Some work on implementing slot selection

This commit is contained in:
KimLS
2015-04-06 16:53:12 -07:00
parent 279ed8d86c
commit 7341ecc185
3 changed files with 110 additions and 112 deletions
+44
View File
@@ -506,6 +506,50 @@ bool EQEmu::Inventory::PopFromCursorBuffer() {
return false;
}
EQEmu::InventorySlot EQEmu::Inventory::PutItemInInventory(std::shared_ptr<ItemInstance> inst, bool try_worn, bool try_cursor) {
return EQEmu::InventorySlot();
}
EQEmu::InventorySlot EQEmu::Inventory::FindFreeSlot(bool for_bag, bool try_cursor, int min_size, bool is_arrow) {
//check basic inventory
for(int i = EQEmu::PersonalSlotGeneral1; i < EQEmu::PersonalSlotGeneral10; ++i) {
EQEmu::InventorySlot slot(EQEmu::InvTypePersonal, i);
if(!Get(slot)) {
return slot;
}
}
if (!for_bag) {
for(int i = EQEmu::PersonalSlotGeneral1; i < EQEmu::PersonalSlotGeneral10; ++i) {
EQEmu::InventorySlot slot(EQEmu::InvTypePersonal, i);
auto inst = Get(slot);
if(inst && inst->GetBaseItem()->ItemClass == ItemClassContainer && inst->GetBaseItem()->BagSize >= min_size)
{
if(inst->GetBaseItem()->BagType == BagTypeQuiver && !is_arrow)
{
continue;
}
int slots = inst->GetBaseItem()->BagSlots;
for(int b_i = 0; b_i < slots; ++b_i) {
EQEmu::InventorySlot bag_slot(EQEmu::InvTypePersonal, i, b_i);
if(!Get(bag_slot)) {
return bag_slot;
}
}
}
}
}
if(try_cursor) {
EQEmu::InventorySlot slot(EQEmu::InvTypePersonal, EQEmu::PersonalSlotCursor);
}
return EQEmu::InventorySlot();
}
int EQEmu::Inventory::CalcMaterialFromSlot(const InventorySlot &slot) {
if(slot.Type() != 0)
return _MaterialInvalid;
+2 -2
View File
@@ -37,7 +37,7 @@ namespace EQEmu
InvTypeGuildTribute
};
enum PersonaInventorylSlot : int
enum PersonaInventorySlot : int
{
PersonalSlotCharm = 0,
PersonalSlotEar1,
@@ -139,8 +139,8 @@ namespace EQEmu
bool Summon(const InventorySlot &slot, std::shared_ptr<ItemInstance> inst);
bool PushToCursorBuffer(std::shared_ptr<ItemInstance> inst);
bool PopFromCursorBuffer();
bool PutStackInInventory(std::shared_ptr<ItemInstance> inst, bool try_worn, bool try_cursor);
InventorySlot PutItemInInventory(std::shared_ptr<ItemInstance> inst, bool try_worn, bool try_cursor);
InventorySlot FindFreeSlot(bool for_bag, bool try_cursor, int min_size = 0, bool is_arrow = false);
//utility
static int CalcMaterialFromSlot(const InventorySlot &slot);