Renamed class Inventory to EQEmu::InventoryProfile

This commit is contained in:
Uleat
2016-10-17 04:59:00 -04:00
parent 1cb79c8c1f
commit 04f4fd652b
33 changed files with 586 additions and 573 deletions
+2 -2
View File
@@ -3325,7 +3325,7 @@ bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) {
// TEST CODE: test for bazaar trader crashing with charm items
if (Trader)
if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) {
EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i));
EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i));
if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel
continue;
}
@@ -3418,7 +3418,7 @@ bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) {
// TEST CODE: test for bazaar trader crashing with charm items
if (Trader)
if (i >= EQEmu::legacy::GENERAL_BAGS_BEGIN && i <= EQEmu::legacy::GENERAL_BAGS_END) {
EQEmu::ItemInstance* parent_item = m_inv.GetItem(Inventory::CalcSlotId(i));
EQEmu::ItemInstance* parent_item = m_inv.GetItem(EQEmu::InventoryProfile::CalcSlotId(i));
if (parent_item && parent_item->GetItem()->ID == 17899) // trader satchel
continue;
}
+7 -7
View File
@@ -2875,7 +2875,7 @@ void Bot::Spawn(Client* botCharacterOwner) {
for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) {
itemID = GetBotItemBySlot(i);
if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i);
materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i);
if(materialFromSlot != 0xFF)
this->SendWearChange(materialFromSlot);
}
@@ -2897,7 +2897,7 @@ void Bot::RemoveBotItemBySlot(uint32 slotID, std::string *errorMessage)
}
// Retrieves all the inventory records from the database for this bot.
void Bot::GetBotItems(Inventory &inv, std::string* errorMessage)
void Bot::GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage)
{
if(!GetBotID())
return;
@@ -3235,7 +3235,7 @@ EQEmu::ItemInstance* 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 = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot);
if (materialFromSlot != EQEmu::textures::materialInvalid) {
equipment[slot] = id; // npc has more than just material slots. Valid material should mean valid inventory index
@@ -3251,7 +3251,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 = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot);
if (materialFromSlot != EQEmu::textures::materialInvalid) {
equipment[slot] = 0; // npc has more than just material slots. Valid material should mean valid inventory index
@@ -3382,7 +3382,7 @@ void Bot::PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* cli
bool UpdateClient = false;
bool already_returned = false;
Inventory& clientInventory = client->GetInv();
EQEmu::InventoryProfile& clientInventory = client->GetInv();
const EQEmu::ItemInstance* inst = clientInventory[i];
if(inst) {
items[i] = inst->GetItem()->ID;
@@ -8434,7 +8434,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag)
return false;
for (uint8 i = EQEmu::textures::textureBegin; i < EQEmu::textures::weaponPrimary; ++i) {
uint8 inv_slot = Inventory::CalcSlotFromMaterial(i);
uint8 inv_slot = EQEmu::InventoryProfile::CalcSlotFromMaterial(i);
EQEmu::ItemInstance* inst = m_inv.GetItem(inv_slot);
if (!inst)
continue;
@@ -8444,7 +8444,7 @@ bool Bot::DyeArmor(int16 slot_id, uint32 rgb, bool all_flag, bool save_flag)
}
}
else {
uint8 mat_slot = Inventory::CalcMaterialFromSlot(slot_id);
uint8 mat_slot = EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id);
if (mat_slot == EQEmu::textures::materialInvalid || mat_slot >= EQEmu::textures::weaponPrimary)
return false;
+2 -2
View File
@@ -647,7 +647,7 @@ private:
bool _petChooser;
uint8 _petChooserID;
bool berserk;
Inventory m_inv;
EQEmu::InventoryProfile m_inv;
double _lastTotalPlayTime;
time_t _startTotalPlayTime;
Mob* _previousTarget;
@@ -711,7 +711,7 @@ private:
void SetBotID(uint32 botID);
// Private "Inventory" Methods
void GetBotItems(Inventory &inv, std::string* errorMessage);
void GetBotItems(EQEmu::InventoryProfile &inv, std::string* errorMessage);
void BotAddEquipItem(int slot, uint32 id);
uint32 GetBotItemBySlot(uint32 slotID);
+1 -1
View File
@@ -4375,7 +4375,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
bool dye_all = (sep->arg[1][0] == '*');
if (!dye_all) {
material_slot = atoi(sep->arg[1]);
slot_id = Inventory::CalcSlotFromMaterial(material_slot);
slot_id = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQEmu::textures::LastTintableTexture) {
c->Message(m_fail, "Valid [mat_slot]s for this command are:");
+2 -2
View File
@@ -1023,7 +1023,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
return true;
}
bool BotDatabase::LoadItems(const uint32 bot_id, Inventory& inventory_inst)
bool BotDatabase::LoadItems(const uint32 bot_id, EQEmu::InventoryProfile& inventory_inst)
{
if (!bot_id)
return false;
@@ -1279,7 +1279,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
if (!bot_id)
return false;
int16 slot_id = Inventory::CalcSlotFromMaterial(material_slot_id);
int16 slot_id = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot_id);
if (slot_id == INVALID_INDEX)
return false;
+2 -2
View File
@@ -31,12 +31,12 @@
class Bot;
class Inventory;
struct BotsAvailableList;
namespace EQEmu
{
class ItemInstance;
class InventoryProfile;
}
@@ -89,7 +89,7 @@ public:
/* Bot inventory functions */
bool QueryInventoryCount(const uint32 bot_id, uint32& item_count);
bool LoadItems(const uint32 bot_id, Inventory &inventory_inst);
bool LoadItems(const uint32 bot_id, EQEmu::InventoryProfile &inventory_inst);
bool SaveItems(Bot* bot_inst);
bool DeleteItems(const uint32 bot_id);
+2 -2
View File
@@ -2799,7 +2799,7 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) {
const EQEmu::ItemData* item = database.GetItem(item_id);
if (item && item->IsClassCommon())
{
uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot);
uint8 matslot = EQEmu::InventoryProfile::CalcMaterialFromSlot(in_slot);
if (matslot != EQEmu::textures::materialInvalid)
{
m_pp.item_material.Slot[matslot].Material = GetEquipmentMaterial(matslot);
@@ -3141,7 +3141,7 @@ void Client::SetTint(int16 in_slot, uint32 color) {
// Still need to reconcile bracer01 versus bracer02
void Client::SetTint(int16 in_slot, EQEmu::textures::Tint_Struct& color) {
uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot);
uint8 matslot = EQEmu::InventoryProfile::CalcMaterialFromSlot(in_slot);
if (matslot != EQEmu::textures::materialInvalid)
{
m_pp.item_tint.Slot[matslot].Color = color.Color;
+3 -3
View File
@@ -340,8 +340,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 EQEmu::InventoryProfile& GetInv() { return m_inv; }
inline const EQEmu::InventoryProfile& 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; }
@@ -1395,7 +1395,7 @@ private:
PlayerProfile_Struct m_pp;
ExtendedProfile_Struct m_epp;
Inventory m_inv;
EQEmu::InventoryProfile 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.
+2 -2
View File
@@ -2939,11 +2939,11 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
// in_augment->container_slot, in_augment->augment_slot, in_augment->container_index, in_augment->augment_index, in_augment->augment_action, in_augment->dest_inst_id);
EQEmu::ItemInstance *tobe_auged = nullptr, *old_aug = nullptr, *new_aug = nullptr, *aug = nullptr, *solvent = nullptr;
Inventory& user_inv = GetInv();
EQEmu::InventoryProfile& user_inv = GetInv();
uint16 item_slot = in_augment->container_slot;
uint16 solvent_slot = in_augment->augment_slot;
uint8 mat = Inventory::CalcMaterialFromSlot(item_slot); // for when player is augging a piece of equipment while they're wearing it
uint8 mat = EQEmu::InventoryProfile::CalcMaterialFromSlot(item_slot); // for when player is augging a piece of equipment while they're wearing it
if (item_slot == INVALID_INDEX || solvent_slot == INVALID_INDEX)
{
+5 -5
View File
@@ -2596,7 +2596,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()));
EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
}
}
@@ -2630,7 +2630,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(EQEmu::inventory::slotCursor, indexSub), EQEmu::inventory::slotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
EQEmu::InventoryProfile::CalcSlotId(EQEmu::inventory::slotCursor, indexSub), EQEmu::inventory::slotCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
}
}
}
@@ -2667,7 +2667,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()));
EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
}
}
@@ -2689,7 +2689,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()));
EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
}
}
@@ -2712,7 +2712,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()));
EQEmu::InventoryProfile::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges()));
}
}
+5 -5
View File
@@ -408,7 +408,7 @@ void Corpse::MoveItemToCorpse(Client *client, EQEmu::ItemInstance *inst, int16 e
if (equipSlot < EQEmu::legacy::GENERAL_BEGIN || equipSlot > EQEmu::inventory::slotCursor) { break; }
for (int16 sub_index = EQEmu::inventory::containerBegin; sub_index < EQEmu::inventory::ContainerCount; ++sub_index) {
int16 real_bag_slot = Inventory::CalcSlotId(equipSlot, sub_index);
int16 real_bag_slot = EQEmu::InventoryProfile::CalcSlotId(equipSlot, sub_index);
auto bag_inst = client->GetInv().GetItem(real_bag_slot);
if (bag_inst == nullptr) { continue; }
@@ -684,8 +684,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, EQEmu::inventory::containerBegin);
if (sitem && bag_item_data && EQEmu::InventoryProfile::SupportsContainers(sitem->equip_slot)) {
int16 bagstart = EQEmu::InventoryProfile::CalcSlotId(sitem->equip_slot, EQEmu::inventory::containerBegin);
cur = itemlist.begin();
end = itemlist.end();
@@ -739,7 +739,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 = EQEmu::InventoryProfile::CalcMaterialFromSlot(sitem->equip_slot); // autos to unsigned char
if (material != EQEmu::textures::materialInvalid)
SendWearChange(material);
@@ -1406,7 +1406,7 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const {
return 0;
}
invslot = Inventory::CalcSlotFromMaterial(material_slot);
invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if(invslot == INVALID_INDEX) // GetWornItem() should be returning a 0 for any invalid index...
return 0;
+28 -28
View File
@@ -767,7 +767,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd
EQEmu::ItemInstance* bagitem = m_inv[slot_id]->GetItem(bag_idx);
if(bagitem) {
int16 bagslot_id = Inventory::CalcSlotId(slot_id, bag_idx);
int16 bagslot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, bag_idx);
qsaudit->items[++parent_offset].char_slot = bagslot_id;
qsaudit->items[parent_offset].item_id = bagitem->GetID();
@@ -866,7 +866,7 @@ bool Client::PutItemInInventory(int16 slot_id, const EQEmu::ItemInstance& inst,
if (client_update)
{
SendItemPacket(slot_id, &inst, ((slot_id == EQEmu::inventory::slotCursor) ? ItemPacketLimbo : ItemPacketTrade));
//SendWearChange(Inventory::CalcMaterialFromSlot(slot_id));
//SendWearChange(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id));
}
if (slot_id == EQEmu::inventory::slotCursor) {
@@ -934,7 +934,7 @@ void Client::PutLootInInventory(int16 slot_id, const EQEmu::ItemInstance &inst,
PutLootInInventory(EQEmu::inventory::slotCursor, *bagitem);
}
else {
auto bag_slot = Inventory::CalcSlotId(slot_id, index);
auto bag_slot = EQEmu::InventoryProfile::CalcSlotId(slot_id, index);
Log.Out(Logs::Detail, Logs::Inventory,
"Putting bag loot item %s (%d) into slot %d (bag slot %d)",
@@ -966,7 +966,7 @@ bool Client::TryStacking(EQEmu::ItemInstance* item, uint8 type, bool try_worn, b
}
for (i = EQEmu::legacy::GENERAL_BEGIN; i <= EQEmu::legacy::GENERAL_END; i++) {
for (uint8 j = EQEmu::inventory::containerBegin; j < EQEmu::inventory::ContainerCount; j++) {
uint16 slotid = Inventory::CalcSlotId(i, j);
uint16 slotid = EQEmu::InventoryProfile::CalcSlotId(i, j);
EQEmu::ItemInstance* tmp_inst = m_inv.GetItem(slotid);
if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) {
@@ -1018,7 +1018,7 @@ bool Client::AutoPutLootInInventory(EQEmu::ItemInstance& inst, bool try_worn, bo
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 = EQEmu::InventoryProfile::CalcMaterialFromSlot(i);
if (worn_slot_material != EQEmu::textures::materialInvalid) {
SendWearChange(worn_slot_material);
}
@@ -1518,8 +1518,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (src_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && src_slot_id <= EQEmu::legacy::SHARED_BANK_END && src_inst->IsClassBag()){
for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* 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, EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), baginst)){
DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(src_slot_id, idx), 0, false);
}
}
}
@@ -1533,8 +1533,8 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (dst_slot_id >= EQEmu::legacy::SHARED_BANK_BEGIN && dst_slot_id <= EQEmu::legacy::SHARED_BANK_END && dst_inst->IsClassBag()){
for (uint8 idx = EQEmu::inventory::containerBegin; idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* 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, EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), baginst)){
DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(dst_slot_id, idx), 0, false);
}
}
}
@@ -1576,7 +1576,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if(m_tradeskill_object != nullptr) {
if (src_slot_id >= EQEmu::legacy::WORLD_BEGIN && src_slot_id <= EQEmu::legacy::WORLD_END) {
// Picking up item from world container
EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(Inventory::CalcBagIdx(src_slot_id));
EQEmu::ItemInstance* inst = m_tradeskill_object->PopItem(EQEmu::InventoryProfile::CalcBagIdx(src_slot_id));
if (inst) {
PutItemInInventory(dst_slot_id, *inst, false);
safe_delete(inst);
@@ -1588,7 +1588,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
else if (dst_slot_id >= EQEmu::legacy::WORLD_BEGIN && dst_slot_id <= EQEmu::legacy::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 = EQEmu::InventoryProfile::CalcBagIdx(dst_slot_id);
EQEmu::ItemInstance* world_inst = m_tradeskill_object->PopItem(world_idx);
// Case 1: No item in container, unidirectional "Put"
@@ -1835,7 +1835,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
Message(15, "Inventory Desyncronization detected: Resending slot data...");
if ((move_slots->from_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->from_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->from_slot == EQEmu::inventory::slotPowerSource) {
int16 resync_slot = (Inventory::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : Inventory::CalcSlotId(move_slots->from_slot);
int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
// This prevents the client from crashing when closing any 'phantom' bags
const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
@@ -1860,7 +1860,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 = (EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot) == INVALID_INDEX) ? move_slots->from_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->from_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
if(m_inv[resync_slot]) {
const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
@@ -1878,7 +1878,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) {
}
if ((move_slots->to_slot >= EQEmu::legacy::EQUIPMENT_BEGIN && move_slots->to_slot <= EQEmu::legacy::CURSOR_BAG_END) || move_slots->to_slot == EQEmu::inventory::slotPowerSource) {
int16 resync_slot = (Inventory::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : Inventory::CalcSlotId(move_slots->to_slot);
int16 resync_slot = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
EQEmu::ItemInstance* token_inst = database.CreateItem(token_struct, 1);
@@ -1902,7 +1902,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 = (EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot) == INVALID_INDEX) ? move_slots->to_slot : EQEmu::InventoryProfile::CalcSlotId(move_slots->to_slot);
if (IsValidSlot(resync_slot) && resync_slot != INVALID_INDEX) {
if(m_inv[resync_slot]) {
const EQEmu::ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
@@ -1963,8 +1963,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
const EQEmu::ItemInstance* 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 = EQEmu::InventoryProfile::CalcSlotId(from_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = EQEmu::InventoryProfile::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);
@@ -1996,8 +1996,8 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
const EQEmu::ItemInstance* 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 = EQEmu::InventoryProfile::CalcSlotId(to_slot_id, bag_idx);
qsaudit->items[move_count].to_slot = EQEmu::InventoryProfile::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);
@@ -2598,7 +2598,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const
return 0;
}
invslot = Inventory::CalcSlotFromMaterial(material_slot);
invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
{
return 0;
@@ -2956,7 +2956,7 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
//
if (InvItem && InvItem->IsClassBag()) {
int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin);
int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin);
uint8 BagSize=InvItem->GetItem()->BagSlots;
@@ -3006,9 +3006,9 @@ bool Client::MoveItemToInventory(EQEmu::ItemInstance *ItemToReturn, bool UpdateC
return true;
}
if (InvItem->IsClassBag() && Inventory::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) {
if (InvItem->IsClassBag() && EQEmu::InventoryProfile::CanItemFitInContainer(ItemToReturn->GetItem(), InvItem->GetItem())) {
int16 BaseSlotID = Inventory::CalcSlotId(i, EQEmu::inventory::containerBegin);
int16 BaseSlotID = EQEmu::InventoryProfile::CalcSlotId(i, EQEmu::inventory::containerBegin);
uint8 BagSize=InvItem->GetItem()->BagSlots;
@@ -3272,7 +3272,7 @@ bool Client::InterrogateInventory_error(int16 head, int16 index, const EQEmu::It
return false;
}
void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) {
void EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) {
EQEmu::ItemInstance *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
@@ -3280,7 +3280,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 EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value) {
EQEmu::ItemInstance *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
@@ -3288,7 +3288,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 EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value) {
EQEmu::ItemInstance *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
@@ -3296,7 +3296,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 EQEmu::InventoryProfile::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value) {
EQEmu::ItemInstance *inst = GetItem(slot_id);
if(inst) {
inst->SetCustomData(identifier, value);
@@ -3304,7 +3304,7 @@ void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::strin
}
}
std::string Inventory::GetCustomItemData(int16 slot_id, std::string identifier) {
std::string EQEmu::InventoryProfile::GetCustomItemData(int16 slot_id, std::string identifier) {
EQEmu::ItemInstance *inst = GetItem(slot_id);
if(inst) {
return inst->GetCustomData(identifier);
+10 -6
View File
@@ -4,26 +4,30 @@
#include "lua_ptr.h"
class Inventory;
class Lua_ItemInst;
class Lua_Item;
namespace EQEmu
{
class InventoryProfile;
}
namespace luabind {
struct scope;
}
luabind::scope lua_register_inventory();
class Lua_Inventory : public Lua_Ptr<Inventory>
class Lua_Inventory : public Lua_Ptr<EQEmu::InventoryProfile>
{
typedef Inventory NativeType;
typedef EQEmu::InventoryProfile NativeType;
public:
Lua_Inventory() : Lua_Ptr(nullptr) { }
Lua_Inventory(Inventory *d) : Lua_Ptr(d) { }
Lua_Inventory(EQEmu::InventoryProfile *d) : Lua_Ptr(d) { }
virtual ~Lua_Inventory() { }
operator Inventory*() {
return reinterpret_cast<Inventory*>(GetLuaPtrData());
operator EQEmu::InventoryProfile*() {
return reinterpret_cast<EQEmu::InventoryProfile*>(GetLuaPtrData());
}
Lua_ItemInst GetItem(int slot_id);
+1 -1
View File
@@ -5050,7 +5050,7 @@ void Merc::UpdateMercAppearance() {
for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::EQUIPMENT_END; ++i) {
itemID = equipment[i];
if(itemID != 0) {
materialFromSlot = Inventory::CalcMaterialFromSlot(i);
materialFromSlot = EQEmu::InventoryProfile::CalcMaterialFromSlot(i);
if (materialFromSlot != EQEmu::textures::materialInvalid)
this->SendWearChange(materialFromSlot);
}
+1 -1
View File
@@ -386,7 +386,7 @@ private:
uint8 _OwnerClientVersion;
uint32 _currentStance;
Inventory m_inv;
EQEmu::InventoryProfile m_inv;
int32 max_end;
int32 cur_end;
bool _medding;
+3 -3
View File
@@ -2728,7 +2728,7 @@ uint32 NPC::GetEquipment(uint8 material_slot) const
{
if(material_slot > 8)
return 0;
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
return 0;
return equipment[invslot];
@@ -2862,7 +2862,7 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{
if (this->IsClient())
{
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
{
return 0;
@@ -2907,7 +2907,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const
uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
const EQEmu::ItemData *item;
item = database.GetItem(GetEquipment(material_slot));
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (item != 0 && invslot != INVALID_INDEX)
{
+2 -2
View File
@@ -489,7 +489,7 @@ void NPC::CheckMinMaxLevel(Mob *them)
if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level)
{
material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot);
material = EQEmu::InventoryProfile::CalcMaterialFromSlot((*cur)->equip_slot);
if (material != EQEmu::textures::materialInvalid)
SendWearChange(material);
@@ -1381,7 +1381,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
if (material_slot >= EQEmu::textures::materialCount)
return 0;
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
int16 invslot = EQEmu::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
return 0;
+7 -7
View File
@@ -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();
EQEmu::InventoryProfile& user_inv = user->GetInv();
EQEmu::ItemInstance* inst = nullptr;
inst = user_inv.GetItem(in_augment->container_slot);
@@ -227,7 +227,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
const EQEmu::ItemInstance* inst = container->GetItem(i);
if (inst)
{
user->DeleteItemInInventory(Inventory::CalcSlotId(in_augment->container_slot,i),0,true);
user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_augment->container_slot, i), 0, true);
}
}
// Explicitly mark container as cleared.
@@ -256,7 +256,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
return;
}
Inventory& user_inv = user->GetInv();
EQEmu::InventoryProfile& user_inv = user->GetInv();
PlayerProfile_Struct& user_pp = user->GetPP();
EQEmu::ItemInstance* container = nullptr;
EQEmu::ItemInstance* inst = nullptr;
@@ -295,7 +295,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation);
if (inst && EQEmu::ItemInstance::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) {
const EQEmu::ItemData* new_weapon = inst->GetItem();
user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true);
user->DeleteItemInInventory(EQEmu::InventoryProfile::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(), EQEmu::inventory::slotCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2));
user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name);
@@ -315,7 +315,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
const EQEmu::ItemInstance* inst = container->GetItem(0);
if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) {
const EQEmu::ItemData* new_weapon = inst->GetItem();
user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true);
user->DeleteItemInInventory(EQEmu::InventoryProfile::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(), EQEmu::inventory::slotCursor, 0, 0);
user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name);
@@ -404,7 +404,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
for (uint8 i = EQEmu::inventory::slotBegin; i < EQEmu::legacy::TYPE_WORLD_SIZE; i++) {
const EQEmu::ItemInstance* inst = container->GetItem(i);
if (inst) {
user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot,i),0,true);
user->DeleteItemInInventory(EQEmu::InventoryProfile::CalcSlotId(in_combine->container_slot, i), 0, true);
}
}
container->Clear();
@@ -501,7 +501,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();
EQEmu::InventoryProfile& user_inv = user->GetInv();
uint8 count = 0;
uint8 needcount = 0;
+9 -9
View File
@@ -174,7 +174,7 @@ void Trade::SendItemData(const EQEmu::ItemInstance* inst, int16 dest_slot_id)
with->SendItemPacket(dest_slot_id - EQEmu::legacy::TRADE_BEGIN, inst, ItemPacketTradeView);
if (inst->GetItem()->ItemClass == 1) {
for (uint16 i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) {
uint16 bagslot_id = Inventory::CalcSlotId(dest_slot_id, i);
uint16 bagslot_id = EQEmu::InventoryProfile::CalcSlotId(dest_slot_id, i);
const EQEmu::ItemInstance* bagitem = trader->GetInv().GetItem(bagslot_id);
if (bagitem) {
with->SendItemPacket(bagslot_id - EQEmu::legacy::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));
EQEmu::InventoryProfile::CalcSlotId(i, j));
}
}
}
@@ -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 = EQEmu::InventoryProfile::CalcSlotId(trade_slot, sub_slot);
detail->to_id = other->CharacterID();
detail->to_slot = Inventory::CalcSlotId(free_slot, sub_slot);
detail->to_slot = EQEmu::InventoryProfile::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);
@@ -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 = EQEmu::InventoryProfile::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 = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) {
// we already have the parent bag and a contents iterator..why not just iterate the bag!??
SlotID = Inventory::CalcSlotId(i, x);
SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID);
if (item) {
if (item->GetID() == ItemID)
@@ -1260,7 +1260,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){
if(item && item->GetItem()->ID == 17899){ //Traders Satchel
for (int x = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) {
// we already have the parent bag and a contents iterator..why not just iterate the bag!??
SlotID = Inventory::CalcSlotId(i, x);
SlotID = EQEmu::InventoryProfile::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 = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++) {
SlotID = Inventory::CalcSlotId(i, x);
SlotID = EQEmu::InventoryProfile::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 = EQEmu::inventory::containerBegin; x < EQEmu::inventory::ContainerCount; x++){
SlotID = Inventory::CalcSlotId(i, x);
SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x);
item = this->GetInv().GetItem(SlotID);
+1 -1
View File
@@ -1167,7 +1167,7 @@ bool Zone::Process() {
if(spawn2_timer.Check()) {
LinkedListIterator<Spawn2*> iterator(spawn2_list);
Inventory::CleanDirty();
EQEmu::InventoryProfile::CleanDirty();
iterator.Reset();
while (iterator.MoreElements()) {