Quantcast

add maintank and mainassistant support

Ou Junhui [10-16-21 - 16:19]
add maintank and mainassistant support
Filename
oUF/elements/raidroleindicator.lua
oUF_Simple/core/functions.lua
oUF_Simple/core/spawn.lua
oUF_Simple/core/style.lua
oUF_Simple/core/tags.lua
oUF_SimpleConfig/party.lua
oUF_SimpleConfig/raid.lua
diff --git a/oUF/elements/raidroleindicator.lua b/oUF/elements/raidroleindicator.lua
index d22915b..6bdb92c 100644
--- a/oUF/elements/raidroleindicator.lua
+++ b/oUF/elements/raidroleindicator.lua
@@ -42,7 +42,10 @@ local function Update(self, event)
 	end

 	local role, isShown
+	--[[ classic disabled
 	if(UnitInRaid(unit) and not UnitHasVehicleUI(unit)) then
+	]]
+	if UnitInRaid(unit) then
 		if(GetPartyAssignment('MAINTANK', unit)) then
 			isShown = true
 			element:SetTexture(MAINTANK_ICON)
diff --git a/oUF_Simple/core/functions.lua b/oUF_Simple/core/functions.lua
index 12fbd8b..e9d46a8 100644
--- a/oUF_Simple/core/functions.lua
+++ b/oUF_Simple/core/functions.lua
@@ -471,6 +471,7 @@ local function CreateRaidDebuffs(self)
   frame.Backdrop = CreateBackdrop(frame) -- create backdrop
   frame.icon = frame:CreateTexture(nil, "ARTWORK")
   frame.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
+  frame.icon:SetAllPoints()
   frame.count = frame:CreateFontString(nil, "OVERLAY")
   frame.count:SetFont(L.C.fonts.expressway, cfg.size/2, "OUTLINE")
   frame.count:SetShadowColor(0,0,0,0.6)
@@ -486,6 +487,18 @@ local function CreateRaidDebuffs(self)
 end
 L.F.CreateRaidDebuffs = CreateRaidDebuffs

+local function CreateRaidRoleIndicator(self)
+  if not self.cfg.raidrole or not self.cfg.raidrole.enabled then return end
+  return CreateIcon(self.Health,"OVERLAY",2,self.cfg.raidrole.size,self.cfg.raidrole.point)
+end
+L.F.CreateRaidRoleIndicator = CreateRaidRoleIndicator
+
+local function CreateGroupRoleIndicator(self)
+  if not self.cfg.grouprole or not self.cfg.grouprole.enabled then return end
+  return CreateIcon(self.Health,"OVERLAY",2,self.cfg.grouprole.size,self.cfg.grouprole.point)
+end
+L.F.CreateGroupRoleIndicator = CreateGroupRoleIndicator
+
 --CreateNameText
 local function CreateNameText(self)
   if not self.cfg.healthbar or not self.cfg.healthbar.name or not self.cfg.healthbar.name.enabled then return end
diff --git a/oUF_Simple/core/spawn.lua b/oUF_Simple/core/spawn.lua
index 5866e91..8e9e9de 100644
--- a/oUF_Simple/core/spawn.lua
+++ b/oUF_Simple/core/spawn.lua
@@ -162,6 +162,50 @@ if L.F.CreateRaidStyle then
       ]]):format(L.C.raid.size[1], L.C.raid.size[2], L.C.raid.scale)
     ):SetPoint(unpack(L.C.raid.points[i])) --config needs to provide 8 point tables, one for each raid group
   end
+
+  if L.C.raid.tank and L.C.raid.tank.enabled then
+    oUF:SpawnHeader(
+      A.."RaidHeader".."MainTank",
+      L.C.raid.setup.template,
+      L.C.raid.setup.visibility,
+      "showPlayer", L.C.raid.setup.showPlayer,
+      "showSolo",   L.C.raid.setup.showSolo,
+      "showParty",  L.C.raid.setup.showParty,
+      "showRaid",   L.C.raid.setup.showRaid,
+      "point",      L.C.raid.setup.point,
+      "xOffset",    L.C.raid.setup.xOffset,
+      "yOffset",    L.C.raid.setup.yOffset,
+      "groupFilter",    "MAINTANK",
+      "unitsPerColumn", 5,
+      "oUF-initialConfigFunction", ([[
+        self:SetWidth(%d)
+        self:SetHeight(%d)
+        self:GetParent():SetScale(%f)
+      ]]):format(L.C.raid.size[1], L.C.raid.size[2], L.C.raid.scale)
+    ):SetPoint(unpack(L.C.raid.tank.point))
+  end
+
+  if L.C.raid.assist and L.C.raid.assist.enabled then
+    oUF:SpawnHeader(
+      A.."RaidHeader".."MainAssist",
+      L.C.raid.setup.template,
+      L.C.raid.setup.visibility,
+      "showPlayer", L.C.raid.setup.showPlayer,
+      "showSolo",   L.C.raid.setup.showSolo,
+      "showParty",  L.C.raid.setup.showParty,
+      "showRaid",   L.C.raid.setup.showRaid,
+      "point",      L.C.raid.setup.point,
+      "xOffset",    L.C.raid.setup.xOffset,
+      "yOffset",    L.C.raid.setup.yOffset,
+      "groupFilter",    "MAINASSIST",
+      "unitsPerColumn", 5,
+      "oUF-initialConfigFunction", ([[
+        self:SetWidth(%d)
+        self:SetHeight(%d)
+        self:GetParent():SetScale(%f)
+      ]]):format(L.C.raid.size[1], L.C.raid.size[2], L.C.raid.scale)
+    ):SetPoint(unpack(L.C.raid.assist.point))
+  end
 end

 --spawn arena frames
