Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.50 KB | None | 0 0
  1. --[[
  2.    
  3.     Copyright (c) 2010, Nils Ruesch
  4.     All rights reserved.
  5.     xPriest
  6.    
  7.     A B C D E F G H I J K L N M O P Q R S T U V W X Y Z
  8.    
  9. ]]
  10.  
  11. local _, class = UnitClass("player")
  12.  
  13. local lastUpdate = 0;
  14. local Spells = {};
  15. local L = {
  16. -- Shadowpriest
  17.     ["Seuche"]  = GetSpellInfo( 2944),  -- Verschlingende Seuche
  18.     ["Vampir"]  = GetSpellInfo(34914),  -- Vampirberührung
  19.     ["Schmerz"] = GetSpellInfo(  589),  -- Schattenwort: Schmerz
  20.     ["SWT"]     = GetSpellInfo(32379),  -- Schattenwort: Tod
  21.     ["Blast"]   = GetSpellInfo( 8092),  -- Gedankenschlag
  22. };
  23.  
  24. -- Shadowpriest
  25. local SWT       = L["SWT"];
  26. local Seuche    = L["Seuche"];
  27. local Vampir    = L["Vampir"];
  28. local Schmerz   = L["Schmerz"];
  29. local Blast     = L["Blast"];
  30.  
  31. local mod = CreateFrame("Frame", nil, UIParent);
  32. mod:RegisterEvent("ACTIONBAR_HIDEGRID");
  33. mod:Hide();
  34.  
  35. function mod:GetActionName(button)
  36.     local action;
  37.     if ( type(button) == "number" ) then
  38.         action = button;
  39.     else
  40.         action = button.action;
  41.     end
  42.    
  43.     if ( not action ) then
  44.         return false;
  45.     end
  46.    
  47.     local type, id = GetActionInfo(action);
  48.     if ( (type == "spell" or type == "macro") and id ~= 0 ) then
  49.         local spellName;
  50.         if ( type == "spell" ) then
  51.             spellName = GetSpellInfo(id);
  52.         elseif ( type == "macro" ) then
  53.             spellName = GetMacroSpell(id);
  54.         end
  55.         if ( spellName ) then
  56.             return spellName;
  57.         else
  58.             return false;
  59.         end
  60.     else
  61.         return false;
  62.     end
  63. end
  64.  
  65. function mod:PLAYER_REGEN_DISABLED()
  66.     self:UnregisterEvent("PLAYER_REGEN_DISABLED");
  67.     self:RegisterEvent("PLAYER_REGEN_ENABLED");
  68.    
  69.     self:Show();
  70. end
  71.  
  72. function mod:PLAYER_REGEN_ENABLED()
  73.     self:UnregisterEvent("PLAYER_REGEN_ENABLED");
  74.     self:RegisterEvent("PLAYER_REGEN_DISABLED");
  75.    
  76.     for _, button in next, Spells do
  77.         ActionButton_HideOverlayGlow(button);
  78.     end
  79.    
  80.     self:Hide();
  81. end
  82.  
  83. function mod:ACTIONBAR_HIDEGRID()
  84.     for _, button in pairs({"ActionButton", "MultiBarLeftButton", "MultiBarRightButton", "MultiBarBottomLeftButton", "MultiBarBottomRightButton", "BonusActionButton"}) do
  85.         for i=1,12 do
  86.             local spellName = self:GetActionName(_G[button..i]);
  87.             if ( spellName and ( spellName == Seuche or spellName == SWT or spellName == Schmerz or spellName == Vampir or spellName == Blast)  ) then
  88.                 Spells[spellName] = _G[button..i];
  89.             end
  90.         end
  91.     end
  92. end
  93.  
  94. function mod:PLAYER_ENTERING_WORLD()
  95.     self:UnregisterEvent("PLAYER_ENTERING_WORLD");
  96.     self:RegisterEvent("ACTIONBAR_HIDEGRID");
  97.     self:RegisterEvent("PLAYER_REGEN_DISABLED");
  98.    
  99.     self:ACTIONBAR_HIDEGRID();
  100. end
  101.  
  102. local function OnUpdate(self, elpased)
  103.     lastUpdate = lastUpdate+elpased;
  104.     local perc = UnitHealth("target")/UnitHealthMax("target");
  105.     if ( lastUpdate > 0.5 ) then
  106.         if ( UnitExists("target") and UnitCanAttack("player", "target") ) then
  107.             if ( class == "PRIEST" ) then
  108.            
  109.                 -- Schattenwort: Schmerz
  110.                 local name, _, _, _, _, _, expirationTime = UnitAura("target", Schmerz, "", "HARMFUL|PLAYER");
  111.                 if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
  112.                     ActionButton_ShowOverlayGlow(Spells[Schmerz]);
  113.                 else
  114.                     ActionButton_HideOverlayGlow(Spells[Schmerz]);
  115.                 end
  116.                
  117.                 -- Verschlingende Seuche
  118.                 local name, _, _, _, _, _, expirationTime = UnitAura("target", Seuche, "", "HARMFUL|PLAYER");
  119.                 if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
  120.                     ActionButton_ShowOverlayGlow(Spells[Seuche]);
  121.                 else
  122.                     ActionButton_HideOverlayGlow(Spells[Schmerz or Seuche or Vampir]);
  123.                 end
  124.                
  125.                 -- Vampirberührung
  126.                 local name, _, _, _, _, _, expirationTime = UnitAura("target", Vampir, "", "HARMFUL|PLAYER");
  127.                 if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
  128.                     ActionButton_ShowOverlayGlow(Spells[Vampir]);
  129.                 else
  130.                     ActionButton_HideOverlayGlow(Spells[Vampir]);
  131.                 end
  132.                
  133.             end;
  134.         else
  135.             for _, button in next, Spells do
  136.                 ActionButton_HideOverlayGlow(button);
  137.             end
  138.         end
  139.         lastUpdate = 0;
  140.     end
  141. end
  142.  
  143. local function OnEvent(self, event, ...)
  144.     if ( self[event] ) then
  145.         return self[event](self, ...);
  146.     end
  147.     print("xPriest [Fehler]:", event, "nicht gefunden!");
  148. end
  149.  
  150. mod:RegisterEvent("PLAYER_ENTERING_WORLD");
  151. mod:SetScript("OnEvent", OnEvent);
  152. mod:SetScript("OnUpdate", OnUpdate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement