WoWInterface SVN Aloft

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches/preview/Aloft/AloftMana
    from Rev 1885 to Rev 1990
    Reverse comparison

Rev 1885 → Rev 1990

AloftManaData.lua
107,6 → 107,13
 
-----------------------------------------------------------------------------
 
local UnitName = UnitName
local UnitPower = UnitPower
local UnitPowerMax = UnitPowerMax
local UnitPowerType = UnitPowerType
 
-----------------------------------------------------------------------------
 
function AloftManaData:OnInitialize()
AloftManaBar = Aloft:GetModule("ManaBar", true)
AloftManaText = Aloft:GetModule("ManaText", true)
148,11 → 155,17
end
]]
 
--[[ obsolete WoW 3.3 events
self:RegisterEvent("UNIT_MANA", "OnUnitManaChanged")
self:RegisterEvent("UNIT_RAGE", "OnUnitManaChanged")
self:RegisterEvent("UNIT_FOCUS", "OnUnitManaChanged")
self:RegisterEvent("UNIT_ENERGY", "OnUnitManaChanged")
self:RegisterEvent("UNIT_RUNIC_POWER", "OnUnitManaChanged")
]]
 
-- new WoW 4.0.1+ event
self:RegisterEvent("UNIT_POWER", "OnUnitManaChanged")
 
self:RegisterEvent("UNIT_DISPLAYPOWER", "OnUnitManaChanged")
 
self:RegisterMessage("Aloft:OnNameplateShow", "OnNameplateShow")
178,10 → 191,10
function AloftManaData:SetManaData(aloftData, unitid)
local name, _ = UnitName(unitid)
if name ~= L["Unknown"] and aloftData.name ~= L["Unknown"] then
local maxMana = UnitManaMax(unitid)
local maxMana = UnitPowerMax(unitid)
-- ChatFrame7:AddMessage("AloftManaData:SetManaData(): update " .. tostring(aloftData.name) .. "/" .. tostring(aloftData.unitid) .. "/".. tostring(maxMana))
if ((maxMana ~= nil) and (maxMana > 0)) then
aloftData.mana = UnitMana(unitid)
aloftData.mana = UnitPower(unitid)
aloftData.maxMana = maxMana
aloftData.powerType, aloftData.powerTypeName = UnitPowerType(unitid)
-- ChatFrame7:AddMessage("AloftManaData:SetManaData(): " .. tostring(unitid) .. "/" .. tostring(aloftData.name) .. "/" .. tostring(aloftData.mana) .. "/" .. tostring(aloftData.maxMana) .. "/" .. tostring(aloftData.powerType) .. "/" .. tostring(aloftData.powerTypeName))
209,7 → 222,8
end
end
 
function AloftManaData:OnUnitManaChanged(event, unitid)
-- the powertype argument is currently not used here, and in any event would arrive with a nil value via the UNIT_DISPLAYPOWER event
function AloftManaData:OnUnitManaChanged(event, unitid, powertype)
-- ChatFrame7:AddMessage("AloftManaData:OnUnitManaChanged(): enter " .. unitid)
if unitid == "target" then
-- ChatFrame7:AddMessage("AloftManaData:OnUnitManaChanged(): target")