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

[B1] Unknown fields type for entities #21

Open LucBerge opened 2 years ago

LucBerge commented 2 years ago

In the enties files, the field type are negative numbers. Display the type in string instead of the number.

-1 : integer -2 : boolean -3 : utf (string) -4 : double -5 : i18n -6 : unsigned_integer (id of entity) -99 : list

Rewrite the D2oReader class

Bia10 commented 1 year ago

Well lets not rush this, as this will be a breaking change to my entity definition parser, so lets look what data says

Following value groups are found in the json data:

5 : reference type

type:  MonsterDrop

4 : reference type

type: MonsterDropCoefficient
type: EffectZone

3 : reference type

type: MonsterGrade
type: EffectInstanceDice

2 : reference type

TypeValue: 2 NameValue: parameters  => type: QuestObjectiveParameters
TypeValue: 2 NameValue: bonusCharacteristics => type:  MonsterBonusCharacteristics
TypeValue: 2 NameValue: SoundUi

1 : reference type

TypeValue: 1 NameValue: coords  => type:  Point
TypeValue: 1 NameValue: bounds  => type:  Rectangle
TypeValue: 1 NameValue: BreedRoleByBreed

-1 : int

TypeValue: -1 NameValue: npcId
TypeValue: -1 NameValue: monsterId

-2 : bool/boolean

TypeValue: -2 NameValue: isVisible
TypeValue: -2 NameValue: isTransition

-3 : string can be a single string or strings with separator as one string

TypeValue: -3 NameValue: animName
TypeValue: -3 NameValue: aggressiveImmunityCriterion
TypeValue: -3 NameValue: adminName

-4 : double (64bit), actually could be single/float(32bit) as most data contained in it don't require double precision

TypeValue: -4 NameValue: scaleY
TypeValue: -4 NameValue: scaleX
TypeValue: -4 NameValue: random
TypeValue: -4 NameValue: probability

-5 : integer which is a key in translation file

TypeValue: -5 NameValue: sectorNameId
TypeValue: -5 NameValue: theoreticalDescriptionId
TypeValue: -5 NameValue: textStringId
TypeValue: -5 NameValue: textKey

-6 : uint

TypeValue: -6 NameValue: spellLevelId
TypeValue: -6 NameValue: rewardId
TypeValue: -6 NameValue: resultTypeId
TypeValue: -6 NameValue: requiredSubDays
TypeValue: -6 NameValue: packId

-99 : public class Vector extends AbstractList implements List, RandomAccess, Cloneable, Serializable

1. Vector of basic type: Vector<int>

1.5 Vector of generic numeric type : Vector<Number>

numeric values that are convertible to the primitive types byte, double, float, int, long, and short.

always end in -4 likely a float

2. Vector of complex type: Vector<Point>

3. Vector of vector type of simple type: Vector<Vector<int>>

3.5 Vector of vector type of generic numeric type: Vector<Vector<Number>>

again ends in -4 a float likely

    "name": "statPerLevelRange",
    "type": -99,
    "vectorTypes": {
        "name": "Vector.<Vector.<Number>>",
        "type": -99,
        "vectorTypes": {
            "name": "Vector.<Number>",
            "type": -4
        }
    }

    "statPerLevelRange": [
        [
            1.0,
            3.0
        ],
        [
            50.0,
            3.0
        ],
        [
            100.0,
            5.0
        ],
        [
            150.0,
            7.0
        ],
        [
            200.0,
            9.0
        ]
    ]

4. Vector of vector type of complex type: Vector<Vector<Point>>