mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 00:22:25 +00:00
Renamed Inventory to InventoryOld
This commit is contained in:
parent
b48a712887
commit
b75e6308dd
@ -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;
|
||||
|
||||
@ -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 */
|
||||
|
||||
166
common/item.cpp
166
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<int16, ItemInst*> &collection, ItemInst *inst) {
|
||||
int InventoryOld::GetSlotByItemInstCollection(const std::map<int16, ItemInst*> &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<int16, ItemInst*> &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<int16, ItemInst*> &col
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection)
|
||||
void InventoryOld::dumpItemCollection(const std::map<int16, ItemInst*> &collection)
|
||||
{
|
||||
for (auto it = collection.cbegin(); it != collection.cend(); ++it) {
|
||||
auto inst = it->second;
|
||||
@ -1088,7 +1088,7 @@ void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection)
|
||||
}
|
||||
}
|
||||
|
||||
void Inventory::dumpBagContents(ItemInst *inst, std::map<int16, ItemInst*>::const_iterator *it)
|
||||
void InventoryOld::dumpBagContents(ItemInst *inst, std::map<int16, ItemInst*>::const_iterator *it)
|
||||
{
|
||||
if (!inst || !inst->IsType(ItemClassContainer))
|
||||
return;
|
||||
@ -1099,7 +1099,7 @@ void Inventory::dumpBagContents(ItemInst *inst, std::map<int16, ItemInst*>::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<int16, ItemInst*>::cons
|
||||
}
|
||||
|
||||
// Internal Method: Retrieves item within an inventory bucket
|
||||
ItemInst* Inventory::_GetItem(const std::map<int16, ItemInst*>& bucket, int16 slot_id) const
|
||||
ItemInst* InventoryOld::_GetItem(const std::map<int16, ItemInst*>& 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<int16, ItemInst*>& 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<int16, ItemInst*>& bucket, uint32 item_id, uint8 quantity)
|
||||
int16 InventoryOld::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, uint8 quantity)
|
||||
{
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
@ -1212,7 +1212,7 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& 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<int16, ItemInst*>& 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<int16, ItemInst*>& bucket, uint8 use, uint8 quantity)
|
||||
int16 InventoryOld::_HasItemByUse(std::map<int16, ItemInst*>& bucket, uint8 use, uint8 quantity)
|
||||
{
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
@ -1300,7 +1300,7 @@ int16 Inventory::_HasItemByUse(std::map<int16, ItemInst*>& 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<int16, ItemInst*>& 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<int16, ItemInst*>& bucket, uint32 loregroup)
|
||||
int16 InventoryOld::_HasItemByLoreGroup(std::map<int16, ItemInst*>& 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<int16, ItemInst*>& 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<int16, ItemInst*>& 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... <watch>
|
||||
else if (slot_id != MainPowerSource && slot_id > EmuConstants::EQUIPMENT_END) { return true; }
|
||||
|
||||
@ -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<uint8, ItemInst*>::const_iterator _cbegin() { return m_contents.cbegin(); }
|
||||
std::map<uint8, ItemInst*>::const_iterator _cend() { return m_contents.cend(); }
|
||||
|
||||
friend class Inventory;
|
||||
friend class InventoryOld;
|
||||
|
||||
|
||||
void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; }
|
||||
|
||||
@ -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: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
|
||||
@ -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: <watch>
|
||||
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);
|
||||
|
||||
@ -3913,7 +3913,7 @@ namespace SoD
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
|
||||
@ -3235,7 +3235,7 @@ namespace SoF
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
|
||||
@ -4214,7 +4214,7 @@ namespace UF
|
||||
|
||||
/*
|
||||
// TEST CODE: <watch>
|
||||
SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x);
|
||||
SubSlotNumber = InventoryOld::CalcSlotID(slot_id_in, x);
|
||||
*/
|
||||
|
||||
SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1);
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <map>
|
||||
|
||||
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<uint32, uint32> 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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -34,7 +34,7 @@ extern std::vector<RaceClassCombos> 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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
14
zone/bot.cpp
14
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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -164,7 +164,7 @@ int Lua_Inventory::GetSlotByItemInst(Lua_ItemInst inst) {
|
||||
}
|
||||
|
||||
luabind::scope lua_register_inventory() {
|
||||
return luabind::class_<Lua_Inventory>("Inventory")
|
||||
return luabind::class_<Lua_Inventory>("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)
|
||||
|
||||
@ -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<Inventory>
|
||||
class Lua_Inventory : public Lua_Ptr<InventoryOld>
|
||||
{
|
||||
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<Inventory*>(GetLuaPtrData());
|
||||
operator InventoryOld*() {
|
||||
return reinterpret_cast<InventoryOld*>(GetLuaPtrData());
|
||||
}
|
||||
|
||||
Lua_ItemInst GetItem(int slot_id);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ private:
|
||||
uint8 _OwnerClientVersion;
|
||||
uint32 _currentStance;
|
||||
|
||||
Inventory m_inv;
|
||||
InventoryOld m_inv;
|
||||
int32 max_end;
|
||||
int32 cur_end;
|
||||
bool _medding;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -1173,7 +1173,7 @@ bool Zone::Process() {
|
||||
if(spawn2_timer.Check()) {
|
||||
LinkedListIterator<Spawn2*> iterator(spawn2_list);
|
||||
|
||||
Inventory::CleanDirty();
|
||||
InventoryOld::CleanDirty();
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user