public static BuildItem FromXml(XmlElement xe) { try { DDOItemData item = DatasetManager.Dataset.Items.Find(i => i.Name == xe.GetAttribute("item")); if (item == null) { return(null); } EquipmentSlotType est = (EquipmentSlotType)Enum.Parse(typeof(EquipmentSlotType), xe.GetAttribute("slot")); if (est == EquipmentSlotType.None) { return(null); } BuildItem bi = new BuildItem(item, est); if (!xe.HasChildNodes) { return(bi); } List <ItemProperty> found = new List <ItemProperty>(); foreach (XmlElement xc in xe.ChildNodes) { string property = xc.InnerText; string type = xc.GetAttribute("type"); foreach (var ip in item.Properties) { if (ip.Options != null && !found.Contains(ip)) { foreach (var op in ip.Options) { if (op.Property == property && ((string.IsNullOrWhiteSpace(op.Type) && type == "untyped") || op.Type == type)) { bi.OptionProperties.Add(op); found.Add(ip); break; } } } } } return(bi); } catch { return(null); } }
public static GearSet FromXml(XmlElement xe) { try { GearSet gs = new GearSet(); foreach (XmlElement xb in xe.ChildNodes) { BuildItem bi = BuildItem.FromXml(xb); if (bi != null) { gs.AddItem(bi); } } gs.ProcessItems(); return(gs); } catch { return(null); } }
public void SetItem(BuildItem item) { Item = item; lvDetails.Items.Clear(); if (item == null) { return; } if (item.Item.QuestFoundIn != null && item.Item.QuestFoundIn.IsRaid) { ListViewItem lvi = new ListViewItem(); lvi.Content = new { Property = "Raid Drop", Type = "", Value = "" }; lvDetails.Items.Add(lvi); } if (item.Item.MinorArtifact) { ListViewItem lvi = new ListViewItem(); lvi.Content = new { Property = "Minor Artifact", Type = "", Value = "" }; lvDetails.Items.Add(lvi); } foreach (var p in item.Item.Properties) { if (p.Options != null && !p.HideOptions) { bool found = false; if (item.OptionProperties != null) { foreach (var op in item.OptionProperties) { if (p.Options.Contains(op)) { ListViewItem lvi = new ListViewItem(); lvi.Content = new { Property = "* " + op.Property, op.Type, op.Value }; lvi.Tag = op; lvDetails.Items.Add(lvi); found = true; break; } } } if (!found) { ListViewItem lvi = new ListViewItem(); lvi.Content = new { p.Property, p.Type, p.Value }; lvDetails.Items.Add(lvi); foreach (var ip in p.Options) { lvi = new ListViewItem(); lvi.Content = new { Property = "> " + ip.Property, ip.Type, ip.Value }; lvi.Tag = ip; lvDetails.Items.Add(lvi); } } } else { ListViewItem lvi = new ListViewItem(); lvi.Content = new { p.Property, p.Type, p.Value }; lvDetails.Items.Add(lvi); } } }
void AddItemToList(BuildItem bi, ListView lv) { lv.Items.Add(new CompareListItem { Text = bi.ToString(), BI = bi }); }
public void SetItem(BuildItem item) { if (Item != null) { Item.InUse = false; } Item = item; if (Item == null) { imgIcon.Source = SlotBGImages[(int)Slot]; ttTT.Content = null; } else { Item.Slot = Slot; Item.InUse = true; ttTT.Content = Item.Item.Name; string iconname = Item.Item.IconName; if (LoadedIcons.ContainsKey(iconname)) { imgIcon.Source = LoadedIcons[iconname]; } else { string iconpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Icons", iconname + ".png"); if (File.Exists(iconpath)) { imgIcon.Source = LoadedIcons[iconname] = new BitmapImage(new Uri(iconpath)); } else { switch (Item.Item.Slot) { case SlotType.Body: if (Item.Item.Category == (int)ArmorCategory.Cloth) { imgIcon.Source = SlotFillImages["body_cloth"]; } else if (Item.Item.Category == (int)ArmorCategory.Light) { imgIcon.Source = SlotFillImages["body_light"]; } else if (Item.Item.Category == (int)ArmorCategory.Medium) { imgIcon.Source = SlotFillImages["body_medium"]; } else if (Item.Item.Category == (int)ArmorCategory.Heavy) { imgIcon.Source = SlotFillImages["body_heavy"]; } else if (Item.Item.Category == (int)ArmorCategory.Docent) { imgIcon.Source = SlotFillImages["body_docent"]; } break; case SlotType.Offhand: if (Item.Item.Category == (int)OffhandCategory.Buckler) { imgIcon.Source = SlotFillImages["offhand_buckler"]; } else if (Item.Item.Category == (int)OffhandCategory.Small) { imgIcon.Source = SlotFillImages["offhand_small"]; } else if (Item.Item.Category == (int)OffhandCategory.Large) { imgIcon.Source = SlotFillImages["offhand_large"]; } else if (Item.Item.Category == (int)OffhandCategory.Tower) { imgIcon.Source = SlotFillImages["offhand_tower"]; } else if (Item.Item.Category == (int)OffhandCategory.Orb) { imgIcon.Source = SlotFillImages["offhand_orb"]; } else if (Item.Item.Category == (int)OffhandCategory.RuneArm) { imgIcon.Source = SlotFillImages["offhand_runearm"]; } break; default: imgIcon.Source = SlotFillImages[Item.Item.Slot.ToString().ToLower()]; break; } } } } }