Refactoring

This commit is contained in:
KimLS 2015-02-20 20:15:58 -08:00
parent 2d617f0ea7
commit a90e9cf4c6
28 changed files with 181 additions and 105 deletions

View File

@ -33,36 +33,62 @@ EQEmu::Inventory::~Inventory() {
delete impl_; delete impl_;
} }
std::shared_ptr<EQEmu::ItemInstance> EQEmu::Inventory::Get(int container_id, int slot_id) { std::shared_ptr<EQEmu::ItemInstance> EQEmu::Inventory::Get(const InventorySlot &slot) {
auto iter = impl_->containers_.find(container_id); auto iter = impl_->containers_.find(slot.type_);
if(iter != impl_->containers_.end()) { if(iter != impl_->containers_.end()) {
return iter->second.Get(slot_id); auto item = iter->second.Get(slot.slot_);
}
return std::shared_ptr<ItemInstance>(nullptr);
}
std::shared_ptr<EQEmu::ItemInstance> EQEmu::Inventory::Get(int container_id, int slot_id, int bag_idx) {
auto iter = impl_->containers_.find(container_id);
if(iter != impl_->containers_.end()) {
auto item = iter->second.Get(slot_id);
if(item) { if(item) {
return item->GetItem(bag_idx); if(slot.bag_index_ > -1) {
auto sub_item = item->Get(slot.bag_index_);
if(sub_item) {
if(slot.aug_index_ > -1) {
return sub_item->Get(slot.aug_index_);
} else {
return sub_item;
}
}
} else {
return item;
}
} }
} }
return std::shared_ptr<ItemInstance>(nullptr); return std::shared_ptr<ItemInstance>(nullptr);
} }
bool EQEmu::Inventory::Put(int container_id, int slot_id, std::shared_ptr<ItemInstance> inst) { bool EQEmu::Inventory::Put(const InventorySlot &slot, std::shared_ptr<ItemInstance> inst) {
if(impl_->containers_.count(container_id) == 0) { if(impl_->containers_.count(slot.type_) == 0) {
auto &container = impl_->containers_[container_id]; impl_->containers_.insert(std::pair<int, ItemContainer>(slot.type_, ItemContainer()));
return container.Put(slot_id, inst);
} else {
ItemContainer container;
bool v = container.Put(slot_id, inst);
impl_->containers_[container_id] = container;
return v;
} }
auto &container = impl_->containers_[slot.type_];
if(slot.bag_index_ > -1) {
auto item = container.Get(slot.slot_);
if(!item)
return false;
if(slot.aug_index_ > -1) {
auto bag_item = item->Get(slot.bag_index_);
if(!bag_item) {
return false;
}
return bag_item->Put(slot.aug_index_, inst);
} else {
return item->Put(slot.bag_index_, inst);
}
} else {
if(slot.aug_index_ > -1) {
auto item = container.Get(slot.slot_);
if(!item)
return false;
return item->Put(slot.aug_index_, inst);
}
return container.Put(slot.slot_, inst);
}
return false;
} }

View File

