diff --git a/config.lua b/config.lua index 42dfdcc..14083a9 100644 --- a/config.lua +++ b/config.lua @@ -5,6 +5,7 @@ paladinRangeAttackDamageIncreasePercent = 15 -- Min/Max rate spawn is a multiplication of the map spawntime in spawns.xml Regular monster spawn time is 600. The formula would be randomValue = random(600*100, 600*200) which varies between 60s and 120s minRateSpawn = 100 maxRateSpawn = 200 +corpseOwnerEnabled = false -- Combat settings -- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced" diff --git a/src/actions.cpp b/src/actions.cpp index e1c4113..6e9d108 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -277,9 +277,11 @@ ReturnValue Actions::internalUseItem(Player* player, const Position& pos, uint8_ openContainer = container; } - uint32_t corpseOwner = container->getCorpseOwner(); - if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) { - return RETURNVALUE_YOUARENOTTHEOWNER; + if (g_config.getBoolean(ConfigManager::CORPSE_OWNER_ENABLED)) { + uint32_t corpseOwner = container->getCorpseOwner(); + if (corpseOwner != 0 && !player->canOpenCorpse(corpseOwner)) { + return RETURNVALUE_YOUARENOTTHEOWNER; + } } //open/close container diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 0d16691..1f68256 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -112,6 +112,7 @@ bool ConfigManager::load() integer[DEATH_LOSE_PERCENT] = getGlobalNumber(L, "deathLosePercent", -1); integer[KNIGHT_CLOSE_ATTACK_DAMAGE_INCREASE_PERCENT] = getGlobalNumber(L, "knightCloseAttackDamageIncreasePercent", -1); integer[PALADIN_RANGE_ATTACK_DAMAGE_INCREASE_PERCENT] = getGlobalNumber(L, "paladinRangeAttackDamageIncreasePercent", -1); + integer[CORPSE_OWNER_ENABLED] = getGlobalBoolean(L, "corpseOwnerEnabled", true); integer[STATUSQUERY_TIMEOUT] = getGlobalNumber(L, "statusTimeout", 5000); integer[WHITE_SKULL_TIME] = getGlobalNumber(L, "whiteSkullTime", 15 * 60); integer[RED_SKULL_TIME] = getGlobalNumber(L, "redSkullTime", 30 * 24 * 60 * 60); diff --git a/src/configmanager.h b/src/configmanager.h index 3caa4fa..181002c 100644 --- a/src/configmanager.h +++ b/src/configmanager.h @@ -49,6 +49,7 @@ class ConfigManager BLOCK_HEIGHT, DROP_ITEMS, DISTANCE_WEAPONS_DROP_ON_GROUND, + CORPSE_OWNER_ENABLED, LAST_BOOLEAN_CONFIG /* this must be the last one */ }; diff --git a/src/monster.h b/src/monster.h index 0c7b6a5..d44e8ec 100644 --- a/src/monster.h +++ b/src/monster.h @@ -22,12 +22,15 @@ #include "tile.h" #include "monsters.h" +#include "configmanager.h" class Creature; class Game; class Spawn; class Combat; +extern ConfigManager g_config; + typedef std::unordered_set CreatureHashSet; typedef std::list CreatureList; @@ -257,6 +260,13 @@ class Monster final : public Creature return skillLoss ? mType->info.experience : 0; } uint16_t getLookCorpse() const final { + if (!g_config.getBoolean(ConfigManager::CORPSE_OWNER_ENABLED)) { + const ItemType& itemtype = Item::items[mType->info.lookcorpse]; + if (itemtype.decayTo != 0) { + return itemtype.decayTo; + } + } + return mType->info.lookcorpse; } void dropLoot(Container* corpse, Creature* lastHitCreature) final;