Exemplo n.º 1
0
        private void set_controls()
        {
            bool magicItemID = this.fParcel.MagicItemID != Guid.Empty;
            bool artifactID  = this.fParcel.ArtifactID != Guid.Empty;
            bool flag        = (magicItemID ? false : !artifactID);

            this.ChangeToMundaneParcel.Enabled = !flag;
            this.ChangeToMagicItem.Enabled     = (magicItemID ? false : Session.MagicItems.Count != 0);
            this.ChangeToArtifact.Enabled      = (artifactID ? false : Session.Artifacts.Count != 0);
            this.Browser.Visible      = !flag;
            this.DetailsPanel.Visible = flag;
            this.SelectBtn.Enabled    = (magicItemID ? true : artifactID);
            if (flag)
            {
                this.NameBox.Text    = this.fParcel.Name;
                this.DetailsBox.Text = this.fParcel.Details;
                return;
            }
            MagicItem magicItem = Session.FindMagicItem(this.fParcel.MagicItemID, SearchType.Global);

            if (magicItem != null)
            {
                string str = HTML.MagicItem(magicItem, DisplaySize.Small, false, true);
                this.Browser.DocumentText = str;
            }
            Artifact artifact = Session.FindArtifact(this.fParcel.ArtifactID, SearchType.Global);

            if (artifact != null)
            {
                string str1 = HTML.Artifact(artifact, DisplaySize.Small, false, true);
                this.Browser.DocumentText = str1;
            }
        }
Exemplo n.º 2
0
 private void randomise_parcel(Parcel parcel)
 {
     if (parcel.MagicItemID != Guid.Empty)
     {
         int num = parcel.FindItemLevel();
         if (num != -1)
         {
             MagicItem magicItem = Treasure.RandomMagicItem(num);
             if (magicItem != null)
             {
                 parcel.SetAsMagicItem(magicItem);
                 return;
             }
         }
     }
     else if (parcel.ArtifactID != Guid.Empty)
     {
         Artifact artifact = Treasure.RandomArtifact(parcel.FindItemTier());
         if (artifact != null)
         {
             parcel.SetAsArtifact(artifact);
             return;
         }
     }
     else if (parcel.Value != 0)
     {
         parcel.Details = Treasure.RandomMundaneItem(parcel.Value);
     }
 }
Exemplo n.º 3
0
        public void ShowMagicItem(MagicItem item)
        {
            string str = HTML.MagicItem(item, PlayerViewForm.DisplaySize, false, true);

            this.set_html(str);
            base.Show();
        }
Exemplo n.º 4
0
        private void RandomiseBtn_Click(object sender, EventArgs e)
        {
            if (this.fParcel.MagicItemID != Guid.Empty)
            {
                MagicItem magicItem = Treasure.RandomMagicItem(this.fParcel.FindItemLevel());
                if (magicItem != null)
                {
                    this.fParcel.SetAsMagicItem(magicItem);
                }
                this.set_controls();
                return;
            }
            if (this.fParcel.ArtifactID != Guid.Empty)
            {
                Artifact artifact = Treasure.RandomArtifact(this.fParcel.FindItemTier());
                if (artifact != null)
                {
                    this.fParcel.SetAsArtifact(artifact);
                }
                this.set_controls();
                return;
            }
            int value = this.fParcel.Value;

            if (value == 0)
            {
                value = Treasure.GetItemValue(Session.Project.Party.Level);
            }
            this.fParcel         = Treasure.CreateParcel(value, false);
            this.NameBox.Text    = this.fParcel.Name;
            this.DetailsBox.Text = this.fParcel.Details;
            this.set_controls();
        }
Exemplo n.º 5
0
    private void CreateElementsRadial()
    {
        // Create a Radial display pattern for buttons.
        Debug.Log("creating radial display");
        UIElement     newUIElement;
        Button        newUIElementButton;
        float         theta = (2 * Mathf.PI / currentTarget.children.Count);
        float         xPos;
        float         yPos;
        RectTransform navRect  = navigationCanvas.GetComponent <RectTransform>();
        float         distance = Mathf.Min(navRect.rect.width, navRect.rect.height) / 4;

        for (int i = 0; i < currentTarget.children.Count; i++)
        {
            MagicItem child = currentTarget.children[i];
            Debug.Log("Creating button for " + child.name);
            //newUIElement = Instantiate(child.buttonPrefab).GetComponent<UIElement>();
            newUIElement = Instantiate(buttonPrefab).GetComponent <UIElement>();
            uiElements.Add(newUIElement);
            newUIElement.transform.SetParent(navigationCanvas.transform, false);
            newUIElement.name = "UI-" + child.name;
            newUIElement.Customize(child);

            newUIElementButton = newUIElement.GetComponent <Button>();
            newUIElementButton.onClick.AddListener(() => ChangeTarget(child));
            newUIElementButton.onClick.AddListener(() => AudioManager.instance.Play("ButtonClick"));

            if (currentTarget.children.Count > 1)
            {
                xPos = Mathf.Sin(theta * i);
                yPos = Mathf.Cos(theta * i);
                newUIElement.transform.localPosition = new Vector3(xPos * distance, yPos * distance, 0);
            }
        }
    }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes the CastAction.
        /// </summary>
        /// <param name="character">The character GameObject.</param>
        /// <param name="magicItem">The MagicItem that the CastAction belongs to.</param>
        /// <param name="index">The index of the CastAction.</param>
        public override void Initialize(GameObject character, MagicItem magicItem, int index)
        {
            base.Initialize(character, magicItem, index);

            m_CharacterTransform  = character.transform;
            m_CharacterLocomotion = character.GetCachedComponent <UltimateCharacterLocomotion>();
        }
 internal spell_cost_param(Actor caster, MagicItem spell, float cost)
 {
     this.Caster       = caster;
     this.Spell        = spell;
     this.Cost         = cost;
     this.OriginalCost = cost;
 }
Exemplo n.º 8
0
        private void ChangeItemBtn_Click(object sender, EventArgs e)
        {
            if ((Parcel != null) && (Parcel.MagicItemID != Guid.Empty))
            {
                int       level = 0;
                MagicItem item  = Session.FindMagicItem(Parcel.MagicItemID, SearchType.Global);
                if (item != null)
                {
                    level = item.Level;
                }
                else
                {
                    int index = Treasure.PlaceholderIDs.IndexOf(Parcel.MagicItemID);
                    if (index != -1)
                    {
                        level = index + 1;
                    }
                }

                if (level > 0)
                {
                    MagicItemSelectForm dlg = new MagicItemSelectForm(level);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Parcel.SetAsMagicItem(dlg.MagicItem);
                        Session.Modified = true;

                        update_list();
                    }
                }
            }
        }
