コード例 #1
0
        public bool IsBetter(IWowItem current, IWowItem item)
        {
            if ((ArmorTypeBlacklist != null && item.GetType() == typeof(WowArmor) && ArmorTypeBlacklist.Contains(((WowArmor)item).ArmorType)) ||
                (WeaponTypeBlacklist != null && item.GetType() == typeof(WowWeapon) && WeaponTypeBlacklist.Contains(((WowWeapon)item).WeaponType)))
            {
                return(false);
            }

            double scoreCurrent = GearscoreFactory.Calculate(current);
            double scoreNew     = GearscoreFactory.Calculate(item);

            return(scoreCurrent < scoreNew);
        }
コード例 #2
0
        public static void Run(WowInterface wowInterface, AmeisenBotConfig config)
        {
            // create a copy here to prevent updates while selling
            foreach (IWowItem item in wowInterface.CharacterManager.Inventory.Items.Where(e => e.Price > 0).ToList())
            {
                IWowItem itemToSell = item;

                if (config.ItemSellBlacklist.Any(e => e.Equals(item.Name, StringComparison.OrdinalIgnoreCase)) ||
                    (!config.SellGrayItems && item.ItemQuality == WowItemQuality.Poor) ||
                    (!config.SellWhiteItems && item.ItemQuality == WowItemQuality.Common) ||
                    (!config.SellGreenItems && item.ItemQuality == WowItemQuality.Uncommon) ||
                    (!config.SellBlueItems && item.ItemQuality == WowItemQuality.Rare) ||
                    (!config.SellPurpleItems && item.ItemQuality == WowItemQuality.Epic))
                {
                    continue;
                }

                if (wowInterface.CharacterManager.IsItemAnImprovement(item, out IWowItem itemToReplace))
                {
                    // equip item and sell the other after
                    itemToSell = itemToReplace;
                    wowInterface.HookManager.LuaEquipItem(item, itemToReplace);
                }

                if (itemToSell != null &&
                    (wowInterface.ObjectManager.Player.Class != WowClass.Hunter || itemToSell.GetType() != typeof(WowProjectile)))
                {
                    wowInterface.HookManager.LuaUseContainerItem(itemToSell.BagId, itemToSell.BagSlot);
                    wowInterface.HookManager.LuaCofirmStaticPopup();
                }
            }
        }
コード例 #3
0
        private double GetRating(IWowItem item, EquipmentSlot slot)
        {
            double rating = 0;

            if (slot.Equals(EquipmentSlot.INVSLOT_OFFHAND))
            {
                // don't use shields or 2nd weapons
                return(0);
            }
            else if (slot.Equals(EquipmentSlot.INVSLOT_MAINHAND))
            {
                // axes
                if (item.GetType() == typeof(WowWeapon) && (((WowWeapon)item).WeaponType.Equals(WeaponType.TWOHANDED_AXES) || ((WowWeapon)item).WeaponType.Equals(WeaponType.ONEHANDED_AXES)))
                {
                    if (item.Stats.TryGetValue("ITEM_MOD_ATTACK_POWER_SHORT", out string attackString) && double.TryParse(attackString, out double attack))
                    {
                        rating += 0.5f * attack;
                    }
                    if (item.Stats.TryGetValue("ITEM_MOD_DAMAGE_PER_SECOND_SHORT", out string dpsString) && double.TryParse(dpsString, out double dps))
                    {
                        rating += 2f * dps;
                    }
                    if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, out double strength))
                    {
                        rating += 1f * strength;
                    }
                }
            }
            else if (slot.Equals(EquipmentSlot.INVSLOT_NECK) || slot.Equals(EquipmentSlot.INVSLOT_RING1) ||
                     slot.Equals(EquipmentSlot.INVSLOT_RING2) || slot.Equals(EquipmentSlot.INVSLOT_TRINKET1) ||
                     slot.Equals(EquipmentSlot.INVSLOT_TRINKET2))
            {
                // jewelry stats
                if (item.Stats.TryGetValue("ITEM_MOD_ATTACK_POWER_SHORT", out string attackString) && double.TryParse(attackString, out double attack))
                {
                    rating += 0.5f * attack;
                }
                if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, out double strength))
                {
                    rating += 1f * strength;
                }
            }
            else
            {
                // armor stats
                if (item.Stats.TryGetValue("RESISTANCE0_NAME", out string armorString) && double.TryParse(armorString, out double armor))
                {
                    rating += 0.5f * armor;
                }
                if (item.Stats.TryGetValue("ITEM_MOD_ATTACK_POWER_SHORT", out string attackString) && double.TryParse(attackString, out double attack))
                {
                    rating += 0.5f * attack;
                }
                if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, out double strength))
                {
                    rating += 1f * strength;
                }
            }
            return(rating);
        }
