private void parse_loot_section(XElement rules_element) { PlayerLoot player_loot = new PlayerLoot(); IEnumerable <XElement> elements = rules_element.Descendants("RulesElement"); player_loot.item_name = rules_element.Descendants("RulesElement").Last().FirstAttribute.Value.ToString(); foreach (XElement element in elements) { IEnumerable <XElement> loot_info = element.Descendants("specific"); foreach (XElement info in loot_info) { XAttribute attribute = info.FirstAttribute; string name = attribute.Value.ToString(); switch (name) { case "Item Slot": player_loot.item_slot = info.Value.ToString(); break; case "Enhancement": player_loot.ehancement = info.Value.ToString(); break; case "Property": player_loot.property = info.Value.ToString(); break; case "Power": player_loot.powers.Add(info.Value.ToString()); break; default: break; } } } charData.player_loot.Add(player_loot); }
private void parse_loot_section(XElement rules_element) { PlayerLoot player_loot = new PlayerLoot(); IEnumerable<XElement> elements = rules_element.Descendants("RulesElement"); player_loot.item_name = rules_element.Descendants("RulesElement").Last().FirstAttribute.Value.ToString(); foreach (XElement element in elements) { IEnumerable<XElement> loot_info = element.Descendants("specific"); foreach (XElement info in loot_info) { XAttribute attribute = info.FirstAttribute; string name = attribute.Value.ToString(); switch (name) { case "Item Slot": player_loot.item_slot = info.Value.ToString(); break; case "Enhancement": player_loot.ehancement = info.Value.ToString(); break; case "Property": player_loot.property = info.Value.ToString(); break; case "Power": player_loot.powers.Add(info.Value.ToString()); break; default: break; } } } charData.player_loot.Add(player_loot); }