From 6e02936226f6251089d01b5a70d144ac5dce2594 Mon Sep 17 00:00:00 2001 From: Alejandro Mujica Date: Tue, 5 Feb 2019 12:51:39 -0400 Subject: [PATCH] Added config option"queryPlayerContainers" This option should allow you to query every player container for an available slot. --- config.lua | 1 + src/configmanager.cpp | 1 + src/configmanager.h | 1 + src/player.cpp | 18 +++++++++++------- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/config.lua b/config.lua index 538791f..2974f71 100644 --- a/config.lua +++ b/config.lua @@ -69,6 +69,7 @@ freePremium = false kickIdlePlayerAfterMinutes = 15 maxMessageBuffer = 4 showMonsterLoot = false +queryPlayerContainers = false -- Character Rooking -- Level threshold is the level requirement to teleport players back to newbie town diff --git a/src/configmanager.cpp b/src/configmanager.cpp index b61e306..d1e60c4 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -77,6 +77,7 @@ bool ConfigManager::load() boolean[CONVERT_UNSAFE_SCRIPTS] = getGlobalBoolean(L, "convertUnsafeScripts", true); boolean[TELEPORT_NEWBIES] = getGlobalBoolean(L, "teleportNewbies", true); boolean[STACK_CUMULATIVES] = getGlobalBoolean(L, "autoStackCumulatives", false); + boolean[QUERY_PLAYER_CONTAINERS] = getGlobalBoolean(L, "queryPlayerContainers", false); string[DEFAULT_PRIORITY] = getGlobalString(L, "defaultPriority", "high"); string[SERVER_NAME] = getGlobalString(L, "serverName", ""); diff --git a/src/configmanager.h b/src/configmanager.h index 04c3a3b..93fa8a2 100644 --- a/src/configmanager.h +++ b/src/configmanager.h @@ -40,6 +40,7 @@ class ConfigManager CONVERT_UNSAFE_SCRIPTS, TELEPORT_NEWBIES, STACK_CUMULATIVES, + QUERY_PLAYER_CONTAINERS, LAST_BOOLEAN_CONFIG /* this must be the last one */ }; diff --git a/src/player.cpp b/src/player.cpp index bd2dab8..a538cb9 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -2297,11 +2297,13 @@ Cylinder* Player::queryDestination(int32_t& index, const Thing& thing, Item** de n--; } - /*for (Item* tmpContainerItem : tmpContainer->getItemList()) { - if (Container* subContainer = tmpContainerItem->getContainer()) { - containers.push_back(subContainer); + if (g_config.getBoolean(ConfigManager::QUERY_PLAYER_CONTAINERS)) { + for (Item* tmpContainerItem : tmpContainer->getItemList()) { + if (Container* subContainer = tmpContainerItem->getContainer()) { + containers.push_back(subContainer); + } } - }*/ + } continue; } @@ -2324,9 +2326,11 @@ Cylinder* Player::queryDestination(int32_t& index, const Thing& thing, Item** de return tmpContainer; } - /*if (Container* subContainer = tmpItem->getContainer()) { - containers.push_back(subContainer); - }*/ + if (g_config.getBoolean(ConfigManager::QUERY_PLAYER_CONTAINERS)) { + if (Container* subContainer = tmpItem->getContainer()) { + containers.push_back(subContainer); + } + } n++; }