private void WriteDescriptor(XmlWriter writer, Hero hero, HeroLevel level, HeroDescriptor descriptor) { writer.WriteStartElement("SimulationDescriptor"); writer.WriteAttributeString("Name", descriptor.GetIdentifier(hero.Name, level.Level)); writer.WriteAttributeString("Type", XmlTranslation.AsText(descriptor.GetType(level.Level))); WriteModifiers(writer, descriptor); writer.WriteEndElement(); }
private void WriteHeroLevels(XmlWriter writer, Hero hero) { hero.Levels.ForEach(level => { writer.WriteStartElement("HeroLevelConfig"); writer.WriteAttributeString("Name", level.GetFullIdentifier(hero.Name)); writer.WriteAttributeString("FoodCost", XmlTranslation.AsText(level.FoodCost)); WriteSkills(writer, level); writer.WriteEndElement(); }); }
private void WriteIntroDialogs(XmlWriter writer, Hero hero) { writer.WriteStartElement("IntroDialogs"); hero.IntroDialogs.ForEach(dialog => { writer.WriteStartElement("Dialog"); writer.WriteAttributeString("Name", XmlTranslation.AsText(dialog.Name)); writer.WriteAttributeString("Text", XmlTranslation.AsText(dialog.Text)); writer.WriteEndElement(); }); writer.WriteEndElement(); }
private void WriteModifier(XmlWriter writer, ModifierDescriptor modifier) { writer.WriteStartElement("SimulationModifierDescriptor"); writer.WriteAttributeString("TargetProperty", modifier.TargetProperty.ToString()); writer.WriteAttributeString("Operation", modifier.Operation.ToString()); writer.WriteAttributeString("Value", Formatter.FormatNumericValue(modifier.Value)); if (modifier.Path != null) { writer.WriteAttributeString("Path", XmlTranslation.AsText(modifier.Path)); } writer.WriteEndElement(); }
private void WriteHeroConfig(XmlWriter writer, Hero hero) { writer.WriteStartElement("HeroConfig"); writer.WriteAttributeString("Name", hero.Identifier); writer.WriteAttributeString("RecruitmentFoodCost", XmlTranslation.AsText(hero.RecruitmentFoodCost)); writer.WriteAttributeString("AITargetType", XmlTranslation.AsText(hero.AITargetType)); writer.WriteAttributeString("AttackType", XmlTranslation.AsText(hero.AttackType)); writer.WriteAttributeString("Archetype", XmlTranslation.AsText(hero.Archetype)); writer.WriteAttributeString("UnlockLevelCount", XmlTranslation.AsText(hero.UnlockLevelCount)); writer.WriteAttributeString("Faction", XmlTranslation.AsText(hero.Faction)); WriteIntroDialogs(writer, hero); WriteEquipmentSlots(writer, hero); writer.WriteEndElement(); }
private void WriteEquipmentSlots(XmlWriter writer, Hero hero) { writer.WriteStartElement("EquipmentSlots"); hero.EquipmentSlots.ForEach(slot => { writer.WriteStartElement("EquipmentSlot"); writer.WriteAttributeString("Name", XmlTranslation.AsText(slot.Name)); if (slot.Type != null) { writer.WriteAttributeString("Type", XmlTranslation.AsText(slot.Type)); } writer.WriteEndElement(); }); writer.WriteEndElement(); }