[Bots] Add Quest API Methods (#2631)

* [Bots] Add Quest API Methods

* Cleanup unneeded methods.
This commit is contained in:
Aeadoin
2022-12-12 18:25:36 -05:00
committed by GitHub
parent 13a3afbfac
commit ae4908b40c
7 changed files with 833 additions and 3 deletions
+67
View File
@@ -25,6 +25,10 @@
#include "zonedb.h"
#include "../common/zone_store.h"
#ifdef BOTS
#include "bot.h"
#endif
extern WorldServer worldserver;
// @merth: this needs to be touched up
@@ -4204,3 +4208,66 @@ int EQ::InventoryProfile::GetItemStatValue(uint32 item_id, const char* identifie
safe_delete(inst);
return stat;
}
#ifdef BOTS
// Returns a slot's item ID (returns INVALID_ID if not found)
int32 Bot::GetItemIDAt(int16 slot_id) {
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
return INVALID_ID;
}
else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
return INVALID_ID;
}
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
return INVALID_ID;
}
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
return INVALID_ID;
}
const EQ::ItemInstance* inst = m_inv[slot_id];
if (inst)
return inst->GetItem()->ID;
// None found
return INVALID_ID;
}
// Returns an augment's ID that's in an item (returns INVALID_ID if not found)
// Pass in the slot ID of the item and which augslot you want to check (0-5)
int32 Bot::GetAugmentIDAt(int16 slot_id, uint8 augslot) {
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_id) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
return INVALID_ID;
}
else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
return INVALID_ID;
}
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
return INVALID_ID;
}
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
if (temp_slot >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
return INVALID_ID;
}
const EQ::ItemInstance* inst = m_inv[slot_id];
if (inst && inst->GetAugmentItemID(augslot)) {
return inst->GetAugmentItemID(augslot);
}
// None found
return INVALID_ID;
}
#endif