Ejemplo n.º 1
0
        private List <Item> findItemsOnContainer(int itemId, string location)
        {
            List <Item> items = new List <Item>();
            Container   c     = this.GetContainer(BotUtil.Number(location));

            if (c == null)
            {
                return(items);
            }

            foreach (Item item in c.Items)
            {
                if (item.Id == itemId)
                {
                    items.Add(item);
                }
            }
            return(items);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //get the key
            if (String.IsNullOrEmpty(textBox1.Text))
            {
                return;
            }
            KeyConverter k   = new KeyConverter();
            Key          key = (Key)k.ConvertFromString(textBox1.Text);

            //hotkey type
            string sType    = comboBox1.SelectedItem.ToString();
            int    count    = bot.GetHotkeys().Count;
            string hotkeyID = Convert.ToString(count + 1);
            Hotkey hotkey;
            string slot;

            switch (sType)
            {
            case "Use item on yourself":
                hotkey        = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseOnYourself);
                hotkey.ItemId = BotUtil.Number(textBox2.Text);
                if (hotkey.ItemId < 0)
                {
                    return;
                }

                //add from grid
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item on yourself", textBox2.Text, "");
                bot.AddHotkey(hotkey);
                break;

            case "Use item on target":
                hotkey        = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseOnTarget);
                hotkey.ItemId = BotUtil.Number(textBox2.Text);
                if (hotkey.ItemId < 0)
                {
                    return;
                }
                //add from grid
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item on target", textBox2.Text, "");
                bot.AddHotkey(hotkey);
                break;

            case "Use with crosshairs":
                hotkey        = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseWithCrosshairs);
                hotkey.ItemId = BotUtil.Number(textBox2.Text);
                if (hotkey.ItemId < 0)
                {
                    return;
                }
                //add from grid
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use with crosshairs", textBox2.Text, "");
                bot.AddHotkey(hotkey);
                break;

            case "Use item":
                hotkey        = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UseItem);
                hotkey.ItemId = BotUtil.Number(textBox2.Text);
                if (hotkey.ItemId < 0)
                {
                    return;
                }
                //add from grid
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Use item", textBox2.Text, "");
                bot.AddHotkey(hotkey);
                break;

            case "Equip item":
                hotkey        = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.EquipItem);
                hotkey.ItemId = BotUtil.Number(textBox2.Text);
                if (hotkey.ItemId < 0)
                {
                    return;
                }
                //add from grid
                slot = comboBox2.SelectedItem.ToString();
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Equip item", textBox2.Text, slot);
                hotkey.InventoryLocation = getInventoryLocationByString(slot);
                bot.AddHotkey(hotkey);
                break;

            case "Unequip item":
                hotkey = new Hotkey(hotkeyID, textBox1.Text, HotkeyType.UnequipItem);
                //add from grid
                slot = comboBox2.SelectedItem.ToString();
                this.dataGridView1.Rows.Add(hotkeyID, textBox1.Text, "Unequip item", "", slot);
                hotkey.InventoryLocation = getInventoryLocationByString(slot);
                bot.AddHotkey(hotkey);
                break;
            }

            textBox1.Clear();
        }
Ejemplo n.º 3
0
        public void SetSetting(string[] path, string value)
        {
            if (path[0].Equals("enabled", StringComparison.CurrentCultureIgnoreCase))
            {
                // Console.WriteLine("|Runemaker module: Enable: " + value);
                settings.Enabled = BotUtil.Bool(value);
                if (settings.Enabled)
                {
                    this.Enable();
                }
                else
                {
                    this.Disable();
                }
            }
            else if (path[0].Equals("hand", StringComparison.CurrentCultureIgnoreCase))
            {
                if (!ItemLocation.IsInventory(value))
                {
                    return;
                }

                Console.WriteLine("seeting inventory location: " + value);
                settings.InventoryLocation = value;
            }
            else if (path[0].Equals("spell", StringComparison.CurrentCultureIgnoreCase))
            {
                Spell spell = game.GetSpell(value);
                if (spell == null)
                {
                    return;
                }

                settings.Spell = spell;
            }
            else if (path[0].Equals("value", StringComparison.CurrentCultureIgnoreCase))
            {
                int val = BotUtil.Number(value);
                if (val < 0)
                {
                    return;
                }

                settings.Value = val;
            }
            else if (path[0].Equals("condition", StringComparison.CurrentCultureIgnoreCase))
            {
                value = value.ToLower();
                switch (value)
                {
                case "mana percent above":
                    settings.Condition = PlayerConditions.ManaPercentAbove;
                    break;

                case "mana above":
                    settings.Condition = PlayerConditions.ManaAbove;
                    break;
                }
            }
            else if (path[0].Equals("logout", StringComparison.CurrentCultureIgnoreCase))
            {
                settings.LogoutBlankRunes = BotUtil.Bool(value);
            }
        }