diff --git a/CHANGELOG.md b/CHANGELOG.md index b270ff9..c66617a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.8.83] - 2022-11-02 + +[view diff](https://github.com/bkader/Skada-Cata/compare/1.8.82...1.8.83) + ## [1.8.82] - 2022-10-12 [view diff](https://github.com/bkader/Skada-Cata/compare/1.8.81...1.8.82) diff --git a/Skada/Core/Core.lua b/Skada/Core/Core.lua index 019801b..50a5f63 100644 --- a/Skada/Core/Core.lua +++ b/Skada/Core/Core.lua @@ -3295,10 +3295,10 @@ do end local function tentative_handler() + Skada.current = del(Skada.current, true) Skada:CancelTimer(tentative_timer, true) tentative_timer = nil tentative = nil - Skada.current = nil end function Skada:CombatLogEvent(t) diff --git a/Skada/Core/Functions.lua b/Skada/Core/Functions.lua index 3e89bb4..40b1962 100644 --- a/Skada/Core/Functions.lua +++ b/Skada/Core/Functions.lua @@ -368,55 +368,6 @@ do end end -------------------------------------------------------------------------------- --- class, role and spec functions - -local is_player = Private.is_player -local is_pet = Private.is_pet -local unit_class -do - local is_creature = Private.is_creature - - function unit_class(guid, flag, set, db, name) - set = set or Skada.current - - -- an existing actor? - local actors = set and set.actors - if actors then - for i = 1, #actors do - local actor = actors[i] - if actor and actor.id == guid then - return actor.class, actor.role, actor.spec - elseif actor and actor.name == name and Skada.validclass[actor.class] then - return actor.class, actor.role, actor.spec - end - end - end - - local class = "UNKNOWN" - if is_player(guid, name, flag) then - class = name and select(2, UnitClass(name)) - if not class and tonumber(guid) then - class = GetClassFromGUID(guid, "group") - class = class or select(2, GetPlayerInfoByGUID(guid)) - end - elseif is_pet(guid, flag) then - class = "PET" - elseif Skada:IsBoss(guid, true) then - class = "BOSS" - elseif is_creature(guid, flag) then - class = "MONSTER" - end - - if class and db and db.class == nil then - db.class = class - end - - return class - end - Private.unit_class = unit_class -end - ------------------------------------------------------------------------------- -- test mode @@ -884,12 +835,12 @@ end -- Active / Effetive time functions -- returns the selected set time. -function Skada:GetSetTime(set, active) - if not set or not set.time then +function Skada:GetSetTime(set) + local settime = set and set.time + if not settime then return 0 end - local settime = active and set.activetime or set.time return (settime >= 1) and settime or max(1, time() - set.starttime) end @@ -898,7 +849,7 @@ function Skada:GetActiveTime(set, actor, active) active = active or (set.type == "pvp") or (set.type == "arena") -- force active for pvp/arena -- use settime to clamp - local settime = self:GetSetTime(set, active) + local settime = self:GetSetTime(set) -- active: actor's time. if (self.db.timemesure ~= 2 or active) and actor.time and actor.time > 0 then @@ -925,7 +876,6 @@ function Skada:AddActiveTime(set, actor, target, override) local adding = floor(100 * delta + 0.5) * 0.01 actor.time = (actor.time or 0) + adding - set.activetime = (set.activetime or 0) + adding -- to save up memory, we only record the rest to the current set. if (set == self.total and not self.db.totalidc) or not target then return end @@ -1132,7 +1082,7 @@ function Skada:FilterClass(win, id, label) win:DisplayMode(win.selectedmode, nil) elseif win.GetSelectedSet and id then local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) win:DisplayMode(win.selectedmode, actor and actor.class) end end @@ -1141,252 +1091,205 @@ end -- player & enemies functions do + local UnitLevel = UnitLevel local GetUnitRole = Skada.GetUnitRole local GetUnitSpec = Skada.GetUnitSpec + local GetUnitIdFromGUID = Skada.GetUnitIdFromGUID local players, pets = Private.players, Private.pets + local actorPrototype = Skada.actorPrototype local playerPrototype = Skada.playerPrototype local enemyPrototype = Skada.enemyPrototype - local modes, userGUID = Skada.modes, Skada.userGUID + local userGUID, userClass = Skada.userGUID, Skada.userClass + local modes = Skada.modes + + local dummy_actor = {} -- used as fallback + + -- attempts to find and actor + function Skada:FindActor(set, actorid, actorname, is_strict) + -- make sure we have all data + actorid = actorid or actorname + actorname = actorname or actorid - -- finds a player that was already recorded - local dummy_pet = {class = "PET"} -- used as fallback - function Skada:FindPlayer(set, id, name, is_create) - id = id or name -- fallback + -- why? I don't know... + if actorid == "total" or actorname == L["Total"] then return end - local actors = set and (id ~= "total") and (name ~= L["Total"]) and set.actors - if not actors then + if not set or not set.actors then -- no set/actors table? return - elseif not set._actoridx then + elseif not set._actoridx then -- fast lookup table set._actoridx = new() end - -- already cached player? - local player = set._actoridx[id] - if player then - return playerPrototype:Bind(player) + -- already cached? + local actor = set._actoridx[actorid] + if actor then + return (actor.enemy and enemyPrototype or playerPrototype):Bind(actor) end -- search the set - for i = 1, #actors do - local actor = actors[i] - if actor and not actor.enemy and (actor.id == id or actor.name == name) then - set._actoridx[id] = actor - return actor + for _, act in pairs(set.actors) do + if act.id == actorid or act.name == actorname then + set._actoridx[actorid] = act + return (act.enemy and enemyPrototype or playerPrototype):Bind(act) end end - if is_create then return end + -- is_strict means we don't use our dummy_actor + if is_strict then return end -- speed up things with pets - local ownerName = strmatch(name, "%<(%a+)%>") + local ownerName = strmatch(actorname, "%<(%a+)%>") if ownerName then - dummy_pet.id = id - dummy_pet.name = name - dummy_pet.owner = ownerName - return playerPrototype:Bind(dummy_pet) - end - - -- search friendly enemies - local enemy = self:FindEnemy(set, name, id) - if enemy and enemy.flag and self:IsFriendly(enemy.flag) then - set._actoridx[id] = enemy - return enemy + dummy_actor.id = actorid + dummy_actor.name = actorname + dummy_actor.class = "PET" + dummy_actor.owner = ownerName + return playerPrototype:Bind(dummy_actor) end - -- our last hope! - dummy_pet.id = id - dummy_pet.name = name or L["Unknown"] - return playerPrototype:Bind(dummy_pet) + -- well.. our last hope! + dummy_actor.id = actorid + dummy_actor.name = actorname + dummy_actor.class = "UNKNOWN" + return playerPrototype:Bind(dummy_actor) end - -- finds a player table or creates it if not found - function Skada:GetPlayer(set, guid, name, flag) - if not (set and set.actors and guid) then return end + -- generic: finds a player/enemy or creates it. + function Skada:GetActor(set, actorid, actorname, actorflags) + -- no set/actors table, sorry! + if not set or not set.actors then return end + + -- make sure we have all data + actorid = actorid or actorname + actorname = actorname or actorid - local actor = self:FindPlayer(set, guid, name, true) + -- attempt to find the actor (true: no dummy_actor) + local actor = self:FindActor(set, actorid, actorname, true) + -- not found? try to creat it then if not actor then - if not name then return end + -- at least the name should be provided! + if not actorname then return end + -- create a new actor table... actor = new() - actor.id = guid - actor.name = name - actor.flag = flag - actor.last = set.last_time or GetTime() - actor.time = 0 - actor.__new = true -- new entry (removed later) - - if players[guid] then - _, actor.class = UnitClass(players[guid]) - actor.role = GetUnitRole(guid) - actor.spec = GetUnitSpec(guid) - elseif pets[guid] then + actor.id = actorid + actor.name = actorname + actor.__new = true + + -- actorflags:true => fakse actor + if actorflags == true then + actor.enemy = true + actor.class = "ENEMY" + actor.fake = true + + -- is it me? move on.. + elseif actorid == userGUID then + actor.class = userClass + actor.role = GetUnitRole(userGUID) + actor.spec = GetUnitSpec(userGUID) + + -- a group member? + elseif players[actorid] then + _, actor.class = UnitClass(players[actorid]) + actor.role = GetUnitRole(userGUID) + actor.spec = GetUnitSpec(userGUID) + + -- a pet maybe? + elseif pets[actorid] then actor.class = "PET" - else - actor.class, actor.role, actor.pec = unit_class(guid, flag, nil, nil, name) - end - for i = 1, #modes do - local mode = modes[i] - if mode and mode.AddPlayerAttributes then - mode:AddPlayerAttributes(actor, set) + -- was a player? (pvp scenario) + elseif self:IsPlayer(actorflags) then + actor.enemy = true + local unit = GetUnitIdFromGUID(actorid, "group") + if unit then -- found a valid unit? + _, actor.class = UnitClass(unit) + else + actor.class = "PLAYER" end - end - - set.actors[#set.actors + 1] = actor - end - - -- not all modules provide flags - if (actor.flag == nil or actor.flag == 0) and flag and flag ~= 0 then - actor.flag = flag - actor.__mod = true - end - - -- attempt to fix player name: - if (actor.name == L["Unknown"] and name ~= L["Unknown"]) or (actor.name == actor.id and name ~= actor.id) then - actor.name = (actor.id == userGUID or guid == userGUID) and userName or name - actor.__mod = true - end - - -- fix players created before their info was received - if self.validclass[actor.class] then - if actor.role == nil or actor.role == "NONE" then - actor.role = GetUnitRole(actor.id) - actor.__mod = true - end - if actor.spec == nil then - actor.spec = GetUnitSpec(actor.id) - actor.__mod = true - end - end - - -- total set has "last" always removed. - if not actor.last then - actor.last = set.last_time or GetTime() - actor.__mod = true - end - - if actor.__new or actor.__mod then - actor.__mod = nil - callbacks:Fire("Skada_GetPlayer", actor, set) - end - self.changed = true - - if actor.__new then - actor.__new = nil - return playerPrototype:Bind(actor), true - end - return actor - end - - -- finds an enemy unit - function Skada:FindEnemy(set, name, id) - local actors = name and set and set.actors - if not actors then - return - elseif not set._actoridx then - set._actoridx = new() - end - - id = id or name -- fallback - - local enemy = set._actoridx[id] - if enemy then - return enemyPrototype:Bind(enemy) - end - - for i = 1, #actors do - local actor = actors[i] - if actor and actor.enemy and (actor.id == id or actor.name == name) then - set._actoridx[name] = enemyPrototype:Bind(actor) - return actor - end - end - end - - -- finds or create an enemy entry - function Skada:GetEnemy(set, name, guid, flag) - if not (set and set.actors and name) then return end - - local actor = self:FindEnemy(set, name, guid) - - if not actor then - - actor = new() - actor.id = guid - actor.name = name - actor.flag = flag - actor.enemy = true - actor.__new = true + -- a npc maybe? + elseif self:IsNPC(actorflags) then + actor.enemy = true + local unit = GetUnitIdFromGUID(actorid, "group") + local level = unit and UnitLevel(unit) + if level == -1 or self:IsBoss(actorid, true) then + actor.class = "BOSS" + elseif self:IsPet(actorflags) then + actor.class = "PET" + elseif self:IsNeutral(actorflags) then + actor.class = "NEUTRAL" + else + actor.class = "MONSTER" + end - if guid or flag then - actor.class = Private.unit_class(guid, flag, nil, actor, name) else - actor.class = "ENEMY" + actor.enemy = true + actor.class = "UNKNOWN" end - for i = 1, #modes do - local mode = modes[i] - if mode and mode.AddEnemyAttributes then - mode:AddEnemyAttributes(actor, set) + for _, mode in pairs(modes) do + -- common + if mode.AddActorAttributes then + mode:AddActorAttributes(actor, set) + end + + if mode.AddEnemyAttributes and actor.enemy then + mode:AddEnemyAttributes(actor, set) -- enemies + elseif mode.AddPlayerAttributes and not actor.enemy then + mode:AddPlayerAttributes(actor, set) -- players end end set.actors[#set.actors + 1] = actor end - -- in case of a missing guid - if actor.id == nil and guid and guid ~= name then - actor.id = guid + -- just in case we have missing/wrong stuff + if (actor.name == L["Unknown"] and actorname ~= L["Unknown"]) or (actor.id == actor.name and actorname ~= actor.id) then + actor.name = (actor.id == userGUID or actorid == userGUID) and userName or actorname actor.__mod = true end - -- not all modules provide flags - if (actor.flag == nil or actor.flag == 0) and flag and flag ~= 0 then - actor.flag = flag - actor.__mod = true - end + -- add more details to the actor... + if players[actor.id] or pets[actor.id] then + if self.validclass[actor.class] then + -- missing role? + if actor.role == nil or actor.role == "NONE" then + actor.role = GetUnitRole(actor.id) + actor.__mod = true + end + -- missing spec? + if actor.spec == nil then + actor.spec = GetUnitSpec(actor.id) + actor.__mod = true + end + end - -- attempt to fix enemy name: - if actor.name == L["Unknown"] and name ~= L["Unknown"] then - actor.name = name - actor.__mod = true + -- total set has "last" always removed. + if not actor.last then + actor.last = set.last_time or GetTime() + actor.__mod = true + end end - -- in pvp while having pvp module enabled? - if self.forPVP and self.validclass[actor.class] then - actor.__mod = (actor.spec == nil) and true or nil + -- pvp enabled + if self.validclass[actor.class] and self.forPVP and not actor.spec then + actor.__mod = true end + -- remove __mod key and fire callbacks if actor.__new or actor.__mod then actor.__mod = nil - callbacks:Fire("Skada_GetEnemy", actor, set) + callbacks:Fire(actor.enemy and "Skada_GetEnemy" or "Skada_GetPlayer", actor, set) end + -- trigger addon change status self.changed = true + + -- remove the __new key after binding the actor if actor.__new then actor.__new = nil - return enemyPrototype:Bind(actor), true - end - return actor - end - - -- generic find a player or an enemey - function Skada:FindActor(set, id, name, no_strict) - return self:FindPlayer(set, id, name, not no_strict) or self:FindEnemy(set, name, id) - end - - -- generic: finds a player/enemy or creates it. - function Skada:GetActor(set, id, name, flag) - local actor = self:FindActor(set, id, name) - -- creates it if not found - if not actor then - if is_player(id, name, flag) == 1 or is_pet(id, flag) == 1 then -- group members or group pets - actor = self:GetPlayer(set, id, name, flag) - else -- an outsider maybe? - actor = self:GetEnemy(set, name, id, flag) - end + return (actor.enemy and enemyPrototype or playerPrototype):Bind(actor), true end return actor end diff --git a/Skada/Core/Init.lua b/Skada/Core/Init.lua index 58695d8..3f1c56c 100644 --- a/Skada/Core/Init.lua +++ b/Skada/Core/Init.lua @@ -229,18 +229,27 @@ function Private.register_classes() local classcolors, validclass = {}, {} for class, info in pairs(CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS) do classcolors[class] = {r = info.r, g = info.g, b = info.b, colorStr = info.colorStr} - classcolors[class].colorStr = info.colorStr or Private.RGBPercToHex(info.r, info.g, info.b, true) L[class] = LOCALIZED_CLASS_NAMES_MALE[class] validclass[class] = true end ns.validclass = validclass -- used to validate classes -- custom class colors - classcolors.BOSS = {r = 0.203, g = 0.345, b = 0.525, colorStr = "ff345886"} - classcolors.ENEMY = {r = 0.94117, g = 0, b = 0.0196, colorStr = "fff00005"} - classcolors.MONSTER = {r = 0.549, g = 0.388, b = 0.404, colorStr = "ff8c6367"} - classcolors.PET = {r = 0.3, g = 0.4, b = 0.5, colorStr = "ff4c0566"} - classcolors.PLAYER = {r = 0.94117, g = 0, b = 0.0196, colorStr = "fff00005"} + classcolors.BOSS = {r = 0.203, g = 0.345, b = 0.525} + classcolors.ENEMY = {r = 0.94117, g = 0, b = 0.0196} + classcolors.MONSTER = {r = 0.549, g = 0.388, b = 0.404} + classcolors.NEUTRAL = {r = 1.0, g = 1.0, b = 0.1} + classcolors.PET = {r = 0.09, g = 0.61, b = 0.55} + + -- generate colorStr + local RGBPercToHex = Private.RGBPercToHex + for class, info in pairs(classcolors) do + if not info.colorStr then + info.colorStr = RGBPercToHex(info.r, info.g, info.b, true) + end + end + -- alias to enemy for now... + classcolors.PLAYER = classcolors.ENEMY local P = ns.db @@ -268,7 +277,7 @@ function Private.register_classes() __call = function(t, class) local color = P.usecustomcolors and P.customcolors and P.customcolors[class] or t[class] if not color.colorStr then - color.colorStr = Private.RGBPercToHex(color.r, color.g, color.b, true) + color.colorStr = RGBPercToHex(color.r, color.g, color.b, true) end return color end @@ -284,6 +293,13 @@ function Private.register_classes() -- class icons and coordinates local classcoords_mt = { __index = function(t, class) + -- neutral: monster + if class == "NEUTRAL" then + local coords = t.MONSTER + rawset(t, class, coords) + return coords + end + local coords = {384/512, 448/512, 64/512, 128/512} -- unknown rawset(t, class, coords) return coords @@ -385,7 +401,7 @@ function Private.register_classes() P.customcolors[class].r = r P.customcolors[class].g = g P.customcolors[class].b = b - P.customcolors[class].colorStr = Private.RGBPercToHex(r, g, b, true) + P.customcolors[class].colorStr = RGBPercToHex(r, g, b, true) end, args = { enable = { diff --git a/Skada/Core/Prototypes.lua b/Skada/Core/Prototypes.lua index 484bfc5..5cc29bf 100644 --- a/Skada/Core/Prototypes.lua +++ b/Skada/Core/Prototypes.lua @@ -14,28 +14,18 @@ local actorPrototype = Skada.actorPrototype -- segment/set prototype & functions -- returns the segment's time -function setPrototype:GetTime(active) - return Skada:GetSetTime(self, active) +function setPrototype:GetTime() + return Skada:GetSetTime(self) end -- returns the actor's time if found (player or enemy) function setPrototype:GetActorTime(id, name, active) - local actor = self:GetActor(name, id) - return actor and actor:GetTime(self, active) or self:GetTime(active) -end - --- attempts to retrieve a player -function setPrototype:GetPlayer(id, name) - return Skada:FindPlayer(self, id, name, true) -end - --- attempts to retrieve an enemy -function setPrototype:GetEnemy(name, id) - return Skada:FindEnemy(self, name, id) + local actor = self:GetActor(id, name) + return actor and actor:GetTime(self, active) or self:GetTime() end -- attempts to find an actor (player or enemy) -function setPrototype:GetActor(name, id, no_strict) +function setPrototype:GetActor(id, name, no_strict) return Skada:FindActor(self, id, name, no_strict) end @@ -80,7 +70,7 @@ end -- fills the give table with actor's details function setPrototype:_fill_actor_table(t, name, actortime, no_strict) if t and (not t.class or (actortime and not t.time)) then - local actor = self:GetActor(name, nil, no_strict) + local actor = self:GetActor(name, name, no_strict) if not actor then return end t.id = t.id or actor.id @@ -129,13 +119,13 @@ end -- returns the actor's damage amount function setPrototype:GetActorDamage(id, name, useful) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) return actor and actor:GetDamage(useful) or 0 end -- returns the actor's dps and damage amount. function setPrototype:GetActorDPS(id, name, useful, active) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then return actor:GetDPS(self, useful, active) end @@ -144,7 +134,7 @@ end -- returns the actor's damage spells table if found function setPrototype:GetActorDamageSpells(id, name) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then return actor.damagespells, actor end @@ -152,7 +142,7 @@ end -- returns the actor's damage targets table if found function setPrototype:GetActorDamageTargets(id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then local targets, total = actor:GetDamageTargets(self, tbl) return targets, total, actor @@ -161,7 +151,7 @@ end -- returns the actor's damage on the given target function setPrototype:GetActorDamageOnTarget(id, name, targetname) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then return actor:GetDamageOnTarget(targetname) end @@ -192,13 +182,13 @@ end -- returns the actor's damage taken amount function setPrototype:GetActorDamageTaken(id, name) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) return actor and actor:GetDamageTaken() end -- returns the actor's dtps and damage taken amount function setPrototype:GetActorDTPS(id, name) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then return actor:GetDTPS(self) end @@ -207,13 +197,13 @@ end -- returns the actor's damage taken spells table if found function setPrototype:GetActorDamageTakenSpells(id, name) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) return actor and actor.damagedspells or nil end -- returns the actor's damage taken sources table if found function setPrototype:GetActorDamageSources(id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then local sources, total = actor:GetDamageSources(self, tbl) return sources, total, actor @@ -222,7 +212,7 @@ end -- returns the damage, overkill and useful function setPrototype:GetActorDamageFromSource(id, name, targetname) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then return actor:GetDamageFromSource(targetname) end @@ -231,7 +221,7 @@ end -- actor heal targets function setPrototype:GetActorHealTargets(id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if actor then local targets, total = actor:GetHealTargets(self, tbl) return targets, total, actor diff --git a/Skada/Locales/enUS.lua b/Skada/Locales/enUS.lua index a15cbc2..41b7ba5 100644 --- a/Skada/Locales/enUS.lua +++ b/Skada/Locales/enUS.lua @@ -860,6 +860,7 @@ L["Website"] = true L["BOSS"] = _G.BOSS L["ENEMY"] = _G.ENEMY L["MONSTER"] = _G.EXAMPLE_TARGET_MONSTER +L["NEUTRAL"] = _G.FACTION_STANDING_LABEL4 L["PET"] = _G.PET L["PLAYER"] = _G.PLAYER L["UNKNOWN"] = _G.UNKNOWN diff --git a/Skada/Modules/Absorbs.lua b/Skada/Modules/Absorbs.lua index 1d22e5b..79217a2 100644 --- a/Skada/Modules/Absorbs.lua +++ b/Skada/Modules/Absorbs.lua @@ -146,7 +146,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) local function log_spellcast(set, actorid, actorname, actorflags, spellid) if not set or (set == Skada.total and not P.totalidc) then return end - local actor = Skada:FindPlayer(set, actorid, actorname, actorflags) + local actor = Skada:FindActor(set, actorid, actorname, actorflags) if actor and actor.absorbspells and actor.absorbspells[spellid] then actor.absorbspells[spellid].casts = (actor.absorbspells[spellid].casts or 1) + 1 end @@ -155,7 +155,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) local function log_absorb(set, nocount) if not absorb.amount or absorb.amount == 0 then return end - local actor = Skada:GetPlayer(set, absorb.actorid, absorb.actorname) + local actor = Skada:GetActor(set, absorb.actorid, absorb.actorname, absorb.actorflags) if not actor then return elseif actor.role ~= "DAMAGER" and not passive_spells[absorb.spell] and not nocount then @@ -458,7 +458,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) local function absorb_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -478,7 +478,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.absorbspells and actor.absorbspells[id] if not spell then return end @@ -518,7 +518,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) win.title = L["actor absorb spells"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or actor.enemy then return end -- unavailable for enemies yet local total = actor.absorb @@ -553,7 +553,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) win.title = L["actor absorb spells"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or actor.enemy then return end -- unavailable for enemies yet local total = actor.absorb @@ -585,7 +585,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) win.title = uformat(L["%s's absorbed targets"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or actor.enemy then return end -- unavailable for enemies yet local total = actor and actor.absorb or 0 @@ -603,7 +603,7 @@ Skada:RegisterModule("Absorbs", function(L, P, G) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -796,7 +796,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(label, id) + local actor = set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -816,7 +816,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor then return end local spell = actor.healspells and actor.healspells[id] or actor.absorbspells and actor.absorbspells[id] @@ -874,7 +874,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) win.title = L["actor absorb and heal spells"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetAbsorbHealOnTarget(win.targetname) if not total or total == 0 or not (actor.healspells or actor.absorbspells) then @@ -925,7 +925,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) win.title = L["actor absorb and heal spells"](win.actorname or L["Unknown"]) if not win.actorname then return end - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetAbsorbHeal() if not total or total == 0 or not (actor.healspells or actor.absorbspells) then @@ -968,7 +968,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) function targetmod:Update(win, set) win.title = uformat(L["%s's absorbed and healed targets"], win.actorname) - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetAbsorbHeal() local targets = (total and total > 0) and actor:GetAbsorbHealTargets(set) @@ -985,7 +985,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) if target.amount > 0 then nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -1046,7 +1046,7 @@ Skada:RegisterModule("Absorbs and Healing", function(L, P) local function feed_personal_hps() local set = Skada:GetSet("current") - local actor = set and set:GetPlayer(Skada.userGUID, Skada.userName) + local actor = set and set:GetActor(Skada.userGUID, Skada.userName) if actor then return format("%s %s", Skada:FormatNumber((actor:GetAHPS(set))), L["HPS"]) end @@ -1113,7 +1113,7 @@ Skada:RegisterModule("HPS", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(label, id) + local actor = set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -1214,11 +1214,11 @@ Skada:RegisterModule("Healing Done By Spell", function(L, _, _, C) local function sourcemod_tooltip(win, id, label, tooltip) local set = win.spellname and win:GetSelectedSet() - local player = set and set:GetActor(label, id) - if not player then return end + local actor = set and set:GetActor(id, label) + if not actor then return end - local spell = player.healspells and player.healspells[win.spellid] - spell = spell or player.absorbspells and player.absorbspells[win.spellid] + local spell = actor.healspells and actor.healspells[win.spellid] + spell = spell or actor.absorbspells and actor.absorbspells[win.spellid] if not spell then return end tooltip:AddLine(label .. " - " .. win.spellname) diff --git a/Skada/Modules/Activity.lua b/Skada/Modules/Activity.lua index 65312ad..d8e4b44 100644 --- a/Skada/Modules/Activity.lua +++ b/Skada/Modules/Activity.lua @@ -21,7 +21,7 @@ Skada:RegisterModule("Activity", function(L, P, _, C) local function activity_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local settime = set:GetTime() @@ -43,7 +43,7 @@ Skada:RegisterModule("Activity", function(L, P, _, C) win.title = uformat(L["%s's activity"], win.actorname) if not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local maxtime = actor and actor:GetTime(set, true) local targets = maxtime and get_activity_targets(actor, set) @@ -57,7 +57,7 @@ Skada:RegisterModule("Activity", function(L, P, _, C) for name, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, name) + local d = win:actor(nr, target, target.enemy, name) d.value = target.time format_valuetext(d, mod_cols, maxtime, win.metadata, true) end @@ -83,7 +83,7 @@ Skada:RegisterModule("Activity", function(L, P, _, C) if activetime > 0 then nr = nr + 1 - local d = win:actor(nr, actor) + local d = win:actor(nr, actor, actor.enemy) d.value = activetime format_valuetext(d, mod_cols, settime, win.metadata) win:color(d, set, actor.enemy) @@ -94,25 +94,11 @@ Skada:RegisterModule("Activity", function(L, P, _, C) function mod:GetSetSummary(set) if not set or not set.time then return end - - local settime = set.time - local value, valuetext = nil, nil - - if set.activetime then - value = set.activetime - valuetext = Skada:FormatValueCols( - mod_cols["Active Time"] and Skada:FormatTime(value), - mod_cols.Percent and Skada:FormatPercent(value, settime) - ) - else -- backwards compatibility - value = settime - valuetext = Skada:FormatValueCols( - mod_cols["Active Time"] and Skada:FormatTime(value), - mod_cols.Percent and format("%s - %s", date("%H:%M", set.starttime), date("%H:%M", set.endtime)) - ) - end - - return value, valuetext + local valuetext = Skada:FormatValueCols( + mod_cols["Active Time"] and Skada:FormatTime(set.time), + mod_cols.Percent and format("%s - %s", date("%H:%M", set.starttime), date("%H:%M", set.endtime)) + ) + return set.time, valuetext end function mod:OnEnable() diff --git a/Skada/Modules/Auras.lua b/Skada/Modules/Auras.lua index 08e50ec..326047a 100644 --- a/Skada/Modules/Auras.lua +++ b/Skada/Modules/Auras.lua @@ -147,7 +147,7 @@ do end end - local function find_or_create_actor(set, info, is_enemy) + local function find_or_create_actor(set, info) -- 1. make sure we can record to the segment. if not set or (set == Skada.total and not Skada.db.totalidc) then return end @@ -155,16 +155,12 @@ do if not info or not info.spellid then return end -- 3. retrieve the actor. - if is_enemy then -- enemy? - return Skada:GetEnemy(set, info.actorname, info.actorid, info.actorflags) - end - - return Skada:GetPlayer(set, info.actorid, info.actorname, info.actorflags) -- player? + return Skada:GetActor(set, info.actorid, info.actorname, info.actorflags) end -- handles SPELL_AURA_APPLIED event - function log_auraapplied(set, is_enemy) - local actor = find_or_create_actor(set, aura, is_enemy) + function log_auraapplied(set) + local actor = find_or_create_actor(set, aura) if not actor then return end local curtime = set.last_action or time() @@ -194,8 +190,8 @@ do end -- handles SPELL_AURA_REFRESH and SPELL_AURA_APPLIED_DOSE events - function log_aurarefresh(set, is_enemy) - local actor = find_or_create_actor(set, aura, is_enemy) + function log_aurarefresh(set) + local actor = find_or_create_actor(set, aura) if not actor then return end -- spell @@ -210,8 +206,8 @@ do end -- handles SPELL_AURA_REMOVED event - function log_auraremove(set, is_enemy) - local actor = find_or_create_actor(set, aura, is_enemy) + function log_auraremove(set) + local actor = find_or_create_actor(set, aura) if not actor then return end -- spell @@ -236,8 +232,8 @@ do end end - function log_specialaura(set, is_enemy) - local actor = find_or_create_actor(set, aura, is_enemy) + function log_specialaura(set) + local actor = find_or_create_actor(set, aura) if not actor then return end -- spell @@ -311,7 +307,7 @@ do -- list actor's auras by type function spell_update_func(self, auratype, win, set, cols) - local actor = set and auratype and set:GetActor(win.actorname, win.actorid) + local actor = set and auratype and set:GetActor(win.actorid, win.actorname) local maxtime = actor and floor(actor:GetTime(set)) local spells = (maxtime and maxtime > 0) and actor.auras @@ -378,7 +374,7 @@ do -- list actor's auras targets by type function target_update_func(self, auratype, win, set, cols, tbl) - local actor = set and auratype and set:GetActor(win.actorname, win.actorid) + local actor = set and auratype and set:GetActor(win.actorid, win.actorname) if not actor then return end local targets, maxtime = get_actor_auras_targets(actor, set, auratype, tbl) @@ -415,7 +411,7 @@ do -- list targets of the given aura function spelltarget_update_func(self, auratype, win, set, cols, tbl) - local actor = set and auratype and set:GetActor(win.actorname, win.actorid) + local actor = set and auratype and set:GetActor(win.actorid, win.actorname) if not actor then return end local targets, maxtime = get_actor_aura_targets(actor, set, win.spellid, tbl) @@ -457,7 +453,7 @@ do -- list auras done on the given target function targetspell_update_func(self, auratype, win, set, cols, tbl) - local actor = set and auratype and set:GetActor(win.actorname, win.actorid) + local actor = set and auratype and set:GetActor(win.actorid, win.actorname) if not actor then return end local spells, maxtime = get_actor_target_auras(actor, win.targetname, tbl) @@ -482,7 +478,7 @@ do local set = win:GetSelectedSet() local settime = set and set:GetTime() if not settime or settime == 0 then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.auras and actor.auras[id] if not spell then return end @@ -511,7 +507,7 @@ do function spelltarget_tooltip(win, id, label, tooltip) local set = win.spellid and win:GetSelectedSet() - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor and actor.auras and actor.auras[win.spellid] local target = spell and spell.targets and spell.targets[label] if not target then return end @@ -827,7 +823,7 @@ Skada:RegisterModule("Debuffs", function(_, _, _, C) local function spellsource_tooltip(win, id, label, tooltip) local set = win.spellid and win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) local spell = actor and actor.auras and actor.auras[win.spellid] if not (spell and spell.count) then return end @@ -901,13 +897,13 @@ Skada:RegisterModule("Enemy Buffs", function(_, P, _, C) aura.type = t.auratype if t.event == "SPELL_PERIODIC_ENERGIZE" then - Skada:DispatchSets(log_specialaura, true) + Skada:DispatchSets(log_specialaura) elseif t.event == "SPELL_AURA_APPLIED" then - Skada:DispatchSets(log_auraapplied, true) + Skada:DispatchSets(log_auraapplied) elseif t.event == "SPELL_AURA_REMOVED" then - Skada:DispatchSets(log_auraremove, true) + Skada:DispatchSets(log_auraremove) else - Skada:DispatchSets(log_aurarefresh, true) + Skada:DispatchSets(log_aurarefresh) end end end @@ -983,11 +979,11 @@ Skada:RegisterModule("Enemy Debuffs", function(_, _, _, C) aura.type = t.auratype if t.event == "SPELL_AURA_APPLIED" then - Skada:DispatchSets(log_auraapplied, true) + Skada:DispatchSets(log_auraapplied) elseif t.event == "SPELL_AURA_REMOVED" then - Skada:DispatchSets(log_auraremove, true) + Skada:DispatchSets(log_auraremove) else - Skada:DispatchSets(log_aurarefresh, true) + Skada:DispatchSets(log_aurarefresh) end end diff --git a/Skada/Modules/CCTracker.lua b/Skada/Modules/CCTracker.lua index 782e108..537ceaf 100644 --- a/Skada/Modules/CCTracker.lua +++ b/Skada/Modules/CCTracker.lua @@ -22,31 +22,31 @@ end -- ======= -- Skada:RegisterModule("CC Done", function(L, P, _, C) local mod = Skada:NewModule("CC Done") - local playermod = mod:NewModule("Crowd Control Spells") + local spellmod = mod:NewModule("Crowd Control Spells") local targetmod = mod:NewModule("Crowd Control Targets") - local sourcemod = playermod:NewModule("Crowd Control Sources") + local sourcemod = spellmod:NewModule("Crowd Control Sources") local cc_spells = Skada.extra_cc_spells -- extended list local get_actor_cc_targets = nil local get_cc_done_sources = nil local mod_cols = nil local function log_ccdone(set) - local player = Skada:GetPlayer(set, cc_table.actorid, cc_table.actorname, cc_table.actorflags) - if not player then return end + local actor = Skada:GetActor(set, cc_table.actorid, cc_table.actorname, cc_table.actorflags) + if not actor then return end -- increment the count. - player.ccdone = (player.ccdone or 0) + 1 + actor.ccdone = (actor.ccdone or 0) + 1 set.ccdone = (set.ccdone or 0) + 1 -- saving this to total set may become a memory hog deluxe. if set == Skada.total and not P.totalidc then return end -- record the spell. - local spell = player.ccdonespells and player.ccdonespells[cc_table.spellid] + local spell = actor.ccdonespells and actor.ccdonespells[cc_table.spellid] if not spell then - player.ccdonespells = player.ccdonespells or {} - player.ccdonespells[cc_table.spellid] = {count = 0} - spell = player.ccdonespells[cc_table.spellid] + actor.ccdonespells = actor.ccdonespells or {} + actor.ccdonespells[cc_table.spellid] = {count = 0} + spell = actor.ccdonespells[cc_table.spellid] end spell.count = spell.count + 1 @@ -72,15 +72,15 @@ Skada:RegisterModule("CC Done", function(L, P, _, C) end end - function playermod:Enter(win, id, label) + function spellmod:Enter(win, id, label) win.actorid, win.actorname = id, label win.title = uformat(L["%s's control spells"], label) end - function playermod:Update(win, set) + function spellmod:Update(win, set) win.title = uformat(L["%s's control spells"], win.actorname) - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.ccdone local spells = (total and total > 0) and actor.ccdonespells @@ -119,7 +119,7 @@ Skada:RegisterModule("CC Done", function(L, P, _, C) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -187,11 +187,11 @@ Skada:RegisterModule("CC Done", function(L, P, _, C) end function mod:OnEnable() - playermod.metadata = {click1 = sourcemod} + spellmod.metadata = {click1 = sourcemod} self.metadata = { showspots = true, ordersort = true, - click1 = playermod, + click1 = spellmod, click2 = targetmod, click4 = Skada.FilterClass, click4_label = L["Toggle Class Filter"], @@ -203,7 +203,7 @@ Skada:RegisterModule("CC Done", function(L, P, _, C) -- no total click. sourcemod.nototal = true - playermod.nototal = true + spellmod.nototal = true targetmod.nototal = true Skada:RegisterForCL( @@ -246,7 +246,7 @@ Skada:RegisterModule("CC Done", function(L, P, _, C) end get_actor_cc_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local spells = actor and actor.ccdone and actor.ccdonespells if not spells then return end @@ -276,9 +276,9 @@ end) -- ======== -- Skada:RegisterModule("CC Taken", function(L, P, _, C) local mod = Skada:NewModule("CC Taken") - local playermod = mod:NewModule("Crowd Control Spells") + local spellmod = mod:NewModule("Crowd Control Spells") local sourcemod = mod:NewModule("Crowd Control Sources") - local targetmod = playermod:NewModule("Crowd Control Targets") + local targetmod = spellmod:NewModule("Crowd Control Targets") local get_actor_cc_sources = nil local get_cc_taken_targets = nil local mod_cols = nil @@ -297,22 +297,22 @@ Skada:RegisterModule("CC Taken", function(L, P, _, C) }, {__index = Skada.extra_cc_spells}) local function log_cctaken(set) - local player = Skada:GetPlayer(set, cc_table.actorid, cc_table.actorname, cc_table.actorflags) - if not player then return end + local actor = Skada:GetActor(set, cc_table.actorid, cc_table.actorname, cc_table.actorflags) + if not actor then return end -- increment the count. - player.cctaken = (player.cctaken or 0) + 1 + actor.cctaken = (actor.cctaken or 0) + 1 set.cctaken = (set.cctaken or 0) + 1 -- saving this to total set may become a memory hog deluxe. if set == Skada.total and not P.totalidc then return end -- record the spell. - local spell = player.cctakenspells and player.cctakenspells[cc_table.spellid] + local spell = actor.cctakenspells and actor.cctakenspells[cc_table.spellid] if not spell then - player.cctakenspells = player.cctakenspells or {} - player.cctakenspells[cc_table.spellid] = {count = 0} - spell = player.cctakenspells[cc_table.spellid] + actor.cctakenspells = actor.cctakenspells or {} + actor.cctakenspells[cc_table.spellid] = {count = 0} + spell = actor.cctakenspells[cc_table.spellid] end spell.count = spell.count + 1 @@ -337,15 +337,15 @@ Skada:RegisterModule("CC Taken", function(L, P, _, C) end end - function playermod:Enter(win, id, label) + function spellmod:Enter(win, id, label) win.actorid, win.actorname = id, label win.title = uformat(L["%s's control spells"], label) end - function playermod:Update(win, set) + function spellmod:Update(win, set) win.title = uformat(L["%s's control spells"], win.actorname) - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.cctaken local spells = (total and total > 0) and actor.cctakenspells @@ -452,11 +452,11 @@ Skada:RegisterModule("CC Taken", function(L, P, _, C) end function mod:OnEnable() - playermod.metadata = {click1 = targetmod} + spellmod.metadata = {click1 = targetmod} self.metadata = { showspots = true, ordersort = true, - click1 = playermod, + click1 = spellmod, click2 = sourcemod, click4 = Skada.FilterClass, click4_label = L["Toggle Class Filter"], @@ -467,7 +467,7 @@ Skada:RegisterModule("CC Taken", function(L, P, _, C) mod_cols = self.metadata.columns -- no total click. - playermod.nototal = true + spellmod.nototal = true sourcemod.nototal = true targetmod.nototal = true @@ -511,7 +511,7 @@ Skada:RegisterModule("CC Taken", function(L, P, _, C) end get_actor_cc_sources = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local spells = actor and actor.cctaken and actor.cctakenspells if not spells then return end @@ -541,7 +541,7 @@ end) -- ========= -- Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) local mod = Skada:NewModule("CC Breaks") - local playermod = mod:NewModule("Crowd Control Spells") + local spellmod = mod:NewModule("Crowd Control Spells") local targetmod = mod:NewModule("Crowd Control Targets") local cc_spells = Skada.cc_spells local get_actor_cc_break_targets = nil @@ -551,22 +551,22 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) local GetPartyAssignment, UnitIterator = GetPartyAssignment, Skada.UnitIterator local function log_ccbreak(set) - local player = Skada:GetPlayer(set, cc_table.srcGUID, cc_table.srcName, cc_table.srcFlags) - if not player then return end + local actor = Skada:GetActor(set, cc_table.actorid, cc_table.actorname, cc_table.actorflags) + if not actor then return end -- increment the count. - player.ccbreak = (player.ccbreak or 0) + 1 + actor.ccbreak = (actor.ccbreak or 0) + 1 set.ccbreak = (set.ccbreak or 0) + 1 -- saving this to total set may become a memory hog deluxe. if set == Skada.total and not P.totalidc then return end -- record the spell. - local spell = player.ccbreakspells and player.ccbreakspells[cc_table.spellid] + local spell = actor.ccbreakspells and actor.ccbreakspells[cc_table.spellid] if not spell then - player.ccbreakspells = player.ccbreakspells or {} - player.ccbreakspells[cc_table.spellid] = {count = 0} - spell = player.ccbreakspells[cc_table.spellid] + actor.ccbreakspells = actor.ccbreakspells or {} + actor.ccbreakspells[cc_table.spellid] = {count = 0} + spell = actor.ccbreakspells[cc_table.spellid] end spell.count = spell.count + 1 @@ -583,14 +583,13 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) local srcGUID, srcName, srcFlags = t.srcGUID, t.srcName, t.srcFlags local _srcGUID, _srcName, _srcFlags = Skada:FixMyPets(srcGUID, srcName, srcFlags) - cc_table.srcGUID = _srcGUID - cc_table.srcName = _srcName - cc_table.srcFlags = _srcFlags - cc_table.dstName = t.dstName - cc_table.spellid = t.spellstring + cc_table.actorid = _srcGUID + cc_table.actorname = _srcName + cc_table.actorflags = _srcFlags - cc_table.dstGUID = nil - cc_table.dstFlags = nil + cc_table.spellid = t.spellstring + cc_table.dstName = t.dstName + cc_table.srcName = nil Skada:DispatchSets(log_ccbreak) @@ -622,15 +621,15 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) end end - function playermod:Enter(win, id, label) + function spellmod:Enter(win, id, label) win.actorid, win.actorname = id, label win.title = uformat(L["%s's control spells"], label) end - function playermod:Update(win, set) + function spellmod:Update(win, set) win.title = uformat(L["%s's control spells"], win.actorname) - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.ccbreak local spells = (total and total > 0) and actor.ccbreakspells @@ -669,7 +668,7 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -714,7 +713,7 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) self.metadata = { showspots = true, ordersort = true, - click1 = playermod, + click1 = spellmod, click2 = targetmod, click4 = Skada.FilterClass, click4_label = L["Toggle Class Filter"], @@ -725,7 +724,7 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) mod_cols = self.metadata.columns -- no total click. - playermod.nototal = true + spellmod.nototal = true targetmod.nototal = true Skada:RegisterForCL( @@ -782,7 +781,7 @@ Skada:RegisterModule("CC Breaks", function(L, P, _, C, M) end get_actor_cc_break_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local spells = actor and actor.ccbreak and actor.ccbreakspells if not spells then return end diff --git a/Skada/Modules/Comparison.lua b/Skada/Modules/Comparison.lua index 4234769..0052881 100644 --- a/Skada/Modules/Comparison.lua +++ b/Skada/Modules/Comparison.lua @@ -67,7 +67,7 @@ Skada:RegisterModule("Comparison", function(L, P) local function spellmod_tooltip(win, id, label, tooltip) if label == L["Critical Hits"] or label == L["Normal Hits"] or label == L["Glancing"] then local set = win:GetSelectedSet() - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor.damagespells and actor.damagespells[win.spellid] if actor.id == otherGUID then @@ -162,7 +162,7 @@ Skada:RegisterModule("Comparison", function(L, P) local function activity_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if actor then local totaltime = set:GetTime() local activetime = actor:GetTime(set, true) @@ -210,7 +210,7 @@ Skada:RegisterModule("Comparison", function(L, P) win.title = uformat(L["%s vs %s: %s"], win.actorname, otherName, uformat(L["%s's damage breakdown"], win.spellname)) if not set or not win.spellid then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor then return end local spell = actor and actor.damagespells and actor.damagespells[win.spellid] @@ -299,7 +299,7 @@ Skada:RegisterModule("Comparison", function(L, P) win.title = uformat(L["%s vs %s: %s"], win.actorname, otherName, L["actor damage"](win.spellname or L["Unknown"])) if not set or not win.spellid then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor then return end local spell = actor and actor.damagespells and actor.damagespells[win.spellid] @@ -666,7 +666,7 @@ Skada:RegisterModule("Comparison", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount d.valuetext = Skada:FormatValueCols(mod_cols.Damage and Skada:FormatNumber(d.value)) @@ -685,7 +685,7 @@ Skada:RegisterModule("Comparison", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount local otarget = otargets and otargets[targetname] @@ -703,7 +703,7 @@ Skada:RegisterModule("Comparison", function(L, P) if not targets[targetname] then nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount d.valuetext = format_value_number(0, d.value, true, actor.id == otherGUID) @@ -733,7 +733,7 @@ Skada:RegisterModule("Comparison", function(L, P) local dps, amount = actor:GetDPS(set) if amount > 0 then nr = nr + 1 - local d = win:actor(nr, actor) + local d = win:actor(nr, actor, actor.enemy) d.value = amount d.valuetext = Skada:FormatValueCols( @@ -776,7 +776,7 @@ Skada:RegisterModule("Comparison", function(L, P) win:DisplayMode(mod) elseif win.GetSelectedSet then local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if actor then otherGUID = actor.id otherName = actor.name diff --git a/Skada/Modules/Damage.lua b/Skada/Modules/Damage.lua index 8d41f9f..24cfcc1 100644 --- a/Skada/Modules/Damage.lua +++ b/Skada/Modules/Damage.lua @@ -36,14 +36,14 @@ Skada:RegisterModule("Damage", function(L, P) local missTypes = Skada.missTypes local mod_cols = nil - -- spells on the list below are used to update player's active time + -- spells on the list below are used to update actor's active time -- no matter their role or damage amount, since pets aren't considered. local whitelist = {} local function log_spellcast(set, actorid, actorname, actorflags, spellid) if not set or (set == Skada.total and not P.totalidc) then return end - local actor = Skada:FindPlayer(set, actorid, actorname, actorflags) + local actor = Skada:FindActor(set, actorid, actorname, true) if not actor or not actor.damagespells then return end local spell = actor.damagespells[spellid] @@ -67,7 +67,7 @@ Skada:RegisterModule("Damage", function(L, P) local function log_damage(set, isdot) if not dmg.amount then return end - local actor = Skada:GetPlayer(set, dmg.actorid, dmg.actorname, dmg.actorflags) + local actor = Skada:GetActor(set, dmg.actorid, dmg.actorname, dmg.actorflags) if not actor then return elseif dmg.amount > 0 and not dmg.petname then @@ -235,7 +235,7 @@ Skada:RegisterModule("Damage", function(L, P) local function damage_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -260,7 +260,7 @@ Skada:RegisterModule("Damage", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagespells and actor.damagespells[id] if not spell then return end @@ -299,7 +299,7 @@ Skada:RegisterModule("Damage", function(L, P) local function spellmod_tooltip(win, id, label, tooltip) if label == L["Critical Hits"] or label == L["Normal Hits"] or label == L["Glancing"] then local set = win:GetSelectedSet() - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor.damagespells and actor.damagespells[win.spellid] if not spell then return end @@ -343,7 +343,7 @@ Skada:RegisterModule("Damage", function(L, P) win.title = L["actor damage"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetDamage() local spells = (total and total > 0) and actor.damagespells @@ -387,7 +387,7 @@ Skada:RegisterModule("Damage", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -416,8 +416,8 @@ Skada:RegisterModule("Damage", function(L, P) win.title = uformat("%s: %s", win.actorname, uformat(L["%s's damage breakdown"], win.spellname)) if not set or not win.spellid then return end - -- details only available for players - local actor = set:GetActor(win.actorname, win.actorid) + -- details only available for actors + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagespells and actor.damagespells[win.spellid] if not spell then @@ -471,8 +471,8 @@ Skada:RegisterModule("Damage", function(L, P) win.title = uformat(L["%s's <%s> damage"], win.actorname, win.spellname) if not win.spellid then return end - -- only available for players - local actor = set and set:GetActor(win.actorname, win.actorid) + -- only available for actors + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagespells and actor.damagespells[win.spellid] if not spell then return end @@ -534,7 +534,7 @@ Skada:RegisterModule("Damage", function(L, P) win.title = L["actor damage"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local targets = actor and actor:GetDamageTargets(set) if not targets or not targets[win.targetname] then return end @@ -610,7 +610,7 @@ Skada:RegisterModule("Damage", function(L, P) local function feed_personal_dps() local set = Skada:GetSet("current") - local actor = set and set:GetPlayer(Skada.userGUID, Skada.userName) + local actor = set and set:GetActor(Skada.userGUID, Skada.userName) return format("%s %s", Skada:FormatNumber(actor and actor:GetDPS(set) or 0), L["DPS"]) end @@ -746,7 +746,7 @@ Skada:RegisterModule("DPS", function(L, P) local function dps_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -835,10 +835,10 @@ Skada:RegisterModule("Damage Done By Spell", function(L, P, _, C) local sourcemod = mod:NewModule("Damage spell sources") local mod_cols = nil - local function player_tooltip(win, id, label, tooltip) + local function sourcemod_tooltip(win, id, label, tooltip) local set = win.spellname and win:GetSelectedSet() - local player = set and set:GetActor(label, id) - local spell = player and player.damagespells and player.damagespells[win.spellid] + local actor = set and set:GetActor(id, label) + local spell = actor and actor.damagespells and actor.damagespells[win.spellid] if not spell then return end tooltip:AddLine(label .. " - " .. win.spellname) @@ -961,7 +961,7 @@ Skada:RegisterModule("Damage Done By Spell", function(L, P, _, C) end function mod:OnEnable() - sourcemod.metadata = {showspots = true, tooltip = player_tooltip} + sourcemod.metadata = {showspots = true, tooltip = sourcemod_tooltip} self.metadata = { showspots = true, click1 = sourcemod, @@ -1005,7 +1005,7 @@ Skada:RegisterModule("Useful Damage", function(L, P) win.title = L["actor damage"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetDamage(true) local spells = (total and total > 0) and actor.damagespells @@ -1053,7 +1053,7 @@ Skada:RegisterModule("Useful Damage", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount if target.o_amt then d.value = max(0, d.value - target.o_amt) @@ -1186,7 +1186,7 @@ Skada:RegisterModule("Overkill", function(L, _, _, C) win.title = uformat(L["%s's overkill spells"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor.overkill local spells = (total and total > 0) and actor.damagespells @@ -1233,7 +1233,7 @@ Skada:RegisterModule("Overkill", function(L, _, _, C) if target.o_amt and target.o_amt > 0 then nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.o_amt format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -1263,7 +1263,7 @@ Skada:RegisterModule("Overkill", function(L, _, _, C) if target.o_amt and target.o_amt > 0 then nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.o_amt format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -1279,7 +1279,7 @@ Skada:RegisterModule("Overkill", function(L, _, _, C) win.title = uformat(L["%s's overkill spells"], win.actorname) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or not actor.overkill or actor.overkill == 0 then return end local targets = actor:GetDamageTargets(set) @@ -1366,7 +1366,7 @@ Skada:RegisterModule("Overkill", function(L, _, _, C) --------------------------------------------------------------------------- get_actor_spell_overkill_targets = function(self, id, name, spellid, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) if not actor or not actor.overkill or actor.overkill == 0 then return end local spell = actor.damagespells and actor.damagespells[spellid] diff --git a/Skada/Modules/DamageTaken.lua b/Skada/Modules/DamageTaken.lua index c2f9369..ecd7909 100644 --- a/Skada/Modules/DamageTaken.lua +++ b/Skada/Modules/DamageTaken.lua @@ -36,7 +36,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) local dmg = {} local function log_damage(set) - local actor = Skada:GetPlayer(set, dmg.actorid, dmg.actorname, dmg.actorflags) + local actor = Skada:GetActor(set, dmg.actorid, dmg.actorname, dmg.actorflags) if not actor then return end actor.damaged = (actor.damaged or 0) + dmg.amount @@ -169,7 +169,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) local function damage_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -189,7 +189,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagedspells and actor.damagedspells[id] if not spell then return end @@ -221,7 +221,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) local function spellmod_tooltip(win, id, label, tooltip) if label == L["Critical Hits"] or label == L["Normal Hits"] or label == L["Glancing"] then local set = win:GetSelectedSet() - local actor = set and set:GetPlayer(win.actorid, win.actorname) + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagedspells and actor.damagedspells[win.spellid] if not spell then return end @@ -265,7 +265,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) win.title = uformat(L["Damage taken by %s"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetDamageTaken() local spells = (total and total > 0) and actor.damagedspells @@ -308,7 +308,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) for sourcename, source in pairs(sources) do nr = nr + 1 - local d = win:actor(nr, source, true, sourcename) + local d = win:actor(nr, source, source.enemy, sourcename) d.value = P.absdamage and source.total or source.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -335,7 +335,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) win.title = uformat("%s: %s", win.actorname, uformat(L["%s's damage breakdown"], win.spellname)) if not set or not win.spellid then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagedspells and actor.damagedspells[win.spellid] if not spell then return @@ -387,7 +387,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) win.title = uformat("%s: %s", win.actorname, uformat(L["Damage from %s"], win.spellname)) if not set or not win.spellid then return end - local actor = set:GetPlayer(win.actorid, win.actorname) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.damagedspells and actor.damagedspells[win.spellid] if not spell then return end @@ -449,7 +449,7 @@ Skada:RegisterModule("Damage Taken", function(L, P) win.title = L["actor damage"](win.targetname or L["Unknown"], win.actorname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local sources = actor and actor:GetDamageSources(set) if not sources or not sources[win.targetname] then return end @@ -605,7 +605,7 @@ Skada:RegisterModule("DTPS", function(L, P) local function dtps_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -694,7 +694,7 @@ Skada:RegisterModule("Damage Taken By Spell", function(L, P) local function player_tooltip(win, id, label, tooltip) local set = win.spellid and win:GetSelectedSet() - local player = set and set:GetActor(label, id) + local player = set and set:GetActor(id, label) if not player then return end local spell = player.damagedspells and player.damagedspells[win.spellid] @@ -772,7 +772,7 @@ Skada:RegisterModule("Damage Taken By Spell", function(L, P) for sourcename, source in pairs(sources) do nr = nr + 1 - local d = win:actor(nr, source, true, sourcename) + local d = win:actor(nr, source, source.enemy, sourcename) d.value = source.amount format_valuetext(d, mod_cols, total, source.time and (d.value / source.time), win.metadata, true) end diff --git a/Skada/Modules/Deaths.lua b/Skada/Modules/Deaths.lua index 62cb9cb..9a264aa 100644 --- a/Skada/Modules/Deaths.lua +++ b/Skada/Modules/Deaths.lua @@ -2,7 +2,7 @@ local _, Skada = ... local Private = Skada.Private Skada:RegisterModule("Deaths", function(L, P, _, _, M) local mod = Skada:NewModule("Deaths") - local playermod = mod:NewModule("Player's deaths") + local actormod = mod:NewModule("Player's deaths") local deathlogmod = mod:NewModule("Death log") local WATCH = nil -- true to watch those alive @@ -59,7 +59,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) local function log_deathlog(set, override) if not set or (set == Skada.total and not P.totalidc) then return end - local actor = Skada:GetPlayer(set, data.actorid, data.actorname, data.actorflags) + local actor = Skada:GetActor(set, data.actorid, data.actorname, data.actorflags) if not actor then return end local deathlog = actor.deathlog and actor.deathlog[1] @@ -69,7 +69,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) deathlog = actor.deathlog[1] end - -- seet player maxhp if not already set + -- seet actor maxhp if not already set if not deathlog.hpm or deathlog.hpm == 0 then _, _, deathlog.hpm = UnitHealthInfo(actor.name, actor.id, "group") deathlog.hpm = deathlog.hpm or 0 @@ -128,17 +128,17 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) end end - local function log_death(set, playerid, playername, playerflags) - local player = Skada:GetPlayer(set, playerid, playername, playerflags) - if not player then return end + local function log_death(set, actorid, actorname, actorflags) + local actor = Skada:GetActor(set, actorid, actorname, actorflags) + if not actor then return end set.death = (set.death or 0) + 1 - player.death = (player.death or 0) + 1 + actor.death = (actor.death or 0) + 1 -- saving this to total set may become a memory hog deluxe. if set == Skada.total and not P.totalidc then return end - local deathlog = player.deathlog and player.deathlog[1] + local deathlog = actor.deathlog and actor.deathlog[1] if not deathlog then return end deathlog.time = set.last_time or GetTime() @@ -168,7 +168,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) -- announce death if M.deathannounce and set ~= Skada.total then - mod:Announce(deathlog.log, player.name) + mod:Announce(deathlog.log, actor.name) end end @@ -424,12 +424,12 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) function deathlogmod:Update(win, set) win.title = uformat(L["%s's death log"], win.actorname) - local player = win.datakey and Skada:FindPlayer(set, win.actorid, win.actorname) - local deathlog = player and player.deathlog and player.deathlog[win.datakey] + local actor = win.datakey and Skada:FindActor(set, win.actorid, win.actorname) + local deathlog = actor and actor.deathlog and actor.deathlog[win.datakey] if not deathlog then return end if M.alternativedeaths then - local num = #player.deathlog + local num = #actor.deathlog if win.datakey ~= num then win.title = format("%s (%d)", win.title, num - win.datakey + 1) end @@ -466,7 +466,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) d.icon = icon_mode d.color = nil d.value = 0 - d.valuetext = format(L["%s dies"], player.name) + d.valuetext = format(L["%s dies"], actor.name) end end @@ -570,16 +570,16 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) end end - function playermod:Enter(win, id, label) + function actormod:Enter(win, id, label) win.actorid, win.actorname = id, label win.title = format(L["%s's deaths"], label) end - function playermod:Update(win, set) + function actormod:Update(win, set) win.title = uformat(L["%s's deaths"], win.actorname) if not set or not win.actorid then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or actor.enemy then return end local deathlog = (actor.death or WATCH) and actor.deathlog @@ -682,7 +682,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) local death = actor.deathlog[j] if death and (death.timeod or WATCH) then nr = nr + 1 - local d = win:actor(nr, actor) + local d = win:actor(nr, actor, actor.enemy) d.id = format("%s::%d", actor.id, j) if death.timeod then @@ -734,7 +734,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) local function entry_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local deathlog = actor and actor.deathlog and win.datakey and actor.deathlog[win.datakey] local entry = deathlog and deathlog.log and deathlog.log[id] if not entry or not entry.id then return end @@ -787,9 +787,9 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) columns = {Change = true, Health = true, Percent = true}, icon = icon_death } - playermod.metadata = {click1 = deathlogmod} + actormod.metadata = {click1 = deathlogmod} self.metadata = { - click1 = playermod, + click1 = actormod, click4 = Skada.FilterClass, click4_label = L["Toggle Class Filter"], columns = {Time = true, Survivability = false, Source = false}, @@ -798,7 +798,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) -- alternative display if M.alternativedeaths then - playermod.metadata.click1 = nil + actormod.metadata.click1 = nil self.metadata.click1 = deathlogmod end @@ -807,7 +807,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) -- no total click. deathlogmod.nototal = true - playermod.nototal = true + actormod.nototal = true local flags_dst_nopets = {dst_is_interesting_nopets = true} @@ -918,11 +918,11 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) end end - function mod:Announce(logs, playername) + function mod:Announce(logs, actorname) -- announce only if: -- 1. we have a valid deathlog. - -- 2. player is not in a pvp (spam caution). - -- 3. player is in a group or channel set to self or guild. + -- 2. actor is not in a pvp (spam caution). + -- 3. actor is in a group or channel set to self or guild. if not logs or IsInPvP() then return end local channel = M.deathchannel @@ -943,7 +943,7 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) local output = format( (channel == "SELF") and "%s > %s (%s) %s" or "Skada: %s > %s (%s) %s", log.src or L["Unknown"], -- source name - playername or L["Unknown"], -- player name + actorname or L["Unknown"], -- actor name log.id and spellnames[abs(log.id)] or L["Unknown"], -- spell name log.amt and Skada:FormatNumber(0 - log.amt, 1) or 0 -- spell amount ) @@ -1063,12 +1063,12 @@ Skada:RegisterModule("Deaths", function(L, P, _, _, M) set = function(_, value) if M.alternativedeaths then M.alternativedeaths = nil - mod.metadata.click1 = playermod - playermod.metadata.click1 = deathlogmod + mod.metadata.click1 = actormod + actormod.metadata.click1 = deathlogmod else M.alternativedeaths = true mod.metadata.click1 = deathlogmod - playermod.metadata.click1 = nil + actormod.metadata.click1 = nil end mod:Reload() diff --git a/Skada/Modules/Dispels.lua b/Skada/Modules/Dispels.lua index 3aa4881..696e85e 100644 --- a/Skada/Modules/Dispels.lua +++ b/Skada/Modules/Dispels.lua @@ -27,10 +27,10 @@ Skada:RegisterModule("Dispels", function(L, P, _, C) local dispel = {} local function log_dispel(set) - local actor = Skada:GetPlayer(set, dispel.actorid, dispel.actorname, dispel.actorflags) + local actor = Skada:GetActor(set, dispel.actorid, dispel.actorname, dispel.actorflags) if not actor then return end - -- increment player's and set's dispels count + -- increment actor's and set's dispels count actor.dispel = (actor.dispel or 0) + 1 set.dispel = (set.dispel or 0) + 1 @@ -118,7 +118,7 @@ Skada:RegisterModule("Dispels", function(L, P, _, C) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -132,7 +132,7 @@ Skada:RegisterModule("Dispels", function(L, P, _, C) function spellmod:Update(win, set) win.title = uformat(L["%s's dispel spells"], win.actorname) - local actor = set and set:GetPlayer(win.actorid, win.actorname) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.dispel local spells = (total and total > 0) and actor.dispelspells @@ -220,7 +220,7 @@ Skada:RegisterModule("Dispels", function(L, P, _, C) --------------------------------------------------------------------------- get_actor_dispelled_spells = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.dispel local spells = total and total > 0 and actor.dispelspells if not spells then return end @@ -237,7 +237,7 @@ Skada:RegisterModule("Dispels", function(L, P, _, C) end get_actor_dispelled_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.dispel local spells = total and total > 0 and actor.dispelspells if not spells then return end diff --git a/Skada/Modules/Enemies.lua b/Skada/Modules/Enemies.lua index 8b9ff81..e6c6c92 100644 --- a/Skada/Modules/Enemies.lua +++ b/Skada/Modules/Enemies.lua @@ -157,10 +157,9 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) end local function log_custom_unit(set, name, playername, spellid, amount, absorbed) - local e = Skada:GetEnemy(set, name) + local e = Skada:GetActor(set, name, name, true) if not e then return end - e.fake = true e.damaged = (e.damaged or 0) + amount e.totaldamaged = (e.totaldamaged or 0) + amount if absorbed > 0 then @@ -216,7 +215,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) local absorbed = dmg.absorbed or 0 if (dmg.amount + absorbed) == 0 then return end - local e = Skada:GetEnemy(set, dmg.actorname, dmg.actorid, dmg.actorflags) + local e = Skada:GetActor(set, dmg.actorid, dmg.actorname, dmg.actorflags) if not e then return end e.damaged = (e.damaged or 0) + dmg.amount @@ -381,7 +380,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) local function usefulmod_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local e = set and set:GetEnemy(label, id) + local e = set and set:GetActor(id, label) local amount, total, useful = e:GetDamageTakenBreakdown(set) if not useful or useful == 0 then return end @@ -405,7 +404,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) if not win.spellid then return end - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) if not (actor and actor.GetDamageSpellSources) then return end local sources, total = actor:GetDamageSpellSources(set, win.spellid) @@ -470,7 +469,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) win.title = L["actor damage"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not win.actorname or not win.targetname then return end - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) local sources = actor and actor:GetDamageSources(set) local source = sources and sources[win.actorname] if not source then return end @@ -506,7 +505,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) function spellmod:Update(win, set) win.title = uformat(L["Damage taken by %s"], win.targetname) - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) local total = actor and actor:GetDamageTaken() local spells = (total and total > 0) and actor.damagedspells @@ -539,7 +538,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) win.title = format("%s (%s)", win.title, L[win.class]) end - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) local total = actor and actor.usefuldamaged local sources = (total and total > 0) and actor:GetDamageSources(set) @@ -556,7 +555,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) if win:show_actor(source, set) and source.useful and source.useful > 0 then nr = nr + 1 - local d = win:actor(nr, source, nil, sourcename) + local d = win:actor(nr, source, source.enemy, sourcename) d.value = source.useful format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -583,7 +582,7 @@ Skada:RegisterModule("Enemy Damage Taken", function(L, P, _, C) if amount > 0 then nr = nr + 1 - local d = win:actor(nr, actor, true) + local d = win:actor(nr, actor, actor.enemy) d.value = amount format_valuetext(d, mod_cols, total, dtps, win.metadata) end @@ -804,7 +803,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) local absorbed = dmg.absorbed or 0 if (dmg.amount + absorbed) == 0 then return end - local e = Skada:GetEnemy(set, dmg.actorname, dmg.actorid, dmg.actorflags) + local e = Skada:GetActor(set, dmg.actorid, dmg.actorname, dmg.actorflags) if not e then return elseif (set.type == "arena" or set.type == "pvp") and dmg.amount > 0 then @@ -901,7 +900,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) win.title = L["actor damage"](win.targetname or L["Unknown"], win.actorname or L["Unknown"]) if not (win.targetname and win.actorname) then return end - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) if not (actor and actor.GetDamageTargetSpells) then return end local spells, total = actor:GetDamageTargetSpells(win.actorname) @@ -936,7 +935,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) if not win.spellid then return end - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) if not (actor and actor.GetDamageSpellTargets) then return end local targets, total = actor:GetDamageSpellTargets(set, win.spellid) @@ -953,7 +952,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) if not win.class or win.class == target.class then nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -985,7 +984,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) if not win.class or win.class == target.class then nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = P.absdamage and target.total or target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -1000,7 +999,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) function spellmod:Update(win, set) win.title = L["actor damage"](win.targetname or L["Unknown"]) - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) local total = actor and actor:GetDamage() local spells = (total and total > 0) and actor.damagespells @@ -1042,7 +1041,7 @@ Skada:RegisterModule("Enemy Damage Done", function(L, P, _, C) if amount > 0 then nr = nr + 1 - local d = win:actor(nr, actor, true) + local d = win:actor(nr, actor, actor.enemy) d.value = amount format_valuetext(d, mod_cols, total, dps, win.metadata) end @@ -1218,7 +1217,7 @@ Skada:RegisterModule("Enemy Healing Done", function(L, P) if not set or (set == Skada.total and not P.totalidc) then return end if not heal.amount or heal.amount == 0 then return end - local e = Skada:GetEnemy(set, heal.actorname, heal.actorid, heal.actorflags) + local e = Skada:GetActor(set, heal.actorid, heal.actorname, heal.actorflags) if not e then return elseif (set.type == "arena" or set.type == "pvp") then @@ -1279,7 +1278,7 @@ Skada:RegisterModule("Enemy Healing Done", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -1293,7 +1292,7 @@ Skada:RegisterModule("Enemy Healing Done", function(L, P) function spellmod:Update(win, set) win.title = L["actor heal spells"](win.targetname or L["Unknown"]) - local actor = set and set:GetEnemy(win.targetname, win.targetid) + local actor = set and set:GetActor(win.targetid, win.targetname) local total = actor and actor.heal local spells = (total and total > 0) and actor.healspells @@ -1338,7 +1337,7 @@ Skada:RegisterModule("Enemy Healing Done", function(L, P) if amount > 0 then nr = nr + 1 - local d = win:actor(nr, actor, true) + local d = win:actor(nr, actor, actor.enemy) d.value = amount format_valuetext(d, mod_cols, total, hps, win.metadata) end diff --git a/Skada/Modules/Failbot.lua b/Skada/Modules/Failbot.lua index 6bec582..9542e52 100644 --- a/Skada/Modules/Failbot.lua +++ b/Skada/Modules/Failbot.lua @@ -26,7 +26,7 @@ Skada:RegisterModule("Fails", function(L, P, _, _, M) end local function log_fail(set, actorid, actorname, spellid, failname) - local actor = Skada:GetPlayer(set, actorid, actorname) + local actor = Skada:GetActor(set, actorid, actorname, 0) if not actor or (actor.role == "TANK" and tank_events[failname]) then return end actor.fail = (actor.fail or 0) + 1 @@ -85,7 +85,7 @@ Skada:RegisterModule("Fails", function(L, P, _, _, M) function spellmod:Update(win, set) win.title = uformat(L["%s's fails"], win.actorname) - local actor = set and set:GetPlayer(win.actorid, win.actorname) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.fail local spells = (total and total > 0) and actor.failspells @@ -123,7 +123,7 @@ Skada:RegisterModule("Fails", function(L, P, _, _, M) if win:show_actor(actor, set, true) and actor.fail then nr = nr + 1 - local d = win:actor(nr, actor, actor.name) + local d = win:actor(nr, actor, actor.enemy) d.value = actor.fail format_valuetext(d, mod_cols, total, win.metadata) end diff --git a/Skada/Modules/FriendlyFire.lua b/Skada/Modules/FriendlyFire.lua index 57b70c0..260e82f 100644 --- a/Skada/Modules/FriendlyFire.lua +++ b/Skada/Modules/FriendlyFire.lua @@ -8,6 +8,7 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) local ignored_spells = Skada.ignored_spells.damage -- Edit Skada\Core\Tables.lua local passive_spells = Skada.ignored_spells.time -- Edit Skada\Core\Tables.lua local get_actor_friendfire_targets = nil + local get_spell_friendfire_targets = nil local pairs, wipe, format, uformat = pairs, wipe, string.format, Private.uformat local new, del, clear = Private.newTable, Private.delTable, Private.clearTable @@ -29,7 +30,7 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) local function log_damage(set) if not dmg.amount or dmg.amount == 0 then return end - local actor = Skada:GetPlayer(set, dmg.actorid, dmg.actorname, dmg.actorflags) + local actor = Skada:GetActor(set, dmg.actorid, dmg.actorname, dmg.actorflags) if not actor then return elseif not passive_spells[dmg.spell] then @@ -98,7 +99,7 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -112,7 +113,7 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) function spellmod:Update(win, set) win.title = L["actor damage"](win.actorname or L["Unknown"]) - local actor = set and set:GetPlayer(win.actorid, win.actorname) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor.friendfire local spells = (total and total > 0) and actor.friendfirespells @@ -143,29 +144,21 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) win.title = uformat(L["%s's <%s> damage"], win.actorname, win.spellname) if not win.spellid then return end - local actor = set and set:GetPlayer(win.actorid, win.actorname) - local total = actor and actor.friendfire - local spell = (total and total > 0) and actor.friendfirespells and actor.friendfirespells[win.spellid] - - if not spell then + local targets, total, actor = get_spell_friendfire_targets(set, win.actorid, win.actorname, win.spellid) + if not targets or not actor then return elseif win.metadata then win.metadata.maxvalue = 0 end - total = spell.amount -- total becomes that of the spell - local targets = spell.targets - local nr = 0 local actortime = mod_cols.sDPS and actor:GetTime(set) - for targetname, amount in pairs(targets) do + for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, targetname) - set:_fill_actor_table(d, targetname) - - d.value = amount + local d = win:actor(nr, target, target.enemy, targetname) + d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end end @@ -273,7 +266,7 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) --------------------------------------------------------------------------- get_actor_friendfire_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.friendfire local spells = total and actor.friendfirespells if not spells then return end @@ -296,4 +289,19 @@ Skada:RegisterModule("Friendly Fire", function(L, P, _, C) end return tbl, total, actor end + + get_spell_friendfire_targets = function(self, id, name, spellid, tbl) + local actor = spellid and self:GetActor(id, name) + local spell = actor and actor.friendfirespells and actor.friendfirespells[spellid] + if not spell or not spell.targets then return end + + tbl = clear(tbl or C) + for targetname, amount in pairs(spell.targets) do + local t = new() + t.amount = amount + self:_fill_actor_table(t, targetname) + tbl[targetname] = t + end + return tbl, spell.amount, actor + end end) diff --git a/Skada/Modules/Healing.lua b/Skada/Modules/Healing.lua index d3e2754..81e9e3d 100644 --- a/Skada/Modules/Healing.lua +++ b/Skada/Modules/Healing.lua @@ -34,15 +34,15 @@ Skada:RegisterModule("Healing", function(L, P) local wipe, del = wipe, Private.delTable local mod_cols = nil - local function log_spellcast(set, actorid, actorname, actorflags, spellid) + local function log_spellcast(set, actorid, actorname, spellid) if not set or (set == Skada.total and not P.totalidc) then return end - local player = Skada:FindPlayer(set, actorid, actorname, actorflags) - if player and player.healspells and player.healspells[spellid] then + local actor = Skada:FindActor(set, actorid, actorname, true) + if actor and actor.healspells and actor.healspells[spellid] then -- because some HoTs don't have an initial amount -- we start from 1 and not from 0 if casts wasn't -- previously set. Otherwise we just increment. - player.healspells[spellid].casts = (player.healspells[spellid].casts or 1) + 1 + actor.healspells[spellid].casts = (actor.healspells[spellid].casts or 1) + 1 end end @@ -50,23 +50,23 @@ Skada:RegisterModule("Healing", function(L, P) local function log_heal(set, ishot) if not heal.amount then return end - local player = Skada:GetPlayer(set, heal.actorid, heal.actorname, heal.actorflags) - if not player then return end + local actor = Skada:GetActor(set, heal.actorid, heal.actorname, heal.actorflags) + if not actor then return end -- get rid of overheal local amount = max(0, heal.amount - heal.overheal) - if player.role == "HEALER" and amount > 0 and not heal.petname and not passive_spells[heal.spell] then - Skada:AddActiveTime(set, player, heal.dstName) + if actor.role == "HEALER" and amount > 0 and not heal.petname and not passive_spells[heal.spell] then + Skada:AddActiveTime(set, actor, heal.dstName) end -- record the healing - player.heal = (player.heal or 0) + amount + actor.heal = (actor.heal or 0) + amount set.heal = (set.heal or 0) + amount -- record the overheal local overheal = (heal.overheal > 0) and heal.overheal or nil if overheal then - player.overheal = (player.overheal or 0) + overheal + actor.overheal = (actor.overheal or 0) + overheal set.overheal = (set.overheal or 0) + overheal end @@ -74,11 +74,11 @@ Skada:RegisterModule("Healing", function(L, P) if set == Skada.total and not P.totalidc then return end -- record the spell - local spell = player.healspells and player.healspells[heal.spellid] + local spell = actor.healspells and actor.healspells[heal.spellid] if not spell then - player.healspells = player.healspells or {} - player.healspells[heal.spellid] = {amount = 0} - spell = player.healspells[heal.spellid] + actor.healspells = actor.healspells or {} + actor.healspells[heal.spellid] = {amount = 0} + spell = actor.healspells[heal.spellid] end spell.count = (spell.count or 0) + 1 @@ -126,7 +126,7 @@ Skada:RegisterModule("Healing", function(L, P) local function spell_cast(t) if t.srcGUID and t.dstGUID and t.spellid and not ignored_spells[t.spellid] then local srcGUID, srcName, srcFlags = Skada:FixMyPets(t.srcGUID, t.srcName, t.srcFlags) - Skada:DispatchSets(log_spellcast, srcGUID, srcName, srcFlags, t.spellstring) + Skada:DispatchSets(log_spellcast, srcGUID, srcName, t.spellstring) end end @@ -150,7 +150,7 @@ Skada:RegisterModule("Healing", function(L, P) local function healing_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(label, id) + local actor = set and set:GetActor(id, label) if not actor then return end local totaltime = set:GetTime() @@ -170,7 +170,7 @@ Skada:RegisterModule("Healing", function(L, P) local set = win:GetSelectedSet() if not set then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local spell = actor and actor.healspells and actor.healspells[id] if not spell then return end @@ -226,7 +226,7 @@ Skada:RegisterModule("Healing", function(L, P) win.title = L["actor heal spells"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetHealOnTarget(win.targetname) local spells = (total and total > 0) and actor.healspells @@ -261,7 +261,7 @@ Skada:RegisterModule("Healing", function(L, P) win.title = L["actor heal spells"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor.heal local spells = (total and total > 0) and actor.healspells @@ -305,7 +305,7 @@ Skada:RegisterModule("Healing", function(L, P) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -446,7 +446,7 @@ Skada:RegisterModule("Overhealing", function(L) win.title = L["actor overheal spells"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetOverhealOnTarget(win.targetname) if not total or total == 0 then @@ -480,7 +480,7 @@ Skada:RegisterModule("Overhealing", function(L) win.title = L["actor overheal spells"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetOverheal() local spells = (total and total > 0) and actor.healspells @@ -513,7 +513,7 @@ Skada:RegisterModule("Overhealing", function(L) win.title = uformat(L["%s's overheal targets"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor.overheal local targets = (total and total > 0) and actor:GetOverhealTargets(set) @@ -529,7 +529,7 @@ Skada:RegisterModule("Overhealing", function(L) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount fmt_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -612,7 +612,7 @@ Skada:RegisterModule("Total Healing", function(L) local function spellmod_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local spell = actor and actor.healspells and actor.healspells[id] if not spell then return end @@ -677,7 +677,7 @@ Skada:RegisterModule("Total Healing", function(L) win.title = L["actor heal spells"](win.actorname or L["Unknown"], win.targetname or L["Unknown"]) if not set or not win.targetname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetTotalHealOnTarget(win.targetname) local spells = (total and total > 0) and actor.healspells @@ -711,7 +711,7 @@ Skada:RegisterModule("Total Healing", function(L) win.title = L["actor heal spells"](win.actorname or L["Unknown"]) if not win.actorname then return end - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetTotalHeal() local spells = (total and total > 0) and actor.healspells @@ -744,7 +744,7 @@ Skada:RegisterModule("Total Healing", function(L) function targetmod:Update(win, set) win.title = uformat(L["%s's healed targets"], win.actorname) - local actor = set and set:GetActor(win.actorname, win.actorid) + local actor = set and set:GetActor(win.actorid, win.actorname) local total = actor and actor:GetTotalHeal() local targets = (total and total > 0) and actor:GetTotalHealTargets(set) @@ -760,7 +760,7 @@ Skada:RegisterModule("Total Healing", function(L) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -859,7 +859,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) win.title = uformat(L["%s's heal sources"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid, true) + local actor = set:GetActor(win.actorid, win.actorname, true) if not actor or actor.enemy then return end -- unavailable for enemies local sources, total = get_actor_heal_sources(actor, set) @@ -875,7 +875,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) for sourcename, source in pairs(C) do nr = nr + 1 - local d = win:actor(nr, source, nil, sourcename) + local d = win:actor(nr, source, source.enemy, sourcename) d.value = source.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end @@ -890,7 +890,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) win.title = L["actor heal spells"](win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid, true) + local actor = set:GetActor(win.actorid, win.actorname, true) if not actor or actor.enemy then return end -- unavailable for enemies local spells, total = get_actor_healed_spells(actor, set) @@ -921,7 +921,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) win.title = L["actor heal spells"](win.targetname or L["Unknown"], win.actorname or L["Unknown"]) if not set or not win.actorname then return end - local actor = set:GetActor(win.targetname, win.targetid) + local actor = set:GetActor(win.targetid, win.targetname) if not actor or actor.enemy then return end -- unavailable for enemies yet local total = actor and actor:GetAbsorbHealOnTarget(win.actorname) @@ -971,7 +971,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) win.title = uformat(L["%s's <%s> sources"], win.actorname, win.spellname) if not set or not win.actorname or not win.spellid then return end - local actor = set:GetActor(win.actorname, win.actorid, true) + local actor = set:GetActor(win.actorid, win.actorname, true) if not actor or actor.enemy then return end local sources, total = get_actor_heal_spell_sources(actor, set, win.spellid) @@ -987,7 +987,7 @@ Skada:RegisterModule("Healing Taken", function(L, P) for sourcename, source in pairs(sources) do nr = nr + 1 - local d = win:actor(nr, source, nil, sourcename) + local d = win:actor(nr, source, source.enemy, sourcename) d.value = source.amount format_valuetext(d, mod_cols, total, actortime and (d.value / actortime), win.metadata, true) end diff --git a/Skada/Modules/Healthstone.lua b/Skada/Modules/Healthstone.lua index 36af3ad..ddf2649 100644 --- a/Skada/Modules/Healthstone.lua +++ b/Skada/Modules/Healthstone.lua @@ -19,7 +19,7 @@ Skada:RegisterModule("Healthstones", function(L) end local function log_healthstone(set, actorid, actorname, actorflags) - local actor = Skada:GetPlayer(set, actorid, actorname, actorflags) + local actor = Skada:GetActor(set, actorid, actorname, actorflags) if actor then actor.healthstone = (actor.healthstone or 0) + 1 set.healthstone = (set.healthstone or 0) + 1 diff --git a/Skada/Modules/Interrupts.lua b/Skada/Modules/Interrupts.lua index 4511780..3f714d3 100644 --- a/Skada/Modules/Interrupts.lua +++ b/Skada/Modules/Interrupts.lua @@ -28,10 +28,10 @@ Skada:RegisterModule("Interrupts", function(L, P, _, C, M) local data = {} local function log_interrupt(set) - local actor = Skada:GetPlayer(set, data.actorid, data.actorname, data.actorflags) + local actor = Skada:GetActor(set, data.actorid, data.actorname, data.actorflags) if not actor then return end - -- increment player's and set's interrupts count + -- increment actor's and set's interrupts count actor.interrupt = (actor.interrupt or 0) + 1 set.interrupt = (set.interrupt or 0) + 1 @@ -133,7 +133,7 @@ Skada:RegisterModule("Interrupts", function(L, P, _, C, M) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -148,7 +148,7 @@ Skada:RegisterModule("Interrupts", function(L, P, _, C, M) win.title = uformat(L["%s's interrupt spells"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = (actor and not actor.enemy) and actor.interrupt local spells = (total and total > 0) and actor.interruptspells @@ -277,7 +277,7 @@ Skada:RegisterModule("Interrupts", function(L, P, _, C, M) --------------------------------------------------------------------------- get_actor_interrupted_spells = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.interrupt local spells = total and actor.interruptspells if not spells then return end @@ -294,7 +294,7 @@ Skada:RegisterModule("Interrupts", function(L, P, _, C, M) end get_actor_interrupt_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.interrupt local spells = total and actor.interruptspells if not spells then return end diff --git a/Skada/Modules/MySpells.lua b/Skada/Modules/MySpells.lua index 566e82b..1aa0444 100644 --- a/Skada/Modules/MySpells.lua +++ b/Skada/Modules/MySpells.lua @@ -19,7 +19,7 @@ Skada:RegisterModule("My Spells", function(L, P) local function spell_tooltip(win, id, label, tooltip) local set = win:GetSelectedSet() - local actor = set and set:GetPlayer(userGUID, userName) + local actor = set and set:GetActor(userGUID, userName) if not actor then return end local spell, damage = nil, nil @@ -89,7 +89,7 @@ Skada:RegisterModule("My Spells", function(L, P) function mod:Update(win, set) win.title = L["My Spells"] - local player = set and set:GetPlayer(userGUID, userName) + local player = set and set:GetActor(userGUID, userName) if not player then return elseif win.metadata then diff --git a/Skada/Modules/Parry.lua b/Skada/Modules/Parry.lua index 5f8af50..514c81b 100644 --- a/Skada/Modules/Parry.lua +++ b/Skada/Modules/Parry.lua @@ -35,7 +35,7 @@ Skada:RegisterModule("Parry-Haste", function(L, P, _, _, M) local data = {} local function log_parry(set) - local actor = Skada:GetPlayer(set, data.actorid, data.actorname, data.actorflags) + local actor = Skada:GetActor(set, data.actorid, data.actorname, data.actorflags) if not actor then return end actor.parry = (actor.parry or 0) + 1 @@ -70,7 +70,7 @@ Skada:RegisterModule("Parry-Haste", function(L, P, _, _, M) win.title = uformat(L["%s's parry targets"], win.actorname) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) local total = (actor and not actor.enemy) and actor.parry local targets = (total and total > 0) and actor.parrytargets diff --git a/Skada/Modules/Potions.lua b/Skada/Modules/Potions.lua index 4f66663..19d01a7 100644 --- a/Skada/Modules/Potions.lua +++ b/Skada/Modules/Potions.lua @@ -27,7 +27,7 @@ Skada:RegisterModule("Potions", function(L, P, _, C) end local function log_potion(set, actorid, actorname, actorflags, potionid) - local actor = Skada:GetPlayer(set, actorid, actorname, actorflags) + local actor = Skada:GetActor(set, actorid, actorname, actorflags) if not actor then return end -- record potion usage for actor and set @@ -129,7 +129,7 @@ Skada:RegisterModule("Potions", function(L, P, _, C) for actorname, actor in pairs(actors) do nr = nr + 1 - local d = win:actor(nr, actor, nil, actorname) + local d = win:actor(nr, actor, actor.enemy, actorname) d.value = actor.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -151,7 +151,7 @@ Skada:RegisterModule("Potions", function(L, P, _, C) win.title = uformat(L["%s's used potions"], win.actorname) if not set or not win.actorname then return end - local actor = Skada:FindPlayer(set, win.actorid, win.actorname, true) + local actor = Skada:FindActor(set, win.actorid, win.actorname, true) local total = actor and actor.potion local potions = (total and total > 0) and actor.potionspells diff --git a/Skada/Modules/Power.lua b/Skada/Modules/Power.lua index 85e0056..4819072 100644 --- a/Skada/Modules/Power.lua +++ b/Skada/Modules/Power.lua @@ -60,7 +60,7 @@ Skada:RegisterModule("Resources", function(L, P) local function log_gain(set) if not (gain and gain.type and gainTable[gain.type]) then return end - local actor = Skada:GetPlayer(set, gain.actorid, gain.actorname, gain.actorflags) + local actor = Skada:GetActor(set, gain.actorid, gain.actorname, gain.actorflags) if not actor then return end actor[gainTable[gain.type]] = (actor[gainTable[gain.type]] or 0) + gain.amount @@ -174,7 +174,7 @@ Skada:RegisterModule("Resources", function(L, P) win.title = uformat(L["%s's gained %s"], win.actorname, L[self.powername]) if not set or not win.actorname then return end - local actor = set:GetActor(win.actorname, win.actorid) + local actor = set:GetActor(win.actorid, win.actorname) if not actor or actor.enemy then return end -- unavailable for enemies yet local total = actor and self.power and actor[self.power] diff --git a/Skada/Modules/Resurrects.lua b/Skada/Modules/Resurrects.lua index 7b3e1c9..7a3223a 100644 --- a/Skada/Modules/Resurrects.lua +++ b/Skada/Modules/Resurrects.lua @@ -23,7 +23,7 @@ Skada:RegisterModule("Resurrects", function(L, P, _, C) local ress = {} local function log_resurrect(set) - local actor = Skada:GetPlayer(set, ress.actorid, ress.actorname, ress.actorflags) + local actor = Skada:GetActor(set, ress.actorid, ress.actorname, ress.actorflags) if not actor then return end actor.ress = (actor.ress or 0) + 1 @@ -66,7 +66,7 @@ Skada:RegisterModule("Resurrects", function(L, P, _, C) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, nil, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -136,7 +136,7 @@ Skada:RegisterModule("Resurrects", function(L, P, _, C) --------------------------------------------------------------------------- get_actor_ress_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.ress local targets = total and actor.restargets if not targets then return end diff --git a/Skada/Modules/SunderCounter.lua b/Skada/Modules/SunderCounter.lua index 6e447ad..f18e57e 100644 --- a/Skada/Modules/SunderCounter.lua +++ b/Skada/Modules/SunderCounter.lua @@ -31,7 +31,7 @@ Skada:RegisterModule("Sunder Counter", function(L, P, _, C, M) local data = {} local function log_sunder(set) - local actor = Skada:GetPlayer(set, data.actorid, data.actorname, data.actorflags) + local actor = Skada:GetActor(set, data.actorid, data.actorname, data.actorflags) if not actor then return end set.sunder = (set.sunder or 0) + 1 @@ -180,7 +180,7 @@ Skada:RegisterModule("Sunder Counter", function(L, P, _, C, M) for targetname, target in pairs(targets) do nr = nr + 1 - local d = win:actor(nr, target, true, targetname) + local d = win:actor(nr, target, target.enemy, targetname) d.value = target.count format_valuetext(d, mod_cols, total, win.metadata, true) end @@ -379,7 +379,7 @@ Skada:RegisterModule("Sunder Counter", function(L, P, _, C, M) end get_actor_sunder_targets = function(self, id, name, tbl) - local actor = self:GetActor(name, id) + local actor = self:GetActor(id, name) local total = actor and actor.sunder if not actor.sundertargets then return end diff --git a/Skada/Skada.toc b/Skada/Skada.toc index 91ed415..dc2f2af 100644 --- a/Skada/Skada.toc +++ b/Skada/Skada.toc @@ -16,7 +16,7 @@ ## DefaultState: enabled ## Author: Kader (|cff808080bkader#5341|r) ## Version: 1.8.83 -## X-Date: 2022-11-01 @ 14:54 |cff808080UTC|r +## X-Date: 2022-11-02 @ 09:42 |cff808080UTC|r ## X-Credits: Zarnivoop ## X-Curse-Project-ID: 623633 ## X-Category: Combat