Advertisement
shinyain

12313

Jan 3rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. function()
  2. local DistanceToPoint = function(x, y)
  3. local playerX, playerY = UnitPosition('player')
  4. if x and y and playerX and playerY then
  5. local dx = playerX - x
  6. local dy = playerY - y
  7. return (dx * dx + dy * dy) ^ 0.5
  8. end
  9. return nil
  10. end
  11.  
  12. local RotateDisplayToPoint = function(display, pointX, pointY, offset)
  13. if display and pointX and pointY then
  14. local playerX, playerY = UnitPosition('player')
  15. offset = offset or 0
  16. local degrees = math.deg(math.atan2((playerY - pointY), (playerX - pointX)) - GetPlayerFacing()) + offset
  17.  
  18. local DisplayType = function(name)
  19. if WeakAuras then
  20. if WeakAuras.auras and WeakAuras.auras[name] then return 'auras' end
  21. if WeakAuras.regions and WeakAuras.regions[name] then return 'regions' end
  22. end
  23. end
  24. local displayType = DisplayType(display)
  25. if not displayType then return end
  26.  
  27. if displayType == 'auras' then
  28. if WeakAuras
  29. and WeakAuras[displayType]
  30. and WeakAuras[displayType][display]
  31. and WeakAuras[displayType][display][0]
  32. and WeakAuras[displayType][display][0]['region']
  33. and WeakAuras[displayType][display][0]['region']['Rotate']
  34. and type(WeakAuras[displayType][display][0]['region']['Rotate']) == 'function' then
  35. WeakAuras[displayType][display][0]['region']['Rotate'](0, degrees and degrees or 0)
  36. end
  37. elseif displayType == 'regions' then
  38. if WeakAuras
  39. and WeakAuras[displayType]
  40. and WeakAuras[displayType][display]
  41. and WeakAuras[displayType][display]
  42. and WeakAuras[displayType][display]['region']
  43. and WeakAuras[displayType][display]['region']['Rotate']
  44. and type(WeakAuras[displayType][display]['region']['Rotate']) == 'function' then
  45. WeakAuras[displayType][display]['region']['Rotate'](0, degrees and degrees or 0)
  46. end
  47. end
  48. end
  49. end
  50.  
  51. if WA_Tran then
  52. local d = math.floor(DistanceToPoint(WA_Tran.x, WA_Tran.y))
  53. if IsUsableSpell(119996) then
  54. WeakAuras["regions"]["TransDistance"]['region']:Color(1, 1, 1, 1)
  55. else
  56. WeakAuras["regions"]["TransDistance"]['region']:Color(0.8, 0, 0, 1)
  57. end
  58. RotateDisplayToPoint("TransArrow", WA_Tran.x, WA_Tran.y, 180)
  59. return d
  60.  
  61. else
  62. return "??"
  63. end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement