/branches/preview/Aloft/AloftCombatText
local SPELL_COLOR_HOLY = { 1.00, 0.90, 0.50, } |
local SPELL_COLOR_FIRE = { 1.00, 0.00, 0.00, } -- red |
local SPELL_COLOR_NATURE = { 0.30, 1.00, 0.30, } |
local SPELL_COLOR_FROST = { 0.50, 1.00, 1.00, } |
local SPELL_COLOR_FROST = { 0.50, 1.00, 1.00, } |
local SPELL_COLOR_SHADOW = { 0.50, 0.50, 1.00, } -- basically the warlock class color |
local SPELL_COLOR_ARCANE = { 1.00, 0.50, 1.00, } |
local SPELL_COLOR_HEAL = { 1.00, 0.50, 0.00, } -- this is an imaginary catch-all color for healing spells (yellow-orange) |
end |
end |
-- any time the update list is empty, cancel all timers (cleans up potential leaked timers) |
if not next(updateList) then |
self:CancelAllTimers() |
end |
combatTextRegion:Hide() |
combatTextRegion:SetText("") |
-- any time the update list is empty, cancel all timers (cleans up potential leaked timers) |
if not next(updateList) then |
self:CancelAllTimers() |
end |
function AloftCombatText:OnIsTargetDataChanged(message, aloftData) |
if Aloft:IsConfigModeEnabled() and (aloftData.isTarget or aloftData:IsTarget()) then |
local combatTextRegion = self:CreateCombatText(aloftData, "1234", 1.0, AloftCombatText.db.profile.colors.text) |
local combatTextRegion = self:CreateCombatText(aloftData, "12345", 1.0, AloftCombatText.db.profile.colors.text) |
if combatTextRegion then |
combatTextRegion:SetAlpha(self.db.profile.alpha) |
end |
local aloftData = Aloft:GetTargetNameplate() |
if aloftData then |
if Aloft:IsConfigModeEnabled() then |
local combatTextRegion = self:CreateCombatText(aloftData, "1234", 1.0, AloftCombatText.db.profile.colors.text) |
local combatTextRegion = self:CreateCombatText(aloftData, "12345", 1.0, AloftCombatText.db.profile.colors.text) |
if combatTextRegion then |
combatTextRegion:SetAlpha(self.db.profile.alpha) |
end |
self:ScheduleRepeatingTimer(function() AloftCombatText:Update() end, 0.05) |
-- ChatFrame7:AddMessage("AloftCombatText:PostCombatText(): show " .. tostring(aloftData.name) .. "/" .. tostring(text) .. "/" .. tostring(layoutFrame.combatTextRegion:GetText())) |
return |
end |
function AloftCombatText:CreateCombatText(aloftData, text, scale, color) |
combatTextRegion:SetAlpha(0) |
combatTextRegion:Show() |
-- ChatFrame7:AddMessage("AloftCombatText:CreateCombatText(): show " .. tostring(aloftData.name) .. "/" .. tostring(text) .. "/" .. tostring(layoutFrame.combatTextRegion:GetText())) |
return combatTextRegion |
end |
----------------------------------------------------------------------------- |
local function getNameplate(targetGUId, targetName, nameplateId) |
local function getNameplate(targetGUId, rawTargetName, nameplateId) |
if targetGUId == AloftCombatText:GetPlayerTargetGUId() then |
return Aloft:GetTargetNameplate(targetName) |
local targetName, _ = Aloft:ParseUnitName(rawTargetName, nil) -- second return value is not used |
local aloftData = Aloft:GetTargetNameplate(targetName) |
-- ChatFrame7:AddMessage("AloftCombatText.getNameplate() TGT " .. tostring(aloftData and aloftData.name) .. "/" .. tostring(rawTargetName) .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. "/" .. tostring(nameplateId)) |
return aloftData |
elseif nameplateId then |
local nameplates = Aloft:GetNamedNameplates(targetName) |
local targetName, _ = Aloft:ParseUnitName(rawTargetName) -- second return value is not used |
local nameplates = Aloft:GetNamedNameplates(targetName, nil) |
if nameplates then |
for aloftData in pairs(nameplates) do |
if nameplateId == AloftTargetTrackingData:GetNameplateId(aloftData) then |
-- ChatFrame7:AddMessage("AloftCombatText.getNameplate() ENV " .. tostring(aloftData and aloftData.name) .. "/" .. tostring(rawTargetName) .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. "/" .. tostring(nameplateId)) |
return aloftData |
end |
end |
else |
-- ChatFrame7:AddMessage("AloftCombatText:getNameplate(): no nameplates " .. tostring(targetName) .. "/" .. tostring(nameplateId)) |
-- nothing happens here but diagnostics |
-- local targetName = Aloft:ParseUnitName(rawTargetName, nil) -- second return value is not used |
-- ChatFrame7:AddMessage("AloftCombatText.getNameplate() NON 1 " .. tostring(rawTargetName) .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. "/" .. tostring(nameplateId)) |
end |
else |
-- ChatFrame7:AddMessage("AloftCombatText:getNameplate(): no nameplateId " .. tostring(targetName)) |
-- nothing happens here but diagnostics |
-- local targetName = Aloft:ParseUnitName(rawTargetName, nil) -- second return value is not used |
-- ChatFrame7:AddMessage("AloftCombatText.getNameplate() NON 2 " .. tostring(rawTargetName) .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. "/" .. tostring(nameplateId)) |
end |
return nil |
end |