コード例 #4
0
        private double GetRating(IWowItem item, EquipmentSlot slot)
        {
            double rating = 0;

            if (item.Stats.TryGetValue("ITEM_MOD_CRIT_MELEE_RATING_SHORT", out string meleeCritString) && double.TryParse(meleeCritString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double meleeCrit))
            {
                rating += 0.5f * meleeCrit;
            }

            if (item.Stats.TryGetValue("ITEM_MOD_CRIT_RATING_SHORT", out string critString) && double.TryParse(critString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double crit))
            {
                rating += 0.5f * crit;
            }

            if (item.Stats.TryGetValue("ITEM_MOD_AGILITY_SHORT", out string agilityString) && double.TryParse(agilityString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double agility))
            {
                rating += 0.5f * agility;
            }

            if (item.Stats.TryGetValue("ITEM_MOD_ATTACK_POWER_SHORT", out string attackString) && double.TryParse(attackString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double attack))
            {
                rating += 0.5f * attack;
            }

            if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double strength))
            {
                rating += 1f * strength;
            }

            if (slot.Equals(EquipmentSlot.INVSLOT_OFFHAND) || slot.Equals(EquipmentSlot.INVSLOT_MAINHAND))
            {
                // also 2nd weapons
                if (item.GetType() == typeof(WowWeapon) && ((WowWeapon)item).WeaponType.Equals(WeaponType.ONEHANDED_SWORDS))
                {
                    if (item.Stats.TryGetValue("ITEM_MOD_DAMAGE_PER_SECOND_SHORT", out string dpsString) && double.TryParse(dpsString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double dps))
                    {
                        rating += 2f * dps;
                    }
                }
            }
            else if (!(slot.Equals(EquipmentSlot.INVSLOT_NECK) || slot.Equals(EquipmentSlot.INVSLOT_RING1) ||
                       slot.Equals(EquipmentSlot.INVSLOT_RING2) || slot.Equals(EquipmentSlot.INVSLOT_TRINKET1) ||
                       slot.Equals(EquipmentSlot.INVSLOT_TRINKET2)))
            {
                // armor stats
                if (item.Stats.TryGetValue("RESISTANCE0_NAME", out string armorString) && double.TryParse(armorString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double armor))
                {
                    rating += 0.1f * armor;
                }
            }

            return(rating);
        }
