[Quest API] Add multiple augment related methods to Perl/Lua. (#1930)

* [Quest API] Add multiple augment related methods to Perl/Lua.
- Add $inventory->CountAugmentEquippedByID(item_id) to Perl.
- Add $inventory->HasAugmentEquippedByID(item_id) to Perl.
- Add $item->ContainsAugmentByID(item_id) to Perl.
- Add $item->CountAugmentByID(item_id) to Perl.
- Add inventory:CountAugmentEquippedByID(item_id) to Perl.
- Add inventory:HasAugmentEquippedByID(item_id) to Perl.
- Add item:ContainsAugmentByID(item_id) to Perl.
- Add item:CountAugmentByID(item_id) to Perl.

* Update inventory_profile.cpp
This commit is contained in:
Kinglykrab
2022-01-16 18:04:51 -05:00
committed by GitHub
parent 5ebbbf647b
commit 3a94132749
10 changed files with 160 additions and 0 deletions
+31
View File
@@ -590,6 +590,37 @@ bool EQ::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Quan
// Checks that user has at least 'quantity' number of items in a given inventory slot
// Returns first slot it was found in, or SLOT_INVALID if not found
bool EQ::InventoryProfile::HasAugmentEquippedByID(uint32 item_id)
{
bool has_equipped = false;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->ContainsAugmentByID(item_id)) {
has_equipped = true;
break;
}
}
return has_equipped;
}
int EQ::InventoryProfile::CountAugmentEquippedByID(uint32 item_id)
{
int quantity = 0;
ItemInstance* item = nullptr;
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
item = GetItem(slot_id);
if (item && item->ContainsAugmentByID(item_id)) {
quantity += item->CountAugmentByID(item_id);
}
}
return quantity;
}
//This function has a flaw in that it only returns the last stack that it looked at
//when quantity is greater than 1 and not all of quantity can be found in 1 stack.
int16 EQ::InventoryProfile::HasItem(uint32 item_id, uint8 quantity, uint8 where)