From 3b2ba40b29f69a219ead741ebe35e358cc0a9488 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 8 Nov 2023 19:01:26 -0300 Subject: [PATCH] API 2.0 now uses Details:GetFullName(unitId) to retrieve a unit name --- boot.lua | 4 ++-- functions/api2.lua | 16 +++++----------- functions/classes.lua | 3 +++ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/boot.lua b/boot.lua index 359f0bbf..cac7fdc1 100644 --- a/boot.lua +++ b/boot.lua @@ -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 diff --git a/functions/api2.lua b/functions/api2.lua index cb5608d9..edcf1d39 100644 --- a/functions/api2.lua +++ b/functions/api2.lua @@ -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 diff --git a/functions/classes.lua b/functions/classes.lua index 0c9f2804..0be5b42e 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -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