Fully working type 20 ornaments for UF/ROF (propbably SoD too)

This commit is contained in:
ricardocampos23
2014-04-13 22:45:56 +01:00
parent 72825c6bc0
commit acc24f1154
3 changed files with 41 additions and 20 deletions
+1 -1
View File
@@ -3531,7 +3531,7 @@ char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint
} }
// Moofta: if the item has an aug of type 20 (ornamentation) then we use the ID file of that when serializing. // Moofta: if the item has an aug of type 20 (ornamentation) then we use the ID file of that when serializing.
// the only thing we should probably worry about is generating a wear change packet to all cl;ients in zone if someone adds a type 20 aug. // the only thing we should probably worry about is generating a wear change packet to all clients in zone if someone adds a type 20 aug.
if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20) if (inst && inst->HasOrnamentation()) //instance is not null and does have an ornament aug (slot 20)
{ {
ItemInst* ornamentation = inst->GetOrnamentation(); ItemInst* ornamentation = inst->GetOrnamentation();
+22
View File
@@ -1907,15 +1907,37 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet); ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet);
} }
if ((inst = m_inv[SLOT_PRIMARY]) && inst->IsType(ItemClassCommon)) { if ((inst = m_inv[SLOT_PRIMARY]) && inst->IsType(ItemClassCommon)) {
if (inst->HasOrnamentation())
{
ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary]= atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
item = inst->GetItem(); item = inst->GetItem();
if (strlen(item->IDFile) > 2) if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]);
} }
}
if ((inst = m_inv[SLOT_SECONDARY]) && inst->IsType(ItemClassCommon)) { if ((inst = m_inv[SLOT_SECONDARY]) && inst->IsType(ItemClassCommon)) {
if (inst->HasOrnamentation())
{
ItemInst* ornament = inst->GetOrnamentation();
if (strlen(ornament->GetItem()->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary]= atoi(&ornament->GetItem()->IDFile[2]);
}
}
else
{
item = inst->GetItem(); item = inst->GetItem();
if (strlen(item->IDFile) > 2) if (strlen(item->IDFile) > 2)
ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]);
} }
}
//these two may be related to ns->spawn.texture //these two may be related to ns->spawn.texture
/* /*
+3 -4
View File
@@ -1898,9 +1898,6 @@ int32 Client::GetEquipmentMaterial(uint8 material_slot) const
uint8 inventorySlot = Inventory::CalcSlotFromMaterial(material_slot); uint8 inventorySlot = Inventory::CalcSlotFromMaterial(material_slot);
const ItemInst* inst = m_inv.GetItem(inventorySlot); const ItemInst* inst = m_inv.GetItem(inventorySlot);
if (inst != nullptr) if (inst != nullptr)
{
if (strlen(inst->GetItem()->IDFile) > 2)
{ {
if (inst->HasOrnamentation()) if (inst->HasOrnamentation())
{ {
@@ -1911,16 +1908,18 @@ int32 Client::GetEquipmentMaterial(uint8 material_slot) const
} }
} }
else else
{
if (strlen(inst->GetItem()->IDFile) > 2)
{ {
return atoi(&inst->GetItem()->IDFile[2]); return atoi(&inst->GetItem()->IDFile[2]);
} }
}
else //may as well try this, since were going to 0 anyways else //may as well try this, since were going to 0 anyways
{ {
return inst->GetItem()->Material; return inst->GetItem()->Material;
} }
} }
} }
}
else else
{ {
const Item_Struct *item = database.GetItem(GetEquipment(material_slot)); const Item_Struct *item = database.GetItem(GetEquipment(material_slot));