vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local BS_PlayerName = nil;
2 local BS_default = 0;
3  
4 function BS_OnLoad()
5 this:RegisterEvent("PLAYER_AURAS_CHANGED");
6 this:RegisterEvent("VARIABLES_LOADED");
7 DEFAULT_CHAT_FRAME:AddMessage("Block Salvation, by Badger", 1, 1, 0.5);
8 SLASH_BS1 = "/BS";
9 SlashCmdList["BS"] = function(msg)
10 BS_SlashCommand(msg);
11 end
12 end
13  
14 function BS_Init()
15 BS_PlayerName = UnitName("player").." of "..GetCVar("realmName");
16  
17 if (BS_CONFIG == nil) then
18 BS_CONFIG = {};
19 end
20  
21 if (BS_CONFIG[BS_PlayerName] == nill) then
22 BS_CONFIG[BS_PlayerName] = BS_default;
23 end
24 end
25  
26 function BS_OnEvent()
27  
28 if (event == "PLAYER_AURAS_CHANGED") then
29 BS_Kill();
30 elseif (event == "VARIABLES_LOADED") then
31 BS_Init();
32 end
33  
34 end
35  
36 function BS_SlashCommand(msg)
37 local BS_Status = "Off";
38 if(msg == "on") then
39 BS_on();
40 elseif (msg == "off") then
41 BS_off()
42 else
43 if ( DEFAULT_CHAT_FRAME ) then
44 if (BS_CONFIG[BS_PlayerName] == 1) then
45 BS_Status = "On";
46 end
47 DEFAULT_CHAT_FRAME:AddMessage("Block Salvation, by Badger (EU Aggramar), ", 1, 1, 0.5);
48 DEFAULT_CHAT_FRAME:AddMessage("Status: "..BS_Status, 1, 1, 0.5);
49 DEFAULT_CHAT_FRAME:AddMessage("Use: /bs on/off", 1, 1, 0.5);
50 end
51 end
52 end
53  
54 function BS_on()
55 BS_CONFIG[BS_PlayerName] = 1;
56 if ( DEFAULT_CHAT_FRAME ) then
57 DEFAULT_CHAT_FRAME:AddMessage("BS: Salvation will now be cancelled.", 1, 1, 0.5);
58 end
59 end
60  
61 function BS_off()
62 BS_CONFIG[BS_PlayerName] = 0;
63 if ( DEFAULT_CHAT_FRAME ) then
64 DEFAULT_CHAT_FRAME:AddMessage("BS: Salvation will no longer be cancelled.", 1, 1, 0.5);
65 end
66 end
67  
68 function BS_Kill()
69 if (BS_CONFIG[BS_PlayerName] == 0) then
70 return false;
71 end
72  
73 local i = 0;
74 while not (GetPlayerBuff(i,"HELPFUL") == -1) do
75 local buffIndex, untilCancelled = GetPlayerBuff(i,"HELPFUL")
76 local texture = GetPlayerBuffTexture(buffIndex);
77  
78 if ((string.find(texture,"SealOfSalvation")) or (string.find(texture,"GreaterBlessingofSalvation"))) then
79 CancelPlayerBuff(i);
80 DEFAULT_CHAT_FRAME:AddMessage("BS: Salvation Blocked.", 1, 1, 0.5);
81 return true;
82 end
83 i = i + 1;
84 end
85 end