Files
wow-weakauras/NewAge/DHRogueSniffer/sniffer.lua

44 lines
1.2 KiB
Lua

-- PLAYER_TARGET_CHANGED
function(e)
local hasEyes = UnitBuff("player", "Spectral Sight") -- Spectral Sight
if not hasEyes then
--print("Player has no Spectral Sight")
return
end
local unitUuid = UnitGUID("target")
if not unitUuid then
--print(string.format("Target has no UUID: %s", tostring(unitUuid)))
return
end
--print(string.format("Target UUID: %s", tostring(unitUuid)))
if not string.find(unitUuid, "Player") then
--print(string.format("Target %s is not a player", tostring(unitUuid)))
return
end
local targetStealth = UnitBuff("target", "Stealth")
if not targetStealth then
--print("Target has no Stealth")
return
end
--print(string.format("Target Stealth: %s", tostring(targetStealth)))
local targetName = UnitName("target")
if not targetName then
--print("Target has no name")
return
end
--print(string.format("Target Name: %s", tostring(targetName)))
local pvp = UnitIsPVP("target")
local pvpState = pvp == true and "ON" or "OFF"
local low, high = WeakAuras.GetRange("target")
local message = string.format("I see %s in stealth with pvp %s between %d and %d yards away", targetName, pvpState, low, high)
--print(string.format("Sending message: %s", tostring(message)))
SendChatMessage(message, "RAID")
end