Beispiel #1
0
        private void OKButton_Clicked(object sender, EventArgs e)
        {
            GameObject.Item Item;
            Item                = GameObject.Items.Material.MaterialTemplates.GetRandomMaterial();
            Item.SubType        = GameObject.RNG.Next(GameObject.Items.Material.MaterialType.Max);
            Item.Description    = "A " + GameObject.Items.Material.MaterialType.GetTypeName(Item.SubType) + " made from " + Item.Name + ". Used in crafting equipment.";
            this.OKButton.Title = Item.GetName();
            this.slot.Item      = Item;
            ItemEquip eq = new ItemEquip();
            BonusPool p  = BonusPool.Load("heavy_0_10");

            eq.Bonuses.Add(p.PickBonus());
            eq.Bonuses.Add(p.PickBonus());
            Enchantment enc     = new Enchantment();
            int         enctype = GameObject.RNG.Next(0, 3);

            switch (enctype)
            {
            case 0:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Fire damage +{0}%", Type = "dmg_scale_fire"
                };
                enc.LineColour = new Color(255, 50, 30);
                enc.Multiplier = 0.15f;
                break;
            }

            case 1:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Water resistance +{0}%", Type = "element_multiplier_water"
                };
                enc.LineColour = new Color(0, 50, 200);
                enc.Multiplier = 0.05f;
                break;
            }

            case 2:
            {
                enc = new Enchantment()
                {
                    Effecttext = "Reduces poisoning duration by +{0}%", Type = "element_dot_time_poison"
                };
                enc.LineColour = new Color(0, 150, 20);
                enc.Multiplier = 0.33f;
                break;
            }
            }
            eq.Enchant = enc;
            eq.SubType = GameObject.RNG.Next(0, 10);
            if (eq.SubType == 7)
            {
                eq.SubType = 18;
            }
            if (eq.SubType == 8)
            {
                eq.SubType = 27;
            }
            if (eq.SubType == 9)
            {
                eq.SubType = 15;
            }
            eq.PrimaryMaterial   = Material.MaterialTemplates.GetRandomMaterial();
            eq.SecondaryMaterial = Material.MaterialTemplates.GetRandomMaterial();
            List <string> ToolTip = eq.GetTooltip();

            this.slot.Item = eq;
            Console.WriteEx("New item is ^BEGINLINK " + Renderer.ColourToCode(eq.NameColour) + "[" + eq.GetName() + "] ^ENDLINK .^FFFFFF Click name to see more.", new List <Action> {
                new Action(() => { ToolTipWindow tip = new ToolTipWindow(this.WM, ToolTip, WM.MouseX, WM.MouseY, false);
                                   WM.Add(tip); })
            });
            //this.Player.EquipItem(eq);
            this.Title = this.Player.CalculateStat("HP").ToString();
        }