mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-15 09:40:49 +00:00
tracking: PlayerIsDruidInCatForm via GetShapeshiftFormID
The byte-2-of-UNIT_BYTES_1 extraction this function did manually (math.floor(b/65536) - math.floor(b/16777216)*256 on the GetUnitField return) is precisely what GetShapeshiftFormID reads under the hood — descriptor +0x212. Collapses to a one-liner that doesn't need to mirror the engine's byte layout in Lua.
This commit is contained in:
@@ -200,14 +200,7 @@ pfUI:RegisterModule("tracking", "vanilla", function ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function pfUI.tracking:PlayerIsDruidInCatForm(playerClass)
|
function pfUI.tracking:PlayerIsDruidInCatForm(playerClass)
|
||||||
if playerClass == "DRUID" then
|
return playerClass == "DRUID" and GetShapeshiftFormID() == 1
|
||||||
local b = GetUnitField("player", "bytes1")
|
|
||||||
if b then
|
|
||||||
local form = math.floor(b / 65536) - math.floor(b / 16777216) * 256
|
|
||||||
return form == 1 -- 1 = Cat Form
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function pfUI.tracking:InitMenu()
|
function pfUI.tracking:InitMenu()
|
||||||
|
|||||||
Reference in New Issue
Block a user