bot4dofus / Datafus

📚🥚 The Dofus database and socket events in JSON files. Includes the source code and more...
https://discord.gg/kNHsFcbUGp
MIT License
50 stars 13 forks source link

[A2] Add `TypeId` information for `Vector.<...>` #29

Closed LucBerge closed 11 months ago

LucBerge commented 1 year ago

In ChatServerWithObjectMessage.as there is an attribute called objects of type Vector.<ObjectItem>. It is serialzed this way:

         output.writeShort(this.objects.length);
         for(var _i1:uint = 0; _i1 < this.objects.length; _i1++)
         {
            (this.objects[_i1] as ObjectItem).serializeAs_ObjectItem(output);
         }

The type must be Vector<Short,ObjectItem>


In ObjectItem.as there is an attribute called effects of type Vector.<ObjectEffect>. It is serialzed this way:

         output.writeShort(this.effects.length);
         for(var _i3:uint = 0; _i3 < this.effects.length; _i3++)
         {
            output.writeShort((this.effects[_i3] as ObjectEffect).getTypeId());
            (this.effects[_i3] as ObjectEffect).serialize(output);
         }

The type must include the fact that the TypeId is serialized before ObjectEffect.


In events.json, the attribute type must include this information. Something like:

TypeId is always serialized as a Short.

LucBerge commented 1 year ago

Can be found with the regex output.writeShort((this.{name}

LucBerge commented 1 year ago

TypeIdVector<Short,Short,ObjectEffect> Seams to be the best solution

kkuette commented 11 months ago

Vector<Short,[Short,ObjectEffect]> is a good option too

Is the lenght param always a Short ?