/branches
RosterMgr\Logger\Log.lua |
# Plugins |
RosterMgr\Talent\Talent.lua |
RosterMgr\DamageMeter\DamageMeter.lua |
RosterMgr\DamageMeter\Obj_TableMeter.lua |
RosterMgr\Threat\Threat.lua |
Metadata\WeaponsBuffs.lua |
end |
RDXDAL.Unit.Validate = VFL.Noop; |
--- @return The WoW unit ID of this unit. |
function RDXDAL.Unit:GetUnitID() |
return self.uid or "none"; |
end |
--- @return the fundamental numeric ID of the unit. |
function RDXDAL.Unit:GetNumber() |
return self.nid or 0; |
end |
--- @return The name of this unit, in internal (lowercased) form |
function RDXDAL.Unit:GetName() |
return self.name or "unknown"; |
return UnitGUID(self.uid) or "Unknown"; |
end |
--- @return The WoW unit ID of this unit. |
function RDXDAL.Unit:GetUnitID() |
return self.uid or "none"; |
end |
--- @return the fundamental numeric ID of the unit. |
function RDXDAL.Unit:GetNumber() |
return self.nid or 0; |
end |
--- @return TRUE iff this unit is in the data range of the WoW engine. |
function RDXDAL.Unit:IsInDataRange() |
return UnitIsVisible(self.uid); |
end |
--- @return TRUE iff this unit is in the data range of the WoW engine. |
function RDXDAL.Unit:IsInRange() |
return UnitInRange(self.uid); |
end |
--- @return Class information about the unit |
function RDXDAL.Unit:GetClass() |
local ret = UnitClass(self.uid or "none"); |
end |
end |
--- @return the WoW Powertype of the unit ("MANA" 0, "RAGE" 1, "ENERGY" 2, "FOCUS" 3) |
function RDXDAL.Unit:GetRoleType() |
local role = UnitGroupRolesAssigned(uid); |
if role == "TANK" then |
return 1; |
elseif role == "HEALER" then |
return 2; |
elseif role == "DAMAGER" then |
return 3; |
elseif role == "NONE" then |
return 4; |
else |
return 0; |
end |
end |
function RDXDAL.Unit:GetMainTalent() |
local t = self:GetNField("sync"); |
if t then return t.mt or 0; end |
end; |
--- @return TRUE if this unit is a pet |
function RDXDAL.Unit:IsPet() |
return h, mh, x, ih; |
end |
end |
--- @return TRUE iff the unit is dead. |
function RDXDAL.Unit:IsDead() |
return (not self:IsFeigned()) and (UnitIsDeadOrGhost(self.uid)); |
end |
--- @return TRUE iff the unit is feigning death. |
function RDXDAL.Unit:IsFeigned() |
return nil; |
end |
--- @return TRUE iff the unit is online |
function RDXDAL.Unit:IsOnline() |
return UnitIsConnected(self.uid or "none"); |
end |
--- @return TRUE iff the unit is incapacitated (offline, dead, feigned) |
function RDXDAL.Unit:IsIncapacitated() |
local uid = self.uid or "none"; |
if (self:IsFeigned()) or (UnitIsDeadOrGhost(uid)) or (not UnitIsConnected(uid)) then return true; else return nil; end |
end |
--------------------------------------------------------------- |
-- UNIT Power DATA.3.0 |
if a<0 then return 0; elseif a>1 then return 1; else return a; end |
end |
-- Status |
--- @return TRUE iff the unit is dead. |
function RDXDAL.Unit:IsDead() |
return (not self:IsFeigned()) and (UnitIsDeadOrGhost(self.uid)); |
end |
--- @return TRUE iff the unit is feigning death. |
function RDXDAL.Unit:IsFeigned() |
return nil; |
end |
--- @return TRUE iff the unit is online |
function RDXDAL.Unit:IsOnline() |
return UnitIsConnected(self.uid or "none"); |
end |
--- @return TRUE iff the unit is incapacitated (offline, dead, feigned) |
function RDXDAL.Unit:IsIncapacitated() |
local uid = self.uid or "none"; |
if (self:IsFeigned()) or (UnitIsDeadOrGhost(uid)) or (not UnitIsConnected(uid)) then return true; else return nil; end |
end |
--- @return TRUE iff this unit is in the data range of the WoW engine. |
function RDXDAL.Unit:IsInDataRange() |
return UnitIsVisible(self.uid); |
end |
--- @return TRUE iff this unit is in the data range of the WoW engine. |
function RDXDAL.Unit:IsInRange() |
return UnitInRange(self.uid); |
end |
--- @return the WoW Powertype of the unit ("MANA" 0, "RAGE" 1, "ENERGY" 2, "FOCUS" 3) |
function RDXDAL.Unit:GetRoleType() |
local role = UnitGroupRolesAssigned(uid); |
if role == "TANK" then |
return 1; |
elseif role == "HEALER" then |
return 2; |
elseif role == "DAMAGER" then |
return 3; |
elseif role == "NONE" then |
return 4; |
else |
return 0; |
end |
end |
------------------------------------------------------ |
-- cooldown real duration (store only in unit engine) |
-- t.cdp = cdpossible with spellid and duration |
end |
end |
-- tablemeter |
function RDXDAL.Unit:GetTableMeterInfo(path) |
local tablemeter = RDXDB.GetObjectInstance(path); |
if tablemeter then |
return tablemeter:GetInfo(self:GetGuid()); |
else |
return nil; |
end |
end |
function RDXDAL.Unit:GetTableMeterValue(path) |
local tablemeter = RDXDB.GetObjectInstance(path); |
if tablemeter then |
return tablemeter:GetValue(self:GetGuid()) or 0; |
else |
return 0; |
end |
end |
------------------------------------------------ |
-- INVALID UNIT API |
------------------------------------------------ |
setmetatable(self, RDXDAL.Unit); |
return true; |
end; |
RDXDAL.InvalidUnit.GetUnitID = VFL.Nil; |
RDXDAL.InvalidUnit.GetNumber = VFL.One; |
function RDXDAL.InvalidUnit:GetName() return "unknown"; end |
RDXDAL.InvalidUnit.GetProperName = VFL.Nil; |
RDXDAL.InvalidUnit.GetGuid = VFL.Nil; |
RDXDAL.InvalidUnit.GetProperGuid = VFL.Nil; |
RDXDAL.InvalidUnit.GetUnitID = VFL.Nil; |
RDXDAL.InvalidUnit.GetNumber = VFL.One; |
RDXDAL.InvalidUnit.IsInDataRange = VFL.Nil; |
RDXDAL.InvalidUnit.IsInRange = VFL.Nil; |
RDXDAL.InvalidUnit.GetRoleType = VFL.Zero; |
RDXDAL.InvalidUnit.GetClass = VFL.Nil; |
RDXDAL.InvalidUnit.GetClassMnemonic = VFL.Nil; |
RDXDAL.InvalidUnit.GetClassID = VFL.Nil; |
RDXDAL.InvalidUnit.GetClassColor = VFL.Nil; |
RDXDAL.InvalidUnit.GetMainTalent = VFL.Nil; |
RDXDAL.InvalidUnit.IsPet = VFL.Nil; |
RDXDAL.InvalidUnit.GetOwnerUnit = VFL.Nil; |
RDXDAL.InvalidUnit.IsArenaUnit = VFL.Nil; |
RDXDAL.InvalidUnit.IsLeader = VFL.Nil; |
RDXDAL.InvalidUnit.GetLeaderLevel = VFL.Nil; |
RDXDAL.InvalidUnit.GetGroup = VFL.Nil; |
RDXDAL.InvalidUnit.GetMemberGroupId = VFL.Nil; |
RDXDAL.InvalidUnit.IsSameUnit = VFL.False; |
RDXDAL.InvalidUnit.Health = VFL.Zero; |
RDXDAL.InvalidUnit.MaxHealth = VFL.One; |
RDXDAL.InvalidUnit.SmartHealth = VFL.Zero; |
RDXDAL.InvalidUnit.FracSmartHealth = VFL.Zero; |
RDXDAL.InvalidUnit.AllSmartHealth = VFL.Zero; |
RDXDAL.InvalidUnit.IsDead = VFL.False; |
RDXDAL.InvalidUnit.IsFeigned = VFL.False; |
RDXDAL.InvalidUnit.IsOnline = VFL.False; |
RDXDAL.InvalidUnit.IsIncapacitated = VFL.True; |
function RDXDAL.InvalidUnit:PowerType() return "MANA"; end |
RDXDAL.InvalidUnit.Power = VFL.Zero; |
RDXDAL.InvalidUnit.MaxPower = VFL.Zero; |
RDXDAL.InvalidUnit.FracPower = VFL.One; |
RDXDAL.InvalidUnit.MissingPower = VFL.Zero; |
RDXDAL.InvalidUnit.FracMissingPower = VFL.Zero; |
RDXDAL.InvalidUnit.IsDead = VFL.False; |
RDXDAL.InvalidUnit.IsFeigned = VFL.False; |
RDXDAL.InvalidUnit.IsOnline = VFL.False; |
RDXDAL.InvalidUnit.IsIncapacitated = VFL.True; |
RDXDAL.InvalidUnit.IsInDataRange = VFL.Nil; |
RDXDAL.InvalidUnit.IsInRange = VFL.Nil; |
RDXDAL.InvalidUnit.GetRoleType = VFL.Zero; |
RDXDAL.InvalidUnit.GetCooldownsDuration = VFL.Zero; |
RDXDAL.InvalidUnit.DeleteCooldownsDuration = VFL.Zero; |
RDXDAL.InvalidUnit.GetCooldownDuration = VFL.Zero; |
RDXDAL.InvalidUnit.SetCooldownDuration = VFL.Zero; |
RDXDAL.InvalidUnit.GetTableMeterInfo = VFL.Zero; |
RDXDAL.InvalidUnit.GetTableMeterValue = VFL.Zero; |
------------------------------------------------ |
-- TEMPORARY UNIT |
RDXDAL.tempUnit.Invalidate = VFL.Noop; |
RDXDAL.tempUnit.Validate = VFL.Noop; |
------------------------------------------------ |
-- Raw unit data accessors (Blizz UID -> data) |
------------------------------------------------ |
function RDX.RawFracHealth(uid) |
local mh = UnitHealthMax(uid); |
if(mh < 1) then mh = 1; end |
return VFL.clamp(UnitHealth(uid)/mh, 0, 1); |
end |
function RDX.RawFracPower(uid) |
local mh = UnitPowerMax(uid); |
if(mh < 1) then mh = 1; end |
return VFL.clamp(UnitPower(uid)/mh, 0, 1); |
end |
end |
end |
local function UpdateTalent() |
if not RDXPlayer then return; end |
local t = RDXPlayer:GetNField("sync"); |
t.mt = RDXMD.GetSelfTalent(); |
end; |
RDXEvents:Bind("INIT_DEFERRED", nil, UpdateTalent); |
WoWEvents:Bind("PLAYER_TALENT_UPDATE", nil, UpdateTalent); |
-- |
-- Metadata about PVP |
-- |
if w._path then |
--VFLP.RegisterCategory("Win: " .. w._path); |
--VFLP.RegisterFrame("Win: " .. w._path, "Create", w, true); |
VFLP.RegisterFunc("Win: " .. w._path, "Win: " .. w._path, paintData, true); |
--VFLP.RegisterFunc("Win: " .. w._path, "Win: " .. w._path, paintData, true); |
if VFLP.IsEnabled() then |
local cpu, calls; |
VFLT.AdaptiveSchedule("Perf" .. w._path, 1, function() cpu, calls = GetFunctionCPUUsage(paintData, true); w:SetPerfText(cpu); end); |
end |
end |
end |
-- DESTROY FUNCTION |
-- Tear down all this |
local function destroy(w) |
-- Adaptive schedule |
if VFLP.IsEnabled() then |
VFLT.AdaptiveUnschedule("Perf" .. w._path); |
end |
-- Unbind us from all events we bound to in Create() |
WoWEvents:Unbind(w); RDXEvents:Unbind(w); |
-- Clear us outta there |
repaintType = "interval"; -- "event" or "interval" |
eventType = ""; -- "WoWEvents" or "RDXEvents" |
eventName = ""; |
interval = 2; |
interval = 1; |
GenerateCreateCodeVariable = function(objname) return [[ |
]]; end; |
GenerateCreateCode = function(objname) return [[ |
}); |
RDX.RegisterOtherTextType({ |
name = "Memory Debit"; |
title = VFLI.i18n("Memory Debit"); |
OnExpose = VFL.Noop; |
OnApply = VFL.Noop; |
repaintType = "interval"; -- "event" or "interval" |
eventType = ""; -- "WoWEvents" or "RDXEvents" |
eventName = ""; |
interval = 1; |
GenerateCreateCodeVariable = function(objname) return [[ |
]]; end; |
GenerateCreateCode = function(objname) return [[ |
_, text = VFLP.GetTextPerf(); |
]]; end; |
}); |
RDX.RegisterOtherTextType({ |
name = "Time"; |
title = VFLI.i18n("Time"); |
OnExpose = VFL.Noop; |