Пример #1
0
 public static void Write(Stream output, UnitAssignedSkill instance, Endian endian)
 {
     output.WriteValueU16(instance.Id, endian);
     output.WriteValueU8(instance.Rank);
     output.WriteValueU8(instance.Unknown);
     output.WriteValueU16(instance.Experience, endian);
 }
Пример #2
0
 public static void Write(Stream output, UnitState instance, Endian endian)
 {
     output.WriteValueU16(instance.BaseCharacter, endian);
     output.WriteValueU16(instance.Unknown002, endian);
     output.WriteValueU16(instance.Portrait, endian);
     output.WriteValueU16(instance.Unknown006, endian);
     output.WriteValueU8(instance.Unknown008);
     output.WriteValueU8(instance.Unknown009);
     output.WriteValueU8(instance.Unknown00A);
     output.WriteValueU8(instance.Life);
     output.WriteValueU32(instance.Unknown00C, endian);
     instance.CurrentPoints.Write(output, endian);
     instance.MaximumPoints.Write(output, endian);
     output.WriteValueU32(instance.Unknown01C, endian);
     output.WriteValueU16(instance.Unknown020, endian);
     output.WriteValueU16(instance.Unknown022, endian);
     instance.BaseStats.Write(output, endian);
     instance.Stats.Write(output, endian);
     output.WriteValueU8(instance.Luck);
     output.WriteValueU8(instance.Loyalty);
     output.WriteValueU8(instance.Unknown046);
     output.WriteValueU8(instance.Unknown047);
     output.WriteValueU8(instance.Unknown048);
     output.WriteValueU8(instance.ClassId);
     output.WriteValueU8(instance.ClassLevel);
     output.WriteValueU8(instance.MovementType);
     output.WriteValueU32(instance.Flags, endian);
     output.WriteValueU8(instance.Unknown050);
     output.WriteValueU8(instance.Unknown051);
     output.WriteValueU8(instance.Allegiance);
     output.WriteValueU8(instance.AIModifier);
     ArrayHelper.ForEach(instance.EquipmentIds, v => output.WriteValueU16(v, endian), EquipmentCount);
     ArrayHelper.ForEach(instance.EquipmentUnknowns, v => output.WriteValueU16(v, endian), EquipmentCount);
     ArrayHelper.ForEach(instance.ConditionBits, v => output.WriteValueU8(v), ConditionCount);
     output.WriteValueU8(instance.Unknown096);
     ArrayHelper.ForEach(instance.Unknown097, v => output.WriteValueU8(v), Unknown097Count);
     output.WriteValueU8(instance.AssignedSkillActiveCount);
     output.WriteValueU8(instance.Unknown0A5);
     ArrayHelper.ForEach(instance.AssignedSkills, e => UnitAssignedSkill.Write(output, e, endian), AssignedSkillCount);
     ArrayHelper.ForEach(instance.SpellBits, v => output.WriteValueU8(v), SpellCount);
     output.WriteValueU8(instance.Unknown103);
     output.WriteValueU8(instance.Unknown104);
     output.WriteValueU8(instance.Unknown105);
     output.WriteValueU8(instance.Unknown106);
     output.WriteValueU8(instance.Unknown107);
 }
Пример #3
0
        public static UnitState Read(Stream input, Endian endian)
        {
            UnitState instance;

            instance.BaseCharacter = input.ReadValueU16(endian);
            instance.Unknown002    = input.ReadValueU16(endian);
            instance.Portrait      = input.ReadValueU16(endian);
            instance.Unknown006    = input.ReadValueU16(endian);
            instance.Unknown008    = input.ReadValueU8();
            instance.Unknown009    = input.ReadValueU8();
            instance.Unknown00A    = input.ReadValueU8();
            instance.Life          = input.ReadValueU8();
            instance.Unknown00C    = input.ReadValueU32(endian);
            instance.CurrentPoints = UnitPoints.Read(input, endian);
            instance.MaximumPoints = UnitPoints.Read(input, endian);
            instance.Unknown01C    = input.ReadValueU32(endian);
            instance.Unknown020    = input.ReadValueU16(endian);
            instance.Unknown022    = input.ReadValueU16(endian);
            instance.BaseStats     = UnitStats.Read(input, endian);
            instance.Stats         = UnitStats.Read(input, endian);
            instance.Luck          = input.ReadValueU8();
            instance.Loyalty       = input.ReadValueU8();
            instance.Unknown046    = input.ReadValueU8();
            instance.Unknown047    = input.ReadValueU8();
            instance.Unknown048    = input.ReadValueU8();
            instance.ClassId       = input.ReadValueU8();
            instance.ClassLevel    = input.ReadValueU8();
            instance.MovementType  = input.ReadValueU8();
            instance.Flags         = input.ReadValueU32(endian);
            instance.Unknown050    = input.ReadValueU8();
            // ???
            // "Share skills and SP (unit will have the learned skills and SP of the unit number in this field)
            // By default the value should be the same as the unit id)."
            instance.Unknown051   = input.ReadValueU8();
            instance.Allegiance   = input.ReadValueU8();
            instance.AIModifier   = input.ReadValueU8();
            instance.EquipmentIds = new ushort[EquipmentCount];
            for (int i = 0; i < EquipmentCount; i++)
            {
                instance.EquipmentIds[i] = input.ReadValueU16(endian);
            }
            instance.EquipmentUnknowns = new ushort[EquipmentCount];
            for (int i = 0; i < EquipmentCount; i++)
            {
                instance.EquipmentUnknowns[i] = input.ReadValueU16(endian);
            }
            instance.ConditionBits            = input.ReadBytes(ConditionCount);
            instance.Unknown096               = input.ReadValueU8();
            instance.Unknown097               = input.ReadBytes(Unknown097Count);
            instance.AssignedSkillActiveCount = input.ReadValueU8();
            instance.Unknown0A5               = input.ReadValueU8();
            instance.AssignedSkills           = new UnitAssignedSkill[AssignedSkillCount];
            for (int i = 0; i < AssignedSkillCount; i++)
            {
                instance.AssignedSkills[i] = UnitAssignedSkill.Read(input, endian);
            }
            instance.SpellBits  = input.ReadBytes(SpellCount);
            instance.Unknown103 = input.ReadValueU8();
            instance.Unknown104 = input.ReadValueU8();
            instance.Unknown105 = input.ReadValueU8();
            instance.Unknown106 = input.ReadValueU8();
            instance.Unknown107 = input.ReadValueU8();
            return(instance);
        }