internal void ProcessTaggedSpecs(Pilot pilot) { var pKey = pilot.FetchGUID(); foreach (var tag in ModInit.modSettings.taggedMissionSpecs) { if (pilot.pilotDef.PilotTags.Contains(tag.Key)) { foreach (var mspec in tag.Value) { if (!SpecHolder.HolderInstance.MissionSpecMap[pKey].Contains(mspec)) { SpecHolder.HolderInstance.MissionSpecMap[pKey].Add(mspec); ModInit.modLog.LogMessage($"Adding {mspec} to {pilot.Callsign}'s MissionSpecMap from Pilot Tag: {tag.Key}."); } } } } foreach (var tag in ModInit.modSettings.taggedOpForSpecs) { if (pilot.pilotDef.PilotTags.Contains(tag.Key)) { foreach (var opspec in tag.Value) { if (!SpecHolder.HolderInstance.OpForSpecMap[pKey].Contains(opspec)) { SpecHolder.HolderInstance.OpForSpecMap[pKey].Add(opspec); ModInit.modLog.LogMessage($"Adding {opspec} to {pilot.Callsign}'s OpForSpecMap from Pilot Tag: {tag.Key}."); } } } } }
internal static string GetPilotSpecializationsOrProgress(Pilot pilot) { var pilotID = pilot.FetchGUID(); var rtrn = ""; if (pilot.IsPlayerCharacter) { rtrn += "\n<b>Active StratCom</b>\n\n"; var stratcoms = SpecManager.ManagerInstance.StratComs; foreach (var stratCom in stratcoms.Where(x => x.StratComID == SpecHolder.HolderInstance.activeStratCom)) { var description = $"<b>{stratCom.StratComName}:</b> {stratCom.description}\n\n"; rtrn += description; } } if (SpecHolder.HolderInstance.MissionSpecMap[pilotID].Count > 0) { rtrn += "\n<b>Mission Specializations</b>\n\n"; var mspecsOrdered = SpecManager.ManagerInstance.MissionSpecList.Where(x => SpecHolder.HolderInstance.MissionSpecMap[pilotID].Any(y => y == x.MissionSpecID)).OrderBy(c => c.contractTypeID).ThenBy(m => m.missionsRequired); foreach (var missionSpec in mspecsOrdered) { var description = $"<b>{missionSpec.MissionSpecName} [{missionSpec.missionsRequired}]:</b> {missionSpec.description}\n\n"; rtrn += description; } } if (SpecHolder.HolderInstance.OpForSpecMap[pilotID].Count > 0) { rtrn += "\n<b>OpFor Specializations</b>\n\n"; var opspecsOrdered = SpecManager.ManagerInstance.OpForSpecList.Where(x => SpecHolder.HolderInstance.OpForSpecMap[pilotID].Any(y => y == x.OpForSpecID)).OrderBy(c => c.factionID).ThenBy(m => m.killsRequired); foreach (var opforSpec in opspecsOrdered) { var description = $"<b>{opforSpec.OpForSpecName} [{opforSpec.killsRequired}]:</b> {opforSpec.description}\n\n"; rtrn += description; } } rtrn += "\n<b>Mission Stats</b>\n\n"; foreach (var stat in SpecHolder.HolderInstance.MissionsTracker[pilotID]) { rtrn += $"<b>{stat.Key}:</b> {stat.Value} complete.\n"; } rtrn += "\n<b>Opfor Stats</b>\n\n"; foreach (var stat in SpecHolder.HolderInstance.OpForKillsTracker[pilotID]) { rtrn += $"<b>{stat.Key}:</b> {stat.Value} kills.\n"; } return(rtrn); }
internal void AddToMaps(Pilot pilot) { if (!pilot.pilotDef.PilotTags.Any(x => x.StartsWith(spGUID))) { pilot.pilotDef.PilotTags.Add($"{spGUID}{pilot.Description.Id}{Guid.NewGuid()}"); } var pKey = pilot.FetchGUID(); if (!SpecHolder.HolderInstance.MissionSpecMap.ContainsKey(pKey)) { SpecHolder.HolderInstance.MissionSpecMap.Add(pKey, new List <string>()); ModInit.modLog.LogMessage($"Added {pilot.Callsign} to MissionSpecMap with iGUID {pKey}"); } if (!SpecHolder.HolderInstance.OpForSpecMap.ContainsKey(pKey)) { SpecHolder.HolderInstance.OpForSpecMap.Add(pKey, new List <string>()); ModInit.modLog.LogMessage($"Added {pilot.Callsign} to OpForSpecMap with iGUID {pKey}"); } if (!SpecHolder.HolderInstance.MissionsTracker.ContainsKey(pKey)) { SpecHolder.HolderInstance.MissionsTracker.Add(pKey, new Dictionary <string, int>()); ModInit.modLog.LogMessage($"Added {pilot.Callsign} to MissionsTracker with iGUID {pKey}"); } if (!SpecHolder.HolderInstance.OpForKillsTracker.ContainsKey(pKey)) { SpecHolder.HolderInstance.OpForKillsTracker.Add(pKey, new Dictionary <string, int>()); ModInit.modLog.LogMessage($"Added {pilot.Callsign} to OpForKillsTracker with iGUID {pKey}"); } }