Skip to content

Commit

Permalink
feat: Added general mythic+ profile
Browse files Browse the repository at this point in the history
  • Loading branch information
peti446 committed Sep 15, 2024
1 parent e53a8b3 commit f651cf2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
33 changes: 32 additions & 1 deletion Frames/Main/MenuItems/TalentSuggestionConfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ end

local function OnDropDownGroupSelectedForMythycPlus(frame, _, group)
local InstanceIDs = frame:GetUserData("InstanceIDs") or {}
local MythicAffixHash = frame:GetUserData("MythicAffixHash")
local IsGeneral = frame:GetUserData("IsGeneral");
local MythicAffixHash = IsGeneral and -1 or frame:GetUserData("MythicAffixHash")
local SeasonID = frame:GetUserData("MythicSeasonID");

if(group == "None") then
Expand Down Expand Up @@ -191,6 +192,36 @@ local function DrawMythicPlusSection(frame, season, instancesIDs, validProfilesL
currentSeasonData[week] = {mythicPlusHash, BuildMythicPlusTitle(week, SwitchSwitch:decodeMythicPlusAffixesID(mythicPlusHash))};
end

local GeneralDropdown = AceGUI:Create("Dropdown")
GeneralDropdown:SetLabel(L["General Mythic+"])
GeneralDropdown:SetUserData("InstanceIDs", instancesIDs)
GeneralDropdown:SetUserData("IsGeneral", true)
GeneralDropdown:SetUserData("MythicSeasonID", season)
GeneralDropdown.alignoffset = 25
GeneralDropdown:SetList(validProfilesList)
GeneralDropdown:SetCallback("OnValueChanged", OnDropDownGroupSelectedForMythycPlus)
local GeneralSetValue = nil
for _journalID, instanceID in pairs(instancesIDs or {}) do
local savedSuggestions = SwitchSwitch:GetMythicPlusProfileSuggestion(instanceID, -1, season, SwitchSwitch:GetPlayerClass(), SwitchSwitch:GetCurrentSpec())
if(savedSuggestions ~= nil) then
if(GeneralSetValue == nil) then
GeneralSetValue = savedSuggestions
else
if(GeneralSetValue ~= savedSuggestions) then
GeneralSetValue = "Multiple"
break;
end
end
end
end
if(GeneralSetValue == "Multiple") then
GeneralDropdown:SetText(L["Multiple values"])
else
if(GeneralSetValue == nil) then GeneralSetValue = "None"; end
GeneralDropdown:SetValue(GeneralSetValue)
end
frame:AddChild(GeneralDropdown)

--Render dropboxes
local currentWeekAfixHash = SwitchSwitch:GetCurrentMythicPlusAfixHash()
for _, packedData in ipairs(currentSeasonData) do
Expand Down
5 changes: 3 additions & 2 deletions GobalEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ function SwitchSwitch:SWITCHSWITCH_BOSS_DETECTED(event_name, instanceID, difficu

-- If we are in mythic/mythic+ we want to see the week specific data
local mythicPlusProfileId = self:GetMythicPlusProfileSuggestion(instanceID)
if(difficultyID == self.PreMythicPlusDificulty and mythicPlusProfileId ~= nil) then
suggestedProfileId = mythicPlusProfileId
local mythicPlusGeneralProfileId = self:GetMythicPlusProfileSuggestion(instanceID, -1)
if(difficultyID == self.PreMythicPlusDificulty and (mythicPlusProfileId ~= nil or mythicPlusGeneralProfileId ~= nil)) then
suggestedProfileId = mythicPlusProfileId or mythicPlusGeneralProfileId
end
end

Expand Down

0 comments on commit f651cf2

Please sign in to comment.