API 2.0 now uses Details:GetFullName(unitId) to retrieve a unit name

This commit is contained in:
Tercio Jose
2023-11-08 19:01:26 -03:00
parent dd13aff961
commit 3b2ba40b29
3 changed files with 10 additions and 13 deletions
+5 -11
View File
@@ -33,16 +33,8 @@ local getActorObjectFromCombat = function(combatObject, containerID, actorName)
end
local getUnitName = function(unitId)
local unitName, serverName = UnitName (unitId)
if (unitName) then
if (serverName and serverName ~= "") then
return unitName .. "-" .. serverName
else
return unitName
end
else
return unitId
end
local unitName = Details:GetFullName(unitId) or unitId
return unitName
end
--return the spell object and the spellId
@@ -652,12 +644,14 @@ function Details.UnitDamage (unitId, segment)
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
--/dump Details.UnitDamage("player")
return floor(playerObject.total or 0)
end