public void SetItem(SlaveLordCrafting.SlaveLordItemContainer item) { SLItem = null; lvSlots.Items.Clear(); lvCrafting.Items.Clear(); if (item == null) { return; } if (item.BaseItem.Name.StartsWith("Legendary")) { cbML.SelectedIndex = 1; } else { cbML.SelectedIndex = 0; } SLItem = item; SlaveLordCrafting.ESlaveLordItemSlots[] slots = (SlaveLordCrafting.ESlaveLordItemSlots[])Enum.GetValues(typeof(SlaveLordCrafting.ESlaveLordItemSlots)); foreach (var slot in slots) { SlaveLordItemPropertyData data = new SlaveLordItemPropertyData(SLItem, slot); data.PropertyChanged += Data_PropertyChanged; lvSlots.Items.Add(data); } // we call this to regenerate the DDOItemData potentially being used SLItem.GetItem(); CalculateCraftingCosts(); }
public static bool Load() { try { CustomItems = new List <ACustomItemContainer>(); XmlDocument doc = new XmlDocument(); doc.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "customitems.xml")); foreach (XmlElement xi in doc.GetElementsByTagName("CustomItem")) { string name = xi.Attributes["name"].Value; ItemDataSource source = (ItemDataSource)Enum.Parse(typeof(ItemDataSource), xi.Attributes["source"].Value); switch (source) { case ItemDataSource.LegendaryGreenSteel: LGSCrafting.LGSItemContainer lic = new LGSCrafting.LGSItemContainer { Name = name }; if (lic.FromXml(xi)) { CustomItems.Add(lic); } break; case ItemDataSource.SlaveLord: SlaveLordCrafting.SlaveLordItemContainer slic = new SlaveLordCrafting.SlaveLordItemContainer { Name = name }; if (slic.FromXml(xi)) { CustomItems.Add(slic); } break; case ItemDataSource.Custom: CustomItemContainer cic = new CustomItemContainer { Name = name, Source = source }; if (cic.FromXml(xi)) { CustomItems.Add(cic); } break; } } return(true); } catch { return(false); } }
private void NewSlaveLordItem_Click(object sender, RoutedEventArgs e) { SlotType slot = SlotType.None; if (tvItems.SelectedItem != null) { slot = (SlotType)(tvItems.SelectedItem as TreeViewItem).Tag; } else { if (!GetSlot(SlotType.None, SlaveLordCrafting.SlaveLordItemContainer.DisallowedSlots, out slot)) { return; } } if (slot == SlotType.None) { return; } SlaveLordCrafting.SlaveLordItemContainer slic = new SlaveLordCrafting.SlaveLordItemContainer { Name = "<Custom Item>" }; string baseitemname = null; switch (slot) { case SlotType.Feet: case SlotType.Wrist: baseitemname = "Shackles"; break; case SlotType.Finger: case SlotType.Trinket: baseitemname = "Five Rings"; break; case SlotType.Neck: case SlotType.Waist: baseitemname = "Chains"; break; } slic.BaseItem = DatasetManager.Dataset.Items.Find(i => i.Name == baseitemname && i.Slot == slot); CustomItemsManager.CustomItems.Add(slic); TreeViewItem tvi = AddItemToTreeView(slic); tvi.BringIntoView(); tvi.IsSelected = true; }
public SlaveLordItemPropertyData(SlaveLordCrafting.SlaveLordItemContainer item, SlaveLordCrafting.ESlaveLordItemSlots slot) { SLItem = item; SLSlot = slot; string ml = "Heroic "; if (SLItem.BaseItem.Name.StartsWith("Legendary")) { ml = "Legendary "; } AvailableProperties = SlaveLordCrafting.ItemSlots[ml + slot.ToString()]; //AvailableProperties.Insert(0, new CraftedItemProperty { Name = "- empty -" }); }