From 97e261e5af4b47849d3eb78439879687e12a75b8 Mon Sep 17 00:00:00 2001 From: ricardocampos23 Date: Thu, 10 Apr 2014 14:09:41 +0100 Subject: [PATCH] caught more places --- world/worlddb.cpp | 3 ++- zone/client.cpp | 1 + zone/client.h | 1 + zone/inventory.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ zone/mob.cpp | 4 +--- 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index cd3e93cd6..82e53742c 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -199,7 +199,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* // the weapons are kept elsewhere if ((material == MaterialPrimary) || (material == MaterialSecondary)) { - if (strlen(item->GetItem()->IDFile) > 2) { + if (strlen(item->GetItem()->IDFile) > 2) + { uint32 idfile = 0; if (item->HasOrnamentation()) { diff --git a/zone/client.cpp b/zone/client.cpp index 6cf490960..4165b7ca0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8068,3 +8068,4 @@ void Client::PlayMP3(const char* fname) QueuePacket(outapp); safe_delete(outapp); } + diff --git a/zone/client.h b/zone/client.h index be1c29c1c..ca64b4247 100644 --- a/zone/client.h +++ b/zone/client.h @@ -797,6 +797,7 @@ public: void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); bool IsValidSlot(uint32 slot); bool IsBankSlot(uint32 slot); + int32 GetEquipmentMaterial(uint8 material_slot) const; inline bool IsTrader() const { return(Trader); } inline bool IsBuyer() const { return(Buyer); } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 865eaa8e5..26b4126e4 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1611,6 +1611,51 @@ void Client::DyeArmor(DyeStruct* dye){ Save(); } +int32 Client::GetEquipmentMaterial(uint8 material_slot) const +{ + // Moofta: Only supporting primary and secondary. next stage is heros forge. which could be any! + if // for primary and secondary we need the model, not the material + ( + material_slot == MaterialPrimary || + material_slot == MaterialSecondary + ) + { + uint8 inventorySlot = Inventory::CalcSlotFromMaterial(material_slot); + const ItemInst* inst = m_inv.GetItem(inventorySlot); + if (inst != nullptr) + { + + if (strlen(inst->GetItem()->IDFile) > 2) + { + if (inst->HasOrnamentation()) + { + ItemInst* ornament = inst->GetOrnamentation(); + if (strlen(ornament->GetItem()->IDFile) > 2) + { + return atoi(&ornament->GetItem()->IDFile[2]); + } + } + else + { + return atoi(&inst->GetItem()->IDFile[2]); + } + } + else //may as well try this, since were going to 0 anyways + { + return inst->GetItem()->Material; + } + } + } + else + { + const Item_Struct *item = database.GetItem(GetEquipment(material_slot)); + if (item!=nullptr) return item->Material; + } + + + return 0; +} + /*bool Client::DecreaseByItemType(uint32 type, uint8 amt) { const Item_Struct* TempItem = 0; ItemInst* ins; diff --git a/zone/mob.cpp b/zone/mob.cpp index cee9003cc..32cf76645 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2561,9 +2561,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color) int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { - const Item_Struct *item; - - item = database.GetItem(GetEquipment(material_slot)); + const Item_Struct *item = database.GetItem(GetEquipment(material_slot)); if(item != 0) { if // for primary and secondary we need the model, not the material