diff --git a/config.lua.dist b/config.lua.dist index e5188d15b65..481eb37e93b 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -239,6 +239,7 @@ onlyPremiumAccount = false -- NOTE: teleportPlayerToVocationRoom will enable oressa to teleport player to his/her room vocation -- NOTE: toggleReceiveReward = true, will enable players to choose one of reward exercise weapon by command !reward -- NOTE: randomMonsterSpawn = true, will enable monsters from the same spawn to be randomized between them, thus making a variable hunt +-- NOTE: enablePlayerPutItemInAmmoSlot = true, will enable players to put any items on ammo slot, more used in custom shopping system weatherRain = false thunderEffect = false allConsoleLog = false @@ -257,6 +258,7 @@ toggleReceiveReward = false randomMonsterSpawn = false lootPouchMaxLimit = 2000 storeInboxMaxLimit = 2000 +enablePlayerPutItemInAmmoSlot = false -- Teleport summon -- Set to true will never remove the summon diff --git a/src/config/config_enums.hpp b/src/config/config_enums.hpp index 7432f955ff9..341385840c1 100644 --- a/src/config/config_enums.hpp +++ b/src/config/config_enums.hpp @@ -55,6 +55,7 @@ enum ConfigKey_t : uint16_t { DISCORD_WEBHOOK_DELAY_MS, DISCORD_WEBHOOK_URL, EMOTE_SPELLS, + ENABLE_PLAYER_PUT_ITEM_IN_AMMO_SLOT, EXPERIENCE_FROM_PLAYERS, EXP_FROM_PLAYERS_LEVEL_RANGE, EX_ACTIONS_DELAY_INTERVAL, diff --git a/src/config/configmanager.cpp b/src/config/configmanager.cpp index 7842d7b4d88..49624eaa063 100644 --- a/src/config/configmanager.cpp +++ b/src/config/configmanager.cpp @@ -327,6 +327,7 @@ bool ConfigManager::load() { loadIntConfig(L, BUY_AOL_COMMAND_FEE, "buyAolCommandFee", 0); loadIntConfig(L, BUY_BLESS_COMMAND_FEE, "buyBlessCommandFee", 0); loadBoolConfig(L, TELEPORT_PLAYER_TO_VOCATION_ROOM, "teleportPlayerToVocationRoom", true); + loadBoolConfig(L, ENABLE_PLAYER_PUT_ITEM_IN_AMMO_SLOT, "enablePlayerPutItemInAmmoSlot", false); loadBoolConfig(L, TOGGLE_HAZARDSYSTEM, "toogleHazardSystem", true); loadIntConfig(L, HAZARD_CRITICAL_INTERVAL, "hazardCriticalInterval", 2000); diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 0860d7baeda..28460082e73 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -3177,12 +3177,18 @@ ReturnValue Player::queryAdd(int32_t index, const std::shared_ptr &thing, ReturnValue ret = RETURNVALUE_NOERROR; const int32_t &slotPosition = item->getSlotPosition(); - if ((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) || (slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) || (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) || (slotPosition & SLOTP_RING)) { - ret = RETURNVALUE_CANNOTBEDRESSED; - } else if (slotPosition & SLOTP_TWO_HAND) { - ret = RETURNVALUE_PUTTHISOBJECTINBOTHHANDS; - } else if ((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) { - ret = RETURNVALUE_CANNOTBEDRESSED; + + bool allowPutItemsOnAmmoSlot = g_configManager().getBoolean(ENABLE_PLAYER_PUT_ITEM_IN_AMMO_SLOT, __FUNCTION__); + if (allowPutItemsOnAmmoSlot && index == CONST_SLOT_AMMO) { + ret = RETURNVALUE_NOERROR; + } else { + if ((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) || (slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) || (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) || (slotPosition & SLOTP_RING)) { + ret = RETURNVALUE_CANNOTBEDRESSED; + } else if (slotPosition & SLOTP_TWO_HAND) { + ret = RETURNVALUE_PUTTHISOBJECTINBOTHHANDS; + } else if ((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) { + ret = RETURNVALUE_CANNOTBEDRESSED; + } } switch (index) { @@ -3324,8 +3330,12 @@ ReturnValue Player::queryAdd(int32_t index, const std::shared_ptr &thing, } case CONST_SLOT_AMMO: { - if ((slotPosition & SLOTP_AMMO)) { + if (allowPutItemsOnAmmoSlot) { ret = RETURNVALUE_NOERROR; + } else { + if ((slotPosition & SLOTP_AMMO)) { + ret = RETURNVALUE_NOERROR; + } } break; }