12.05.2011, 08:40
|
#57
|
Гость
|
build 12340
XML замечательно описывает формат пакета ( не считая условий )
Код:
<Definition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Opcode="SMSG_CHAR_ENUM">
<Fields xsi:type="DynamicLoop" Name="Characters" DataType="Byte">
<Fields xsi:type="Simple" Name="PlayerGuid" DataType="UInt64"/>
<Fields xsi:type="Simple" Name="PlayerName" DataType="String"/>
<Fields xsi:type="Simple" Name="Race" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Class" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Gender" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Skin" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Face" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Hairstyle" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Haircolor" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Facialhair" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Level" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Zone" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="Map" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="Coords" DataType="Coords3"/>
<Fields xsi:type="Simple" Name="GuildId" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="Char_flags" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="LoginFlags" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="Firstlogin" DataType="Byte"/>
<Fields xsi:type="Simple" Name="PetDisplayId" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="PetLevel" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="PetFamily" DataType="UInt32"/>
<Fields xsi:type="StaticLoop" Name="Items" DataType="UInt32" LoopLength="19">
<Fields xsi:type="Simple" Name="DisplayInfoID" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="InventoryType" DataType="Byte"/>
<Fields xsi:type="Simple" Name="EnchantAuraId" DataType="UInt32"/>
</Fields>
<Fields xsi:type="StaticLoop" Name="Items2" DataType="UInt32" LoopLength="4">
<Fields xsi:type="Simple" Name="Bag" DataType="UInt32"/>
<Fields xsi:type="Simple" Name="Slot" DataType="Byte"/>
<Fields xsi:type="Simple" Name="Enchant" DataType="UInt32"/>
</Fields>
</Fields>
</Definition>
Про JSON такого сказать не получится, но он и не для этого предназначается(может я его и не так использую...?)
Код:
[{"name":"Characters","type":"DynamicLoop","loopvalue":"Byte","chield":{"PlayerGuid":{"type":"UInt64"},"PlayerName":{"type":"String"},"Race":{"type":"Byte"},"Class":{"type":"Byte"},"Gender":{"type":"Byte"},"Skin":{"type":"Byte"},"Face":{"type":"Byte"},"Hairstyle":{"type":"Byte"},"Haircolor":{"type":"Byte"},"Facialhair":{"type":"Byte"},"Level":{"type":"Byte"},"Zone":{"type":"UInt32"},"Map":{"type":"UInt32"},"Coords":{"type":"Coords3"},"GuildId":{"type":"UInt32"},"Char_flags":{"type":"UInt32"},"LoginFlags":{"type":"UInt32"},"Firstlogin":{"type":"Byte"},"PetDisplayId":{"type":"UInt32"},"PetLevel":{"type":"UInt32"},"PetFamily":{"type":"UInt32"},"Items":{"name":"Items","type":"StaticLoop","LoopLength":19,"chield":{"DisplayInfoID":{"type":"UInt32"},"InventoryType":{"type":"Byte"},"EnchantAuraId":{"type":"UInt32"}}},"Items2":{"name":"Items2","type":"StaticLoop","LoopLength":4,"chield":{"Bag":{"type":"UInt32"},"Slot":{"type":"Byte"},"Enchant":{"type":"UInt32"}}}}}]
Ипользуя XML можно организовать чтение пакетов, или кодогенератор...да и зрительно просто песня
может сообразим какой нить формат описания данных?
зы текущий XML формат позаимствован у TOM_RUS
Последний раз редактировалось Minimajack; 12.05.2011 в 09:04.
|
|
|