Exemplo n.º 9
0
 private void ChangeItemBtn_Click(object sender, EventArgs e)
 {
     if (this.Parcel != null && this.Parcel.MagicItemID != Guid.Empty)
     {
         int       level     = 0;
         MagicItem magicItem = Session.FindMagicItem(this.Parcel.MagicItemID, SearchType.Global);
         if (magicItem == null)
         {
             int num = Treasure.PlaceholderIDs.IndexOf(this.Parcel.MagicItemID);
             if (num != -1)
             {
                 level = num + 1;
             }
         }
         else
         {
             level = magicItem.Level;
         }
         if (level > 0)
         {
             MagicItemSelectForm magicItemSelectForm = new MagicItemSelectForm(level);
             if (magicItemSelectForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.Parcel.SetAsMagicItem(magicItemSelectForm.MagicItem);
                 Session.Modified = true;
                 this.update_list();
             }
         }
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes the ImpactAction.
        /// </summary>
        /// <param name="character">The character GameObject.</param>
        /// <param name="magicItem">The MagicItem that the ImpactAction belongs to.</param>
        /// <param name="index">The index of the ImpactAction.</param>
        public override void Initialize(GameObject character, MagicItem magicItem, int index)
        {
            base.Initialize(character, magicItem, index);

            m_CharacterLayerManager = character.GetCachedComponent <CharacterLayerManager>();
            m_HitColliders          = new Collider[m_MaxCollisionCount];
        }
Exemplo n.º 11
0
        private static string GetAugmentSelectorText(MagicItem magicItem, int i, IReadOnlyList <MagicItemEffect> augmentableEffects, ItemRarity rarity)
        {
            var  pip  = EpicLoot.GetMagicEffectPip(magicItem.IsEffectAugmented(i));
            bool free = EnchantCostsHelper.EffectIsDeprecated(augmentableEffects[i].EffectType);

            return($"{pip} {Localization.instance.Localize(MagicItem.GetEffectText(augmentableEffects[i], rarity, true))}{(free ? " [FREE]" : "")}");
        }
Exemplo n.º 12
0
 void randomise_parcel(Parcel parcel)
 {
     if (parcel.MagicItemID != Guid.Empty)
     {
         int level = parcel.FindItemLevel();
         if (level != -1)
         {
             MagicItem new_item = Treasure.RandomMagicItem(level);
             if (new_item != null)
             {
                 parcel.SetAsMagicItem(new_item);
             }
         }
     }
     else if (parcel.ArtifactID != Guid.Empty)
     {
         Tier     tier     = parcel.FindItemTier();
         Artifact new_item = Treasure.RandomArtifact(tier);
         if (new_item != null)
         {
             parcel.SetAsArtifact(new_item);
         }
     }
     else
     {
         if (parcel.Value != 0)
         {
             parcel.Details = Treasure.RandomMundaneItem(parcel.Value);
         }
     }
 }
Exemplo n.º 13
0
        public void ItemQualityIsKept()
        {
            ItemQuality quality;
            Random      r = new Random();

            for (int t = 0; t < 10000; t++)
            {
                int i = r.Next(1, 4);
                switch (i)
                {
                case 1:
                    quality = ItemQuality.Minor;
                    break;

                case 2:
                    quality = ItemQuality.Medium;
                    break;

                case 3:
                    quality = ItemQuality.Major;
                    break;

                default:
                    quality = ItemQuality.Medium;
                    break;
                }

                MagicItem item = MagicItemCreation.Instance.Create(quality);

                item.Quality.Should().Be(quality);
            }
        }
Exemplo n.º 14
0
    public override void OnInspectorGUI()
    {
        MagicItem main = (MagicItem)target;

        base.OnInspectorGUI();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("等级文本", LocalizationMgr.instance.GetText(main.key_level));
        if (GUILayout.Button("编辑文本"))
        {
            LocalizationWindow.ShowWindow(main.key_level);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("蓝耗文本", LocalizationMgr.instance.GetText(main.key_mana));
        if (GUILayout.Button("编辑文本"))
        {
            LocalizationWindow.ShowWindow(main.key_mana);
        }
        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("初始化"))
        {
            main.Init();
        }

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 15
0
        public static MagicItem FindMagicItem(Guid item_id, SearchType search_type)
        {
            if ((search_type == SearchType.External) || (search_type == SearchType.Global))
            {
                foreach (Library lib in Libraries)
                {
                    MagicItem item = lib.FindMagicItem(item_id);
                    if (item != null)
                    {
                        return(item);
                    }
                }
            }

            if ((search_type == SearchType.Project) || (search_type == SearchType.Global))
            {
                if (Project != null)
                {
                    MagicItem item = Project.Library.FindMagicItem(item_id);
                    if (item != null)
                    {
                        return(item);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 16
0
        //Recieves a line of input and its corresponding item table, and inserts the item into the applicable indexes in that ItemTable's array
        private static void disectAndAddItem(string line, MagicItem[] magicItemTable)
        {
            //Get Item
            String[] lineArray = line.Split('\t');
            String   diceRolls = lineArray[0];
            String   name      = lineArray[1];
            String   rarity    = lineArray[2];
            String   value     = lineArray[3];

            //Get dice rolls of this item
            int startPos;
            int endPos;

            if (diceRolls.Length == 2)
            {
                startPos = Int32.Parse(Char.ToString(diceRolls[0]) + Char.ToString(diceRolls[1]));
                endPos   = startPos;
            }
            else if (diceRolls.Length == 3)
            {
                startPos = Int32.Parse(Char.ToString(diceRolls[0]) + Char.ToString(diceRolls[1]) + Char.ToString(diceRolls[2]));
                endPos   = startPos;
            }
            else
            {
                startPos = Int32.Parse(Char.ToString(diceRolls[0]) + Char.ToString(diceRolls[1]));
                endPos   = Int32.Parse(Char.ToString(diceRolls[3]) + Char.ToString(diceRolls[4]));
            }

            //Add the item to the applicable indexes of the table
            for (int i = startPos - 1; i < endPos; i++)
            {
                magicItemTable[i] = new MagicItem(name, rarity, value);
            }
        }
Exemplo n.º 17
0
 public async Task <object> GetMagicItem()
 {
     return(await TakePostAction <MagicItemRequest>((res, data) =>
     {
         res.Data = MagicItem.ByID(data.IsCustom, data.ID).ToRemote();
     }));
 }
Exemplo n.º 18
0
    private void BuyMgScrollItem(int itemIndex, GameObject itemUseSet)
    {
        //마법
        MagicItem item = (MagicItem)StateManager.Instance.magicScrollItems[itemIndex];

        if (StateManager.Instance.playGold >= item.Price)
        {
            if (MgscrollNum[itemIndex] == 0)
            {
                itemUseNameText.text    = "이 름: " + item.Name;
                itemUseExplainText.text = "설 명: " + item.Explain;
                itemUseImage.GetComponent <Image>().sprite = (Sprite)Resources.Load(item.Image, typeof(Sprite));

                itemUseSet = Instantiate(itemUseSetObj) as GameObject;
                itemUseSet.transform.SetParent(magicUseGrid.transform);
                itemUseSet.transform.localScale = new Vector3(1, 1, 1);
                itemUseSet.name        = "Magic" + itemIndex;
                MgScrollBag[itemIndex] = itemUseSet;
            }
            StateManager.Instance.playGold -= item.Price;
            MgscrollNum[itemIndex]++;
            MgscrollPoolSet[itemIndex].transform.FindChild("Scrollcnt").GetComponent <Text>().text = "보 유 갯 수:" + MgscrollNum[itemIndex] + " 개";
            MgScrollBag[itemIndex].transform.FindChild("ScrollUseCut").GetComponent <Text>().text  = "보 유" + "\n" + MgscrollNum[itemIndex] + " 개";
        }
        else
        {
            popClose.SetActive(true);
        }
    }
Exemplo n.º 19
0
        private static Loot GetRolledItems(int dieResult, List <KeyValuePair <Loot, double> > itemsFromTable)
        {
            double cumulative = 0;

            foreach (var t in itemsFromTable)
            {
                cumulative += t.Value;
                if (!(dieResult < cumulative))
                {
                    continue;
                }
                var  magicItem = t.Key;
                Loot lootedSpell;
                if (string.Equals(magicItem.Name, "Spell Scroll", StringComparison.CurrentCultureIgnoreCase))
                {
                    var secondaryLoot = GetRolledSpell((MagicItem)magicItem);
                    lootedSpell       = new MagicItem();
                    lootedSpell.Name += magicItem.Name + " - \"" + secondaryLoot + "\"";
                }
                else
                {
                    lootedSpell = magicItem;
                }
                return(lootedSpell);
            }
            return(null);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes the ImpactAction.
        /// </summary>
        /// <param name="character">The character GameObject.</param>
        /// <param name="magicItem">The MagicItem that the ImpactAction belongs to.</param>
        /// <param name="index">The index of the ImpactAction.</param>
        public virtual void Initialize(GameObject character, MagicItem magicItem, int index)
        {
            base.Initialize(character);

            m_MagicItem = magicItem;
            m_Index     = index;
        }
Exemplo n.º 21
0
        public static Library FindLibrary(MagicItem mi)
        {
            Library library;

            if (mi == null)
            {
                return(null);
            }
            foreach (Library library1 in Session.Libraries)
            {
                foreach (MagicItem magicItem in library1.MagicItems)
                {
                    if (magicItem == null || !(magicItem.ID == mi.ID))
                    {
                        continue;
                    }
                    library = library1;
                    return(library);
                }
            }
            if (Session.fProject != null)
            {
                foreach (MagicItem magicItem1 in Session.fProject.Library.MagicItems)
                {
                    if (magicItem1 == null || !(magicItem1.ID == mi.ID))
                    {
                        continue;
                    }
                    library = Session.fProject.Library;
                    return(library);
                }
            }
            return(null);
        }
Exemplo n.º 22
0
        private void ShowTreasureFragment()
        {
            if (!MagicItem.MagicItemsLoaded)
            {
                _ProgressDialog = new ProgressDialog(this, (int)ProgressDialogStyle.Spinner);
                _ProgressDialog.SetMessage("Loading");
                _ProgressDialog.SetCanceledOnTouchOutside(false);
                _ProgressDialog.Show();

                Thread t = new Thread(() =>
                {
                    MagicItem.LoadMagicItems();
                    RunOnUiThread(() =>
                    {
                        _ProgressDialog.Dismiss();
                        FinishLoadTreasureFragment();
                    });
                });
                t.Start();
            }
            else
            {
                FinishLoadTreasureFragment();
            }
        }
Exemplo n.º 23
0
        private void update_list()
        {
            List <MagicItem> magicItems = new List <MagicItem>();

            foreach (PlotPoint point in this.get_points(this.SelectedPlot))
            {
                foreach (Parcel parcel in point.Parcels)
                {
                    if (parcel.MagicItemID == Guid.Empty)
                    {
                        continue;
                    }
                    MagicItem magicItem = Session.FindMagicItem(parcel.MagicItemID, SearchType.Global);
                    if (magicItem == null || magicItems.Contains(magicItem))
                    {
                        continue;
                    }
                    magicItems.Add(magicItem);
                }
            }
            magicItems.Sort();
            this.ItemList.Items.Clear();
            foreach (MagicItem magicItem1 in magicItems)
            {
                ListViewItem listViewItem = this.ItemList.Items.Add(magicItem1.Name);
                listViewItem.Tag = magicItem1;
            }
        }
Exemplo n.º 24
0
        public void CheckMajorWeapon()
        {
            //On prepare les jets :
            // 13 -> Weapon
            // 43 -> arme +5 à 50000po
            MockDices dices = new MockDices(new List <int> {
                13, 43
            });

            //Utilisation des dés pipés :P
            MagicItemCreation.Instantiate(dices);

            //Portee = melee
            Range chosenRange = Range.Melee;

            MagicItemCreation.Instance.ChosenRange = chosenRange;

            //Creation
            MagicItem item = MagicItemCreation.Instance.Create(ItemQuality.Major);

            item.GetType().Should().Be(typeof(MagicWeapon));

            MagicWeapon weapon = item as MagicWeapon;

            weapon.Quality.Should().Be(ItemQuality.Major);
            weapon.Type.Should().Be(ItemType.Weapon);
            weapon.Price.Should().Be(50000);
            weapon.AlterationBonus.Should().Be(5);
            weapon.Abilities.Should().BeNull();
            weapon.Range.Should().Be(chosenRange);
        }
        public void Visit(MagicItem item)
        {
            var itemToBuild = item.Clone() as MagicItem;

            itemToBuild.Build();
            lootBag.Add(itemToBuild);
        }
Exemplo n.º 26
0
        public void SpecificMajorWeapon()
        {
            //On prepare les jets :
            // 13 -> Weapon
            // 55 -> Specific weapon
            // 83 -> Dwarven thrower qui coute 60312 po
            MockDices dices = new MockDices(new List <int> {
                13, 55, 83
            });

            //Utilisation des dés pipés :P
            MagicItemCreation.Instantiate(dices);

            //Portee = melee
            Range chosenRange = Range.Melee;

            MagicItemCreation.Instance.ChosenRange = chosenRange;

            //Creation
            MagicItem item = MagicItemCreation.Instance.Create(ItemQuality.Major);

            item.GetType().Should().Be(typeof(MagicWeapon));

            MagicWeapon weapon = item as MagicWeapon;

            weapon.Quality.Should().Be(ItemQuality.Major);
            weapon.Type.Should().Be(ItemType.Weapon);
            weapon.Price.Should().Be(60312);
            weapon.Abilities.Should().BeNull();
            weapon.Name.Should().Be("Dwarven thrower");
            weapon.Range.Should().Be(chosenRange);
        }
Exemplo n.º 27
0
        public void MinorWeaponWithOneSpecialAbility()
        {
            //On prepare les jets :
            //  7 -> Weapon
            // 93 -> Special ability
            // 78 -> Arme +2 qui coute 8000 po
            // 89 -> capa "Throwing" qui fait +1, donc arme +2 qui coute 18000
            MockDices dices = new MockDices(new List <int> {
                7, 93, 78, 89
            });

            //Utilisation des dés pipés :P
            MagicItemCreation.Instantiate(dices);

            //Portee = melee
            Range chosenRange = Range.Melee;

            MagicItemCreation.Instance.ChosenRange = chosenRange;

            //Creation
            MagicItem item = MagicItemCreation.Instance.Create(ItemQuality.Minor);

            item.GetType().Should().Be(typeof(MagicWeapon));

            MagicWeapon weapon = item as MagicWeapon;

            weapon.Quality.Should().Be(ItemQuality.Minor);
            weapon.Type.Should().Be(ItemType.Weapon);
            weapon.Price.Should().Be(18000);
            weapon.AlterationBonus.Should().Be(2);
            weapon.Abilities.Should().NotBeNull();
            weapon.Abilities.Count.Should().Be(1);
            weapon.Abilities[0].Should().Be("Throwing");
            weapon.Range.Should().Be(chosenRange);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Initializes the CastAction.
        /// </summary>
        /// <param name="character">The character GameObject.</param>
        /// <param name="magicItem">The MagicItem that the CastAction belongs to.</param>
        /// <param name="index">The index of the CastAction.</param>
        public override void Initialize(GameObject character, MagicItem magicItem, int index)
        {
            base.Initialize(character, magicItem, index);

            m_Transform           = character.transform;
            m_CharacterLocomotion = character.GetCachedComponent <UltimateCharacterLocomotion>();
            m_MaterialColorID     = Shader.PropertyToID(m_MaterialColorName);
        }
 private bool MagicItemsEqual(MagicItem fromDDI, MagicItem fromMP)
 {
     Assert.IsNotNull(fromMP, fromDDI.Name + " not found in " + Libraries.Count + " test libraries");
     Assert.AreEqual(fromMP.Name, fromDDI.Name);
     Assert.AreEqual(fromMP.Type, fromDDI.Type);
     Assert.AreEqual(fromMP.Level,fromDDI.Level);
     return true;
 }
Exemplo n.º 30
0
        public MagicItemBuilderForm(MagicItem item)
        {
            InitializeComponent();

            fMagicItem = item.Copy();

            update_statblock();
        }
Exemplo n.º 31
0
        public MagicItemDetailsForm(MagicItem item)
        {
            InitializeComponent();

            fItem = item.Copy();

            Browser.DocumentText = HTML.MagicItem(fItem, Session.Preferences.TextSize, false, true);
        }
Exemplo n.º 32
0
        private MagicItem GenerateItem(string rank)
        {
            string newName = "";
            string abilities = "";
            string itemType = "";
            int cost = 0; //the total cost (SHOULD take into account non-enhancement bonus abilities)
            int bonus = 0; //used to track bonuses for dynamic cost formulas
            MagicItem magicRolledItem = new MagicItem(""); //used to swap between minor/medium/major item tables
            Item rolledItem = new Item();

            int rollsLeft = 1;

            #region First Loop

            do
            {
                switch (rank)
                {
                    //first, roll what TYPE of item this is (ring, weapon, armor, staff, etc)
                    case "Minor":
                        switch (magicRolledItem.GetItemType())
                        {
                            case "Armor Ability":
                                magicRolledItem = (MagicItem)MinorArmorTable.rdsResult.Single();
                                break;
                            case "Weapon Ability":
                                magicRolledItem = (MagicItem)MinorWeaponsTable.rdsResult.Single(); ///NOOOOOOOOOO INSTEAD DO ITEMTYPE (STRING)?
                                break;
                            case "Shield Ability":
                                magicRolledItem = (MagicItem)MinorShieldsTable.rdsResult.Single(); ///NOOOOOOOOOO INSTEAD DO ITEMTYPE (STRING)?
                                break;
                            default:
                                magicRolledItem = (MagicItem)MinorMagicTable.rdsResult.Single();
                                textBox2.Text += "\r\nMINOR DEFAULT -> " + magicRolledItem.GetItemType();
                                break;
                        }
                        break;
                    case "Medium":
                        switch (magicRolledItem.GetItemType())
                        {
                            case "Armor Ability":
                                magicRolledItem = (MagicItem)MediumArmorTable.rdsResult.Single();
                                break;
                            case "Weapon Ability":
                                magicRolledItem = (MagicItem)MediumWeaponsTable.rdsResult.Single();
                                break;
                            default:
                                magicRolledItem = (MagicItem)MediumMagicTable.rdsResult.Single();
                                break;
                        }
                        break;
                    case "Major":
                        switch (magicRolledItem.GetItemType())
                        {
                            case "Armor Ability":
                                magicRolledItem = (MagicItem)MajorArmorTable.rdsResult.Single();
                                break;
                            case "Weapon Ability":
                                magicRolledItem = (MagicItem)MajorWeaponsTable.rdsResult.Single();
                                break;
                            default:
                                magicRolledItem = (MagicItem)MajorMagicTable.rdsResult.Single();
                                break;
                        }
                        break;
                    default:
                        break;
                }

                cost = magicRolledItem.GetCost(); //for mostly non-ability things (ability is currently zero cost)
                textBox2.Text += magicRolledItem.GetCost() + "    bitch titteh \r\n";

                //then, do stuff based on what this TYPE is
                switch (magicRolledItem.GetItemType())
                {
                    case "Magic Armor":
                        if (rolledItem.ToString() == "Nothing") //if this has not been rolled and it gets here, it is a simple magic armor with no abilities
                        {
                            rolledItem = (Item)ArmorTable.rdsResult.Single();
                            cost = rolledItem.GetCost();
                        }

                        /*            *        "+1"     +       " Armor Name"    = "+1 Chain Shirt (of shadow)"  */
                        newName = magicRolledItem.ToString() + " " + rolledItem.ToString() + abilities;

                        if (magicRolledItem.GetBonus() >= 1 && magicRolledItem.GetBonus() < 11)
                        {
                            bonus += magicRolledItem.GetBonus();
                        }
                        cost += magicRolledItem.GetCost();
                        break;
                    case "Magic Shield":
                        if (rolledItem.ToString() == "Nothing") //magic shield with no abilities
                        {
                            rolledItem = (Item)Shields.rdsResult.Single();
                            cost = rolledItem.GetCost();
                        }
                         newName = magicRolledItem.ToString() + " " + rolledItem.ToString() + abilities;
                        if (magicRolledItem.GetBonus() >= 1 && magicRolledItem.GetBonus() < 11)
                        {  //TODO: If >COST< is between 1 and 11, this is a BONUS.
                            bonus += magicRolledItem.GetBonus();
                        }
                        //else
                        //
                        cost += magicRolledItem.GetCost();

                        //textBox2.Text += magicRolledItem.GetCost() + "   \r\n";
                        //}
                        break;
                    case "Magic Weapon":
                        if (rolledItem.ToString() == "Nothing") //magic weapon with no abilities
                        {
                            rolledItem = (Item)WeaponsTable.rdsResult.Single();
                            cost = rolledItem.GetCost();
                        }

                        newName = magicRolledItem.ToString() + " " + rolledItem.ToString() + abilities;
                        if (magicRolledItem.GetBonus() >= 1)
                        {
                            bonus += magicRolledItem.GetBonus();
                        }
                        else
                        {
                            cost += magicRolledItem.GetCost();
                        }
                        break;
                    case "Specific Armor":
                        newName = "Specificized! Name: " + magicRolledItem.ToString();
                        break;
                    case "Potion":
                    case "Scroll":
                    case "Rod":
                    case "Wand":
                    case "Wondrous Item":
                        newName = magicRolledItem.ToString(); //no abilities, just a name
                        break;
                    case "Armor Ability":
                        itemType = "Armor Ability";
                        abilities += AddAbilities(rank, itemType);
                        rollsLeft++;
                        break;
                    case "Weapon Ability":
                        if(itemType == "")
                        {
                            rolledItem = (Item)WeaponsTable.rdsResult.Single();
                            itemType = rolledItem.GetItemType();
                            cost = rolledItem.GetCost();
                            textBox2.Text += "blarg! " + cost;
                        }
                        abilities += AddAbilities(rank, itemType);
                        //rollsLeft++;
                        break;
                    default:
                        break;
                }

            rollsLeft--;

            } while (rollsLeft > 0);

            #endregion

            //return newName;

            if (magicRolledItem.GetItemType() == "Magic Weapon")
            {
                cost += (int)Math.Pow(bonus, 2) * 200000 + 30000; //bonus^2 * 2000 gold
            }
            if (magicRolledItem.GetItemType() == "Magic Armor" || magicRolledItem.GetItemType() == "Magic Shield")
            {
                cost += (int)Math.Pow(bonus, 2) * 100000 + 15000; //bonus^2 * 1000 gold
            }

            return new MagicItem(magicRolledItem.GetItemType(),newName,cost,bonus);
        }
 private bool MagicItemsEqual(MagicItem fromDDI)
 {
     return MagicItemsEqual(fromDDI, FindMagicItem(fromDDI.Name));
 }