Пример #1
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);
        }
 public static void Write(Stream output, UnitPoints instance, Endian endian)
 {
     output.WriteValueU16(instance.Health, endian);
     output.WriteValueU16(instance.Magic, endian);
     output.WriteValueU16(instance.Tactical, endian);
 }