vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 SPAMIAM_FILTERS = {
2 ERR_ABILITY_COOLDOWN, -- Ability is not ready yet. (Ability)
3 ERR_SPELL_COOLDOWN, -- Spell is not ready yet. (Spell)
4 ERR_OUT_OF_ENERGY, -- Not enough energy. (Err)
5 OUT_OF_ENERGY, -- Not enough energy.
6 ERR_OUT_OF_RAGE, -- Not enough rage.
7 ERR_NO_ATTACK_TARGET, -- There is nothing to attack.
8 SPELL_FAILED_NO_COMBO_POINTS, -- That ability requires combo points.
9 SPELL_FAILED_TARGETS_DEAD, -- Your target is dead.
10 SPELL_FAILED_SPELL_IN_PROGRESS, -- Another action is in progress. (Spell)
11 SPELL_FAILED_TARGET_AURASTATE, -- You can't do that yet. (TargetAura)
12 SPELL_FAILED_CASTER_AURASTATE, -- You can't do that yet. (CasterAura)
13 };
14 SPAMIAM_SPAMIAM = "SpamIam";
15 SPAMIAM_INIT1 = "SpamIam ";
16 SPAMIAM_V = "v";
17 SPAMIAM_INIT2 = " loaded. Type /SpamIam or /sia for options.";
18 SPAMIAM_STATUS1 = "[SpamIam is currently ";
19 SPAMIAM_STATUS2 = "]";
20 SPAMIAM_ENABLED = "enabled";
21 SPAMIAM_DISABLED = "disabled";
22 SPAMIAM_HELP = "help";
23 SPAMIAM_USAGE1 = "Type /SpamIam or /sia followed by one of the following commands:";
24 SPAMIAM_USAGE2 = " enable - Enables SpamIam";
25 SPAMIAM_USAGE3 = " disable - Disables SpamIam";
26 SPAMIAM_USAGE4 = " toggle - Toggles SpamIam on/off";
27 SPAMIAM_USAGE5 = " list - Shows the current filters and their ID number";
28 SPAMIAM_USAGE6 = " add [message] - Adds [message] to the filter list";
29 SPAMIAM_USAGE7 = " remove [id] - Removes the message [id] from the filter list";
30 SPAMIAM_USAGE8 = " speechoff - Disables Error Speech";
31 SPAMIAM_USAGE9 = " speechon - Enables Error Speech";
32 SPAMIAM_ENABLE = "enable";
33 SPAMIAM_DISABLE = "disable";
34 SPAMIAM_FILTERSCMD = "list";
35 SPAMIAM_ADD = "add";
36 SPAMIAM_REMOVE = "remove";
37 SPAMIAM_TOGGLE = "toggle";
38 SPAMIAM_SPEECHOFF = "speechoff";
39 SPAMIAM_SPEECHON = "speechon";
40 SPAMIAM_UNKNOWNCOMMAND = "SpamIam: Unknown command. Type /SpamIam or /sia for help.";
41 SPAMIAM_SPEECHTEXT1 = "SpamIam: Error Speech Disabled.";
42 SPAMIAM_SPEECHTEXT2 = "SpamIam: Error Speech Enabled.";
43 SPAMIAM_CURRENTFILTERS = "Current SpamIam filters:";
44 SPAMIAM_SLASHCOMMAND1 = "/spamiam";
45 SPAMIAM_SLASHCOMMAND2 = "/sia";
46 SPAMIAM_ADDUSAGE1 = "Usage: /SpamIam add [msg]";
47 SPAMIAM_ADDUSAGE2 = "Example: /SpamIam add Hello, world!";
48 SPAMIAM_ADDEDFILTER = "SpamIam added filter: ";
49 SPAMIAM_REMOVEUSAGE1 = "Usage: /SpamIam remove [id]";
50 SPAMIAM_REMOVEUSAGE2 = "Example: /SpamIam remove 2";
51 SPAMIAM_REMOVEUSAGE3 = "Use /SpamIam list to see the ID's of every filter";
52 SPAMIAM_FILTERNOTFOUND = "SpamIam: filter not found";
53 SPAMIAM_REMOVEDFILTER = "Removed filter ";
54 SPAMIAM_Version = "0.1";
55 SPAMIAM_Enabled = 1;
56 SI_NameRegistered = 0;
57 function SI_BCC(r, g, b)
58 return string.format("|cff%02x%02x%02x", (r*255), (g*255), (b*255));
59 end
60 local SIC = SI_BCC(1, .6, .2);
61 local SIW = SI_BCC(1, 1, 1);
62 function SI_Print(msg)
63 if (DEFAULT_CHAT_FRAME) then
64 DEFAULT_CHAT_FRAME:AddMessage(msg);
65 end
66 end
67 function SPAMIAM_OnLoad()
68 this:RegisterEvent("UNIT_NAME_UPDATE");
69 this:RegisterEvent("PLAYER_ENTERING_WORLD");
70 SlashCmdList["SPAMIAMCOMMAND"] = Spamiam_SlashHandler;
71 SLASH_SPAMIAMCOMMAND1 = SPAMIAM_SLASHCOMMAND1;
72 SLASH_SPAMIAMCOMMAND2 = SPAMIAM_SLASHCOMMAND2;
73 SI_Old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent;
74 UIErrorsFrame_OnEvent = SI_New_UIErrorsFrame_OnEvent;
75 end
76 function SPAMIAM_Localize()
77 if (GetLocale() == "frFR") then
78 SPAMIAM_SPAMIAM = "SpamIam";
79 SPAMIAM_INIT1 = "SpamIam ";
80 SPAMIAM_V = "v";
81 SPAMIAM_INIT2 = " charg\195\169. Ecrivez /SpamIam ou /sia pour options.";
82 SPAMIAM_STATUS1 = "[SpamIam est actuellemnt ";
83 SPAMIAM_STATUS2 = "]";
84 SPAMIAM_ENABLED = "activ\195\169";
85 SPAMIAM_DISABLED = "d\195\169sactiv\195\169";
86 SPAMIAM_HELP = "aide";
87 SPAMIAM_USAGE1 = "Ecrivez /SpamIam ou /sia suivit d'une des commandes suivantes :";
88 SPAMIAM_USAGE2 = " activer - Active SpamIam";
89 SPAMIAM_USAGE3 = " d\195\169sactiver - D\195\169sactive SpamIam";
90 SPAMIAM_USAGE4 = " basculer - Basculer SpamIam en Activ\195\169/D\195\169sactiv\195\169";
91 SPAMIAM_USAGE5 = " liste - Affiche les filtres actuels et leur num\195\169ro d'ID ";
92 SPAMIAM_USAGE6 = " ajouter [message] - Ajoute [message] \195\160 la liste des filtres";
93 SPAMIAM_USAGE7 = " enlever [id] - Enl\195\168ve l'[id] du message de la liste des filtres";
94 SPAMIAM_USAGE8 = " La Parole D'Erreur De Debronchements";
95 SPAMIAM_USAGE9 = " Permet La Parole D'Erreur";
96 SPAMIAM_ENABLE = "activer";
97 SPAMIAM_DISABLE = "d\195\169sactiver";
98 SPAMIAM_FILTERSCMD = "liste";
99 SPAMIAM_ADD = "ajouter";
100 SPAMIAM_REMOVE = "enlever";
101 SPAMIAM_TOGGLE = "basculer";
102 SPAMIAM_SPEECHOFF = "speechoff";
103 SPAMIAM_SPEECHON = "speechon";
104 SPAMIAM_UNKNOWNCOMMAND = "SpamIam : Commande inconnue. Ecrivez /SpamIam ou /sia pour l'aide.";
105 SPAMIAM_SPEECHTEXT1 = "SpamIam: Discours D'Erreur Neutralise.";
106 SPAMIAM_SPEECHTEXT2 = "SpamIam: Discours D'Erreur Permis.";
107 SPAMIAM_CURRENTFILTERS = "Filtres actuels de SpamIam:";
108 SPAMIAM_SLASHCOMMAND1 = "/spamiam";
109 SPAMIAM_SLASHCOMMAND2 = "/sia";
110 SPAMIAM_ADDUSAGE1 = "Utilisation : /SpamIam ajouter [msg]";
111 SPAMIAM_ADDUSAGE2 = "Exemple : /SpamIam ajouter Bonjour tout le monde !";
112 SPAMIAM_ADDEDFILTER = "SpamIam ajoute le filtre : ";
113 SPAMIAM_REMOVEUSAGE1 = "Utilisation : /SpamIam enl\195\168ve l'[id]";
114 SPAMIAM_REMOVEUSAGE2 = "Exemple : /SpamIam enl\195\168ve 2";
115 SPAMIAM_REMOVEUSAGE3 = "Utiliser /SpamIam liste, pour voir l'ID de tous les filtres";
116 SPAMIAM_FILTERNOTFOUND = "SpamIam : filtre non trouv\195\169";
117 SPAMIAM_REMOVEDFILTER = "Filtre enlev\195\169 ";
118 elseif (GetLocale() == "deDE") then
119 SPAMIAM_INIT1 = "SpamIam ";
120 SPAMIAM_V = "v";
121 SPAMIAM_INIT2 = " geladen. /SpamIam oder /sia zeigt die Optionen an.";
122 SPAMIAM_STATUS1 = "[SpamIam ist ";
123 SPAMIAM_STATUS2 = "]";
124 SPAMIAM_ENABLED = "aktiv";
125 SPAMIAM_DISABLED = "inaktiv";
126 SPAMIAM_HELP = "Hilfe";
127 SPAMIAM_USAGE1 = "/SpamIam oder /sia mit einem der folgenden Befehle eingeben:";
128 SPAMIAM_USAGE2 = " aktivieren - aktiviert SpamIam";
129 SPAMIAM_USAGE3 = " deaktivieren - deaktiviert SpamIam";
130 SPAMIAM_USAGE4 = " toggle - toggelt den Aktivzustand von SpamIam";
131 SPAMIAM_USAGE5 = " liste - zeigt die aktuellen Filter und ihre IDs an";
132 SPAMIAM_USAGE6 = " add [nachricht] - F\195\188gt [message] der Filterliste hinzu";
133 SPAMIAM_USAGE7 = " remove [id] - L\195\182scht die Nachricht [id] von der Filterliste";
134 SPAMIAM_USAGE8 = " Sperrungen Storung Rede";
135 SPAMIAM_USAGE9 = " Ermoglicht Storung Rede";
136 SPAMIAM_ENABLE = "aktivieren";
137 SPAMIAM_DISABLE = "deaktivieren";
138 SPAMIAM_FILTERSCMD = "liste";
139 SPAMIAM_ADD = "add";
140 SPAMIAM_REMOVE = "remove";
141 SPAMIAM_TOGGLE = "toggle";
142 SPAMIAM_SPEECHOFF = "speechoff";
143 SPAMIAM_SPEECHON = "speechon";
144 SPAMIAM_UNKNOWNCOMMAND = "SpamIam: Unbekannter Befehl. /SpamIam oder /sia zeigt die Hilfe an.";
145 SPAMIAM_SPEECHTEXT1 = "SpamIam: Storung Rede Sperrte.";
146 SPAMIAM_SPEECHTEXT2 = "SpamIam: Storung Rede Ermoglicht.";
147 SPAMIAM_CURRENTFILTERS = "Momentane SpamIam-Filter:";
148 SPAMIAM_SLASHCOMMAND1 = "/spamiam";
149 SPAMIAM_SLASHCOMMAND2 = "/sia";
150 SPAMIAM_ADDUSAGE1 = "Benutzung: /SpamIam add [msg]";
151 SPAMIAM_ADDUSAGE2 = "Beispiel: /SpamIam add Hallo!";
152 SPAMIAM_ADDEDFILTER = "SpamIam f\195\188gte folgenden Filter der Liste hinzu: ";
153 SPAMIAM_REMOVEUSAGE1 = "Benutzung: /SpamIam remove [id]";
154 SPAMIAM_REMOVEUSAGE2 = "Beispiel: /SpamIam remove 2";
155 SPAMIAM_REMOVEUSAGE3 = "/SpamIam liste um die IDs der Filter anzeigen";
156 SPAMIAM_FILTERNOTFOUND = "SpamIam: Filter nicht gefunden";
157 SPAMIAM_REMOVEDFILTER = "Filter gel\195\182scht ";
158 end
159 end
160 function SPAMIAM_Toggle()
161 if (SPAMIAM_Enabled == 1) then
162 SPAMIAM_Enabled = 0;
163 else
164 SPAMIAM_Enabled = 1;
165 end
166 SI_PrintStatus();
167 end
168 function SI_Initialize()
169 this:UnregisterEvent("UNIT_NAME_UPDATE");
170 this:UnregisterEvent("PLAYER_ENTERING_WORLD");
171 SPAMIAM_Localize();
172 if(myAddOnsList) then
173 myAddOnsList.SpamIam = {
174 name = "SpamIam",
175 description = "",
176 version = SPAMIAM_Version,
177 frame = "SpamIamFrame",
178 category = MYADDONS_CATEGORY_CLASS
179 };
180 end
181 SI_Print(SIC..SPAMIAM_INIT1..SIW..SPAMIAM_V..SPAMIAM_Version..SIC..SPAMIAM_INIT2);
182 end
183 function SPAMIAM_OnEvent()
184 if (event == "UNIT_NAME_UPDATE" and arg1 == "player") or (event=="PLAYER_ENTERING_WORLD") then
185 if (SI_NameRegistered == 1) then
186 return;
187 end
188 local playerName = UnitName("player");
189 if (playerName ~= UNKNOWNBEING and playerName ~= "Unknown Entity" and playerName ~= nil ) then
190 SI_NameRegistered = 1;
191 SI_Initialize();
192 end
193 end
194 end
195 function SI_PrintStatus()
196 s = SIC..SPAMIAM_STATUS1..SIW;
197 if (SPAMIAM_Enabled == 1) then
198 s = s..SPAMIAM_ENABLED;
199 else
200 s = s..SPAMIAM_DISABLED;
201 end
202 s = s..SIC..SPAMIAM_STATUS2;
203 SI_Print(s);
204 end
205 function Spamiam_SlashHandler(msg, arg1, arg2)
206 local omsg = msg;
207 if (msg) then
208 msg = string.lower(msg);
209 if (msg == "" or msg == SPAMIAM_HELP) then
210 SI_Print(SIC..SPAMIAM_USAGE1);
211 SI_Print(SIC..SPAMIAM_USAGE2);
212 SI_Print(SIC..SPAMIAM_USAGE3);
213 SI_Print(SIC..SPAMIAM_USAGE4);
214 SI_Print(SIC..SPAMIAM_USAGE5);
215 SI_Print(SIC..SPAMIAM_USAGE6);
216 SI_Print(SIC..SPAMIAM_USAGE7);
217 SI_Print(SIC..SPAMIAM_USAGE8);
218 SI_Print(SIC..SPAMIAM_USAGE9);
219 SI_PrintStatus();
220 elseif (msg == SPAMIAM_SPEECHOFF) then
221 SetCVar("EnableErrorSpeech", 0);
222 SI_Print(SPAMIAM_SPEECHTEXT1);
223 elseif (msg == SPAMIAM_SPEECHON) then
224 SetCVar("EnableErrorSpeech", 1);
225 SI_Print(SPAMIAM_SPEECHTEXT2);
226 elseif (msg == SPAMIAM_DISABLE) then
227 SPAMIAM_Enabled = 0;
228 SI_PrintStatus();
229 elseif (msg == SPAMIAM_ENABLE) then
230 SPAMIAM_Enabled = 1;
231 SI_PrintStatus();
232 elseif (msg == SPAMIAM_FILTERSCMD) then
233 SI_Print(SIW..SPAMIAM_CURRENTFILTERS);
234 for key, text in SPAMIAM_FILTERS do
235 SI_Print(SIC.." ["..SIW..key..SIC.."] "..text);
236 end
237 elseif (msg == SPAMIAM_TOGGLE) then
238 SPAMIAM_Toggle();
239 elseif (string.sub(msg, 1, string.len(SPAMIAM_ADD)) == SPAMIAM_ADD) then
240 if (string.sub(msg, 1, (string.len(SPAMIAM_ADD)+1)) ~= (SPAMIAM_ADD.." ")) then
241 SI_Print(SPAMIAM_ADDUSAGE1);
242 SI_Print(SPAMIAM_ADDUSAGE2);
243 else
244 str = string.sub(omsg, (string.len(SPAMIAM_ADD)+2), -1);
245 table.insert(SPAMIAM_FILTERS, str);
246 SI_Print(SIC..SPAMIAM_ADDEDFILTER..SIW..str);
247 end
248 elseif (string.sub(msg, 1, string.len(SPAMIAM_REMOVE)) == SPAMIAM_REMOVE) then
249 if (string.sub(msg, 1, (string.len(SPAMIAM_REMOVE)+1)) ~= (SPAMIAM_REMOVE.." ")) then
250 SI_Print(SPAMIAM_REMOVEUSAGE1);
251 SI_Print(SPAMIAM_REMOVEUSAGE2);
252 SI_Print(SPAMIAM_REMOVEUSAGE3);
253 else
254 str = string.sub(omsg, (string.len(SPAMIAM_REMOVE)+2), -1);
255 for key, text in SPAMIAM_FILTERS do
256 if (key == tonumber(str)) then
257 table.remove(SPAMIAM_FILTERS, key);
258 SI_Print(SIC..SPAMIAM_REMOVEDFILTER..SIW..text);
259 return;
260 end
261 end
262 SI_Print(SPAMIAM_FILTERNOTFOUND);
263 end
264 else
265 SI_Print(SPAMIAM_UNKNOWNCOMMAND);
266 end
267 end
268 end
269 function SI_New_UIErrorsFrame_OnEvent(event, message, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
270 if (SPAMIAM_Enabled == 1) then
271 for key, text in SPAMIAM_FILTERS do
272 if (text and message) then if (message == text) then return; end end
273 end
274 end
275 SI_Old_UIErrorsFrame_OnEvent(event, message, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
276 end