revert _IsHotbarSlot

10-use-item-shortcut-client
bensaine 3 years ago
parent e7dec3d6b0
commit 7aa639138a

@ -315,7 +315,6 @@ CCtrlSheetInfo::CCtrlSheetInfo()
_ItemSlot= SLOTTYPE::UNDEFINED;
_AutoGrayed= false;
_HasTradeSlotType = false;
_IsHotbarSlot = false;
_BrickOverable= false;
_ReadQuantityFromSheet = false;
_AHOnLeftClick = NULL;
@ -391,10 +390,6 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
prop = (char*) xmlGetProp( cur, (xmlChar*)"use_slot_type_db_entry" );
if (prop)
_HasTradeSlotType= CInterfaceElement::convertBool(prop);
prop = (char*) xmlGetProp( cur, (xmlChar*)"hotbar_slot" );
if (prop)
_IsHotbarSlot= CInterfaceElement::convertBool(prop);
// Read Action handlers
CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams);
@ -3794,7 +3789,8 @@ bool CDBCtrlSheet::canDropItem(CDBCtrlSheet *src) const
bf|= 1<<SLOTTYPE::RIGHT_HAND_EXCLUSIVE;
}
if ( _IsHotbarSlot && getInventory().isUsableItem(src->getSheetId()) )
string invPath = getInventory().getDBIndexPath(src);
if ( strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0 && getInventory().isUsableItem(src->getSheetId()) )
{
return true;
}

@ -169,7 +169,6 @@ public:
// and another in the source slot. Useful for items to buy that are in infinite quantity.
bool _AutoGrayed : 1; // if true then gray the ctrlSheeet if: 1/ Items: Is the Item Locked. 2/ Bricks: is the brick Latent.
bool _HasTradeSlotType : 1; // true is the SLOT_TYPE DB field should be taken in account
bool _IsHotbarSlot : 1; // true if the slot is part of the hotbar
bool _BrickOverable : 1; // if Type is Brick, display like a button (because LeftClickable).
@ -274,7 +273,6 @@ public:
uint32 getItemNameId() const { return (uint32)_NameId.getSInt32();}
// New Stack Size
sint32 getStackable() const { return (_Stackable>1) ? 999 : 1; }
bool isHotbarSlot() const { return _IsHotbarSlot; }
// get non locked quantity (can be zero)
sint32 getNonLockedQuantity() const;

@ -1030,6 +1030,11 @@ void CInventoryManager::equip(const std::string &bagPath, const std::string &inv
inventory = INVENTORIES::equipment;
fromString(invPath.substr(22,invPath.size()), invSlot);
}
else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0)
{
inventory = INVENTORIES::hotbar;
fromString(invPath.substr(23,invPath.size()), invSlot);
}
// Hands management : check if we have to unequip left hand because of incompatibility with right hand item
sint16 oldRightIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16();
@ -1163,6 +1168,11 @@ void CInventoryManager::unequip(const std::string &invPath)
inventory = INVENTORIES::equipment;
fromString(invPath.substr(22,invPath.size()), invSlot);
}
else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0)
{
inventory = INVENTORIES::hotbar;
fromString(invPath.substr(23,invPath.size()), invSlot);
}
// Hands management : check if we have to unequip left hand because of incompatibility with right hand item
if (inventory == INVENTORIES::handling && invSlot == 0)
@ -3113,7 +3123,7 @@ class CHandlerInvDropTo : public IActionHandler
{
CInterfaceGroup *pIG = CWidgetManager::getInstance()->getModalWindow();
if (pIG == NULL) return;
if (pIG->getId() != "ui:interface:bag_choose") return;
if (pIG->getId() != "ui:interface:bag_choose" || pIG->getId() != "ui:interface:hotbar_choose") return;
getInventory().beginDrag(NULL, CInventoryManager::TextList);
// Special case for choose in bag dialog
@ -3275,8 +3285,8 @@ class CHandlerInvCannotDrop : public IActionHandler
if (!getInventory().isDraggingFromTextList())
{
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);
if (!pCSDst->isHotbarSlot()) {
string invPath = getInventory().getDBIndexPath(pCSDst);
string invPath = getInventory().getDBIndexPath(pCSDst);
if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) != 0) {
getInventory().unequip(invPath);
}
}

Loading…
Cancel
Save