From c56d2e136d3f24c8b5dd93c84b368bcdcf96dd52 Mon Sep 17 00:00:00 2001 From: ulukyn Date: Wed, 27 Jun 2018 15:40:35 +0200 Subject: [PATCH] Changed: Increse MAX_INVENTORY_ANIMAL to 7 to add 3 pets companions (ingame named ZIGs) --HG-- branch : patches-from-atys --- .../client/src/interface_v3/dbctrl_sheet.cpp | 8 ++- .../src/interface_v3/inventory_manager.cpp | 60 +++++++++++++++---- .../src/interface_v3/inventory_manager.h | 2 +- code/ryzom/common/data_common/database.xml | 18 +++--- .../common/src/game_share/inventories.cpp | 18 +++++- .../ryzom/common/src/game_share/inventories.h | 29 +++++---- 6 files changed, 98 insertions(+), 37 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 0533441cf..a1ab7b318 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -902,7 +902,7 @@ uint CDBCtrlSheet::getInventorySlot( const string &dbBranchId ) return INVENTORIES::bag; break; case 'P': - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); if( strncmp( "PACK_ANIMAL", szName2, 11 ) ) break; switch( szName2[11] ) @@ -915,6 +915,12 @@ uint CDBCtrlSheet::getInventorySlot( const string &dbBranchId ) return INVENTORIES::pet_animal3; case '3': return INVENTORIES::pet_animal4; + case '4': + return INVENTORIES::pet_animal5; + case '5': + return INVENTORIES::pet_animal6; + case '6': + return INVENTORIES::pet_animal7; default: break; } diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 5f9ff2d3b..e4ce2b6e9 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -80,6 +80,9 @@ const std::string CInventoryManager::InventoryDBs[]= "INVENTORY:PACK_ANIMAL1", "INVENTORY:PACK_ANIMAL2", "INVENTORY:PACK_ANIMAL3", + "INVENTORY:PACK_ANIMAL4", + "INVENTORY:PACK_ANIMAL5", + "INVENTORY:PACK_ANIMAL6", "INVENTORY:TEMP", "EXCHANGE:GIVE", "EXCHANGE:RECEIVE", @@ -92,7 +95,7 @@ const std::string CInventoryManager::InventoryDBs[]= static void dummyCheck() { // if this raise, correct the 2 tables above and below - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); } const uint CInventoryManager::InventoryIndexes[]= @@ -103,6 +106,9 @@ const uint CInventoryManager::InventoryIndexes[]= INVENTORIES::pet_animal2, INVENTORIES::pet_animal3, INVENTORIES::pet_animal4, + INVENTORIES::pet_animal5, + INVENTORIES::pet_animal6, + INVENTORIES::pet_animal7, INVENTORIES::temporary, INVENTORIES::exchange, INVENTORIES::exchange_proposition, @@ -1511,7 +1517,7 @@ void CInventoryManager::getBranchSlotCounts(const std::string &basePath, uint& n // *************************************************************************** double CInventoryManager::getBagBulk(uint32 inventoryIndex) { - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); if (inventoryIndex == 0) return getBranchBulk(LOCAL_INVENTORY ":BAG", 0, MAX_BAGINV_ENTRIES); else if (inventoryIndex == 1) @@ -1523,10 +1529,16 @@ double CInventoryManager::getBagBulk(uint32 inventoryIndex) else if (inventoryIndex == 4) return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL3", 0, MAX_ANIMALINV_ENTRIES); else if (inventoryIndex == 5) - return 0; + return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL4", 0, MAX_ANIMALINV_ENTRIES); else if (inventoryIndex == 6) - return 0; + return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL5", 0, MAX_ANIMALINV_ENTRIES); else if (inventoryIndex == 7) + return getBranchBulk(LOCAL_INVENTORY ":PACK_ANIMAL6", 0, MAX_ANIMALINV_ENTRIES); + else if (inventoryIndex == 8) + return 0; + else if (inventoryIndex == 9) + return 0; + else if (inventoryIndex == 10) return getBranchBulk(LOCAL_INVENTORY ":TEMP", 0, MAX_TEMPINV_ENTRIES); return 0; } @@ -1543,7 +1555,7 @@ double CInventoryManager::getItemBulk(uint32 sheetID) // *************************************************************************** double CInventoryManager::getMaxBagBulk(uint32 inventoryIndex) { - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); CInterfaceManager *pIM = CInterfaceManager::getInstance(); CCDBNodeLeaf *pNL=NULL; if (inventoryIndex == 0) @@ -1556,6 +1568,12 @@ double CInventoryManager::getMaxBagBulk(uint32 inventoryIndex) pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST2:BULK_MAX"); else if (inventoryIndex == 4) pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST3:BULK_MAX"); + else if (inventoryIndex == 5) + pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST4:BULK_MAX"); + else if (inventoryIndex == 6) + pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST5:BULK_MAX"); + else if (inventoryIndex == 7) + pNL = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:PACK_ANIMAL:BEAST6:BULK_MAX"); if (pNL != NULL) return pNL->getValue32(); return 0; @@ -2756,7 +2774,10 @@ class CHandlerInvCanDropTo : public IActionHandler if ((pListDstIcon->getInvType() == CInventoryManager::InvPA0) || (pListDstIcon->getInvType() == CInventoryManager::InvPA1) || (pListDstIcon->getInvType() == CInventoryManager::InvPA2) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA3)) + (pListDstIcon->getInvType() == CInventoryManager::InvPA3) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA4) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA5) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA6)) { INVENTORIES::TInventory e = (INVENTORIES::TInventory)(INVENTORIES::pet_animal1 + (pListDstIcon->getInvType()-CInventoryManager::InvPA0)); if (!pInv->isInventoryAvailable(e)) @@ -2768,7 +2789,10 @@ class CHandlerInvCanDropTo : public IActionHandler if ((pListDstText->getInvType() == CInventoryManager::InvPA0) || (pListDstText->getInvType() == CInventoryManager::InvPA1) || (pListDstText->getInvType() == CInventoryManager::InvPA2) || - (pListDstText->getInvType() == CInventoryManager::InvPA3)) + (pListDstText->getInvType() == CInventoryManager::InvPA3) || + (pListDstText->getInvType() == CInventoryManager::InvPA4) || + (pListDstText->getInvType() == CInventoryManager::InvPA5) || + (pListDstText->getInvType() == CInventoryManager::InvPA6)) { INVENTORIES::TInventory e = (INVENTORIES::TInventory)(INVENTORIES::pet_animal1 + (pListDstText->getInvType()-CInventoryManager::InvPA0)); if (!pInv->isInventoryAvailable(e)) @@ -2891,17 +2915,24 @@ class CHandlerInvDropTo : public IActionHandler else if (((pListDstText != NULL) && ((pListDstText->getInvType() == CInventoryManager::InvPA0) || (pListDstText->getInvType() == CInventoryManager::InvPA1) || (pListDstText->getInvType() == CInventoryManager::InvPA2) || - (pListDstText->getInvType() == CInventoryManager::InvPA3) + (pListDstText->getInvType() == CInventoryManager::InvPA3) || + (pListDstText->getInvType() == CInventoryManager::InvPA4) || + (pListDstText->getInvType() == CInventoryManager::InvPA5) || + (pListDstText->getInvType() == CInventoryManager::InvPA6) )) || ((pListDstIcon != NULL) && ((pListDstIcon->getInvType() == CInventoryManager::InvPA0) || (pListDstIcon->getInvType() == CInventoryManager::InvPA1) || (pListDstIcon->getInvType() == CInventoryManager::InvPA2) || - (pListDstIcon->getInvType() == CInventoryManager::InvPA3) + (pListDstIcon->getInvType() == CInventoryManager::InvPA3) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA4) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA5) || + (pListDstIcon->getInvType() == CInventoryManager::InvPA6) ))) { string sTmp; if (pListDstText != NULL) sTmp = toString("%d",pListDstText->getInvType()-CInventoryManager::InvPA0); if (pListDstIcon != NULL) sTmp = toString("%d",pListDstIcon->getInvType()-CInventoryManager::InvPA0); + nlinfo("ici :%s", sTmp.c_str()); CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_pa|"+sTmp); } else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvGuild)) || @@ -3084,7 +3115,7 @@ class CHandlerInvTempAll : public IActionHandler vector > BagsBulk; BagsBulk.push_back(pair (pInv->getBagBulk(0), pInv->getMaxBagBulk(0))); - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); if (pInv->isInventoryAvailable(INVENTORIES::pet_animal1)) BagsBulk.push_back(pair (pInv->getBagBulk(1), pInv->getMaxBagBulk(1))); if (pInv->isInventoryAvailable(INVENTORIES::pet_animal2)) @@ -3093,6 +3124,12 @@ class CHandlerInvTempAll : public IActionHandler BagsBulk.push_back(pair (pInv->getBagBulk(3), pInv->getMaxBagBulk(3))); if (pInv->isInventoryAvailable(INVENTORIES::pet_animal4)) BagsBulk.push_back(pair (pInv->getBagBulk(4), pInv->getMaxBagBulk(4))); + if (pInv->isInventoryAvailable(INVENTORIES::pet_animal5)) + BagsBulk.push_back(pair (pInv->getBagBulk(5), pInv->getMaxBagBulk(4))); + if (pInv->isInventoryAvailable(INVENTORIES::pet_animal6)) + BagsBulk.push_back(pair (pInv->getBagBulk(6), pInv->getMaxBagBulk(4))); + if (pInv->isInventoryAvailable(INVENTORIES::pet_animal7)) + BagsBulk.push_back(pair (pInv->getBagBulk(7), pInv->getMaxBagBulk(4))); bool bPlaceFound = true; @@ -3675,6 +3712,9 @@ CInventoryManager::TInvType CInventoryManager::invTypeFromString(const string &s if (sTmp == "inv_pa1") return InvPA1; if (sTmp == "inv_pa2") return InvPA2; if (sTmp == "inv_pa3") return InvPA3; + if (sTmp == "inv_pa4") return InvPA4; + if (sTmp == "inv_pa5") return InvPA5; + if (sTmp == "inv_pa6") return InvPA6; if (sTmp == "inv_guild") return InvGuild; if (sTmp == "inv_room") return InvRoom; return InvUnknown; diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.h b/code/ryzom/client/src/interface_v3/inventory_manager.h index 364874f36..0fa6fd2ee 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.h +++ b/code/ryzom/client/src/interface_v3/inventory_manager.h @@ -291,7 +291,7 @@ public: bool isInventoryEmpty (INVENTORIES::TInventory invId); - enum TInvType { InvBag, InvPA0, InvPA1, InvPA2, InvPA3, InvGuild, InvRoom, InvUnknown }; + enum TInvType { InvBag, InvPA0, InvPA1, InvPA2, InvPA3, InvPA4, InvPA5, InvPA6, InvGuild, InvRoom, InvUnknown }; static TInvType invTypeFromString(const std::string &str); diff --git a/code/ryzom/common/data_common/database.xml b/code/ryzom/common/data_common/database.xml index 8cdcf1f31..6c3780d65 100644 --- a/code/ryzom/common/data_common/database.xml +++ b/code/ryzom/common/data_common/database.xml @@ -90,7 +90,7 @@ type="I32" /> + count="7"> @@ -504,7 +504,7 @@ @@ -602,7 +602,7 @@ type="I1" /> - - + count="7"> @@ -1292,7 +1292,7 @@ - + count="7"> diff --git a/code/ryzom/common/src/game_share/inventories.cpp b/code/ryzom/common/src/game_share/inventories.cpp index 4166734b5..6f58216a3 100644 --- a/code/ryzom/common/src/game_share/inventories.cpp +++ b/code/ryzom/common/src/game_share/inventories.cpp @@ -38,6 +38,9 @@ namespace INVENTORIES NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal2) NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal3) NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal4) + NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal5) + NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal6) + NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal7) // NL_STRING_CONVERSION_TABLE_ENTRY(bot_gift) NL_STRING_CONVERSION_TABLE_ENTRY(UNDEFINED) NL_STRING_CONVERSION_TABLE_ENTRY(exchange) @@ -52,7 +55,7 @@ namespace INVENTORIES const std::string& toString( TInventory inv ) { // if this raise, correct the table above - nlctassert(MAX_INVENTORY_ANIMAL==4); + nlctassert(MAX_INVENTORY_ANIMAL==7); return InventoryToString.toString(inv); } @@ -72,6 +75,12 @@ namespace INVENTORIES inv = pet_animal3; else if (str == "pack_animal4") inv = pet_animal4; + else if (str == "pack_animal5") + inv = pet_animal5; + else if (str == "pack_animal6") + inv = pet_animal6; + else if (str == "pack_animal7") + inv = pet_animal7; } return inv; @@ -90,6 +99,9 @@ namespace INVENTORIES "", // pack_animal2 "", // pack_animal3 "", // pack_animal4 + "", // pack_animal5 + "", // pack_animal6 + "", // pack_animal7 "", // harvest // "", // bot_gift "", // exchange @@ -102,9 +114,9 @@ namespace INVENTORIES // const char *CInventoryCategoryForCharacter::InventoryStr [CInventoryCategoryForCharacter::NbInventoryIds] = - { "BAG", "PACK_ANIMAL0", "PACK_ANIMAL1", "PACK_ANIMAL2", "PACK_ANIMAL3", "ROOM" }; + { "BAG", "PACK_ANIMAL0", "PACK_ANIMAL1", "PACK_ANIMAL2", "PACK_ANIMAL3", "PACK_ANIMAL4", "PACK_ANIMAL5", "PACK_ANIMAL6", "ROOM" }; const uint CInventoryCategoryForCharacter::InventoryNbSlots [CInventoryCategoryForCharacter::NbInventoryIds] = - { NbBagSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbRoomSlots }; + { NbBagSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbRoomSlots }; // Other values to change according to these InventoryNbSlots: // - game_share.h/inventories.h: CInventoryCategoryForCharacter::SlotBitSize // - data_common/database.xml: INVENTORY:BAG count diff --git a/code/ryzom/common/src/game_share/inventories.h b/code/ryzom/common/src/game_share/inventories.h index 83230fc41..297b97656 100644 --- a/code/ryzom/common/src/game_share/inventories.h +++ b/code/ryzom/common/src/game_share/inventories.h @@ -34,8 +34,8 @@ WARNING!!!!! If you change MAX_INVENTORY_ANIMAL value, you'll have to: * ******/ #define MAX_PACK_ANIMAL 3 #define MAX_MEKTOUB_MOUNT 1 -#define MAX_OTHER_PET 0 -#define MAX_INVENTORY_ANIMAL ( MAX_PACK_ANIMAL + MAX_MEKTOUB_MOUNT ) +#define MAX_OTHER_PET 3 +#define MAX_INVENTORY_ANIMAL ( MAX_PACK_ANIMAL + MAX_MEKTOUB_MOUNT + MAX_OTHER_PET) // This give by which value the WEIGHT in database must be divided to get the value in Kg // valueKg= valueDb / DB_WEIGHT_SCALE @@ -159,22 +159,25 @@ namespace INVENTORIES temporary, // 1 equipment, // 2 bag, // 3 - pet_animal, // 4 Character can have 5 pack animal + pet_animal, // 4 Character can have 7 pack animal pet_animal1 = pet_animal, // for toString => TInventory convertion pet_animal2, pet_animal3, pet_animal4, - max_pet_animal, // 8 - NUM_INVENTORY = max_pet_animal, // 8 - UNDEFINED = NUM_INVENTORY, // 8 - - exchange, // 9 This is not a bug : exchange is a fake inventory - exchange_proposition, // 10 and should not count in the number of inventory + pet_animal5, + pet_animal6, + pet_animal7, + max_pet_animal, // 10 + NUM_INVENTORY = max_pet_animal, // 10 + UNDEFINED = NUM_INVENTORY, // 10 + + exchange, // 11 This is not a bug : exchange is a fake inventory + exchange_proposition, // 12 and should not count in the number of inventory // same for botChat trading. - trading, // 11 - reward_sharing, // 12 fake inventory, not in database.xml. Used by the item info protocol only - guild, // 13 (warning: number stored in guild saved file) - player_room, // 14 + trading, // 13 + reward_sharing, // 14 fake inventory, not in database.xml. Used by the item info protocol only + guild, // 15 (warning: number stored in guild saved file) + player_room, // 16 NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY };