From bbc3733c3a97ab8c2c57488fd85291f571c10151 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 21 Jun 2015 01:45:42 -0700 Subject: [PATCH] Compiles again, had to disable a new piece of code though --- zone/bot.cpp | 3 +- zone/inventory.cpp | 215 ++++++++++++++++++++++---------------------- zone/loottables.cpp | 2 +- zone/mob.cpp | 2 +- 4 files changed, 112 insertions(+), 110 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 2f02abe12..536b661f8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -5,6 +5,7 @@ #include "doors.h" #include "quest_parser_collection.h" #include "../common/string_util.h" +#include "../common/item.h" extern volatile bool ZoneLoaded; @@ -9006,7 +9007,7 @@ void Bot::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug, return; } - const Item_Struct *item = inst->GetItem(); + const ItemData *item = inst->GetItem(); if(!isTribute && !inst->IsEquipable(GetBaseRace(),GetClass())) { diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 0cedb9d9a..e1eec88cc 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2271,113 +2271,114 @@ static bool CopyBagContents(ItemInst* new_bag, const ItemInst* old_bag) void Client::DisenchantSummonedBags(bool client_update) { - for (auto slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id) { - auto inst = m_inv[slot_id]; - if (!inst) { continue; } - if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } - if (inst->GetTotalItemCount() == 1) { continue; } - - auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); - if (!new_id) { continue; } - auto new_item = database.GetItem(new_id); - if (!new_item) { continue; } - auto new_inst = database.CreateBaseItem(new_item); - if (!new_inst) { continue; } - - if (CopyBagContents(new_inst, inst)) { - Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); - PutItemInInventory(slot_id, *new_inst, client_update); - } - safe_delete(new_inst); - } - - for (auto slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; ++slot_id) { - auto inst = m_inv[slot_id]; - if (!inst) { continue; } - if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } - if (inst->GetTotalItemCount() == 1) { continue; } - - auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); - if (!new_id) { continue; } - auto new_item = database.GetItem(new_id); - if (!new_item) { continue; } - auto new_inst = database.CreateBaseItem(new_item); - if (!new_inst) { continue; } - - if (CopyBagContents(new_inst, inst)) { - Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); - PutItemInInventory(slot_id, *new_inst, client_update); - } - safe_delete(new_inst); - } - - for (auto slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; ++slot_id) { - auto inst = m_inv[slot_id]; - if (!inst) { continue; } - if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } - if (inst->GetTotalItemCount() == 1) { continue; } - - auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); - if (!new_id) { continue; } - auto new_item = database.GetItem(new_id); - if (!new_item) { continue; } - auto new_inst = database.CreateBaseItem(new_item); - if (!new_inst) { continue; } - - if (CopyBagContents(new_inst, inst)) { - Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); - PutItemInInventory(slot_id, *new_inst, client_update); - } - safe_delete(new_inst); - } - - while (!m_inv.CursorEmpty()) { - auto inst = m_inv[MainCursor]; - if (!inst) { break; } - if (!IsSummonedBagID(inst->GetItem()->ID)) { break; } - if (inst->GetItem()->ItemClass != ItemClassContainer) { break; } - if (inst->GetTotalItemCount() == 1) { break; } - - auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); - if (!new_id) { break; } - auto new_item = database.GetItem(new_id); - if (!new_item) { break; } - auto new_inst = database.CreateBaseItem(new_item); - if (!new_inst) { break; } - - if (CopyBagContents(new_inst, inst)) { - Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, MainCursor); - std::list local; - local.push_front(new_inst); - m_inv.PopItem(MainCursor); - safe_delete(inst); - - while (!m_inv.CursorEmpty()) { - auto limbo_inst = m_inv.PopItem(MainCursor); - if (limbo_inst == nullptr) { continue; } - local.push_back(limbo_inst); - } - - for (auto iter = local.begin(); iter != local.end(); ++iter) { - auto cur_inst = *iter; - if (cur_inst == nullptr) { continue; } - m_inv.PushCursor(*cur_inst); - safe_delete(cur_inst); - } - local.clear(); - - auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); - database.SaveCursor(this->CharacterID(), s, e); - } - else { - safe_delete(new_inst); // deletes disenchanted bag if not used - } - - break; - } + //Inv2 todo: uh fix this + //for (auto slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id) { + // auto inst = m_inv[slot_id]; + // if (!inst) { continue; } + // if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } + // if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + // if (inst->GetTotalItemCount() == 1) { continue; } + // + // auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); + // if (!new_id) { continue; } + // auto new_item = database.GetItem(new_id); + // if (!new_item) { continue; } + // auto new_inst = database.CreateBaseItem(new_item); + // if (!new_inst) { continue; } + // + // if (CopyBagContents(new_inst, inst)) { + // Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); + // PutItemInInventory(slot_id, *new_inst, client_update); + // } + // safe_delete(new_inst); + //} + // + //for (auto slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; ++slot_id) { + // auto inst = m_inv[slot_id]; + // if (!inst) { continue; } + // if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } + // if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + // if (inst->GetTotalItemCount() == 1) { continue; } + // + // auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); + // if (!new_id) { continue; } + // auto new_item = database.GetItem(new_id); + // if (!new_item) { continue; } + // auto new_inst = database.CreateBaseItem(new_item); + // if (!new_inst) { continue; } + // + // if (CopyBagContents(new_inst, inst)) { + // Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); + // PutItemInInventory(slot_id, *new_inst, client_update); + // } + // safe_delete(new_inst); + //} + // + //for (auto slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; ++slot_id) { + // auto inst = m_inv[slot_id]; + // if (!inst) { continue; } + // if (!IsSummonedBagID(inst->GetItem()->ID)) { continue; } + // if (inst->GetItem()->ItemClass != ItemClassContainer) { continue; } + // if (inst->GetTotalItemCount() == 1) { continue; } + // + // auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); + // if (!new_id) { continue; } + // auto new_item = database.GetItem(new_id); + // if (!new_item) { continue; } + // auto new_inst = database.CreateBaseItem(new_item); + // if (!new_inst) { continue; } + // + // if (CopyBagContents(new_inst, inst)) { + // Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, slot_id); + // PutItemInInventory(slot_id, *new_inst, client_update); + // } + // safe_delete(new_inst); + //} + // + //while (!m_inv.CursorEmpty()) { + // auto inst = m_inv[MainCursor]; + // if (!inst) { break; } + // if (!IsSummonedBagID(inst->GetItem()->ID)) { break; } + // if (inst->GetItem()->ItemClass != ItemClassContainer) { break; } + // if (inst->GetTotalItemCount() == 1) { break; } + // + // auto new_id = GetDisenchantedBagID(inst->GetItem()->BagSlots); + // if (!new_id) { break; } + // auto new_item = database.GetItem(new_id); + // if (!new_item) { break; } + // auto new_inst = database.CreateBaseItem(new_item); + // if (!new_inst) { break; } + // + // if (CopyBagContents(new_inst, inst)) { + // Log.Out(Logs::General, Logs::Inventory, "Disenchant Summoned Bags: Replacing %s with %s in slot %i", inst->GetItem()->Name, new_inst->GetItem()->Name, MainCursor); + // std::list local; + // local.push_front(new_inst); + // m_inv.PopItem(MainCursor); + // safe_delete(inst); + // + // while (!m_inv.CursorEmpty()) { + // auto limbo_inst = m_inv.PopItem(MainCursor); + // if (limbo_inst == nullptr) { continue; } + // local.push_back(limbo_inst); + // } + // + // for (auto iter = local.begin(); iter != local.end(); ++iter) { + // auto cur_inst = *iter; + // if (cur_inst == nullptr) { continue; } + // m_inv.PushCursor(*cur_inst); + // safe_delete(cur_inst); + // } + // local.clear(); + // + // auto s = m_inv.cursor_cbegin(), e = m_inv.cursor_cend(); + // database.SaveCursor(this->CharacterID(), s, e); + // } + // else { + // safe_delete(new_inst); // deletes disenchanted bag if not used + // } + // + // break; + //} } void Client::RemoveNoRent(bool client_update) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 5cfd95239..372d7acd3 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -157,7 +157,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml for(int i = 0; i < mindrop; ++i) { float roll = (float)zone->random.Real(0.0, roll_t_min); for(uint32 j = 0; j < lds->NumEntries; ++j) { - const Item_Struct* db_item = GetItem(lds->Entries[j].item_id); + const ItemData* db_item = GetItem(lds->Entries[j].item_id); if(db_item) { if(roll < lds->Entries[j].chance) { npc->AddLootDrop(db_item, itemlist, lds->Entries[j].item_charges, lds->Entries[j].minlevel, diff --git a/zone/mob.cpp b/zone/mob.cpp index 41ad94d2d..990698e4b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2729,7 +2729,7 @@ void Mob::SendArmorAppearance(Client *one_client) { if (!IsClient()) { - const Item_Struct *item; + const ItemData *item; for (int i=0; i< 7 ; ++i) { item=database.GetItem(GetEquipment(i));