public static string ParentheticalListOfRelations(GameObject legendaryCreature) { GivesRep repInfo = legendaryCreature.GetPart <GivesRep>(); if (repInfo == null) { return(string.Empty); } List <string> relationList = new List <string>(); foreach (string key in legendaryCreature.pBrain.FactionMembership.Keys) { Faction ifExists = Factions.getIfExists(key); if (ifExists != null && ifExists.Visible) { relationList.Add("Loved by {{C|" + ifExists.getFormattedName() + "}}"); } } foreach (FriendorFoe relatedFaction in repInfo.relatedFactions) { Faction ifExists2 = Factions.getIfExists(relatedFaction.faction); if (ifExists2 != null && ifExists2.Visible) { if (relatedFaction.status == "friend") { relationList.Add("Admired by {{C|" + Faction.getFormattedName(relatedFaction.faction) + "}}"); } else if (relatedFaction.status == "dislike") { relationList.Add("Disliked by {{C|" + Faction.getFormattedName(relatedFaction.faction) + "}}"); } else if (relatedFaction.status == "hate") { relationList.Add("Hated by {{C|" + Faction.getFormattedName(relatedFaction.faction) + "}}"); } } } string relations = string.Empty; for (int i = 0; i < relationList.Count; i++) { if (i == 0) { relations += "{{y| ("; } else if (i > 0 && i < relationList.Count) { relations += ", "; } relations += relationList[i]; } if (relationList.Count > 0) { relations += ")}}"; } return(relations); }
public void ReplaceFactions() { LegendaryDogsWorgHero1 HeroPart = ParentObject.GetPart <LegendaryDogsWorgHero1>(); GivesRep GivesRepPart = ParentObject.GetPart <GivesRep>(); for (int i = 0; i < GivesRepPart.relatedFactions.Count; i++) { FriendorFoe FoF = GivesRepPart.relatedFactions[i]; if (FoF.status == "friend") { FoF.reason = LegendaryDogsGenerateFriendOrFoe.getLikeReason(); } else { FoF.reason = LegendaryDogsGenerateFriendOrFoe.getHateReason(); } } }