Merge branch 'main/gingo-test' into server/gingo-test

main/yubo-dev
Nuno 3 years ago
commit 7120bd6583

@ -562,7 +562,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
//=====================================================================================================================
static void sendExchangeAddToServer(uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc)
static void sendExchangeAddToServer(uint16 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->getSecondIndexInDB(), (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->getSecondIndexInDB(), (uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val);
}
}
}
@ -746,6 +747,10 @@ public:
CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src);
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pElt);
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);
// end drag
getInventory().endDrag();
if ((pCSSrc == NULL) || (pCSDst == NULL)) return;
if (pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item)
@ -1049,9 +1054,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))
{
@ -1868,7 +1885,7 @@ class CHandlerItemMenuCheck : public IActionHandler
}
if (pItemTextDisplay && pIS->Family == ITEMFAMILY::SCROLL)
{
if (pCS->getInventoryIndex()==INVENTORIES::bag)
if (pCS->getInventoryIndex()==INVENTORIES::bag && pIS->Scroll.Label.empty())
pItemTextDisplay->setActive(true);
pItemInfos->setActive(false);
}

@ -2903,32 +2903,6 @@ class CHandlerInvCanDropTo : public IActionHandler
if ((pListDstText != NULL) || (pListDstIcon != NULL))
{
bool bCanDrop = true;
// WE CANT DND if we want to dnd from other bag than BAG to guild bag
if (pListDstIcon != NULL)
{
if (pListDstIcon->getInvType() == CInventoryManager::InvGuild)
if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0)
bCanDrop = false;
}
if (pListDstText != NULL)
{
if (pListDstText->getInvType() == CInventoryManager::InvGuild)
if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0)
bCanDrop = false;
}
// WE CANT DND if we want to dnd from guild bag to other bag than BAG
if (pListDstIcon != NULL)
{
if (pListDstIcon->getInvType() != CInventoryManager::InvBag)
if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0)
bCanDrop = false;
}
if (pListDstText != NULL)
{
if (pListDstText->getInvType() != CInventoryManager::InvBag)
if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0)
bCanDrop = false;
}
// WE CANT DND when packer/mount is too far
if (pListDstIcon != NULL)
@ -3100,7 +3074,6 @@ class CHandlerInvDropTo : public IActionHandler
else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvGuild)) ||
((pListDstIcon != NULL) && (pListDstIcon->getInvType() == CInventoryManager::InvGuild)))
{
if (strnicmp(pCSSrc->getSheet().c_str(), "LOCAL:INVENTORY:BAG", 19) == 0)
CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_guild");
}
else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvRoom)) ||

@ -1630,7 +1630,7 @@ const char *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetI
const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, bool women)
{
vector<string> listInfos = getTitleInfos(titleId, women);
if (!listInfos.empty())
{
_TitleWords.push_back(listInfos[0]);
@ -1681,7 +1681,19 @@ vector<string> CStringManagerClient::getTitleInfos(const string &titleId, bool w
{
if (titleId[0] != '#')
{
listInfos[0] = getSpecialWord(listInfos[0], women);
// Check special case like SON_OF|jane|joe (with SON_OF = "Son of {1} and {2}")
vector<string> titleReps;
splitString(listInfos[0], string("|"), titleReps);
if (titleReps.size() > 1)
{
listInfos[0] = getSpecialWord(titleReps[0], women);
for(uint i=1; i < titleReps.size(); ++i )
{
while(strFindReplace(listInfos[0], toString("{%d}", i), titleReps[i]));
}
}
else
listInfos[0] = getSpecialWord(listInfos[0], women);
}
}

Loading…
Cancel
Save