Skip to content

Commit

Permalink
API 2.0 now uses Details:GetFullName(unitId) to retrieve a unit name
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Nov 8, 2023
1 parent dd13aff commit 3b2ba40
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()

Details.build_counter = 12024
Details.alpha_build_counter = 12024 --if this is higher than the regular counter, use it instead
Details.build_counter = 12025
Details.alpha_build_counter = 12025 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
Expand Down
16 changes: 5 additions & 11 deletions functions/api2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions functions/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ do
end

function Details:GetFullName(unitId)
--playerName, realmName = UnitFullName(unitId) --realm name already has spaces removed
--return playerName .. "-" .. realmName

local playerName, realmName = UnitName(unitId)

if (not realmName) then
Expand Down

0 comments on commit 3b2ba40

Please sign in to comment.