Skip to content
Permalink
Browse files

Better way to check "Caster" and "Melee" role.

  • Loading branch information...
Wetxius committed Nov 3, 2014
1 parent 0c5fc8b commit 29c6143f04b024a7b001912791e59975a06fcc84
@@ -59,32 +59,33 @@ T.CheckSpec = function(tree)
end
end

local isCaster = {
DRUID = {true}, -- Balance
MAGE = {true, true, true}, -- All specs
PRIEST = {nil, nil, true}, -- Shadow
SHAMAN = {true}, -- Elemental
WARLOCK = {true, true, true} -- All specs
}

local function CheckRole(self, event, unit)
local tree = GetSpecialization()
local role = tree and select(6, GetSpecializationInfo(tree))
local role = tree and GetSpecializationRole(tree)

if role == "TANK" then
T.Role = "Tank"
elseif role == "HEALER" then
T.Role = "Healer"
elseif role == "DAMAGER" then
local _, playerint = UnitStat("player", 4)
local _, playeragi = UnitStat("player", 2)
local base, posBuff, negBuff = UnitAttackPower("player")
local playerap = base + posBuff + negBuff

if (playerap > playerint) or (playeragi > playerint) then
T.Role = "Melee"
else
if isCaster[T.class][spec] then
T.Role = "Caster"
else
T.Role = "Melee"
end
end
end
local RoleUpdater = CreateFrame("Frame")
RoleUpdater:RegisterEvent("PLAYER_ENTERING_WORLD")
RoleUpdater:RegisterEvent("PLAYER_TALENT_UPDATE")
RoleUpdater:RegisterEvent("UNIT_INVENTORY_CHANGED")
RoleUpdater:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
RoleUpdater:SetScript("OnEvent", CheckRole)

----------------------------------------------------------------------------------------
@@ -133,7 +133,7 @@ local function OnAuraChange(self, event, arg1, unit)

for i, Spell5Buff in pairs(Spell5Buff) do
local name, _, icon = GetSpellInfo(Spell5Buff)
if event == "PLAYER_ENTERING_WORLD" then
if event == "PLAYER_ENTERING_WORLD" or event == "ACTIVE_TALENT_GROUP_CHANGED" then
Spell5Frame.t:SetTexture(icon)
end
if UnitAura("player", name) then
@@ -194,8 +194,6 @@ raidbuff_reminder:CreatePanel("Invisible", (C.reminder.raid_buffs_size * 6) + 15
raidbuff_reminder:RegisterEvent("UNIT_AURA")
raidbuff_reminder:RegisterEvent("PLAYER_ENTERING_WORLD")
raidbuff_reminder:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
raidbuff_reminder:RegisterEvent("UNIT_INVENTORY_CHANGED")
raidbuff_reminder:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
raidbuff_reminder:RegisterEvent("ZONE_CHANGED_NEW_AREA")
raidbuff_reminder:SetScript("OnEvent", OnAuraChange)

@@ -149,7 +149,6 @@ for i = 1, #tab do

frame:RegisterEvent("UNIT_AURA")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("UNIT_INVENTORY_CHANGED")
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
frame:RegisterEvent("ZONE_CHANGED_NEW_AREA")

0 comments on commit 29c6143

Please sign in to comment.
You can’t perform that action at this time.