@ -23,6 +23,21 @@
namespace EQEmu namespace EQEmu
{ {
struct InventorySlot
{
InventorySlot(int type, int slot)
: type_(type), slot_(slot), bag_index_(-1), aug_index_(-1) { }
InventorySlot(int type, int slot, int bag_index)
: type_(type), slot_(slot), bag_index_(bag_index), aug_index_(-1) { }
InventorySlot(int type, int slot, int bag_index, int aug_index)
: type_(type), slot_(slot), bag_index_(bag_index), aug_index_(aug_index) { }
int type_;
int slot_;
int bag_index_;
int aug_index_;
};
enum InventoryType : int enum InventoryType : int
{ {
InvTypePersonal = 0, InvTypePersonal = 0,
@ -42,9 +57,9 @@ namespace EQEmu
Inventory(); Inventory();
~Inventory(); ~Inventory();
std::shared_ptr<ItemInstance> Get(int container_id, int slot_id); std::shared_ptr<ItemInstance> Get(const InventorySlot &slot);
std::shared_ptr<ItemInstance> Get(int container_id, int slot_id, int bag_idx); bool Put(const InventorySlot &slot, std::shared_ptr<ItemInstance> inst);
bool Put(int container_id, int slot_id, std::shared_ptr<ItemInstance> inst); bool Swap(const InventorySlot &src, const InventorySlot &dest);
private: private:
struct impl; struct impl;
impl *impl_; impl *impl_;

View File

@ -1994,7 +1994,7 @@ void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id)
if (item_id == NO_ITEM) { return; } if (item_id == NO_ITEM) { return; }
if (db == nullptr) { return; /* TODO: add log message for nullptr */ } if (db == nullptr) { return; /* TODO: add log message for nullptr */ }
const ItemInst* aug = db->CreateItem(item_id); const ItemInst* aug = db->CreateItemOld(item_id);
if (aug) { if (aug) {
PutAugment(slot, *aug); PutAugment(slot, *aug);
safe_delete(aug); safe_delete(aug);

View File

@ -9,12 +9,18 @@ struct EQEmu::ItemContainer::impl
EQEmu::ItemContainer::ItemContainer() EQEmu::ItemContainer::ItemContainer()
{ {
impl_ = new impl; impl_ = new impl();
} }
EQEmu::ItemContainer::~ItemContainer() EQEmu::ItemContainer::~ItemContainer()
{ {
delete impl_; if(impl_)
delete impl_;
}
EQEmu::ItemContainer::ItemContainer(ItemContainer &&other) {
impl_ = other.impl_;
other.impl_ = nullptr;
} }
std::shared_ptr<EQEmu::ItemInstance> EQEmu::ItemContainer::Get(int slot_id) { std::shared_ptr<EQEmu::ItemInstance> EQEmu::ItemContainer::Get(int slot_id) {

View File

@ -29,11 +29,15 @@ namespace EQEmu
public: public:
ItemContainer(); ItemContainer();
~ItemContainer(); ~ItemContainer();
ItemContainer(ItemContainer &&other);
std::shared_ptr<ItemInstance> Get(int slot_id); std::shared_ptr<ItemInstance> Get(int slot_id);
bool Put(int slot_id, std::shared_ptr<ItemInstance> inst); bool Put(int slot_id, std::shared_ptr<ItemInstance> inst);
bool Delete(int slot_id); bool Delete(int slot_id);
private: private:
ItemContainer(const ItemContainer &other);
ItemContainer& operator=(const ItemContainer &other);
struct impl; struct impl;
impl *impl_; impl *impl_;
}; };

View File

@ -81,7 +81,7 @@ const ItemData *EQEmu::ItemInstance::GetItem() {
return impl_->modified_item_ ? impl_->modified_item_ : impl_->base_item_; return impl_->modified_item_ ? impl_->modified_item_ : impl_->base_item_;
} }
std::shared_ptr<EQEmu::ItemInstance> EQEmu::ItemInstance::GetItem(int index) { std::shared_ptr<EQEmu::ItemInstance> EQEmu::ItemInstance::Get(int index) {
if(EQEmu::ValueWithin(index, 0, 255)) { if(EQEmu::ValueWithin(index, 0, 255)) {
return impl_->contents_.Get(index); return impl_->contents_.Get(index);
} }
@ -89,7 +89,7 @@ std::shared_ptr<EQEmu::ItemInstance> EQEmu::ItemInstance::GetItem(int index) {
return std::shared_ptr<EQEmu::ItemInstance>(nullptr); return std::shared_ptr<EQEmu::ItemInstance>(nullptr);
} }
bool EQEmu::ItemInstance::PutItem(int index, std::shared_ptr<ItemInstance> inst) { bool EQEmu::ItemInstance::Put(int index, std::shared_ptr<ItemInstance> inst) {
if(!inst || !inst->GetItem()) { if(!inst || !inst->GetItem()) {
return false; return false;
} }

View File

@ -33,8 +33,8 @@ namespace EQEmu
~ItemInstance(); ~ItemInstance();
const ItemData *GetItem(); const ItemData *GetItem();
std::shared_ptr<ItemInstance> GetItem(int index); std::shared_ptr<ItemInstance> Get(int index);
bool PutItem(int index, std::shared_ptr<ItemInstance> inst); bool Put(int index, std::shared_ptr<ItemInstance> inst);
private: private:
struct impl; struct impl;
impl *impl_; impl *impl_;

View File

@ -371,7 +371,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, InventoryOld* in
if(!myitem) if(!myitem)
continue; continue;
ItemInst* myinst = CreateBaseItem(myitem, charges); ItemInst* myinst = CreateBaseItemOld(myitem, charges);
if(slot < 0) if(slot < 0)
slot = inv->FindFreeSlot(0, 0); slot = inv->FindFreeSlot(0, 0);
@ -433,7 +433,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, InventoryOld *inv, bool is_charid)
int16 put_slot_id = INVALID_INDEX; int16 put_slot_id = INVALID_INDEX;
ItemInst *inst = CreateBaseItem(item, charges); ItemInst *inst = CreateBaseItemOld(item, charges);
if (inst && item->ItemClass == ItemClassCommon) { if (inst && item->ItemClass == ItemClassCommon) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (aug[i]) if (aug[i])
@ -536,7 +536,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::Inventory *inv)
// //
// int16 put_slot_id = INVALID_INDEX; // int16 put_slot_id = INVALID_INDEX;
// //
// ItemInst *inst = CreateBaseItem(item, charges); // ItemInst *inst = CreateBaseItemOld(item, charges);
// //
// if (inst == nullptr) // if (inst == nullptr)
// continue; // continue;
@ -671,7 +671,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, InventoryOld *i
if (!item) if (!item)
continue; continue;
ItemInst *inst = CreateBaseItem(item, charges); ItemInst *inst = CreateBaseItemOld(item, charges);
if (inst == nullptr) if (inst == nullptr)
continue; continue;
@ -1257,14 +1257,14 @@ bool SharedDatabase::LoadNPCFactionLists() {
} }
// Create appropriate ItemInst class // Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) ItemInst* SharedDatabase::CreateItemOld(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{ {
const ItemData* item = nullptr; const ItemData* item = nullptr;
ItemInst* inst = nullptr; ItemInst* inst = nullptr;
item = GetItem(item_id); item = GetItem(item_id);
if (item) { if (item) {
inst = CreateBaseItem(item, charges); inst = CreateBaseItemOld(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
@ -1286,14 +1286,14 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
// Create appropriate ItemInst class // Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(const ItemData* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) ItemInst* SharedDatabase::CreateItemOld(const ItemData* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{ {
ItemInst* inst = nullptr; ItemInst* inst = nullptr;
if (item) { if (item) {
inst = CreateBaseItem(item, charges); inst = CreateBaseItemOld(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItemOld()");
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
@ -1310,7 +1310,7 @@ ItemInst* SharedDatabase::CreateItem(const ItemData* item, int16 charges, uint32
return inst; return inst;
} }
ItemInst* SharedDatabase::CreateBaseItem(const ItemData* item, int16 charges) { ItemInst* SharedDatabase::CreateBaseItemOld(const ItemData* item, int16 charges) {
ItemInst* inst = nullptr; ItemInst* inst = nullptr;
if (item) { if (item) {
// if maxcharges is -1 that means it is an unlimited use item. // if maxcharges is -1 that means it is an unlimited use item.
@ -1324,7 +1324,7 @@ ItemInst* SharedDatabase::CreateBaseItem(const ItemData* item, int16 charges) {
inst = new ItemInst(item, charges); inst = new ItemInst(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItemOld()");
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
@ -1336,6 +1336,23 @@ ItemInst* SharedDatabase::CreateBaseItem(const ItemData* item, int16 charges) {
return inst; return inst;
} }
std::shared_ptr<EQEmu::ItemInstance> SharedDatabase::CreateItem(uint32 item_id, int16 charges) {
const ItemData* item = GetItem(item_id);
if(item) {
if(charges == 0 && item->MaxCharges == -1) {
charges = 1;
}
if(charges <= 0 && item->Stackable) {
charges = 1;
}
return std::shared_ptr<EQEmu::ItemInstance>(new EQEmu::ItemInstance(item, charges));
}
return std::shared_ptr<EQEmu::ItemInstance>(nullptr);
}
int32 SharedDatabase::DeleteStalePlayerCorpses() { int32 SharedDatabase::DeleteStalePlayerCorpses() {
if(RuleB(Zone, EnableShadowrest)) { if(RuleB(Zone, EnableShadowrest)) {
std::string query = StringFormat( std::string query = StringFormat(

View File

@ -82,9 +82,10 @@ class SharedDatabase : public Database
/* /*
Item Methods Item Methods
*/ */
ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); ItemInst* CreateItemOld(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateItem(const ItemData* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); ItemInst* CreateItemOld(const ItemData* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateBaseItem(const ItemData* item, int16 charges = 0); ItemInst* CreateBaseItemOld(const ItemData* item, int16 charges = 0);
std::shared_ptr<EQEmu::ItemInstance> CreateItem(uint32 item_id, int16 charges = 0);
/* /*
Shared Memory crap Shared Memory crap

View File

@ -139,36 +139,43 @@ public:
void InitInventory() void InitInventory()
{ {
std::shared_ptr<EQEmu::ItemInstance> bag(new EQEmu::ItemInstance(&container)); std::shared_ptr<EQEmu::ItemInstance> m_bag(new EQEmu::ItemInstance(&container));
bag->PutItem(0, std::shared_ptr<EQEmu::ItemInstance>(new EQEmu::ItemInstance(&armor))); std::shared_ptr<EQEmu::ItemInstance> m_armor(new EQEmu::ItemInstance(&armor));
bag->PutItem(1, std::shared_ptr<EQEmu::ItemInstance>(new EQEmu::ItemInstance(&augment))); std::shared_ptr<EQEmu::ItemInstance> m_augment(new EQEmu::ItemInstance(&augment));
bag->PutItem(7, std::shared_ptr<EQEmu::ItemInstance>(new EQEmu::ItemInstance(&stackable, 45))); std::shared_ptr<EQEmu::ItemInstance> m_stackable(new EQEmu::ItemInstance(&stackable, 45));
inv.Put(0, 23, bag); //23 first inv slot inv.Put(EQEmu::InventorySlot(0, 23), m_bag);
inv.Put(EQEmu::InventorySlot(0, 23, 0), m_armor);
inv.Put(EQEmu::InventorySlot(0, 23, 1), m_augment);
inv.Put(EQEmu::InventorySlot(0, 23, 7), m_stackable);
} }
void InventoryVerifyInitialItemsTest() void InventoryVerifyInitialItemsTest()
{ {
auto m_bag = inv.Get(0, 23); auto m_bag = inv.Get(EQEmu::InventorySlot(0, 23));
TEST_ASSERT(m_bag); TEST_ASSERT(m_bag);
TEST_ASSERT(m_bag->GetItem()); TEST_ASSERT(m_bag->GetItem());
TEST_ASSERT(m_bag->GetItem()->ID == 1000); TEST_ASSERT(m_bag->GetItem()->ID == 1000);
auto m_armor = m_bag->GetItem(0); auto m_armor = m_bag->Get(0);
TEST_ASSERT(m_armor); TEST_ASSERT(m_armor);
TEST_ASSERT(m_armor->GetItem()); TEST_ASSERT(m_armor->GetItem());
TEST_ASSERT(m_armor->GetItem()->ID == 1001); TEST_ASSERT(m_armor->GetItem()->ID == 1001);
auto m_augment = m_bag->GetItem(1); auto m_augment = m_bag->Get(1);
TEST_ASSERT(m_augment); TEST_ASSERT(m_augment);
TEST_ASSERT(m_augment->GetItem()); TEST_ASSERT(m_augment->GetItem());
TEST_ASSERT(m_augment->GetItem()->ID == 1002); TEST_ASSERT(m_augment->GetItem()->ID == 1002);
auto m_stackable = m_bag->GetItem(7); auto m_stackable = m_bag->Get(7);
TEST_ASSERT(m_stackable); TEST_ASSERT(m_stackable);
TEST_ASSERT(m_stackable->GetItem()); TEST_ASSERT(m_stackable->GetItem());
TEST_ASSERT(m_stackable->GetItem()->ID == 1003); TEST_ASSERT(m_stackable->GetItem()->ID == 1003);
} }
void InventorySwapItemsTest()
{
}
private: private:
EQEmu::Inventory inv; EQEmu::Inventory inv;
ItemData container; ItemData container;

View File

@ -4219,7 +4219,7 @@ void Bot::GetBotItems(std::string* errorMessage, InventoryOld &inv) {
aug[4] = (uint32)atoul(row[8]); aug[4] = (uint32)atoul(row[8]);
bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false;
ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); ItemInst* inst = database.CreateItemOld(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]);
if (!inst) { if (!inst) {
Log.Out(Logs::General, Logs::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); Log.Out(Logs::General, Logs::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id);
continue; continue;

View File

@ -5423,7 +5423,7 @@ bool Client::TryReward(uint32 claim_id) {
} }
InternalVeteranReward ivr = (*iter); InternalVeteranReward ivr = (*iter);
ItemInst *claim = database.CreateItem(ivr.items[0].item_id, ivr.items[0].charges); ItemInst *claim = database.CreateItemOld(ivr.items[0].item_id, ivr.items[0].charges);
if(!claim) { if(!claim) {
Save(); Save();
return true; return true;
@ -5433,7 +5433,7 @@ bool Client::TryReward(uint32 claim_id) {
for(int y = 1; y < 8; y++) for(int y = 1; y < 8; y++)
if(ivr.items[y].item_id && claim->GetItem()->ItemClass == 1) { if(ivr.items[y].item_id && claim->GetItem()->ItemClass == 1) {
ItemInst *item_temp = database.CreateItem(ivr.items[y].item_id, ivr.items[y].charges); ItemInst *item_temp = database.CreateItemOld(ivr.items[y].item_id, ivr.items[y].charges);
if(item_temp) { if(item_temp) {
if(CheckLoreConflict(item_temp->GetItem())) { if(CheckLoreConflict(item_temp->GetItem())) {
lore_conflict = true; lore_conflict = true;

View File

@ -2056,7 +2056,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app)
if (item->MaxCharges != 0) if (item->MaxCharges != 0)
charges = item->MaxCharges; charges = item->MaxCharges;
ItemInst *inst = database.CreateItem(item, charges); ItemInst *inst = database.CreateItemOld(item, charges);
if (!AutoPutLootInInventory(*inst, true, true)) if (!AutoPutLootInInventory(*inst, true, true))
{ {
PutLootInInventory(MainCursor, *inst); PutLootInInventory(MainCursor, *inst);
@ -2579,7 +2579,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app)
if (item->MaxCharges != 0) if (item->MaxCharges != 0)
charges = item->MaxCharges; charges = item->MaxCharges;
ItemInst *inst = database.CreateItem(item, charges); ItemInst *inst = database.CreateItemOld(item, charges);
if (!AutoPutLootInInventory(*inst, true, true)) if (!AutoPutLootInInventory(*inst, true, true))
{ {
PutLootInInventory(MainCursor, *inst); PutLootInInventory(MainCursor, *inst);
@ -3383,7 +3383,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app)
Message(13, "Error: This item does not exist!"); Message(13, "Error: This item does not exist!");
else else
{ {
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if (inst) if (inst)
{ {
SendItemPacket(0, inst, ItemPacketViewLink); SendItemPacket(0, inst, ItemPacketViewLink);
@ -3416,7 +3416,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app)
Message(13, "Error: This item does not exist!"); Message(13, "Error: This item does not exist!");
else else
{ {
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if (inst) if (inst)
{ {
SendItemPacket(0, inst, ItemPacketViewLink); SendItemPacket(0, inst, ItemPacketViewLink);
@ -3456,7 +3456,7 @@ void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app)
return; return;
} }
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if (inst) { if (inst) {
SendItemPacket(0, inst, ItemPacketViewLink); SendItemPacket(0, inst, ItemPacketViewLink);
@ -8081,7 +8081,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
} }
ItemInst* inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4], ivrs->augments[5]); ItemInst* inst = database.CreateItemOld(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4], ivrs->augments[5]);
if (inst) { if (inst) {
SendItemPacket(0, inst, ItemPacketViewLink); SendItemPacket(0, inst, ItemPacketViewLink);
safe_delete(inst); safe_delete(inst);
@ -8096,7 +8096,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app)
return; return;
} }
LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer;
ItemInst* inst = database.CreateItem(item->item_id); ItemInst* inst = database.CreateItemOld(item->item_id);
if (inst) { if (inst) {
SendItemPacket(0, inst, ItemPacketViewLink); SendItemPacket(0, inst, ItemPacketViewLink);
safe_delete(inst); safe_delete(inst);
@ -12064,7 +12064,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
else else
charges = item->MaxCharges; charges = item->MaxCharges;
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItemOld(item, charges);
int SinglePrice = 0; int SinglePrice = 0;
if (RuleB(Merchant, UsePriceMod)) if (RuleB(Merchant, UsePriceMod))

View File

@ -962,7 +962,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
int charges = 1; int charges = 1;
if (item->ItemClass == ItemClassCommon) if (item->ItemClass == ItemClassCommon)
charges = item->MaxCharges; charges = item->MaxCharges;
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItemOld(item, charges);
if (inst) { if (inst) {
if (RuleB(Merchant, UsePriceMod)) { if (RuleB(Merchant, UsePriceMod)) {
inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false)));
@ -1003,7 +1003,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
// charges=ml.charges; // charges=ml.charges;
//else //else
charges = item->MaxCharges; charges = item->MaxCharges;
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItemOld(item, charges);
if (inst) { if (inst) {
if (RuleB(Merchant, UsePriceMod)) { if (RuleB(Merchant, UsePriceMod)) {
inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false)));

View File

@ -10201,7 +10201,7 @@ void command_zopp(Client *c, const Seperator *sep)
c->Message(0, "Processing request..results may cause unpredictable behavior."); c->Message(0, "Processing request..results may cause unpredictable behavior.");
} }
ItemInst* FakeItemInst = database.CreateItem(FakeItem, charges); ItemInst* FakeItemInst = database.CreateItemOld(FakeItem, charges);
c->SendItemPacket(slotid, FakeItemInst, packettype); c->SendItemPacket(slotid, FakeItemInst, packettype);
c->Message(0, "Sending zephyr op packet to client - [%s] %s (%u) with %i %s to slot %i.", c->Message(0, "Sending zephyr op packet to client - [%s] %s (%u) with %i %s to slot %i.",
packettype == ItemPacketTrade ? "Trade" : "Summon", FakeItem->Name, itemid, charges, packettype == ItemPacketTrade ? "Trade" : "Summon", FakeItem->Name, itemid, charges,

View File

@ -972,7 +972,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(Loot_Request_Type == 5) { if(Loot_Request_Type == 5) {
int pkitem = GetPlayerKillItem(); int pkitem = GetPlayerKillItem();
const ItemData* item = database.GetItem(pkitem); const ItemData* item = database.GetItem(pkitem);
ItemInst* inst = database.CreateItem(item, item->MaxCharges); ItemInst* inst = database.CreateItemOld(item, item->MaxCharges);
if(inst) { if(inst) {
if (item->RecastDelay) if (item->RecastDelay)
inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0);
@ -1005,7 +1005,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(i < corpselootlimit) { if(i < corpselootlimit) {
item = database.GetItem(item_data->item_id); item = database.GetItem(item_data->item_id);
if(client && item) { if(client && item) {
ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); ItemInst* inst = database.CreateItemOld(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned);
if(inst) { if(inst) {
if (item->RecastDelay) if (item->RecastDelay)
inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0); inst->SetRecastTimestamp(timestamps.count(item->RecastType) ? timestamps.at(item->RecastType) : 0);
@ -1122,10 +1122,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (item != 0) { if (item != 0) {
if (item_data){ if (item_data){
inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); inst = database.CreateItemOld(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned);
} }
else { else {
inst = database.CreateItem(item); inst = database.CreateItemOld(item);
} }
} }

View File

@ -298,7 +298,7 @@ void Client::GoFish()
const ItemData* food_item = database.GetItem(food_id); const ItemData* food_item = database.GetItem(food_id);
Message_StringID(MT_Skills, FISHING_SUCCESS); Message_StringID(MT_Skills, FISHING_SUCCESS);
ItemInst* inst = database.CreateItem(food_item, 1); ItemInst* inst = database.CreateItemOld(food_item, 1);
if(inst != nullptr) { if(inst != nullptr) {
if(CheckLoreConflict(inst->GetItem())) if(CheckLoreConflict(inst->GetItem()))
{ {
@ -414,7 +414,7 @@ void Client::ForageItem(bool guarantee) {
} }
Message_StringID(MT_Skills, stringid); Message_StringID(MT_Skills, stringid);
ItemInst* inst = database.CreateItem(food_item, 1); ItemInst* inst = database.CreateItemOld(food_item, 1);
if(inst != nullptr) { if(inst != nullptr) {
// check to make sure it isn't a foraged lore item // check to make sure it isn't a foraged lore item
if(CheckLoreConflict(inst->GetItem())) if(CheckLoreConflict(inst->GetItem()))

View File

@ -1021,7 +1021,7 @@ ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID,
if((SlotID > (GUILD_BANK_DEPOSIT_AREA_SIZE - 1))) if((SlotID > (GUILD_BANK_DEPOSIT_AREA_SIZE - 1)))
return nullptr; return nullptr;
inst = database.CreateItem((*Iterator)->Items.DepositArea[SlotID].ItemID); inst = database.CreateItemOld((*Iterator)->Items.DepositArea[SlotID].ItemID);
if(!inst) if(!inst)
return nullptr; return nullptr;
@ -1034,7 +1034,7 @@ ItemInst* GuildBankManager::GetItem(uint32 GuildID, uint16 Area, uint16 SlotID,
if((SlotID > (GUILD_BANK_MAIN_AREA_SIZE - 1))) if((SlotID > (GUILD_BANK_MAIN_AREA_SIZE - 1)))
return nullptr; return nullptr;
inst = database.CreateItem((*Iterator)->Items.MainArea[SlotID].ItemID); inst = database.CreateItemOld((*Iterator)->Items.MainArea[SlotID].ItemID);
if(!inst) if(!inst)
return nullptr; return nullptr;

View File

@ -528,7 +528,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// in any other situation just use charges as passed // in any other situation just use charges as passed
ItemInst* inst = database.CreateItem(item, charges); ItemInst* inst = database.CreateItemOld(item, charges);
if(inst == nullptr) { if(inst == nullptr) {
Message(13, "An unknown server error has occurred and your item was not created."); Message(13, "An unknown server error has occurred and your item was not created.");
@ -900,7 +900,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
if(bag_item_data[i] == nullptr) if(bag_item_data[i] == nullptr)
continue; 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); const ItemInst *bagitem = database.CreateItemOld(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 = InventoryOld::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); 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); PutLootInInventory(interior_slot, *bagitem);
@ -1707,7 +1707,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Split into two // Split into two
src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack);
Log.Out(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); Log.Out(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges());
ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); ItemInst* inst = database.CreateItemOld(src_inst->GetItem(), move_in->number_in_stack);
m_inv.PutItem(dst_slot_id, *inst); m_inv.PutItem(dst_slot_id, *inst);
safe_delete(inst); safe_delete(inst);
} }
@ -1802,7 +1802,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
// This prevents the client from crashing when closing any 'phantom' bags -U // This prevents the client from crashing when closing any 'phantom' bags -U
const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
ItemInst* token_inst = database.CreateItem(token_struct, 1); ItemInst* token_inst = database.CreateItemOld(token_struct, 1);
SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
@ -1827,7 +1827,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
if(m_inv[resync_slot]) { if(m_inv[resync_slot]) {
const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
ItemInst* token_inst = database.CreateItem(token_struct, 1); ItemInst* token_inst = database.CreateItemOld(token_struct, 1);
SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);
@ -1844,7 +1844,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
int16 resync_slot = (InventoryOld::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : InventoryOld::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 (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
ItemInst* token_inst = database.CreateItem(token_struct, 1); ItemInst* token_inst = database.CreateItemOld(token_struct, 1);
SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
@ -1869,7 +1869,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) { if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
if(m_inv[resync_slot]) { if(m_inv[resync_slot]) {
const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin' const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
ItemInst* token_inst = database.CreateItem(token_struct, 1); ItemInst* token_inst = database.CreateItemOld(token_struct, 1);
SendItemPacket(resync_slot, token_inst, ItemPacketTrade); SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade);

View File

@ -9,12 +9,12 @@
#include "lua_item.h" #include "lua_item.h"
Lua_ItemInst::Lua_ItemInst(int item_id) { Lua_ItemInst::Lua_ItemInst(int item_id) {
SetLuaPtrData(database.CreateItem(item_id)); SetLuaPtrData(database.CreateItemOld(item_id));
cloned_ = true; cloned_ = true;
} }
Lua_ItemInst::Lua_ItemInst(int item_id, int charges) { Lua_ItemInst::Lua_ItemInst(int item_id, int charges) {
SetLuaPtrData(database.CreateItem(item_id, charges)); SetLuaPtrData(database.CreateItemOld(item_id, charges));
cloned_ = true; cloned_ = true;
} }

View File

@ -3665,7 +3665,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
int32 Mob::GetItemStat(uint32 itemid, const char *identifier) int32 Mob::GetItemStat(uint32 itemid, const char *identifier)
{ {
const ItemInst* inst = database.CreateItem(itemid); const ItemInst* inst = database.CreateItemOld(itemid);
if (!inst) if (!inst)
return 0; return 0;

View File

@ -1378,7 +1378,7 @@ void NPC::PickPocket(Client* thief) {
const ItemData* item = database.GetItem(citem->item_id); const ItemData* item = database.GetItem(citem->item_id);
if (item) if (item)
{ {
inst = database.CreateItem(item, citem->charges); inst = database.CreateItemOld(item, citem->charges);
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false; bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow); int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
if (/*!Equipped(item->ID) &&*/ if (/*!Equipped(item->ID) &&*/
@ -1398,7 +1398,7 @@ void NPC::PickPocket(Client* thief) {
if (x > 0) if (x > 0)
{ {
int random = zone->random.Int(0, x-1); int random = zone->random.Int(0, x-1);
inst = database.CreateItem(steal_items[random], charges[random]); inst = database.CreateItemOld(steal_items[random], charges[random]);
if (inst) if (inst)
{ {
const ItemData* item = inst->GetItem(); const ItemData* item = inst->GetItem();

View File

@ -876,7 +876,7 @@ void Object::SetItemID(uint32 itemid)
if (itemid) if (itemid)
{ {
this->m_inst = database.CreateItem(itemid); this->m_inst = database.CreateItemOld(itemid);
} }
} }

View File

@ -1171,7 +1171,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
c->SendItemPacket(MainCursor, SummonedItem, ItemPacketSummonItem); c->SendItemPacket(MainCursor, SummonedItem, ItemPacketSummonItem);
safe_delete(SummonedItem); safe_delete(SummonedItem);
} }
SummonedItem = database.CreateItem(spell.base[i], charges); SummonedItem = database.CreateItemOld(spell.base[i], charges);
} }
} }
@ -1208,7 +1208,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
if (charges < 1) if (charges < 1)
charges = 1; charges = 1;
ItemInst *SubItem = database.CreateItem(spell.base[i], charges); ItemInst *SubItem = database.CreateItemOld(spell.base[i], charges);
if (SubItem != nullptr) { if (SubItem != nullptr) {
SummonedItem->PutItem(slot, *SubItem); SummonedItem->PutItem(slot, *SubItem);
safe_delete(SubItem); safe_delete(SubItem);

View File

@ -1165,7 +1165,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) {
return; return;
} }
ItemInst* inst = database.CreateItem(item, Quantity); ItemInst* inst = database.CreateItemOld(item, Quantity);
if (inst) if (inst)
{ {
@ -1204,7 +1204,7 @@ void Client::BulkSendTraderInventory(uint32 char_id) {
item=database.GetItem(TraderItems->ItemID[i]); item=database.GetItem(TraderItems->ItemID[i]);
if (item && (item->NoDrop!=0)) { if (item && (item->NoDrop!=0)) {
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if (inst) { if (inst) {
inst->SetSerialNumber(TraderItems->SerialNumber[i]); inst->SetSerialNumber(TraderItems->SerialNumber[i]);
if(TraderItems->Charges[i] > 0) if(TraderItems->Charges[i] > 0)
@ -2025,7 +2025,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru
if(!item) return; if(!item) return;
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if(!inst) return; if(!inst) return;
@ -2106,7 +2106,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St
Log.Out(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName()); Log.Out(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName());
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if(!inst) return; if(!inst) return;

View File

@ -161,7 +161,7 @@ void Client::DoTributeUpdate() {
uint32 item_id = tier.tribute_item_id; uint32 item_id = tier.tribute_item_id;
//summon the item for them //summon the item for them
const ItemInst* inst = database.CreateItem(item_id, 1); const ItemInst* inst = database.CreateItemOld(item_id, 1);
if(inst == nullptr) if(inst == nullptr)
continue; continue;

View File

@ -257,7 +257,7 @@ bool Zone::LoadZoneObjects() {
} }
else { else {
// Groundspawn object // Groundspawn object
inst = database.CreateItem(itemid); inst = database.CreateItemOld(itemid);
} }
//Father Nitwit's fix... not perfect... //Father Nitwit's fix... not perfect...
@ -295,7 +295,7 @@ bool Zone::LoadGroundSpawns() {
for(gsindex=0;gsindex<50;gsindex++){ for(gsindex=0;gsindex<50;gsindex++){
if(groundspawn.spawn[gsindex].item>0 && groundspawn.spawn[gsindex].item<500000){ if(groundspawn.spawn[gsindex].item>0 && groundspawn.spawn[gsindex].item<500000){
ItemInst* inst = nullptr; ItemInst* inst = nullptr;
inst = database.CreateItem(groundspawn.spawn[gsindex].item); inst = database.CreateItemOld(groundspawn.spawn[gsindex].item);
gsnumber=groundspawn.spawn[gsindex].max_allowed; gsnumber=groundspawn.spawn[gsindex].max_allowed;
ix=0; ix=0;
if(inst){ if(inst){

View File

@ -495,7 +495,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container)
aug[4] = (uint32)atoi(row[7]); aug[4] = (uint32)atoi(row[7]);
aug[5] = (uint32)atoi(row[8]); aug[5] = (uint32)atoi(row[8]);
ItemInst* inst = database.CreateItem(item_id, charges); ItemInst* inst = database.CreateItemOld(item_id, charges);
if (inst && inst->GetItem()->ItemClass == ItemClassCommon) { if (inst && inst->GetItem()->ItemClass == ItemClassCommon) {
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++)
if (aug[i]) if (aug[i])
@ -640,7 +640,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) {
if (item->NoDrop == 0) if (item->NoDrop == 0)
return nullptr; return nullptr;
ItemInst* inst = database.CreateItem(item); ItemInst* inst = database.CreateItemOld(item);
if(!inst) { if(!inst) {
Log.Out(Logs::Detail, Logs::Trading, "Unable to create item instance\n"); Log.Out(Logs::Detail, Logs::Trading, "Unable to create item instance\n");
fflush(stdout); fflush(stdout);