This commit is contained in:
andrew6180
2023-12-29 11:51:34 -07:00
parent 31fc1ffe06
commit 9b7cf19457
65 changed files with 47581 additions and 27154 deletions
+42 -54
View File
@@ -1,21 +1,8 @@
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
AtlasLoot_Difficulty = {
-- table of difficulties and there itemID references
["Default"] = {};
AtlasLoot.Difficultys["Default"] = {};
["ClassicDungeon"] = {
{"Normal", 2,},
{"Bloodforged", 1,},
};
["PVP"] = {
{"Normal", 2},
{"Bloodforged", 1},
};
["ClassicDungeonExt"] = {
AtlasLoot.Difficultys["ClassicDungeon"] = {
{"Bloodforged", 1},
{"Normal", 2},
{"Heroic", 3},
@@ -30,7 +17,27 @@ AtlasLoot_Difficulty = {
{"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 },
};
["ClassicRaid"] = {
AtlasLoot.Difficultys["PVP"] = {
{"Normal", 2},
{"Bloodforged", 1},
};
AtlasLoot.Difficultys["ClassicDungeonExt"] = {
{"Bloodforged", 1},
{"Normal", 2},
{"Heroic", 3},
{"Mythic", 4},
{"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 },
{"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 },
{"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 },
{"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 },
{"Mythic 21", 25 }, {"Mythic 22", 26 }, {"Mythic 23", 27 }, {"Mythic 24", 28 }, {"Mythic 25", 29 },
{"Mythic 26", 30 }, {"Mythic 27", 31 }, {"Mythic 28", 32 }, {"Mythic 29", 33 }, {"Mythic 30", 34 },
{"Mythic 31", 35 }, {"Mythic 32", 36 }, {"Mythic 33", 37 }, {"Mythic 34", 38 }, {"Mythic 35", 39 },
{"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 },
};
AtlasLoot.Difficultys["ClassicRaid"] = {
{"Normal", 2},
{"Heroic", 3},
{"Mythic", 5},
@@ -38,7 +45,7 @@ AtlasLoot_Difficulty = {
{"Bloodforged", 1},
};
["BCDungeon"] = {
AtlasLoot.Difficultys["BCDungeon"] = {
{"Bloodforged", 1},
{"Normal/Heroic", 2},
{"Mythic", 4},
@@ -52,7 +59,7 @@ AtlasLoot_Difficulty = {
{"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 },
};
["BCRaid"] = {
AtlasLoot.Difficultys["BCRaid"] = {
{"Normal", 2},
{"Heroic", 3},
{"Mythic", 5},
@@ -60,7 +67,7 @@ AtlasLoot_Difficulty = {
{"Bloodforged", 1},
};
["WrathDungeon"] = {
AtlasLoot.Difficultys["WrathDungeon"] = {
{"Normal/Heroic", 2},
{"Mythic", 4},
{"Bloodforged", 1},
@@ -70,7 +77,7 @@ AtlasLoot_Difficulty = {
{"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 },
};
["WrathRaid"] = {
AtlasLoot.Difficultys["WrathRaid"] = {
{"Normal", 2},
{"Heroic", 3},
{"Mythic", 4},
@@ -78,22 +85,16 @@ AtlasLoot_Difficulty = {
{"Bloodforged", 1},
};
["Crafting"] = {
{"Crafting Patterns", "Pattern" },
{"Item Normal", 2 },
{"Bloodforged", 1 },
};
["CraftingNoBF"] = {
{"Crafting Patterns", "Pattern" },
{"Item Normal", 2 },
AtlasLoot.Difficultys["Crafting"] = {
{"Normal", 2 },
};
["Search"] = {
AtlasLoot.Difficultys["Search"] = {
{"Bloodforged", 1},
{"Normal", 2},
{"Heroic", 3},
{"Mythic/Ascended", 4},
{"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 },
{"Mythic", 4},
{"Mythic 1/Ascended", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 },
{"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 },
{"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 },
{"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 },
@@ -104,33 +105,20 @@ AtlasLoot_Difficulty = {
};
--Enums for comparisons in code
Bloodforged = 1;
Normal = 2;
Heroic = 3;
Mythic = 4;
Ascended = 4;
AtlasLoot.Difficultys.Bloodforged = 1;
AtlasLoot.Difficultys.Normal = 2;
AtlasLoot.Difficultys.Heroic = 3;
AtlasLoot.Difficultys.Mythic = 4;
AtlasLoot.Difficultys.Ascended = 4;
MythicPlus = {
AtlasLoot.Difficultys.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,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44
}; --Usage AtlasLoot_Difficulty.MythicPlus[1-40];
DIF_SEARCH = 16;
DUPLICATE = 17;
MIN_DIF = 18;
MAX_DIF = 19;
}
function AtlasLoot_Difficulty:getMaxDifficulty(difficultyKey)
if(difficultyKey == "ClassicDungeon" or difficultyKey == "PVP") then
return 2;
elseif (difficultyKey == "ClassicDungeonExt" or difficultyKey == "BCDungeon" or difficultyKey == "WrathDungeon") then
return 44;
elseif (difficultyKey == "ClassicRaid" or difficultyKey == "BCRaid" or difficultyKey == "WrathRaid") then
return 5;
else
return 0;
end
end
AtlasLoot.Difficultys.DIF_SEARCH = 16;
AtlasLoot.Difficultys.DUPLICATE = 17;
AtlasLoot.Difficultys.MIN_DIF = 18;
AtlasLoot.Difficultys.MAX_DIF = 19;
File diff suppressed because it is too large Load Diff
+5 -11
View File
@@ -1,22 +1,16 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<!--Ascension Files-->
<Script file="AtlasDifficulty.lua"/>
<!-- <Script file="ItemIDsDatabase.lua"/>
<Script file="ItemIDsDatabase2.lua"/>
<Script file="ItemIDsDatabase3.lua"/> -->
<!--Default Files-->
<Script file="AtlasLoot.lua"/>
<Script file="ItemIDsDatabaseFixes.lua"/>
<Script file="AtlasDifficulty.lua"/>
<Script file="Utils.lua"/>
<Script file="Filter.lua"/>
<Script file="ExtraText.lua"/>
<Script file="TextParsing.lua"/>
<Script file="Options.lua"/>
<Script file="LootButtons.lua"/>
<Script file="Atlasloot_Maps.lua"/>
<Script file="Launchers.lua"/>
<Script file="MapData.lua"/>
<Script file="Maps.lua"/>
<Script file="Launchers.lua"/>
<Script file="WishList.lua"/>
<Script file="SearchAdvanced.lua"/>
<Script file="Search.lua"/>
+205 -337
View File
@@ -1,62 +1,13 @@
--[[
Atlasloot Enhanced
Author Daviesh
Loot browser associating loot with instance bosses
Can be integrated with Atlas (http://www.atlasmod.com)
Functions:
AtlasLoot:HideFilteredItems()
AtlasLoot_FilterEnableButton()
<local> CreateCheckButton(parrent, text, num)
AtlasLoote_CreateFilterOptions()
AtlasLoot:FilterEnableButton()
]]
local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0")
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
AtlasLoot_FilterMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_SetFiltersMenu = AceLibrary("Dewdrop-2.0");
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
local FilterTable = {
{
Name = AL["Armor Type"],
Type = "ArmorType",
{"Cloth", "Cloth"},
{"Leather", "Leather"},
{"Mail", "Mail"},
{"Plate", "Plate"},
},
{
Name = AL["Weapons"],
Type = "InvType",
{"One-Hand", "INVTYPE_WEAPON"},
{"Two-Hand", "INVTYPE_2HWEAPON"},
{"Main Hand", "INVTYPE_WEAPONMAINHAND"},
{"Off Hand", "INVTYPE_WEAPONOFFHAND"},
{"Caster Off Hand", "INVTYPE_HOLDABLE"},
{"Ranged", "INVTYPE_RANGED"},
{"Thrown", "INVTYPE_THROWN"},
{"Relic", "INVTYPE_RELIC"},
{"Shield", "INVTYPE_SHIELD"}
},
{
Name = AL["Accessories"],
Type = "InvType",
{"Necklace", "INVTYPE_NECK"},
{"Back", "INVTYPE_CLOAK"},
{"Ring", "INVTYPE_FINGER"},
{"Trinket", "INVTYPE_TRINKET"}
},
{
Name = AL["Secondary Stats"],
Type = "Stat",
{"Crit", "ITEM_MOD_CRIT_RATING_SHORT"},
{"Hit", "ITEM_MOD_HIT_RATING_SHORT"},
{"Haste", "ITEM_MOD_HASTE_RATING_SHORT"},
{"Expertise", "ITEM_MOD_EXPERTISE_RATING_SHORT"},
{"Armor Pen", "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT"},
{"Spell Pen", "ITEM_MOD_SPELL_PENETRATION_SHORT"}
},
{
Name = AL["Primary Stats"],
Type = "PrimaryStat",
@@ -67,6 +18,15 @@ local FilterTable = {
{"Attack Power", "ITEM_MOD_ATTACK_POWER_SHORT"},
{"Spell Power", "ITEM_MOD_SPELL_POWER_SHORT"}
},
{
Name = AL["Secondary Stats"],
Type = "Stat",
{"Crit", "ITEM_MOD_CRIT_RATING_SHORT"},
{"Hit", "ITEM_MOD_HIT_RATING_SHORT"},
{"Haste", "ITEM_MOD_HASTE_RATING_SHORT"},
{"Armor Pen", "ITEM_MOD_ARMOR_PENETRATION_RATING_SHORT"},
{"Spell Pen", "ITEM_MOD_SPELL_PENETRATION_SHORT"}
},
{
Name = AL["Defensive Stats"],
Type = "Stat",
@@ -79,337 +39,245 @@ local FilterTable = {
},
}
local VanityFilterTable = {
{"Owned", "Owned"},
{"OwnedUnknown", "Owned Unknown"},
{"OwnedExcludeKnown", "Owned Exclude Known"}
}
local CraftingFilterTable = {
{"Known", "Known"},
{"Unknown", "Unknown"},
}
-- **********************************************************************
-- ItemFilter:
-- AtlasLoot:HideFilteredItems()
-- AtlasLoot_FilterEnableButton()
-- AtlasLoot:FilterEnableButton()
-- **********************************************************************
AtlasLootFilter = {};
AtlasLootFilter["FilterList"] = {};
AtlasLootFilter = { FilterList = {} }
function AtlasLoot:HideFilteredItems()
local dataID, dataSource, tablenum = AtlasLootItemsFrame.refreshFilter[1], _G[AtlasLootItemsFrame.refreshFilter[2]], AtlasLootItemsFrame.refreshFilter[3];
local dataID, dataSource, tablenum = AtlasLootItemsFrame.refreshFilter[1], _G[AtlasLootItemsFrame.refreshFilter[2]], AtlasLootItemsFrame.refreshFilter[3]
local tablebase = dataSource[dataID][tablenum]
if not tablebase or dataID == "WishList" or dataID == "SearchResult" or AtlasLootCharDB.SelectedFilter == nil then return end
AtlasLootFilter["FilterList"] = {};
AtlasLootFilter["FilterList"].Type = dataSource[dataID].Type;
AtlasLootFilter["FilterList"].Name = dataSource[dataID].Name;
AtlasLootFilter["FilterList"].Back = dataSource[dataID].Back;
AtlasLootFilter["FilterList"].Map = dataSource[dataID].Map;
AtlasLootFilter["FilterList"][1] = {Name = dataSource[dataID][tablenum].Name};
if not tablebase or dataID == "WishList" or dataID == "SearchResult" then return end
local source = dataSource[dataID]
AtlasLootFilter["FilterList"] = {
Type = source.Type,
Name = source.Name,
Back = source.Back,
Map = source.Map,
vanity = source.vanity,
[1] = {Name = source[tablenum].Name}
}
local function getStats(itemID,sType)
for i,v in pairs(AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter]) do
if type(v) == "table" then
if v[1] and v[3] == sType then
local ItemStats = {};
GetItemStats(select(2,GetItemInfo(itemID)), ItemStats);
if ItemStats[v[2]] then
return true;
end
-- returns true if item has the desired stats
local function checkStats(itemStats, sCheck)
for pStat, sStat in pairs(AtlasLootFilterDB) do
if sStat[1] and sStat[2] == sCheck and itemStats[pStat] then
return true
end
end
return false
end
-- checks filters for the right conditions
local function checkfilters(itemStats, sCheck)
if checkStats(itemStats, sCheck) then return true end
for _, fTable in ipairs(FilterTable) do
for _, stat in ipairs(fTable) do
if fTable.Type == sCheck and AtlasLootFilterDB[stat[2]][1] then
return false
end
end
end
return true
end
local function checkNofilter(itemID, filter)
if getStats(itemID,filter) then return true end;
for i,v in pairs(AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter]) do
for n,t in ipairs(FilterTable) do
if t.Type == filter and v[1] then
return true;
end
end
end
end
local count = 0
-- checks filters and whether the id is armor or a weapon
local function getFilterType(itemID)
local filterSelect3, filterSelect2,_ , filterSelect1 = select(6,GetItemInfo(itemID));
local filter1 = AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][filterSelect1];
local filter2 = AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][filterSelect2];
if not itemID then return end
local itemLink, _, _, _, armorCheck = select(2,GetItemInfo(itemID))
local itemStats = GetItemStats(itemLink)
if (filter1 and filter1[1] and filter1[3] == "InvType" and getStats(itemID,"PrimaryStat") and checkNofilter(itemID, "Stat")) or
(filter2 and filter2[1] and filter2[3] == "ArmorType" and getStats(itemID,"PrimaryStat") and checkNofilter(itemID, "Stat"))
then
return true;
else
for _,v in pairs(FilterTable) do
for _,t in ipairs(v) do
if t[2] == filterSelect1 or t[2] == filterSelect2 or t[2] == filterSelect3 then
return false;
if (armorCheck == "Armor" or armorCheck == "Weapon") and checkfilters(itemStats, "PrimaryStat") and checkfilters(itemStats, "Stat") then
return true
elseif armorCheck ~= "Armor" and armorCheck ~= "Weapon" then
return true
end
end
local function getVanityFilters(itemID, learnedSpellID)
local db = AtlasLootFilterDB.VanityFilters
local learnedSpellID
if VANITY_ITEMS[itemID] and VANITY_ITEMS[itemID].learnedSpell and VANITY_ITEMS[itemID].learnedSpell ~= 0 then
learnedSpellID = VANITY_ITEMS[itemID].learnedSpell
end
if C_VanityCollection.IsCollectionItemOwned(itemID) then
if learnedSpellID and not CA_IsSpellKnown(learnedSpellID) and db["OwnedUnknown"] then
return true
elseif not learnedSpellID and db["OwnedExcludeKnown"] then
return true
elseif db["Owned"] then
return true
end
end
end
local function getCraftingFilters(spellID)
local db = AtlasLootFilterDB.CraftingFilters
if not db["Unknown"] and not db["Known"] then return true end
if (not CA_IsSpellKnown(spellID) and db["Unknown"]) or (CA_IsSpellKnown(spellID) and db["Known"]) then
return true
end
end
-- build filtered list removing any blank spaces that are not meant to be there
local count = 0
for i = 1, 30 do
if tablebase[i] then
if source.vanity then
if getVanityFilters(tablebase[i].itemID, tablebase[i].learnedSpellID) then
if i == 16 then
count = 0
end
AtlasLootFilter.FilterList[1][i-count] = tablebase[i]
elseif i == 16 then
count = 1
else
count = count + 1
end
elseif source.Type == "Crafting" then
if getCraftingFilters(tablebase[i].spellID) then
if i == 16 then
count = 0
end
AtlasLootFilter.FilterList[1][i-count] = tablebase[i]
elseif i == 16 then
count = 1
else
count = count + 1
end
else
if getFilterType(tablebase[i].itemID) or tablebase[i].icon then
if i == 16 then
count = 0
end
AtlasLootFilter.FilterList[1][i-count] = tablebase[i]
elseif i == 16 then
count = 1
else
count = count + 1
end
end
return true;
end
end
for i,v in ipairs(tablebase) do
if getFilterType(v[2]) or v[2] == 0 then
if v[1] == 16 then
count = 0;
end
table.insert(AtlasLootFilter["FilterList"][1],{v[1] - count,v[2],v[3],v[4],v[5],v[6],v[7],v[8]});
elseif v[1] == 16 then
count = 1
else
count = count + 1;
end
end
AtlasLoot:ShowItemsFrame("FilterList", "AtlasLootFilter", 1)
-- show filtered table
self:ShowItemsFrame("FilterList", "AtlasLootFilter", 1)
end
function AtlasLoot_FilterEnableButton(self, btnclick)
function AtlasLoot:FilterEnableButton(frame, btnclick)
if btnclick == "RightButton" then
if AtlasLoot_FilterMenu:IsOpen() then
AtlasLoot_FilterMenu:Close();
if self.Dewdrop:IsOpen() then
self.Dewdrop:Close()
else
AtlasLoot_FilterMenu:Unregister(AtlasLootFilterCheck);
AtlasLoot:FilterMenuRegister();
AtlasLoot_FilterMenu:Open(self);
self.Dewdrop:Unregister(AtlasLootFilterCheck)
self:FilterMenuRegister()
self.Dewdrop:Open(frame)
end
if AtlasLootFilterCheck:GetChecked() then
AtlasLootFilterCheck:SetChecked(false);
AtlasLootFilterCheck:SetChecked(false)
else
AtlasLootFilterCheck:SetChecked(true);
AtlasLootFilterCheck:SetChecked(true)
end
else
if ATLASLOOT_FILTER_ENABLE then
ATLASLOOT_FILTER_ENABLE = false;
AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refreshFilter[1], AtlasLootItemsFrame.refreshFilter[2], AtlasLootItemsFrame.refreshFilter[3]);
if self.filterEnable then
self.filterEnable = false
self:ShowItemsFrame(AtlasLootItemsFrame.refreshFilter[1], AtlasLootItemsFrame.refreshFilter[2], AtlasLootItemsFrame.refreshFilter[3])
else
ATLASLOOT_FILTER_ENABLE = true
AtlasLoot:HideFilteredItems();
self.filterEnable = true
self:HideFilteredItems()
end
end
end
local function disableFilters(current)
local db = AtlasLootFilterDB.VanityFilters
for filter, stat in pairs(db) do
if stat and current ~= filter then
db[filter] = false
end
end
end
--[[
AtlasLoot:FilterMenuRegister:
Constructs the Filter menu.
]]
function AtlasLoot:FilterMenuRegister()
AtlasLoot_FilterMenu:Register(AtlasLootFilterCheck,
local db = AtlasLootFilterDB
self.Dewdrop:Register(AtlasLootFilterCheck,
'point', function(parent)
return "TOP", "BOTTOM"
return "TOPLEFT", "BOTTOM"
end,
'children', function(level, value)
for i,v in ipairs(AtlasLootFilterDB["FilterLists"]) do
local setFilter = false;
if AtlasLootCharDB.SelectedFilter == i then setFilter = true end
AtlasLoot_FilterMenu:AddLine(
"text", v.Name,
if _G[AtlasLootItemsFrame.refreshFilter[2]][AtlasLootItemsFrame.refreshFilter[1]].vanity then
for _, filter in ipairs(VanityFilterTable) do
local fDB = db.VanityFilters
if not fDB[filter[1]] then fDB[filter[1]] = false end
self.Dewdrop:AddLine(
"text", filter[2],
"func", function()
AtlasLootCharDB.SelectedFilter = i;
AtlasLoot_FilterMenu:Close();
fDB[filter[1]] = not fDB[filter[1]]
disableFilters(filter[1])
if self.filterEnable then
self:HideFilteredItems()
end
end,
"checked", setFilter
);
"checked", fDB[filter[1]],
"closeWhenClicked", true
)
end
AtlasLoot_FilterMenu:AddLine(
"text", AL["Add Filter Set"],
"func", function() AtlasLoot:OpenFilterCreate() end,
"notCheckable", true
);
elseif _G[AtlasLootItemsFrame.refreshFilter[2]][AtlasLootItemsFrame.refreshFilter[1]].Type == "Crafting" then
for _, filter in ipairs(CraftingFilterTable) do
local fDB = db.CraftingFilters
if not fDB[filter[1]] then fDB[filter[1]] = false end
self.Dewdrop:AddLine(
"text", filter[2],
"func", function()
fDB[filter[1]] = not fDB[filter[1]]
disableFilters(filter[1])
if self.filterEnable then
self:HideFilteredItems()
end
end,
"checked", fDB[filter[1]],
"closeWhenClicked", true
)
end
else
for _, group in ipairs(FilterTable) do
self.Dewdrop:AddLine('text' , group.Name, 'textHeight', 12, 'textWidth', 12, 'isTitle', true, "notCheckable", true)
for _, filters in ipairs(group) do
if not db[filters[2]] then db[filters[2]] = {false, group.Type} end
self.Dewdrop:AddLine(
"text", filters[1],
"func", function()
db[filters[2]][1] = not db[filters[2]][1]
if self.filterEnable then
self:HideFilteredItems()
end
end,
"checked", db[filters[2]][1]
)
end
end
end
--Close button
AtlasLoot_FilterMenu:AddLine(
'text', AL["Close Menu"],
'textR', 0,
'textG', 1,
'textB', 1,
'func', function() AtlasLoot_FilterMenu:Close() end,
'notCheckable', true
);
self.Dewdrop:AddLine('text', AL["Close Menu"], 'textR', 0, 'textG', 1, 'textB', 1, "closeWhenClicked", true, 'notCheckable', true)
end,
'dontHook', true
)
end
--Sets all the filter check boxs for current filter
local function setFilterChecks()
local filterList = AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter];
local count = 1;
for i,v in ipairs(FilterTable) do
count = count + 1;
for n,t in ipairs(v) do
if filterList[t[2]] and filterList[t[2]][1] then
_G["AtlasLootFilterButton_"..count]:SetChecked(true);
else
_G["AtlasLootFilterButton_"..count]:SetChecked(false);
end
count = count + 1;
end
end
end
local function setFilter(arg1,type)
if AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][arg1] and AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][arg1][1] then
AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][arg1] = {false,arg1,type};
else
AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][arg1] = {true,arg1,type};
end
end
function AtlasLoot:HideFilterCreateButtons()
if not ATLASLOOT_BUILD_FILTER_LIST then return end
for i=1, 41 do
_G["AtlasLootFilterButton_"..i]:Hide();
end
AtlasLootFilterSelect:Hide();
AtlasLootFilterCreate:Hide();
AtlasLootFilterDelete:Hide();
end
-- **********************************************************************
-- Options:
-- AtlasLoot:HideFilteredItems()
-- **********************************************************************
ATLASLOOT_BUILD_FILTER_LIST = false;
-- Place to add new or edit existing filter lists
function AtlasLoot:OpenFilterCreate()
if not ATLASLOOT_BUILD_FILTER_LIST then
ATLASLOOT_BUILD_FILTER_LIST = true;
local count = 1;
for i,v in ipairs(FilterTable) do
local filterCatLable = AtlasLootItemsFrame:CreateFontString("AtlasLootFilterButton_"..count,"OVERLAY","GameFontNormal");
filterCatLable:SetText(v.Name);
filterCatLable:Show();
if count == 1 then
filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",-150,-90);
elseif count == 16 then
filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",0,-90);
elseif count == 28 then
filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",150,-90);
else
filterCatLable:SetPoint("LEFT", "AtlasLootFilterButton_"..(count - 1), "LEFT",0,-25);
end
count = count + 1;
for n,t in ipairs(v) do
local button = CreateFrame("CheckButton", "AtlasLootFilterButton_"..count, AtlasLootItemsFrame, "OptionsCheckButtonTemplate");
_G["AtlasLootFilterButton_"..count.."Text"]:SetText(t[1]);
button:SetScript("OnClick", function() setFilter(t[2],v.Type) end)
if n == 1 then
button:SetPoint("LEFT", "AtlasLootFilterButton_"..(count - 1), "LEFT",0,-25);
else
button:SetPoint("LEFT", "AtlasLootFilterButton_"..(count - 1), "LEFT",0,-20);
end
count = count + 1;
end
end
local filterSelectButton = CreateFrame("Button", "AtlasLootFilterSelect", AtlasLootItemsFrame, "UIDropDownMenuTemplate");
filterSelectButton:SetSize(190,24);
filterSelectButton:SetPoint("Top", "AtlasLootItemsFrame", "TOP",-110,-35);
local createFilterButton = CreateFrame("Button", "AtlasLootFilterCreate", AtlasLootItemsFrame, "OptionsButtonTemplate");
createFilterButton:SetSize(130,20);
createFilterButton:SetPoint("LEFT", "AtlasLootItemsFrame_BACK", "LEFT",-150,0);
createFilterButton:SetText(AL["Add/Edit Filter"]);
createFilterButton:SetScript("OnClick", function(self) StaticPopup_Show("ATLASLOOT_ADD_FILTER_LIST") end);
local deleteFilterButton = CreateFrame("Button", "AtlasLootFilterDelete", AtlasLootItemsFrame, "OptionsButtonTemplate");
deleteFilterButton:SetSize(130,20);
deleteFilterButton:SetPoint("RIGHT", "AtlasLootItemsFrame_BACK", "RIGHT",150,0);
deleteFilterButton:SetText(AL["Delete Filter"]);
deleteFilterButton:SetScript("OnClick", function(self) StaticPopup_Show("ATLASLOOT_DELETE_FILTERLIST") end);
end
UIDropDownMenu_Initialize(AtlasLootFilterSelect, AtlasLoot.FilterSelectorMenuInitialize);
UIDropDownMenu_SetSelectedID(AtlasLootFilterSelect, AtlasLootCharDB.SelectedFilter);
setFilterChecks();
for i=1,41 do
_G["AtlasLootFilterButton_"..i]:Show();
end
AtlasLootFilterSelect:Show();
AtlasLootFilterCreate:Show();
AtlasLootFilterDelete:Show();
--Ditch the Quicklook selector
AtlasLootQuickLooksButton:Hide();
-- Hide the Filter Check-Box
AtlasLootFilterCheck:Hide();
--Hide navigation buttons by default, only show what we need
_G["AtlasLootItemsFrame_BACK"]:Show();
_G["AtlasLootItemsFrame_NEXT"]:Hide();
_G["AtlasLootItemsFrame_PREV"]:Hide();
--Hide UI objects so that only needed ones are shown
for i = 1, 30, 1 do
_G["AtlasLootItem_"..i.."_Unsafe"]:Hide();
_G["AtlasLootItem_"..i]:Hide();
_G["AtlasLootItem_"..i].itemID = 0;
_G["AtlasLootItem_"..i].spellitemID = 0;
end
--Set Page Title
AtlasLoot_BossName:SetText("Create Filter Set");
AtlasLoot_FilterMenu:Close();
end
local function FilterSelectOnClick()
AtlasLootCharDB.SelectedFilter = this:GetID();
UIDropDownMenu_SetSelectedID(AtlasLootFilterSelect, AtlasLootCharDB.SelectedFilter);
setFilterChecks();
end
function AtlasLoot:FilterSelectorMenuInitialize()
for i,v in ipairs(AtlasLootFilterDB["FilterLists"]) do
local info = {
text = v.Name;
func = FilterSelectOnClick;
};
UIDropDownMenu_AddButton(info);
end
end
--[[
StaticPopupDialogs["ATLASLOOT_ADD_FILTER_LIST"]
This is shown, if you want too add a add/edit a filter list
]]
StaticPopupDialogs["ATLASLOOT_ADD_FILTER_LIST"] = {
text = "Filter Name",
button1 = "Add Filter",
button3 = "Edit Filter",
button2 = AL["Cancel"],
OnShow = function(self)
self.editBox:SetText(UIDropDownMenu_GetText(AtlasLootFilterSelect))
self:SetFrameStrata("TOOLTIP");
end,
OnAccept = function(self)
local text = self.editBox:GetText();
table.insert(AtlasLootFilterDB["FilterLists"],AtlasLoot:CloneTable(AtlasLootFilterDB["FilterLists"][UIDropDownMenu_GetSelectedID(AtlasLootFilterSelect)]));
AtlasLootFilterDB["FilterLists"][#AtlasLootFilterDB["FilterLists"]].Name = text;
UIDropDownMenu_SetSelectedID(AtlasLootFilterSelect,#AtlasLootFilterDB["FilterLists"]);
UIDropDownMenu_SetText(AtlasLootFilterSelect,text);
end,
OnButton3 = function(self)
local text = self.editBox:GetText();
AtlasLootFilterDB["FilterLists"][UIDropDownMenu_GetSelectedID(AtlasLootFilterSelect)].Name = self.editBox:GetText();
UIDropDownMenu_SetText(AtlasLootFilterSelect,text);
end,
hasEditBox = 1,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
};
--[[
StaticPopupDialogs["ATLASLOOT_DELETE_FILTERLIST"]
This is shown, if you want too delete a filter list
]]
StaticPopupDialogs["ATLASLOOT_DELETE_FILTERLIST"] = {
text = AL["Delete Filter"],
button1 = AL["Delete"],
button2 = AL["Cancel"],
OnShow = function()
this:SetFrameStrata("TOOLTIP");
end,
OnAccept = function()
table.remove(AtlasLootFilterDB["FilterLists"],UIDropDownMenu_GetSelectedID(AtlasLootFilterSelect));
UIDropDownMenu_SetSelectedID(AtlasLootFilterSelect,1);
UIDropDownMenu_SetText(AtlasLootFilterSelect,UIDropDownMenu_GetText(AtlasLootFilterSelect));
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
};
end
+42 -124
View File
@@ -1,34 +1,15 @@
--[[
Name : AtlasLootFu
Version : 2.0
Author : Daviesh (oma_daviesh@hotmail.com)
Website : https://discord.gg/uYCE2X2FgA
Description : Adds AtlasLoot to FuBar.
]]
--Invoke libraries
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
--Make an LDB object
LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("AtlasLoot", {
type = "launcher",
local icon = LibStub('LibDBIcon-1.0')
local minimap = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject("AtlasLoot", {
type = 'data source',
text = "AtlasLoot",
icon = "Interface\\Icons\\INV_Box_01",
OnClick = function()
if IsShiftKeyDown() then
AtlasLootOptions_Toggle();
else
if AtlasLootDefaultFrame:IsVisible() then
AtlasLootDefaultFrame:Hide();
else
AtlasLootDefaultFrame:Show();
end
end
end,
})
})
function AtlasLoot_OnBarButtonClick(button)
if IsShiftKeyDown() then
AtlasLootOptions_Toggle();
function minimap.OnClick(frame, button)
GameTooltip:Hide()
if IsShiftKeyDown() then
AtlasLoot:OptionsToggle();
else
if AtlasLootDefaultFrame:IsVisible() then
AtlasLootDefaultFrame:Hide();
@@ -38,110 +19,47 @@ function AtlasLoot_OnBarButtonClick(button)
end
end
--[[function AtlasLoot_MinimapButtonInit()
if AtlasLootMinimapButtonFrame then
if IsAddOnLoaded("FuBar") then
AtlasLootMinimapButtonFrame:SetPoint("CENTER", "UIParent", "CENTER");
AtlasLootMinimapButtonFrame:Hide();
elseif(AtlasLoot.db.profile.MinimapButton == true) then
AtlasLootMinimapButtonFrame:SetPoint("TOPLEFT","Minimap","TOPLEFT",54 - (78 * cos(AtlasLoot.db.profile.MinimapButtonAngle)),(78 * sin(AtlasLoot.db.profile.MinimapButtonAngle)) - 55);
AtlasLootMinimapButtonFrame:Show();
else
AtlasLootMinimapButtonFrame:SetPoint("CENTER", "UIParent", "CENTER");
AtlasLootMinimapButtonFrame:Hide();
end
end
function minimap.OnLeave()
GameTooltip:Hide()
end
function AtlasLoot_MinimapButtonOnEnter()
GameTooltip:SetOwner(this, "ANCHOR_LEFT");
GameTooltip:SetText(string.sub(ATLASLOOT_VERSION, 11, 28));
GameTooltip:AddLine(AL["|cff1eff00Left-Click|r Browse Loot Tables"]);
GameTooltip:AddLine(AL["|cffff0000Shift-Click|r View Options"]);
GameTooltip:AddLine(AL["|cffccccccRight-Click + Drag|r Move Minimap Button"]);
GameTooltip:Show();
-- handle minimap tooltip
local function GetTipAnchor(frame)
local x, y = frame:GetCenter()
if not x or not y then return 'TOPLEFT', 'BOTTOMLEFT' end
local hhalf = (x > UIParent:GetWidth() * 2 / 3) and 'RIGHT' or (x < UIParent:GetWidth() / 3) and 'LEFT' or ''
local vhalf = (y > UIParent:GetHeight() / 2) and 'TOP' or 'BOTTOM'
return vhalf .. hhalf, frame, (vhalf == 'TOP' and 'BOTTOM' or 'TOP') .. hhalf
end
-- Thanks to Yatlas and Atlas for this code
function AtlasLoot_MinimapButtonBeingDragged()
-- Thanks to Gello and Dan Gilbert for this code
local xpos,ypos = GetCursorPosition()
local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom()
xpos = xmin-xpos/UIParent:GetScale()+70
ypos = ypos/UIParent:GetScale()-ymin-70
AtlasLoot_MinimapButtonSetPosition(math.deg(math.atan2(ypos,xpos)));
function minimap.OnEnter(frame)
GameTooltip:SetOwner(frame, 'ANCHOR_NONE')
GameTooltip:SetPoint(GetTipAnchor(frame))
GameTooltip:ClearLines()
GameTooltip:AddLine("AtlasLoot")
GameTooltip:AddLine("|cff1eff00Left-Click|r Browse Loot Tables")
GameTooltip:AddLine("|cffff0000Shift-Click|r View Options")
GameTooltip:AddLine("|cffccccccLeft-Click + Drag|r Move Minimap Button")
GameTooltip:Show()
end
function AtlasLoot_MinimapButtonSetPosition(v)
if(v < 0) then
v = v + 360;
end
function AtlasLoot:MinimapIconSetup()
if not self.db.profile.minimap then
self.db.profile.minimap = {hide = false}
end
AtlasLoot.db.profile.MinimapButtonAngle = v;
AtlasLoot_MinimapButtonUpdatePosition();
if icon then
icon:Register('AtlasLoot', minimap, self.db.profile.minimap)
end
end
function AtlasLoot_MinimapButtonUpdatePosition()
local radius = AtlasLoot.db.profile.MinimapButtonRadius;
AtlasLootMinimapButtonFrame:SetPoint(
"TOPLEFT",
"Minimap",
"TOPLEFT",
54 - (radius * cos(AtlasLoot.db.profile.MinimapButtonAngle)),
(radius * sin(AtlasLoot.db.profile.MinimapButtonAngle)) - 55
);
if(AtlasLoot.db.profile.MinimapButton == true) then
AtlasLootMinimapButtonFrame:Show();
-- show/hide minimap icon
function AtlasLoot:ToggleMinimap()
local hide = not self.db.profile.minimap.hide
self.db.profile.minimap.hide = hide
if hide then
icon:Hide("AtlasLoot")
else
AtlasLootMinimapButtonFrame:Hide();
icon:Show("AtlasLoot")
end
end]]
--[[if IsAddOnLoaded("FuBar") then
if AtlasLootMinimapButtonFrame then
AtlasLootMinimapButtonFrame:SetPoint("CENTER", "UIParent", "CENTER");
AtlasLootMinimapButtonFrame:Hide();
end
AtlasLootFu = LibStub("AceAddon-3.0"):NewAddon("AtlasLootFu");
AceDB = LibStub("AceDB-3.0");
AtlasLootFu.db = AceDB:New("AtlasLootFuDB");
LibStub("AceAddon-3.0"):EmbedLibrary(AtlasLootFu, "LibFuBarPlugin-Mod-3.0", true);
AtlasLootFu:SetFuBarOption("tooltipType", "GameTooltip");
--AtlasLootFu:SetFuBarOption("configType", "Dewdrop-2.0");
AtlasLootFu:SetFuBarOption("iconPath", "Interface\\Icons\\INV_Box_01");
--AtlasLootFu:SetFuBarOption("defaultMinimapPosition", 220);
AtlasLootFu:SetFuBarOption("cannotDetachTooltip", true);
AtlasLootFu:SetFuBarOption("hasNoColor", true);
--Make sure the plugin is the rightt format when activated
function AtlasLootFu:OnEnable()
self:UpdateFuBarPlugin();
end
--Define text to display when the cursor mouses over the plugin
function AtlasLootFu:OnUpdateFuBarTooltip()
GameTooltip:AddLine(AL["|cff1eff00Left-Click|r Browse Loot Tables"]);
GameTooltip:AddLine(AL["|cffff0000Shift-Click|r View Options"]);
GameTooltip:AddLine(AL["|cffccccccLeft-Click + Drag|r Move Minimap Button"]);
end
--Define what to do when the plugin is clicked
function AtlasLootFu:OnFuBarClick(button)
--Left click -> open loot browser
--Shift Left Click -> show options menu
--Right click -> standard FuBar options
AtlasLoot_OnBarButtonClick(button);
end
function AtlasLootFu:OpenMenu()
AtlasLootOptions_Toggle();
end
end]]
end
File diff suppressed because it is too large Load Diff
+257
View File
@@ -0,0 +1,257 @@
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
local ORANGE = "|cffFF8400"
local GOLD = "|cffffcc00"
local WHITE = "|cFFFFFFFF"
local CYAN = "|cff00ffff"
local DefaultPin = "questlog-questtypeicon-daily"
-- Map Functions
local playerFaction = UnitFactionGroup("player")
local lastMap
local totalPins = 0
-- Creates the map pins
function AtlasLoot:CreateMapPins(list)
_G["AtlasLoot_PlayerMapPin"]:Hide()
-- Hide all pins before reshowing so any extras arnt showing
if totalPins then
for i = 1, totalPins do
_G["AtlasLoot_MapPin"..i]:Hide()
end
end
-- Creates buttons on the map for pins if a button dosnt already exist
-- If a button exists reuse it
for i,map in ipairs(list) do
--create pin buttons
if not _G["AtlasLoot_MapPin"..i] then
-- Map Pins
local mapPin = CreateFrame("Button","AtlasLoot_MapPin"..i, AtlasLootDefaultFrame_Map)
mapPin:SetSize(25,25)
mapPin:SetFrameStrata("HIGH")
mapPin.text = mapPin:CreateFontString(nil, "OVERLAY","GameFontNormal")
mapPin.text:SetPoint("LEFT",mapPin, 30, 0)
mapPin.text:SetJustifyH("LEFT")
mapPin.text:SetFont("GameFontNormal", 28)
mapPin.text:SetSize(150,12)
mapPin.tex = mapPin:CreateTexture(nil, "ARTWORK")
mapPin.tex:SetPoint("CENTER")
totalPins = totalPins + 1
end
-- converts a standard coordinate x,y to stardard anchor points
local x = ((AtlasLootDefaultFrame_Map:GetWidth()/100) * map[2][1]) - (_G["AtlasLoot_MapPin"..i]:GetWidth()/2)
local y = (-(AtlasLootDefaultFrame_Map:GetHeight()/100) * map[2][2]) + (_G["AtlasLoot_MapPin"..i]:GetHeight()/2)
_G["AtlasLoot_MapPin"..i]:SetScript("OnEnter", function(btn)
self.showCords = true
GameTooltip:SetOwner(btn, "ANCHOR_TOPLEFT")
GameTooltip:AddLine(WHITE..map[1])
if map[4] and list.groups[map[4]] then
for _,v in ipairs(list.groups[map[4]]) do
if v ~= map[1] then
GameTooltip:AddLine(WHITE..v)
end
end
end
GameTooltip:AddLine("("..map[2][1]..", "..map[2][2]..")")
GameTooltip:Show()
end)
_G["AtlasLoot_MapPin"..i]:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
if map[3] then
local tex = AtlasUtil:GetAtlasInfo(map[3])
_G["AtlasLoot_MapPin"..i].tex:SetTexture(tex.filename)
_G["AtlasLoot_MapPin"..i].tex:SetTexCoord(tex.leftTexCoord, tex.rightTexCoord, tex.topTexCoord, tex.bottomTexCoord)
_G["AtlasLoot_MapPin"..i].tex:SetSize(25,25)
else
local tex = AtlasUtil:GetAtlasInfo(DefaultPin)
_G["AtlasLoot_MapPin"..i].tex:SetTexture(tex.filename)
_G["AtlasLoot_MapPin"..i].tex:SetTexCoord(tex.leftTexCoord, tex.rightTexCoord, tex.topTexCoord, tex.bottomTexCoord)
_G["AtlasLoot_MapPin"..i].tex:SetSize(25,25)
end
_G["AtlasLoot_MapPin"..i].text:SetText(CYAN..map[1])
_G["AtlasLoot_MapPin"..i]:ClearAllPoints()
_G["AtlasLoot_MapPin"..i]:SetPoint("TOPLEFT",AtlasLootDefaultFrame_Map,x ,y)
_G["AtlasLoot_MapPin"..i]:Show()
end
end
function AtlasLoot:MapOnEnter()
local x, y = self:GetCursorCords()
if self.showCords then
AtlasLootDefaultFrame_Map.cursorCords:SetText(WHITE.."Cursor: "..x.." , "..y)
end
end
-- Track the coordinates off the mouse while it is on the map frame
function AtlasLoot:GetCursorCords()
local scale,x, y = AtlasLootDefaultFrame_Map:GetEffectiveScale(), GetCursorPosition()
local width, height = AtlasLootDefaultFrame_Map:GetWidth()/100, AtlasLootDefaultFrame_Map:GetHeight()/100
x, y = math.ceil(((x/scale) - AtlasLootDefaultFrame_Map:GetLeft())/width), math.ceil((((y/scale) - AtlasLootDefaultFrame_Map:GetTop())/height) * -1)
return x, y
end
function AtlasLoot:PlayerPin(firstSet)
if AtlasLootDefaultFrame_Map:IsVisible() and AtlasLoot_MapData[self.CurrentMap].ZoneName[1] == GetRealZoneText() and self.MapNum == GetCurrentMapDungeonLevel() then
_G["AtlasLoot_PlayerMapPin"]:Show()
else
return
end
if GetUnitSpeed("player") > 0 or firstSet then
local x, y = GetPlayerMapPosition("player")
x = ((AtlasLootDefaultFrame_Map:GetWidth()/100) * (x * 100)) - (_G["AtlasLoot_PlayerMapPin"]:GetWidth()/2)
y = (-(AtlasLootDefaultFrame_Map:GetHeight()/100) * (y * 100)) + (_G["AtlasLoot_PlayerMapPin"]:GetHeight()/2)
_G["AtlasLoot_PlayerMapPin"]:ClearAllPoints()
_G["AtlasLoot_PlayerMapPin"]:SetPoint("TOPLEFT",AtlasLootDefaultFrame_Map, x, y )
_G["AtlasLoot_PlayerMapPin"].texture:SetRotation(GetPlayerFacing())
end
self.playerPinTimer = self:ScheduleTimer("PlayerPin", .1)
end
function AtlasLoot:SetNavButtons(mapID, mapNum)
if not AtlasLootDefaultFrame_Map:IsVisible() then return end
--Hide navigation buttons by default, only show what we need
_G["AtlasLootItemsFrame_BACK"]:Hide()
_G["AtlasLootItemsFrame_NEXT"]:Hide()
_G["AtlasLootItemsFrame_PREV"]:Hide()
if mapNum ~= #_G["AtlasLoot_MapData"][mapID] then
_G["AtlasLootItemsFrame_NEXT"]:SetParent("AtlasLootDefaultFrame_Map")
_G["AtlasLootItemsFrame_NEXT"]:Show()
_G["AtlasLootItemsFrame_NEXT"].mapNum = mapNum + 1
_G["AtlasLootItemsFrame_NEXT"].mapID = mapID
_G["AtlasLootItemsFrame_NEXT"]:ClearAllPoints()
_G["AtlasLootItemsFrame_NEXT"]:SetPoint("BOTTOMRIGHT", "AtlasLootDefaultFrame_Map", "BOTTOMRIGHT",-5,5)
end
if mapNum ~= 1 then
_G["AtlasLootItemsFrame_PREV"]:SetParent("AtlasLootDefaultFrame_Map")
_G["AtlasLootItemsFrame_PREV"]:Show()
_G["AtlasLootItemsFrame_PREV"].mapNum = mapNum - 1
_G["AtlasLootItemsFrame_PREV"].mapID = mapID
_G["AtlasLootItemsFrame_PREV"]:ClearAllPoints()
_G["AtlasLootItemsFrame_PREV"]:SetPoint("BOTTOMLEFT", "AtlasLootDefaultFrame_Map", "BOTTOMLEFT",5,5)
end
end
--called everytime you open a map hiding the loot item buttons
function AtlasLoot:MapOnShow(mapID, mapNum, refresh)
if not refresh and AtlasLootDefaultFrame_Map:IsVisible() then
AtlasLootDefaultFrame_Map:Hide()
AtlaslLoot_LootBackground:Show()
self:BackButton_OnClick()
AtlasLoot_BossName:Show()
Atlasloot_HeaderLabel:Hide()
self:ScrollFrameUpdate()
else
if self.CurrentMap then
AtlasLoot_BossName:Hide()
-- Hide the Filter Check-Box
AtlasLootFilterCheck:Hide()
AtlaslLoot_LootBackground:Hide()
--Hide UI objects so that only needed ones are shown
for i = 1, 30, 1 do
_G["AtlasLootItem_"..i]:Hide()
_G["AtlasLootItem_"..i].itemID = 0
end
AtlasLootDefaultFrame_Map:Show()
Atlasloot_HeaderLabel:Show()
self:ScrollFrameUpdate(true)
AtlasLootDefaultFrameScroll:Hide()
SetMapToCurrentZone()
if mapNum and mapID then
self.CurrentMap = mapID
elseif AtlasLoot_MapData[self.CurrentMap].ZoneName[1] == GetRealZoneText() then
if GetCurrentMapDungeonLevel() == 0 then
mapNum = 1
else
mapNum = GetCurrentMapDungeonLevel()
end
elseif lastMap == self.CurrentMap then
mapNum = self.MapNum
end
lastMap = self.CurrentMap
self:MapSelect(self.CurrentMap, mapNum)
end
end
end
--called to change the current displayed map
function AtlasLoot:MapSelect(mapID, mapNum)
local map = AtlasLoot_MapData[mapID]
if map.MapName then
for i = 1, 12 do
local texture = _G["AtlasLoot_MapDetailTile"..i]:SetTexture("Interface\\Worldmap\\"..map.MapName.."\\"..map.MapName..mapNum.."_"..i)
if not texture then
_G["AtlasLoot_MapDetailTile"..i]:SetTexture("Interface\\Worldmap\\"..map.MapName.."\\"..map.MapName..i)
end
end
end
local pinsList = {groups = {}}
local group = 0
for _, v in ipairs (map[mapNum]) do
if v.cords then
group = group + 1
tinsert(pinsList,{v[1],v.cords,v.pinType, group})
end
if group ~= 0 then
if not pinsList.groups[group] then pinsList.groups[group] = {} end
tinsert(pinsList.groups[group], v[1])
end
end
self.MapNum = mapNum
self.CurrentMap = mapID
self:SubTableScrollFrameUpdate(mapID, "AtlasLoot_MapData", mapNum)
self:SetNavButtons(mapID, mapNum)
self:CreateMapPins(pinsList)
self:CancelTimer(self.playerPinTimer)
self:PlayerPin(true)
local text = map.ZoneName[1]..WHITE.." ["..map.Acronym.."]\n"..
GOLD .. "Location: ".. WHITE..map.Location[1].."\n"..
GOLD .. "Level Range: ".. WHITE..map.LevelRange.."\n"..
GOLD .. "Minimum Level: ".. WHITE..map.MinLevel.."\n"..
GOLD .. "Player Limit: ".. WHITE..map.PlayerLimit
if map.Reputation and type(map.Reputation) == "table" then
text = text .. "\n" .. GOLD .. AL["Reputation"] .. ": ".. WHITE .. map.Reputation[playerFaction]
elseif map.Reputation then
text = text .. "\n" .. GOLD .. AL["Reputation"] .. ": ".. WHITE .. map.Reputation
end
Atlasloot_HeaderLabel:SetText(text)
self:SetMapButtonText(mapID, mapNum)
end
function AtlasLoot:SetMapButtonText(mapID, mapNum)
local map = AtlasLoot_MapData[mapID]
mapNum = mapNum or 1
local text
if map[mapNum][1].Zone then
text = map[mapNum][2][1]
else
text = map[mapNum][1][1]
end
AtlasLootDefaultFrame_MapButton:SetText(text)
end
--drop down map menu
function AtlasLoot:MapMenuOpen(frame)
local mapID = self.CurrentMap
local map = AtlasLoot_MapData[mapID]
local menuList = { [1] = {} }
for i,v in ipairs(map) do
local text
if v[1].Zone then
text = map[i][2][1]
else
text = v[1][1]
end
tinsert(menuList[1], {text = WHITE..text, func = function() self:MapOnShow(mapID, i, true) end, notCheckable = true, closeWhenClicked = true, textHeight = 12, textWidth = 12})
end
tinsert(menuList[1], {divider = 35})
tinsert(menuList[1], {text = ORANGE..AL["Open AscensionDB To Zone Map"], func = function() self:OpenDBURL(AtlasLoot_MapData[self.CurrentMap].ZoneName[2] , "zone") end, notCheckable = true, closeWhenClicked = true, textHeight = 12, textWidth = 12})
tinsert(menuList[1], {close = true, divider = 35})
self:OpenDewdropMenu(frame, menuList)
end
+182 -290
View File
@@ -2,152 +2,102 @@
Options.lua
Functions:
AtlasLoot_OptionsPanelOnLoad(panel)
AtlasLootOptions_Init()
AtlasLootOptions_OnLoad()
AtlasLootOptions_SafeLinksToggle()
AtlasLootOptions_AllLinksToggle()
AtlasLootOptions_DefaultTTToggle()
AtlasLootOptions_LootlinkTTToggle()
AtlasLootOptions_ItemSyncTTToggle()
AtlasLootOptions_EquipCompareToggle()
AtlasLootOptions_OpaqueToggle()
AtlasLootOptions_ItemIDToggle()
AtlasLootOptions_MinimapToggle()
AtlasLootOptions_LoDSpam()
AtlasLootOptions_LoDStartup()
AtlasLoot_SetupLootBrowserSlider(frame, mymin, mymax, step)
AtlasLoot_UpdateLootBrowserSlider(frame)
AtlasLoot_DisplayHelp();
AtlasLoot_CreateOptionsInfoTooltips()
AtlasLoot:OptionsInit()
AtlasLoot:OptionsAllLinksToggle()
AtlasLoot:OptionsEquipCompareToggle()
AtlasLoot:OptionsOpaqueToggle()
AtlasLoot:OptionsItemIDToggle()
AtlasLoot:OptionsLoDStartup()
AtlasLoot:SetupLootBrowserSlider(frame, mymin, mymax, step)
AtlasLoot:UpdateLootBrowserSlider(frame)
AtlasLoot:DisplayHelp()
AtlasLoot:CreateOptionsInfoTooltips()
]]
local GREY = "|cff999999";
local RED = "|cffff0000";
local WHITE = "|cffFFFFFF";
local GREEN = "|cff1eff00";
local PURPLE = "|cff9F3FFF";
local BLUE = "|cff0070dd";
local ORANGE = "|cffFF8400";
local GREY = "|cff999999"
local WHITE = "|cffFFFFFF"
local GREEN = "|cff1eff00"
local ORANGE = "|cffFF8400"
--Invoke libraries
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
function AtlasLoot_OptionsPanelOnLoad(panel)
panel.name=AL["AtlasLoot"];
InterfaceOptions_AddCategory(panel);
panel.name=AL["AtlasLoot"]
InterfaceOptions_AddCategory(panel)
end
function AtlasLootOptions_Init()
function AtlasLoot:OptionsInit()
--Initialise all the check boxes on the options frame
AtlasLootOptionsFrameSafeLinks:SetChecked(AtlasLoot.db.profile.SafeLinks);
AtlasLootOptionsFrameDefaultTT:SetChecked(AtlasLoot.db.profile.DefaultTT);
AtlasLootOptionsFrameLootlinkTT:SetChecked(AtlasLoot.db.profile.LootlinkTT);
AtlasLootOptionsFrameItemSyncTT:SetChecked(AtlasLoot.db.profile.ItemSyncTT);
AtlasLootOptionsFrameEquipCompare:SetChecked(AtlasLoot.db.profile.EquipCompare);
AtlasLootOptionsFrameOpaque:SetChecked(AtlasLoot.db.profile.Opaque);
AtlasLootOptionsFrameAutoInstance:SetChecked(AtlasLoot.db.profile.AutoCurrentInstance);
AtlasLootOptionsFrameItemID:SetChecked(AtlasLoot.db.profile.ItemIDs);
AtlasLootOptionsFrameLoDStartup:SetChecked(AtlasLoot.db.profile.LoadAllLoDStartup);
AtlasLootOptionsFrameLootBrowserScale:SetValue(AtlasLoot.db.profile.LootBrowserScale);
AtlasLootOptionsFrameEquipCompare:SetChecked(self.db.profile.EquipCompare)
AtlasLootOptionsFrameOpaque:SetChecked(self.db.profile.Opaque)
AtlasLootOptionsFrameAutoInstance:SetChecked(self.db.profile.AutoCurrentInstance)
AtlasLootOptionsFrameItemID:SetChecked(self.db.profile.ItemIDs)
AtlasLootOptionsFrameLootBrowserScale:SetValue(self.db.profile.LootBrowserScale)
AtlasLootOptionsMinimapIcon:SetChecked(self.db.profile.minimap.hide)
AtlasLootOptionsFrameCraftingInfo:SetChecked(self.db.profile.recipeExtraInfoSwitch)
end
function AtlasLootOptions_OnLoad()
--Disable checkboxes of missing addons
if( not LootLink_SetTooltip ) then
AtlasLootOptionsFrameLootlinkTT:Disable();
AtlasLootOptionsFrameLootlinkTTText:SetText(AL["|cff9d9d9dLootlink Tooltips|r"]);
end
if( not ItemSync ) then
AtlasLootOptionsFrameItemSyncTT:Disable();
AtlasLootOptionsFrameItemSyncTTText:SetText(AL["|cff9d9d9dItemSync Tooltips|r"]);
end
AtlasLootOptions_Init();
temp=AtlasLoot.db.profile.SafeLinks;
end
function AtlasLootOptions_SafeLinksToggle()
if(AtlasLoot.db.profile.SafeLinks) then
AtlasLoot.db.profile.SafeLinks = false;
AtlasLoot.db.profile.AllLinks = true;
--[[
AtlasLoot:OptionsToggle:
Toggle on/off the options window
]]
function AtlasLoot:OptionsToggle()
if InterfaceOptionsFrame_OpenToCategory and not InterfaceOptionsFrame:IsVisible() then
InterfaceOptionsFrame_OpenToCategory(AL["AtlasLoot"])
else
AtlasLoot.db.profile.SafeLinks = true;
AtlasLoot.db.profile.AllLinks = false;
end
AtlasLootOptions_Init();
end
function AtlasLootOptions_DefaultTTToggle()
AtlasLoot.db.profile.DefaultTT = true;
AtlasLoot.db.profile.LootlinkTT = false;
AtlasLoot.db.profile.ItemSyncTT = false;
AtlasLootOptions_Init();
end
function AtlasLootOptions_LootlinkTTToggle()
AtlasLoot.db.profile.DefaultTT = false;
AtlasLoot.db.profile.LootlinkTT = true;
AtlasLoot.db.profile.ItemSyncTT = false;
AtlasLootOptions_Init();
end
function AtlasLootOptions_ItemSyncTTToggle()
AtlasLoot.db.profile.DefaultTT = false;
AtlasLoot.db.profile.LootlinkTT = false;
AtlasLoot.db.profile.ItemSyncTT = true;
AtlasLootOptions_Init();
end
function AtlasLootOptions_OpaqueToggle()
AtlasLoot.db.profile.Opaque=AtlasLootOptionsFrameOpaque:GetChecked();
if (AtlasLoot.db.profile.Opaque) then
AtlasLootItemsFrame_Back:SetTexture(0, 0, 0, 1);
else
AtlasLootItemsFrame_Back:SetTexture(0, 0, 0, 0.65);
InterfaceOptionsFrame:Hide()
end
AtlasLootOptions_Init();
InterfaceOptionsFrame:SetFrameStrata("DIALOG")
end
function AtlasLoot:OptionsOpaqueToggle()
self.db.profile.Opaque = AtlasLootOptionsFrameOpaque:GetChecked()
if (self.db.profile.Opaque) then
AtlasLootItemsFrame_Back:SetTexture(0, 0, 0, 1)
Atlasloot_Difficulty_ScrollFrame_Back:SetTexture(0, 0, 0, 1)
Atlasloot_SubTableFrame_Back:SetTexture(0, 0, 0, 1)
else
AtlasLootItemsFrame_Back:SetTexture(0, 0, 0, 0.05)
Atlasloot_Difficulty_ScrollFrame_Back:SetTexture(0, 0, 0, 0.05)
Atlasloot_SubTableFrame_Back:SetTexture(0, 0, 0, 0.05)
end
self:OptionsInit()
end
function AtlasLoot:Options_AutoInstanceToggle()
AtlasLoot.db.profile.AutoCurrentInstance = AtlasLootOptionsFrameAutoInstance:GetChecked();
self.db.profile.AutoCurrentInstance = AtlasLootOptionsFrameAutoInstance:GetChecked()
end
function AtlasLootOptions_LoDStartup()
if (AtlasLoot.db.profile.LoadAllLoDStartup) then
AtlasLoot.db.profile.LoadAllLoDStartup = false;
else
AtlasLoot.db.profile.LoadAllLoDStartup = true;
end
AtlasLootOptions_Init();
function AtlasLoot:OptionsItemIDToggle()
self.db.profile.ItemIDs=AtlasLootOptionsFrameItemID:GetChecked()
self:OptionsInit()
end
function AtlasLootOptions_ItemIDToggle()
AtlasLoot.db.profile.ItemIDs=AtlasLootOptionsFrameItemID:GetChecked();
AtlasLootOptions_Init();
end
function AtlasLoot_SetupLootBrowserSlider(frame, mymin, mymax, step)
_G[frame:GetName().."Text"]:SetText(AL["Loot Browser Scale: "].." ("..frame:GetValue()..")");
frame:SetMinMaxValues(mymin, mymax);
_G[frame:GetName().."Low"]:SetText(mymin);
_G[frame:GetName().."High"]:SetText(mymax);
frame:SetValueStep(step);
function AtlasLoot:SetupLootBrowserSlider(frame, mymin, mymax, step)
_G[frame:GetName().."Text"]:SetText(AL["Loot Browser Scale: "].." ("..frame:GetValue()..")")
frame:SetMinMaxValues(mymin, mymax)
_G[frame:GetName().."Low"]:SetText(mymin)
_G[frame:GetName().."High"]:SetText(mymax)
frame:SetValueStep(step)
self:OptionsInit()
end
--Borrowed from Atlas, thanks Dan!
local function round(num, idp)
local mult = 10 ^ (idp or 0);
return math.floor(num * mult + 0.5) / mult;
local mult = 10 ^ (idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function AtlasLoot_UpdateLootBrowserSlider(frame)
_G[frame:GetName().."Text"]:SetText(AL["Loot Browser Scale: "].." ("..round(frame:GetValue(),2)..")");
function AtlasLoot:UpdateLootBrowserSlider(frame)
_G[frame:GetName().."Text"]:SetText(AL["Loot Browser Scale: "].." ("..round(frame:GetValue(),2)..")")
end
function AtlasLoot_UpdateLootBrowserScale()
AtlasLootDefaultFrame:SetScale(AtlasLoot.db.profile.LootBrowserScale);
function AtlasLoot:UpdateLootBrowserScale()
AtlasLootDefaultFrame:SetScale(self.db.profile.LootBrowserScale)
end
function AtlasLoot_DisplayHelp()
function AtlasLoot:DisplayHelp()
if not _G["AtlasLootHelpFrame_HelpText"] then
local framewidht = InterfaceOptionsFramePanelContainer:GetWidth()
local panel3 = CreateFrame("ScrollFrame", "AtlasLootHelpFrame_HelpTextFrameScroll", AtlasLootHelpFrame, "UIPanelScrollFrameTemplate")
@@ -169,16 +119,13 @@ function AtlasLoot_DisplayHelp()
local Text = scc:CreateFontString("AtlasLootHelpFrame_HelpText","OVERLAY","GameFontNormal")
Text:SetPoint("TOPLEFT", scc, "TOPLEFT", 0, 0)
Text:SetText(
ORANGE..AL["How to open the standalone Loot Browser:"].."\n"..
WHITE..AL["If you have AtlasLootFu enabled, click the minimap button, or alternatively a button generated by a mod like Titan or FuBar. Finally, you can type '/al' in the chat window."].."\n\n"..
ORANGE..AL["How to link an item to someone else:"].."\n"..
WHITE..AL["Shift+Left Click the item like you would for any other in-game item"].."\n\n"..
ORANGE..AL["How to view an item in the Dressing Room:"].."\n"..
WHITE..AL["Simply Ctrl+Left Click on the item. Sometimes the dressing room window is hidden behind the Atlas or AtlasLoot windows, so if nothing seems to happen move your Atlas or AtlasLoot windows and see if anything is hidden."].."\n\n"..
ORANGE..AL["How to open an item to its AscensionDB page in your browser window:"].."\n"..
WHITE..AL["Alt+Right Click any item to open it in a browser window."].."\n\n"..
ORANGE..AL["How to add an item to the wishlist:"].."\n"..
WHITE..AL["Alt+Left Click any item to add it to the wishlist."].."\n\n"..
WHITE..AL["Right Click any item and open the context menu and click add to wishlist."].."\n\n"..
WHITE..AL["Or Alt+Left Click any item to add it to the default wishlist."].."\n\n"..
ORANGE..AL["How to delete an item from the wishlist:"].."\n"..
WHITE..AL["While on the wishlist screen, just Alt+Left Click on an item to delete it."].."\n\n"..
ORANGE..AL["What else does the wishlist do?"].."\n"..
@@ -188,7 +135,7 @@ function AtlasLoot_DisplayHelp()
ORANGE..AL["HELP!! I have broken the mod somehow!"].."\n"..
WHITE..AL["Use the reset buttons available in the options menu, or type '/al reset' in your chat window."].."\n\n"..
GREY..AL["For further help, see our website and forums: "]..GREEN.."https://discord.gg/uYCE2X2FgA"
);
)
Text:SetWidth(framewidht-80)
Text:SetJustifyH("LEFT")
Text:SetJustifyV("TOP")
@@ -196,195 +143,140 @@ function AtlasLoot_DisplayHelp()
end
--[[
AtlasLoot_CreateOptionsInfoTooltips()
AtlasLoot:CreateOptionsInfoTooltips()
Adds explanatory tooltips to Atlasloot options
]]
function AtlasLoot_CreateOptionsInfoTooltips()
AtlasLoot:AddTooltip("AtlasLootOptionsFrameDefaultTT", nil) -- AL["Default Tooltips"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameLootlinkTT", nil) -- AL["Lootlink Tooltips"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameItemSyncTT", nil) -- AL["ItemSync Tooltips"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameOpaque", nil) -- AL["Make Loot Table Opaque"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameItemID", nil) -- AL["Show itemIDs at all times"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameSafeLinks", nil) -- AL["Safe Chat Links |cff1eff00(recommended)|r"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameEquipCompare", nil) -- AL["Show Comparison Tooltips"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameLoDSpam", nil) -- AL["Notify on LoD Module Load"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrameLootBrowserScale", nil) -- Scale SLIDER
AtlasLoot:AddTooltip("AtlasLootOptionsFrame_ResetAtlasLoot", nil) -- AL["Reset Frames"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrame_ResetWishlist", nil) -- AL["Reset Wishlist"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrame_ResetQuicklooks", nil) -- AL["Reset Quicklooks"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrame_FuBarShow", nil) -- AL["Show FuBar Plugin"]
AtlasLoot:AddTooltip("AtlasLootOptionsFrame_FuBarHide", nil) -- AL["Hide FuBar Plugin"]
AtlasLoot:AddTooltip("AtlasLoot_SelectLootBrowserStyle", nil)
function AtlasLoot:CreateOptionsInfoTooltips()
self:AddTooltip("AtlasLootOptionsFrameOpaque", nil) -- AL["Make Loot Table Opaque"]
self:AddTooltip("AtlasLootOptionsFrameItemID", nil) -- AL["Show itemIDs at all times"]
self:AddTooltip("AtlasLootOptionsFrameEquipCompare", nil) -- AL["Show Comparison Tooltips"]
self:AddTooltip("AtlasLootOptionsFrameLoDSpam", nil) -- AL["Notify on LoD Module Load"]
self:AddTooltip("AtlasLootOptionsFrameLootBrowserScale", nil) -- Scale SLIDER
self:AddTooltip("AtlasLootOptionsFrame_ResetAtlasLoot", nil) -- AL["Reset Frames"]
self:AddTooltip("AtlasLootOptionsFrame_ResetWishlist", nil) -- AL["Reset Wishlist"]
self:AddTooltip("AtlasLootOptionsFrame_ResetQuicklooks", nil) -- AL["Reset Favorites"]
self:AddTooltip("AtlasLoot_SelectLootBrowserStyle", nil)
end
local function AtlasLoot_SelectLootBrowserStyle_Initialize()
local info;
info = {
text = AL["New Style"];
func = AtlasLoot_SelectLootBrowserStyle_OnClick;
};
UIDropDownMenu_AddButton(info);
info = {
text = AL["Classic Style"];
func = AtlasLoot_SelectLootBrowserStyle_OnClick;
};
UIDropDownMenu_AddButton(info);
end
function AtlasLoot_OptionsOnShow()
AtlasLoot_SelectLootBrowserStyle_Label:SetText(AL["Loot Browser Style:"]);
UIDropDownMenu_Initialize(AtlasLoot_SelectLootBrowserStyle, AtlasLoot_SelectLootBrowserStyle_Initialize);
UIDropDownMenu_SetSelectedID(AtlasLoot_SelectLootBrowserStyle, AtlasLoot.db.profile.LootBrowserStyle);
UIDropDownMenu_SetWidth(AtlasLoot_SelectLootBrowserStyle, 150);
end
function AtlasLoot_SelectLootBrowserStyle_OnClick()
local thisID = this:GetID();
UIDropDownMenu_SetSelectedID(AtlasLoot_SelectLootBrowserStyle, thisID);
AtlasLoot.db.profile.LootBrowserStyle = thisID;
if( AtlasLoot.db.profile.LootBrowserStyle == 1 ) then
AtlasLoot:SetNewStyle("new");
else
AtlasLoot:SetNewStyle("old");
local function selectLootBrowserStyle_Initialize()
for _, skin in pairs(AtlasLoot.skinKeys) do
local info = {
text = skin[2],
func = AtlasLoot.SelectLootBrowserStyle_OnClick,
}
UIDropDownMenu_AddButton(info)
end
AtlasLoot_OptionsOnShow();
end
function AtlasLoot:OptionsOnShow()
AtlasLoot_SelectLootBrowserStyle_Label:SetText(AL["Change AtlasLoot Skin:"])
UIDropDownMenu_Initialize(AtlasLoot_SelectLootBrowserStyle, selectLootBrowserStyle_Initialize)
UIDropDownMenu_SetSelectedID(AtlasLoot_SelectLootBrowserStyle, self.db.profile.LootBrowserStyle)
UIDropDownMenu_SetWidth(AtlasLoot_SelectLootBrowserStyle, 150)
end
function AtlasLoot:SelectLootBrowserStyle_OnClick()
local thisID = this:GetID()
UIDropDownMenu_SetSelectedID(AtlasLoot_SelectLootBrowserStyle, thisID)
AtlasLoot.db.profile.LootBrowserStyle = thisID
if AtlasLoot.db.profile.LootBrowserStyle then
AtlasLoot:SetSkin(AtlasLoot.skinKeys[AtlasLoot.db.profile.LootBrowserStyle][1])
end
AtlasLoot:OptionsOnShow()
end
function AtlasLoot:CreateOptionsFrame()
local helpframe = CreateFrame("Frame", "AtlasLootHelpFrame")
helpframe:SetSize(425,450);
helpframe:Hide();
helpframe:SetPoint("CENTER");
helpframe.title = helpframe:CreateFontString("AtlasLootHelpFrame_Title", "OVERLAY", "GameFontHighlightLarge");
helpframe.title:SetJustifyH("CENTER");
helpframe.title:SetSize(400,30);
helpframe.title:SetPoint("TOP", "AtlasLootHelpFrame","TOP");
helpframe.title:SetText(AL["AtlasLoot Help"]);
helpframe:SetScript("OnShow", function() AtlasLoot_DisplayHelp() end);
helpframe:SetSize(425,450)
helpframe:Hide()
helpframe:SetPoint("CENTER")
helpframe.title = helpframe:CreateFontString("AtlasLootHelpFrame_Title", "OVERLAY", "GameFontHighlightLarge")
helpframe.title:SetJustifyH("CENTER")
helpframe.title:SetSize(400,30)
helpframe.title:SetPoint("TOP", "AtlasLootHelpFrame","TOP")
helpframe.title:SetText(AL["AtlasLoot Help"])
helpframe:SetScript("OnShow", function() self:DisplayHelp() end)
local optframe = CreateFrame("Frame", "AtlasLootOptionsFrame");
optframe:Hide();
optframe:SetSize(425,405);
optframe:SetPoint("CENTER");
optframe.title = optframe:CreateFontString("AtlasLoot_OptionsTitle", "OVERLAY", "GameFontHighlightLarge");
optframe.title:SetJustifyH("CENTER");
optframe.title:SetSize(400,30);
optframe.title:SetPoint("TOP", "AtlasLootOptionsFrame","TOP");
optframe.title:SetText(ATLASLOOT_VERSION);
optframe.foobar = optframe:CreateFontString("AtlasLootOptionsFrame_FuBarNotice", "OVERLAY", "GameFontNormal");
optframe.foobar:SetPoint("BOTTOM",0,45);
optframe.foobar:SetText(AL["The Minimap Button is generated by the FuBar Plugin."].."\n"..AL["This is automatic, you do not need FuBar installed."]);
optframe:SetScript("OnShow", function() AtlasLoot_OptionsOnShow() end);
local optframe = CreateFrame("Frame", "AtlasLootOptionsFrame")
optframe:Hide()
optframe:SetSize(425,405)
optframe:SetPoint("CENTER")
optframe.title = optframe:CreateFontString("AtlasLoot_OptionsTitle", "OVERLAY", "GameFontHighlightLarge")
optframe.title:SetJustifyH("CENTER")
optframe.title:SetSize(400,30)
optframe.title:SetPoint("TOP", "AtlasLootOptionsFrame","TOP")
optframe.title:SetText(self.Version)
optframe:SetScript("OnShow", function() self:OptionsOnShow() end)
local deftt = CreateFrame("CheckButton", "AtlasLootOptionsFrameDefaultTT", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
deftt:SetPoint("TOPLEFT",5,-40);
AtlasLootOptionsFrameDefaultTTText:SetText(AL["Default Tooltips"]);
deftt:SetScript("OnClick", function() AtlasLootOptions_DefaultTTToggle() end);
local opaque = CreateFrame("CheckButton", "AtlasLootOptionsFrameOpaque", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
opaque:SetPoint("TOPLEFT",5,-40)
AtlasLootOptionsFrameOpaqueText:SetText(AL["Make Loot Table Opaque"])
opaque:SetScript("OnClick", function() self:OptionsOpaqueToggle() end)
local lootlnk = CreateFrame("CheckButton", "AtlasLootOptionsFrameLootlinkTT", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
lootlnk:SetPoint("TOPLEFT",5,-70);
AtlasLootOptionsFrameLootlinkTTText:SetText(AL["Lootlink Tooltips"]);
lootlnk:SetScript("OnClick", function() AtlasLootOptions_LootlinkTTToggle() end);
local autoInstance = CreateFrame("CheckButton", "AtlasLootOptionsFrameAutoInstance", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
autoInstance:SetPoint("TOPLEFT",5,-70)
AtlasLootOptionsFrameAutoInstanceText:SetText(AL["Auto Load Instance Loot Pages"])
autoInstance:SetScript("OnClick", function() self:Options_AutoInstanceToggle() end)
local itemsync = CreateFrame("CheckButton", "AtlasLootOptionsFrameItemSyncTT", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
itemsync:SetPoint("TOPLEFT",5,-100);
AtlasLootOptionsFrameItemSyncTTText:SetText(AL["ItemSync Tooltips"]);
itemsync:SetScript("OnClick", function() AtlasLootOptions_ItemSyncTTToggle() end);
local craftingInfo = CreateFrame("CheckButton", "AtlasLootOptionsFrameCraftingInfo", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
craftingInfo:SetPoint("TOPLEFT",5,-100)
AtlasLootOptionsFrameCraftingInfoText:SetText(AL["Only show crafting source while colding CTRL"])
craftingInfo:SetScript("OnClick", function() self.db.profile.recipeExtraInfoSwitch = not self.db.profile.recipeExtraInfoSwitch end)
local opaque = CreateFrame("CheckButton", "AtlasLootOptionsFrameOpaque", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
opaque:SetPoint("TOPLEFT",5,-130);
AtlasLootOptionsFrameOpaqueText:SetText(AL["Make Loot Table Opaque"]);
opaque:SetScript("OnClick", function() AtlasLootOptions_OpaqueToggle() end);
local itemid = CreateFrame("CheckButton", "AtlasLootOptionsFrameItemID", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
itemid:SetPoint("TOP",5,-70)
AtlasLootOptionsFrameItemIDText:SetText(AL["Show itemIDs at all times"])
itemid:SetScript("OnClick", function() self:OptionsItemIDToggle() end)
local autoInstance = CreateFrame("CheckButton", "AtlasLootOptionsFrameAutoInstance", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
autoInstance:SetPoint("TOPLEFT",5,-160);
AtlasLootOptionsFrameAutoInstanceText:SetText(AL["Auto Load Instance Loot Pages"]);
autoInstance:SetScript("OnClick", function() AtlasLoot:Options_AutoInstanceToggle() end);
local miniMap = CreateFrame("CheckButton", "AtlasLootOptionsMinimapIcon", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
miniMap:SetPoint("TOP",5,-100)
AtlasLootOptionsMinimapIconText:SetText(AL["Hide minimap icon"])
miniMap:SetScript("OnClick", function() self:ToggleMinimap() end)
local itemid = CreateFrame("CheckButton", "AtlasLootOptionsFrameItemID", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
itemid:SetPoint("TOP",5,-130);
AtlasLootOptionsFrameItemIDText:SetText(AL["Show itemIDs at all times"]);
itemid:SetScript("OnClick", function() AtlasLootOptions_ItemIDToggle() end);
local equip = CreateFrame("CheckButton", "AtlasLootOptionsFrameEquipCompare", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate")
equip:SetPoint("TOP",5,-40)
AtlasLootOptionsFrameEquipCompareText:SetText(AL["Show Comparison Tooltips"])
equip:SetScript("OnClick", function() self.db.profile.EquipCompare = not self.db.profile.EquipCompare end)
local lod = CreateFrame("CheckButton", "AtlasLootOptionsFrameLoDStartup", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
lod:SetPoint("TOP",5,-40);
AtlasLootOptionsFrameLoDStartupText:SetText(AL["Load Loot Modules at Startup"]);
lod:SetScript("OnClick", function() AtlasLootOptions_LoDStartup() end);
local sStyle = CreateFrame("Button", "AtlasLoot_SelectLootBrowserStyle", AtlasLootOptionsFrame, "UIDropDownMenuTemplate")
sStyle.lable = sStyle:CreateFontString("AtlasLoot_SelectLootBrowserStyle_Label", "BACKGROUND", "GameFontNormalSmall")
sStyle.lable:SetPoint("LEFT", "AtlasLoot_SelectLootBrowserStyle", "RIGHT",5,2)
sStyle:SetPoint("TOPLEFT",-10,-220)
local safe = CreateFrame("CheckButton", "AtlasLootOptionsFrameSafeLinks", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
safe:SetPoint("TOP",5,-70);
AtlasLootOptionsFrameSafeLinksText:SetText(AL["Safe Chat Links"]);
safe:SetScript("OnClick", function() AtlasLootOptions_SafeLinksToggle() end);
local bscale = CreateFrame("Slider", "AtlasLootOptionsFrameLootBrowserScale", AtlasLootOptionsFrame,"OptionsSliderTemplate")
bscale:SetSize(240,16)
bscale:SetPoint("TOP", 0,-300)
bscale:SetScript("OnShow", function() self:SetupLootBrowserSlider(bscale, 0.25, 1.5, 0.01) end)
bscale:SetScript("OnValueChanged", function()
self:UpdateLootBrowserSlider(bscale)
self.db.profile.LootBrowserScale = bscale:GetValue()
self:UpdateLootBrowserScale()
end)
local equip = CreateFrame("CheckButton", "AtlasLootOptionsFrameEquipCompare", AtlasLootOptionsFrame, "OptionsCheckButtonTemplate");
equip:SetPoint("TOP",5,-100);
AtlasLootOptionsFrameEquipCompareText:SetText(AL["Show Comparison Tooltips"]);
equip:SetScript("OnClick", function()
if(AtlasLoot.db.profile.EquipCompare) then
AtlasLoot.db.profile.EquipCompare = false;
if (EquipCompare_UnregisterTooltip) then
EquipCompare_UnregisterTooltip(AtlasLootTooltip);
end
else
AtlasLoot.db.profile.EquipCompare = true;
if (EquipCompare_RegisterTooltip) then
EquipCompare_RegisterTooltip(AtlasLootTooltip);
end
end
end);
local resetwish = CreateFrame("Button", "AtlasLootOptionsFrame_ResetWishlist", AtlasLootOptionsFrame, "OptionsButtonTemplate")
resetwish:SetSize(130,25)
resetwish:SetPoint("TOP", 0, -325)
resetwish:SetText(AL["Reset Wishlist"])
resetwish:SetScript("OnClick", function() self:Reset("wishlist") end)
resetwish:SetScript("OnShow", function() resetwish:SetWidth(AtlasLootOptionsFrame_ResetWishlist:GetTextWidth()+20) end)
local sStyle = CreateFrame("Button", "AtlasLoot_SelectLootBrowserStyle", AtlasLootOptionsFrame, "UIDropDownMenuTemplate");
sStyle.lable = sStyle:CreateFontString("AtlasLoot_SelectLootBrowserStyle_Label", "BACKGROUND", "GameFontNormalSmall");
sStyle.lable:SetPoint("RIGHT", "AtlasLoot_SelectLootBrowserStyle", "LEFT",15,2);
sStyle:SetPoint("TOP",30,-220);
local bscale = CreateFrame("Slider", "AtlasLootOptionsFrameLootBrowserScale", AtlasLootOptionsFrame,"OptionsSliderTemplate");
bscale:SetSize(240,16);
bscale:SetPoint("TOP", 0,-300);
bscale:SetScript("OnShow", function(self) AtlasLoot_SetupLootBrowserSlider(self, 0.25, 1.5, 0.01) end);
bscale:SetScript("OnValueChanged", function(self)
AtlasLoot_UpdateLootBrowserSlider(self);
AtlasLoot.db.profile.LootBrowserScale = self:GetValue();
AtlasLoot_UpdateLootBrowserScale();
end);
local resetwish = CreateFrame("Button", "AtlasLootOptionsFrame_ResetWishlist", AtlasLootOptionsFrame, "OptionsButtonTemplate");
resetwish:SetSize(130,25);
resetwish:SetPoint("TOP", 0, -325);
resetwish:SetText(AL["Reset Wishlist"]);
resetwish:SetScript("OnClick", function() AtlasLoot_Reset("wishlist") end);
resetwish:SetScript("OnShow", function() resetwish:SetWidth(AtlasLootOptionsFrame_ResetWishlist:GetTextWidth()+20) end);
local resetAtlas = CreateFrame("Button", "AtlasLootOptionsFrame_ResetAtlasLoot", AtlasLootOptionsFrame, "OptionsButtonTemplate");
resetAtlas:SetSize(130,25);
resetAtlas:SetText(AL["Reset Frames"]);
resetAtlas:SetPoint("RIGHT", "AtlasLootOptionsFrame_ResetWishlist", "LEFT", -10, 0);
resetAtlas:SetScript("OnClick", function() AtlasLoot_Reset("frames") end);
local resetAtlas = CreateFrame("Button", "AtlasLootOptionsFrame_ResetAtlasLoot", AtlasLootOptionsFrame, "OptionsButtonTemplate")
resetAtlas:SetSize(130,25)
resetAtlas:SetText(AL["Reset Frames"])
resetAtlas:SetPoint("RIGHT", "AtlasLootOptionsFrame_ResetWishlist", "LEFT", -10, 0)
resetAtlas:SetScript("OnClick", function() self:Reset("frames") end)
resetAtlas:SetScript("OnShow", function() resetAtlas:SetWidth(AtlasLootOptionsFrame_ResetAtlasLoot:GetTextWidth()+20) end)
local resetquick = CreateFrame("Button", "AtlasLootOptionsFrame_ResetQuicklooks", AtlasLootOptionsFrame, "OptionsButtonTemplate");
resetquick:SetSize(130,25);
resetquick:SetText(AL["Reset Quicklooks"]);
resetquick:SetPoint("LEFT", "AtlasLootOptionsFrame_ResetWishlist", "RIGHT", 10, 0);
resetquick:SetScript("OnClick", function() AtlasLoot_Reset("quicklooks") end);
local resetquick = CreateFrame("Button", "AtlasLootOptionsFrame_ResetQuicklooks", AtlasLootOptionsFrame, "OptionsButtonTemplate")
resetquick:SetSize(130,25)
resetquick:SetText(AL["Reset Favorites"])
resetquick:SetPoint("LEFT", "AtlasLootOptionsFrame_ResetWishlist", "RIGHT", 10, 0)
resetquick:SetScript("OnClick", function() self:Reset("quicklooks") end)
resetquick:SetScript("OnShow", function() resetquick:SetWidth(AtlasLootOptionsFrame_ResetQuicklooks:GetTextWidth()+20) end)
local fooshow = CreateFrame("Button", "AtlasLootOptionsFrame_FuBarShow", AtlasLootOptionsFrame, "OptionsButtonTemplate");
fooshow:SetSize(150,25);
fooshow:SetText(AL["Show FuBar Plugin"]);
fooshow:SetPoint("TOP", "AtlasLootOptionsFrame", "TOP", -85, -390);
fooshow:SetScript("OnClick", function()
if AtlasLootFu then
AtlasLootFu:Show();
end
end);
end
local foohide = CreateFrame("Button", "AtlasLootOptionsFrame_FuBarHide", AtlasLootOptionsFrame, "OptionsButtonTemplate");
foohide:SetSize(150,25);
foohide:SetText(AL["Hide FuBar Plugin"]);
foohide:SetPoint("TOP", "AtlasLootOptionsFrame", "TOP", 85, -390);
foohide:SetScript("OnClick", function()
if AtlasLootFu then
AtlasLootFu:Hide();
end
end);
AtlasLoot:CreateOptionsFrame()
+206 -182
View File
@@ -1,18 +1,14 @@
local GREY = "|cff999999";
local RED = "|cffff0000";
local WHITE = "|cffFFFFFF";
local GREEN = "|cff1eff00";
local PURPLE = "|cff9F3FFF";
local BLUE = "|cff0070dd";
local ORANGE = "|cffFF8400";
local RED = "|cffff0000"
local WHITE = "|cffFFFFFF"
local GREEN = "|cff1eff00"
local ORANGE = "|cffFF8400"
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
local modules = {"AtlasLoot_BurningCrusade", "AtlasLoot_Vanity", "AtlasLoot_Crafting", "AtlasLoot_OriginalWoW", "AtlasLoot_WorldEvents", "AtlasLoot_WrathoftheLichKing"};
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
-- Supported Operators
local OP_AND = "&"
-- multi-character patterns must come before single-character patterns
local RELATIONAL_OPERATORS = {">=", "<=", "<>", "<", ">", "="};
local RELATIONAL_OPERATORS = {">=", "<=", "<>", "<", ">", "="}
-- Supported Stat Filters
local STAT_FILTERS = {
@@ -82,9 +78,6 @@ local STAT_FILTERS = {
["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",
@@ -133,23 +126,23 @@ local STAT_FILTERS = {
["resistancearcane"] = "RESISTANCE6_NAME",
["resarcane"] = "RESISTANCE6_NAME",
["resarc"] = "RESISTANCE6_NAME"
};
}
local SOCKET_FILTERS = {
["socket"] = true,
["sockets"] = true,
["gem"] = true,
["gems"] = true
};
}
local SOCKET_TYPES = {"EMPTY_SOCKET_BLUE", "EMPTY_SOCKET_RED", "EMPTY_SOCKET_YELLOW", "EMPTY_SOCKET_META", "EMPTY_SOCKET_NO_COLOR"};
local SOCKET_TYPES = {"EMPTY_SOCKET_BLUE", "EMPTY_SOCKET_RED", "EMPTY_SOCKET_YELLOW", "EMPTY_SOCKET_META", "EMPTY_SOCKET_NO_COLOR"}
local INFO_FILTERS = {
["ilvl"] = true,
["minlvl"] = true
-- ["type"] = true,
-- ["subtype"] = true,
};
}
local QUALITY_FILTERS = {
["poor"] = 0,
@@ -160,7 +153,7 @@ local QUALITY_FILTERS = {
["legendary"] = 5,
["artifact"] = 6,
["heirloom"] = 7
};
}
local SLOT_FILTERS = {
["none"] = "INVTYPE_NON_EQUIP",
@@ -195,7 +188,7 @@ local SLOT_FILTERS = {
["rangedright"] = "INVTYPE_RANGEDRIGHT",
["quiver"] = "INVTYPE_QUIVER",
["relic"] = "INVTYPE_RELIC"
};
}
local TYPE_FILTERS = {
["cloth"] = "Cloth",
@@ -236,9 +229,9 @@ local NON_EQUIPABLE_SLOTS = {
["INVTYPE_BAG"] = true,
["INVTYPE_AMMO"] = true,
["INVTYPE_QUIVER"] = true
};
}
SLASH_ATLASLOOTHELP1 = "/atlasloothelp";
SLASH_ATLASLOOTHELP1 = "/atlasloothelp"
SlashCmdList["ATLASLOOTHELP"] = function(msg, editBox)
local function show(caption, t)
local keys = {}
@@ -260,13 +253,13 @@ SlashCmdList["ATLASLOOTHELP"] = function(msg, editBox)
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("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_ATLASLOOTSEARCH1 = "/atlaslootsearch";
SLASH_ATLASLOOTSEARCH2 = "/als";
SLASH_ATLASLOOTSEARCH1 = "/atlaslootsearch"
SLASH_ATLASLOOTSEARCH2 = "/als"
SlashCmdList["ATLASLOOTSEARCH"] = function(search, editBox)
AtlasLootDefaultFrame:Show()
if search and search ~= '' then
@@ -327,7 +320,7 @@ local function IsItemLevelFilterMatch(term, itemLvl)
return
end
local searchedValue = tonumber(term.right);
local searchedValue = tonumber(term.right)
if not searchedValue then
ThrowQueryError("ilvl search requires a numeric argument")
end
@@ -358,11 +351,11 @@ local function IsItemSocketMatch(term, stats)
ThrowQueryError("'%s' requires a numeric argument", term.left)
end
local socketCount = 0;
local socketCount = 0
for _, socketType in pairs(SOCKET_TYPES) do
local statValue = tonumber(stats[socketType]);
local statValue = tonumber(stats[socketType])
if statValue then
socketCount = socketCount + statValue;
socketCount = socketCount + statValue
end
end
@@ -374,7 +367,7 @@ local function IsMinLevelFilterMatch(term, minLvl)
return
end
local searchedValue = tonumber(term.right);
local searchedValue = tonumber(term.right)
if not searchedValue then
ThrowQueryError("minlvl search requires a numeric argument")
end
@@ -413,14 +406,14 @@ local function IsItemTypeMatch(term, itemEquipType)
ThrowQueryError("unrecognized type name: \"%s\"", term.right)
end
return type == itemEquipType;
return type == itemEquipType
end
local function nameMatches(name, searchText)
if AtlasLoot.db.profile.PartialMatching then
return string.find(string.lower(name), string.lower(searchText));
function AtlasLoot:NameMatches(name, searchText)
if self.db.profile.PartialMatching then
return string.find(string.lower(name), string.lower(searchText))
else
return string.lower(name) == string.lower(searchText);
return string.lower(name) == string.lower(searchText)
end
end
@@ -502,9 +495,6 @@ local RelationalFunctions = {
["armourpen"] = {IsItemStatMatch, 7},
["arp"] = {IsItemStatMatch, 7},
["expertise"] = {IsItemStatMatch, 7},
["exp"] = {IsItemStatMatch, 7},
["dps"] = {IsItemStatMatch, 7},
["resilience"] = {IsItemStatMatch, 7},
@@ -556,30 +546,26 @@ local RelationalFunctions = {
}
local function ItemMatchesTerm(term, itemDetails)
function AtlasLoot:ItemMatchesTerm(term, itemDetails)
if term.relational then
local func, arg = unpack(RelationalFunctions[term.left]);
local func, arg = unpack(RelationalFunctions[term.left])
if func then
return func(term, itemDetails[arg]);
return func(term, itemDetails[arg])
end
return false;
return false
else
return nameMatches(itemDetails[1], term.name);
return self:NameMatches(itemDetails[1], term.name)
end
end
local function ItemMatchesAllTerms(searchTerms, itemDetails)
local function IsItemEquipableMatch(itemEquipLoc)
return not AtlasLoot.db.profile.EquipableFilter or ((itemEquipLoc and itemEquipLoc ~= '' and not NON_EQUIPABLE_SLOTS[itemEquipLoc]))
end
function AtlasLoot:ItemMatchesAllTerms(searchTerms, itemDetails)
for _, term in ipairs(searchTerms) do
if not ItemMatchesTerm(term, itemDetails) then
if not self:ItemMatchesTerm(term, itemDetails) then
return false
end
end
return true and IsItemEquipableMatch(itemDetails[5])
return true
end
local function ParseTerm(termText)
@@ -603,193 +589,231 @@ end
local function ParseQuery(searchText)
local terms = {}
for _, term in pairs(SplitString(searchText, OP_AND)) do
table.insert(terms, ParseTerm(term));
table.insert(terms, ParseTerm(term))
end
return terms
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=", "");
function AtlasLoot:GetItemDetails(itemId)
-- 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, _, itemSubType, _, itemEquipLoc = GetItemInfo(itemId)
return itemName, itemQuality, itemLvl, minLvl, itemEquipLoc, itemSubType, GetItemStats("item:" .. itemId)
end
local count = 0
local tablenum = 1
function AtlasLoot:AddItemToSearchResult(item, dataSource, dataID, tableNum)
if AtlasLootCharDB["SearchResult"][tablenum] == nil then
AtlasLootCharDB["SearchResult"][tablenum] = {Name = "Page "..tablenum}
end
local tableCopy = self:CloneTable(item)
tinsert(AtlasLootCharDB["SearchResult"][tablenum], tableCopy)
local tNum = #AtlasLootCharDB["SearchResult"][tablenum]
AtlasLootCharDB["SearchResult"][tablenum][tNum].lootTable = {{dataID, dataSource, tableNum}, "Source"}
AtlasLootCharDB["SearchResult"][tablenum][tNum][1] = (count % 30) + 1
count = count + 1
if (count) % 30 == 0 then
tablenum = tablenum + 1
end
end
local function DoSearch(searchText)
AtlasLootCharDB["SearchResult"] = {Name = "Search Result" , Type = "Search", Back = true};
AtlasLootCharDB.LastSearchedText = searchText;
local count = 0;
local tablenum = 1;
local searchTerms = ParseQuery(searchText);
local equipableFilterOn = AtlasLoot.db.profile.EquipableFilter;
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, _, itemSubType, _, itemEquipLoc = GetItemInfo(itemId);
if not itemName then
itemName = gsub(atlasName, "=q%d=", "")
end
return itemName, itemQuality, itemLvl, minLvl, itemEquipLoc, itemSubType, GetItemStats("item:" .. itemId)
end
local function AddItemToSearchResult(itemId, itemType, itemName, dataID, itemIdBackup, difCap, dataPage)
local lootPage = AtlasLoot_Data[dataID].Name or "Argh!";
if AtlasLootCharDB["SearchResult"][tablenum] == nil then
AtlasLootCharDB["SearchResult"][tablenum] = {Name = "Page "..tablenum};
end
table.insert(AtlasLootCharDB["SearchResult"][tablenum], {(count % 30) + 1, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "AtlasLoot_Data" .. "|" .. tostring(dataPage), itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap});
count = count + 1;
if (count) % 30 == 0 then
tablenum = tablenum + 1;
end
end
for dataID, data in pairs(AtlasLoot_Data) do
for dataPage, t in ipairs(data) do
for _, v in ipairs(t) do
if type(v) == "table" then
local _, itemId, itemType, atlasName = unpack(v)
if type(itemId) == "number" and itemId > 0 then
local itemIdBackup = itemId;
if #searchTerms == 1 and searchTerms[1].name then
if nameMatches(atlasName, searchTerms[1].name) then
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type), dataPage);
end
local showSearch
function AtlasLoot:ProcessItem(data)
if not data then return end
local itemData, dataID, tableNum, searchTerms, searchText = unpack(data)
if type(itemData) == "table" then
local itemID = itemData.itemID
local spellID = itemData.spellID
if spellID then
self:ItemsLoading(-1)
local spellName = GetSpellInfo(spellID)
if self:NameMatches(spellName, searchText) then
self:AddItemToSearchResult(itemData, "AtlasLoot_Data", dataID, tableNum)
if not showSearch then
self:ShowSearchResult()
showSearch = true
end
self:ItemFrameRefresh()
end
elseif itemID then
local item = Item:CreateFromID(itemID)
if item then
local function nextItem()
self:ItemsLoading(-1)
local itemDetails = {self:GetItemDetails(itemID)}
if self:ItemMatchesAllTerms(searchTerms, itemDetails) then
self:AddItemToSearchResult(itemData, "AtlasLoot_Data", dataID, tableNum)
if not showSearch then
self:ShowSearchResult()
showSearch = true
else
local difficultyCap = min(AtlasLoot_Difficulty:getMaxDifficulty(data.Type), ItemindexID);
itemId = AtlasLoot:FindId(itemId, difficultyCap, data.Type) or 2;
local item = Item:CreateFromID(itemId);
item:ContinueOnLoad(function()
local itemDetails = {GetItemDetails(item.itemID, atlasName)};
if ItemMatchesAllTerms(searchTerms, itemDetails) then
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type), dataPage);
end
end)
self:ItemFrameRefresh()
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, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type), dataPage);
end
end
if not item:GetInfo() then
item:ContinueOnLoad(function(itemID)
nextItem()
end)
else
nextItem()
end
end
end
end
end
local itemList = {}
function AtlasLoot:DoSearch(searchText)
AtlasLootCharDB["SearchResult"] = {Name = "Search Result" , Type = "Search", Back = true}
count = 0
tablenum = 1
showSearch = false
wipe(itemList)
local searchTerms = ParseQuery(searchText)
for dataID, data in pairs(AtlasLoot_Data) do
if self.db.profile.SearchOn.All or self.db.profile.SearchOn[data.Module] or (self.db.profile.SearchAscensionVanity and data.Module == "AtlasLoot_Ascension_Vanity") then
for tableNum, t in ipairs(data) do
for _, itemData in pairs(t) do
if itemData.itemID or itemData.spellID then
if data.Type then
itemData.Type = data.Type
if not itemData[self.Difficultys.MAX_DIF] then
itemData[self.Difficultys.MAX_DIF] = #self.Difficultys[data.Type]
end
end
tinsert(itemList, {{itemData, dataID, tableNum, searchTerms, searchText}})
end
end
end
end
end
-- rate limit tied to half the current frame rate
self:ItemsLoading(#itemList)
local maxDuration = 500/GetFramerate()
local startTime = debugprofilestop()
local function continue()
startTime = debugprofilestop()
local task = tremove(itemList)
while (task) do
self:ProcessItem(task[1])
if (debugprofilestop() - startTime > maxDuration) then
Timer.After(0, continue)
return
end
task = tremove(itemList)
end
end
return continue()
end
function AtlasLoot:ShowSearchResult()
AtlasLoot:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1);
self:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1)
end
function AtlasLoot:Search(Text)
if not Text then
function AtlasLoot:Search(text)
if not text then
return
end
Text = strtrim(Text);
if Text == "" then
text = strtrim(text)
if text == "" then
return
end
if self.db.profile.SearchAscensionDB then
return OpenAscensionDBURL("?search="..text)
end
-- Decide if we need load all modules or just specified ones
local allDisabled = not self.db.profile.SearchOn.All;
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;
for _, module in ipairs(self.dataModules) do
if self.db.profile.SearchOn[module] == true or self.db.profile.SearchAscensionVanity then
allDisabled = false
break
end
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;
DEFAULT_CHAT_FRAME:AddMessage(RED .. AL["AtlasLoot"] .. ": " .. WHITE .. AL["You don't have any module selected to search on. Right click search to select modules the more selected the longer it will take to search"])
return
end
if self.db.profile.SearchOn.All then
AtlasLoot:LoadAllModules();
self: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."]);
DEFAULT_CHAT_FRAME:AddMessage(GREEN .. AL["AtlasLoot"] .. ": " .. ORANGE .. k .. WHITE .. " " .. AL["sucessfully loaded."])
end
end
end
local success, message = pcall(DoSearch, Text)
self:DoSearch(text)
--local success, message = pcall(self:DoSearch, text)
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.
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);
else
AtlasLoot:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1);
end
-- 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.
-- 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)
-- else
-- self:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1)
-- end
end
function AtlasLoot:ShowSearchOptions(button)
local dewdrop = AceLibrary("Dewdrop-2.0");
if dewdrop:IsOpen(button) then
dewdrop:Close(1);
if self.Dewdrop:IsOpen(button) then
self.Dewdrop:Close(1)
else
local setOptions = function()
dewdrop:AddLine("text", AL["Search on"], "isTitle", true, "notCheckable", true);
dewdrop:AddLine("text", AL["All modules"], "checked", self.db.profile.SearchOn.All, "tooltipTitle", AL["All modules"], "tooltipText",
self.Dewdrop:AddLine("text", AL["Search on"], "isTitle", true, "notCheckable", true)
self.Dewdrop:AddLine("text", AL["All modules"], "checked", not self.db.profile.SearchAscensionDB and self.db.profile.SearchOn.All, "tooltipTitle", AL["All modules"], "tooltipText",
AL["If checked, AtlasLoot will load and search across all the modules."], "func", function()
self.db.profile.SearchOn.All = not self.db.profile.SearchOn.All;
end);
for _, module in ipairs(modules) do
self.db.profile.SearchOn.All = not self.db.profile.SearchOn.All
end)
for _, module in ipairs(self.dataModules) do
if IsAddOnLoadOnDemand(module) then
local title = GetAddOnMetadata(module, "title");
local notes = GetAddOnMetadata(module, "notes");
dewdrop:AddLine("text", title, "checked", self.db.profile.SearchOn.All or self.db.profile.SearchOn[module], "disabled", self.db.profile.SearchOn.All, "tooltipTitle", title,
local title = GetAddOnMetadata(module, "title")
local notes = GetAddOnMetadata(module, "notes")
self.Dewdrop:AddLine("text", title, "checked", not self.db.profile.SearchAscensionDB and self.db.profile.SearchOn.All or self.db.profile.SearchOn[module], "disabled", self.db.profile.SearchAscensionDB or self.db.profile.SearchOn.All, "tooltipTitle", title,
"tooltipText", notes, "func", function()
if self.db.profile.SearchOn[module] == nil then
self.db.profile.SearchOn[module] = true;
self.db.profile.SearchOn[module] = true
else
self.db.profile.SearchOn[module] = nil;
self.db.profile.SearchOn[module] = nil
end
end);
end)
end
end
dewdrop:AddLine("text", AL["Search options"], "isTitle", true, "notCheckable", true);
dewdrop:AddLine("text", AL["Partial matching"], "checked", self.db.profile.PartialMatching, "tooltipTitle", AL["Partial matching"], "tooltipText",
AL["If checked, AtlasLoot search item names for a partial match."], "func", function()
self.Dewdrop:AddLine("text", AL["Ascension Vanity Collection"], "checked", self.db.profile.SearchAscensionVanity, "tooltipTitle", AL["Ascension Vanity Collection"], "tooltipText",
AL["If checked, AtlasLoot will search Ascension Vanity Collection"], "func", function()
self.db.profile.SearchAscensionVanity = not self.db.profile.SearchAscensionVanity
end)
self.Dewdrop:AddLine("text", AL["Search options"], "isTitle", true, "notCheckable", true)
self.Dewdrop:AddLine("text", AL["Partial matching"], "checked", self.db.profile.PartialMatching, "tooltipTitle", AL["Partial matching"], "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)
return "BOTTOMLEFT", "BOTTOMRIGHT";
end, "children", setOptions);
end
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);
end)
self.Dewdrop:AddLine("text", AL["Search AscensionDB"], "checked", self.db.profile.SearchAscensionDB, "tooltipTitle", AL["Partial matching"], "tooltipText",
AL["If checked, AtlasLoot will open a browser window and search AscensionDB"], "func", function()
self.db.profile.SearchAscensionDB = not self.db.profile.SearchAscensionDB
end)
end
self.Dewdrop:Open(button, 'point', function(parent)
return "BOTTOMLEFT", "BOTTOMRIGHT"
end, "children", setOptions)
end
end
end
+215 -221
View File
@@ -1,70 +1,57 @@
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
AtlasLoot_QualityMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_DifficultyMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_EquipMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_EquipSubMenu = AceLibrary("Dewdrop-2.0");
local MAX_ARGUMENTS = 6
local ACTIVE_ARGUMENT = 0
local MAX_ARGUMENTS = 6;
local ACTIVE_ARGUMENT = 0;
AtlasLoot.SearchMenus = { ArgumentMenus = {}, ArgumentSubMenus = {}}
AtlasLoot_ArgumentMenus = {};
AtlasLoot_ArgumentSubMenus = {};
local RED = "|cffff0000"
local GREY = "|cff999999";
local RED = "|cffff0000";
local WHITE = "|cffFFFFFF";
local GREEN = "|cff1eff00";
local PURPLE = "|cff9F3FFF";
local BLUE = "|cff0070dd";
local ORANGE = "|cffFF8400";
local DEFAULT = "|cffFFd200";
AtlasLoot_FrameMenuList = {
["EquipSubMenu"] = {AtlasLoot_EquipSubMenu, "AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton", "Select Option", "type", ""}
local FrameMenuList = {
["EquipSubMenu"] = {AtlasLoot.Dewdrop, "AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton", "Select Option", "type", ""}
}
AtlasLoot_AdvancedSearchMenus = {
local AdvancedSearchMenus = {
["Difficulty"] = {
[1] = {{"Normal", "difficulty", AtlasLoot_Difficulty.Normal}},
[2] = {{"Heroic", "difficulty", AtlasLoot_Difficulty.Heroic}},
[3] = {{"Mythic/Ascended", "difficulty", AtlasLoot_Difficulty.Mythic}},
[1] = {{"Normal", "difficulty", AtlasLoot.Difficultys.Normal}},
[2] = {{"Heroic", "difficulty", AtlasLoot.Difficultys.Heroic}},
[3] = {{"Mythic/Ascended", "difficulty", AtlasLoot.Difficultys.Mythic}},
[4] = {
["Mythic+ 1-10"] = {{"Mythic 1", "difficulty", AtlasLoot_Difficulty.MythicPlus[1]}, {"Mythic 2", "difficulty", AtlasLoot_Difficulty.MythicPlus[2]},
{"Mythic 3", "difficulty", AtlasLoot_Difficulty.MythicPlus[3]}, {"Mythic 4", "difficulty", AtlasLoot_Difficulty.MythicPlus[4]},
{"Mythic 5", "difficulty", AtlasLoot_Difficulty.MythicPlus[5]}, {"Mythic 6", "difficulty", AtlasLoot_Difficulty.MythicPlus[6]},
{"Mythic 7", "difficulty", AtlasLoot_Difficulty.MythicPlus[7]}, {"Mythic 8", "difficulty", AtlasLoot_Difficulty.MythicPlus[8]},
{"Mythic 9", "difficulty", AtlasLoot_Difficulty.MythicPlus[9]}, {"Mythic 10", "difficulty", AtlasLoot_Difficulty.MythicPlus[10]}}
["Mythic+ 1-10"] = {{"Mythic 1", "difficulty", AtlasLoot.Difficultys.MythicPlus[1]}, {"Mythic 2", "difficulty", AtlasLoot.Difficultys.MythicPlus[2]},
{"Mythic 3", "difficulty", AtlasLoot.Difficultys.MythicPlus[3]}, {"Mythic 4", "difficulty", AtlasLoot.Difficultys.MythicPlus[4]},
{"Mythic 5", "difficulty", AtlasLoot.Difficultys.MythicPlus[5]}, {"Mythic 6", "difficulty", AtlasLoot.Difficultys.MythicPlus[6]},
{"Mythic 7", "difficulty", AtlasLoot.Difficultys.MythicPlus[7]}, {"Mythic 8", "difficulty", AtlasLoot.Difficultys.MythicPlus[8]},
{"Mythic 9", "difficulty", AtlasLoot.Difficultys.MythicPlus[9]}, {"Mythic 10", "difficulty", AtlasLoot.Difficultys.MythicPlus[10]}}
},
[5] = {
["Mythic+ 11-20"] = {{"Mythic 11", "difficulty", AtlasLoot_Difficulty.MythicPlus[11]}, {"Mythic 12", "difficulty", AtlasLoot_Difficulty.MythicPlus[12]},
{"Mythic 13", "difficulty", AtlasLoot_Difficulty.MythicPlus[13]}, {"Mythic 14", "difficulty", AtlasLoot_Difficulty.MythicPlus[14]},
{"Mythic 15", "difficulty", AtlasLoot_Difficulty.MythicPlus[15]}, {"Mythic 16", "difficulty", AtlasLoot_Difficulty.MythicPlus[16]},
{"Mythic 17", "difficulty", AtlasLoot_Difficulty.MythicPlus[17]}, {"Mythic 18", "difficulty", AtlasLoot_Difficulty.MythicPlus[18]},
{"Mythic 19", "difficulty", AtlasLoot_Difficulty.MythicPlus[19]}, {"Mythic 20", "difficulty", AtlasLoot_Difficulty.MythicPlus[20]}}
["Mythic+ 11-20"] = {{"Mythic 11", "difficulty", AtlasLoot.Difficultys.MythicPlus[11]}, {"Mythic 12", "difficulty", AtlasLoot.Difficultys.MythicPlus[12]},
{"Mythic 13", "difficulty", AtlasLoot.Difficultys.MythicPlus[13]}, {"Mythic 14", "difficulty", AtlasLoot.Difficultys.MythicPlus[14]},
{"Mythic 15", "difficulty", AtlasLoot.Difficultys.MythicPlus[15]}, {"Mythic 16", "difficulty", AtlasLoot.Difficultys.MythicPlus[16]},
{"Mythic 17", "difficulty", AtlasLoot.Difficultys.MythicPlus[17]}, {"Mythic 18", "difficulty", AtlasLoot.Difficultys.MythicPlus[18]},
{"Mythic 19", "difficulty", AtlasLoot.Difficultys.MythicPlus[19]}, {"Mythic 20", "difficulty", AtlasLoot.Difficultys.MythicPlus[20]}}
},
[6] = {
["Mythic+ 21-30"] = {{"Mythic 21", "difficulty", AtlasLoot_Difficulty.MythicPlus[21]}, {"Mythic 22", "difficulty", AtlasLoot_Difficulty.MythicPlus[22]},
{"Mythic 23", "difficulty", AtlasLoot_Difficulty.MythicPlus[23]}, {"Mythic 24", "difficulty", AtlasLoot_Difficulty.MythicPlus[24]},
{"Mythic 25", "difficulty", AtlasLoot_Difficulty.MythicPlus[25]}, {"Mythic 26", "difficulty", AtlasLoot_Difficulty.MythicPlus[26]},
{"Mythic 27", "difficulty", AtlasLoot_Difficulty.MythicPlus[27]}, {"Mythic 28", "difficulty", AtlasLoot_Difficulty.MythicPlus[28]},
{"Mythic 29", "difficulty", AtlasLoot_Difficulty.MythicPlus[29]}, {"Mythic 30", "difficulty", AtlasLoot_Difficulty.MythicPlus[30]}}
["Mythic+ 21-30"] = {{"Mythic 21", "difficulty", AtlasLoot.Difficultys.MythicPlus[21]}, {"Mythic 22", "difficulty", AtlasLoot.Difficultys.MythicPlus[22]},
{"Mythic 23", "difficulty", AtlasLoot.Difficultys.MythicPlus[23]}, {"Mythic 24", "difficulty", AtlasLoot.Difficultys.MythicPlus[24]},
{"Mythic 25", "difficulty", AtlasLoot.Difficultys.MythicPlus[25]}, {"Mythic 26", "difficulty", AtlasLoot.Difficultys.MythicPlus[26]},
{"Mythic 27", "difficulty", AtlasLoot.Difficultys.MythicPlus[27]}, {"Mythic 28", "difficulty", AtlasLoot.Difficultys.MythicPlus[28]},
{"Mythic 29", "difficulty", AtlasLoot.Difficultys.MythicPlus[29]}, {"Mythic 30", "difficulty", AtlasLoot.Difficultys.MythicPlus[30]}}
},
[7] = {{"Bloodforged", "difficulty", AtlasLoot_Difficulty.Bloodforged}},
[7] = {{"Bloodforged", "difficulty", AtlasLoot.Difficultys.Bloodforged}},
[8] = {{RED .. "Reset", "difficulty", "reset"}}
},
["Quality"] = {
-- [1] = {
-- {AtlasLoot_FixText("=q0=").."Poor", "quality", "poor"},
-- {AtlasLoot:FixText("=q0=").."Poor", "quality", "poor"},
-- },
-- [2] = {
-- {AtlasLoot_FixText("=q1=").."Common", "quality", "common"},
-- {AtlasLoot:FixText("=q1=").."Common", "quality", "common"},
-- },
[1] = {{AtlasLoot_FixText("=q2=") .. "Uncommon", "quality", "uncommon"}},
[2] = {{AtlasLoot_FixText("=q3=") .. "Rare", "quality", "rare"}},
[3] = {{AtlasLoot_FixText("=q4=") .. "Epic", "quality", "epic"}},
[4] = {{AtlasLoot_FixText("=q5=") .. "Legendary", "quality", "legendary"}},
[1] = {{AtlasLoot:FixText("=q2=") .. "Uncommon", "quality", "uncommon"}},
[2] = {{AtlasLoot:FixText("=q3=") .. "Rare", "quality", "rare"}},
[3] = {{AtlasLoot:FixText("=q4=") .. "Epic", "quality", "epic"}},
[4] = {{AtlasLoot:FixText("=q5=") .. "Legendary", "quality", "legendary"}},
[5] = {{RED .. "Reset", "quality", "reset"}}
},
@@ -137,13 +124,13 @@ AtlasLoot_AdvancedSearchMenus = {
}
}
AtlasLoot_AdvancedSearchArguments = {
local AdvancedSearchArguments = {
["Arguments"] = {
[1] = {
["Primary Stats"] = {{"Stamina", "sta"}, {"Strength", "str"}, {"Agility", "agi"}, {"Intellect", "int"}, {"Spirit", "spi"}}
},
[2] = {
["Secondary Stats"] = {{"Attack Power", "ap"}, {"Spell Power", "sp"}, {"Crit", "crit"}, {"Hit", "hit"}, {"Haste", "haste"}, {"Expertise", "exp"}, {"Armor Pen", "arp"}, {"Spell Pen", "spp"}, {"Mana Per 5", "mp5"}}
["Secondary Stats"] = {{"Attack Power", "ap"}, {"Spell Power", "sp"}, {"Crit", "crit"}, {"Hit", "hit"}, {"Haste", "haste"}, {"Armor Pen", "arp"}, {"Spell Pen", "spp"}, {"Mana Per 5", "mp5"}}
},
[3] = {
["Defensive Stats"] = {{"Defense", "def"}, {"Dodge", "dodge"}, {"Parry", "parry"}, {"Block", "block"}, {"Block Value", "bv"}, {"Resilience", "res"}}
@@ -173,74 +160,64 @@ AtlasLoot_AdvancedSearchArguments = {
}
}
AtlasLoot_AdvSearchOptions = {
local AdvSearchOptions = {
["quality"] = "",
["equip"] = "",
["type"] = "",
["difficulty"] = ""
}
function AtlasLoot_AdvancedSearchSetup()
AtlasLoot_AdvancedSearchRegister(AtlasLoot_QualityMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton, AtlasLoot_AdvancedSearchMenus["Quality"]);
AtlasLoot_AdvancedSearchRegister(AtlasLoot_EquipMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton, AtlasLoot_AdvancedSearchMenus["Equip"]);
--AtlasLoot_AdvancedSearchRegister(AtlasLoot_DifficultyMenu, AtlasLootDefaultFrame_AdvancedSearchPanel_Difficulty, AtlasLoot_AdvancedSearchMenus["Difficulty"]);
function AtlasLoot:AdvancedSearchSetup()
self:AdvancedSearchRegister(self.Dewdrop, AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton, AdvancedSearchMenus["Quality"])
self:AdvancedSearchRegister(self.Dewdrop, AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton, AdvancedSearchMenus["Equip"])
for n = 1, MAX_ARGUMENTS do
AtlasLoot_ArgumentMenus[n] = AceLibrary("Dewdrop-2.0");
AtlasLoot_ArgumentSubMenus[n] = AceLibrary("Dewdrop-2.0");
self.SearchMenus.ArgumentMenus[n] = self.Dewdrop
self.SearchMenus.ArgumentSubMenus[n] = self.Dewdrop
AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n)], tostring(n), AtlasLoot_AdvancedSearchArguments["Arguments"]);
AtlasLoot_AdvancedSearchArgumentRegister(AtlasLoot_ArgumentSubMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n) .. "Sub"], tostring(n),
AtlasLoot_AdvancedSearchArguments["Operators"]);
self:AdvancedSearchArgumentRegister(self.SearchMenus.ArgumentMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n)], tostring(n), AdvancedSearchArguments["Arguments"])
self:AdvancedSearchArgumentRegister(self.SearchMenus.ArgumentSubMenus[n], _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(n) .. "Sub"], tostring(n),
AdvancedSearchArguments["Operators"])
end
-- Reset Search options to defualt
AtlasLoot_AdvancedSearchReset();
self:AdvancedSearchReset()
end
function AtlasLoot_AdvancedSearchShow()
function AtlasLoot:AdvancedSearchShow()
if (AtlasLootDefaultFrame_AdvancedSearchPanel:IsVisible()) then
AtlasLoot_AdvancedSearchClose();
return;
self:AdvancedSearchClose()
return
end
-- Hide all elements that could be in the AtlasTable
_G["AtlasLootItemsFrame_NEXT"]:Hide();
_G["AtlasLootItemsFrame_PREV"]:Hide();
_G["AtlasLootItemsFrame_BACK"]:Hide();
-- Ditch the Quicklook selector
AtlasLootQuickLooksButton:Hide();
_G["AtlasLootItemsFrame_NEXT"]:Hide()
_G["AtlasLootItemsFrame_PREV"]:Hide()
_G["AtlasLootItemsFrame_BACK"]:Hide()
-- Hide the Filter Check-Box
AtlasLootFilterCheck:Hide();
AtlasLootFilterCheck:Hide()
for i = 1, 30, 1 do
_G["AtlasLootItem_" .. i .. "_Unsafe"]:Hide();
_G["AtlasLootItem_" .. i]:Hide();
_G["AtlasLootItem_" .. i].itemID = 0;
_G["AtlasLootItem_" .. i].spellitemID = 0;
_G["AtlasLootItem_" .. i]:Hide()
end
AtlasLoot_BossName:SetText("Advanced Search");
AtlasLoot_BossName:SetText("Advanced Search")
AtlasLootDefaultFrame_AdvancedSearchPanel:Show();
AtlasLootDefaultFrame_AdvancedSearchPanel:Show()
ATLASLOOT_CURRENTTYPE = "Search";
AtlasLoot:ScrollFrameUpdate();
AtlasLoot:SubTableScrollFrameUpdate("EmptyTable","AtlasLoot_Data");
self.CurrentType = "Search"
self:ScrollFrameUpdate()
self:SubTableScrollFrameUpdate("EmptyTable","AtlasLoot_Data")
end
function AtlasLoot_AdvancedSearchClose()
AtlasLootDefaultFrame_AdvancedSearchPanel:Hide();
if (SearchPrevData[1] ~= "") then
AtlasLoot:ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3]);
end
function AtlasLoot:AdvancedSearchClose()
AtlasLootDefaultFrame_AdvancedSearchPanel:Hide()
self:ItemFrameRefresh()
end
function AtlasLoot_AdvancedSearchReset()
AtlasLoot_AdvSearchOptions = {
function AtlasLoot:AdvancedSearchReset()
AdvSearchOptions = {
["quality"] = "",
["equip"] = "",
["type"] = "",
@@ -248,60 +225,60 @@ function AtlasLoot_AdvancedSearchReset()
}
for i = 1, MAX_ARGUMENTS do
AtlasLoot_AdvSearchOptions["arg" .. tostring(i)] = "";
AtlasLoot_AdvSearchOptions["arg" .. tostring(i) .. "op"] = "";
AdvSearchOptions["arg" .. tostring(i)] = ""
AdvSearchOptions["arg" .. tostring(i) .. "op"] = ""
AtlasLoot_RemoveArgumentContainer();
self:RemoveArgumentContainer()
end
local expansionLevels = {60, 70, 80}
AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMin:SetText(expansionLevels[GetAccountExpansionLevel() + 1]);
AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMax:SetText(expansionLevels[GetAccountExpansionLevel() + 1]);
AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMin:SetText("");
AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMax:SetText("");
AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMin:SetText(expansionLevels[GetAccountExpansionLevel() + 1])
AtlasLootDefaultFrame_AdvancedSearchPanel_LevelMax:SetText(expansionLevels[GetAccountExpansionLevel() + 1])
AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMin:SetText("")
AtlasLootDefaultFrame_AdvancedSearchPanel_iLevelMax:SetText("")
AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton:SetText("Select Quality");
AtlasLootDefaultFrame_AdvancedSearchPanel_QualityButton:SetText("Select Quality")
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton:SetText("Select Item Type");
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:Disable();
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:SetText("Select Option");
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipButton:SetText("Select Item Type")
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:Disable()
AtlasLootDefaultFrame_AdvancedSearchPanel_EquipSubButton:SetText("Select Option")
end
function AtlasLoot_AddArgumentContainer()
function AtlasLoot:AddArgumentContainer()
if ACTIVE_ARGUMENT == MAX_ARGUMENTS then
AtlasLoot_AdvSearchArgButtonToggle()
self:AdvSearchArgButtonToggle()
return
end
ACTIVE_ARGUMENT = ACTIVE_ARGUMENT + 1;
ACTIVE_ARGUMENT = ACTIVE_ARGUMENT + 1
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Show();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:SetText("Select Option");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Show();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Show()
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:SetText("Select Option")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Show()
AtlasLoot_AdvSearchArgButtonToggle()
self:AdvSearchArgButtonToggle()
end
function AtlasLoot_RemoveArgumentContainer()
function AtlasLoot:RemoveArgumentContainer()
if ACTIVE_ARGUMENT == 0 then
AtlasLoot_AdvSearchArgButtonToggle()
self:AdvSearchArgButtonToggle()
return
end
AtlasLoot_AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT)] = "";
AtlasLoot_AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT) .. "op"] = "";
AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT)] = ""
AdvSearchOptions["arg" .. tostring(ACTIVE_ARGUMENT) .. "op"] = ""
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Disable();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Value"]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT)]:Hide()
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Disable()
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Sub"]:Hide()
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(ACTIVE_ARGUMENT) .. "Value"]:Hide()
ACTIVE_ARGUMENT = ACTIVE_ARGUMENT - 1;
AtlasLoot_AdvSearchArgButtonToggle()
ACTIVE_ARGUMENT = ACTIVE_ARGUMENT - 1
self:AdvSearchArgButtonToggle()
end
function AtlasLoot_AdvSearchArgButtonToggle()
function AtlasLoot:AdvSearchArgButtonToggle()
if ACTIVE_ARGUMENT == MAX_ARGUMENTS then
AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainerAddArgBtn:Disable()
else
@@ -315,73 +292,76 @@ function AtlasLoot_AdvSearchArgButtonToggle()
end
end
AtlasLoot_AdvSearchDefaultText = {
local AdvSearchDefaultText = {
["quality"] = "Select Quality",
["equip"] = "Select Item Type",
["type"] = "Select Option",
["difficulty"] = "Select Difficulty"
}
function AtlasLoot_AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, ChildMenu, ChildMenuRegister)
function AtlasLoot:AdvancedSearchMenuClick(Object, VariableToSet, VariableValue, ChildMenu, ChildMenuRegister)
-- Setups child menus and sets search options to default
if (ChildMenu ~= nil) then
if (ChildMenuRegister == "Disable") then
AtlasLoot_AdvSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5];
_G[AtlasLoot_FrameMenuList[ChildMenu][2]]:Disable();
AdvSearchOptions[FrameMenuList[ChildMenu][4]] = FrameMenuList[ChildMenu][5]
_G[FrameMenuList[ChildMenu][2]]:Disable()
-- Disable assigned children menus as well
if (AtlasLoot_FrameMenuList[ChildMenu][6]) then
_G[AtlasLoot_FrameMenuList[ChildMenu][6]]:Disable();
if (FrameMenuList[ChildMenu][6]) then
_G[FrameMenuList[ChildMenu][6]]:Disable()
end
if VariableValue == "reset" then
AtlasLoot_AdvSearchOptions[VariableToSet] = "";
Object[1]:SetText(AtlasLoot_AdvSearchDefaultText[VariableToSet]);
Object[2]:Close();
AdvSearchOptions[VariableToSet] = ""
Object[1]:SetText(AdvSearchDefaultText[VariableToSet])
Object[2]:Close()
_G[AtlasLoot_FrameMenuList[ChildMenu][2]]:SetText(AtlasLoot_FrameMenuList[ChildMenu][3])
_G[FrameMenuList[ChildMenu][2]]:SetText(FrameMenuList[ChildMenu][3])
return
end
else
AtlasLoot_AdvancedSearchRegister(AtlasLoot_FrameMenuList[ChildMenu][1], _G[AtlasLoot_FrameMenuList[ChildMenu][2]], AtlasLoot_AdvancedSearchMenus[ChildMenuRegister]);
AtlasLoot_AdvSearchOptions[AtlasLoot_FrameMenuList[ChildMenu][4]] = AtlasLoot_FrameMenuList[ChildMenu][5];
_G[AtlasLoot_FrameMenuList[ChildMenu][2]]:Enable();
_G[AtlasLoot_FrameMenuList[ChildMenu][2]]:SetText(AtlasLoot_FrameMenuList[ChildMenu][3]);
self:AdvancedSearchRegister(FrameMenuList[ChildMenu][1], _G[FrameMenuList[ChildMenu][2]], AdvancedSearchMenus[ChildMenuRegister])
AdvSearchOptions[FrameMenuList[ChildMenu][4]] = FrameMenuList[ChildMenu][5]
_G[FrameMenuList[ChildMenu][2]]:Enable()
_G[FrameMenuList[ChildMenu][2]]:SetText(FrameMenuList[ChildMenu][3])
-- Disable assigned children menus as well
if (AtlasLoot_FrameMenuList[ChildMenu][6]) then
_G[AtlasLoot_FrameMenuList[ChildMenu][6]]:Disable();
if (FrameMenuList[ChildMenu][6]) then
_G[FrameMenuList[ChildMenu][6]]:Disable()
end
end
end
if VariableValue == "reset" then
AtlasLoot_AdvSearchOptions[VariableToSet] = "";
Object[1]:SetText(AtlasLoot_AdvSearchDefaultText[VariableToSet]);
Object[2]:Close();
AdvSearchOptions[VariableToSet] = ""
Object[1]:SetText(AdvSearchDefaultText[VariableToSet])
Object[2]:Close()
return
end
AtlasLoot_AdvSearchOptions[VariableToSet] = VariableValue;
Object[1]:SetText(Object[3]);
Object[2]:Close();
AdvSearchOptions[VariableToSet] = VariableValue
Object[1]:SetText(Object[3])
Object[2]:Close()
end
function AtlasLoot_AdvancedSearchRegister(DropDown, DropDownObject, MenuOption)
function AtlasLoot:AdvancedSearchRegister(DropDown, DropDownObject, MenuOption)
DropDown:Register(DropDownObject, 'point', function(parent)
return "TOP", "BOTTOM"
end, 'children', function(level, value)
if level == 1 then
if AtlasLoot_AdvancedSearchMenus then
if AdvancedSearchMenus then
for k, v in ipairs(MenuOption) do
-- If a link to show a submenu
if (type(v[1]) == "table") and (type(v[1][1]) == "string") then
if v[1][1] ~= "" then
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchMenuClick, 'arg1', {DropDownObject, DropDown, v[1][1]}, 'arg2',
v[1][2], 'arg3', v[1][3], 'arg4', v[1][4], 'arg5', v[1][5], 'notCheckable', true)
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0,
'func', function()
self:AdvancedSearchMenuClick({DropDownObject, DropDown, v[1][1]}, v[1][2], v[1][3], v[1][4], v[1][5])
end,
'notCheckable', true)
end
else
local lock = 0;
local lock = 0
-- If an entry linked to a subtable
for i, j in pairs(v) do
if lock == 0 then
DropDown:AddLine('text', i, 'textR', 1, 'textG', 0.82, 'textB', 0, 'hasArrow', true, 'value', j, 'notCheckable', true)
lock = 1;
lock = 1
end
end
end
@@ -394,80 +374,88 @@ function AtlasLoot_AdvancedSearchRegister(DropDown, DropDownObject, MenuOption)
elseif level == 2 then
if value then
for k, v in ipairs(value) do
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchMenuClick, 'arg1', {DropDownObject, DropDown, v[1]}, 'arg2', v[2], 'arg3',
v[3], 'arg4', v[4], 'arg5', v[5], 'notCheckable', true)
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0,
'func', function()
self:AdvancedSearchMenuClick({DropDownObject, DropDown, v[1]}, v[2], v[3], v[4], v[5])
end,
'notCheckable', true)
end
end
end
end, 'dontHook', true)
end
function AtlasLoot_AdvancedSearchArgumentClick(Object, VariableToSet, VariableValue, IsOperator)
function AtlasLoot:AdvancedSearchArgumentClick(Object, VariableToSet, VariableValue, IsOperator)
if IsOperator and VariableValue == "reset" then
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = "";
AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide()
Object[1]:SetText("Select Option");
Object[2]:Close();
Object[1]:SetText("Select Option")
Object[2]:Close()
elseif IsOperator then
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = VariableValue;
AdvSearchOptions["arg" .. VariableToSet .. "op"] = VariableValue
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Show();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Show()
Object[1]:SetText(Object[3]);
Object[2]:Close();
Object[1]:SetText(Object[3])
Object[2]:Close()
elseif VariableValue == "reset" then
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:SetText("Select Option");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:Disable();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:SetText("Select Option")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:Disable()
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide()
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet] = "";
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = "";
AdvSearchOptions["arg" .. VariableToSet] = ""
AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""
Object[1]:SetText("Select Option");
Object[2]:Close();
Object[1]:SetText("Select Option")
Object[2]:Close()
else
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:SetText("Select Option");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:Enable();
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet .. "op"] = "";
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:SetText("Select Option")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Sub"]:Enable()
AdvSearchOptions["arg" .. VariableToSet .. "op"] = ""
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("");
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide();
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:SetText("")
_G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. VariableToSet .. "Value"]:Hide()
AtlasLoot_AdvSearchOptions["arg" .. VariableToSet] = VariableValue;
Object[1]:SetText(Object[3]);
Object[2]:Close();
AdvSearchOptions["arg" .. VariableToSet] = VariableValue
Object[1]:SetText(Object[3])
Object[2]:Close()
end
end
function AtlasLoot_AdvancedSearchArgumentRegister(DropDown, DropDownObject, ArgumentCount, ArgumentMenu)
function AtlasLoot:AdvancedSearchArgumentRegister(DropDown, DropDownObject, ArgumentCount, ArgumentMenu)
DropDown:Register(DropDownObject, 'point', function(parent)
return "TOP", "BOTTOM"
end, 'children', function(level, value)
if level == 1 then
if AtlasLoot_AdvancedSearchArguments then
if AdvancedSearchArguments then
for k, v in ipairs(ArgumentMenu) do
-- If a link to show a submenu
if (type(v[1]) == "table") and (type(v[1][1]) == "string") then
local checked = false;
local checked = false
if v[1][3] == "Submenu" then
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchArgumentClick, 'arg1', {DropDownObject, DropDown, v[1][1]}, 'arg2',
ArgumentCount, 'arg3', v[1][2], 'arg4', v[1][3], 'notCheckable', true)
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0,
'func', function()
self:AdvancedSearchArgumentClick({DropDownObject, DropDown, v[1][1]}, ArgumentCount, v[1][2], v[1][3])
end,
'notCheckable', true)
elseif v[1][1] ~= "" then
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchArgumentClick, 'arg1', {DropDownObject, DropDown, v[1][1]}, 'arg2',
ArgumentCount, 'arg3', v[1][2], 'arg4', v[1][3], 'notCheckable', true)
DropDown:AddLine('text', v[1][1], 'textR', 1, 'textG', 0.82, 'textB', 0,
'func', function() self:AdvancedSearchArgumentClick({DropDownObject, DropDown, v[1][1]}, ArgumentCount, v[1][2], v[1][3])
end,
'notCheckable', true)
end
else
local lock = 0;
local lock = 0
-- If an entry linked to a subtable
for i, j in pairs(v) do
if lock == 0 then
DropDown:AddLine('text', i, 'textR', 1, 'textG', 0.82, 'textB', 0, 'hasArrow', true, 'value', j, 'notCheckable', true)
lock = 1;
lock = 1
end
end
end
@@ -479,20 +467,26 @@ function AtlasLoot_AdvancedSearchArgumentRegister(DropDown, DropDownObject, Argu
end, 'notCheckable', true)
elseif level == 2 then
if value then
for k, v in ipairs(value) do
for _, v in ipairs(value) do
if type(v) == "table" then
if (type(v[1]) == "string") then
local checked = false;
local checked = false
-- If an entry to show a submenu
if v[4] == "Header" then
DropDown:AddLine('text', v[1], 'textR', 0.2, 'textG', 0.82, 'textB', 0.5, 'func', AtlasLoot_AdvancedSearchArgumentClick, 'arg1', {DropDownObject, DropDown, v[1]},
'arg2', ArgumentCount, 'arg3', v[2], 'arg4', v[3], 'notCheckable', true)
DropDown:AddLine('text', v[1], 'textR', 0.2, 'textG', 0.82, 'textB', 0.5, 'func', function()
self:AdvancedSearchArgumentClick({DropDownObject, DropDown, v[1]}, ArgumentCount, v[2], v[3])
end,
'notCheckable', true)
elseif v[3] == "Submenu" then
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchArgumentClick, 'arg1', {DropDownObject, DropDown, v[1]}, 'arg2',
ArgumentCount, 'arg3', v[2], 'arg4', v[3], 'notCheckable', true)
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', function()
self:AdvancedSearchArgumentClick({DropDownObject, DropDown, v[1]}, ArgumentCount, v[2], v[3])
end,
'notCheckable', true)
else
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', AtlasLoot_AdvancedSearchArgumentClick, 'arg1', {DropDownObject, DropDown, v[1]}, 'arg2',
ArgumentCount, 'arg3', v[2], 'arg4', v[3], 'notCheckable', true)
DropDown:AddLine('text', v[1], 'textR', 1, 'textG', 0.82, 'textB', 0, 'func', function()
self:AdvancedSearchArgumentClick({DropDownObject, DropDown, v[1]}, ArgumentCount, v[2], v[3])
end,
'notCheckable', true)
end
end
end
@@ -509,16 +503,16 @@ function AtlasLoot:AdvancedSearch(Text)
if not Text then
return
end
Text = strtrim(Text);
local advSearchString = Text or "";
Text = strtrim(Text)
local advSearchString = Text or ""
local function AppendSearchString(toAppend, str)
if toAppend ~= "" then
toAppend = toAppend .. "&" .. str;
return toAppend;
toAppend = toAppend .. "&" .. str
return toAppend
end
return str;
return str
end
local function GetTextByName(name)
@@ -526,69 +520,69 @@ function AtlasLoot:AdvancedSearch(Text)
return _G["AtlasLootDefaultFrame_AdvancedSearchPanel_" .. name]:GetText()
end
return nil;
return nil
end
local function FixRangedSlot(subType)
if (subType == "wand" or subType == "gun" or subType == "crossbow") then
return "rangedright";
return "rangedright"
elseif subType == "thrown" then
return "thrown";
return "thrown"
end
return "ranged";
return "ranged"
end
if AtlasLoot_AdvSearchOptions["quality"] ~= "" then
advSearchString = AppendSearchString(advSearchString, "quality=" .. AtlasLoot_AdvSearchOptions["quality"]);
if AdvSearchOptions["quality"] ~= "" then
advSearchString = AppendSearchString(advSearchString, "quality=" .. AdvSearchOptions["quality"])
end
if AtlasLoot_AdvSearchOptions["equip"] ~= "" then
if AtlasLoot_AdvSearchOptions["equip"] == "ranged" and AtlasLoot_AdvSearchOptions["type"] ~= "" then
AtlasLoot_AdvSearchOptions["equip"] = FixRangedSlot(AtlasLoot_AdvSearchOptions["type"]);
if AdvSearchOptions["equip"] ~= "" then
if AdvSearchOptions["equip"] == "ranged" and AdvSearchOptions["type"] ~= "" then
AdvSearchOptions["equip"] = FixRangedSlot(AdvSearchOptions["type"])
end
advSearchString = AppendSearchString(advSearchString, "slot=" .. AtlasLoot_AdvSearchOptions["equip"]);
advSearchString = AppendSearchString(advSearchString, "slot=" .. AdvSearchOptions["equip"])
end
if AtlasLoot_AdvSearchOptions["type"] ~= "" and AtlasLoot_AdvSearchOptions["type"] then
advSearchString = AppendSearchString(advSearchString, "type=" .. AtlasLoot_AdvSearchOptions["type"]);
if AdvSearchOptions["type"] ~= "" and AdvSearchOptions["type"] then
advSearchString = AppendSearchString(advSearchString, "type=" .. AdvSearchOptions["type"])
end
if AtlasLoot_AdvSearchOptions["difficulty"] ~= "" and AtlasLoot_AdvSearchOptions["difficulty"] ~= 2 then
advSearchString = AppendSearchString(advSearchString, "dif=" .. AtlasLoot_AdvSearchOptions["difficulty"]);
if AdvSearchOptions["difficulty"] ~= "" and AdvSearchOptions["difficulty"] ~= 2 then
advSearchString = AppendSearchString(advSearchString, "dif=" .. AdvSearchOptions["difficulty"])
end
if(not AtlasLootDefaultFrame_AdvancedSearchPanel_LevelToggle:GetChecked()) then
if (GetTextByName("LevelMin") and GetTextByName("LevelMin") ~= "") then
advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. GetTextByName("LevelMin"));
advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. GetTextByName("LevelMin"))
end
if (GetTextByName("LevelMax") and GetTextByName("LevelMax") ~= "") then
advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. GetTextByName("LevelMax"));
advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. GetTextByName("LevelMax"))
end
else
advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. UnitLevel("player"));
advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. UnitLevel("player"));
advSearchString = AppendSearchString(advSearchString, "minlvl>=" .. UnitLevel("player"))
advSearchString = AppendSearchString(advSearchString, "minlvl<=" .. UnitLevel("player"))
end
if (GetTextByName("iLevelMin") and GetTextByName("iLevelMin") ~= "") then
advSearchString = AppendSearchString(advSearchString, "ilvl>=" .. GetTextByName("iLevelMin"));
advSearchString = AppendSearchString(advSearchString, "ilvl>=" .. GetTextByName("iLevelMin"))
end
if (GetTextByName("iLevelMax") and GetTextByName("iLevelMax") ~= "") then
advSearchString = AppendSearchString(advSearchString, "ilvl<=" .. GetTextByName("iLevelMax"));
advSearchString = AppendSearchString(advSearchString, "ilvl<=" .. GetTextByName("iLevelMax"))
end
for i = 1, ACTIVE_ARGUMENT, 1 do
if AtlasLoot_AdvSearchOptions["arg" .. i] ~= "" then
local arg = _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(i) .. "Value"]:GetText();
if AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] == "" then
AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] = ">"
arg = "0";
if AdvSearchOptions["arg" .. i] ~= "" then
local arg = _G["AtlasLootDefaultFrame_AdvancedSearchPanel_ArgumentContainer" .. tostring(i) .. "Value"]:GetText()
if AdvSearchOptions["arg" .. i .. "op"] == "" then
AdvSearchOptions["arg" .. i .. "op"] = ">"
arg = "0"
end
advSearchString = AppendSearchString(advSearchString, AtlasLoot_AdvSearchOptions["arg" .. i] .. AtlasLoot_AdvSearchOptions["arg" .. i .. "op"] .. arg);
advSearchString = AppendSearchString(advSearchString, AdvSearchOptions["arg" .. i] .. AdvSearchOptions["arg" .. i .. "op"] .. arg)
end
end
AtlasLootDefaultFrame_AdvancedSearchPanel:Hide();
AtlasLoot:Search(string.lower(advSearchString));
AtlasLootDefaultFrame_AdvancedSearchPanel:Hide()
self:Search(string.lower(advSearchString))
end
File diff suppressed because it is too large Load Diff
+442
View File
@@ -0,0 +1,442 @@
local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot")
-- Colours stored for code readability
local GREY = "|cff999999"
local RED = "|cffff0000"
local WHITE = "|cffFFFFFF"
local GREEN = "|cff1eff00"
local PURPLE = "|cff9F3FFF"
local BLUE = "|cff0070dd"
local ORANGE = "|cffFF8400"
local CYAN = "|cff00ffff"
local SPRINGGREEN = "|cFF00FF7F"
-- Used to create a dewdrop menu from a table
function AtlasLoot:OpenDewdropMenu(frame, menuList, skipRegister)
if self.Dewdrop:IsOpen(frame) then self.Dewdrop:Close() return end
if not skipRegister then
self.Dewdrop:Register(frame,
'point', function(parent)
return "TOP", "BOTTOM"
end,
'children', function(level, value)
local altar
for _, menu in pairs(menuList[level]) do
if menu.divider then
local text = WHITE.."----------------------------------------------------------------------------------------------------"
self.Dewdrop:AddLine(
'text' , text:sub(1, menu.divider),
'textHeight', 13,
'textWidth', 13,
'isTitle', true,
'notCheckable', true
)
else
self.Dewdrop:AddLine(
'text', menu.text,
'func', menu.func,
'closeWhenClicked', menu.closeWhenClicked,
'textHeight', menu.textHeight,
'textWidth', menu.textWidth,
'notCheckable', menu.notCheckable,
'tooltip', menu.tooltip,
'secure', menu.secure,
'icon', menu.icon
)
end
-- create close button
if menu.close then
self.Dewdrop:AddLine(
'text', AL["Close Menu"],
'textR', 0,
'textG', 1,
'textB', 1,
'textHeight', 12,
'textWidth', 12,
'closeWhenClicked', true,
'notCheckable', true
)
end
end
end,
'dontHook', true
)
end
self.Dewdrop:Open(frame)
return true
end
--for a adding a divider to dew drop menus
function AtlasLoot:AddDividerLine(maxLenght)
local text = WHITE.."----------------------------------------------------------------------------------------------------"
self.Dewdrop:AddLine(
'text' , text:sub(1, maxLenght),
'textHeight', 12,
'textWidth', 12,
'isTitle', true,
"notCheckable", true
)
end
function AtlasLoot:CloseDewDrop(divider, maxLenght)
if divider then
self:AddDividerLine(maxLenght)
end
self.Dewdrop:AddLine(
'text', AL["Close Menu"],
'textR', 0,
'textG', 1,
'textB', 1,
'textHeight', 12,
'textWidth', 12,
'closeWhenClicked', true,
'notCheckable', true
)
end
-- return a copy of the table table
function AtlasLoot:CloneTable(table)
if type(table) ~= "table" then return end
local new = {} -- create a new table
for i, v in pairs(table) do
if type(v) == "table" then
v = self:CloneTable(v)
end
new[i] = v
end
return new
end
--[[
AtlasLoot:FindId(id, difficulty)
Finds the Ids of other difficulties based on the normal id of the item and the difficulty parameter given.
On the form of {ID, {normal, heroic, mythic, mythic1, mythic2, ... ,mythicN}}
]]
function AtlasLoot:FindId(id, difficulty, type, sourceType)
if not ItemIDsDatabase[id] then return nil, false end
if (difficulty == 4 and (type == "BCRaid" or type == "ClassicRaid") and sourceType == "Search") or
(difficulty == 5 and (type == "BCRaid" or type == "ClassicRaid") and sourceType ~= "Search") then
return ItemIDsDatabase[id]["MythicRaid"], true
end
if (difficulty == 5 and (type == "BCRaid" or type == "ClassicRaid") and sourceType == "Search") then
difficulty = 4
end
return ItemIDsDatabase[id][difficulty], true
end
-- Create enchant tooltip
function AtlasLoot:GetEnchantLink(enchantID)
if not enchantID then return end
local EnchantLink = nil
AtlasLootScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
AtlasLootScanTooltip:ClearLines()
AtlasLootScanTooltip:SetHyperlink("enchant:"..enchantID)
AtlasLootScanTooltip:Show()
local tooltipline = _G["AtlasLootScanTooltipTextLeft1"]
local text = tooltipline:GetText()
if text and string.find(text, ":") then
EnchantLink = "|cffffd000|Henchant:"..enchantID.."|h["..text.."]|h|r"
else
EnchantLink = GetSpellLink(enchantID)
end
AtlasLootScanTooltip:Hide()
return EnchantLink
end
-- Open a ascension db link
function AtlasLoot:OpenDBURL(ID, Type)
OpenAscensionDBURL("?"..Type.."="..ID)
end
-- create a enchant or item chat link!
function AtlasLoot:Chatlink(ID,chatType,Type)
if Type == "spell" then
SendChatMessage(self:GetEnchantLink(ID) ,chatType)
else
SendChatMessage(select(2,GetItemInfo(ID)) ,chatType)
end
end
function AtlasLoot:GetRecipeData(recipeID, idType)
if not TRADESKILL_RECIPES then return end
for _,prof in pairs(TRADESKILL_RECIPES) do
for _,cat in pairs(prof) do
for _,recipe in pairs(cat) do
if (idType == "spell" and recipeID == recipe.SpellEntry) or (idType == "item" and recipeID == recipe.RecipeItemEntry) then
local info = {{recipe.CreatedItemEntry}, "blank", "blank", "blank", "blank", "blank",spellID = recipe.SpellEntry}
if ItemIDsDatabase[recipe.CreatedItemEntry] and ItemIDsDatabase[recipe.CreatedItemEntry][1] then
info[2] = {ItemIDsDatabase[recipe.CreatedItemEntry][1]}
end
if recipe.RecipeItemEntry and recipe.RecipeItemEntry ~= 0 then
local number = 3
if info[2] == "blank" then
number = 2
end
info[number] = {recipe.RecipeItemEntry}
end
for _,v in pairs(recipe.Reagents) do
tinsert(info, v)
end
return info
end
end
end
end
end
-- Returns the recipe itemID from a crafting spellID
function AtlasLoot:GetRecipeID(spellID)
if not TRADESKILL_RECIPES then return end
for _,prof in pairs(TRADESKILL_RECIPES) do
for _,cat in pairs(prof) do
for _,recipe in pairs(cat) do
if spellID == recipe.SpellEntry and recipe.RecipeItemEntry ~= 0 then
return recipe.RecipeItemEntry
end
end
end
end
end
-- Get rep faction for when you have 2 loot tables and want to show a different one depending on rep
function AtlasLoot:GetReputationFaction(factions)
local factionIndex = 1
local lastFactionName
repeat
local name, _, _, _, _, totalRep = GetFactionInfo(factionIndex)
for _, faction in pairs(factions) do
if name == faction and totalRep and totalRep >= 1 then
return faction
end
if name == faction then
lastFactionName = faction
end
end
factionIndex = factionIndex + 1
until factionIndex > 200
return lastFactionName
end
--[[
AtlasLoot:PopoupItemFrame(item, data)
Used to create a popup item frame for items like gem sacks to show what they contain
]]
function AtlasLoot:PopoupItemFrame(frame, data)
if not data then AtlasLoot_PopupFrame:Hide() return end
--hide the unused buttons
for i = 1, 15 do
local button = _G["AtlasLoot_PopupButton_"..i]
if button then
button:Hide()
end
end
--creates a button only if one dosnt already exist re use old one if it does
local function createButton(num)
if _G["AtlasLoot_PopupButton_"..num] then return end
local button = CreateFrame("Button", "AtlasLoot_PopupButton_"..num, AtlasLoot_PopupFrame)
button:SetID(num)
button:SetSize(30,30)
button:EnableMouse()
button:RegisterForClicks("AnyDown")
button:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD")
button.icon = button:CreateTexture(nil,"ARTWORK")
button.icon:SetSize(30,30)
button.icon:SetPoint("CENTER")
button.name = button:CreateFontString(nil,"ARTWORK","GameFontHighlightLarge")
button.name:SetFont("GameFontHighlightLarge", 30)
button.name:SetSize(30,30)
button.name:SetPoint("CENTER", button.icon,0,0)
button.name:SetJustifyH("CENTER")
button.name:Hide()
button.number = num
button:SetScript("OnClick", function(btn, arg1) self:ItemOnClick(btn, arg1) end)
button:SetScript("OnEnter", function(btn)
self:ItemOnEnter(btn)
AtlasLoot_PopupFrame:Show()
end)
button:SetScript("OnLeave", function(btn)
if not self.Dewdrop:IsOpen(_G["AtlasLoot_PopupButton_"..num]) then
self:ItemOnLeave(btn)
end
end)
if num == 1 then
button:SetPoint("TOPLEFT", "AtlasLoot_PopupFrame", 9, -8)
elseif num == 7 then
button:SetPoint("BOTTOM", "AtlasLoot_PopupButton_1", 0, -33)
elseif num == 13 then
button:SetPoint("BOTTOM", "AtlasLoot_PopupButton_6", 0, -33)
else
button:SetPoint("LEFT", _G["AtlasLoot_PopupButton_"..(num-1)],"RIGHT",3,0)
end
end
if data.Faction then
data = data[self:GetReputationFaction(data.Faction)]
end
local numberBtns
for i, item in ipairs(data) do
createButton(i)
local button = _G["AtlasLoot_PopupButton_"..i]
if item == "blank" then
button:Hide()
else
local itemID = item.itemID or item[1]
local itemData = Item:CreateFromID(itemID)
if itemID and not itemData:GetInfo() then
self:ItemsLoading(1)
itemData:ContinueOnLoad(function(itemID)
self:ItemsLoading(-1)
end)
end
button.icon:SetTexture(GetItemIcon(itemID))
button.itemID = itemID
button.itemTexture = frame.itemTexture
local recipe = self:GetRecipeData(itemID, "item")
if recipe then
button.craftingData = self:RecipeSource(recipe.spellID)
end
if item[2] then
button.name:SetText(WHITE..item[2])
button.name:Show()
else
button.name:Hide()
end
button:Show()
end
numberBtns = i
end
if numberBtns < 6 then
AtlasLoot_PopupFrame:SetWidth((numberBtns*33)+16)
else
AtlasLoot_PopupFrame:SetWidth(214)
end
if numberBtns > 6 then
AtlasLoot_PopupFrame:SetHeight(79)
elseif numberBtns > 12 then
AtlasLoot_PopupFrame:SetHeight(107)
else
AtlasLoot_PopupFrame:SetHeight(46)
end
AtlasLoot_PopupFrame:SetParent(frame)
AtlasLoot_PopupFrame:ClearAllPoints()
AtlasLoot_PopupFrame:SetPoint("TOPLEFT",frame,0,-25)
AtlasLoot_PopupFrame:Show()
end
--Adds explanatory tooltips to UI objects.
function AtlasLoot:AddTooltip(frameb, tooltiptext)
if not tooltiptext or not frameb then return end
local frame = _G[frameb]
frame:SetScript("OnEnter", function()
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
GameTooltip:SetText(tooltiptext)
GameTooltip:Show()
end)
frame:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
--Called when 'Back'Button is pressed and calls up the appropriate loot page
function AtlasLoot:BackButton_OnClick()
self.backEnabled = false
if AtlasLootItemsFrame.refreshSearch then
self:ShowItemsFrame(AtlasLootItemsFrame.refreshSearch[1], AtlasLootItemsFrame.refreshSearch[2], AtlasLootItemsFrame.refreshSearch[3])
else
self:ShowItemsFrame(AtlasLootItemsFrame.refreshBack[1], AtlasLootItemsFrame.refreshBack[2], AtlasLootItemsFrame.refreshBack[3])
end
end
--[[
AtlasLoot:IsLootTableAvailable(dataID):
Checks if a loot table is in memory and attempts to load the correct LoD module if it isn't
dataID: Loot table dataID
]]
function AtlasLoot:IsLootTableAvailable(dataSource)
local moduleName
moduleName = self.ModuleName[dataSource]
if moduleName and IsAddOnLoaded(moduleName) then
return true
elseif moduleName then
LoadAddOn(moduleName)
end
end
--[[
AtlasLoot:NavButton_OnClick:
Called when <-, -> are pressed and calls up the appropriate loot page
]]
function AtlasLoot:NavButton_OnClick(btn)
if AtlasLootDefaultFrame_Map:IsVisible() then
self:MapSelect(btn.mapID, btn.mapNum)
else
local tablenum, dataID, dataSource = btn.tablenum, btn.tablebase[1], btn.tablebase[2]
if #_G[dataSource][dataID] > 26 then
local min, max = AtlasLootDefaultFrameSubTableScrollScrollBar:GetMinMaxValues()
AtlasLootDefaultFrameSubTableScrollScrollBar:SetValue(tablenum * (max / #_G[dataSource][dataID]))
end
self:ShowItemsFrame(dataID, dataSource, tablenum)
end
end
--------- rate limited item frame refresh ---------
local refreshTimer
function AtlasLoot:ItemRefreshTimer()
self:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3])
refreshTimer = false
end
function AtlasLoot:ItemFrameRefresh()
if refreshTimer then return end
self:ScheduleTimer("ItemRefreshTimer", 5)
refreshTimer = true
end
-----------------------------------------------------
function AtlasLoot:getMaxDifficulty(difficultyKey)
if(difficultyKey == "ClassicDungeon" or difficultyKey == "PVP") then
return 2
elseif (difficultyKey == "ClassicDungeonExt" or difficultyKey == "BCDungeon" or difficultyKey == "WrathDungeon") then
return 44
elseif (difficultyKey == "ClassicRaid" or difficultyKey == "BCRaid" or difficultyKey == "WrathRaid") then
return 5
else
return 0
end
end
-- Loading items spinner
local loadingCount = 0
function AtlasLoot:ItemsLoading(count)
if count == "reset" then
loadingCount = 0
count = 0
end
loadingCount = loadingCount + count
if(loadingCount > 0) then
AtlasLoot_ItemsLoadingSpinner:SetVertexColor(0,1,0)
AtlasLoot_ItemsLoadingFrameBackground:SetVertexColor(0,1,0)
AtlasLoot_ItemsLoading.tooltip = loadingCount.." Items still loading"
AtlasLoot_ItemsLoading.Loop:Play()
AtlasLoot_ItemsLoading:Show()
if GameTooltip:GetOwner() == AtlasLoot_ItemsLoading then
GameTooltip:SetOwner(AtlasLoot_ItemsLoading, "ANCHOR_LEFT")
GameTooltip:SetText(AtlasLoot_ItemsLoading.tooltip, nil, nil, nil, nil, true)
end
else
AtlasLoot_ItemsLoading.Loop:Stop()
AtlasLoot_ItemsLoading:Hide()
end
end
function AtlasLoot:BatchRequestVanity(itemList)
itemList = self:CloneTable(itemList)
local function nextItem()
local task = tremove(itemList)
while task do
RequestDeliverVanityCollectionItem(task)
return Timer.After(1, nextItem)
end
end
return nextItem()
end
File diff suppressed because it is too large Load Diff