Advertisement
Guest User

CursorGlow.lua

a guest
Oct 17th, 2010
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. function CursorGlow_OnLoad()
  2. CursorGlowGlow:SetAlpha(0.5);
  3. CursorGlowGlow:SetVertexColor(0.7,0.7,1);
  4. this:SetAlpha(0);
  5. this.lastX = 0;
  6. this.lastY = 0;
  7. this.angle = 0;
  8. end
  9.  
  10. local origSetCursor = SetCursor;
  11. function SetCursor(cursor)
  12. if ( cursor == "CAST_CURSOR" ) then
  13. CursorGlowFrame.nofade = 1;
  14. else
  15. CursorGlowFrame.nofade = nil;
  16. end
  17. return origSetCursor(cursor);
  18. end
  19.  
  20. local origResetCursor = ResetCursor;
  21. function ResetCursor()
  22. CursorGlowFrame.nofade = nil;
  23. return origResetCursor();
  24. end
  25.  
  26. function CursorGlow_OnUpdate(elapsed)
  27. local curX, curY = GetCursorPosition();
  28. if ( curX ~= this.lastX or curY ~= this.lastY ) then
  29. local scale = UIParent:GetScale();
  30. this:SetPoint("CENTER", "UIParent", "BOTTOMLEFT", curX/scale, curY/scale );
  31. this.fade = nil;
  32. elseif ( not this.fade ) then
  33. this.fade = 1.5;
  34. end
  35. CursorGlowGlow:Hide();
  36. local r,g,b = 0.5,0.5,0.5;
  37. if ( SpellIsTargeting() ) then
  38. CursorGlowGlow:Show();
  39. CursorGlowTexture:SetTexture("Spells\\AuraRune8");
  40. if ( SpellCanTargetUnit("mouseover") or this.nofade ) then
  41. CursorGlowGlow:SetAlpha(0.5);
  42. r,g,b=0.3,0.3,1;
  43. else
  44. CursorGlowGlow:SetAlpha(0.15);
  45. r,g,b=0.8,0.8,0.8;
  46. end
  47. this.fade = nil;
  48. else
  49. CursorGlowTexture:SetTexture("Spells\\AuraRune256");
  50. if ( UnitIsEnemy("player","mouseover") ) then
  51. r,g,b=0.5,0,0;
  52. elseif ( UnitIsFriend("player","mouseover") ) then
  53. r,g,b=0.25,0.75,0.25;
  54. end
  55. if ( IsControlKeyDown() ) then
  56. r,g,b=r*2,g*2,b*2;
  57. this.fade = nil;
  58. end
  59. end
  60. CursorGlowTexture:SetVertexColor(r,g,b);
  61. if ( this.fade and not this.nofade ) then
  62. this.fade = this.fade - elapsed;
  63. if ( this.fade > 0 ) then
  64. this:SetAlpha(1 * min((this.fade/1),1));
  65. else
  66. this:SetAlpha(0);
  67. end
  68. else
  69. this:SetAlpha(1);
  70. end
  71. this.lastX = curX;
  72. this.lastY = curY;
  73.  
  74. -- Iriel's spinny code
  75. this.angle = this.angle + (arg1 / 30);
  76. local a = math.deg(this.angle - 45);
  77.  
  78. local l = 1;
  79.  
  80. local s = math.sin(a) * 0.75;
  81. local c = math.cos(a) * 0.75;
  82.  
  83. local f = CursorGlowTexture;
  84.  
  85. f:SetTexCoord(0.5-s, 0.5+c,
  86. 0.5+c, 0.5+s,
  87. 0.5-c, 0.5-s,
  88. 0.5+s, 0.5-c);
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement