diff --git a/modules/config.lua b/modules/config.lua index d15f563c..90360b66 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -37,6 +37,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", nil, "buff_size", "20") pfUI:UpdateConfig("unitframes", nil, "debuff_size", "20") pfUI:UpdateConfig("unitframes", nil, "layout", "default") + pfUI:UpdateConfig("unitframes", nil, "globalclick", "0") pfUI:UpdateConfig("unitframes", "player", "width", "200") pfUI:UpdateConfig("unitframes", "player", "height", "50") pfUI:UpdateConfig("unitframes", "player", "pheight", "10") diff --git a/modules/group.lua b/modules/group.lua index 3bf5c1e5..bf9a7ad7 100644 --- a/modules/group.lua +++ b/modules/group.lua @@ -172,6 +172,45 @@ pfUI:RegisterModule("group", function () DropItemOnUnit("party" .. this.id) else TargetUnit("party" .. this.id) + + if pfUI_config.unitframes.globalclick == "0" then return end + + -- clickcast: shift modifier + if IsShiftKeyDown() then + if pfUI_config.unitframes.raid.clickcast_shift ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_shift) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: alt modifier + elseif IsAltKeyDown() then + if pfUI_config.unitframes.raid.clickcast_alt ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_alt) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: ctrl modifier + elseif IsControlKeyDown() then + if pfUI_config.unitframes.raid.clickcast_ctrl ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_ctrl) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: default + else + if pfUI_config.unitframes.raid.clickcast ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + else + -- no clickcast: default action + TargetUnit("party" .. this.id) + end + end end else local x, y = GetCursorPosition() diff --git a/modules/gui.lua b/modules/gui.lua index 29daf40c..12a84672 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -700,6 +700,7 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.uf, "Buff size", pfUI_config.unitframes, "buff_size") pfUI.gui:CreateConfig(pfUI.gui.uf, "Debuff size", pfUI_config.unitframes, "debuff_size") pfUI.gui:CreateConfig(pfUI.gui.uf, "Layout", pfUI_config.unitframes, "layout", "dropdown", { "default", "tukui" }) + pfUI.gui:CreateConfig(pfUI.gui.uf, "Enable Clickcast for all Frames", pfUI_config.unitframes, "globalclick", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.uf, "Player width", pfUI_config.unitframes.player, "width") pfUI.gui:CreateConfig(pfUI.gui.uf, "Player height", pfUI_config.unitframes.player, "height") pfUI.gui:CreateConfig(pfUI.gui.uf, "Player powerbar height", pfUI_config.unitframes.player, "pheight") diff --git a/modules/player.lua b/modules/player.lua index d1e7bcdd..c601fc4f 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -25,6 +25,45 @@ pfUI:RegisterModule("player", function () end else TargetUnit("player") + + if pfUI_config.unitframes.globalclick == "0" then return end + + -- clickcast: shift modifier + if IsShiftKeyDown() then + if pfUI_config.unitframes.raid.clickcast_shift ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_shift) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: alt modifier + elseif IsAltKeyDown() then + if pfUI_config.unitframes.raid.clickcast_alt ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_alt) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: ctrl modifier + elseif IsControlKeyDown() then + if pfUI_config.unitframes.raid.clickcast_ctrl ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_ctrl) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: default + else + if pfUI_config.unitframes.raid.clickcast ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + else + -- no clickcast: default action + TargetUnit("player") + end + end end end) diff --git a/modules/target.lua b/modules/target.lua index 898c06e7..e0daec18 100644 --- a/modules/target.lua +++ b/modules/target.lua @@ -27,6 +27,38 @@ pfUI:RegisterModule("target", function () pfUI.uf.target:SetScript("OnClick", function () if arg1 == "RightButton" then ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor") + else + if pfUI_config.unitframes.globalclick == "0" then return end + + -- clickcast: shift modifier + if IsShiftKeyDown() then + if pfUI_config.unitframes.raid.clickcast_shift ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_shift) + pfUI.uf.target.noanim = "yes" + return + end + -- clickcast: alt modifier + elseif IsAltKeyDown() then + if pfUI_config.unitframes.raid.clickcast_alt ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_alt) + pfUI.uf.target.noanim = "yes" + return + end + -- clickcast: ctrl modifier + elseif IsControlKeyDown() then + if pfUI_config.unitframes.raid.clickcast_ctrl ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_ctrl) + pfUI.uf.target.noanim = "yes" + return + end + -- clickcast: default + else + if pfUI_config.unitframes.raid.clickcast ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast) + pfUI.uf.target.noanim = "yes" + return + end + end end end) diff --git a/modules/targettarget.lua b/modules/targettarget.lua index 80d3ce42..16f1d20a 100644 --- a/modules/targettarget.lua +++ b/modules/targettarget.lua @@ -25,8 +25,47 @@ pfUI:RegisterModule("targettarget", function () pfUI.uf.targettarget:RegisterForClicks('LeftButtonUp', 'RightButtonUp') pfUI.uf.targettarget:SetScript("OnClick", function () - TargetUnit("targettarget") - end) + TargetUnit("targettarget") + + if pfUI_config.unitframes.globalclick == "0" then return end + + -- clickcast: shift modifier + if IsShiftKeyDown() then + if pfUI_config.unitframes.raid.clickcast_shift ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_shift) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: alt modifier + elseif IsAltKeyDown() then + if pfUI_config.unitframes.raid.clickcast_alt ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_alt) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: ctrl modifier + elseif IsControlKeyDown() then + if pfUI_config.unitframes.raid.clickcast_ctrl ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast_ctrl) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + end + -- clickcast: default + else + if pfUI_config.unitframes.raid.clickcast ~= "" then + CastSpellByName(pfUI_config.unitframes.raid.clickcast) + pfUI.uf.target.noanim = "yes" + TargetLastTarget() + return + else + -- no clickcast: default action + TargetUnit("targettarget") + end + end + end) pfUI.uf.targettarget:SetScript("OnUpdate", function() if UnitExists("targettarget") then