782c7be - Clickable boss frames for Kael
authorAleksi Blinnikka <aleksi.blinnikka@iki.fi>
Wed, 30 Jun 2021 16:30:37 +0000
committerAleksi Blinnikka <aleksi.blinnikka@iki.fi>
Wed, 30 Jun 2021 16:30:37 +0000
kehys/boss.lua

index 988b93d..fecf8fd 100644 (file)
@@ -6,6 +6,8 @@ local CFrame = CreateFrame("Frame", "kehysBossInit", UIParent);
 local CTimerAfter = C_Timer.After;
 
 local barTexture = "Interface\\AddOns\\kehys\\images\\minimalist";
+local class = nil;
+local attributes = {};
 
 local function showTooltip(frame)
     GameTooltip_SetDefaultAnchor(GameTooltip, frame);
@@ -65,7 +67,12 @@ local function initBoss(parent, y, width, height, update, event)
     end);
     f:SetScript("OnEnter", showTooltip);
     f:SetScript("OnLeave", hideTooltip);
+    -- set attributes
     f:RegisterForClicks("AnyDown");
+    for attr, val in pairs(attributes) do
+        if attr ~= "type1" and attr ~= "spell1" then f:SetAttribute(attr, val) end
+    end
+    -- rest give target and menu
     f:SetAttribute("*type1", "target");
     f:SetAttribute("*type2", "togglemenu");
     f:SetAttribute("toggleForVehicle", false);
@@ -138,6 +145,8 @@ local function initBoss(parent, y, width, height, update, event)
 end
 
 CFrame:SetScript("OnEvent", function(self)
+    _, class = UnitClass("player");
+    attributes = addon.Clickheal[class];
     self:UnregisterAllEvents();
     CFrame:SetFrameStrata("LOW");
     CFrame:SetPoint("CENTER", nil, "CENTER");