Skip to content

Commit

Permalink
fix right click in cata
Browse files Browse the repository at this point in the history
  • Loading branch information
fusionpit committed Nov 30, 2024
1 parent 5bff807 commit 4807bb4
Showing 1 changed file with 28 additions and 96 deletions.
124 changes: 28 additions & 96 deletions WhatsTrainingUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,124 +282,56 @@ function wt.CreateFrame()
wt.MainFrame = mainFrame
end


wt.ClickHook = function(spell, afterClick, row)
local tomeId = spell.id
if (not wt.TomeIds or not wt.TomeIds[tomeId]) then
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
local isIgnored = ignoreStore:IsIgnored(spell.id)
local menuTitle = spell.formattedFullName
if (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC) then
local menu = {
{text = menuTitle, isTitle = true, classicChecks = true},
{
text = wt.L.IGNORED_TT,
checked = isIgnored,
func = function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
afterClick()
end,
isNotRadio = true
-- classicChecks = true
}
}

MenuUtil.CreateContextMenu(row, function(owner, rootDescription)
rootDescription:CreateTitle(menuTitle)
rootDescription:CreateCheckbox(wt.L.IGNORED_TT, function() return isIgnored end, function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
afterClick()
return MenuResponse.Close
end)

local allRanks = wt:AllRanks(spell.id)

if allRanks and #allRanks > 1 then
local allIgnored = true
for _, id in ipairs(allRanks) do
allIgnored = allIgnored and ignoreStore:IsIgnored(id)
end
tinsert(menu, {
text = wt.L.IGNORE_ALL_TT,
checked = allIgnored,
func = function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:UpdateMany(allRanks, not allIgnored)
afterClick()
end,
isNotRadio = true,
})
end

EasyMenu(menu, menuFrame, "cursor", 10, 35, "MENU")
else
MenuUtil.CreateContextMenu(row, function(owner, rootDescription)
rootDescription:CreateTitle(menuTitle)
rootDescription:CreateCheckbox(wt.L.IGNORED_TT, function() return isIgnored end, function()
rootDescription:CreateCheckbox(wt.L.IGNORE_ALL_TT, function() return allIgnored end, function ()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
ignoreStore:UpdateMany(allRanks, not allIgnored)
afterClick()
return MenuResponse.Close
end)

local allRanks = wt:AllRanks(spell.id)
if allRanks and #allRanks > 1 then
local allIgnored = true
for _, id in ipairs(allRanks) do
allIgnored = allIgnored and ignoreStore:IsIgnored(id)
end
rootDescription:CreateCheckbox(wt.L.IGNORE_ALL_TT, function() return allIgnored end, function ()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:UpdateMany(allRanks, not allIgnored)
afterClick()
return MenuResponse.Close
end)
end
end)
end
end
end)

return
end

local checked = wt.learnedPetAbilityMap[tomeId]
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
local isIgnored = ignoreStore:IsIgnored(spell.id)
if (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC) then
local menu = {
{text = wt.L.TOME_HEADER, isTitle = true, classicChecks = true},
{
text = wt.L.TOME_LEARNED,
checked = checked,
func = function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
wt.learnedPetAbilityMap[tomeId] = not checked
afterClick()
end,
isNotRadio = true
},
{text = spell.name, isTitle = true, classicChecks = true},
{
text = wt.L.IGNORED_TT,
checked = isIgnored,
func = function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
afterClick()
end,
isNotRadio = true
-- classicChecks = true
}
}
EasyMenu(menu, menuFrame, "cursor", 10, 35, "MENU")
else
MenuUtil.CreateContextMenu(row, function(owner, rootDescription)
rootDescription:CreateTitle(wt.L.TOME_HEADER)
rootDescription:CreateCheckbox(wt.L.TOME_LEARNED, function() return checked end, function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
wt.learnedPetAbilityMap[tomeId] = not checked
afterClick()
return MenuResponse.Close
end)
rootDescription:CreateTitle(spell.name)
rootDescription:CreateCheckbox(wt.L.IGNORED_TT, function() return isIgnored end, function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
afterClick()
return MenuResponse.Close
end)
MenuUtil.CreateContextMenu(row, function(owner, rootDescription)
rootDescription:CreateTitle(wt.L.TOME_HEADER)
rootDescription:CreateCheckbox(wt.L.TOME_LEARNED, function() return checked end, function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
wt.learnedPetAbilityMap[tomeId] = not checked
afterClick()
return MenuResponse.Close
end)
end
rootDescription:CreateTitle(spell.name)
rootDescription:CreateCheckbox(wt.L.IGNORED_TT, function() return isIgnored end, function()
PlaySound(SOUNDKIT.U_CHAT_SCROLL_BUTTON)
ignoreStore:Flip(spell.id)
afterClick()
return MenuResponse.Close
end)
end)
end

0 comments on commit 4807bb4

Please sign in to comment.