Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Copyright (c) 2010, Nils Ruesch
- All rights reserved.
- xPriest
- 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
- ]]
- local _, class = UnitClass("player")
- local lastUpdate = 0;
- local Spells = {};
- local L = {
- -- Shadowpriest
- ["Seuche"] = GetSpellInfo( 2944), -- Verschlingende Seuche
- ["Vampir"] = GetSpellInfo(34914), -- Vampirberührung
- ["Schmerz"] = GetSpellInfo( 589), -- Schattenwort: Schmerz
- ["SWT"] = GetSpellInfo(32379), -- Schattenwort: Tod
- ["Blast"] = GetSpellInfo( 8092), -- Gedankenschlag
- };
- -- Shadowpriest
- local SWT = L["SWT"];
- local Seuche = L["Seuche"];
- local Vampir = L["Vampir"];
- local Schmerz = L["Schmerz"];
- local Blast = L["Blast"];
- local mod = CreateFrame("Frame", nil, UIParent);
- mod:RegisterEvent("ACTIONBAR_HIDEGRID");
- mod:Hide();
- function mod:GetActionName(button)
- local action;
- if ( type(button) == "number" ) then
- action = button;
- else
- action = button.action;
- end
- if ( not action ) then
- return false;
- end
- local type, id = GetActionInfo(action);
- if ( (type == "spell" or type == "macro") and id ~= 0 ) then
- local spellName;
- if ( type == "spell" ) then
- spellName = GetSpellInfo(id);
- elseif ( type == "macro" ) then
- spellName = GetMacroSpell(id);
- end
- if ( spellName ) then
- return spellName;
- else
- return false;
- end
- else
- return false;
- end
- end
- function mod:PLAYER_REGEN_DISABLED()
- self:UnregisterEvent("PLAYER_REGEN_DISABLED");
- self:RegisterEvent("PLAYER_REGEN_ENABLED");
- self:Show();
- end
- function mod:PLAYER_REGEN_ENABLED()
- self:UnregisterEvent("PLAYER_REGEN_ENABLED");
- self:RegisterEvent("PLAYER_REGEN_DISABLED");
- for _, button in next, Spells do
- ActionButton_HideOverlayGlow(button);
- end
- self:Hide();
- end
- function mod:ACTIONBAR_HIDEGRID()
- for _, button in pairs({"ActionButton", "MultiBarLeftButton", "MultiBarRightButton", "MultiBarBottomLeftButton", "MultiBarBottomRightButton", "BonusActionButton"}) do
- for i=1,12 do
- local spellName = self:GetActionName(_G[button..i]);
- if ( spellName and ( spellName == Seuche or spellName == SWT or spellName == Schmerz or spellName == Vampir or spellName == Blast) ) then
- Spells[spellName] = _G[button..i];
- end
- end
- end
- end
- function mod:PLAYER_ENTERING_WORLD()
- self:UnregisterEvent("PLAYER_ENTERING_WORLD");
- self:RegisterEvent("ACTIONBAR_HIDEGRID");
- self:RegisterEvent("PLAYER_REGEN_DISABLED");
- self:ACTIONBAR_HIDEGRID();
- end
- local function OnUpdate(self, elpased)
- lastUpdate = lastUpdate+elpased;
- local perc = UnitHealth("target")/UnitHealthMax("target");
- if ( lastUpdate > 0.5 ) then
- if ( UnitExists("target") and UnitCanAttack("player", "target") ) then
- if ( class == "PRIEST" ) then
- -- Schattenwort: Schmerz
- local name, _, _, _, _, _, expirationTime = UnitAura("target", Schmerz, "", "HARMFUL|PLAYER");
- if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
- ActionButton_ShowOverlayGlow(Spells[Schmerz]);
- else
- ActionButton_HideOverlayGlow(Spells[Schmerz]);
- end
- -- Verschlingende Seuche
- local name, _, _, _, _, _, expirationTime = UnitAura("target", Seuche, "", "HARMFUL|PLAYER");
- if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
- ActionButton_ShowOverlayGlow(Spells[Seuche]);
- else
- ActionButton_HideOverlayGlow(Spells[Schmerz or Seuche or Vampir]);
- end
- -- Vampirberührung
- local name, _, _, _, _, _, expirationTime = UnitAura("target", Vampir, "", "HARMFUL|PLAYER");
- if ( (name and expirationTime and expirationTime-GetTime() < 4) ) then
- ActionButton_ShowOverlayGlow(Spells[Vampir]);
- else
- ActionButton_HideOverlayGlow(Spells[Vampir]);
- end
- end;
- else
- for _, button in next, Spells do
- ActionButton_HideOverlayGlow(button);
- end
- end
- lastUpdate = 0;
- end
- end
- local function OnEvent(self, event, ...)
- if ( self[event] ) then
- return self[event](self, ...);
- end
- print("xPriest [Fehler]:", event, "nicht gefunden!");
- end
- mod:RegisterEvent("PLAYER_ENTERING_WORLD");
- mod:SetScript("OnEvent", OnEvent);
- mod:SetScript("OnUpdate", OnUpdate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement