//Functions that take a raw data class and spit out an item. private Weapon process_wDC(WeaponDC rw) { int WIDNM = rw.IDNumber; int WCOST = rw.Cost; string WNAME = rw.Name; Weapon.Type WTYPE = 0; switch (rw.WeaponType) { case "Axe": WTYPE = Weapon.Type.Axe; break; case "Bow": WTYPE = Weapon.Type.Bow; break; case "Crossbow": WTYPE = Weapon.Type.Crossbow; break; case "Lance": WTYPE = Weapon.Type.Lance; break; case "Mace": WTYPE = Weapon.Type.Mace; break; case "Spear": WTYPE = Weapon.Type.Spear; break; case "Staff": WTYPE = Weapon.Type.Staff; break; case "Sword": WTYPE = Weapon.Type.Sword; break; } int WHAND = rw.Hands; int WMIND = rw.MinDamage; int WMAXD = rw.MaxDamage; int WRANG = rw.WeaponRange; return(new Weapon(WIDNM, WCOST, WNAME, WTYPE, WHAND, WMIND, WMAXD, WRANG)); }
//Functions that take a raw data class and spit out an item. private Weapon process_wDC(WeaponDC rw) { return new Weapon(rw); }
private XmlNode fill_in_weapon_node(XmlDocument rootDocument, XmlNode rootNode, WeaponDC raw_weapon) { //Generic item properties XmlNode weapon_id_node = rootDocument.CreateElement("Weapon_ID"); weapon_id_node.InnerText = raw_weapon.IDNumber.ToString(); XmlNode weapon_cost_node = rootDocument.CreateElement("Weapon_Cost"); weapon_cost_node.InnerText = raw_weapon.Cost.ToString(); XmlNode weapon_icon_node = rootDocument.CreateElement("Weapon_Icon"); weapon_icon_node.InnerText = raw_weapon.Icon; XmlNode weapon_name_node = rootDocument.CreateElement("Weapon_Name"); weapon_name_node.InnerText = raw_weapon.Name; XmlNode weapon_tier_node = rootDocument.CreateElement("Weapon_Tier"); weapon_tier_node.InnerText = raw_weapon.ItemTier.ToString(); XmlNode weapon_dungeons_node = rootDocument.CreateElement("Weapon_Dungeons_Required"); weapon_dungeons_node.InnerText = raw_weapon.DungeonsRequired.ToString(); XmlNode weapon_floors_node = rootDocument.CreateElement("Weapon_Floors_Required"); weapon_floors_node.InnerText = raw_weapon.FloorsRequired.ToString(); XmlNode weapon_classes_node = rootDocument.CreateElement("Weapon_Valid_Classes"); weapon_classes_node.InnerText = raw_weapon.ValidClasses; XmlNode weapon_properties_node = rootDocument.CreateElement("Weapon_Properties"); List<string> raw_properties = raw_weapon.ItemProperties; for (int i = 0; i < raw_properties.Count; i++) { XmlNode property_node = rootDocument.CreateElement("Item"); property_node.InnerText = raw_properties[i]; weapon_properties_node.AppendChild(property_node); } XmlNode weapon_talismans_node = rootDocument.CreateElement("Weapon_Talismans"); List<string> raw_talismans = raw_weapon.Talismans; for (int i = 0; i < raw_talismans.Count; i++) { XmlNode talisman_node = rootDocument.CreateElement("Item"); talisman_node.InnerText = raw_talismans[i]; weapon_talismans_node.AppendChild(talisman_node); } //Weapon specific properties XmlNode weapon_type_node = rootDocument.CreateElement("Weapon_Type"); weapon_type_node.InnerText = raw_weapon.WeaponType; XmlNode weapon_hands_node = rootDocument.CreateElement("Weapon_Hands"); weapon_hands_node.InnerText = raw_weapon.Hands.ToString(); XmlNode weapon_min_dmg_node = rootDocument.CreateElement("Weapon_Min_Damage"); weapon_min_dmg_node.InnerText = raw_weapon.MinDamage.ToString(); XmlNode weapon_max_dmg_node = rootDocument.CreateElement("Weapon_Max_Damage"); weapon_max_dmg_node.InnerText = raw_weapon.MaxDamage.ToString(); XmlNode weapon_range_node = rootDocument.CreateElement("Weapon_Range"); weapon_range_node.InnerText = raw_weapon.WeaponRange.ToString(); rootNode.AppendChild(weapon_id_node); rootNode.AppendChild(weapon_cost_node); rootNode.AppendChild(weapon_icon_node); rootNode.AppendChild(weapon_name_node); rootNode.AppendChild(weapon_tier_node); rootNode.AppendChild(weapon_dungeons_node); rootNode.AppendChild(weapon_floors_node); rootNode.AppendChild(weapon_classes_node); rootNode.AppendChild(weapon_properties_node); rootNode.AppendChild(weapon_talismans_node); rootNode.AppendChild(weapon_type_node); rootNode.AppendChild(weapon_hands_node); rootNode.AppendChild(weapon_min_dmg_node); rootNode.AppendChild(weapon_max_dmg_node); rootNode.AppendChild(weapon_range_node); return rootNode; }