Playerbot: BotGear addon — fix target guid extraction
The UnitGUID parser grabbed the realm/sub field (-(%d+)-%x+$) instead of the low counter, so the request carried the owner's guid (1) and the server resolved the owner, not the bot — FindConnectedPlayer + IsOwner both failed and no GEAR response was ever sent. Parse the LAST '-' group as hex (the character counter), and reset the title hint when no target resolves.
This commit is contained in:
@@ -55,7 +55,11 @@ local function ResolveTarget()
|
||||
if not UnitExists("target") then return nil, nil end
|
||||
local guid = UnitGUID("target")
|
||||
if not guid then return nil, nil end
|
||||
local low = tonumber(string.match(guid, "-(%d+)-%x+$"))
|
||||
-- Player guid format ends with the low counter as hex, e.g.
|
||||
-- "Player-1-00000258" or "Player-0000-00000258" / "Player-0-1-00000258".
|
||||
-- The character counter is the LAST '-' group (hex).
|
||||
local low = tonumber(string.match(guid, "%-([%x]+)$"), 16)
|
||||
if not low or low == 0 then return nil, nil end
|
||||
return low, UnitName("target")
|
||||
end
|
||||
|
||||
@@ -301,6 +305,10 @@ local function RefreshTarget()
|
||||
modelActor:SetUnit("target")
|
||||
end
|
||||
RefreshAll()
|
||||
else
|
||||
if frame and frame.title then
|
||||
frame.title:SetText("Bot - /target a bot")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user