From b75e6308ddbc6b6e0d5b29f48921d0055b94aa07 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 17 Feb 2015 13:42:21 -0800 Subject: [PATCH] Renamed Inventory to InventoryOld --- common/database.cpp | 2 +- common/database.h | 4 +- common/item.cpp | 166 ++++++++++++++++++++-------------------- common/item.h | 10 +-- common/patches/rof.cpp | 4 +- common/patches/rof2.cpp | 4 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/uf.cpp | 2 +- common/shareddb.cpp | 24 +++--- common/shareddb.h | 10 +-- world/client.cpp | 2 +- world/worlddb.cpp | 6 +- zone/bonuses.cpp | 4 +- zone/bot.cpp | 14 ++-- zone/bot.h | 4 +- zone/client.cpp | 4 +- zone/client.h | 6 +- zone/client_packet.cpp | 4 +- zone/command.cpp | 10 +-- zone/corpse.cpp | 10 +-- zone/inventory.cpp | 58 +++++++------- zone/lua_inventory.cpp | 2 +- zone/lua_inventory.h | 12 +-- zone/merc.cpp | 2 +- zone/merc.h | 2 +- zone/mob.cpp | 6 +- zone/npc.cpp | 4 +- zone/tradeskills.cpp | 14 ++-- zone/trading.cpp | 22 +++--- zone/zone.cpp | 2 +- 31 files changed, 209 insertions(+), 209 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 31566d82f..9b64c79f3 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -677,7 +677,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe } /* This only for new Character creation storing */ -bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) { +bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, InventoryOld* inv) { uint32 charid = 0; char zone[50]; float x, y, z; diff --git a/common/database.h b/common/database.h index f3b8ba8c1..b28fd4d8f 100644 --- a/common/database.h +++ b/common/database.h @@ -36,7 +36,7 @@ //atoi is not uint32 or uint32 safe!!!! #define atoul(str) strtoul(str, nullptr, 10) -class Inventory; +class InventoryOld; class MySQLRequestResult; class Client; @@ -102,7 +102,7 @@ public: bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked); bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone); - bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv); + bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, InventoryOld* inv); bool UpdateName(const char* oldname, const char* newname); /* General Information Queries */ diff --git a/common/item.cpp b/common/item.cpp index 0e2f0f574..e5252a9d0 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -105,9 +105,9 @@ ItemInst* ItemInstQueue::peek_front() const // -// class Inventory +// class InventoryOld // -Inventory::~Inventory() +InventoryOld::~InventoryOld() { for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { safe_delete(iter->second); @@ -135,7 +135,7 @@ Inventory::~Inventory() m_trade.clear(); } -void Inventory::CleanDirty() { +void InventoryOld::CleanDirty() { auto iter = dirty_inst.begin(); while (iter != dirty_inst.end()) { delete (*iter); @@ -144,14 +144,14 @@ void Inventory::CleanDirty() { dirty_inst.clear(); } -void Inventory::MarkDirty(ItemInst *inst) { +void InventoryOld::MarkDirty(ItemInst *inst) { if (inst) { dirty_inst.push_back(inst); } } // Retrieve item at specified slot; returns false if item not found -ItemInst* Inventory::GetItem(int16 slot_id) const +ItemInst* InventoryOld::GetItem(int16 slot_id) const { ItemInst* result = nullptr; @@ -186,37 +186,37 @@ ItemInst* Inventory::GetItem(int16 slot_id) const // Inner bag slots else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) { // Trade bag slots - ItemInst* inst = _GetItem(m_trade, Inventory::CalcSlotId(slot_id)); + ItemInst* inst = _GetItem(m_trade, InventoryOld::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryOld::CalcBagIdx(slot_id)); } } else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { // Shared Bank bag slots - ItemInst* inst = _GetItem(m_shbank, Inventory::CalcSlotId(slot_id)); + ItemInst* inst = _GetItem(m_shbank, InventoryOld::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryOld::CalcBagIdx(slot_id)); } } else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) { // Bank bag slots - ItemInst* inst = _GetItem(m_bank, Inventory::CalcSlotId(slot_id)); + ItemInst* inst = _GetItem(m_bank, InventoryOld::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryOld::CalcBagIdx(slot_id)); } } else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) { // Cursor bag slots ItemInst* inst = m_cursor.peek_front(); if (inst && inst->IsType(ItemClassContainer)) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryOld::CalcBagIdx(slot_id)); } } else if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) { // Personal inventory bag slots - ItemInst* inst = _GetItem(m_inv, Inventory::CalcSlotId(slot_id)); + ItemInst* inst = _GetItem(m_inv, InventoryOld::CalcSlotId(slot_id)); if (inst && inst->IsType(ItemClassContainer)) { - result = inst->GetItem(Inventory::CalcBagIdx(slot_id)); + result = inst->GetItem(InventoryOld::CalcBagIdx(slot_id)); } } @@ -224,13 +224,13 @@ ItemInst* Inventory::GetItem(int16 slot_id) const } // Retrieve item at specified position within bag -ItemInst* Inventory::GetItem(int16 slot_id, uint8 bagidx) const +ItemInst* InventoryOld::GetItem(int16 slot_id, uint8 bagidx) const { - return GetItem(Inventory::CalcSlotId(slot_id, bagidx)); + return GetItem(InventoryOld::CalcSlotId(slot_id, bagidx)); } // Put an item snto specified slot -int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) +int16 InventoryOld::PutItem(int16 slot_id, const ItemInst& inst) { // Clean up item already in slot (if exists) DeleteItem(slot_id); @@ -245,19 +245,19 @@ int16 Inventory::PutItem(int16 slot_id, const ItemInst& inst) return _PutItem(slot_id, inst.Clone()); } -int16 Inventory::PushCursor(const ItemInst& inst) +int16 InventoryOld::PushCursor(const ItemInst& inst) { m_cursor.push(inst.Clone()); return MainCursor; } -ItemInst* Inventory::GetCursorItem() +ItemInst* InventoryOld::GetCursorItem() { return m_cursor.peek_front(); } // Swap items in inventory -bool Inventory::SwapItem(int16 slot_a, int16 slot_b) +bool InventoryOld::SwapItem(int16 slot_a, int16 slot_b) { // Temp holding areas for a and b ItemInst* inst_a = GetItem(slot_a); @@ -273,7 +273,7 @@ bool Inventory::SwapItem(int16 slot_a, int16 slot_b) } // Remove item from inventory (with memory delete) -bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) +bool InventoryOld::DeleteItem(int16 slot_id, uint8 quantity) { // Pop item out of inventory map (or queue) ItemInst* item_to_delete = PopItem(slot_id); @@ -293,7 +293,7 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) ) { // Item can now be destroyed - Inventory::MarkDirty(item_to_delete); + InventoryOld::MarkDirty(item_to_delete); return true; } } @@ -303,19 +303,19 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) return false; } - Inventory::MarkDirty(item_to_delete); + InventoryOld::MarkDirty(item_to_delete); return true; } // Checks All items in a bag for No Drop -bool Inventory::CheckNoDrop(int16 slot_id) { +bool InventoryOld::CheckNoDrop(int16 slot_id) { ItemInst* inst = GetItem(slot_id); if (!inst) return false; if (!inst->GetItem()->NoDrop) return true; if (inst->GetItem()->ItemClass == 1) { for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { - ItemInst* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); + ItemInst* bagitem = GetItem(InventoryOld::CalcSlotId(slot_id, i)); if (bagitem && !bagitem->GetItem()->NoDrop) return true; } @@ -325,7 +325,7 @@ bool Inventory::CheckNoDrop(int16 slot_id) { // Remove item from bucket without memory delete // Returns item pointer if full delete was successful -ItemInst* Inventory::PopItem(int16 slot_id) +ItemInst* InventoryOld::PopItem(int16 slot_id) { ItemInst* p = nullptr; @@ -358,9 +358,9 @@ ItemInst* Inventory::PopItem(int16 slot_id) } else { // Is slot inside bag? - ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); + ItemInst* baginst = GetItem(InventoryOld::CalcSlotId(slot_id)); if (baginst != nullptr && baginst->IsType(ItemClassContainer)) { - p = baginst->PopItem(Inventory::CalcBagIdx(slot_id)); + p = baginst->PopItem(InventoryOld::CalcBagIdx(slot_id)); } } @@ -368,7 +368,7 @@ ItemInst* Inventory::PopItem(int16 slot_id) return p; } -bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { +bool InventoryOld::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { if (ItemToTry->Stackable) { @@ -388,7 +388,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { } if (InvItem && InvItem->IsType(ItemClassContainer)) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN); + int16 BaseSlotID = InventoryOld::CalcSlotId(i, SUB_BEGIN); uint8 BagSize = InvItem->GetItem()->BagSlots; for (uint8 BagSlot = SUB_BEGIN; BagSlot < BagSize; BagSlot++) { @@ -432,7 +432,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 Quantity) { } else if (InvItem->IsType(ItemClassContainer) && CanItemFitInContainer(ItemToTry, InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN); + int16 BaseSlotID = InventoryOld::CalcSlotId(i, SUB_BEGIN); uint8 BagSize = InvItem->GetItem()->BagSlots; @@ -468,7 +468,7 @@ bool Inventory::HasSpaceForItem(const Item_Struct *ItemToTry, int16 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 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) +int16 InventoryOld::HasItem(uint32 item_id, uint8 quantity, uint8 where) { int16 slot_id = INVALID_INDEX; @@ -518,7 +518,7 @@ int16 Inventory::HasItem(uint32 item_id, uint8 quantity, uint8 where) } //this function has the same quantity flaw mentioned above in HasItem() -int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) +int16 InventoryOld::HasItemByUse(uint8 use, uint8 quantity, uint8 where) { int16 slot_id = INVALID_INDEX; @@ -564,7 +564,7 @@ int16 Inventory::HasItemByUse(uint8 use, uint8 quantity, uint8 where) return slot_id; } -int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) +int16 InventoryOld::HasItemByLoreGroup(uint32 loregroup, uint8 where) { int16 slot_id = INVALID_INDEX; @@ -612,7 +612,7 @@ int16 Inventory::HasItemByLoreGroup(uint32 loregroup, uint8 where) // Locate an available inventory slot // Returns slot_id when there's one available, else SLOT_INVALID -int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow) +int16 InventoryOld::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow) { // Check basic inventory for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { @@ -631,7 +631,7 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo continue; } - int16 base_slot_id = Inventory::CalcSlotId(i, SUB_BEGIN); + int16 base_slot_id = InventoryOld::CalcSlotId(i, SUB_BEGIN); uint8 slots = inst->GetItem()->BagSlots; uint8 j; @@ -656,9 +656,9 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo } // This is a mix of HasSpaceForItem and FindFreeSlot..due to existing coding behavior, it was better to add a new helper function... -int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { +int16 InventoryOld::FindFreeSlotForTradeItem(const ItemInst* inst) { // Do not arbitrarily use this function..it is designed for use with Client::ResetTrade() and Client::FinishTrade(). - // If you have a need, use it..but, understand it is not a compatible replacement for Inventory::FindFreeSlot(). + // If you have a need, use it..but, understand it is not a compatible replacement for InventoryOld::FindFreeSlot(). // // I'll probably implement a bitmask in the new inventory system to avoid having to adjust stack bias -U @@ -701,7 +701,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { continue; if ((sub_inst->GetID() == inst->GetID()) && (sub_inst->GetCharges() < sub_inst->GetItem()->StackSize)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryOld::CalcSlotId(free_slot, free_bag_slot); } } } @@ -717,7 +717,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryOld::CalcSlotId(free_slot, free_bag_slot); } } } @@ -732,7 +732,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryOld::CalcSlotId(free_slot, free_bag_slot); } } } @@ -754,7 +754,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) - return Inventory::CalcSlotId(free_slot, free_bag_slot); + return InventoryOld::CalcSlotId(free_slot, free_bag_slot); } } } @@ -764,7 +764,7 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { } // Opposite of below: Get parent bag slot_id from a slot inside of bag -int16 Inventory::CalcSlotId(int16 slot_id) { +int16 InventoryOld::CalcSlotId(int16 slot_id) { int16 parent_slot_id = INVALID_INDEX; // this is not a bag range... using this risks over-writing existing items @@ -792,8 +792,8 @@ int16 Inventory::CalcSlotId(int16 slot_id) { } // Calculate slot_id for an item within a bag -int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { - if (!Inventory::SupportsContainers(bagslot_id)) +int16 InventoryOld::CalcSlotId(int16 bagslot_id, uint8 bagidx) { + if (!InventoryOld::SupportsContainers(bagslot_id)) return INVALID_INDEX; int16 slot_id = INVALID_INDEX; @@ -817,7 +817,7 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { return slot_id; } -uint8 Inventory::CalcBagIdx(int16 slot_id) { +uint8 InventoryOld::CalcBagIdx(int16 slot_id) { uint8 index = 0; // this is not a bag range... using this risks over-writing existing items @@ -846,7 +846,7 @@ uint8 Inventory::CalcBagIdx(int16 slot_id) { return index; } -int16 Inventory::CalcSlotFromMaterial(uint8 material) +int16 InventoryOld::CalcSlotFromMaterial(uint8 material) { switch (material) { @@ -873,7 +873,7 @@ int16 Inventory::CalcSlotFromMaterial(uint8 material) } } -uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) +uint8 InventoryOld::CalcMaterialFromSlot(int16 equipslot) { switch (equipslot) { @@ -901,7 +901,7 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) } } -bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_Struct *Container) { +bool InventoryOld::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_Struct *Container) { if (!ItemToTry || !Container) return false; @@ -918,7 +918,7 @@ bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_S return true; } -bool Inventory::SupportsClickCasting(int16 slot_id) +bool InventoryOld::SupportsClickCasting(int16 slot_id) { // there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range if ((uint16)slot_id <= EmuConstants::GENERAL_END || slot_id == MainPowerSource) @@ -934,7 +934,7 @@ bool Inventory::SupportsClickCasting(int16 slot_id) return false; } -bool Inventory::SupportsPotionBeltCasting(int16 slot_id) +bool InventoryOld::SupportsPotionBeltCasting(int16 slot_id) { if ((uint16)slot_id <= EmuConstants::GENERAL_END || slot_id == MainPowerSource || (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END)) return true; @@ -943,7 +943,7 @@ bool Inventory::SupportsPotionBeltCasting(int16 slot_id) } // Test whether a given slot can support a container item -bool Inventory::SupportsContainers(int16 slot_id) +bool InventoryOld::SupportsContainers(int16 slot_id) { if ((slot_id == MainCursor) || (slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END) || @@ -957,7 +957,7 @@ bool Inventory::SupportsContainers(int16 slot_id) return false; } -int Inventory::GetSlotByItemInst(ItemInst *inst) { +int InventoryOld::GetSlotByItemInst(ItemInst *inst) { if (!inst) return INVALID_INDEX; @@ -993,7 +993,7 @@ int Inventory::GetSlotByItemInst(ItemInst *inst) { return INVALID_INDEX; } -uint8 Inventory::FindHighestLightValue() +uint8 InventoryOld::FindHighestLightValue() { uint8 light_value = NOT_USED; @@ -1023,7 +1023,7 @@ uint8 Inventory::FindHighestLightValue() return light_value; } -void Inventory::dumpEntireInventory() { +void InventoryOld::dumpEntireInventory() { dumpWornItems(); dumpInventory(); @@ -1033,29 +1033,29 @@ void Inventory::dumpEntireInventory() { std::cout << std::endl; } -void Inventory::dumpWornItems() { +void InventoryOld::dumpWornItems() { std::cout << "Worn items:" << std::endl; dumpItemCollection(m_worn); } -void Inventory::dumpInventory() { +void InventoryOld::dumpInventory() { std::cout << "Inventory items:" << std::endl; dumpItemCollection(m_inv); } -void Inventory::dumpBankItems() { +void InventoryOld::dumpBankItems() { std::cout << "Bank items:" << std::endl; dumpItemCollection(m_bank); } -void Inventory::dumpSharedBankItems() { +void InventoryOld::dumpSharedBankItems() { std::cout << "Shared Bank items:" << std::endl; dumpItemCollection(m_shbank); } -int Inventory::GetSlotByItemInstCollection(const std::map &collection, ItemInst *inst) { +int InventoryOld::GetSlotByItemInstCollection(const std::map &collection, ItemInst *inst) { for (auto iter = collection.begin(); iter != collection.end(); ++iter) { ItemInst *t_inst = iter->second; if (t_inst == inst) { @@ -1065,7 +1065,7 @@ int Inventory::GetSlotByItemInstCollection(const std::map &col if (t_inst && !t_inst->IsType(ItemClassContainer)) { for (auto b_iter = t_inst->_cbegin(); b_iter != t_inst->_cend(); ++b_iter) { if (b_iter->second == inst) { - return Inventory::CalcSlotId(iter->first, b_iter->first); + return InventoryOld::CalcSlotId(iter->first, b_iter->first); } } } @@ -1074,7 +1074,7 @@ int Inventory::GetSlotByItemInstCollection(const std::map &col return -1; } -void Inventory::dumpItemCollection(const std::map &collection) +void InventoryOld::dumpItemCollection(const std::map &collection) { for (auto it = collection.cbegin(); it != collection.cend(); ++it) { auto inst = it->second; @@ -1088,7 +1088,7 @@ void Inventory::dumpItemCollection(const std::map &collection) } } -void Inventory::dumpBagContents(ItemInst *inst, std::map::const_iterator *it) +void InventoryOld::dumpBagContents(ItemInst *inst, std::map::const_iterator *it) { if (!inst || !inst->IsType(ItemClassContainer)) return; @@ -1099,7 +1099,7 @@ void Inventory::dumpBagContents(ItemInst *inst, std::map::cons if (!baginst || !baginst->GetItem()) continue; - std::string subSlot = StringFormat(" Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first), + std::string subSlot = StringFormat(" Slot %d: %s (%d)", InventoryOld::CalcSlotId((*it)->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges()); std::cout << subSlot << std::endl; } @@ -1107,7 +1107,7 @@ void Inventory::dumpBagContents(ItemInst *inst, std::map::cons } // Internal Method: Retrieves item within an inventory bucket -ItemInst* Inventory::_GetItem(const std::map& bucket, int16 slot_id) const +ItemInst* InventoryOld::_GetItem(const std::map& bucket, int16 slot_id) const { auto it = bucket.find(slot_id); if (it != bucket.end()) { @@ -1120,7 +1120,7 @@ ItemInst* Inventory::_GetItem(const std::map& bucket, int16 sl // Internal Method: "put" item into bucket, without regard for what is currently in bucket // Assumes item has already been allocated -int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) +int16 InventoryOld::_PutItem(int16 slot_id, ItemInst* inst) { // What happens here when we _PutItem(MainCursor)? Bad things..really bad things... // @@ -1166,25 +1166,25 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } else { // Slot must be within a bag - parentSlot = Inventory::CalcSlotId(slot_id); + parentSlot = InventoryOld::CalcSlotId(slot_id); ItemInst* baginst = GetItem(parentSlot); // Get parent bag if (baginst && baginst->IsType(ItemClassContainer)) { - baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); + baginst->_PutItem(InventoryOld::CalcBagIdx(slot_id), inst); result = slot_id; } } if (result == INVALID_INDEX) { - Log.Out(Logs::General, Logs::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); - Inventory::MarkDirty(inst); // Slot not found, clean up + Log.Out(Logs::General, Logs::Error, "InventoryOld::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + InventoryOld::MarkDirty(inst); // Slot not found, clean up } return result; } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) +int16 InventoryOld::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) { uint8 quantity_found = 0; @@ -1212,7 +1212,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryOld::CalcSlotId(iter->first, bag_iter->first); } for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { @@ -1226,7 +1226,7 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) +int16 InventoryOld::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) { // The downfall of this (these) queue procedure is that callers presume that when an item is // found, it is presented as being available on the cursor. In cases of a parity check, this @@ -1260,7 +1260,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) if (bag_inst->GetID() == item_id) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(MainCursor, bag_iter->first); + return InventoryOld::CalcSlotId(MainCursor, bag_iter->first); } for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { @@ -1277,7 +1277,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) } // Internal Method: Checks an inventory bucket for a particular item -int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) +int16 InventoryOld::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) { uint8 quantity_found = 0; @@ -1300,7 +1300,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, ui if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryOld::CalcSlotId(iter->first, bag_iter->first); } } } @@ -1309,7 +1309,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, ui } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) +int16 InventoryOld::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) { uint8 quantity_found = 0; @@ -1332,7 +1332,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); if (quantity_found >= quantity) - return Inventory::CalcSlotId(MainCursor, bag_iter->first); + return InventoryOld::CalcSlotId(MainCursor, bag_iter->first); } } @@ -1343,7 +1343,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) return INVALID_INDEX; } -int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) +int16 InventoryOld::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) { for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { auto inst = iter->second; @@ -1367,7 +1367,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 if (bag_inst == nullptr) { continue; } if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(iter->first, bag_iter->first); + return InventoryOld::CalcSlotId(iter->first, bag_iter->first); for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { auto aug_inst = bag_inst->GetAugment(index); @@ -1383,7 +1383,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 } // Internal Method: Checks an inventory queue type bucket for a particular item -int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) +int16 InventoryOld::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) { for (auto iter = iqueue.cbegin(); iter != iqueue.cend(); ++iter) { auto inst = *iter; @@ -1407,7 +1407,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) if (bag_inst == nullptr) { continue; } if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(MainCursor, bag_iter->first); + return InventoryOld::CalcSlotId(MainCursor, bag_iter->first); for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { auto aug_inst = bag_inst->GetAugment(index); @@ -2150,7 +2150,7 @@ ItemInst* ItemInst::Clone() const bool ItemInst::IsSlotAllowed(int16 slot_id) const { // 'SupportsContainers' and 'slot_id > 21' previously saw the reassigned PowerSource slot (9999 to 22) as valid -U if (!m_item) { return false; } - else if (Inventory::SupportsContainers(slot_id)) { return true; } + else if (InventoryOld::SupportsContainers(slot_id)) { return true; } else if (m_item->Slots & (1 << slot_id)) { return true; } else if (slot_id == MainPowerSource && (m_item->Slots & (1 << 22))) { return true; } // got lazy... else if (slot_id != MainPowerSource && slot_id > EmuConstants::EQUIPMENT_END) { return true; } diff --git a/common/item.h b/common/item.h index 906e00313..b1227df33 100644 --- a/common/item.h +++ b/common/item.h @@ -104,9 +104,9 @@ protected: }; // ######################################## -// Class: Inventory +// Class: InventoryOld // Character inventory -class Inventory +class InventoryOld { friend class ItemInst; public: @@ -114,8 +114,8 @@ public: // Public Methods /////////////////////////////// - Inventory() { m_version = ClientVersion::Unknown; m_versionset = false; } - ~Inventory(); + InventoryOld() { m_version = ClientVersion::Unknown; m_versionset = false; } + ~InventoryOld(); // Inventory v2 creep bool SetInventoryVersion(ClientVersion version) { @@ -425,7 +425,7 @@ protected: std::map::const_iterator _cbegin() { return m_contents.cbegin(); } std::map::const_iterator _cend() { return m_contents.cend(); } - friend class Inventory; + friend class InventoryOld; void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index cb95bfdb1..94c42a1f2 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5031,7 +5031,7 @@ namespace RoF ss.write(tmp, strlen(tmp)); ss.write((const char*)&null_term, sizeof(uint8)); ornaIcon = inst->GetOrnamentationIcon(); - heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); + heroModel = inst->GetOrnamentHeroModel(InventoryOld::CalcMaterialFromSlot(slot_id_in)); } else { @@ -5474,7 +5474,7 @@ namespace RoF /* // TEST CODE: - SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x); */ SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 5cab22a60..f8b48c1c0 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5194,7 +5194,7 @@ namespace RoF2 ss.write(tmp, strlen(tmp)); ss.write((const char*)&null_term, sizeof(uint8)); ornaIcon = inst->GetOrnamentationIcon(); - heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); + heroModel = inst->GetOrnamentHeroModel(InventoryOld::CalcMaterialFromSlot(slot_id_in)); } else { @@ -5650,7 +5650,7 @@ namespace RoF2 /* // TEST CODE: - SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x); */ SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1, packet_type); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 488f51e87..59412726e 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3913,7 +3913,7 @@ namespace SoD /* // TEST CODE: - SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x); */ SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index ab956a28d..bd6bfff37 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -3235,7 +3235,7 @@ namespace SoF /* // TEST CODE: - SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x); */ SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 11fdb3c7b..b31590a3c 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -4214,7 +4214,7 @@ namespace UF /* // TEST CODE: - SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x); */ SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0e057812d..94a1ba226 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -208,10 +208,10 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) + if (inst->IsType(ItemClassContainer) && InventoryOld::SupportsContainers(slot_id)) for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = inst->GetItem(idx); - SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); + SaveInventory(char_id, baginst, InventoryOld::CalcSlotId(slot_id, idx)); } if (!results.Success()) { @@ -252,10 +252,10 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { + if (inst->IsType(ItemClassContainer) && InventoryOld::SupportsContainers(slot_id)) { for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = inst->GetItem(idx); - SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); + SaveInventory(char_id, baginst, InventoryOld::CalcSlotId(slot_id, idx)); } } @@ -276,10 +276,10 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { } // Delete bag slots, if need be - if (!Inventory::SupportsContainers(slot_id)) + if (!InventoryOld::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); + int16 base_slot_id = InventoryOld::CalcSlotId(slot_id, SUB_BEGIN); query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i", char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); @@ -302,10 +302,10 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { } // Delete bag slots, if need be - if (!Inventory::SupportsContainers(slot_id)) + if (!InventoryOld::SupportsContainers(slot_id)) return true; - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); + int16 base_slot_id = InventoryOld::CalcSlotId(slot_id, SUB_BEGIN); query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i " "AND slotid >= %i AND slotid < %i", account_id, base_slot_id, (base_slot_id+10)); @@ -345,7 +345,7 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { return true; } -bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { +bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, InventoryOld* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { const Item_Struct* myitem; @@ -382,7 +382,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, // Retrieve shared bank inventory based on either account or character -bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) +bool SharedDatabase::GetSharedBank(uint32 id, InventoryOld *inv, bool is_charid) { std::string query; @@ -482,7 +482,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) } // Overloaded: Retrieve character inventory based on character id -bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) +bool SharedDatabase::GetInventory(uint32 char_id, InventoryOld *inv) { // Retrieve character inventory std::string query = @@ -625,7 +625,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv) } // Overloaded: Retrieve character inventory based on account_id and character name -bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv) +bool SharedDatabase::GetInventory(uint32 account_id, char *name, InventoryOld *inv) { // Retrieve character inventory std::string query = diff --git a/common/shareddb.h b/common/shareddb.h index aef325380..ce608b4a1 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -14,7 +14,7 @@ #include class EvolveInfo; -class Inventory; +class InventoryOld; class ItemInst; struct BaseDataStruct; struct InspectMessage_Struct; @@ -65,15 +65,15 @@ class SharedDatabase : public Database bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id); bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id); bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); - bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); + bool GetSharedBank(uint32 id, InventoryOld* inv, bool is_charid); int32 GetSharedPlatinum(uint32 account_id); bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); - bool GetInventory(uint32 char_id, Inventory* inv); - bool GetInventory(uint32 account_id, char* name, Inventory* inv); + bool GetInventory(uint32 char_id, InventoryOld* inv); + bool GetInventory(uint32 account_id, char* name, InventoryOld* inv); std::map GetItemRecastTimestamps(uint32 char_id); uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type); void ClearOldRecastTimestamps(uint32 char_id); - bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); + bool SetStartingItems(PlayerProfile_Struct* pp, InventoryOld* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); std::string GetBook(const char *txtfile); diff --git a/world/client.cpp b/world/client.cpp index ace58ffea..0b1cc2640 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1347,7 +1347,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { PlayerProfile_Struct pp; ExtendedProfile_Struct ext; - Inventory inv; + InventoryOld inv; time_t bday = time(nullptr); char startzone[50]={0}; uint32 i; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 223ae89d6..07d931958 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -34,7 +34,7 @@ extern std::vector character_create_race_class_combos; // the current stuff is at the bottom of this function void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) { - Inventory *inv; + InventoryOld *inv; uint8 has_home = 0; uint8 has_bind = 0; @@ -167,7 +167,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } /* Load Inventory */ - inv = new Inventory; + inv = new InventoryOld; if (GetInventory(account_id, cs->name[char_num], inv)) { const Item_Struct* item = nullptr; @@ -176,7 +176,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) { - invslot = Inventory::CalcSlotFromMaterial(matslot); + invslot = InventoryOld::CalcSlotFromMaterial(matslot); if (invslot == INVALID_INDEX) { continue; } inst = inv->GetItem(invslot); diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a76860ce4..d3e32127d 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -3173,7 +3173,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EmuConstants::GENERAL_BAGS_BEGIN && i <= EmuConstants::GENERAL_BAGS_END) { - ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + ItemInst* parent_item = m_inv.GetItem(InventoryOld::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } @@ -3266,7 +3266,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // TEST CODE: test for bazaar trader crashing with charm items if (Trader) if (i >= EmuConstants::GENERAL_BAGS_BEGIN && i <= EmuConstants::GENERAL_BAGS_END) { - ItemInst* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i)); + ItemInst* parent_item = m_inv.GetItem(InventoryOld::CalcSlotId(i)); if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel continue; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 4b42fac37..b449ebfe0 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4138,7 +4138,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) { for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { itemID = GetBotItemBySlot(i); if(itemID != 0) { - materialFromSlot = Inventory::CalcMaterialFromSlot(i); + materialFromSlot = InventoryOld::CalcMaterialFromSlot(i); if(materialFromSlot != 0xFF) this->SendWearChange(materialFromSlot); } @@ -4191,7 +4191,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage) { } // Retrieves all the inventory records from the database for this bot. -void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { +void Bot::GetBotItems(std::string* errorMessage, InventoryOld &inv) { if(this->GetBotID() == 0) return; @@ -5081,7 +5081,7 @@ ItemInst* Bot::GetBotItem(uint32 slotID) { // Adds the specified item it bot to the NPC equipment array and to the bot inventory collection. void Bot::BotAddEquipItem(int slot, uint32 id) { if(slot > 0 && id > 0) { - uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); + uint8 materialFromSlot = InventoryOld::CalcMaterialFromSlot(slot); if(materialFromSlot != _MaterialInvalid) { equipment[slot] = id; // npc has more than just material slots. Valid material should mean valid inventory index @@ -5097,7 +5097,7 @@ void Bot::BotAddEquipItem(int slot, uint32 id) { // Erases the specified item from bot the NPC equipment array and from the bot inventory collection. void Bot::BotRemoveEquipItem(int slot) { if(slot > 0) { - uint8 materialFromSlot = Inventory::CalcMaterialFromSlot(slot); + uint8 materialFromSlot = InventoryOld::CalcMaterialFromSlot(slot); if(materialFromSlot != _MaterialInvalid) { equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index @@ -5669,7 +5669,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli bool UpdateClient = false; bool already_returned = false; - Inventory& clientInventory = client->GetInv(); + InventoryOld& clientInventory = client->GetInv(); const ItemInst* inst = clientInventory[i]; if(inst) { items[i] = inst->GetItem()->ID; @@ -11281,7 +11281,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!results.Success()) return; - uint8 slotmaterial = Inventory::CalcMaterialFromSlot(setslot); + uint8 slotmaterial = InventoryOld::CalcMaterialFromSlot(setslot); c->GetTarget()->CastToBot()->SendWearChange(slotmaterial); } else { @@ -15974,7 +15974,7 @@ uint32 Bot::GetEquipmentColor(uint8 material_slot) const uint32 botid = this->GetBotID(); //Translate code slot # to DB slot # - slotid = Inventory::CalcSlotFromMaterial(material_slot); + slotid = InventoryOld::CalcSlotFromMaterial(material_slot); if (slotid == INVALID_INDEX) return 0; diff --git a/zone/bot.h b/zone/bot.h index 7dd354358..295eff175 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -579,7 +579,7 @@ private: bool _petChooser; uint8 _petChooserID; bool berserk; - Inventory m_inv; + InventoryOld m_inv; double _lastTotalPlayTime; time_t _startTotalPlayTime; Mob* _previousTarget; @@ -651,7 +651,7 @@ private: void SetBotID(uint32 botID); // Private "Inventory" Methods - void GetBotItems(std::string* errorMessage, Inventory &inv); + void GetBotItems(std::string* errorMessage, InventoryOld &inv); void BotRemoveEquipItem(int slot); void BotAddEquipItem(int slot, uint32 id); uint32 GetBotItemBySlot(uint32 slotID); diff --git a/zone/client.cpp b/zone/client.cpp index 63a9b5073..1a7d81405 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2705,7 +2705,7 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { const Item_Struct* item = database.GetItem(item_id); if (item && (item->ItemClass==ItemClassCommon)) { - uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); + uint8 matslot = InventoryOld::CalcMaterialFromSlot(in_slot); if (matslot != _MaterialInvalid) { m_pp.item_material[matslot] = GetEquipmentMaterial(matslot); @@ -3047,7 +3047,7 @@ void Client::SetTint(int16 in_slot, uint32 color) { // Still need to reconcile bracer01 versus bracer02 void Client::SetTint(int16 in_slot, Color_Struct& color) { - uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); + uint8 matslot = InventoryOld::CalcMaterialFromSlot(in_slot); if (matslot != _MaterialInvalid) { m_pp.item_tint[matslot].color = color.color; diff --git a/zone/client.h b/zone/client.h index f2325ccca..85177aee2 100644 --- a/zone/client.h +++ b/zone/client.h @@ -333,8 +333,8 @@ public: inline uint8 GetAnon() const { return m_pp.anon; } inline PlayerProfile_Struct& GetPP() { return m_pp; } inline ExtendedProfile_Struct& GetEPP() { return m_epp; } - inline Inventory& GetInv() { return m_inv; } - inline const Inventory& GetInv() const { return m_inv; } + inline InventoryOld& GetInv() { return m_inv; } + inline const InventoryOld& GetInv() const { return m_inv; } inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } @@ -1405,7 +1405,7 @@ private: PlayerProfile_Struct m_pp; ExtendedProfile_Struct m_epp; - Inventory m_inv; + InventoryOld m_inv; Object* m_tradeskill_object; PetInfo m_petinfo; // current pet data, used while loading from and saving to DB PetInfo m_suspendedminion; // pet data for our suspended minion. diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2d60b444e..b0cde60c7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2969,7 +2969,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { ItemInst *tobe_auged = nullptr, *auged_with = nullptr; int8 slot = -1; - Inventory& user_inv = GetInv(); + InventoryOld& user_inv = GetInv(); uint16 slot_id = in_augment->container_slot; uint16 aug_slot_id = in_augment->augment_slot; @@ -3039,7 +3039,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { ItemInst *tobe_auged = nullptr, *auged_with = nullptr; int8 slot = -1; - Inventory& user_inv = GetInv(); + InventoryOld& user_inv = GetInv(); uint16 slot_id = in_augment->container_slot; uint16 aug_slot_id = in_augment->augment_slot; //it's actually solvent slot diff --git a/zone/command.cpp b/zone/command.cpp index ff81e73ed..28eabb057 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2602,7 +2602,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + InventoryOld::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2636,7 +2636,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + InventoryOld::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } } @@ -2673,7 +2673,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + InventoryOld::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2695,7 +2695,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + InventoryOld::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2718,7 +2718,7 @@ void command_peekinv(Client *c, const Seperator *sep) item_link = linker.GenerateLink(); c->Message((item_data == nullptr), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); + InventoryOld::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 767159ce7..df03783c3 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -409,7 +409,7 @@ void Corpse::MoveItemToCorpse(Client *client, ItemInst *inst, int16 equipSlot, s if (equipSlot < EmuConstants::GENERAL_BEGIN || equipSlot > MainCursor) { break; } for (auto sub_index = SUB_BEGIN; sub_index < EmuConstants::ITEM_CONTAINER_SIZE; ++sub_index) { - int16 real_bag_slot = Inventory::CalcSlotId(equipSlot, sub_index); + int16 real_bag_slot = InventoryOld::CalcSlotId(equipSlot, sub_index); auto bag_inst = client->GetInv().GetItem(real_bag_slot); if (bag_inst == nullptr) { continue; } @@ -683,8 +683,8 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } } - if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) { - int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, SUB_BEGIN); + if (sitem && bag_item_data && InventoryOld::SupportsContainers(sitem->equip_slot)) { + int16 bagstart = InventoryOld::CalcSlotId(sitem->equip_slot, SUB_BEGIN); cur = itemlist.begin(); end = itemlist.end(); @@ -738,7 +738,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data) is_corpse_changed = true; itemlist.erase(iter); - uint8 material = Inventory::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char + uint8 material = InventoryOld::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char if (material != _MaterialInvalid) SendWearChange(material); @@ -1397,7 +1397,7 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { return NO_ITEM; } - invslot = Inventory::CalcSlotFromMaterial(material_slot); + invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if(invslot == INVALID_INDEX) // GetWornItem() should be returning a NO_ITEM for any invalid index... return NO_ITEM; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 69f1de882..6d149067c 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -765,7 +765,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd ItemInst* bagitem = m_inv[slot_id]->GetItem(bag_idx); if(bagitem) { - int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx); + int16 bagslot_id = InventoryOld::CalcSlotId(slot_id, bag_idx); qsaudit->items[++parent_offset].char_slot = bagslot_id; qsaudit->items[parent_offset].item_id = bagitem->GetID(); @@ -864,7 +864,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client if (client_update) { SendItemPacket(slot_id, &inst, ((slot_id == MainCursor) ? ItemPacketSummonItem : ItemPacketTrade)); - //SendWearChange(Inventory::CalcMaterialFromSlot(slot_id)); + //SendWearChange(InventoryOld::CalcMaterialFromSlot(slot_id)); } if (slot_id == MainCursor) { @@ -901,7 +901,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI if(bag_item_data[i] == nullptr) continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); - interior_slot = Inventory::CalcSlotId(slot_id, i); + interior_slot = InventoryOld::CalcSlotId(slot_id, i); Log.Out(Logs::Detail, Logs::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); @@ -928,7 +928,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur } for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - uint16 slotid = Inventory::CalcSlotId(i, j); + uint16 slotid = InventoryOld::CalcSlotId(i, j); ItemInst* tmp_inst = m_inv.GetItem(slotid); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { @@ -981,7 +981,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs if (inst.IsEquipable(i)) { // Equippable at this slot? //send worn to everyone... PutLootInInventory(i, inst); - uint8 worn_slot_material = Inventory::CalcMaterialFromSlot(i); + uint8 worn_slot_material = InventoryOld::CalcMaterialFromSlot(i); if (worn_slot_material != _MaterialInvalid) { SendWearChange(worn_slot_material); } @@ -1481,8 +1481,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_END && src_inst->IsType(ItemClassContainer)){ for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = src_inst->GetItem(idx); - if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){ - DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false); + if(baginst && !database.VerifyInventory(account_id, InventoryOld::CalcSlotId(src_slot_id, idx), baginst)){ + DeleteItemInInventory(InventoryOld::CalcSlotId(src_slot_id, idx),0,false); } } } @@ -1496,8 +1496,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_END && dst_inst->IsType(ItemClassContainer)){ for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = dst_inst->GetItem(idx); - if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){ - DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false); + if(baginst && !database.VerifyInventory(account_id, InventoryOld::CalcSlotId(dst_slot_id, idx), baginst)){ + DeleteItemInInventory(InventoryOld::CalcSlotId(dst_slot_id, idx),0,false); } } } @@ -1539,7 +1539,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(m_tradeskill_object != nullptr) { if (src_slot_id >= EmuConstants::WORLD_BEGIN && src_slot_id <= EmuConstants::WORLD_END) { // Picking up item from world container - ItemInst* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id)); + ItemInst* inst = m_tradeskill_object->PopItem(InventoryOld::CalcBagIdx(src_slot_id)); if (inst) { PutItemInInventory(dst_slot_id, *inst, false); safe_delete(inst); @@ -1551,7 +1551,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } else if (dst_slot_id >= EmuConstants::WORLD_BEGIN && dst_slot_id <= EmuConstants::WORLD_END) { // Putting item into world container, which may swap (or pile onto) with existing item - uint8 world_idx = Inventory::CalcBagIdx(dst_slot_id); + uint8 world_idx = InventoryOld::CalcBagIdx(dst_slot_id); ItemInst* world_inst = m_tradeskill_object->PopItem(world_idx); // Case 1: No item in container, unidirectional "Put" @@ -1798,7 +1798,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); + int16 resync_slot = (InventoryOld::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : InventoryOld::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { // This prevents the client from crashing when closing any 'phantom' bags -U const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1823,7 +1823,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize source slot %i.", move_slots->from_slot); } } else { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot); + int16 resync_slot = (InventoryOld::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : InventoryOld::CalcSlotId(move_slots->from_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1841,7 +1841,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { } if((move_slots->to_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->to_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->to_slot == MainPowerSource) { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); + int16 resync_slot = (InventoryOld::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : InventoryOld::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' ItemInst* token_inst = database.CreateItem(token_struct, 1); @@ -1865,7 +1865,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { else { Message(13, "Could not resyncronize destination slot %i.", move_slots->to_slot); } } else { - int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot); + int16 resync_slot = (InventoryOld::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : InventoryOld::CalcSlotId(move_slots->to_slot); if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if(m_inv[resync_slot]) { const Item_Struct* token_struct = database.GetItem(22292); // 'Copper Coin' @@ -1925,8 +1925,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const ItemInst* from_baginst = from_inst->GetItem(bag_idx); if(from_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].from_slot = InventoryOld::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = InventoryOld::CalcSlotId(to_slot_id, bag_idx); qsaudit->items[move_count].item_id = from_baginst->GetID(); qsaudit->items[move_count].charges = from_baginst->GetCharges(); qsaudit->items[move_count].aug_1 = from_baginst->GetAugmentItemID(1); @@ -1958,8 +1958,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) { const ItemInst* to_baginst = to_inst->GetItem(bag_idx); if(to_baginst) { - qsaudit->items[move_count].from_slot = Inventory::CalcSlotId(to_slot_id, bag_idx); - qsaudit->items[move_count].to_slot = Inventory::CalcSlotId(from_slot_id, bag_idx); + qsaudit->items[move_count].from_slot = InventoryOld::CalcSlotId(to_slot_id, bag_idx); + qsaudit->items[move_count].to_slot = InventoryOld::CalcSlotId(from_slot_id, bag_idx); qsaudit->items[move_count].item_id = to_baginst->GetID(); qsaudit->items[move_count].charges = to_baginst->GetCharges(); qsaudit->items[move_count].aug_1 = to_baginst->GetAugmentItemID(1); @@ -2382,7 +2382,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const return 0; } - invslot = Inventory::CalcSlotFromMaterial(material_slot); + invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) { return 0; @@ -2560,7 +2560,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if (slot == INVALID_INDEX) { if (m_inv.GetItem(MainCursor)) { if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id && - m_inv.GetItem(MainCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check + m_inv.GetItem(MainCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches InventoryOld::_HasItem conditional check slot = MainCursor; } else if (m_inv.GetItem(MainCursor)->GetItem()->ItemClass == 1) { @@ -2736,7 +2736,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // if (InvItem && InvItem->IsType(ItemClassContainer)) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN); + int16 BaseSlotID = InventoryOld::CalcSlotId(i, SUB_BEGIN); uint8 BagSize=InvItem->GetItem()->BagSlots; @@ -2786,9 +2786,9 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { return true; } - if(InvItem->IsType(ItemClassContainer) && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { + if(InvItem->IsType(ItemClassContainer) && InventoryOld::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) { - int16 BaseSlotID = Inventory::CalcSlotId(i, SUB_BEGIN); + int16 BaseSlotID = InventoryOld::CalcSlotId(i, SUB_BEGIN); uint8 BagSize=InvItem->GetItem()->BagSlots; @@ -3052,7 +3052,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* return false; } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { +void InventoryOld::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { ItemInst *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3060,7 +3060,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { +void InventoryOld::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) { ItemInst *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3068,7 +3068,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { +void InventoryOld::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) { ItemInst *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3076,7 +3076,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { +void InventoryOld::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) { ItemInst *inst = GetItem(slot_id); if(inst) { inst->SetCustomData(identifier, value); @@ -3084,7 +3084,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin } } -std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) { +std::string InventoryOld::GetCustomItemData(int16 slot_id, std::string identifier) { ItemInst *inst = GetItem(slot_id); if(inst) { return inst->GetCustomData(identifier); diff --git a/zone/lua_inventory.cpp b/zone/lua_inventory.cpp index 498835926..e2578603c 100644 --- a/zone/lua_inventory.cpp +++ b/zone/lua_inventory.cpp @@ -164,7 +164,7 @@ int Lua_Inventory::GetSlotByItemInst(Lua_ItemInst inst) { } luabind::scope lua_register_inventory() { - return luabind::class_("Inventory") + return luabind::class_("InventoryOld") .def(luabind::constructor<>()) .def("GetItem", (Lua_ItemInst(Lua_Inventory::*)(int))&Lua_Inventory::GetItem) .def("GetItem", (Lua_ItemInst(Lua_Inventory::*)(int,int))&Lua_Inventory::GetItem) diff --git a/zone/lua_inventory.h b/zone/lua_inventory.h index ca49a55e6..12e531050 100644 --- a/zone/lua_inventory.h +++ b/zone/lua_inventory.h @@ -4,7 +4,7 @@ #include "lua_ptr.h" -class Inventory; +class InventoryOld; class Lua_ItemInst; class Lua_Item; @@ -14,16 +14,16 @@ namespace luabind { luabind::scope lua_register_inventory(); -class Lua_Inventory : public Lua_Ptr +class Lua_Inventory : public Lua_Ptr { - typedef Inventory NativeType; + typedef InventoryOld NativeType; public: Lua_Inventory() : Lua_Ptr(nullptr) { } - Lua_Inventory(Inventory *d) : Lua_Ptr(d) { } + Lua_Inventory(InventoryOld *d) : Lua_Ptr(d) { } virtual ~Lua_Inventory() { } - operator Inventory*() { - return reinterpret_cast(GetLuaPtrData()); + operator InventoryOld*() { + return reinterpret_cast(GetLuaPtrData()); } Lua_ItemInst GetItem(int slot_id); diff --git a/zone/merc.cpp b/zone/merc.cpp index 059ccb316..acae1b80c 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5022,7 +5022,7 @@ void Merc::UpdateMercAppearance() { for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { itemID = equipment[i]; if(itemID != NO_ITEM) { - materialFromSlot = Inventory::CalcMaterialFromSlot(i); + materialFromSlot = InventoryOld::CalcMaterialFromSlot(i); if(materialFromSlot != _MaterialInvalid) this->SendWearChange(materialFromSlot); } diff --git a/zone/merc.h b/zone/merc.h index 82136c15d..4c8749164 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -381,7 +381,7 @@ private: uint8 _OwnerClientVersion; uint32 _currentStance; - Inventory m_inv; + InventoryOld m_inv; int32 max_end; int32 cur_end; bool _medding; diff --git a/zone/mob.cpp b/zone/mob.cpp index ea86ff4dc..2829d1a65 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2547,7 +2547,7 @@ uint32 NPC::GetEquipment(uint8 material_slot) const { if(material_slot > 8) return 0; - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) return 0; return equipment[invslot]; @@ -2645,7 +2645,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { if (this->IsClient()) { - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) { return 0; @@ -2690,7 +2690,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); const Item_Struct *item; item = database.GetItem(GetEquipment(material_slot)); - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if (item != 0 && invslot != INVALID_INDEX) { diff --git a/zone/npc.cpp b/zone/npc.cpp index 5d180e994..20648db3c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -473,7 +473,7 @@ void NPC::CheckMinMaxLevel(Mob *them) if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level) { - material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot); + material = InventoryOld::CalcMaterialFromSlot((*cur)->equip_slot); if (material != _MaterialInvalid) SendWearChange(material); @@ -1285,7 +1285,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const if (material_slot >= _MaterialCount) return 0; - int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + int16 invslot = InventoryOld::CalcSlotFromMaterial(material_slot); if (invslot == INVALID_INDEX) return 0; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 07ae6d2a5..cc8a37a69 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -55,7 +55,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme else { // Check to see if they have an inventory container type 53 that is used for this. - Inventory& user_inv = user->GetInv(); + InventoryOld& user_inv = user->GetInv(); ItemInst* inst = nullptr; inst = user_inv.GetItem(in_augment->container_slot); @@ -218,7 +218,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme const ItemInst* inst = container->GetItem(i); if (inst) { - user->DeleteItemInInventory(Inventory::CalcSlotId(in_augment->container_slot,i),0,true); + user->DeleteItemInInventory(InventoryOld::CalcSlotId(in_augment->container_slot,i),0,true); } } // Explicitly mark container as cleared. @@ -247,7 +247,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } - Inventory& user_inv = user->GetInv(); + InventoryOld& user_inv = user->GetInv(); PlayerProfile_Struct& user_pp = user->GetPP(); ItemInst* container = nullptr; ItemInst* inst = nullptr; @@ -286,7 +286,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { const Item_Struct* new_weapon = inst->GetItem(); - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + user->DeleteItemInInventory(InventoryOld::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); @@ -306,7 +306,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const ItemInst* inst = container->GetItem(0); if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { const Item_Struct* new_weapon = inst->GetItem(); - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + user->DeleteItemInInventory(InventoryOld::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, 0, 0); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); @@ -395,7 +395,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob for (uint8 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; i++) { const ItemInst* inst = container->GetItem(i); if (inst) { - user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true); + user->DeleteItemInInventory(InventoryOld::CalcSlotId(in_combine->container_slot,i),0,true); } } container->Clear(); @@ -492,7 +492,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac memset(counts, 0, sizeof(counts)); //search for all the items in their inventory - Inventory& user_inv = user->GetInv(); + InventoryOld& user_inv = user->GetInv(); uint8 count = 0; uint8 needcount = 0; diff --git a/zone/trading.cpp b/zone/trading.cpp index 047aa3a6a..8d498c034 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -174,7 +174,7 @@ void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id) with->SendItemPacket(dest_slot_id - EmuConstants::TRADE_BEGIN, inst, ItemPacketTradeView); if (inst->GetItem()->ItemClass == 1) { for (uint16 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { - uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i); + uint16 bagslot_id = InventoryOld::CalcSlotId(dest_slot_id, i); const ItemInst* bagitem = trader->GetInv().GetItem(bagslot_id); if (bagitem) { with->SendItemPacket(bagslot_id - EmuConstants::TRADE_BEGIN, bagitem, ItemPacketTradeView); @@ -317,7 +317,7 @@ void Trade::DumpTrade() if (inst) { Log.Out(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), - Inventory::CalcSlotId(i, j)); + InventoryOld::CalcSlotId(i, j)); } } } @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by InventoryOld::FindFreeSlotForTradeItem()"); break; } @@ -530,9 +530,9 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st detail = new QSTradeItems_Struct; detail->from_id = this->character_id; - detail->from_slot = Inventory::CalcSlotId(trade_slot, sub_slot); + detail->from_slot = InventoryOld::CalcSlotId(trade_slot, sub_slot); detail->to_id = other->CharacterID(); - detail->to_slot = Inventory::CalcSlotId(free_slot, sub_slot); + detail->to_slot = InventoryOld::CalcSlotId(free_slot, sub_slot); detail->item_id = bag_inst->GetID(); detail->charges = (!bag_inst->IsStackable() ? 1 : bag_inst->GetCharges()); detail->aug_1 = bag_inst->GetAugmentItemID(1); @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - Log.Out(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by InventoryOld::FindFreeSlotForTradeItem()"); break; } @@ -849,7 +849,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st strcpy(detail->action_type, "HANDIN"); - detail->char_slot = Inventory::CalcSlotId(trade_slot, sub_slot); + detail->char_slot = InventoryOld::CalcSlotId(trade_slot, sub_slot); detail->item_id = trade_baginst->GetID(); detail->charges = (!trade_inst->IsStackable() ? 1 : trade_inst->GetCharges()); detail->aug_1 = trade_baginst->GetAugmentItemID(1); @@ -1237,7 +1237,7 @@ uint32 Client::FindTraderItemSerialNumber(int32 ItemID) { if (item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? - SlotID = Inventory::CalcSlotId(i, x); + SlotID = InventoryOld::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); if (item) { if (item->GetID() == ItemID) @@ -1260,7 +1260,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ if(item && item->GetItem()->ID == 17899){ //Traders Satchel for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++) { // we already have the parent bag and a contents iterator..why not just iterate the bag!?? - SlotID = Inventory::CalcSlotId(i, x); + SlotID = InventoryOld::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); if(item) { if(item->GetSerialNumber() == SerialNumber) @@ -1290,7 +1290,7 @@ GetItems_Struct* Client::GetTraderItems(){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++) { - SlotID = Inventory::CalcSlotId(i, x); + SlotID = InventoryOld::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); @@ -1314,7 +1314,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel for(int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; x++){ - SlotID = Inventory::CalcSlotId(i, x); + SlotID = InventoryOld::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); diff --git a/zone/zone.cpp b/zone/zone.cpp index 6cd81929f..25a8488f8 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1173,7 +1173,7 @@ bool Zone::Process() { if(spawn2_timer.Check()) { LinkedListIterator iterator(spawn2_list); - Inventory::CleanDirty(); + InventoryOld::CleanDirty(); iterator.Reset(); while (iterator.MoreElements()) {