コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (lbxWeightSets.SelectedIndex < 0 || lbxWeightSets.SelectedIndex >= _weightSets.Count)
            {
                Close();
                return;
            }

            AutoEquipSettings.ChosenWeightSet = _weightSets[lbxWeightSets.SelectedIndex];
            AutoEquipSettings.SaveDefaultAutoEquipSet();
            Close();
        }
コード例 #2
0
        public override void Initialize()
        {
            if (AutoEquipSettings.ChosenWeightSet == null)
            {
                AutoEquipSettings.LoadDefaultSet();
            }

            BotEvents.OnBotStart       += BotEvents_OnBotStart;
            BotEvents.Player.OnLevelUp += Player_OnLevelUp;
            Lua.Events.AttachEvent("UNIT_INVENTORY_CHANGED", HandleLootClosed);
            Lua.Events.AttachEvent("LOOT_CLOSED", HandleLootClosed);
            Lua.Events.AttachEvent("AUTOEQUIP_BIND_CONFIRM", HandleBindConfirm);
            Lua.Events.AttachEvent("EQUIP_BIND_CONFIRM", HandleBindConfirm);
            Lua.Events.AttachEvent("LOOT_BIND_CONFIRM", HandleBindConfirm);
            _initialized = true;
        }
コード例 #3
0
        private void RefreshWeightSets()
        {
            lbxWeightSets.Items.Clear();
            _weightSets.Clear();
            var weightSetPath = Path.Combine(AutoEquipSettings.PluginFolderPath, "Weight Sets");

            string[] files       = Directory.GetFiles(weightSetPath, "*.xml", SearchOption.AllDirectories);
            int      selectIndex = 0;

            for (int i = 0; i < files.Length; i++)
            {
                string file = files[i];
                string name = Path.GetFileNameWithoutExtension(file);
                try
                {
                    WeightSet weightSet = AutoEquipSettings.LoadWeightSetFromXML(name, XElement.Load(file));
                    _weightSets.Add(weightSet);
                    lbxWeightSets.Items.Add(name);

                    if (AutoEquipSettings.ChosenWeightSet != null && AutoEquipSettings.ChosenWeightSet.Name == weightSet.Name)
                    {
                        selectIndex = i;
                    }
                }
                catch (XmlException ex)
                {
                    Logging.Write("[AutoEquip]: Could not load weight set {0} - {1}", name, ex.Message);
                }
            }

            if (selectIndex < 0 || selectIndex >= lbxWeightSets.Items.Count)
            {
                return;
            }

            lbxWeightSets.SelectedIndex = selectIndex;
        }
コード例 #4
0
 private static void Log(bool main, string format, params object[] args)
 {
     AutoEquipSettings.Log(main, format, args);
 }
コード例 #5
0
 public AutoEquip()
 {
     AutoEquipSettings.InitializeSettings();
     // If this is because of a recompile, we will be able to find the default set right now. Else we will do it again in the first pulse. :)
     AutoEquipSettings.LoadDefaultSet();
 }
コード例 #6
0
        private void DoCheck()
        {
            if (AutoEquipSettings.ChosenWeightSet == null)
            {
                Log(true, "You have not yet selected a weight set!{0}Please open the form and select a weight set to use AutoEquip.", Environment.NewLine);
                return;
            }

            if (!_doCheckWait.IsFinished)
            {
                return;
            }

            _doCheckWait.Reset();

            RefreshEquippedItems();


            int tickCount = Environment.TickCount;

            HashSet <WoWItemQuality> equipQualities = AutoEquipSettings.EquipQualities;
            var items = new List <WoWItem>();

            items.AddRange(ObjectManager.Me.Inventory.Backpack.PhysicalItems);
            for (uint i = 0; i < 4; i++)
            {
                WoWContainer bag = ObjectManager.Me.GetBagAtIndex(i);
                if (bag != null)
                {
                    items.AddRange(bag.PhysicalItems);
                }
            }

            var equippableNewItems = new List <WoWItem>();

            foreach (WoWItem item in items)
            {
                ulong itemGuid = item.Guid;
                if (_ignoreItems.Contains(itemGuid))
                {
                    continue;
                }

                if (_equippedItems.ContainsValue(item) ||
                    AutoEquipSettings.IsItemIgnored(item) ||
                    AutoEquipSettings.IgnoreTypes.Contains(item.ItemInfo.InventoryType) ||
                    !equipQualities.Contains(item.ItemInfo.Quality) ||
                    !ObjectManager.Me.CanEquipItem(item))
                {
                    _ignoreItems.Add(itemGuid);
                    continue;
                }

                equippableNewItems.Add(item);
            }

            int took = Environment.TickCount - tickCount;

            if (equippableNewItems.Count == 0)
            {
                return;
            }

            if (AutoEquipSettings.AutoEquipItems)
            {
                tickCount = Environment.TickCount;


                CheckForItems(equippableNewItems);


                took = Environment.TickCount - tickCount;
            }
            if (AutoEquipSettings.AutoEquipBags)
            {
                tickCount = Environment.TickCount;


                CheckForBag(equippableNewItems);


                took = Environment.TickCount - tickCount;
            }
        }