private void CheckManaItem(ref LootObject IOItemMana)
 {
     try
     {
         if(mGeneralSettings.GearInspectorSettings.LootByMana == 0){return;}
         if(mCurrentInventory.EmptyManaStonesCount == 0 || mCurrentInventory.EmptyManaStonesCount <= LOHash.Where(x => x.IOR == IOResult.manatank).Count()){return;}
         if(IOItemMana.Values(ALongValueKeys.CurrentMana) > mGeneralSettings.GearInspectorSettings.LootByMana)
         {
             IOItemMana.IOR = IOResult.manatank;
         }
     } catch(Exception ex){LogError(ex);}
 }
 private void CheckRare(ref LootObject IOItemRare)
 {
     try
     {
         if(IOItemRare.Values(ALongValueKeys.RareId) > 0)
         {
             IOItemRare.IOR = IOResult.rare;
         }
     }catch(Exception ex){LogError(ex);}
 }
        private bool MatchAdvanced(ItemRule rule, LootObject item)
        {
            bool result = false;
            bool[] tumbler = {false,false,false,false,false};
            List<int> ands = new List<int>();

            try
            {
                for(int i = 0; i < rule.Advanced.Count; i ++)
                {
                    if(rule.Advanced[i].keylink == 1) {ands.Add(i);}

                    if(rule.Advanced[i].keytype == 0)
                    {
                        switch(rule.Advanced[i].keycompare)
                        {
                            case 0:
                                if(item.Values((ADoubleValueKeys)rule.Advanced[i].key) == rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 1:
                                if(item.Values((ADoubleValueKeys)rule.Advanced[i].key) != rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 2:
                                if(item.Values((ADoubleValueKeys)rule.Advanced[i].key) >= rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 3:
                                if(item.Values((ADoubleValueKeys)rule.Advanced[i].key) <= rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                        }
                    }
                    else if(rule.Advanced[i].keytype == 1)
                    {
                        switch(rule.Advanced[i].keycompare)
                        {
                            case 0:
                                if(item.Values((ALongValueKeys)rule.Advanced[i].key) == rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 1:
                                if(item.Values((ALongValueKeys)rule.Advanced[i].key) != rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 2:
                                if(item.Values((ALongValueKeys)rule.Advanced[i].key) >= rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                            case 3:
                                if(item.Values((ALongValueKeys)rule.Advanced[i].key) <= rule.Advanced[i].keyvalue) {tumbler[i] = true;}
                                break;
                        }
                    }
                }

                switch(rule.Advanced.Count)
                {
                    case 1:  //2 ^ 0 == 1
                        if(tumbler[0]) {result = true;}
                        break;
                    case 2:  //2 ^ 1 == 2
                        if(rule.Advanced[0].keylink == 1)
                        {
                            if(tumbler[0] && tumbler[1]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2)
                        {
                            if(tumbler[0] || tumbler[1]) {result = true;}
                        }
                        break;
                    case 3:  //2 ^ 2 == 4
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1)
                        {
                            if(tumbler[0] && tumbler[1] && tumbler[2]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1]) || tumbler[2]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2])) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2)
                        {
                            if(tumbler[0] || tumbler[1] || tumbler[2]) {result = true;}
                        }
                        break;
                    case 4:  //2 ^ 3 == 8
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1)
                        {
                            if(tumbler[0] && tumbler[1] && tumbler[2] && tumbler[3]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1] && tumbler[2]) || tumbler[3]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1)
                        {
                            if((tumbler[0] && tumbler[1]) || (tumbler[2] && tumbler[3])) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2] && tumbler[3])) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1]) || tumbler[2] || tumbler[3]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1)
                        {
                            if(tumbler[0] || tumbler[1] || (tumbler[2] && tumbler[3])) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2)
                        {
                            if(tumbler[0] || tumbler[1] || tumbler[2] || tumbler[3]) {result = true;}
                        }
                        else if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2]) || tumbler[3]) {result = true;}
                        }
                        break;
                    case 5:  //2 ^ 4 == 16
                        // 0 Or
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 1)
                        {
                            if(tumbler[0] && tumbler[1] && tumbler[2] && tumbler[3] && tumbler[4]) {result = true;}
                        }

                        // 1 Or
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1] && tumbler[2] && tumbler[3]) || tumbler[4]) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 1)
                        {
                            if((tumbler[0] && tumbler[1] && tumbler[2]) || (tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 1)
                        {
                            if((tumbler[0] && tumbler[1]) || (tumbler[2] && tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 1)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2] && tumbler[3] && tumbler[4])) {result = true;}
                        }

                        // 2 Or
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1] && tumbler[2]) || tumbler[3] || tumbler[4]) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 1)
                        {
                            if((tumbler[0] && tumbler[1]) || tumbler[2] || (tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 1)
                        {
                            if(tumbler[0] || tumbler[1] || (tumbler[2] && tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1]) || (tumbler[2] && tumbler[3]) || tumbler[4]) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 1)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2]) || (tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 2)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2] && tumbler[3]) ||  tumbler[4]) {result = true;}
                        }

                        // 3 Or
                        if(rule.Advanced[0].keylink == 1 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 2)
                        {
                            if((tumbler[0] && tumbler[1]) || tumbler[2] || tumbler[3] || tumbler[4]) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 1 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 2)
                        {
                            if(tumbler[0] || (tumbler[1] && tumbler[2]) || tumbler[3] || tumbler[4]) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 1)
                        {
                            if(tumbler[0] || tumbler[1] || tumbler[2] || (tumbler[3] && tumbler[4])) {result = true;}
                        }
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 1 && rule.Advanced[3].keylink == 2)
                        {
                            if(tumbler[0] || tumbler[1] || (tumbler[2] && tumbler[3]) || tumbler[4]) {result = true;}
                        }

                        // 4 Or
                        if(rule.Advanced[0].keylink == 2 && rule.Advanced[1].keylink == 2 && rule.Advanced[2].keylink == 2 && rule.Advanced[3].keylink == 2)
                        {
                            if(tumbler[0] || tumbler[1] || tumbler[2] || tumbler[3] || tumbler[4]) {result = true;}
                        }

                        break;
                }
            }catch(Exception ex){LogError(ex);}
            return result;
        }
        private void CheckSalvageItem(ref LootObject IOItemSalvage)
        {
            try
            {
                int Material = (int)IOItemSalvage.Values(ALongValueKeys.Material);
                double SalvageWork = IOItemSalvage.Values(ADoubleValueKeys.SalvageWorkmanship);

                if(IOItemSalvage.Values(ADoubleValueKeys.SalvageWorkmanship) > 0)
                {
                    if(!SalvageMatDictionary.ContainsKey(Material)) {return;}

                    SalvageRule SalvageRuleMatch = SalvageMatDictionary[Material].Where(x => SalvageWork >= x.minwork && SalvageWork <= x.maxwork +0.99).FirstOrDefault();
                    if(SalvageRuleMatch != null)
                    {
                        IOItemSalvage.IOR = IOResult.salvage;
                        IOItemSalvage.MatchingSalvageRule = SalvageRuleMatch;
                    }
                }
            }catch(Exception ex){LogError(ex);}
        }