diff --git a/oUF_Simple/core/style.lua b/oUF_Simple/core/style.lua
index 77c71ba..a1e6d80 100644
--- a/oUF_Simple/core/style.lua
+++ b/oUF_Simple/core/style.lua
@@ -42,9 +42,12 @@ local function CreateStyle(self)
   self.Swing = L.F.CreateSwing(self)
   self.Debuffs = L.F.CreateDebuffs(self)
   self.Buffs = L.F.CreateBuffs(self)
+  self.LeaderIndicator = L.F.CreateGroupRoleIndicator(self)
+  self.AssistantIndicator = L.F.CreateGroupRoleIndicator(self)
   self.RaidTargetIndicator = L.F.CreateRaidMark(self)
   self.ReadyCheckIndicator = L.F.CreateReadyCheck(self)
   self.RaidDebuffs = L.F.CreateRaidDebuffs(self)
+  self.RaidRoleIndicator = L.F.CreateRaidRoleIndicator(self)
   self.Range = L.F.CreateRange(self)
   self.Trinket = L.F.CreateTrinket(self)
 end
diff --git a/oUF_Simple/core/tags.lua b/oUF_Simple/core/tags.lua
index 956ecf5..5664228 100644
--- a/oUF_Simple/core/tags.lua
+++ b/oUF_Simple/core/tags.lua
@@ -52,6 +52,9 @@ oUF.Tags.Methods["oUF_Simple:leader"] = function(unit)
   if UnitIsGroupLeader(unit) then
     return "|TInterface\\GroupFrame\\UI-Group-LeaderIcon:14:14:0:0|t"
   end
+  if UnitIsGroupAssistant(unit) then
+    return "|TInterface\\GroupFrame\\UI-Group-AssistantIcon:14:14:0:0|t"
+  end
 end
 --tag event: oUF_Simple:leader
 oUF.Tags.Events["oUF_Simple:leader"] = "PARTY_LEADER_CHANGED GROUP_ROSTER_UPDATE"
diff --git a/oUF_SimpleConfig/party.lua b/oUF_SimpleConfig/party.lua
index fa44005..52e9d9a 100644
--- a/oUF_SimpleConfig/party.lua
+++ b/oUF_SimpleConfig/party.lua
@@ -32,7 +32,7 @@ L.C.party = {
         {"TOPRIGHT",-2,10},
       },
       size = 17,
-      tag = "[name][oUF_Simple:leader]",
+      tag = "[name]",
     },
     health = {
       enabled = true,
@@ -65,6 +65,12 @@ L.C.party = {
     size = {12,12},
     point = {"CENTER","CENTER",0,0},
   },
+  --group role, leader or assistant
+  grouprole = {
+    enabled = true,
+    size = {12,12},
+    point = {"TOPRIGHT","TOPRIGHT",-5,6},
+  },
   --range alpha
   range = {
     enabled = true,
diff --git a/oUF_SimpleConfig/raid.lua b/oUF_SimpleConfig/raid.lua
index 82bdc76..f5acb52 100644
--- a/oUF_SimpleConfig/raid.lua
+++ b/oUF_SimpleConfig/raid.lua
@@ -42,7 +42,7 @@ L.C.raid = {
       },
       size = 16,
       align = "CENTER",
-      tag = "[name][oUF_Simple:leader]",
+      tag = "[name]",
     },
     debuffHighlight = true,
   },
@@ -67,11 +67,33 @@ L.C.raid = {
     size = {12,12},
     point = {"CENTER","CENTER",0,0},
   },
+  --raid role, main tank or assit
+  raidrole = {
+    enabled = true,
+    size = {12,12},
+    point = {"TOPLEFT","TOPLEFT",5,6},
+  },
+  --group role, leader or assistant
+  grouprole = {
+    enabled = true,
+    size = {12,12},
+    point = {"TOPRIGHT","TOPRIGHT",-5,6},
+  },
   --range alpha
   range = {
     enabled = true,
     alpha = 0.3,  -- outside alpha
   },
+  --main tank
+  tank = {
+    enabled = false,
+    point = {"TOPLEFT", "oUF_SimpleRaidHeader2", "TOPRIGHT", 10, 0}
+  },
+  --main assist
+  assist = {
+    enabled = false,
+    point = {"TOPLEFT", "oUF_SimpleRaidHeader3", "TOPRIGHT", 10, 0}
+  },
   setup = {
     template = nil,
     visibility = "custom [group:raid] show; hide",