Skip to content

Commit

Permalink
Update on Details.UnitInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jul 12, 2021
1 parent caf27f4 commit 7fd57e2
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions functions/api2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,21 @@ function Details.UnitInfo (unitId, segment)
return unitInfo
end

unitInfo.class = playerObject.classe or "UNKNOW"
unitInfo.spec = playerObject.spec or 0
unitInfo.guid = playerObject.serial or ""
unitInfo.role = playerObject.role or "NONE"
local specCache = Details.cached_specs
local unitSerial = UnitGUID(unitId)
local _, class = UnitClass(unitId)

local playerInfo = {}

local raidStatusLib = LibStub:GetLibrary("LibRaidStatus-1.0")
if (raidStatusLib) then
playerInfo = raidStatusLib.playerInfoManager.GetPlayerInfo(unitName)
end

unitInfo.class = playerObject.classe or class or "UNKNOW"
unitInfo.spec = playerObject.spec or specCache[unitSerial] or playerInfo.spec or 0
unitInfo.guid = playerObject.serial or unitSerial or ""
unitInfo.role = playerObject.role or Details.cached_roles[unitSerial] or "NONE"
unitInfo.isPlayer = playerObject:IsPlayer()
unitInfo.isEnemy = playerObject:IsEnemy()
unitInfo.isPet = playerObject:IsPetOrGuardian()
Expand Down

0 comments on commit 7fd57e2

Please sign in to comment.