diff --git a/config.lua.dist b/config.lua.dist index 10105287115..5bf4987ba73 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -346,6 +346,7 @@ freeQuestStage = 1 -- death penalty formula. For the old formula, set it to 10. For -- no skill/experience loss, set it to 0. deathLosePercent = -1 +leavePartyOnDeath = false -- Houses -- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality diff --git a/src/config/config_enums.hpp b/src/config/config_enums.hpp index 85a685cef3e..4a1ca689d29 100644 --- a/src/config/config_enums.hpp +++ b/src/config/config_enums.hpp @@ -127,6 +127,7 @@ enum ConfigKey_t : uint16_t { INVENTORY_GLOW, IP, KICK_AFTER_MINUTES, + LEAVE_PARTY_ON_DEATH, LOCATION, LOGIN_PORT, LOGLEVEL, diff --git a/src/config/configmanager.cpp b/src/config/configmanager.cpp index af7c72c24bc..0b05cc0d87e 100644 --- a/src/config/configmanager.cpp +++ b/src/config/configmanager.cpp @@ -159,6 +159,7 @@ bool ConfigManager::load() { loadBoolConfig(L, WARN_UNSAFE_SCRIPTS, "warnUnsafeScripts", true); loadBoolConfig(L, XP_DISPLAY_MODE, "experienceDisplayRates", true); loadBoolConfig(L, CYCLOPEDIA_HOUSE_AUCTION, "toggleCyclopediaHouseAuction", true); + loadBoolConfig(L, LEAVE_PARTY_ON_DEATH, "leavePartyOnDeath", false); loadFloatConfig(L, BESTIARY_RATE_CHARM_SHOP_PRICE, "bestiaryRateCharmShopPrice", 1.0); loadFloatConfig(L, COMBAT_CHAIN_SKILL_FORMULA_AXE, "combatChainSkillFormulaAxe", 0.9); diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 5443ea2c5dd..201489be31b 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -3852,6 +3852,10 @@ void Player::despawn() { player->vip()->notifyStatusChange(static_self_cast(), VipStatus_t::Pending, false); } + if (m_party && g_configManager().getBoolean(LEAVE_PARTY_ON_DEATH)) { + m_party->leaveParty(static_self_cast()); + } + setDead(true); }