Пример #5
0
        private void ButlerHudList_Click(object sender, int row, int col)
        {
            try
            {
                ButlerRow = ButlerHudList[row];
                int ItemGuid = Convert.ToInt32(((HudStaticText)ButlerRow[6]).Text);
                LootObject lo = new LootObject(AetherObjects.Collection[ItemGuid]);

                if(col == 0)
                {
                    Host.Actions.SelectItem(lo.Id);
                }
                if(col == 1)
                {
                    if(mGeneralSettings.EnabledHudSettings.bGearInspectorEnabled)
                    {
                        Core.Actions.SelectItem(lo.Id);
                        Core.Actions.RequestId(lo.Id);
                    }
                    else
                    {
                        if(mGeneralSettings.GearInspectorSettings.GSStrings){HudToChat(lo.GSReportString(),2);}
                        if(mGeneralSettings.GearInspectorSettings.AlincoStrings){HudToChat(lo.LinkString(),2);}
                    }
               			}
                if(col == 2)
                {
                    Core.Actions.MoveItem(lo.Id, AetherCharacter.CharStats.Id, 0, false);
                }
                if(col == 3 && !mButlerFilters.storage)
                {
                    if(Core.Actions.OpenedContainer == 0 || AetherObjects.Collection[Core.Actions.OpenedContainer].Name != "Storage")
                    {
                        WriteToChat("No storage container opened.");
                    }
                    else
                    {
                        Foundry_LoadAction(FoundryActionTypes.AddToStorage, lo.Id);
                    }
                }
                if(col == 4 && !mButlerFilters.storage)
                {
                    if(AetherObjects.Collection[Core.Actions.CurrentSelection].ObjectClass == AObjectClass.Npc ||  AetherObjects.Collection[Core.Actions.CurrentSelection].ObjectClass == AObjectClass.Player)
                    {
                       if(lo.Values(ALongValueKeys.EquippedSlots) > 0 || lo.Values(ALongValueKeys.Unknown10) == 56)
                       {
                           	WriteToChat("Unequip the item first.");
                       }
                       else
                       {
                       		Host.Actions.GiveItem(lo.Id, Host.Actions.CurrentSelection);
                       }
                    }
                    else
                    {
                        WriteToChat("First select an NPC, Player, or yourself.");
                    }
                }
                if(col == 5 && !mButlerFilters.storage)
                {
                    if(AetherTrade.TradeWindow.InTrade)
                    {
                        Core.Actions.TradeAdd(lo.Id);
                    }
                    else if(AetherTrade.VendorId != 0)
                    {
                       if(lo.Values(ALongValueKeys.EquippedSlots) > 0 || lo.Values(ALongValueKeys.Unknown10) == 56)
                       {
                           	WriteToChat("Unequip the item first.");
                       }
                       else
                       {
                       		Core.Actions.VendorAddSellList(lo.Id);
                       }
                    }
                }
            }
            catch (Exception ex) { LogError(ex); }
        }