Exemplo n.º 1
0
        public void Initialise()
        {
            Name = NameOffset + _calculator.GetNonF1DriverNameId(Id);

            var stepOffset = LocalOffset * Id;

            if (Id < 8) // each attribute is 10 bytes long
            {
                Salary            = BaseOffset + stepOffset + SalaryOffset;
                RaceBonus         = BaseOffset + stepOffset + RaceBonusOffset;
                ChampionshipBonus = BaseOffset + stepOffset + ChampionshipBonusOffset;
                Age           = BaseOffset + stepOffset + AgeOffset;
                Nationality   = BaseOffset + stepOffset + NationalityOffset;
                UnknownA      = BaseOffset + stepOffset + UnknownAOffset;
                Speed         = BaseOffset + stepOffset + SpeedOffset;
                Skill         = BaseOffset + stepOffset + SkillOffset;
                Overtaking    = BaseOffset + stepOffset + OvertakingOffset;
                WetWeather    = BaseOffset + stepOffset + WetWeatherOffset;
                Concentration = BaseOffset + stepOffset + ConcentrationOffset;
                Experience    = BaseOffset + stepOffset + ExperienceOffset;
                Stamina       = BaseOffset + stepOffset + StaminaOffset;
                Morale        = BaseOffset + stepOffset + MoraleOffset;
            }
            else if (Id == 8) // some attributes become 7 bytes long
            {
                Salary            = BaseOffset + stepOffset + SalaryOffset;
                RaceBonus         = BaseOffset + stepOffset + RaceBonusOffset;
                ChampionshipBonus = BaseOffset + stepOffset + ChampionshipBonusOffset;
                Age           = BaseOffset + stepOffset + AgeOffset - 12;
                Nationality   = BaseOffset + stepOffset + NationalityOffset;
                UnknownA      = BaseOffset + stepOffset + UnknownAOffset;
                Speed         = BaseOffset + stepOffset + SpeedOffset;
                Skill         = BaseOffset + stepOffset + SkillOffset;
                Overtaking    = BaseOffset + stepOffset + OvertakingOffset;
                WetWeather    = BaseOffset + stepOffset + WetWeatherOffset;
                Concentration = BaseOffset + stepOffset + ConcentrationOffset;
                Experience    = BaseOffset + stepOffset + ExperienceOffset - 3;
                Stamina       = BaseOffset + stepOffset + StaminaOffset - 6;
                Morale        = BaseOffset + stepOffset + MoraleOffset - 9;
            }
            else // each attribute is 7 bytes long
            {
                stepOffset        = LocalOffset * 9 - 15 + LocalOffset / 10 * 7 * (Id % 9);
                Salary            = BaseOffset + stepOffset + SalaryOffset / 10 * 7;
                RaceBonus         = BaseOffset + stepOffset + RaceBonusOffset / 10 * 7;
                ChampionshipBonus = BaseOffset + stepOffset + ChampionshipBonusOffset / 10 * 7;
                Age           = BaseOffset + stepOffset + AgeOffset / 10 * 7;
                Nationality   = BaseOffset + stepOffset + NationalityOffset / 10 * 7;
                UnknownA      = BaseOffset + stepOffset + UnknownAOffset / 10 * 7;
                Speed         = BaseOffset + stepOffset + SpeedOffset / 10 * 7;
                Skill         = BaseOffset + stepOffset + SkillOffset / 10 * 7;
                Overtaking    = BaseOffset + stepOffset + OvertakingOffset / 10 * 7;
                WetWeather    = BaseOffset + stepOffset + WetWeatherOffset / 10 * 7;
                Concentration = BaseOffset + stepOffset + ConcentrationOffset / 10 * 7;
                Experience    = BaseOffset + stepOffset + ExperienceOffset / 10 * 7;
                Stamina       = BaseOffset + stepOffset + StaminaOffset / 10 * 7;
                Morale        = BaseOffset + stepOffset + MoraleOffset / 10 * 7;
            }
        }