Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 32 additions & 21 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ function eventFrame:ADDON_LOADED(arg1)
if type(CellDB["clickCastings"][Cell.vars.playerClass]) ~= "table" then
CellDB["clickCastings"][Cell.vars.playerClass] = {
["useCommon"] = true,
["hookBlizzardFrames"] = false,
["smartResurrection"] = "disabled",
["alwaysTargeting"] = {
["common"] = "disabled",
Expand Down Expand Up @@ -713,28 +714,38 @@ function eventFrame:PLAYER_ENTERING_WORLD()
end
end

-- REVIEW:
-- local function RegisterGlobalClickCastings()
-- ClickCastFrames = ClickCastFrames or {}
local function registerGlobalClickCastings()
ClickCastFrames = ClickCastFrames or {}

-- if ClickCastFrames then
-- for frame, options in pairs(ClickCastFrames) do
-- F:RegisterFrame(frame)
-- end
-- end
if ClickCastFrames then
for frame, options in pairs(ClickCastFrames) do
F:RegisterFrame(frame, false)
end
end

ClickCastFrames = setmetatable({}, {__newindex = function(t, k, v)
if v == nil or v == false then
F:UnregisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
else
F:RegisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
end
end})

for _, name in pairs(Cell.blizzardFrames) do
local frame = _G[name]
if frame then
F:RegisterFrame(frame, false)
end
end

F:IterateAllUnitButtons(function (b)
F:RegisterFrame(b, true)
end)
Cell:Fire("UpdateClickCastings")
end

-- ClickCastFrames = setmetatable({}, {__newindex = function(t, k, v)
-- if v == nil or v == false then
-- F:UnregisterFrame(k)
-- else
-- F:RegisterFrame(k)
-- end
-- end})

-- F:IterateAllUnitButtons(function (b)
-- ClickCastFrames[b] = true
-- end)
-- end

function eventFrame:PLAYER_LOGIN()
F:Debug("|cffbbbbbb=== PLAYER_LOGIN ===")
Expand Down Expand Up @@ -768,7 +779,7 @@ function eventFrame:PLAYER_LOGIN()
-- REVIEW: register unitframes for click casting
-- RegisterGlobalClickCastings()
-- update click-castings
Cell:Fire("UpdateClickCastings")
registerGlobalClickCastings()
-- update indicators
-- Cell:Fire("UpdateIndicators") -- NOTE: already update in GROUP_ROSTER_UPDATE -> GroupTypeChanged -> F:UpdateLayout
-- update texture and font
Expand Down
37 changes: 36 additions & 1 deletion Core_Cata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ function eventFrame:ADDON_LOADED(arg1)
CellCharacterDB["clickCastings"] = {
["class"] = Cell.vars.playerClass, -- NOTE: validate on import
["useCommon"] = true,
["hookBlizzardFrames"] = false,
["smartResurrection"] = "disabled",
["alwaysTargeting"] = {
["common"] = "disabled",
Expand Down Expand Up @@ -675,6 +676,40 @@ local function UpdateSpecVars(exceptActiveTalentGroup)
end
end


local function registerGlobalClickCastings()
ClickCastFrames = ClickCastFrames or {}

if ClickCastFrames then
for frame, options in pairs(ClickCastFrames) do
F:RegisterFrame(frame, false)
end
end

ClickCastFrames = setmetatable({}, {__newindex = function(t, k, v)
if v == nil or v == false then
F:UnregisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
else
F:RegisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
end
end})

for _, name in pairs(Cell.blizzardFrames) do
local frame = _G[name]
if frame then
F:RegisterFrame(frame, false)
end
end

F:IterateAllUnitButtons(function (b)
F:RegisterFrame(b, true)
end)
Cell:Fire("UpdateClickCastings")
end


function eventFrame:PLAYER_LOGIN()
F:Debug("|cffbbbbbb=== PLAYER_LOGIN ===")
eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
Expand Down Expand Up @@ -704,7 +739,7 @@ function eventFrame:PLAYER_LOGIN()
-- update visibility
Cell:Fire("UpdateVisibility")
-- update click-castings
Cell:Fire("UpdateClickCastings")
registerGlobalClickCastings()
-- update indicators
-- Cell:Fire("UpdateIndicators") -- NOTE: already update in GROUP_ROSTER_UPDATE -> GroupTypeChanged -> F:UpdateLayout
-- update texture and font
Expand Down
35 changes: 34 additions & 1 deletion Core_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ function eventFrame:ADDON_LOADED(arg1)
CellCharacterDB["clickCastings"] = {
["class"] = Cell.vars.playerClass, -- validate on import
["useCommon"] = true,
["hookBlizzardFrames"] = false,
["smartResurrection"] = "disabled",
["alwaysTargeting"] = {
["common"] = "disabled",
Expand Down Expand Up @@ -611,6 +612,38 @@ function eventFrame:PLAYER_ENTERING_WORLD()
end
end

local function registerGlobalClickCastings()
ClickCastFrames = ClickCastFrames or {}

if ClickCastFrames then
for frame, options in pairs(ClickCastFrames) do
F:RegisterFrame(frame, false)
end
end

ClickCastFrames = setmetatable({}, {__newindex = function(t, k, v)
if v == nil or v == false then
F:UnregisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
else
F:RegisterFrame(k, false)
Cell:Fire("UpdateClickCastings")
end
end})

for _, name in pairs(Cell.blizzardFrames) do
local frame = _G[name]
if frame then
F:RegisterFrame(frame, false)
end
end

F:IterateAllUnitButtons(function (b)
F:RegisterFrame(b, true)
end)
Cell:Fire("UpdateClickCastings")
end

function eventFrame:PLAYER_LOGIN()
F:Debug("|cffbbbbbb=== PLAYER_LOGIN ===")
eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
Expand All @@ -631,7 +664,7 @@ function eventFrame:PLAYER_LOGIN()
-- update visibility
Cell:Fire("UpdateVisibility")
-- update click-castings
Cell:Fire("UpdateClickCastings")
registerGlobalClickCastings()
-- update indicators
-- Cell:Fire("UpdateIndicators") -- NOTE: already update in GROUP_ROSTER_UPDATE -> GroupTypeChanged -> F:UpdateLayout
-- update texture and font
Expand Down
69 changes: 37 additions & 32 deletions Modules/ClickCastings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local listButtons = {}
local clickCastingTable
local loaded
local LoadProfile
local alwaysTargeting, smartResurrection
local alwaysTargeting, smartResurrection, hookBlizzardFrames
-------------------------------------------------
-- changes
-------------------------------------------------
Expand Down Expand Up @@ -556,6 +556,7 @@ local function UpdateClickCastings(noReload, onlyqueued)
end

smartResurrection = Cell.vars.clickCastings["smartResurrection"]
hookBlizzardFrames = Cell.vars.clickCastings["hookBlizzardFrames"]

if not noReload then
if clickCastingsTab:IsVisible() then
Expand All @@ -568,34 +569,25 @@ local function UpdateClickCastings(noReload, onlyqueued)
local snippet = GetBindingSnippet()
F:Debug(snippet)

-- REVIEW:
-- local clickFrames = Cell.clickCastFrames
-- if onlyqueued then
-- clickFrames = Cell.clickCastFrameQueue
-- end
-- for b, val in pairs(clickFrames) do
-- Cell.clickCastFrameQueue[b] = nil
-- -- clear if attribute already set
-- ClearClickCastings(b)
-- if val then
-- -- update bindingClicks
-- b:SetAttribute("snippet", snippet)
-- SetBindingClicks(b)

-- -- load db and set attribute
-- ApplyClickCastings(b)
-- end
-- end

F:IterateAllUnitButtons(function(b)
local clickFrames = Cell.clickCastFrames
if not hookBlizzardFrames then
clickFrames = Cell.clickCastCellFrames
end
for b, _ in pairs(Cell.clickCastFrames) do
-- clear if attribute already set
ClearClickCastings(b)
-- update bindingClicks
b:SetAttribute("snippet", snippet)
SetBindingClicks(b)
-- load db and set attribute
ApplyClickCastings(b)
end, false, true)
end
for b, val in pairs(clickFrames) do
Cell.clickCastFrameQueue[b] = nil
if val then
-- update bindingClicks
b:SetAttribute("snippet", snippet)
SetBindingClicks(b)

-- load db and set attribute
ApplyClickCastings(b)
end
end

previousClickCastings = F:Copy(clickCastingTable)
end
Expand All @@ -616,7 +608,7 @@ local function CreateProfilePane()
profilePane:SetPoint("TOPLEFT", 5, -5)

profileDropdown = Cell:CreateDropdown(profilePane, 412)
profileDropdown:SetPoint("TOPLEFT", profilePane, "TOPLEFT", 5, -27)
profileDropdown:SetPoint("TOPLEFT", profilePane, "TOPLEFT", 5, -22)
profileDropdown:SetEnabled(not Cell.isVanilla)

profileDropdown:SetItems({
Expand All @@ -640,17 +632,29 @@ local function CreateProfilePane()
end


local hookBlizzFrames
-------------------------------------------------
-- Hook click casting to blizzard frames
-------------------------------------------------
local function CreateHookBlizzardFramesCB()
hookBlizzFrames = Cell:CreateCheckButton(clickCastingsTab, "Hook to Blizzard Frames", function(checked)
Cell.vars.clickCastings["hookBlizzardFrames"] = checked
Cell:Fire("UpdateClickCastings")
end)
hookBlizzFrames:SetPoint("TOPLEFT", profileDropdown, 0, -22)
end

-------------------------------------------------
-- always targeting
-------------------------------------------------
local targetingDropdown

local function CreateTargetingPane()
local targetingPane = Cell:CreateTitledPane(clickCastingsTab, L["Always Targeting"], 205, 50)
targetingPane:SetPoint("TOPLEFT", clickCastingsTab, "TOPLEFT", 5, -70)
targetingPane:SetPoint("TOPLEFT", hookBlizzFrames, "TOPLEFT", 5, -22)

targetingDropdown = Cell:CreateDropdown(targetingPane, 195)
targetingDropdown:SetPoint("TOPLEFT", targetingPane, "TOPLEFT", 5, -27)
targetingDropdown:SetPoint("TOPLEFT", targetingPane, "TOPLEFT", 5, -22)

local items = {
{
Expand Down Expand Up @@ -696,10 +700,10 @@ local smartResDropdown

local function CreateSmartResPane()
local smartResPane = Cell:CreateTitledPane(clickCastingsTab, L["Smart Resurrection"], 205, 50)
smartResPane:SetPoint("TOPLEFT", clickCastingsTab, "TOPLEFT", 222, -70)
smartResPane:SetPoint("TOPLEFT", hookBlizzFrames, "TOPLEFT", 222, -22)

smartResDropdown = Cell:CreateDropdown(smartResPane, 195)
smartResDropdown:SetPoint("TOPLEFT", smartResPane, "TOPLEFT", 5, -27)
smartResDropdown:SetPoint("TOPLEFT", smartResPane, "TOPLEFT", 5, -22)

local items = {
{
Expand Down Expand Up @@ -1630,6 +1634,7 @@ local function ShowTab(tab)
if not init then
init = true
CreateProfilePane()
CreateHookBlizzardFramesCB()
CreateTargetingPane()
CreateSmartResPane()
CreateListPane()
Expand Down
42 changes: 27 additions & 15 deletions Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -802,24 +802,36 @@ end
-------------------------------------------------
local combinedHeader = "CellRaidFrameHeader0"
local separatedHeaders = {"CellRaidFrameHeader1", "CellRaidFrameHeader2", "CellRaidFrameHeader3", "CellRaidFrameHeader4", "CellRaidFrameHeader5", "CellRaidFrameHeader6", "CellRaidFrameHeader7", "CellRaidFrameHeader8"}
Cell.blizzardFrames = {
"PlayerFrame",
"TargetFrame",
"PetFrame",
"PartyMemberFrame1",
"PartyMemberFrame2",
"PartyMemberFrame3",
"PartyMemberFrame4",
"PartyMemberFrame1PetFrame",
"PartyMemberFrame2PetFrame",
"PartyMemberFrame3PetFrame",
"PartyMemberFrame4PetFrame",
}
Cell.clickCastCellFrames = {}
Cell.clickCastFrames = {}
Cell.clickCastFrameQueue = {}

-- REVIEW:
-- Cell.clickCastFrames = {}
-- Cell.clickCastFrameQueue = {}

-- function F:RegisterFrame(frame)
-- Cell.clickCastFrames[frame] = true
-- Cell.clickCastFrameQueue[frame] = true -- put into queue
-- Cell:Fire("UpdateQueuedClickCastings")
-- end
function F:RegisterFrame(frame, isCell)
Cell.clickCastFrames[frame] = true
if isCell then
Cell.clickCastCellFrames[frame] = true
end
Cell.clickCastFrameQueue[frame] = true -- put into queue
end

-- function F:UnregisterFrame(frame)
-- Cell.clickCastFrames[frame] = nil -- ignore
-- Cell.clickCastFrameQueue[frame] = false -- mark for only cleanup
-- Cell:Fire("UpdateQueuedClickCastings")
-- end
function F:UnregisterFrame(frame, isCell)
Cell.clickCastFrames[frame] = nil -- ignore
Cell.clickCastFrameQueue[frame] = nil -- mark for only cleanup
end

-- REVIEW: updateBlizzardFrames
function F:IterateAllUnitButtons(func, updateCurrentGroupOnly, updateQuickAssist, updateBlizzardFrames)
-- solo
if not updateCurrentGroupOnly or (updateCurrentGroupOnly and Cell.vars.groupType == "solo") then
Expand Down