public void serializeCharacterData(MessageOut msg)
{
// general character properties
msg.writeInt8(getAccountLevel());
msg.writeInt8((int)getGender());
msg.writeInt8(getHairStyle());
msg.writeInt8(getHairColor());
msg.writeInt16(getLevel());
msg.writeInt16(getCharacterPoints());
msg.writeInt16(getCorrectionPoints());
msg.writeInt16(mAttributes.Count);
// foreach(KeyValuePair<uint, AttributeValue> pair in mAttributes)
// {
// msg.writeInt16((Int16)pair.Key);
//
// msg.writeDouble(pair.Value.@base);
// msg.writeDouble(pair.Value.modified);
// }
foreach(KeyValuePair<uint, Attribute> pair in mAttributes)
{
msg.writeInt16((int)pair.Key);
msg.writeDouble(pair.Value.getBase());
msg.writeDouble(pair.Value.getModifiedAttribute());
}
// character skills
msg.writeInt16(getSkillSize());
foreach(KeyValuePair<int, int> pair in mExperience)
{
msg.writeInt16(pair.Key);
msg.writeInt32(pair.Value);
}
// status effects currently affecting the character
msg.writeInt16(getStatusEffectSize());
foreach(KeyValuePair<int, int> pair in mStatusEffects)
{
msg.writeInt16(pair.Key);
msg.writeInt16(pair.Value);
}
// location
msg.writeInt16(getMapId());
Point pos=getPosition();
msg.writeInt16(pos.x);
msg.writeInt16(pos.y);
// kill count
msg.writeInt16(getKillCountSize());
foreach(KeyValuePair<int, int> pair in mKillCount)
{
msg.writeInt16(pair.Key);
msg.writeInt32(pair.Value);
}
// character specials
msg.writeInt16(mSpecials.Count);
foreach(KeyValuePair<int, Special> pair in mSpecials)
{
msg.writeInt32(pair.Key);
}
// inventory - must be last because size isn't transmitted
Possessions poss=getPossessions();
Dictionary< uint, EquipmentItem > equipData=poss.getEquipment();
msg.writeInt16(equipData.Count); // number of equipment
foreach(KeyValuePair<uint, EquipmentItem> k in equipData)
{
msg.writeInt16((int)k.Key); // Equip slot id
msg.writeInt16((int)k.Value.itemId); // ItemId
msg.writeInt16((int)k.Value.itemInstance); // Item Instance id
}
Dictionary< uint, InventoryItem > inventoryData=poss.getInventory();
foreach(KeyValuePair<uint, InventoryItem> j in inventoryData)
{
msg.writeInt16((int)j.Key); // slot id
msg.writeInt16((int)j.Value.itemId); // item id
msg.writeInt16((int)j.Value.amount); // amount
}
}