コード例 #5
0
        public override void Execute()
        {
            if (InventoryUpdateEvent.Run())
            {
                WowInterface.CharacterManager.Inventory.Update();
            }

            if (!NeedToSell())
            {
                StateMachine.SetState(BotState.Idle);
                return;
            }

            if (IsVendorNpcNear(out WowUnit selectedUnit))
            {
                if (WowInterface.ObjectManager.Player.Position.GetDistance(selectedUnit.Position) > 1.5)
                {
                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Moving, selectedUnit.Position);

                    if (WowInterface.MovementEngine.PathfindingStatus == PathfindingStatus.PathIncomplete)
                    {
                        ++BlacklistCounter;

                        if (BlacklistCounter > 2)
                        {
                            WowInterface.MovementEngine.StopMovement();
                            Blacklist.Add(selectedUnit.Guid);
                            BlacklistCounter = 0;
                            return;
                        }
                    }
                }
                else if (InteractionEvent.Run())
                {
                    if (WowInterface.ObjectManager.TargetGuid != selectedUnit.Guid)
                    {
                        WowInterface.HookManager.TargetGuid(selectedUnit.Guid);
                        return;
                    }

                    WowInterface.MovementEngine.StopMovement();

                    if (!BotMath.IsFacing(WowInterface.ObjectManager.Player.Position, WowInterface.ObjectManager.Player.Rotation, selectedUnit.Position))
                    {
                        WowInterface.HookManager.FacePosition(WowInterface.ObjectManager.Player, selectedUnit.Position);
                        return;
                    }

                    // WowInterface.HookManager.UnitOnRightClick(selectedUnit);
                    WowInterface.CharacterManager.ClickToMove(selectedUnit.Position, selectedUnit.Guid, Character.Enums.ClickToMoveType.Interact, 20.9f, 1.5f);

                    if (Config.AutoRepair && WowInterface.ObjectManager.Target.IsRepairVendor)
                    {
                        WowInterface.HookManager.RepairAllItems();
                    }

                    if (Config.AutoSell)
                    {
                        foreach (IWowItem item in WowInterface.CharacterManager.Inventory.Items.Where(e => e.Price > 0))
                        {
                            IWowItem itemToSell = item;

                            if (Config.ItemSellBlacklist.Any(e => e.Equals(item.Name, StringComparison.OrdinalIgnoreCase)) ||
                                (!Config.SellGrayItems && item.ItemQuality == ItemQuality.Poor) ||
                                (!Config.SellWhiteItems && item.ItemQuality == ItemQuality.Common) ||
                                (!Config.SellGreenItems && item.ItemQuality == ItemQuality.Uncommon) ||
                                (!Config.SellBlueItems && item.ItemQuality == ItemQuality.Rare) ||
                                (!Config.SellPurpleItems && item.ItemQuality == ItemQuality.Epic))
                            {
                                continue;
                            }

                            if (WowInterface.CharacterManager.IsItemAnImprovement(item, out IWowItem itemToReplace))
                            {
                                // equip item and sell the other after
                                itemToSell = itemToReplace;
                                WowInterface.HookManager.ReplaceItem(null, item);
                            }

                            if (itemToSell != null &&
                                (WowInterface.ObjectManager.Player.Class != WowClass.Hunter || itemToSell.GetType() != typeof(WowProjectile)))
                            {
                                WowInterface.HookManager.UseItemByBagAndSlot(itemToSell.BagId, itemToSell.BagSlot);
                                WowInterface.HookManager.CofirmBop();
                                Task.Delay(50).Wait();
                            }
                        }
                    }

                    foreach (IWowItem item in WowInterface.CharacterManager.Inventory.Items.Where(e => e.Price > 0))
                    {
                        IWowItem itemToSell = item;

                        if (Config.ItemSellBlacklist.Any(e => e.Equals(item.Name, StringComparison.OrdinalIgnoreCase)) ||
                            (!Config.SellGrayItems && item.ItemQuality == ItemQuality.Poor) ||
                            (!Config.SellWhiteItems && item.ItemQuality == ItemQuality.Common) ||
                            (!Config.SellGreenItems && item.ItemQuality == ItemQuality.Uncommon) ||
                            (!Config.SellBlueItems && item.ItemQuality == ItemQuality.Rare) ||
                            (!Config.SellPurpleItems && item.ItemQuality == ItemQuality.Epic))
                        {
                            continue;
                        }

                        if (WowInterface.CharacterManager.IsItemAnImprovement(item, out IWowItem itemToReplace))
                        {
                            // equip item and sell the other after
                            itemToSell = itemToReplace;
                            WowInterface.HookManager.ReplaceItem(null, item);
                        }

                        if (itemToSell != null &&
                            (WowInterface.ObjectManager.Player.Class != WowClass.Hunter || itemToSell.GetType() != typeof(WowProjectile)))
                        {
                            WowInterface.HookManager.UseItemByBagAndSlot(itemToSell.BagId, itemToSell.BagSlot);
                            WowInterface.HookManager.CofirmBop();
                        }
                    }

                    if (Config.AutoRepair && WowInterface.ObjectManager.Target.IsRepairVendor)
                    {
                        WowInterface.HookManager.RepairAllItems();
                    }
                }
            }
            else
            {
                StateMachine.SetState(BotState.Idle);
            }
        }
