Esempio n. 1
0
        public Pilot() // all values should be initialized here before a pilot file is loaded
        {
            PltName             = "No Pilot File Loaded";
            PltHealth           = Health.Alive;
            PltRank             = Rank.Cadet;
            PltDifficulty       = Difficulty.Easy;
            PltBattleScore      = 0;
            PltSkillLevel       = 0;
            PltSecretOrderLevel = 0;



            foreach (FlyableShipType playerShip in Enum.GetValues(typeof(FlyableShipType)))
            {
                TrainingRecordList.Add(new TrainingRecord(playerShip));
            }

            foreach (FlyableShipType missionType in Enum.GetValues(typeof(FlyableShipType)))
            {
                switch (missionType)
                {
                case FlyableShipType.TF:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.TI:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.TB:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.TA:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.GUN:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.TD:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;

                case FlyableShipType.MB:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 4));
                    break;
                }
            }

            BattleStats   = new BattleStats();
            ListOfBattles = new ListOfBattles(totalBattles);
        }
Esempio n. 2
0
        public void GetData(string fileName, byte[] bytes)
        {
            PltName             = Path.GetFileNameWithoutExtension(fileName);
            PltHealth           = (Health)bytes[1];
            PltRank             = (Rank)bytes[2];
            PltDifficulty       = (Difficulty)bytes[3];
            PltBattleScore      = BitConverter.ToInt32(bytes, 4);
            PltSkillLevel       = BitConverter.ToUInt16(bytes, 8);
            PltSecretOrderLevel = (SecretOrder)bytes[10];

            int nextTrainingLevelOffset = 29;
            int trainingScoreOffset     = 42;
            int trainingCompletedOffset = 90;
            int scoreMultiplier         = 0;
            int completedMultuplier     = 0;

            TrainingRecordList.Clear();

            foreach (FlyableShipType playerShip in Enum.GetValues(typeof(FlyableShipType)))
            {
                TrainingRecordList.Add(new TrainingRecord(playerShip, bytes, nextTrainingLevelOffset + completedMultuplier, trainingScoreOffset + scoreMultiplier, trainingCompletedOffset + completedMultuplier));
                scoreMultiplier     += 4; // increments offset to read score
                completedMultuplier += 1; // increments offset to read how many training levels were completed
            }

            HistoricCombatRecordList.Clear();

            foreach (FlyableShipType missionType in Enum.GetValues(typeof(FlyableShipType)))
            {
                switch (missionType)
                {
                case FlyableShipType.TF:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 520, 136));
                    break;

                case FlyableShipType.TI:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 528, 168));
                    break;

                case FlyableShipType.TB:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 536, 200));
                    break;

                case FlyableShipType.TA:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 544, 232));
                    break;

                case FlyableShipType.GUN:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 552, 264));
                    break;

                case FlyableShipType.TD:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 560, 296));
                    break;

                case FlyableShipType.MB:
                    HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 4, 568, 328));
                    break;
                }
            }

            BattleStats   = new BattleStats(bytes);
            ListOfBattles = new ListOfBattles(bytes, totalBattles, 616);
        }