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; CurrentTour = 0; CurrentTourOpsComp = 0; foreach (FlyableShipType playerShip in Enum.GetValues(typeof(FlyableShipType))) { TrainingRecordList.Add(new TrainingRecord(playerShip)); } foreach (HistoricMissionType missionType in Enum.GetValues(typeof(HistoricMissionType))) { switch (missionType) { case HistoricMissionType.XWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 6)); break; case HistoricMissionType.YWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 6)); break; case HistoricMissionType.AWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 6)); break; case HistoricMissionType.BWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 6)); break; case HistoricMissionType.Bonus: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, 6)); break; } } TODStats = new TODStats(); int totalTours = 5; for (int i = 1; i < totalTours + 1; i++) { switch (i) { case 1: TourRecordList.Add(new TODOperationScore(i, 12)); break; case 2: TourRecordList.Add(new TODOperationScore(i, 12)); break; case 3: TourRecordList.Add(new TODOperationScore(i, 14)); break; case 4: TourRecordList.Add(new TODOperationScore(i, 24)); break; case 5: TourRecordList.Add(new TODOperationScore(i, 24)); break; } } Medals = new Medals(); Medals.KalidorCrescent = (int)KalidorCrescentLevel.None; }
public void GetData(string fileName, byte[] bytes) { PltName = Path.GetFileNameWithoutExtension(fileName); PltHealth = (Health)bytes[2]; PltRank = (Rank)bytes[3]; PltTODScore = BitConverter.ToUInt32(bytes, 4); PltRookieNum = BitConverter.ToUInt16(bytes, 8); CurrentTour = bytes[640]; CurrentTourOpsComp = BitConverter.ToUInt16(bytes, 643); int trainingScoreOffset = 38; int trainingCompletedOffset = 134; int scoreMultiplier = 0; int completedMultuplier = 0; int totalTours = 5; TrainingRecordList.Clear(); foreach (FlyableShipType playerShip in Enum.GetValues(typeof(FlyableShipType))) { TrainingRecordList.Add(new TrainingRecord(playerShip, bytes, 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 (HistoricMissionType missionType in Enum.GetValues(typeof(HistoricMissionType))) { switch (missionType) { case HistoricMissionType.XWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 6, 544, 160)); break; case HistoricMissionType.YWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 6, 560, 224)); break; case HistoricMissionType.AWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 6, 576, 288)); break; case HistoricMissionType.BWing: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 6, 592, 352)); break; case HistoricMissionType.Bonus: HistoricCombatRecordList.Add(new HistoricCombatRecord(missionType, bytes, 6, 608, 416)); break; } } TODStats = new TODStats(bytes); TourRecordList.Clear(); for (int i = 1; i < totalTours + 1; i++) { switch (i) { case 1: TourRecordList.Add(new TODOperationScore(i, bytes, 735, 12, 751, 759)); break; case 2: TourRecordList.Add(new TODOperationScore(i, bytes, 736, 12, 752, 859)); break; case 3: TourRecordList.Add(new TODOperationScore(i, bytes, 737, 14, 753, 959)); break; case 4: TourRecordList.Add(new TODOperationScore(i, bytes, 738, 24, 754, 1059)); break; case 5: TourRecordList.Add(new TODOperationScore(i, bytes, 739, 24, 755, 1159)); break; } } Medals = new Medals(bytes); }