-Implement Atlas integration for difficulty select

This commit is contained in:
Anch
2022-01-31 01:18:06 +13:00
parent 686d71bf46
commit 255bb794fa
5 changed files with 234 additions and 29 deletions
+18 -4
View File
@@ -55,6 +55,7 @@ ATLASLOOT_INDENT = " ";
AtlasLoot_Dewdrop = AceLibrary("Dewdrop-2.0");
AtlasLoot_DewdropSubMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_DewdropSubMenu2 = AceLibrary("Dewdrop-2.0");
AtlasLoot_DifficultyAtlas = AceLibrary("Dewdrop-2.0");
--Variable to cap debug spam
ATLASLOOT_DEBUGSHOWN = false;
@@ -81,8 +82,6 @@ Hooked_Atlas_Refresh = nil;
Hooked_Atlas_OnShow = nil;
Hooked_AtlasScrollBar_Update = nil;
--Pre Sets for defficuilty menu
SelectedTable2TextSet = true
isTablereference = false
notPattern = false
@@ -367,6 +366,7 @@ function AtlasLoot_OnVariablesLoaded()
AtlasLootDefaultFrame_SelectedCategory:SetText(AL["Choose Table ..."]);
AtlasLootDefaultFrame_SelectedTable:SetText("");
AtlasLootDefaultFrame_SelectedTable2:SetText("");
AtlasLootItemsFrame_DifficultyAtlasButton:SetText("Select Difficulty");
AtlasLootDefaultFrame_SelectedCategory:Show();
AtlasLootDefaultFrame_SelectedTable:Show();
AtlasLootDefaultFrame_SelectedTable2:Show();
@@ -531,6 +531,10 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
-- Hide the Filter Check-Box
AtlasLootFilterCheck:Hide();
-- Hide Selector
AtlasLootItemsFrame_DifficultyAtlasButton:Disable();
AtlasLootItemsFrame_DifficultyAtlasButton:Hide();
-- Updates AtlasLoot_Lastboss if your in a main loot table
if AtlasLoot_Hold == false then
@@ -542,11 +546,14 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
if dataID == "SearchResult" or dataID == "WishList" then
ItemindexID = "";
AtlasLootItemsFrame_DifficultyAtlasButton:Disable();
AtlasLootItemsFrame_DifficultyAtlasButton:Hide();
AtlasLootDefaultFrame_SubMenu2:Disable();
AtlasLootDefaultFrame_SelectedTable2:SetText("");
AtlasLootDefaultFrame_SelectedTable2:Hide();
dataSource = {};
-- Match the page number to display
AtlasLootItemsFrame_DifficultyAtlasButton:SetText("Select Difficulty");
dataSource = {};
-- Match the page number to display
wlPage = tonumber(dataSource_backup:match("%d+$"));
-- Aquiring items of the page
if dataID == "SearchResult" then
@@ -583,6 +590,13 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame)
AtlasLootFilterCheck:SetChecked(false);
ATLASLOOT_FILTER_ENABLE = false
end
if (AtlasLootItemsFrame:GetParent() == AlphaMapAlphaMapFrame or AtlasLootItemsFrame:GetParent() == AtlasFrame) then
AtlasMapMenu = true;
else
AtlasLootItemsFrame_DifficultyAtlasButton:Hide();
AtlasLootItemsFrame_DifficultyAtlasButton:Disable();
AtlasMapMenu = false;
end
if Type == nil and ATLASLOOT_FILTER_ENABLE == false or dataID:match("MENU") or ATLASLOOT_FILTER_ENABLE and dataSource[AtlasLoot_CurrentBoss].Type == nil then -- disable difficulty menu
AtlasLoot_DifficultyDisable()
+25 -1
View File
@@ -369,6 +369,30 @@
</OnShow>
</Scripts>
</Button>
<Button name="$parent_DifficultyAtlasButton" inherits="OptionsButtonTemplate">
<Size>
<AbsDimension x="140" y="23" />
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="60" y="4"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnShow>
this:SetFrameLevel( (this:GetParent()):GetFrameLevel() + 1 );
</OnShow>
<OnClick>
if AtlasLoot_DifficultyAtlas:IsOpen() then
AtlasLoot_DifficultyAtlas:Close();
else
AtlasLoot_DifficultyAtlas:Open(this);
end
</OnClick>
</Scripts>
</Button>
<Button name="AtlasLootItem_1" inherits="AtlasLootItem_Template" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
@@ -601,7 +625,7 @@
</Button>
<Button name="AtlasLootServerQueryButton" inherits="OptionsButtonTemplate">
<Size>
<AbsDimension x="160" y="23"/>
<AbsDimension x="140" y="23"/>
</Size>
<Anchors>
<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
@@ -25,6 +25,7 @@ local BabbleZone = AtlasLoot_GetLocaleLibBabble("LibBabble-Zone-3.0")
AtlasLoot_Dewdrop = AceLibrary("Dewdrop-2.0");
AtlasLoot_DewdropSubMenu = AceLibrary("Dewdrop-2.0");
AtlasLoot_DewdropSubMenu2 = AceLibrary("Dewdrop-2.0");
AtlasLoot_DifficultyAtlas = AceLibrary("Dewdrop-2.0");
indexID = 2
ItemindexID = ""
@@ -160,11 +161,32 @@ function AtlasLoot_DewDropSubMenu2Click(raidtablename, itemID, itemColour)
end
end
function AtlasLoot_DifficultyAtlasClick(raidtablename, itemID, itemColour)
if ATLASLOOT_FILTER_ENABLE == true then --used to refresh loottable when filter is enabled
AtlasLoot_FilterEnableButton()
ReEnableFilter = true
end
-- gets itemID reference
AtlasLootDefaultFrame_GetRaidDifficulty(raidtablename, itemID, itemColour)
--Show the select loot table
AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], AtlasLootItemsFrame.refreshOri[4]);
--Set text for difficulty
AtlasLootItemsFrame_DifficultyAtlasButton:SetText(DropTablename);
AtlasLoot_DifficultyAtlas:Close(1);
if ReEnableFilter then --used to refresh loottable when filter is enabled
AtlasLoot_FilterEnableButton()
end
end
function AtlasLoot_DifficultyDisable() --Disables Difficulty Menu
isTablereference = false
notPattern = false
AtlasLootItemsFrame_DifficultyAtlasButton:Hide();
AtlasLootItemsFrame_DifficultyAtlasButton:Disable();
AtlasLoot_DifficultyAtlas:Unregister(AtlasLootItemsFrame_DifficultyAtlasButton);
AtlasLoot_DewdropSubMenu2:Unregister(AtlasLootDefaultFrame_SubMenu2);
AtlasLootDefaultFrame_SubMenu2:Disable();
AtlasLootItemsFrame_DifficultyAtlasButton:SetText("Select Difficulty");
AtlasLootDefaultFrame_SelectedTable2:SetText("");
AtlasLootDefaultFrame_SelectedTable2:Hide();
DewDrop2Enable = false
@@ -173,15 +195,26 @@ end
function AtlasLoot_DifficultyEnable(dataID, dataSource) --Enables Difficulty Menu
if not AtlasLoot_Difficulty[dataSource[dataID].Type] then return end
AtlasLootDefaultFrame_SubMenu2:Enable();
AtlasLoot_DewdropSubMenu2:Unregister(AtlasLootDefaultFrame_SubMenu2);
AtlasLoot_DewdropSubMenu2Register(AtlasLoot_Difficulty[dataSource[dataID].Type]);
if SelectedTable2TextSet == false then
AtlasLootDefaultFrame_SelectedTable2:SetText(AtlasLoot_Difficulty[dataSource[dataID].Type][1][1][1])
if AtlasMapMenu == true then
AtlasLootItemsFrame_DifficultyAtlasButton:Show();
AtlasLootItemsFrame_DifficultyAtlasButton:Enable();
AtlasLoot_DifficultyAtlas:Unregister(AtlasLootItemsFrame_DifficultyAtlasButton);
AtlasLoot_DifficultyAtlasRegister(AtlasLoot_Difficulty[dataSource[dataID].Type]);
if SelectedTable2TextSet == false then
AtlasLootItemsFrame_DifficultyAtlasButton:SetText(AtlasLoot_Difficulty[dataSource[dataID].Type][1][1][1])
end
SelectedTable2TextSet = true
else
AtlasLootDefaultFrame_SubMenu2:Enable();
AtlasLoot_DewdropSubMenu2:Unregister(AtlasLootDefaultFrame_SubMenu2);
AtlasLoot_DewdropSubMenu2Register(AtlasLoot_Difficulty[dataSource[dataID].Type]);
if SelectedTable2TextSet == false then
AtlasLootDefaultFrame_SelectedTable2:SetText(AtlasLoot_Difficulty[dataSource[dataID].Type][1][1][1])
end
AtlasLootDefaultFrame_SelectedTable2:Show();
SelectedTable2TextSet = true
end
AtlasLootDefaultFrame_SelectedTable2:Show();
SelectedTable2TextSet = true
end
function AtlasLootDefaultFrame_GetRaidDifficulty(raidtablename, itemID, itemColour)
@@ -373,6 +406,140 @@ function AtlasLoot_DewdropSubMenu2Register(loottable)
)
end
function AtlasLoot_DifficultyAtlasRegister(loottable)
AtlasLoot_DifficultyAtlas:Register(AtlasLootItemsFrame_DifficultyAtlasButton,
'point', function(parent)
return "BOTTOM", "TOP"
end,
'children', function(level, value)
if level == 1 then
if AtlasLoot_Difficulty then
for k,v in ipairs(loottable) do
--If a link to show a submenu
if (type(v[1]) == "table") and (type(v[1][1]) == "string") then
local checked = false;
if v[1][3] == "Submenu" then
AtlasLoot_DifficultyAtlas:AddLine(
'text', v[1][1],
'textR', 1,
'textG', 0.82,
'textB', 0,
'func', AtlasLoot_DifficultyAtlasClick,
'arg1', v[1][1],
'arg2', v[1][2],
'arg3', v[1][3],
'arg4', v[1][4],
'notCheckable', true
)
elseif v[1][1] ~= "" then
AtlasLoot_DifficultyAtlas:AddLine(
'text', v[1][1],
'textR', 1,
'textG', 0.82,
'textB', 0,
'func', AtlasLoot_DifficultyAtlasClick,
'arg1', v[1][1],
'arg2', v[1][2],
'arg3', v[1][3],
'arg4', v[1][4],
'notCheckable', true
)
end
else
local lock=0;
--If an entry linked to a subtable
for i,j in pairs(v) do
if lock==0 then
AtlasLoot_DifficultyAtlas:AddLine(
'text', i,
'textR', 1,
'textG', 0.82,
'textB', 0,
'hasArrow', true,
'value', j,
'notCheckable', true
)
lock=1;
end
end
end
end
end
--Close button
AtlasLoot_DifficultyAtlas:AddLine(
'text', AL["Close Menu"],
'textR', 0,
'textG', 1,
'textB', 1,
'func', function() AtlasLoot_DifficultyAtlas:Close() end,
'notCheckable', true
)
elseif level == 2 then
if value then
for k,v in ipairs(value) do
if type(v) == "table" then
if (type(v[1]) == "string") then
local checked = false;
--If an entry to show a submenu
if v[4] == "Header" then
AtlasLoot_Dewdrop:AddLine(
'text', v[1],
'textR', 0.2,
'textG', 0.82,
'textB', 0.5,
'func', AtlasLoot_DifficultyAtlasClick,
'arg1', v[1],
'arg2', v[2],
'arg3', v[3],
'arg4', v[4],
'notCheckable', true
)
elseif v[3] == "Submenu" then
AtlasLoot_DifficultyAtlas:AddLine(
'text', v[1],
'textR', 1,
'textG', 0.82,
'textB', 0,
'func', AtlasLoot_DifficultyAtlasClick,
'arg1', v[1],
'arg2', v[2],
'arg3', v[3],
'arg4', v[4],
'notCheckable', true
)
else
AtlasLoot_DifficultyAtlas:AddLine(
'text', v[1],
'textR', 1,
'textG', 0.82,
'textB', 0,
'func', AtlasLoot_DifficultyAtlasClick,
'arg1', v[1],
'arg2', v[2],
'arg3', v[3],
'arg4', v[4],
'notCheckable', true
)
end
end
end
end
end
AtlasLoot_DifficultyAtlas:AddLine(
'text', AL["Close Menu"],
'textR', 0,
'textG', 1,
'textB', 1,
'func', function() AtlasLoot_DifficultyAtlas:Close() end,
'notCheckable', true
)
end
end,
'dontHook', true
)
end
--[[
AtlasLoot_DewdropSubMenuRegister(loottable):
loottable - Table defining the sub menu
+6 -6
View File
@@ -286,22 +286,22 @@ AtlasLoot_DewDropDown = {
},
[4] = {
{ AL["Crafting"], "CRAFTINGMENU", "Table", "Submenu2Table" },
{ AL["Crafting"], "CRAFTINGMENU", "Table" },
},
[5] = {
{ AL["Sets/Collections"], "SETMENU", "Table", "Submenu2Table" },
{ AL["Sets/Collections"], "SETMENU", "Table" },
},
[6] = {
{ AL["PvP Rewards"], "PVPMENU", "Table", "Submenu2Table" },
{ AL["PvP Rewards"], "PVPMENU", "Table" },
},
[7] = {
{ AL["World Bosses"], "WorldBosses", "Submenu", "Submenu2Table" },
{ AL["World Bosses"], "WorldBosses", "Submenu" },
},
[8] = {
{ AL["Reputation Factions"], "REPMENU", "Table", "Submenu2Table" },
{ AL["Reputation Factions"], "REPMENU", "Table" },
},
[9] = {
{ AL["World Events"], "WORLDEVENTMENU", "Table", "Submenu2Table" },
{ AL["World Events"], "WORLDEVENTMENU", "Table" },
},
};
+10 -10
View File
@@ -5063,16 +5063,16 @@ local BabbleFaction = AtlasLoot_GetLocaleLibBabble("LibBabble-Faction-3.0")
-- T1 Token Items
AtlasLoot_Data["T1Bracers"] = {
{ 1, 16830, "", "=q4=Cenarion Bracers", "=ds="..AL["Trash Mobs"], "", ""};
{ 2, 16850, "", "=q4=Giantstalker's Bracers", "=ds="..AL["Trash Mobs"], "", ""};
{ 3, 16799, "", "=q4=Arcanist Bindings", "=ds="..AL["Trash Mobs"], "", ""};
{ 4, 16857, "", "=q4=Lawbringer Bracers", "=ds="..AL["Trash Mobs"], "", ""};
{ 5, 16819, "", "=q4=Vambraces of Prophecy", "=ds="..AL["Trash Mobs"], "", ""};
{ 6, 16825, "", "=q4=Nightslayer Bracelets", "=ds="..AL["Trash Mobs"], "", ""};
{ 7, 16840, "", "=q4=Earthfury Bracers", "=ds="..AL["Trash Mobs"], "", ""};
{ 8, 16804, "", "=q4=Felheart Bracers", "=ds="..AL["Trash Mobs"], "", ""};
{ 9, 16861, "", "=q4=Bracers of Might", "=ds="..AL["Trash Mobs"], "", ""};
{ 10, 10483, "", "=q4=Wristguards of Might", "=ds="..AL["Trash Mobs"], ""};
{ 1, 16830, "", "=q4=Cenarion Bracers", "=ds=#c1#", "", ""};
{ 2, 16850, "", "=q4=Giantstalker's Bracers", "=ds=#c2#", "", ""};
{ 3, 16799, "", "=q4=Arcanist Bindings", "=ds=#c3#", "", ""};
{ 4, 16857, "", "=q4=Lawbringer Bracers", "=ds=#c4#", "", ""};
{ 5, 16819, "", "=q4=Vambraces of Prophecy", "=ds=#c5#", "", ""};
{ 6, 16825, "", "=q4=Nightslayer Bracelets", "=ds=#c6#", "", ""};
{ 7, 16840, "", "=q4=Earthfury Bracers", "=ds=#c7#", "", ""};
{ 8, 16804, "", "=q4=Felheart Bracers", "=ds=#c8#", "", ""};
{ 9, 16861, "", "=q4=Bracers of Might", "=ds=#c9#", "", ""};
{ 10, 10483, "", "=q4=Wristguards of Might", "=ds=#c9#", "", ""};
Back = AtlasLoot_Lastboss;
Type = "ClassicRaid";