private EquipmentSlot CreateEquipmentSlot(XmlNode equipConfig) { return(new EquipmentSlot { Name = XmlTranslation.ValueAs <EquipmentName>(equipConfig.Attribute("Name")), Type = equipConfig.Attribute <WeaponType?>("Type"), }); }
private HeroLevel CreateHeroLevel(XmlNode heroConfig) { var level = new HeroLevel(); level.FoodCost = heroConfig.Attribute <int>("FoodCost"); level.Level = XmlTranslation.ValueAs <int>(heroConfig.Attribute("Name").Split("_LVL")[1]); level.Skills = heroConfig.Select("Skills/Skill", CreateSkill); return(level); }
private static IList <ModifierDescriptor> CreateModifiers(XmlNode simulationNode) { var descriptors = simulationNode.SelectNodes("SimulationModifierDescriptors/SimulationModifierDescriptor"); return(descriptors.AsQuery() .Select(x => new ModifierDescriptor { TargetProperty = x.Attributes["TargetProperty"].Value.ParseToEnum <TargetProperty>(), Operation = x.Attributes["Operation"].Value.ParseToEnum <Operation>(), Value = (float)Convert.ToDouble(x.Attributes["Value"].Value), Path = XmlTranslation.ValueAs <Path?>(x.Attributes["Path"]?.Value), }) .ToList()); }
public static T Attribute <T>(this XmlNode node, string name) { return(XmlTranslation.ValueAs <T>(node.Attributes[name]?.Value)); }