caught more places

This commit is contained in:
ricardocampos23 2014-04-10 14:09:41 +01:00
parent 6d2eb6d03f
commit 97e261e5af
5 changed files with 50 additions and 4 deletions

View File

@ -199,7 +199,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
// the weapons are kept elsewhere // the weapons are kept elsewhere
if ((material == MaterialPrimary) || (material == MaterialSecondary)) if ((material == MaterialPrimary) || (material == MaterialSecondary))
{ {
if (strlen(item->GetItem()->IDFile) > 2) { if (strlen(item->GetItem()->IDFile) > 2)
{
uint32 idfile = 0; uint32 idfile = 0;
if (item->HasOrnamentation()) if (item->HasOrnamentation())
{ {

View File

@ -8068,3 +8068,4 @@ void Client::PlayMP3(const char* fname)
QueuePacket(outapp); QueuePacket(outapp);
safe_delete(outapp); safe_delete(outapp);
} }

View File

@ -797,6 +797,7 @@ public:
void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type);
bool IsValidSlot(uint32 slot); bool IsValidSlot(uint32 slot);
bool IsBankSlot(uint32 slot); bool IsBankSlot(uint32 slot);
int32 GetEquipmentMaterial(uint8 material_slot) const;
inline bool IsTrader() const { return(Trader); } inline bool IsTrader() const { return(Trader); }
inline bool IsBuyer() const { return(Buyer); } inline bool IsBuyer() const { return(Buyer); }

View File

@ -1611,6 +1611,51 @@ void Client::DyeArmor(DyeStruct* dye){
Save(); 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) { /*bool Client::DecreaseByItemType(uint32 type, uint8 amt) {
const Item_Struct* TempItem = 0; const Item_Struct* TempItem = 0;
ItemInst* ins; ItemInst* ins;

View File

@ -2561,9 +2561,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color)
int32 Mob::GetEquipmentMaterial(uint8 material_slot) const int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{ {
const Item_Struct *item; const Item_Struct *item = database.GetItem(GetEquipment(material_slot));
item = database.GetItem(GetEquipment(material_slot));
if(item != 0) if(item != 0)
{ {
if // for primary and secondary we need the model, not the material if // for primary and secondary we need the model, not the material