From c3a633ae507670c29969d8d5520d115a01d33e6f Mon Sep 17 00:00:00 2001 From: bensaine Date: Sun, 21 Nov 2021 00:33:15 -0500 Subject: [PATCH 1/2] add: srcInvIndex --- .../src/interface_v3/action_handler_item.cpp | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 9bbf9fbc8..af962e918 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -562,7 +562,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet //===================================================================================================================== - static void sendExchangeAddToServer(uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc) + static void sendExchangeAddToServer(unint16 srcInvIndex, uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -571,6 +571,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out)) { // Swap all the Src (quantity= quantitySrc) to dest + out.serial(srcInvIndex); out.serial(srcSlotIndex); out.serial(destSlotIndex); out.serial(quantitySrc); @@ -615,7 +616,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0); // send msg to server - sendExchangeAddToServer((uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc); + sendExchangeAddToServer((uint16) src->getInventoryIndex(), (uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc); } else { @@ -725,7 +726,7 @@ static void validateStackItem(CDBCtrlSheet *pCSSrc, CDBCtrlSheet *pCSDst, sint32 NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0); // send msg to server - sendExchangeAddToServer((uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val); + sendExchangeAddToServer((uint16)pCSSrc->getInventoryIndex(), (uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val); } } } @@ -1049,9 +1050,21 @@ class CCanDropToExchange : public IActionHandler if (!pCSSrc || !pCSDst) return; // Exchange can only be done from bag to exchange inventories - - if (pCSSrc->getSecondIndexInDB() == INVENTORIES::bag && - pCSDst->getSecondIndexInDB() == INVENTORIES::exchange) + uint32 srcInventory = pCSSrc->getSecondIndexInDB(); + if ( + (srcInventory == INVENTORIES::bag || + srcInventory == INVENTORIES::pet_animal1 || + srcInventory == INVENTORIES::pet_animal2 || + srcInventory == INVENTORIES::pet_animal3 || + srcInventory == INVENTORIES::pet_animal4 || + srcInventory == INVENTORIES::pet_animal5 || + srcInventory == INVENTORIES::pet_animal6 || + srcInventory == INVENTORIES::pet_animal7 || + srcInventory == INVENTORIES::guild || + srcInventory == INVENTORIES::player_room) + && getInventory().isInventoryAvailable((INVENTORIES::TInventory) pCSSrc->getSecondIndexInDB()) + && pCSDst->getSecondIndexInDB() == INVENTORIES::exchange + ) { if (checkCanExchangeItem(pCSSrc)) { From e1527b724b47ce2fb0f286a74894c93e4302d6d1 Mon Sep 17 00:00:00 2001 From: bensaine Date: Sun, 21 Nov 2021 01:09:53 -0500 Subject: [PATCH 2/2] fix: typo --- ryzom/client/src/interface_v3/action_handler_item.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index af962e918..46171b6c1 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -562,7 +562,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet //===================================================================================================================== - static void sendExchangeAddToServer(unint16 srcInvIndex, uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc) + static void sendExchangeAddToServer(uint16 srcInvIndex, uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); @@ -616,7 +616,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0); // send msg to server - sendExchangeAddToServer((uint16) src->getInventoryIndex(), (uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc); + sendExchangeAddToServer((uint16) src->getSecondIndexInDB(), (uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc); } else { @@ -726,7 +726,7 @@ static void validateStackItem(CDBCtrlSheet *pCSSrc, CDBCtrlSheet *pCSDst, sint32 NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0); // send msg to server - sendExchangeAddToServer((uint16)pCSSrc->getInventoryIndex(), (uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val); + sendExchangeAddToServer((uint16)pCSSrc->getSecondIndexInDB(), (uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val); } } }