Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        private void NewCustomItem_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, null, out slot))
                {
                    return;
                }
            }

            if (slot == SlotType.None)
            {
                return;
            }

            CustomItemContainer cic = new CustomItemContainer {
                Name = "<Custom Item>"
            };

            cic.Item = new DDOItemData(ItemDataSource.Custom, false)
            {
                Name = cic.Name, Slot = slot
            };
            cic.Item.AddProperty("Minimum Level", null, 1, null);
            AddSlotSpecificProperties(cic.Item);

            CustomItemsManager.CustomItems.Add(cic);
            TreeViewItem tvi = AddItemToTreeView(cic);

            tvi.BringIntoView();
            tvi.IsSelected = true;
        }