示例#1
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentItem != null)
            {
                CurrentItem.Name       = NameText.Text;
                CurrentItem.SetName    = SetNameText.Text;
                CurrentItem.IconPath   = IconPathText.Text;
                CurrentItem.Unique     = UniqueCheck.IsChecked.GetValueOrDefault(false);
                CurrentItem.ItemLevel  = (int)IlvlNum.Value;
                CurrentItem.Id         = (int)IdNum.Value;
                CurrentItem.MinDamage  = (int)MinDamageNum.Value;
                CurrentItem.MaxDamage  = (int)MaxDamageNum.Value;
                CurrentItem.Speed      = (float)SpeedNum.Value;
                CurrentItem.Stats      = clonedStats;
                CurrentItem.Type       = (ItemType)TypeCombo.SelectedIndex;
                CurrentItem.Slot       = (ItemSlot)SlotCombo.SelectedIndex;
                CurrentItem.Bind       = (BindsOn)BindCombo.SelectedIndex;
                CurrentItem.Quality    = (ItemQuality)QualityCombo.SelectedIndex;
                CurrentItem.DamageType = (ItemDamageType)DamageTypeComboBox.SelectedIndex;
                CurrentItem.Cost       = (float)CostText.Value;

                if (Gem1Combo.SelectedIndex == 1)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Meta;
                }
                else if (Gem1Combo.SelectedIndex == 2)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Red;
                }
                else if (Gem1Combo.SelectedIndex == 3)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Yellow;
                }
                else if (Gem1Combo.SelectedIndex == 4)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Blue;
                }
                else if (Gem1Combo.SelectedIndex == 5)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Cogwheel;
                }
                else if (Gem1Combo.SelectedIndex == 6)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Hydraulic;
                }
                else if (Gem1Combo.SelectedIndex == 7)
                {
                    CurrentItem.SocketColor1 = ItemSlot.Prismatic;
                }
                else
                {
                    CurrentItem.SocketColor1 = ItemSlot.None;
                }
                if (Gem2Combo.SelectedIndex == 1)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Meta;
                }
                else if (Gem2Combo.SelectedIndex == 2)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Red;
                }
                else if (Gem2Combo.SelectedIndex == 3)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Yellow;
                }
                else if (Gem2Combo.SelectedIndex == 4)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Blue;
                }
                else if (Gem2Combo.SelectedIndex == 5)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Cogwheel;
                }
                else if (Gem2Combo.SelectedIndex == 6)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Hydraulic;
                }
                else if (Gem2Combo.SelectedIndex == 7)
                {
                    CurrentItem.SocketColor2 = ItemSlot.Prismatic;
                }
                else
                {
                    CurrentItem.SocketColor2 = ItemSlot.None;
                }
                if (Gem3Combo.SelectedIndex == 1)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Meta;
                }
                else if (Gem3Combo.SelectedIndex == 2)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Red;
                }
                else if (Gem3Combo.SelectedIndex == 3)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Yellow;
                }
                else if (Gem3Combo.SelectedIndex == 4)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Blue;
                }
                else if (Gem3Combo.SelectedIndex == 5)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Cogwheel;
                }
                else if (Gem3Combo.SelectedIndex == 6)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Hydraulic;
                }
                else if (Gem3Combo.SelectedIndex == 7)
                {
                    CurrentItem.SocketColor3 = ItemSlot.Prismatic;
                }
                else
                {
                    CurrentItem.SocketColor3 = ItemSlot.None;
                }

                if (SourcesChanged /* && tempSources != null*/)
                {
                    CurrentItem.LocationInfo = tempSources;
                }

                if (CB_Faction.SelectedIndex == 0)
                {
                    currentItem.Faction = ItemFaction.Neutral;
                }
                else if (CB_Faction.SelectedIndex == 1)
                {
                    currentItem.Faction = ItemFaction.Alliance;
                }
                else if (CB_Faction.SelectedIndex == 2)
                {
                    currentItem.Faction = ItemFaction.Horde;
                }
                else
                {
                    currentItem.Faction = ItemFaction.Neutral;
                }

                foreach (PropertyInfo info in Stats.PropertyInfoCache)
                {
                    if (Extensions.DisplayName(info).Equals(BonusStat.SelectedItem))
                    {
                        PropertyInfo oldStat = BonusStat.Tag as PropertyInfo;
                        object[]     param   = new object[1] {
                            0
                        };
                        oldStat.GetSetMethod().Invoke(CurrentItem.SocketBonus, param);
                        param = new object[1] {
                            float.Parse(BonusAmount.Text)
                        };
                        info.GetSetMethod().Invoke(CurrentItem.SocketBonus, param);
                        BonusStat.Tag = info;
                        break;
                    }
                }

                string req = null;
                foreach (KeyValuePair <string, CheckBox> kvp in ClassCheckBoxes)
                {
                    if (kvp.Value.IsChecked.GetValueOrDefault(false))
                    {
                        if (req == null)
                        {
                            req = kvp.Key;
                        }
                        else
                        {
                            req += "|" + kvp.Key;
                        }
                    }
                }
                CurrentItem.RequiredClasses = req;
                CurrentItem.InvalidateCachedData();
                ItemCache.OnItemsChanged();
            }
            LoadScreen.SaveFiles();
            this.DialogResult = true;
        }
示例#2
0
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     ItemCache.OnItemsChanged();
     this.DialogResult = true;
 }
示例#3
0
 private void DeleteCustomGemming(object sender, RoutedEventArgs e)
 {
     Character.CustomItemInstances.Remove(ItemInstance);
     ItemCache.OnItemsChanged();
 }