Mythic+ 30 and Updated Search functions and files

This commit is contained in:
merstrax
2022-01-15 04:55:43 -05:00
parent f354b79231
commit d9c6979f75
15 changed files with 12689 additions and 12912 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: AtlasLoot Ascension Edition
## Notes: Shows the possible loot from the bosses
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Credits: Daviesh, Lag, Cellelach, Asurn, Pernicus and many others.
## X-Category: Map
+84 -193
View File
@@ -2,172 +2,178 @@ local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
AtlasLoot_Difficulty = {
-- table of difficulties and there itemID references
["ClassicDungeon"] = {
["ClassicDungeon"] = {
[1] = {
{"Normal", "", [4] = "Submenu"},
},
{"Normal", "", [4] = "Submenu"},
},
[2] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
{"Bloodforged", 1, [4] = "Submenu"},
},
};
["ClassicDungeonExt"] = {
["ClassicDungeonExt"] = {
[1] = {
{"Normal", "", [4] = "Submenu"},
},
{"Normal", "", [4] = "Submenu"},
},
[2] = {
{"Heroic", 3, "=q4=", [4] = "Submenu"},
},
{"Heroic", 3, "=q4=", [4] = "Submenu"},
},
[3] = {
{"Mythic", 4, "=q4=", [4] = "Submenu"},
},
[4] = {
{"Mythic", 4, "=q4=", [4] = "Submenu"},
},
[4] = {
["Mythic+ 1-10"] = {
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 6", 10, "=q4=", [4] = "Submenu" }, {"Mythic 7", 11, "=q4=", [4] = "Submenu" }, {"Mythic 8", 12, "=q4=", [4] = "Submenu" }, {"Mythic 9", 13, "=q4=", [4] = "Submenu" }, {"Mythic 10", 14, "=q4=", [4] = "Submenu" },
},
},
},
[5] = {
["Mythic+ 11-20"] = {
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 16", 20, "=q4=", [4] = "Submenu" }, {"Mythic 17", 21, "=q4=", [4] = "Submenu" }, {"Mythic 18", 22, "=q4=", [4] = "Submenu" }, {"Mythic 19", 23, "=q4=", [4] = "Submenu" }, {"Mythic 20", 24, "=q4=", [4] = "Submenu" },
},
},
},
[6] = {
["Mythic+ 21-30"] = {
{"Mythic 21", 25, "=q4=", [4] = "Submenu" }, {"Mythic 22", 26, "=q4=", [4] = "Submenu" }, {"Mythic 23", 27, "=q4=", [4] = "Submenu" }, {"Mythic 24", 28, "=q4=", [4] = "Submenu" }, {"Mythic 25", 29, "=q4=", [4] = "Submenu" },
{"Mythic 26", 30, "=q4=", [4] = "Submenu" }, {"Mythic 27", 31, "=q4=", [4] = "Submenu" }, {"Mythic 28", 32, "=q4=", [4] = "Submenu" }, {"Mythic 29", 33, "=q4=", [4] = "Submenu" }, {"Mythic 30", 34, "=q4=", [4] = "Submenu" },
},
},
[7] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
},
};
["ClassicRaid"] = {
["ClassicRaid"] = {
[1] = {
{"Normal Flex", "", [4] = "Submenu"},
},
{"Normal Flex", "", [4] = "Submenu"},
},
[2] = {
{"Heroic Flex", 3, [4] = "Submenu"},
},
{"Heroic Flex", 3, [4] = "Submenu"},
},
[3] = {
{"Ascended", 4, [4] = "Submenu"},
{"Ascended", 4, [4] = "Submenu"},
},
[4] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
},
};
["BCDungeon"] = {
["BCDungeon"] = {
[1] = {
{"Normal/Heroic", "", [4] = "Submenu"},
},
{"Normal/Heroic", "", [4] = "Submenu"},
},
[2] = {
{"Mythic", 4, "=q4=", [4] = "Submenu"},
{"Mythic", 4, "=q4=", [4] = "Submenu"},
},
[3] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
},
--[[
[3] = {
[3] = {
["Mythic+ 1-10"] = {
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 6", 10, "=q4=", [4] = "Submenu" }, {"Mythic 7", 11, "=q4=", [4] = "Submenu" }, {"Mythic 8", 12, "=q4=", [4] = "Submenu" }, {"Mythic 9", 13, "=q4=", [4] = "Submenu" }, {"Mythic 10", 14, "=q4=", [4] = "Submenu" },
},
},
},
[4] = {
["Mythic+ 11-20"] = {
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 16", 20, "=q4=", [4] = "Submenu" }, {"Mythic 17", 21, "=q4=", [4] = "Submenu" }, {"Mythic 18", 22, "=q4=", [4] = "Submenu" }, {"Mythic 19", 23, "=q4=", [4] = "Submenu" }, {"Mythic 20", 24, "=q4=", [4] = "Submenu" },
},
},
},
]]
};
["BCRaid"] = {
["BCRaid"] = {
[1] = {
{"Normal Flex", "", [4] = "Submenu"},
},
{"Normal Flex", "", [4] = "Submenu"},
},
[2] = {
{"Heroic Flex", 3, [4] = "Submenu"},
},
{"Heroic Flex", 3, [4] = "Submenu"},
},
[3] = {
{"Ascended", 4, [4] = "Submenu"},
{"Ascended", 4, [4] = "Submenu"},
},
[4] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
};
["WrathDungeon"] = {
["WrathDungeon"] = {
[1] = {
{"Normal/Heroic", "", [4] = "Submenu"},
},
{"Normal/Heroic", "", [4] = "Submenu"},
},
[2] = {
{"Mythic", 4, "=q4=", [4] = "Submenu"},
{"Mythic", 4, "=q4=", [4] = "Submenu"},
},
[3] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
},
--[[
[3] = {
[3] = {
["Mythic+ 1-10"] = {
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 1", 5, "=q4=", [4] = "Submenu" }, {"Mythic 2", 6, "=q4=", [4] = "Submenu" }, {"Mythic 3", 7, "=q4=", [4] = "Submenu" }, {"Mythic 4", 8, "=q4=", [4] = "Submenu" }, {"Mythic 5", 9, "=q4=", [4] = "Submenu" },
{"Mythic 6", 10, "=q4=", [4] = "Submenu" }, {"Mythic 7", 11, "=q4=", [4] = "Submenu" }, {"Mythic 8", 12, "=q4=", [4] = "Submenu" }, {"Mythic 9", 13, "=q4=", [4] = "Submenu" }, {"Mythic 10", 14, "=q4=", [4] = "Submenu" },
},
},
},
[4] = {
["Mythic+ 11-20"] = {
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 11", 15, "=q4=", [4] = "Submenu" }, {"Mythic 12", 16, "=q4=", [4] = "Submenu" }, {"Mythic 13", 17, "=q4=", [4] = "Submenu" }, {"Mythic 14", 18, "=q4=", [4] = "Submenu" }, {"Mythic 15", 19, "=q4=", [4] = "Submenu" },
{"Mythic 16", 20, "=q4=", [4] = "Submenu" }, {"Mythic 17", 21, "=q4=", [4] = "Submenu" }, {"Mythic 18", 22, "=q4=", [4] = "Submenu" }, {"Mythic 19", 23, "=q4=", [4] = "Submenu" }, {"Mythic 20", 24, "=q4=", [4] = "Submenu" },
},
},
},
]]
};
["WrathRaid"] = {
["WrathRaid"] = {
[1] = {
{"Normal Flex", "", [4] = "Submenu"},
},
{"Normal Flex", "", [4] = "Submenu"},
},
[2] = {
{"Heroic Flex", 3, [4] = "Submenu"},
},
{"Heroic Flex", 3, [4] = "Submenu"},
},
[3] = {
{"Ascended", 4, [4] = "Submenu"},
{"Ascended", 4, [4] = "Submenu"},
},
[4] = {
{"Bloodforged", 1, [4] = "Submenu"},
},
};
["Crafting"] = {
["Crafting"] = {
[1] = {
{"Crafting Patterns", "", [4] = "Submenu" },
},
[2] = {
[2] = {
{"Item Normal", "=s=Normal", [4] = "Submenu" },
},
[3] = {
[3] = {
{"Bloodforged", 1, [4] = "Submenu" },
},
},
};
["CraftingExt"] = {
["CraftingExt"] = {
[1] = {
{"Crafting Pattern Uncommon", "", [4] = "Submenu" },
},
[2] = {
[2] = {
{"Crafting Patterns Rare", "Rare", [4] = "Submenu" },
},
[3] = {
[3] = {
{"Crafting Patterns Epic", "Epic", [4] = "Submenu" },
},
[4] = {
[4] = {
{"Item Uncommon", "=s=", [4] = "Submenu" },
},
[5] = {
[5] = {
{"Item Rare", "=s=Rare", [4] = "Submenu" },
},
[6] = {
[6] = {
{"Item Epic", "=s=Epic", [4] = "Submenu" }
},
},
};
["Search"] = {"Bloodforged", "Normal", "Heroic", "Mythic", "Mythic 1", "Mythic 2","Mythic 3","Mythic 4","Mythic 5", "Mythic 6","Mythic 7",
"Mythic 8","Mythic 9", "Mythic 10", "Mythic 11", "Mythic 12","Mythic 13","Mythic 14","Mythic 15", "Mythic 16","Mythic 17","Mythic 18",
@@ -179,125 +185,10 @@ AtlasLoot_Difficulty = {
Heroic = 3;
Mythic = 4; --Use for Ascended as well
MythicPlus = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; --Usage AtlasLoot_Difficulty.MythicPlus[1-20];
MythicPlus = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34}; --Usage AtlasLoot_Difficulty.MythicPlus[1-30];
DIF_SEARCH = 16;
DUPLICATE = 17;
MIN_DIF = 18;
MAX_DIF = 19;
}
function QueryItems(instance, difficulty, expansion)
if instance == "help" then
print("Instance types are: \"Dungeon\", \"Raid\"");
print("Difficulty types are: 1 - 24");
print("Expansion options are: \"classic\" and \"tbc\"");
print("Example: QueryItems(\"Dungeon\", 10) - This will query all classic dungeons Mythic+ 6 items");
print("Example: QueryItems(\"Dungeon\", 10, \"tbc\") - This will query all tbc dungeons Mythic+ 6 items");
return
end
local instanceType = "ClassicRaid";
--Expansion select enums to make arguments easier to use
local ex_sel = {
["classic"] = AL["Classic Instances"];
["tbc"] = AL["BC Instances"];
}
--Setup ranges so we arent parsing unwanted instance pages
local range = {
["classic"] = {
["Raid"] = {2, 8},
["Dungeon"] = {10, 29}
},
["tbc"] = {
["Raid"] = {2, 10},
["Dungeon"] = {12, 27}
}
}
--Setup defualts if the arguments are not set or nil
if expansion == nil or ex_sel[expansion] == nil then expansion = "classic" end
if instance == nil then
instance = "Dungeon"
instanceType = "ClassicDungeonExt"
end
--TBC dungeon types are ExDungeon, i only want one argument type so we swap it here
if instance == "Dungeon" and expansion == "tbc" then
instanceType = "BCDungeon"
end
if instance == "Raid" then
if expansion == "classic" then
instanceType = "ClassicRaid"
end
if expansion == "tbc" then
instanceType = "BCRaid"
end
end
if difficulty == nil then difficulty = AtlasLoot_Difficulty.Normal end
--We parse a drop down menu, they are setup weird so we have to check for expansion twice in the arry once as a number second as a Global Var
local _men = 1
if expansion == "tbc" then _men = 2 end;
if instance == "Raid" then difficulty = math.min(AtlasLoot_Difficulty.Mythic, difficulty) end
for i = range[expansion][instance][1], range[expansion][instance][2] do
local inst = "";
--DireMaul is in an another drop down list so instead what we can do is utilize instance ids we won't be querying
if i == 14 and expansion == "classic" then inst = "DireMaulNorth" elseif i == 15 and expansion == "classic" then inst = "DireMaulEast" elseif i == 16 and expansion == "classic" then inst = "DireMaulWest"
else
inst = AtlasLoot_DewDropDown[_men][ex_sel[expansion]][i][1][2]
end
if (inst ~= nil and AtlasLoot_DewDropDown_SubTables[inst] ~= nil) then
for b = 1, #AtlasLoot_DewDropDown_SubTables[inst] do
local boss = AtlasLoot_DewDropDown_SubTables[inst][b][2];
if(AtlasLoot_Data[boss] ~= nil and AtlasLoot_Data[boss].Type ~= nil and AtlasLoot_Data[boss].Type == instanceType) then
local n = 1;
local querytime = 0;
local now = 0;
while n < 31 do
now = GetTime();
if now - querytime > 0.01 then
querytime = GetTime();
if(AtlasLoot_Data[boss][n] ~= nil) then
local queryitem = AL_FindId(string.sub(AtlasLoot_Data[boss][n][4], 5), difficulty) or AtlasLoot_Data[boss][n][2];
if (queryitem) and (queryitem ~= nil) and (queryitem ~= "") and (queryitem ~= 0) and (string.sub(queryitem, 1, 1) ~= "s") then
AtlasLootTooltip:SetHyperlink("item:"..queryitem..":0:0:0:0:0:0:0");
end
end
n = n + 1;
end
end
print("Query for "..boss.." in instance "..inst.." finished");
end
end
elseif AtlasLoot_DewDropDown[_men][ex_sel[expansion]][i][1][3] == "Table" then
if(AtlasLoot_Data[inst] ~= nil and AtlasLoot_Data[inst].Type ~= nil and AtlasLoot_Data[inst].Type == instanceType) then
local n = 1;
local querytime = 0;
local now = 0;
while n < 31 do
now = GetTime();
if now - querytime > 0.01 then
querytime = GetTime();
if(AtlasLoot_Data[inst][n] ~= nil) then
local queryitem = AL_FindId(string.sub(AtlasLoot_Data[inst][n][4], 5), difficulty) or AtlasLoot_Data[inst][n][2];
if (queryitem) and (queryitem ~= nil) and (queryitem ~= "") and (queryitem ~= 0) and (string.sub(queryitem, 1, 1) ~= "s") then
AtlasLootTooltip:SetHyperlink("item:"..queryitem..":0:0:0:0:0:0:0");
end
end
n = n + 1;
end
end
print("Query for "..inst.." in instance "..inst.." finished");
end
end
end
print("You may need to reload your UI to finalize the Query")
end
+1 -1
View File
@@ -2276,7 +2276,7 @@
AtlasLootAdvancedSearch_Argument1Value:ClearFocus();
AtlasLootAdvancedSearch_Argument2Value:ClearFocus();
AtlasLootAdvancedSearch_Argument3Value:ClearFocus();
AtlasLoot:AdvancedSearch(AtlasLootAdvancedSearch_SearchBox:GetText(), AtlasLootAdvancedSearch_Argument1Value:GetText(), AtlasLootAdvancedSearch_Argument2Value:GetText(), AtlasLootAdvancedSearch_Argument3Value:GetText());
AtlasLoot:AdvancedSearch(AtlasLootAdvancedSearch_SearchBox:GetText(), {AtlasLootAdvancedSearch_Argument1Value:GetText(), AtlasLootAdvancedSearch_Argument2Value:GetText(), AtlasLootAdvancedSearch_Argument3Value:GetText()});
</OnClick>
</Scripts>
</Button>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+385 -366
View File
@@ -8,105 +8,106 @@ local ORANGE = "|cffFF8400";
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
local modules = { "AtlasLoot_BurningCrusade", "AtlasLoot_Crafting", "AtlasLoot_OriginalWoW", "AtlasLoot_WorldEvents", "AtlasLoot_WrathoftheLichKing" };
currentPage = 1;
SearchResult = nil;
local currentPage = 1;
local SearchResult = nil;
-- Supported Operators
BINARYOPERATORS = { "&" };
OPERATORS = { "<>", "<=", ">=", "=", "<", ">" };
local OP_AND = "&"
local BINARYOPERATORS = { OP_AND };
-- multi-character patterns must come before single-character patterns
local RELATIONAL_OPERATORS = { ">=", "<=", "<>", "<", ">", "=", };
-- Supported Stat Filters
STATFILTERS = {
local STAT_FILTERS = {
-- Base Stats
["stamina"] = "ITEM_MOD_STAMINA_SHORT",
["stam"] = "ITEM_MOD_STAMINA_SHORT",
["sta"] = "ITEM_MOD_STAMINA_SHORT",
["strength"] = "ITEM_MOD_STRENGTH_SHORT",
["str"] = "ITEM_MOD_STRENGTH_SHORT",
["agility"] = "ITEM_MOD_AGILITY_SHORT",
["agi"] = "ITEM_MOD_AGILITY_SHORT",
["intellect"] = "ITEM_MOD_INTELLECT_SHORT",
["int"] = "ITEM_MOD_INTELLECT_SHORT",
["spirit"] = "ITEM_MOD_SPIRIT_SHORT",
["spir"] = "ITEM_MOD_SPIRIT_SHORT",
["spi"] = "ITEM_MOD_SPIRIT_SHORT",
["spr"] = "ITEM_MOD_SPIRIT_SHORT",
["health"] = "ITEM_MOD_HEALTH_SHORT",
["mana"] = "ITEM_MOD_MANA_SHORT",
["mp5"] = "ITEM_MOD_POWER_REGEN0_SHORT",
["mpr"] = "ITEM_MOD_POWER_REGEN0_SHORT",
["hp5"] = "ITEM_MOD_HEALTH_REGEN_SHORT",
["hpr"] = "ITEM_MOD_HEALTH_REGEN_SHORT",
--Sockets
["socketblue"] = "EMPTY_SOCKET_BLUE",
["socketred"] = "EMPTY_SOCKET_RED",
["socketyellow"] = "EMPTY_SOCKET_YELLOW",
["socketnocolor"] = "EMPTY_SOCKET_NO_COLOR",
["socketwhite"] = "EMPTY_SOCKET_NO_COLOR",
["socketmeta"] = "EMPTY_SOCKET_META",
["meta"] = "EMPTY_SOCKET_META",
--Secondary Stats
["attackpowerferal"] = "ITEM_MOD_FERAL_ATTACK_POWER_SHORT",
["attackpowferal"] = "ITEM_MOD_FERAL_ATTACK_POWER_SHORT",
["apferal"] = "ITEM_MOD_FERAL_ATTACK_POWER_SHORT",
["attackpower"] = "ITEM_MOD_ATTACK_POWER_SHORT",
["attackpow"] = "ITEM_MOD_ATTACK_POWER_SHORT",
["ap"] = "ITEM_MOD_ATTACK_POWER_SHORT",
["spellpower"] = "ITEM_MOD_SPELL_POWER_SHORT",
["spellpow"] = "ITEM_MOD_SPELL_POWER_SHORT",
["sp"] = "ITEM_MOD_SPELL_POWER_SHORT",
["spellpenetration"] = "ITEM_MOD_SPELL_PENETRATION_SHORT",
["spellpen"] = "ITEM_MOD_SPELL_PENETRATION_SHORT",
["spp"] = "ITEM_MOD_SPELL_PENETRATION_SHORT",
["crit"] = "ITEM_MOD_CRIT_RATING_SHORT",
["haste"] = "ITEM_MOD_HASTE_RATING_SHORT",
["hit"] = "ITEM_MOD_HIT_RATING_SHORT",
["armorpenetration"] = "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT",
["armourpenetration"] = "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT",
["armorpen"] = "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT",
["armourpen"] = "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT",
["arp"] = "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT",
["expertise"] = "ITEM_MOD_EXPERTISE_RATING_SHORT",
["exp"] = "ITEM_MOD_EXPERTISE_RATING_SHORT",
["dps"] = "ITEM_MOD_DAMAGE_PER_SECOND_SHORT",
["resilience"] = "ITEM_MOD_RESILIENCE_RATING",
["resil"] = "ITEM_MOD_RESILIENCE_RATING",
["res"] = "ITEM_MOD_RESILIENCE_RATING",
["defense"] = "ITEM_MOD_DEFENSE_SKILL_RATING_SHORT",
["def"] = "ITEM_MOD_DEFENSE_SKILL_RATING_SHORT",
["dodge"] = "ITEM_MOD_DODGE_RATING_SHORT",
["dod"] = "ITEM_MOD_DODGE_RATING_SHORT",
["block"] = "ITEM_MOD_BLOCK_RATING_SHORT",
["blockvalue"] = "ITEM_MOD_BLOCK_VALUE_SHORT",
["blockval"] = "ITEM_MOD_BLOCK_VALUE_SHORT",
["bv"] = "ITEM_MOD_BLOCK_VALUE_SHORT",
["parry"] = "ITEM_MOD_PARRY_RATING_SHORT",
--Resistances
["armor"] = "RESISTANCE0_NAME",
["armour"] = "RESISTANCE0_NAME",
@@ -114,30 +115,37 @@ STATFILTERS = {
["resistancephysical"] = "RESISTANCE0_NAME",
["resistancephys"] = "RESISTANCE0_NAME",
["resphys"] = "RESISTANCE0_NAME",
["resistanceholy"] = "RESISTANCE1_NAME",
["resholy"] = "RESISTANCE1_NAME",
["resistancefire"] = "RESISTANCE2_NAME",
["resfire"] = "RESISTANCE2_NAME",
["resistancenature"] = "RESISTANCE3_NAME",
["resnature"] = "RESISTANCE3_NAME",
["resnat"] = "RESISTANCE3_NAME",
["resistanceforst"] = "RESISTANCE4_NAME",
["resfrost"] = "RESISTANCE4_NAME",
["resistanceshadow"] = "RESISTANCE5_NAME",
["resshadow"] = "RESISTANCE5_NAME",
["resshad"] = "RESISTANCE5_NAME",
["resistancearcane"] = "RESISTANCE6_NAME",
["resarcane"] = "RESISTANCE6_NAME",
["resarc"] = "RESISTANCE6_NAME"
};
ITEMSOCKETSTATFILTERS = {
local SOCKET_FILTERS = {
["socket"] = true,
["sockets"] = true,
["gem"] = true,
["gems"] = true,
};
local SOCKET_TYPES = {
"EMPTY_SOCKET_BLUE",
"EMPTY_SOCKET_RED",
"EMPTY_SOCKET_YELLOW",
@@ -145,51 +153,336 @@ ITEMSOCKETSTATFILTERS = {
"EMPTY_SOCKET_NO_COLOR"
};
ITEMINFOFILTERS = {
["ilvl"] = "ilvl",
["minlvl"] = "minlvl",
["type"] = "type",
["subtype"] = "subtype",
["quality"] = "quality"
local INFO_FILTERS = {
["ilvl"] = true,
["minlvl"] = true,
--["type"] = true,
--["subtype"] = true,
};
ITEMLEVELGEAREQUIPFILTER = {
["INVTYPE_NON_EQUIP"] = "INVTYPE_NON_EQUIP",
["INVTYPE_BODY"] = "INVTYPE_BODY",
["INVTYPE_BAG"] = "INVTYPE_BAG",
["INVTYPE_AMMO"] = "INVTYPE_AMMO",
["INVTYPE_QUIVER"] = "INVTYPE_QUIVER"
local QUALITY_FILTERS = {
["poor"] = 0,
["common"] = 1,
["uncommon"] = 2,
["rare"] = 3,
["epic"] = 4,
["legendary"] = 5,
["artifact"] = 6,
["heirloom"] = 7
};
-- Slash command that prints out all used item filter keys
SLASH_ATLASLOOTITEMINFOFILTERS1 = "/atlaslootfilterkeys";
SlashCmdList["ATLASLOOTITEMINFOFILTERS"] = function(msg, editBox)
local sortedTable = { "socket", "sockets", "gem", "gems", "ilvl" };
for index, statItem in pairs(STATFILTERS) do
table.insert(sortedTable, index);
end
table.sort(sortedTable, function(a,b) return a < b; end)
local SLOT_FILTERS = {
["none"] = "INVTYPE_NON_EQUIP",
["head"] = "INVTYPE_HEAD",
["neck"] = "INVTYPE_NECK",
["shoulder"] = "INVTYPE_SHOULDER",
["body"] = "INVTYPE_BODY",
["chest"] = "INVTYPE_CHEST",
["waist"] = "INVTYPE_WAIST",
["legs"] = "INVTYPE_LEGS",
["feet"] = "INVTYPE_FEET",
["wrist"] = "INVTYPE_WRIST",
["hand"] = "INVTYPE_HAND",
["finger"] = "INVTYPE_FINGER",
["trinket"] = "INVTYPE_TRINKET",
["weapon"] = "INVTYPE_WEAPON",
["shield"] = "INVTYPE_SHIELD",
["ranged"] = "INVTYPE_RANGED",
["cloak"] = "INVTYPE_CLOAK",
["2hweapon"] = "INVTYPE_2HWEAPON",
["bag"] = "INVTYPE_BAG",
["tabard"] = "INVTYPE_TABARD",
["robe"] = "INVTYPE_ROBE",
["weaponmainhand"] = "INVTYPE_WEAPONMAINHAND",
["mainhand"] = "INVTYPE_WEAPONMAINHAND",
["weaponoffhand"] = "INVTYPE_WEAPONOFFHAND",
["offhand"] = "INVTYPE_WEAPONOFFHAND",
["holdable"] = "INVTYPE_HOLDABLE",
["ammo"] = "INVTYPE_AMMO",
["thrown"] = "INVTYPE_THROWN",
["rangedright"] = "INVTYPE_RANGEDRIGHT",
["quiver"] = "INVTYPE_QUIVER",
["relic"] = "INVTYPE_RELIC"
};
local filterKeys = "Filter keys: [ ";
for i, filterIndex in pairs(sortedTable) do
if i == 1 then
filterKeys = filterKeys..filterIndex;
else
filterKeys = filterKeys..", "..filterIndex;
end
end
filterKeys = filterKeys.." ]";
print(filterKeys);
local NON_EQUIPABLE_SLOTS = {
["INVTYPE_NON_EQUIP"] = true,
["INVTYPE_BODY"] = true,
["INVTYPE_BAG"] = true,
["INVTYPE_AMMO"] = true,
["INVTYPE_QUIVER"] = true,
};
SLASH_ATLASLOOTHELP1 = "/atlasloothelp";
SlashCmdList["ATLASLOOTHELP"] = function(msg, editBox)
local function show(caption, t)
local keys = {}
for key in pairs(t) do table.insert(keys, key) end
table.sort(keys, function(a,b) return a < b end)
print(caption..": ".. table.concat(keys, ", "))
end
show("stat", STAT_FILTERS)
show("socket", SOCKET_FILTERS)
show("slot", SLOT_FILTERS)
show("quality", QUALITY_FILTERS)
show("info", INFO_FILTERS)
print("\nExamples:")
print("gladiator")
print("str>40")
print("gladiator&str>40")
print("str>40&ilvl>=120&ilvl<140&int>0&socket>2");
print("sp>20&quality>=rare&quality<legendary&slot=finger");
print("stam>20&minlvl<=50")
end
-- Slash command that prints filter examples
SLASH_ATLASLOOTITEMINFOFILTEREXAMPLE1 = "/atlaslootfilterexample";
SlashCmdList["ATLASLOOTITEMINFOFILTEREXAMPLE"] = function(msg, editBox)
print("Single search example: str>40");
print("Multi search example: str>40&ilvl<140&ilvl>=120&int>0&socket>2");
SLASH_ATLASLOOTSEARCH1 = "/atlaslootsearch";
SLASH_ATLASLOOTSEARCH2 = "/als";
SlashCmdList["ATLASLOOTSEARCH"] = function(search, editBox)
AtlasLootDefaultFrame:Show()
if search and search ~= '' then
AtlasLootDefaultFrameSearchBox:SetText(search)
AtlasLootDefaultFrameSearchButton:Click()
end
end
-- split one string on another (delimiter can be more than one character)
local function SplitString(str, delimiter)
local result = {}
local start = 1
local len = #str
while start <= len do
local delimPos = str:find(delimiter, start, true)
if delimPos then
result[#result+1] = str:sub(start, delimPos-1) -- grab up to the delimeter
start = delimPos + #delimiter -- advance past the delimiter
else
result[#result+1] = str:sub(start) -- grab the rest of the string
break
end
end
return result
end
local function CompareNumbersByOperator(operator, left, right)
return left and right and (
(operator == "<>" and left ~= right)
or (operator == "<=" and left <= right)
or (operator == ">=" and left >= right)
or (operator == "=" and left == right)
or (operator == "<" and left < right)
or (operator == ">" and left > right)
)
end
local function ThrowQueryError(...)
error("Error: "..string.format(...))
end
local function IsItemStatMatch(term, stats)
local filterKey = STAT_FILTERS[term.left]
if not filterKey then
return
end
local statValue = tonumber(stats[filterKey])
if not statValue then
return
end
local searchedValue = tonumber(term.right)
if not searchedValue then
ThrowQueryError("'%s' requires a numeric argument", term.left)
end
return CompareNumbersByOperator(term.relational, statValue, searchedValue)
end
local function IsItemLevelFilterMatch(term, itemLvl, itemEquipLoc)
if term.left ~= "ilvl" then
return
end
local searchedValue = tonumber(term.right);
if not searchedValue then
ThrowQueryError("ilvl search requires a numeric argument")
end
return itemLvl ~= nil and itemLvl > 0 and CompareNumbersByOperator(term.relational, itemLvl, searchedValue)
end
local function IsItemQualityMatch(term, itemQuality)
if term.left ~= "quality" then
return
end
local searchedValue = QUALITY_FILTERS[term.right]
if not searchedValue then
ThrowQueryError("unrecognized quality value \"%s\"", term.right)
end
return CompareNumbersByOperator(term.relational, itemQuality, searchedValue)
end
local function IsItemSocketMatch(term, stats)
if not SOCKET_FILTERS[term.left] then
return
end
local searchedValue = tonumber(term.right)
if not searchedValue then
ThrowQueryError("'%s' requires a numeric argument", term.left)
end
local socketCount = 0;
for _, socketType in pairs(SOCKET_TYPES) do
local statValue = tonumber(stats[socketType]);
if statValue then
socketCount = socketCount + statValue;
end
end
return CompareNumbersByOperator(term.relational, socketCount, searchedValue)
end
local function IsMinLevelFilterMatch(term, minLvl)
if term.left ~= "minlvl" then
return
end
local searchedValue = tonumber(term.right);
if not searchedValue then
ThrowQueryError("minlvl search requires a numeric argument")
end
return minLvl ~= nil and minLvl > 0 and CompareNumbersByOperator(term.relational, minLvl, searchedValue)
end
local function IsItemSlotMatch(term, itemEquipLoc)
if term.left ~= "slot" then
return
end
if term.relational ~= "=" then
ThrowQueryError("slot searches should be in the form \"slot=[slotname]\"")
end
local slot = SLOT_FILTERS[term.right]
if not slot then
ThrowQueryError("unrecognized slot name: \"%s\"", term.right)
end
return slot == itemEquipLoc
end
local function nameMatches(name, searchText)
if AtlasLoot.db.profile.PartialMatching then
return string.find(string.lower(name), searchText);
else
return string.lower(name) == searchText;
end
end
local function ItemMatchesTerm(term, itemName, stats, itemLvl, minLvl, itemQuality, itemEquipLoc)
if term.relational then
return IsItemStatMatch(term, stats)
or IsItemSocketMatch(term, stats)
or IsItemLevelFilterMatch(term, itemLvl, itemEquipLoc)
or IsMinLevelFilterMatch(term, minLvl)
or IsItemSlotMatch(term, itemEquipLoc)
or IsItemQualityMatch(term, itemQuality)
else
return nameMatches(itemName, term.name)
end
end
local function ItemMatchesAllTerms(searchTerms, itemName, stats, itemLvl, minLvl, itemQuality, itemEquipLoc)
for _, term in ipairs(searchTerms) do
if not ItemMatchesTerm(term, itemName, stats, itemLvl, minLvl, itemQuality, itemEquipLoc) then
return false
end
end
return true
end
local function ParseTerm(termText)
for _, relational in ipairs(RELATIONAL_OPERATORS) do
local operands = SplitString(termText, relational)
if #operands == 2 then
return {
left = operands[1],
right = operands[2],
relational = relational
}
end
end
return { name = termText } -- simple name search
end
-- Parse search text into '&'-delimited search terms,
-- then parse each term on its relational operator, if present.
local function ParseQuery(searchText)
local terms = {}
for i, term in pairs(SplitString(searchText, OP_AND)) do
table.insert(terms, ParseTerm(term))
end
return terms
end
local function GetItemDetails(itemId, atlasName)
-- Name, Link, Quality(num), iLvl(num), minLvl(num), itemType(localized string), itemSubType(localized string), stackCount(num), itemEquipLoc(enum), texture(link to a local file), displayId(num)
local itemName, _, itemQuality, itemLvl, minLvl, _, _, _, itemEquipLoc = GetItemInfo(itemId);
if not itemName then itemName = gsub(atlasName, "=q%d=", "") end
return itemName, itemQuality, itemLvl, minLvl, itemEquipLoc, GetItemStats("item:"..itemId)
end
local function GetSpellName(itemId, atlasName)
local spellName = GetSpellInfo(string.sub(itemId, 2));
if spellName then
return spellName
elseif (string.sub(atlasName, 1, 2) == "=d") then
return gsub(atlasName, "=ds=", "");
else
return gsub(atlasName, "=q%d=", "");
end
end
local function DoSearch(searchText)
AtlasLootCharDB["SearchResult"] = {};
AtlasLootCharDB.LastSearchedText = Text;
local function AddItemToSearchResult(itemId, itemType, itemName, dataID)
local lootPage = AtlasLoot_TableNames[dataID] and AtlasLoot_TableNames[dataID][1] or "Argh!";
table.insert(AtlasLootCharDB["SearchResult"], { 0, itemId, itemType, itemName, lootPage, "", "", dataID.."|".."\"\"", [AtlasLoot_Difficulty.DIF_SEARCH] = 2});
end
local searchTerms = ParseQuery(searchText)
local equipableFilterOn = AtlasLoot.db.profile.EquipableFilter
local function IsItemEquipableMatch(itemEquipLoc)
return not equipableFilterOn or (itemEquipLoc and itemEquipLoc ~= '' and not NON_EQUIPABLE_SLOTS[itemEquipLoc])
end
for dataID, data in pairs(AtlasLoot_Data) do
for _, v in ipairs(data) do
local _, itemId, itemType, atlasName = unpack(v)
if type(itemId) == "number" and itemId > 0 then
local itemName, itemQuality, itemLvl, minLvl, itemEquipLoc, stats = GetItemDetails(itemId, atlasName);
if IsItemEquipableMatch(itemEquipLoc) and ItemMatchesAllTerms(searchTerms, itemName, stats, itemLvl, minLvl, itemQuality, itemEquipLoc) then
AddItemToSearchResult(itemId, itemType, itemName, dataID)
end
elseif not equipableFilterOn and itemId and itemId ~= "" and string.sub(itemId, 1, 1) == "s" then
local spellName = GetSpellName(itemId, atlasName)
if nameMatches(spellName, searchText) then
spellName = string.sub(atlasName, 1, 4)..spellName;
AddItemToSearchResult(itemId, itemType, spellName, dataID)
end
end
end
end
end
function AtlasLoot:ShowSearchResult()
AtlasLoot_ShowItemsFrame("SearchResult", "SearchResultPage"..currentPage, (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame);
end
@@ -198,7 +491,7 @@ function AtlasLoot:Search(Text)
if not Text then return end
Text = strtrim(Text);
if Text == "" then return end
-- Decide if we need load all modules or just specified ones
local allDisabled = not self.db.profile.SearchOn.All;
if allDisabled then
@@ -210,7 +503,7 @@ function AtlasLoot:Search(Text)
end
end
if allDisabled then
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..AL["You don't have any module selected to search on."]);
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..AL["You don't have any module selected to search on."]);
return;
end
if self.db.profile.SearchOn.All then
@@ -222,299 +515,18 @@ function AtlasLoot:Search(Text)
end
end
end
AtlasLootCharDB["SearchResult"] = {};
AtlasLootCharDB.LastSearchedText = Text;
local text = string.lower(Text);
--[[if not self.db.profile.SearchOn.All then
local module = AtlasLoot_GetLODModule(dataSource);
if not module or self.db.profile.SearchOn[module] ~= true then return end
end]]
local function HaveBinaryOperator (textValue)
for index, operator in ipairs(BINARYOPERATORS) do
if string.find(textValue, operator) then
return operator;
end
end
return nil;
end
local function HaveOperator (textValue)
for index, operator in ipairs(OPERATORS) do
if string.find(textValue, operator) then
return operator;
end
end
return nil;
end
local function SplitString(str, delimiter)
result = {};
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
local function CompareNumbersByOperator (operator, baseValue, valueToCompare)
if baseValue ~= nil and valueToCompare ~= nil
and ((operator == "<>") and (baseValue ~= valueToCompare)
or (operator == "<=") and (baseValue <= valueToCompare)
or (operator == ">=") and (baseValue >= valueToCompare)
or (operator == "=") and (baseValue == valueToCompare)
or (operator == "<") and (baseValue < valueToCompare)
or (operator == ">") and (baseValue > valueToCompare))
then
return true;
end
return false;
end
-- Region: Stat Filter
local function IsSocketTermInSearchText(searchText)
if string.find(searchText, "socket")
or string.find(searchText, "sockets")
or string.find(searchText, "gem")
or string.find(searchText, "gems")
then
return true;
end
return false;
end
local function IsSocketTermEqualsSearchText(searchText)
if searchText == "socket"
or searchText == "sockets"
or searchText == "gem"
or searchText == "gems"
then
return true;
end
return false;
end
local function FilterSockets(searchTextItem, stats, operator)
if stats then
if IsSocketTermInSearchText(searchTextItem) then
local searchedStatValue = tonumber(string.match(searchTextItem, "%d+"));
local searchTerm = string.gsub(searchTextItem, tostring(searchedStatValue), "");
searchTerm = string.gsub(searchTerm, operator, "");
if IsSocketTermEqualsSearchText(searchTerm) then
local socketCount = 0;
for _, socketType in pairs(ITEMSOCKETSTATFILTERS) do
if socketType then
local statValue = tonumber(stats[socketType]);
if statValue then
socketCount = socketCount + statValue;
end
end
end
if CompareNumbersByOperator(operator, socketCount, searchedStatValue) then
return true;
end
end
end
end
return false;
end
local function HaveStat (textValue)
for index, statItem in pairs(STATFILTERS) do
if textValue == index then
return STATFILTERS[index];
end
end
return nil;
end
local function IsItemStatMatch(searchTextItem, stats, operator)
if stats then
local searchedStat = tonumber(string.match(searchTextItem, "%d+"));
local searchTerm = searchTextItem.gsub(searchTextItem, tostring(searchedStat), "");
searchTerm = string.gsub(searchTerm, operator, "");
local statFilterFound = HaveStat(searchTerm);
if statFilterFound then
local statValue = tonumber(stats[statFilterFound]);
if CompareNumbersByOperator(operator, statValue, searchedStat) then
return true;
end
else
return FilterSockets(searchTextItem, stats, operator);
end
end
return false;
end
-- EndRegion
-- Region: Item Level Filter
local function HaveItemInfoFilter (textValue)
for index, itemInfoFilter in pairs(ITEMINFOFILTERS) do
if textValue == index then
return index;
end
end
return nil;
end
local function IsEquipableGear (textValue)
if textValue == nil or textValue == "" then
return false;
end
for index, equipLoc in ipairs(ITEMLEVELGEAREQUIPFILTER) do
if string.find(textValue, equipLoc) then
return false;
end
end
return true;
end
local function IsItemLevelFilter (textValue)
local itemLevelFilter = ITEMINFOFILTERS["ilvl"];
if string.match(textValue, itemLevelFilter) then
return true;
end
return false;
end
local function IsItemLevelFilterMatch(searchText, itemLvl, itemEquipLoc, operator)
local searchedItemLevel = tonumber(string.match(searchText, "%d+"));
local searchTerm = searchText.gsub(searchText, tostring(searchedItemLevel), "");
searchTerm = string.gsub(searchTerm, operator, "");
local itemInfoFilter = HaveItemInfoFilter(searchTerm);
if itemInfoFilter and itemLvl ~= nil and itemLvl > 0
--TODO Equipment filter patch
--and IsEquipableGear(itemEquipLoc)
and IsItemLevelFilter(itemInfoFilter)
then
if CompareNumbersByOperator(operator, itemLvl, searchedItemLevel) then
return true;
end
end
return false;
end
-- EndRegion
-- Add item to Search Result
local function AddItemToSearchResult(itemId, itemType, itemName, lootPage, dataId)
table.insert(AtlasLootCharDB["SearchResult"], { 0, itemId, itemType, itemName, lootPage, "", "", dataId.."|".."\"\"" });
end
-- Checks for Partial Matching
local partial = self.db.profile.PartialMatching;
-- Checks for Item Filters by searching for an Operator in the search text
local operator = HaveOperator(text);
for dataID, data in pairs(AtlasLoot_Data) do
for _, v in ipairs(data) do
if type(v[2]) == "number" and v[2] > 0 then
-- Name, Link, Quality(num), iLvl(num), minLvl(num), itemType(localized string), itemSubType(localized string), stackCount(num), itemEquipLoc(enum), texture(link to a local file), displayId(num)
local itemName, _, itemQuality, itemLvl, minLvl, _, _, _, itemEquipLoc = GetItemInfo(v[2]);
if not itemName then itemName = gsub(v[4], "=q%d=", "") end
local success, message = pcall(DoSearch, Text)
if operator ~= nil then
local stats = GetItemStats("item:"..tostring(v[2]));
-- Currently only supports "&"
local binaryOperator = HaveBinaryOperator(text);
if binaryOperator ~= nil then
local searchConditionsMet = true;
local searchItems = SplitString(text, binaryOperator);
if searchItems then
for _, searchTextItem in ipairs(searchItems) do
local localOperator = HaveOperator(searchTextItem);
if not localOperator
or not (
-- Stat Filter
IsItemStatMatch(searchTextItem, stats, localOperator)
-- Item Level Filter
or IsItemLevelFilterMatch(searchTextItem, itemLvl, itemEquipLoc, localOperator)
)
then
searchConditionsMet = false;
break;
end
end
if searchConditionsMet then
AddItemToSearchResult(v[2], v[3], itemName, lootpage, dataID);
end
end
else
-- Stat Filter
if IsItemStatMatch(text, stats, operator)
-- Item Level Filter
or IsItemLevelFilterMatch(text, itemLvl, itemEquipLoc, operator)
then
AddItemToSearchResult(v[2], v[3], itemName, lootpage, dataID);
end
-- TODO itemQuality
-- TODO minLvl
-- TODO itemEquipLoc
end
-- Stat Table Cleanup
if stats then
table.wipe(stats);
end
end
local found;
if partial then
local res = SplitString(text, " ");
for _, t in ipairs(res) do
found = string.find(string.lower(itemName), t);
if not found then
break;
end
end
else
found = string.lower(itemName) == text;
end
if found then
local _, _, quality = string.find(v[4], "=q(%d)=");
if quality then itemName = "=q"..quality.."="..itemName end
if AtlasLoot_TableNames[dataID] then lootpage = AtlasLoot_TableNames[dataID][1]; else lootpage = "Argh!"; end
table.insert(AtlasLootCharDB["SearchResult"], { 0, v[2], v[3], itemName, lootpage, "", "", dataID.."|".."\"\"" });
end
elseif (v[2] ~= nil) and (v[2] ~= "") and (string.sub(v[2], 1, 1) == "s") then
local spellName = GetSpellInfo(string.sub(v[2], 2));
if not spellName then
if (string.sub(v[4], 1, 2) == "=d") then
spellName = gsub(v[4], "=ds=", "");
else
spellName = gsub(v[4], "=q%d=", "");
end
end
local found;
if partial then
found = string.find(string.lower(spellName), text);
else
found = string.lower(spellName) == text;
end
if found then
spellName = string.sub(v[4], 1, 4)..spellName;
if AtlasLoot_TableNames[dataID][1] then lootpage = AtlasLoot_TableNames[dataID][1]; else lootpage = "Argh!"; end
table.insert(AtlasLootCharDB["SearchResult"], { 0, v[2], v[3], spellName, lootpage, "", "", dataID.."|".."\"\"" });
end
end
end
end
if #AtlasLootCharDB["SearchResult"] == 0 then
if not success then
message = message:match("[^:]+: (.*)") or message -- strip stack location
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..message);
elseif #AtlasLootCharDB["SearchResult"] == 0 then
local itemFilterErrorMessage = "";
if operator then
itemFilterErrorMessage = [[
Please check if you have a typo in the filter.
To check filter keys, type "/atlaslootfilterkeys".
To check filter examples, type "/atlaslootfilterexample".
For help, type "/atlasloothelp".
You might also have to query the server for item informations to load them into your client's Cache.]];
end
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..AL["No match found for"].." \""..Text.."\"."..itemFilterErrorMessage);
@@ -577,6 +589,13 @@ function AtlasLoot:ShowSearchOptions(button)
"tooltipText", AL["If checked, AtlasLoot search item names for a partial match."],
"func", function() self.db.profile.PartialMatching = not self.db.profile.PartialMatching end
);
dewdrop:AddLine(
"text", "Only search equipable", -- TODO: put in AL
"checked", self.db.profile.EquipableFilter,
"tooltipTitle", "Equipable filter", -- TODO: put in AL
"tooltipText", "If checked, AtlasLoot only includes items that are euipable.", -- TODO: put in AL
"func", function() self.db.profile.EquipableFilter = not self.db.profile.EquipableFilter end
);
end;
dewdrop:Open(button,
'point', function(parent)
@@ -589,8 +608,8 @@ end
function AtlasLoot:GetOriginalDataFromSearchResult(itemID)
for i, v in ipairs(AtlasLootCharDB["SearchResult"]) do
if v[2] == itemID then
AtlasLoot_ShowWishListDropDown(v[2], v[3], v[4], v[5], v[8], this, nil, v[AtlasLoot_Difficulty.DIF_SEARCH]);
if v[2] == itemID then
AtlasLoot_ShowWishListDropDown(v[2], v[3], v[4], v[5], v[8], this, nil, v[AtlasLoot_Difficulty.DIF_SEARCH]);
end
end
end
+153 -585
View File
@@ -26,6 +26,13 @@ local BLUE = "|cff0070dd";
local ORANGE = "|cffFF8400";
local DEFAULT = "|cffFFd200";
AdvSearchSubMenuEnabled = 0;
AdvSearchSubMenuText = "";
AdvSearchSubMenu2Enabled = 0;
AdvSearchSubMenuText = "";
AdvSearchSetup = false;
AtlasLoot_FrameMenuList = {
["EquipSubMenu"] = {AtlasLoot_EquipSubMenu, "AtlasLootAdvancedSearch_EquipSub", "Select Option", "equipType", "", "AtlasLootAdvancedSearch_WeaponSub"};
["MythicSubMenu"] = {AtlasLoot_DiffSubMenu, "AtlasLootAdvancedSearch_MythicSub", "Mythic+ 1", "difficulty", 5};
@@ -48,121 +55,124 @@ AtlasLoot_AdvancedSearchMenus = {
},
[5] = {
{"Bloodforged", "difficulty", 1, "MythicSubMenu", "Disable"},
},
},
};
["MythicPlus"] = {
};
["Quality"] = {
["Quality"] = {
[1] = {
{AtlasLoot_FixText("=q0=").."Poor", "quality", "=q0="},
},
{AtlasLoot_FixText("=q0=").."Poor", "quality", "poor"},
},
[2] = {
{AtlasLoot_FixText("=q1=").."Normal", "quality", "=q1="},
},
{AtlasLoot_FixText("=q1=").."Normal", "quality", "normal"},
},
[3] = {
{AtlasLoot_FixText("=q2=").."Uncommon", "quality", "=q2="},
},
{AtlasLoot_FixText("=q2=").."Uncommon", "quality", "uncommon"},
},
[4] = {
{AtlasLoot_FixText("=q3=").."Rare", "quality", "=q3="},
},
{AtlasLoot_FixText("=q3=").."Rare", "quality", "rare"},
},
[5] = {
{AtlasLoot_FixText("=q4=").."Epic", "quality", "=q4="},
},
{AtlasLoot_FixText("=q4=").."Epic", "quality", "epic"},
},
[6] = {
{AtlasLoot_FixText("=q5=").."Legendary", "quality", "=q5="},
},
{AtlasLoot_FixText("=q5=").."Legendary", "quality", "legendary"},
},
};
["Equip"] = {
["Equip"] = {
[1] = {
{"Head", "equip", "#s1#", "EquipSubMenu", "ArmorType"},
},
{"Head", "equip", "head", "EquipSubMenu", "ArmorType"},
},
[2] = {
{"Shoulder", "equip", "#s3#", "EquipSubMenu", "ArmorType"},
},
{"Shoulder", "equip", "shoulder", "EquipSubMenu", "ArmorType"},
},
[3] = {
{"Chest", "equip", "#s5#", "EquipSubMenu", "ArmorType"},
},
{"Chest", "equip", "chest", "EquipSubMenu", "ArmorType"},
},
[4] = {
{"Wrist", "equip", "#s8#", "EquipSubMenu", "ArmorType"},
},
{"Wrist", "equip", "wrist", "EquipSubMenu", "ArmorType"},
},
[5] = {
{"Hands", "equip", "#s9#", "EquipSubMenu", "ArmorType"},
},
{"Hands", "equip", "hands", "EquipSubMenu", "ArmorType"},
},
[6] = {
{"Waist", "equip", "#s10#", "EquipSubMenu", "ArmorType"},
},
{"Waist", "equip", "waist", "EquipSubMenu", "ArmorType"},
},
[7] = {
{"Legs", "equip", "#s11#", "EquipSubMenu", "ArmorType"},
{"Legs", "equip", "legs", "EquipSubMenu", "ArmorType"},
},
[8] = {
{"Feet", "equip", "#s12#", "EquipSubMenu", "ArmorType"},
{"Feet", "equip", "feet", "EquipSubMenu", "ArmorType"},
},
[9] = {
{"Back", "equip", "#s4#", "EquipSubMenu", "Disable"},
{"Back", "equip", "back", "EquipSubMenu", "Disable"},
},
[10] = {
{"Necklace", "equip", "#s2#", "EquipSubMenu", "Disable"},
{"Necklace", "equip", "neck", "EquipSubMenu", "Disable"},
},
[11] = {
{"Ring", "equip", "#s13#", "EquipSubMenu", "Disable"},
{"Ring", "equip", "ring", "EquipSubMenu", "Disable"},
},
[12] = {
{"Trinket", "equip", "#s14#", "EquipSubMenu", "Disable"},
{"Trinket", "equip", "trinket", "EquipSubMenu", "Disable"},
},
[13] = {
{"Weapon/Shield", "equip", "#w", "EquipSubMenu", "WeaponEquip"},
{"Weapon/Shield", "equip", "#w", "EquipSubMenu", "WeaponEquip"},
},
[14] = {
{"Relic", "equip", "#s16#", "EquipSubMenu", "RelicType"},
[14] = {
{"Held in Off-Hand", "equip", "holdable", "EquipSubMenu", "Disable"},
},
[15] = {
{"Relic", "equip", "relic", "EquipSubMenu", "RelicType"},
},
};
["ArmorType"] = {
[1] = {
{"Cloth", "equipType", "#a1#"},
},
{"Cloth", "equipType", "cloth"},
},
[2] = {
{"Leather", "equipType", "#a2#"},
},
{"Leather", "equipType", "leather"},
},
[3] = {
{"Mail", "equipType", "#a3#"},
},
{"Mail", "equipType", "mail"},
},
[4] = {
{"Plate", "equipType", "#a4#"},
{"Plate", "equipType", "plate"},
},
};
["RelicType"] = {
[1] = {
{"Idols", "equipType", "#w14#"},
},
{"Idols", "equipType", "idol"},
},
[2] = {
{"Libram", "equipType", "#w16#"},
},
{"Libram", "equipType", "libram"},
},
[3] = {
{"Totem", "equipType", "#w15#"},
},
{"Totem", "equipType", "totem"},
},
[4] = {
{"Sigil", "equipType", "#w21#"},
{"Sigil", "equipType", "sigil"},
},
};
["WeaponEquip"] = {
[1] = {
{"One-Hand", "equip", "#h1#", "WeaponSubMenu", "WeaponType"},
},
{"One-Hand", "equip", "weapon", "WeaponSubMenu", "WeaponType"},
},
[2] = {
{"Two-Hand", "equip", "#h2#", "WeaponSubMenu", "WeaponType"},
},
{"Two-Hand", "equip", "2hweapon", "WeaponSubMenu", "WeaponType"},
},
[3] = {
{"Main Hand", "equip", "#h3#", "WeaponSubMenu", "WeaponType"},
},
{"Main Hand", "equip", "mainhand", "WeaponSubMenu", "WeaponType"},
},
[4] = {
{"Off Hand", "equip", "#h4#", "WeaponSubMenu", "WeaponType"},
{"Off Hand", "equip", "offhand", "WeaponSubMenu", "WeaponType"},
},
[5] = {
{"Ranged", "equip", "ranged", "WeaponSubMenu", "WeaponType"},
@@ -208,7 +218,7 @@ AtlasLoot_AdvancedSearchMenus = {
},
[13] = {
{"Shield", "equipType", "#w8#"}
},
},
};
}
@@ -302,12 +312,6 @@ AtlasLoot_AdvancedSearchArguments = {
}
}
local findByQuality = false;
local findByEquip = false;
local findByEquipType = false;
local findByName = false;
local findByDifficulty = false;
AdvancedSearchOptions = {
["quality"] = "",
["equip"] = "",
@@ -321,26 +325,8 @@ AdvancedSearchOptions = {
["arg3op"] = "",
}
local AtlasLoot_AdvancedSearchQuality = {
["=q0="] = "Poor",
["=q1="] = "Common",
["=q2="] = "Uncoom",
["=q3="] = "Rare",
["=q4="] = "Epic",
["=q5="] = "Legendary",
["=q6="] = "Artifact",
["=q7="] = "Heirloom"
};
function AtlasLoot_AdvancedSearchShow()
if (AtlasLootAdvancedSearch:IsVisible()) then
AtlasLoot_AdvancedSearchClose();
return;
end
pFrame = { "TOPLEFT", "AtlasLootDefaultFrame_LootBackground", "TOPLEFT", "2", "-2" };
AtlasLoot_AdvancedSearchRegister(AtlasLoot_QualityMenu, AtlasLootAdvancedSearch_Quality, AtlasLoot_AdvancedSearchMenus["Quality"]);
function AtlasLoot_AdvancedSearchSetup()
AtlasLoot_AdvancedSearchRegister(AtlasLoot_QualityMenu, AtlasLootAdvancedSearch_Quality, AtlasLoot_AdvancedSearchMenus["Quality"]);
AtlasLoot_AdvancedSearchRegister(AtlasLoot_EquipMenu, AtlasLootAdvancedSearch_Equip, AtlasLoot_AdvancedSearchMenus["Equip"]);
AtlasLoot_AdvancedSearchRegister(AtlasLoot_DifficultyMenu, AtlasLootAdvancedSearch_Difficulty, AtlasLoot_AdvancedSearchMenus["Difficulty"]);
@@ -352,24 +338,52 @@ function AtlasLoot_AdvancedSearchShow()
AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_Argument2SubMenu, AtlasLootAdvancedSearch_Argument2Sub, "2", AtlasLoot_AdvancedSearchArguments["Operators"]);
AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_Argument3SubMenu, AtlasLootAdvancedSearch_Argument3Sub, "3", AtlasLoot_AdvancedSearchArguments["Operators"]);
--Setup Mythic+ dropdown options;
for i = 1, 30, 1 do
AtlasLoot_AdvancedSearchMenus["MythicPlus"][i] = {
{"Mythic+ "..i, "difficulty", i + 4};
}
end
AdvSearchSetup = true;
end
function AtlasLoot_AdvancedSearchShow()
if (AtlasLootAdvancedSearch:IsVisible()) then
AtlasLoot_AdvancedSearchClose();
return;
end
pFrame = { "TOPLEFT", "AtlasLootDefaultFrame_LootBackground", "TOPLEFT", "2", "-2" };
if not (AdvSearchSetup) then AtlasLoot_AdvancedSearchSetup() end
--Hide all elements that could be in the AtlasTable
getglobal("AtlasLootItemsFrame_NEXT"):Hide();
getglobal("AtlasLootItemsFrame_PREV"):Hide();
getglobal("AtlasLootItemsFrame_BACK"):Hide();
AtlasLootDefaultFrame_SubMenu2:Disable();
AtlasLootDefaultFrame_SelectedTable2:SetText("");
AtlasLootDefaultFrame_SelectedTable2:Hide();
if AtlasLootDefaultFrame_SubMenu2:IsEnabled() then
AdvSearchSubMenu2Enabled = 1;
AdvSearchSubMenu2Text = AtlasLootDefaultFrame_SelectedTable2:GetText();
AtlasLootDefaultFrame_SubMenu2:Disable();
AtlasLootDefaultFrame_SelectedTable2:SetText("");
AtlasLootDefaultFrame_SelectedTable2:Hide();
end
AtlasLootDefaultFrame_SubMenu:Disable();
AtlasLootDefaultFrame_SelectedTable:SetText("");
if AtlasLootDefaultFrame_SubMenu:IsEnabled() then
AdvSearchSubMenuEnabled = 1;
AdvSearchSubMenuText = AtlasLootDefaultFrame_SelectedTable:GetText();
AtlasLootDefaultFrame_SubMenu:Disable();
AtlasLootDefaultFrame_SelectedTable:SetText("");
end
AtlasLootServerQueryButton:Hide();
--Ditch the Quicklook selector
AtlasLoot_QuickLooks:Hide();
AtlasLootQuickLooksButton:Hide();
-- Hide the Filter Check-Box
AtlasLootFilterCheck:Hide();
@@ -381,13 +395,6 @@ function AtlasLoot_AdvancedSearchShow()
getglobal("AtlasLootItem_"..i).spellitemID = 0;
end
--Setup Mythic+ dropdown options;
for i = 1, 20, 1 do
AtlasLoot_AdvancedSearchMenus["MythicPlus"][i] = {
{"Mythic+ "..i, "difficulty", i + 4};
}
end
--Reset Search options
AtlasLoot_AdvancedSearchReset();
@@ -400,8 +407,29 @@ function AtlasLoot_AdvancedSearchShow()
AtlasLootAdvancedSearch:Show();
end
function AtlasLoot_AdvancedSearchClose()
AtlasLootAdvancedSearch:Hide();
AtlasLootServerQueryButton:Show();
if AdvSearchSubMenu2Enabled then
AtlasLootDefaultFrame_SubMenu2:Enable();
AtlasLootDefaultFrame_SelectedTable2:SetText(AdvSearchSubMenu2Text);
end
if AdvSearchSubMenuEnabled then
AtlasLootDefaultFrame_SubMenu:Enable();
AtlasLootDefaultFrame_SelectedTable:SetText(AdvSearchSubMenuText);
end
AdvSearchSubMenuEnabled = 0;
AdvSearchSubMenu2Enabled = 0;
if (SearchPrevData[1] ~= "") then
AtlasLoot_ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3], SearchPrevData[4]);
end
end
function AtlasLoot_AdvancedSearchReset()
AdvancedSearchOptions = { }
AdvancedSearchOptions = {
["quality"] = "",
["equip"] = "",
@@ -415,14 +443,9 @@ function AtlasLoot_AdvancedSearchReset()
["arg3op"] = "",
}
findByQuality = false;
findByEquip = false;
findByEquipType = false;
findByName = false;
findByDifficulty = false;
AtlasLootAdvancedSearch_Quality:SetText("Select Quality");
AtlasLootAdvancedSearch_Equip:SetText("Select Item Type");
AtlasLootAdvancedSearch_Difficulty:Disable();
AtlasLootAdvancedSearch_Difficulty:SetText("Select Difficulty");
AtlasLootAdvancedSearch_Argument1:SetText("Select Option");
AtlasLootAdvancedSearch_Argument2:SetText("Select Option");
@@ -449,14 +472,7 @@ function AtlasLoot_AdvancedSearchReset()
AtlasLootAdvancedSearch_Argument3Value:SetText("");
end
function AtlasLoot_AdvancedSearchClose()
AtlasLootAdvancedSearch:Hide();
AtlasLootServerQueryButton:Show();
if (SearchPrevData[1] ~= "") then
AtlasLoot_ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3], SearchPrevData[4]);
end
end
function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, ChildMenu, ChildMenuRegister)
--Setups child menus and sets search options to default
@@ -468,7 +484,7 @@ function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue,
if(AtlasLoot_FrameMenuList[ChildMenu][6]) then
getglobal(AtlasLoot_FrameMenuList[ChildMenu][6]):Disable();
end
else
else
AtlasLoot_AdvancedSearchRegister(AtlasLoot_FrameMenuList[ChildMenu][1], getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]), AtlasLoot_AdvancedSearchMenus[ChildMenuRegister]);
AdvancedSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5];
getglobal(AtlasLoot_FrameMenuList[ChildMenu][2]):Enable();
@@ -569,18 +585,18 @@ function AtlasLoot_AdvancedSearchArgumentClick(Object, VariableToSet, VariableVa
getglobal("AtlasLootAdvancedSearch_Argument"..VariableToSet.."Value"):Hide();
AdvancedSearchOptions["arg"..VariableToSet] = "";
AdvancedSearchOptions["arg"..VariableToSet.."op"] = "";
AdvancedSearchOptions["arg"..VariableToSet.."op"] = "";
Object[1]:SetText("Select Option");
Object[2]:Close();
else
getglobal("AtlasLootAdvancedSearch_Argument"..VariableToSet.."Sub"):SetText("Select Option");
getglobal("AtlasLootAdvancedSearch_Argument"..VariableToSet.."Sub"):Enable();
AdvancedSearchOptions["arg"..VariableToSet.."op"] = "";
AdvancedSearchOptions["arg"..VariableToSet.."op"] = "";
getglobal("AtlasLootAdvancedSearch_Argument"..VariableToSet.."Value"):SetText("");
getglobal("AtlasLootAdvancedSearch_Argument"..VariableToSet.."Value"):Hide();
AdvancedSearchOptions["arg"..VariableToSet] = VariableValue;
Object[1]:SetText(Object[3]);
Object[2]:Close();
@@ -720,490 +736,42 @@ function AtlasLoot_AdvancedSearchArgumentRegister(DropDown, DropDownObject, Argu
)
end
function AtlasLoot:AdvancedSearch(Text, arg1, arg2, arg3)
function AtlasLoot:AdvancedSearch(Text, args)
if not Text then return end
Text = strtrim(Text);
if Text == "" then findByName = false else findByName = true end
local searchTitleString = Text
local dif = 2;
local advSearchString = Text or "";
if AdvancedSearchOptions["difficulty"] ~= 0 then
findByDifficulty = true;
dif = AdvancedSearchOptions["difficulty"]
searchTitleString = searchTitleString.." "..WHITE..AtlasLoot_Difficulty.Search[dif];
end
local function AppendSearchString(toAppend, str)
if toAppend ~= "" then
toAppend = toAppend.."&"..str;
return toAppend;
end
return str;
end
if AdvancedSearchOptions["quality"] ~= "" then
findByQuality = true;
searchTitleString = searchTitleString.." "..AtlasLoot_FixText(AdvancedSearchOptions["quality"])..AtlasLoot_AdvancedSearchQuality[AdvancedSearchOptions["quality"]];
advSearchString = AppendSearchString(advSearchString, "quality="..AdvancedSearchOptions["quality"]);
end
if AdvancedSearchOptions["equipType"] ~= "" then
findByEquipType = true;
searchTitleString = searchTitleString.." "..WHITE..AtlasLoot_FixText(AdvancedSearchOptions["equipType"]);
--advSearchString = AppendSearchString(advSearchString, AtlasLoot_FixText(AdvancedSearchOptions["equipType"]));
end
if AdvancedSearchOptions["equip"] ~= "" then
findByEquip = true;
searchTitleString = searchTitleString.." "..WHITE..AtlasLoot_FixText(AdvancedSearchOptions["equip"]);
advSearchString = AppendSearchString(advSearchString, "slot="..AdvancedSearchOptions["equip"]);
end
local advSearchString = "";
if AdvancedSearchOptions["arg1"] ~= "" and AdvancedSearchOptions["arg1op"] == "" then
AdvancedSearchOptions["arg1op"] = ">"
arg1 = "0";
end
if AdvancedSearchOptions["arg2"] ~= "" and AdvancedSearchOptions["arg2op"] == "" then
AdvancedSearchOptions["arg2op"] = ">"
arg2 = "0";
end
if AdvancedSearchOptions["arg3"] ~= "" and AdvancedSearchOptions["arg3op"] == "" then
AdvancedSearchOptions["arg3op"] = ">"
arg3 = "0";
end
if AdvancedSearchOptions["arg1"] ~= "" and AdvancedSearchOptions["arg1op"] ~= "" and arg1 ~= "" then
advSearchString = advSearchString..AdvancedSearchOptions["arg1"]..AdvancedSearchOptions["arg1op"]..arg1;
searchTitleString = searchTitleString.." "..AdvancedSearchOptions["arg1"].." "..AdvancedSearchOptions["arg1op"].." "..arg1;
end
if AdvancedSearchOptions["arg2"] ~= "" and AdvancedSearchOptions["arg2op"] ~= "" and arg2 ~= "" then
if advSearchString == "" then
advSearchString = advSearchString..AdvancedSearchOptions["arg2"]..AdvancedSearchOptions["arg2op"]..arg2;
searchTitleString = searchTitleString.." "..AdvancedSearchOptions["arg2"].." "..AdvancedSearchOptions["arg2op"].." "..arg2;
else
advSearchString = advSearchString.."&"..AdvancedSearchOptions["arg2"]..AdvancedSearchOptions["arg2op"]..arg2;
searchTitleString = searchTitleString.." & "..AdvancedSearchOptions["arg2"].." "..AdvancedSearchOptions["arg2op"].." "..arg2;
end
end
if AdvancedSearchOptions["arg3"] ~= "" and AdvancedSearchOptions["arg3op"] ~= "" and arg3 ~= "" then
if advSearchString == "" then
advSearchString = advSearchString..AdvancedSearchOptions["arg3"]..AdvancedSearchOptions["arg3op"]..arg3;
searchTitleString = searchTitleString.." "..AdvancedSearchOptions["arg3"].." "..AdvancedSearchOptions["arg3op"].." "..arg3
else
advSearchString = advSearchString.."&"..AdvancedSearchOptions["arg3"]..AdvancedSearchOptions["arg3op"]..arg3;
searchTitleString = searchTitleString.." & "..AdvancedSearchOptions["arg3"].." "..AdvancedSearchOptions["arg3op"].." "..arg3
end
end
advSearchString = string.lower(advSearchString);
-- Decide if we need load all modules or just specified ones
local allDisabled = not self.db.profile.SearchOn.All;
if allDisabled then
for _, module in ipairs(modules) do
if self.db.profile.SearchOn[module] == true then
allDisabled = false;
break;
for i = 1, 3, 1 do
if AdvancedSearchOptions["arg"..i] ~= "" then
if AdvancedSearchOptions["arg"..i.."op"] == "" then
AdvancedSearchOptions["arg"..i.."op"] = ">"
args[i] = "0";
print(args[i]);
end
advSearchString = AppendSearchString(advSearchString, AdvancedSearchOptions["arg"..i]..AdvancedSearchOptions["arg"..i.."op"]..args[i]);
end
end
if allDisabled then
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..AL["You don't have any module selected to search on."]);
return;
end
if self.db.profile.SearchOn.All then
AtlasLoot_LoadAllModules();
else
for k, v in pairs(self.db.profile.SearchOn) do
if k ~= "All" and v == true and not IsAddOnLoaded(k) and LoadAddOn(k) and self.db.profile.LoDNotify then
DEFAULT_CHAT_FRAME:AddMessage(GREEN..AL["AtlasLoot"]..": "..ORANGE..k..WHITE.." "..AL["sucessfully loaded."]);
end
end
end
AtlasLootCharDB["SearchResult"] = {};
AtlasLootCharDB.LastSearchedText = searchTitleString;
local text = string.lower(Text);
--[[if not self.db.profile.SearchOn.All then
local module = AtlasLoot_GetLODModule(dataSource);
if not module or self.db.profile.SearchOn[module] ~= true then return end
end]]
local function HaveBinaryOperator (textValue)
for index, operator in ipairs(BINARYOPERATORS) do
if string.find(textValue, operator) then
return operator;
end
end
return nil;
end
local function HaveOperator (textValue)
for index, operator in ipairs(OPERATORS) do
if string.find(textValue, operator) then
return operator;
end
end
return nil;
end
local function SplitString(str, delimiter)
local result = {};
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
local function CompareNumbersByOperator (operator, baseValue, valueToCompare)
if baseValue ~= nil and valueToCompare ~= nil
and ((operator == "<>") and (baseValue ~= valueToCompare)
or (operator == "<=") and (baseValue <= valueToCompare)
or (operator == ">=") and (baseValue >= valueToCompare)
or (operator == "=") and (baseValue == valueToCompare)
or (operator == "<") and (baseValue < valueToCompare)
or (operator == ">") and (baseValue > valueToCompare))
then
return true;
end
return false;
end
-- Region: Stat Filter
local function IsSocketTermInSearchText(searchText)
if string.find(searchText, "socket")
or string.find(searchText, "sockets")
or string.find(searchText, "gem")
or string.find(searchText, "gems")
then
return true;
end
return false;
end
local function IsSocketTermEqualsSearchText(searchText)
if searchText == "socket"
or searchText == "sockets"
or searchText == "gem"
or searchText == "gems"
then
return true;
end
return false;
end
local function FilterSockets(searchTextItem, stats, operator)
if stats then
if IsSocketTermInSearchText(searchTextItem) then
local searchedStatValue = tonumber(string.match(searchTextItem, "%d+"));
local searchTerm = string.gsub(searchTextItem, tostring(searchedStatValue), "");
searchTerm = string.gsub(searchTerm, operator, "");
if IsSocketTermEqualsSearchText(searchTerm) then
local socketCount = 0;
for _, socketType in pairs(ITEMSOCKETSTATFILTERS) do
if socketType then
local statValue = tonumber(stats[socketType]);
if statValue then
socketCount = socketCount + statValue;
end
end
end
if CompareNumbersByOperator(operator, socketCount, searchedStatValue) then
return true;
end
end
end
end
return false;
end
local function HaveStat (textValue)
for index, statItem in pairs(STATFILTERS) do
if textValue == index then
return STATFILTERS[index];
end
end
return nil;
end
local function IsItemStatMatch(searchTextItem, stats, operator)
if stats then
local searchedStat = tonumber(string.match(searchTextItem, "%d+"));
local searchTerm = searchTextItem.gsub(searchTextItem, tostring(searchedStat), "");
searchTerm = string.gsub(searchTerm, operator, "");
local statFilterFound = HaveStat(searchTerm);
if statFilterFound then
local statValue = tonumber(stats[statFilterFound]);
if CompareNumbersByOperator(operator, statValue, searchedStat) then
return true;
end
else
return FilterSockets(searchTextItem, stats, operator);
end
end
return false;
end
-- EndRegion
-- Region: Item Level Filter
local function HaveItemInfoFilter (textValue)
for index, itemInfoFilter in pairs(ITEMINFOFILTERS) do
if textValue == index then
return index;
end
end
return nil;
end
local function IsEquipableGear (textValue)
if textValue == nil or textValue == "" then
return false;
end
for index, equipLoc in ipairs(ITEMLEVELGEAREQUIPFILTER) do
if string.find(textValue, equipLoc) then
return false;
end
end
return true;
end
local function IsItemLevelFilter (textValue)
local itemLevelFilter = ITEMINFOFILTERS["ilvl"];
if string.match(textValue, itemLevelFilter) then
return true;
end
return false;
end
local function IsItemLevelFilterMatch(searchText, itemLvl, itemEquipLoc, operator)
local searchedItemLevel = tonumber(string.match(searchText, "%d+"));
local searchTerm = searchText.gsub(searchText, tostring(searchedItemLevel), "");
searchTerm = string.gsub(searchTerm, operator, "");
local itemInfoFilter = HaveItemInfoFilter(searchTerm);
if itemInfoFilter and itemLvl ~= nil and itemLvl > 0
--TODO Equipment filter patch
--and IsEquipableGear(itemEquipLoc)
and IsItemLevelFilter(itemInfoFilter)
then
if CompareNumbersByOperator(operator, itemLvl, searchedItemLevel) then
return true;
end
end
return false;
end
local function IsMinLevelFilter (textValue)
local itemLevelFilter = ITEMINFOFILTERS["minlvl"];
if string.match(textValue, itemLevelFilter) then
return true;
end
return false;
end
local function IsMinLevelFilterMatch(searchText, minLvl, operator)
local searchedMinLevel = tonumber(string.match(searchText, "%d+"));
local searchTerm = searchText.gsub(searchText, tostring(searchedMinLevel), "");
searchTerm = string.gsub(searchTerm, operator, "");
local itemInfoFilter = HaveItemInfoFilter(searchTerm);
if itemInfoFilter and minLvl ~= nil and minLvl > 0
and IsMinLevelFilter(itemInfoFilter)
then
if CompareNumbersByOperator(operator, minLvl, searchedMinLevel) then
return true;
end
end
return false;
end
-- EndRegion
-- Checks for Partial Matching
local partial = self.db.profile.PartialMatching;
-- Checks for Item Filters by searching for an Operator in the search text
local operator = HaveOperator(advSearchString);
for dataID, data in pairs(AtlasLoot_Data) do
for _, v in ipairs(data) do
local _id;
local found = true;
local dup = "";
if v[AtlasLoot_Difficulty.DUPLICATE] then
dup = " "..v[AtlasLoot_Difficulty.DUPLICATE]
end
if findByDifficulty then
_id = AL_FindId(string.sub(v[4]..dup, 5), dif);
if _id == nil then found = false; end
else
_id = v[2];
end
if _id ~= nil and type(_id) == "number" and _id > 0 then
-- Name, Link, Quality(num), iLvl(num), minLvl(num), itemType(localized string), itemSubType(localized string), stackCount(num), itemEquipLoc(enum), texture(link to a local file), displayId(num)
local itemName, _, itemQuality, itemLvl, minLvl, _, _, _, itemEquipLoc, tex = GetItemInfo(_id);
if GetItemIcon(_id) == nil then
found = false;
end
if(dif > 4 and (data.Type ~= "ClassicDungeonExt" --[[or data.Type ~= "BCDungeon"]])) then
found = false;
end
itemName = string.sub(v[4], 5)
local quality = string.sub(v[4], 3, -(string.len(v[4]) - 2));
if dif > 2 and tonumber(quality) then
if tonumber(quality) < 4 then
quality = 4;
end
end
if findByQuality then
if not (AdvancedSearchOptions["quality"] == "=q"..quality.."=") then
found = false;
end
end
--v[5] contains equip data
if findByEquip then
if v[5] then
if string.find(v[5], AdvancedSearchOptions["equip"]) then
if findByEquipType then
if not (string.find(v[5], AdvancedSearchOptions["equipType"])) then
found = false;
end
end
else
found = false
end
else
found = false;
end
end
if operator ~= nil and found then
local stats = GetItemStats("item:"..tostring(_id));
-- Currently only supports "&"
local binaryOperator = HaveBinaryOperator(advSearchString);
if binaryOperator ~= nil then
local searchConditionsMet = true;
local searchItems = SplitString(advSearchString, binaryOperator);
if searchItems then
for _, searchTextItem in ipairs(searchItems) do
local localOperator = HaveOperator(searchTextItem);
if not localOperator
or not (
-- Stat Filter
IsItemStatMatch(searchTextItem, stats, localOperator)
-- Item Level Filter
or IsItemLevelFilterMatch(searchTextItem, itemLvl, itemEquipLoc, localOperator)
-- Min Level Filter
or IsMinLevelFilterMatch(searchTextItem, minLvl, localOperator)
)
then
searchConditionsMet = false;
break;
end
end
if not (searchConditionsMet) then
found = false;
end
end
else
-- Stat Filter
if not (IsItemStatMatch(advSearchString, stats, operator)
-- Item Level Filter
or IsItemLevelFilterMatch(advSearchString, itemLvl, itemEquipLoc, operator)
-- Min Level Filter
or IsMinLevelFilterMatch(advSearchString, minLvl, operator))
then
found = false;
end
end
-- Stat Table Cleanup
if stats then
table.wipe(stats);
end
end
if findByName and found then
if partial then
local res = SplitString(text, " ");
for _, t in ipairs(res) do
found = string.find(string.lower(itemName), t);
if not found then
break;
end
end
else
found = string.lower(itemName) == text;
end
end
if found then
local difficultyName = AtlasLoot_Difficulty.Search[dif];
local tempdif = dif
if dif == 4 and data.Type then
if string.find(data.Type, "Raid") then
difficultyName = "Ascended";
tempdif = 99;
end
end
itemName = "=q"..quality.."="..itemName
if AtlasLoot_TableNames[dataID] then lootpage = AtlasLoot_TableNames[dataID][1]; else lootpage = "Argh!"; end
table.insert(AtlasLootCharDB["SearchResult"], { 0, _id, v[3], itemName, lootpage.." ("..GREEN..difficultyName..DEFAULT..")", "", "", dataID.."|".."\"\"", [AtlasLoot_Difficulty.DUPLICATE] = dup, [AtlasLoot_Difficulty.DIF_SEARCH] = tempdif});
end
--[[elseif (v[2] ~= nil) and (v[2] ~= "") and (string.sub(v[2], 1, 1) == "s") then
local spellName = GetSpellInfo(string.sub(v[2], 2));
if not spellName then
if (string.sub(v[4], 1, 2) == "=d") then
spellName = gsub(v[4], "=ds=", "");
else
spellName = gsub(v[4], "=q%d=", "");
end
end
local found;
if partial then
found = string.find(string.lower(spellName), text);
else
found = string.lower(spellName) == text;
end
if found then
spellName = string.sub(v[4], 1, 4)..spellName;
if AtlasLoot_TableNames[dataID][1] then lootpage = AtlasLoot_TableNames[dataID][1]; else lootpage = "Argh!"; end
table.insert(AtlasLootCharDB["SearchResult"], { 0, v[2], v[3], spellName, lootpage, "", "", dataID.."|".."\"\"" });
end--]]
end
end
end
if #AtlasLootCharDB["SearchResult"] == 0 then
local itemFilterErrorMessage = "";
if operator then
itemFilterErrorMessage = [[
Please check if you have a typo in the filter.
To check filter keys, type "/atlaslootfilterkeys".
To check filter examples, type "/atlaslootfilterexample".
You might also have to query the server for item informations to load them into your client's Cache.]];
end
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..WHITE..AL["No match found for"].." \""..Text.."\"."..itemFilterErrorMessage);
else
AtlasLootServerQueryButton:Show();
currentPage = 1;
SearchResult = AtlasLoot_CategorizeWishList(AtlasLootCharDB["SearchResult"]);
AtlasLoot_ShowItemsFrame("SearchResult", "SearchResultPage1", (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame);
end
print(string.lower(advSearchString));
AtlasLoot:Search(string.lower(advSearchString));
end
+1 -1
View File
@@ -4,7 +4,7 @@
## Title-zhTW: |r|cFF0099FF[地圖]|rAL 小地圖按鍵
## Notes-zhTW: AtlasLoot 小地圖按鍵
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2
@@ -8,7 +8,7 @@
## Notes-zhCN: AtlasLoot Enhanced 的《燃烧的远征》副本掉落信息
## Notes-zhTW: AtlasLoot 燃燒的遠征副本掉落物品資料庫
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2
+3 -5
View File
@@ -1494,6 +1494,7 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
{ 4, 30023, "", "=q4=Totem of the Maelstrom", "=ds=#s16#, #w15#", "", "3%"};
{ 5, 30021, "", "=q4=Wildfury Greatstaff", "=ds=#h2#, #w9#", "", "3%"};
{ 6, 30025, "", "=q4=Serpentshrine Shuriken", "=ds=#w11#", "", "3%"};
{ 7, 44831, "", "=q4=Mmrgrg glm Nuubs", "=ds=#s15#", "", "3%"};
{ 8, 30324, "", "=q4=Plans: Red Havoc Boots", "=ds=#p2# (375)", "", "1%"};
{ 9, 30322, "", "=q4=Plans: Red Belt of Battle", "=ds=#p2# (375)", "", "2%"};
{ 10, 30323, "", "=q4=Plans: Boots of the Protector", "=ds=#p2# (375)", "", "2%"};
@@ -3023,6 +3024,7 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
{ 4, 30026, "", "=q4=Bands of the Celestial Archer", "=ds=#s8#, #a3#", "", "2%"};
{ 5, 30030, "", "=q4=Girdle of Fallen Stars", "=ds=#s10#, #a3#", "", "2%"};
{ 6, 30028, "", "=q4=Seventh Ring of the Tirisfalen", "=ds=#s13#", "", "2%"};
{ 7, 2032902, "", "=q4=Bottled Nethergron Extract", "=ds=#s14#, =q1=#m1# =ds=#c6#", "", "2%"};
{ 8, 30324, "", "=q4=Plans: Red Havoc Boots", "=ds=#p2# (375)", "", "1%"};
{ 9, 30322, "", "=q4=Plans: Red Belt of Battle", "=ds=#p2# (375)", "", "2%"};
{ 10, 30323, "", "=q4=Plans: Boots of the Protector", "=ds=#p2# (375)", "", "2%"};
@@ -3041,7 +3043,6 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
{ 23, 30302, "", "=q4=Pattern: Belt of Deep Shadow", "=ds=#p7# (375)", "", "1%"};
{ 25, 30183, "", "=q4=Nether Vortex", "=ds=#e8#", "", "75%"};
{ 27, 32897, "", "=q2=Mark of the Illidari", "=ds=#m20#", "", "27%"};
{ 29, 2032902, "", "=q4=Bottled Nethergron Extract", "=ds=#s14#", "", "??%"};
Type = "BCRaid";
};
@@ -6752,7 +6753,4 @@ AtlasLoot_Data["T6WarriorFury"] = {
{ 24, 30723, "", "=q4=Talon of the Tempest", "=ds=#h3#, #w4#", "", "15.4%"};
{ 25, 30722, "", "=q4=Ethereum Nexus-Reaver", "=ds=#h2#, #w1#", "", "16.0%"};
{ 26, 30724, "", "=q4=Barrel-Blade Longrifle", "=ds=#w5#", "", "20.0%"};
};
};
@@ -1445,7 +1445,7 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
{ 2, 29984, "", "=q4=Girdle of Zaetar", "=ds=#s10#, #a2#", "", "13%"};
{ 3, 29985, "", "=q4=Void Reaver Greaves", "=ds=#s11#, #a3#", "", "14%"};
{ 4, 29983, "", "=q4=Fel-Steel Warhelm", "=ds=#s1#, #a4#", "", "12%"};
{ 5, 32515, "", "=q4=Wristgaurds of Determination", "=ds=#s8#, #a4#", "", "13%"};
{ 5, 32515, "", "=q4=Wristguards of Determination", "=ds=#s8#, #a4#", "", "13%"};
{ 6, 30619, "", "=q4=Fel Reaver's Piston", "=ds=#s14#", "", "13%"};
{ 7, 30450, "", "=q4=Warp-Spring Coil", "=ds=#s14#, =q1=#m1# =ds=#c6#", "", "12%"};
{ 16, 30248, "", "=q4=Pauldrons of the Vanquished Champion", "=ds=#m22# #e15#", "", "61%"};
@@ -1468,7 +1468,7 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
{ 16, 30446, "", "=q4=Solarian's Sapphire", "=ds=#s14#, =q1=#m1# =ds=#c9#", "", "21%"};
{ 17, 30449, "", "=q4=Void Star Talisman", "=ds=#s14#, =q1=#m1# =ds=#c8#", "", "22%"};
{ 18, 29962, "", "=q4=Heartrazor", "=ds=#h1#, #w4#", "", "23%"};
{ 19, 29981, "", "=q4=Etherium Life-Staff", "=ds=#w9#", "", "21%"};
{ 19, 29981, "", "=q4=Ethereum Life-Staff", "=ds=#w9#", "", "21%"};
{ 20, 29982, "", "=q4=Wand of the Forgotten Star", "=ds=#w12#", "", "18%"};
{ 22, 29434, "", "=q4=Badge of Justice", "=ds=#e15#", "", "100%"};
Prev = "TKEyeVoidReaver";
+1 -1
View File
@@ -7,7 +7,7 @@
## Notes-zhCN: AtlasLoot 交易技能制造出的物品表
## Notes-zhTW: AtlasLoot 商業技能物品資料庫
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2
@@ -8,7 +8,7 @@
## Notes-zhCN: AtlasLoot Enhanced 的《燃烧的远征》发售之前的副本掉落信息
## Notes-zhTW: AtlasLoot 艾澤拉斯副本掉落物品資料庫
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2
@@ -7,7 +7,7 @@
## Notes-zhCN: AtlasLoot Enhanced 的户外首领掉落信息
## Notes-zhTW: AtlasLoot 世界事件物品掉落資料庫
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2
@@ -6,7 +6,7 @@
## Notes-zhCN: AtlasLoot Enhanced 的《巫妖王之怒》副本掉落信息
## Notes-zhTW: AtlasLoot 巫妖王之怒副本掉落物品資料庫
## Author: Original: Hegarol, Ascension: Skray/Szyler/Anch/Rvng
## Version: v6.0.0
## Version: v6.2.0
## X-eMail: manager@atlasloot.net
## X-Category: Map
## X-License: GPL v2