ItemDB Optimization and Search Fix
This commit is contained in:
@@ -148,8 +148,8 @@ AtlasLoot_Difficulty = {
|
||||
MythicPlus = {5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
|
||||
|
||||
--Helper Enums to Set min and max difficulties
|
||||
MIN_DIF = 8;
|
||||
MAX_DIF = 9;
|
||||
MIN_DIF = 18;
|
||||
MAX_DIF = 19;
|
||||
}
|
||||
--AtlasLoot_Difficulty was too long to write for enum reasons
|
||||
AL_Dif = AtlasLoot_Difficulty;
|
||||
@@ -884,12 +884,18 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
|
||||
|
||||
|
||||
--Check if difficulties exist, if so show difficulty select buttons
|
||||
if (AtlasLoot_Data[dataID].Dif ~= nil) then
|
||||
if (dataID ~= "SearchResult" and AtlasLoot_Data[dataID].Dif ~= nil) then
|
||||
AtlasLootMythicButton.difficulty_type = AtlasLoot_Data[dataID].Type or "Dungeon"
|
||||
AtlasLootMythicButton:Show();
|
||||
AtlasLoot_DifficultySelect:Show();
|
||||
end
|
||||
|
||||
if (dataID == "SearchResult" and dataSource[dataID].Dif ~= nil) then
|
||||
AtlasLootMythicButton.difficulty_type = dataSource[dataID].Type or "Dungeon"
|
||||
AtlasLootMythicButton:Show();
|
||||
AtlasLoot_DifficultySelect:Show();
|
||||
end
|
||||
|
||||
-- Show the Filter Check-Box
|
||||
if dataID ~= "WishList" and dataID ~= "SearchResult" and dataSource_backup ~= "AtlasLootCrafting" then
|
||||
AtlasLootFilterCheck:Show();
|
||||
@@ -1621,6 +1627,7 @@ function QueryItems(instance, difficulty, expansion)
|
||||
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 == instance) then
|
||||
print("Query for "..boss.." in instance "..inst.." started");
|
||||
local n = 1;
|
||||
local querytime = 0;
|
||||
local now = 0;
|
||||
@@ -1642,6 +1649,7 @@ function QueryItems(instance, difficulty, expansion)
|
||||
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 == instance) then
|
||||
print("Query for "..inst.." in instance "..inst.." started");
|
||||
local n = 1;
|
||||
local querytime = 0;
|
||||
local now = 0;
|
||||
@@ -1662,5 +1670,4 @@ function QueryItems(instance, difficulty, expansion)
|
||||
end
|
||||
end
|
||||
end
|
||||
print("You may need to reload your UI to finalize the Query")
|
||||
end
|
||||
+11141
-11133
File diff suppressed because it is too large
Load Diff
@@ -453,15 +453,25 @@ function AtlasLoot:Search(Text)
|
||||
local operator = HaveOperator(text);
|
||||
|
||||
for dataID, data in pairs(AtlasLoot_Data) do
|
||||
local queryDifficulties = 1;
|
||||
local maxDifficulties = 1;
|
||||
|
||||
if data.Type ~= nil then
|
||||
queryDifficulties = 0;
|
||||
maxDifficulties = 4;
|
||||
end
|
||||
|
||||
for dif = 1, maxDifficulties do
|
||||
for _, v in ipairs(data) do
|
||||
if type(v[2]) == "number" and v[2] > 0 then
|
||||
local _id = AL_FindId(gsub(v[4], "=q%d=", ""), dif + queryDifficulties) or v[2]
|
||||
if 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 = GetItemInfo(v[2]);
|
||||
local itemName, _, itemQuality, itemLvl, minLvl, _, _, _, itemEquipLoc = GetItemInfo(_id);
|
||||
|
||||
if not itemName then itemName = gsub(v[4], "=q%d=", "") end
|
||||
|
||||
if operator ~= nil then
|
||||
local stats = GetItemStats("item:"..tostring(v[2]));
|
||||
local stats = GetItemStats("item:"..tostring(_id));
|
||||
|
||||
-- Currently only supports "&"
|
||||
local binaryOperator = HaveBinaryOperator(text);
|
||||
@@ -486,7 +496,7 @@ function AtlasLoot:Search(Text)
|
||||
end
|
||||
|
||||
if searchConditionsMet then
|
||||
AddItemToSearchResult(v[2], v[3], itemName, lootpage, dataID);
|
||||
AddItemToSearchResult(_id, v[3], itemName, lootpage, dataID);
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -495,7 +505,7 @@ function AtlasLoot:Search(Text)
|
||||
-- Item Level Filter
|
||||
or IsItemLevelFilterMatch(text, itemLvl, itemEquipLoc, operator)
|
||||
then
|
||||
AddItemToSearchResult(v[2], v[3], itemName, lootpage, dataID);
|
||||
AddItemToSearchResult(_id, v[3], itemName, lootpage, dataID);
|
||||
end
|
||||
-- TODO itemQuality
|
||||
-- TODO minLvl
|
||||
@@ -518,7 +528,7 @@ function AtlasLoot:Search(Text)
|
||||
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.."|".."\"\"" });
|
||||
table.insert(AtlasLootCharDB["SearchResult"], { 0, _id, 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));
|
||||
@@ -543,6 +553,7 @@ function AtlasLoot:Search(Text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #AtlasLootCharDB["SearchResult"] == 0 then
|
||||
local itemFilterErrorMessage = "";
|
||||
@@ -650,5 +661,9 @@ function AtlasLoot:GetSearchResultPage(page)
|
||||
table.insert(result, SearchResult[i]);
|
||||
k=k+1;
|
||||
end
|
||||
|
||||
result.Type = "Dungeon";
|
||||
result.Dif = GetDifficultyTier();
|
||||
|
||||
return result, pageMax;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user