Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function()
- local DistanceToPoint = function(x, y)
- local playerX, playerY = UnitPosition('player')
- if x and y and playerX and playerY then
- local dx = playerX - x
- local dy = playerY - y
- return (dx * dx + dy * dy) ^ 0.5
- end
- return nil
- end
- local RotateDisplayToPoint = function(display, pointX, pointY, offset)
- if display and pointX and pointY then
- local playerX, playerY = UnitPosition('player')
- offset = offset or 0
- local degrees = math.deg(math.atan2((playerY - pointY), (playerX - pointX)) - GetPlayerFacing()) + offset
- local DisplayType = function(name)
- if WeakAuras then
- if WeakAuras.auras and WeakAuras.auras[name] then return 'auras' end
- if WeakAuras.regions and WeakAuras.regions[name] then return 'regions' end
- end
- end
- local displayType = DisplayType(display)
- if not displayType then return end
- if displayType == 'auras' then
- if WeakAuras
- and WeakAuras[displayType]
- and WeakAuras[displayType][display]
- and WeakAuras[displayType][display][0]
- and WeakAuras[displayType][display][0]['region']
- and WeakAuras[displayType][display][0]['region']['Rotate']
- and type(WeakAuras[displayType][display][0]['region']['Rotate']) == 'function' then
- WeakAuras[displayType][display][0]['region']['Rotate'](0, degrees and degrees or 0)
- end
- elseif displayType == 'regions' then
- if WeakAuras
- and WeakAuras[displayType]
- and WeakAuras[displayType][display]
- and WeakAuras[displayType][display]
- and WeakAuras[displayType][display]['region']
- and WeakAuras[displayType][display]['region']['Rotate']
- and type(WeakAuras[displayType][display]['region']['Rotate']) == 'function' then
- WeakAuras[displayType][display]['region']['Rotate'](0, degrees and degrees or 0)
- end
- end
- end
- end
- if WA_Tran then
- local d = math.floor(DistanceToPoint(WA_Tran.x, WA_Tran.y))
- if IsUsableSpell(119996) then
- WeakAuras["regions"]["TransDistance"]['region']:Color(1, 1, 1, 1)
- else
- WeakAuras["regions"]["TransDistance"]['region']:Color(0.8, 0, 0, 1)
- end
- RotateDisplayToPoint("TransArrow", WA_Tran.x, WA_Tran.y, 180)
- return d
- else
- return "??"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement