Added Details:GetUntitClass(unitId), this call handles the Ambiguate in combatlog's player name when calling UnitClass
This commit is contained in:
@@ -174,6 +174,28 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
---return the class file name of the unit passed
|
||||
local getFromCache = Details222.ClassCache.GetClassFromCache
|
||||
local Ambiguate = Ambiguate
|
||||
local UnitClass = UnitClass
|
||||
function Details:GetUnitClass(unitId)
|
||||
local class, classFileName = getFromCache(unitId)
|
||||
|
||||
if (not classFileName) then
|
||||
unitId = Ambiguate(unitId, "none")
|
||||
classFileName = select(2, UnitClass(unitId))
|
||||
end
|
||||
|
||||
return classFileName
|
||||
end
|
||||
|
||||
---return the class name, class file name and class id of the unit passed
|
||||
function Details:GetUnitClassFull(unitId)
|
||||
unitId = Ambiguate(unitId, "none")
|
||||
local locClassName, classFileName, classId = UnitClass(unitId)
|
||||
return locClassName, classFileName, classId
|
||||
end
|
||||
|
||||
function Details:GetFullName(unitId)
|
||||
--playerName, realmName = UnitFullName(unitId) --realm name already has spaces removed
|
||||
--return playerName .. "-" .. realmName
|
||||
|
||||
@@ -157,7 +157,7 @@ local tickerCallback = function(tickerObject)
|
||||
end
|
||||
end
|
||||
|
||||
addPlayerDamage(UnitName ("player"))
|
||||
addPlayerDamage(UnitName("player"))
|
||||
end
|
||||
|
||||
function mythicDungeonCharts:OnBossDefeated()
|
||||
|
||||
+10
-10
@@ -103,12 +103,12 @@ do
|
||||
---@param actorName string
|
||||
---@return string className, number left, number right, number top, number bottom, number red, number green, number blue, number alpha
|
||||
function Details:GetClass(actorName)
|
||||
local _, class = UnitClass(actorName)
|
||||
local unitClass = Details:GetUnitClass(actorName)
|
||||
|
||||
if (class) then
|
||||
local left, right, top, bottom = unpack(Details.class_coords[class])
|
||||
local r, g, b = unpack(Details.class_colors[class])
|
||||
return class, left, right, top, bottom, r or 1, g or 1, b or 1, 1
|
||||
if (unitClass) then
|
||||
local left, right, top, bottom = unpack(Details.class_coords[unitClass])
|
||||
local r, g, b = unpack(Details.class_colors[unitClass])
|
||||
return unitClass, left, right, top, bottom, r or 1, g or 1, b or 1, 1
|
||||
else
|
||||
local overallCombatObject = Details:GetCombat(DETAILS_SEGMENTID_OVERALL)
|
||||
for containerId = 1, DETAILS_COMBAT_AMOUNT_CONTAINERS do
|
||||
@@ -116,12 +116,12 @@ do
|
||||
local actorObject = actorContainer:GetActor(actorName)
|
||||
|
||||
if (actorObject) then
|
||||
class = actorObject:Class()
|
||||
if (class) then
|
||||
unitClass = actorObject:Class()
|
||||
if (unitClass) then
|
||||
--found the class of the actor
|
||||
local left, right, top, bottom = unpack(Details.class_coords[class] or CONST_UNKNOWN_CLASS_COORDS)
|
||||
local r, g, b = unpack(Details.class_colors[class])
|
||||
return class, left, right, top, bottom, r or 1, g or 1, b or 1, 1
|
||||
local left, right, top, bottom = unpack(Details.class_coords[unitClass] or CONST_UNKNOWN_CLASS_COORDS)
|
||||
local r, g, b = unpack(Details.class_colors[unitClass])
|
||||
return unitClass, left, right, top, bottom, r or 1, g or 1, b or 1, 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user