Merge remote-tracking branch 'origin/10-use-item-shortcut-client' into server/yubo-dev

main/yubo-dev
Nuno 3 years ago
commit 9517cc7384

@ -314,7 +314,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
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);
CAHManager::getInstance()->parseAH(cur, "onclick_r", "params_r", _AHOnRightClick, _AHRightClickParams);
@ -3798,7 +3793,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;
}

@ -168,7 +168,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).
@ -273,7 +272,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);
if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) != 0) {
getInventory().unequip(invPath);
}
}

@ -33,6 +33,7 @@ namespace INVENTORIES
NL_STRING_CONVERSION_TABLE_ENTRY(handling)
NL_STRING_CONVERSION_TABLE_ENTRY(temporary)
NL_STRING_CONVERSION_TABLE_ENTRY(equipment)
NL_STRING_CONVERSION_TABLE_ENTRY(hotbar)
NL_STRING_CONVERSION_TABLE_ENTRY(bag)
NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal1)
NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal2)
@ -49,7 +50,6 @@ namespace INVENTORIES
NL_STRING_CONVERSION_TABLE_ENTRY(reward_sharing)
NL_STRING_CONVERSION_TABLE_ENTRY(guild)
NL_STRING_CONVERSION_TABLE_ENTRY(player_room)
NL_STRING_CONVERSION_TABLE_ENTRY(hotbar)
NL_END_STRING_CONVERSION_TABLE(TInventory, InventoryToString, UNDEFINED)
@ -95,6 +95,7 @@ namespace INVENTORIES
"TEMP", // temporary
// "", // pick-up
"EQUIP", // equipment
"HOTBAR", // hotbar
"", // bag
"", // pack_animal1
"", // pack_animal2
@ -109,7 +110,6 @@ namespace INVENTORIES
// "", // exchange_proposition
"", // guild
"", // player_room
"HOTBAR", // hotbar
"" // unknown
};

@ -158,8 +158,9 @@ namespace INVENTORIES
handling = 0,
temporary, // 1
equipment, // 2
bag, // 3
pet_animal, // 4 Character can have 7 pack animal
hotbar, // 3
bag, // 4
pet_animal, // 5 Character can have 7 pack animal
pet_animal1 = pet_animal, // for toString => TInventory convertion
pet_animal2,
pet_animal3,
@ -167,18 +168,17 @@ namespace INVENTORIES
pet_animal5,
pet_animal6,
pet_animal7,
max_pet_animal, // 11
NUM_INVENTORY = max_pet_animal, // 11
UNDEFINED = NUM_INVENTORY, // 11
max_pet_animal, // 12
NUM_INVENTORY = max_pet_animal, // 12
UNDEFINED = NUM_INVENTORY, // 12
exchange, // 12 This is not a bug : exchange is a fake inventory
exchange_proposition, // 13 and should not count in the number of inventory
exchange, // 13 This is not a bug : exchange is a fake inventory
exchange_proposition, // 14 and should not count in the number of inventory
// same for botChat trading.
trading, // 14
reward_sharing, // 15 fake inventory, not in database.xml. Used by the item info protocol only
guild, // 16 (warning: number stored in guild saved file)
player_room, // 17
hotbar, // 18
trading, // 15
reward_sharing, // 16 fake inventory, not in database.xml. Used by the item info protocol only
guild, // 17 (warning: number stored in guild saved file)
player_room, // 18
NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY
};

Loading…
Cancel
Save