Skip to content

Commit

Permalink
Changing player detection by GUID
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 30, 2024
1 parent 31d1508 commit d4efd5a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5725,6 +5725,10 @@ function _G.__benchmark(bNotPrintResult)
end
end

function DF:DebugTexture(texture, left, right, top, bottom)
return DF:PreviewTexture(texture, left, right, top, bottom)
end

function DF:PreviewTexture(texture, left, right, top, bottom)
if (texture and type(texture) == "table" and texture.GetObjectType and texture:GetObjectType() == "Texture") then
DF:Msg("PreviewTexture: you have passed a texture object (uiobject) instead of the texture atlas, filename or id.")
Expand Down
10 changes: 5 additions & 5 deletions classes/container_actors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Details222.Pets.AkaarisSoulOwner(petGUID)
do
local ownerGUID = tooltipData.guid --tooltipData.guid seems to exists on all akari soul tooltips and point to the owner guid
if (ownerGUID) then
if (ownerGUID:find("^P")) then
if (ownerGUID:find("^Pl")) then
local playerGUID = ownerGUID
local actorObject = Details:GetActorFromCache(playerGUID) --quick cache only exists during conbat
if (actorObject) then
Expand All @@ -108,7 +108,7 @@ function Details222.Pets.AkaarisSoulOwner(petGUID)
local lineData = tooltipData.lines[i]
if (lineData.unitToken) then --unit token seems to exists when the add belongs to the "player"
local ownerGUID = UnitGUID(lineData.unitToken)
if (ownerGUID and ownerGUID:find("^P")) then
if (ownerGUID and ownerGUID:find("^Pl")) then
local playerGUID = ownerGUID
local actorObject = Details:GetActorFromCache(playerGUID) --quick cache only exists during conbat
if (actorObject) then
Expand Down Expand Up @@ -291,7 +291,7 @@ end
do
local ownerGUID = tooltipData.guid --tooltipData.guid points to the player attributed to this tooltip.
if (ownerGUID) then --If we have an owner GUID, then we should make sure it starts with a P for Player and then attempt to find the owner object from the caches.
if (ownerGUID:find("^P")) then
if (ownerGUID:find("^Pl")) then
local playerGUID = ownerGUID
local actorObject = Details:GetActorFromCache(playerGUID) --quick cache only exists during conbat
if (actorObject) then
Expand Down Expand Up @@ -320,7 +320,7 @@ end
local lineData = tooltipData.lines[i]
if (lineData.unitToken) then --unit token seems to exists when the add belongs to the "player"
local ownerGUID = UnitGUID(lineData.unitToken)
if (ownerGUID and ownerGUID:find("^P")) then
if (ownerGUID and ownerGUID:find("^Pl")) then
local playerGUID = ownerGUID
local actorObject = Details:GetActorFromCache(playerGUID) --quick cache only exists during conbat
if (actorObject) then
Expand Down Expand Up @@ -934,7 +934,7 @@ end
end
end

elseif (actorSerial:match("^P")) then
elseif (actorSerial:match("^Pl")) then
newActor.aID = actorSerial:gsub("Player%-", "")

else
Expand Down
14 changes: 10 additions & 4 deletions functions/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,25 @@ local packActorSerial = function(actor)
local npcId = tonumber(select(6, strsplit("-", serial)) or 0)
return "C" .. npcId

elseif (serial:match("^P") == "P") then
return "P"

elseif (serial:match("^Pl") == "Pl") then
return "Pl"

elseif (serial:match("^Pe") == "Pe") then
return "Pe"

elseif (serial == "") then
return "C12345"
end
end

local unpackActorSerial = function(serialNumber)
--player serial
if (serialNumber:match("^P")) then
if (serialNumber:match("^Pl")) then
return "Player-1-" .. Details.packFunctions.GenerateSerialNumber()

elseif (serialNumber:match("^Pe")) then
return "Pet-0-0-0-0-" .. serialNumber:gsub("Pe", "") .."-" .. Details.packFunctions.GenerateSerialNumber()

elseif (serialNumber:match("^C")) then
return "Creature-0-0-0-0-" .. serialNumber:gsub("C", "") .."-" .. Details.packFunctions.GenerateSerialNumber()
end
Expand Down

0 comments on commit d4efd5a

Please sign in to comment.