public void UpdateBoosterPartners() { foreach (BoosterData partner in RelationsBoosterCache) { float relation = partner.Relation; double time = partner.Time; string partnerName = partner.faction; FactionData TargetedFaction = factionsData[partnerName]; BoosterData TheBooster = null; foreach (BoosterData TempRelation in TargetedFaction.Boosters) { if (TempRelation.faction == FactionName) { TheBooster = TempRelation; } } if (TheBooster != null) { TheBooster.Relation = relation; TheBooster.Time = time; } else { Logger.Error("A partner did not found the current faction in its booster relation list."); } } }
public void AddBooster(string faction, float value, double time) { // On the selected faction toward the targeted one XmlNode relationsNode = XMLFunctions.FindChild(FactionNode, "relations"); if (relationsNode == null) { relationsNode = FactionNode.OwnerDocument.CreateElement("relations"); FactionNode.AppendChild(relationsNode); } Boosters.Add(new BoosterData(faction, value, time, XMLFunctions.FindChild(FactionNode, "relations"), cde)); // On the targeted faction toward the selected string SelectedFaction = FactionName; FactionData TargetedFaction = factionsData[faction]; if (TargetedFaction == null) { TargetedFaction = factionsData.AddFactionData(faction); } relationsNode = XMLFunctions.FindChild(TargetedFaction.FactionNode, "relations"); if (relationsNode == null) { relationsNode = TargetedFaction.FactionNode.OwnerDocument.CreateElement("relations"); TargetedFaction.FactionNode.AppendChild(relationsNode); } TargetedFaction.Boosters.Add(new BoosterData(SelectedFaction, value, time, XMLFunctions.FindChild(TargetedFaction.FactionNode, "relations"), cde)); }
public void UpdateRelationPartners() { foreach (RelationData partner in RelationsCache) { float relation = partner.Relation; string partnerName = partner.faction; FactionData TargetedFaction = factionsData[partnerName]; RelationData TheRelation = null; foreach (RelationData TempRelation in TargetedFaction.Relations) { if (TempRelation.faction == FactionName) { TheRelation = TempRelation; } } if (TheRelation != null) { TheRelation.Relation = relation; } else { Logger.Error("A partner did not found the current faction in its relation list."); } } }