コード例 #6
0
        private double GetRating(IWowItem item, EquipmentSlot slot)
        {
            double rating = 0;

            if (slot.Equals(EquipmentSlot.INVSLOT_OFFHAND))
            {
                // shields
                if (item.GetType() == typeof(WowArmor) && ((WowArmor)item).ArmorType.Equals(ArmorType.SHIELDS))
                {
                    if (item.Stats.TryGetValue("RESISTANCE0_NAME", out string armorString) && double.TryParse(armorString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double armor))
                    {
                        rating += 0.5 * armor;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_STAMINA_SHORT", out string staminaString) && double.TryParse(staminaString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double stamina))
                    {
                        rating += 1f * stamina;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_DEFENSE_SKILL_RATING_SHORT", out string defenseString) && double.TryParse(defenseString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double defense))
                    {
                        rating += 1f * defense;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_BLOCK_VALUE_SHORT", out string blockString) && double.TryParse(blockString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double blockValue))
                    {
                        rating += 5f * blockValue;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_BLOCK_RATING_SHORT", out string blockChanceString) && double.TryParse(blockChanceString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double blockChance))
                    {
                        rating += 10f * blockChance;
                    }
                }
            }
            else if (slot.Equals(EquipmentSlot.INVSLOT_MAINHAND))
            {
                // swords
                if (item.GetType() == typeof(WowWeapon) && ((WowWeapon)item).WeaponType.Equals(WeaponType.ONEHANDED_SWORDS))
                {
                    if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double strength))
                    {
                        rating += 0.5f * strength;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_DAMAGE_PER_SECOND_SHORT", out string dpsString) && double.TryParse(dpsString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double dps))
                    {
                        rating += 1f * dps;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_DEFENSE_SKILL_RATING_SHORT", out string defenseString) && double.TryParse(defenseString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double defense))
                    {
                        rating += 5f * defense;
                    }

                    if (item.Stats.TryGetValue("ITEM_MOD_PARRY_RATING_SHORT", out string parryString) && double.TryParse(parryString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double parry))
                    {
                        rating += 10f * parry;
                    }
                }
            }
            else if (slot.Equals(EquipmentSlot.INVSLOT_NECK) || slot.Equals(EquipmentSlot.INVSLOT_RING1) ||
                     slot.Equals(EquipmentSlot.INVSLOT_RING2) || slot.Equals(EquipmentSlot.INVSLOT_TRINKET1) ||
                     slot.Equals(EquipmentSlot.INVSLOT_TRINKET2))
            {
                // jewelry stats
                if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double strength))
                {
                    rating += 0.5f * strength;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_STAMINA_SHORT", out string staminaString) && double.TryParse(staminaString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double stamina))
                {
                    rating += 1f * stamina;
                }
            }
            else
            {
                // armor stats
                if (item.Stats.TryGetValue("RESISTANCE0_NAME", out string armorString) && double.TryParse(armorString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double armor))
                {
                    rating += 0.5f * armor;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double strength))
                {
                    rating += 0.5f * strength;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_PARRY_RATING_SHORT", out string parryString) && double.TryParse(parryString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double parry))
                {
                    rating += 0.5f * parry;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_BLOCK_RATING_SHORT", out string blockChanceString) && double.TryParse(blockChanceString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double blockChance))
                {
                    rating += 0.5f * blockChance;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_BLOCK_VALUE_SHORT", out string blockString) && double.TryParse(blockString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double blockValue))
                {
                    rating += 0.5f * blockValue;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_STAMINA_SHORT", out string staminaString) && double.TryParse(staminaString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double stamina))
                {
                    rating += 1f * stamina;
                }

                if (item.Stats.TryGetValue("ITEM_MOD_DEFENSE_SKILL_RATING_SHORT", out string defenseString) && double.TryParse(defenseString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double defense))
                {
                    rating += 1f * defense;
                }
            }

            return(rating);
        }