vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | InviteOMatic is a BG Group inviter |
||
3 | |||
4 | @author Gof |
||
5 | @version 29-03-06 |
||
6 | ]]-- |
||
7 | |||
8 | ---------------------------------------------------------------------- |
||
9 | -- Saved variable |
||
10 | ---------------------------------------------------------------------- |
||
11 | |||
12 | InviteOMaticOptions = {}; |
||
13 | |||
14 | ---------------------------------------------------------------------- |
||
15 | -- Strings used in this mod |
||
16 | ---------------------------------------------------------------------- |
||
17 | |||
18 | local IOM_VERSION = "v1.16"; |
||
19 | local IOM_IOM = "[InviteOMatic]"; |
||
20 | local IOM_LOADED = IOM_IOM.." "..IOM_VERSION.." Loaded!"; |
||
21 | |||
22 | local IOM_FIRST_INVITE_SPAM_DEFAULT = IOM_IOM.." Please leave your groups, i have the raid group, (Or at least Promote me so i can help invite =)"; |
||
23 | |||
24 | local IOM_ERROR_AIG_DEFAULT = IOM_IOM.." Since you appear to already be grouped you could not be auto-invited to the raid. If you want to join the raid, please leave your group and send me a whisper with the word: invite"; |
||
25 | |||
26 | local IOM_INVITE_REG_EXP = "[iI][nN][vV][iI][tT][eE]"; -- Regular expression for magic word. |
||
27 | |||
28 | ---------------------------------------------------------------------- |
||
29 | -- Local variables used to capture state |
||
30 | ---------------------------------------------------------------------- |
||
31 | local IOM_WHOIS = false; -- Are we doing a /who lookup? |
||
32 | local IOM_NAME_BY_WHO = "----"; -- The name we are currently looking up over /Who |
||
33 | local IOM_NAME_BY_WHO_INVITER = "----"; -- The name of the person starting the lookup over /who |
||
34 | local IOM_BG_ACTIVE = false; -- Are we active in a BG, or just handling group outside BG |
||
35 | local IOM_BG_ACTIVE_INDEX = -1; -- The index of the active BG |
||
36 | local IOM_INVITE_WAIT = 1; -- Time to back off before sending invites again, (in seconds) |
||
37 | -- local IOM_FIRST_SCHED_TIME = 2; -- Time to wait from joining BG, to sending the first invite |
||
38 | local IOM_LAST_INVITE = 0; -- Time since last invite cycle, to prevent spamming of invites |
||
39 | local IOM_INVITE_FIRST = true; -- Is this the first invite cycle in this BG? |
||
40 | local IOM_READY = false; |
||
41 | |||
42 | local IOM_AIG = {}; |
||
43 | local IOM_AIG_ERROR = {}; |
||
44 | local IOM_DECLINE = {}; |
||
45 | local IOM_IGNORE = {}; |
||
46 | |||
47 | local IOM_GROUPBUG = {}; |
||
48 | |||
49 | local IOM_PURGE_TIMER = 0; |
||
50 | local IOM_INVITE_TIMER = 0; |
||
51 | local IOM_UPDATE_PURGE_TIMER = false; |
||
52 | local IOM_UPDATE_INVITE_TIMER = false; |
||
53 | |||
54 | ---------------------------------------------------------------------- |
||
55 | -- This function is called when the mod is first loaded. |
||
56 | ---------------------------------------------------------------------- |
||
57 | |||
58 | function InviteOMatic_OnLoad() |
||
59 | this:RegisterEvent("VARIABLES_LOADED"); -- Saved variables loaded |
||
60 | this:RegisterEvent("UPDATE_BATTLEFIELD_STATUS"); -- Register event that fires when BG status changes |
||
61 | this:RegisterEvent("CHAT_MSG_WHISPER"); -- Register event that fires when player receives a whisper |
||
62 | end |
||
63 | |||
64 | ---------------------------------------------------------------------- |
||
65 | -- Called when an event occurs (That we have registered to hear) |
||
66 | -- |
||
67 | -- @param event The event that occured |
||
68 | ---------------------------------------------------------------------- |
||
69 | function InviteOMatic_OnEvent() |
||
70 | |||
71 | if( event == "VARIABLES_LOADED" ) then |
||
72 | InviteOMatic_VariablesLoaded(); |
||
73 | |||
74 | elseif( event == "CHAT_MSG_WHISPER" ) then |
||
75 | InviteOMatic_WhisperEvent(arg1, arg2); |
||
76 | |||
77 | elseif( event == "UPDATE_BATTLEFIELD_STATUS" ) then |
||
78 | InviteOMatic_BGEvent(); |
||
79 | |||
80 | elseif( event == "WHO_LIST_UPDATE" ) then |
||
81 | InviteOMatic_WhoEvent(); |
||
82 | |||
83 | elseif( event == "CHAT_MSG_SYSTEM" ) then |
||
84 | InviteOMatic_ChannelSystem(arg1); |
||
85 | |||
86 | end |
||
87 | end |
||
88 | |||
89 | function InviteOMatic_VariablesLoaded() |
||
90 | if( InviteOMaticOptions == nil ) then |
||
91 | InviteOMaticOptions = {}; |
||
92 | end |
||
93 | |||
94 | if( type(InviteOMaticOptions) ~= "table" ) then |
||
95 | InviteOMaticOptions = {}; |
||
96 | end |
||
97 | |||
98 | if( InviteOMaticOptions["autoInvite"] == nil ) then |
||
99 | InviteOMaticOptions["autoInvite"] = true; |
||
100 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAutoInvite", "checked", InviteOMaticOptions["autoInvite"]); |
||
101 | end |
||
102 | |||
103 | if( InviteOMaticOptions["whisperInvite"] == nil ) then |
||
104 | InviteOMaticOptions["whisperInvite"] = true; |
||
105 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteWhisperInvite", "checked", InviteOMaticOptions["whisperInvite"]); |
||
106 | end |
||
107 | |||
108 | if( InviteOMaticOptions["autoPurge"] == nil ) then |
||
109 | InviteOMaticOptions["autoPurge"] = true; |
||
110 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAutoPurge", "checked", InviteOMaticOptions["autoPurge"]); |
||
111 | end |
||
112 | |||
113 | if( InviteOMaticOptions["debug"] == nil ) then |
||
114 | InviteOMaticOptions["debug"] = false; |
||
115 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteDebug", "checked", InviteOMaticOptions["debug"]); |
||
116 | end |
||
117 | |||
118 | if( InviteOMaticOptions["ignoreList"] == nil ) then |
||
119 | InviteOMaticOptions["ignoreList"] = {}; |
||
120 | end |
||
121 | |||
122 | if( InviteOMaticOptions["aigttl"] == nil ) then |
||
123 | InviteOMaticOptions["aigttl"] = 10; |
||
124 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAIGRetry", "slider", InviteOMaticOptions["aigttl"]); |
||
125 | end |
||
126 | |||
127 | if( InviteOMaticOptions["declinettl"] == nil ) then |
||
128 | InviteOMaticOptions["declinettl"] = 1; |
||
129 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteDeclineRetry", "slider", InviteOMaticOptions["declinettl"]); |
||
130 | end |
||
131 | |||
132 | if( InviteOMaticOptions["ignorettl"] == nil ) then |
||
133 | InviteOMaticOptions["ignorettl"] = 1; |
||
134 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteIgnoreRetry", "slider", InviteOMaticOptions["ignorettl"]); |
||
135 | end |
||
136 | |||
137 | if( InviteOMaticOptions["sendInviteSpam"] == nil ) then |
||
138 | InviteOMaticOptions["sendInviteSpam"] = true; |
||
139 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSendSpam", "checked", InviteOMaticOptions["sendInviteSpam"]); |
||
140 | end |
||
141 | |||
142 | if( InviteOMaticOptions["sendAIGSpam"] == nil ) then |
||
143 | InviteOMaticOptions["sendAIGSpam"] = true; |
||
144 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSendAIGSpam", "checked", InviteOMaticOptions["sendAIGSpam"]); |
||
145 | end |
||
146 | |||
147 | if( InviteOMaticOptions["inviteDelay"] == nil ) then |
||
148 | InviteOMaticOptions["inviteDelay"] = 10; |
||
149 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteDelay", "slider", InviteOMaticOptions["inviteDelay"]); |
||
150 | end |
||
151 | |||
152 | if( InviteOMaticOptions["purgeDelay"] == nil ) then |
||
153 | InviteOMaticOptions["purgeDelay"] = 10; |
||
154 | InviteOMatic_KhaosSetKey("InviteOMatic", "PurgeDelay", "slider", InviteOMaticOptions["purgeDelay"]); |
||
155 | end |
||
156 | |||
157 | if( InviteOMaticOptions["inviteMsg"] == nil ) then |
||
158 | InviteOMaticOptions["inviteMsg"] = IOM_FIRST_INVITE_SPAM_DEFAULT; |
||
159 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSpamMsg", "value", InviteOMaticOptions["inviteMsg"]); |
||
160 | end |
||
161 | |||
162 | if( InviteOMaticOptions["aigMsg"] == nil ) then |
||
163 | InviteOMaticOptions["aigMsg"] = IOM_ERROR_AIG_DEFAULT; |
||
164 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAIGSpamMsg", "value", InviteOMaticOptions["aigMsg"]); |
||
165 | end |
||
166 | |||
167 | if( InviteOMaticOptions["magicWord"] == nil ) then |
||
168 | InviteOMaticOptions["magicWord"] = IOM_INVITE_REG_EXP; |
||
169 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteMagicWord", "value", InviteOMaticOptions["magicWord"]); |
||
170 | end |
||
171 | |||
172 | InviteOMatic.log(IOM_LOADED); |
||
173 | SlashCmdList["IOM"] = InviteOMatic_SlashHandler; |
||
174 | SLASH_IOM1 = "/iom"; |
||
175 | |||
176 | IOM_READY = true; |
||
177 | |||
178 | InviteOMatic_RegisterKhaos(); |
||
179 | |||
180 | end |
||
181 | |||
182 | ---------------------------------------------------------------------- |
||
183 | -- Slash command handler |
||
184 | ---------------------------------------------------------------------- |
||
185 | function InviteOMatic_SlashHandler(msg) |
||
186 | if( not IOM_READY ) then |
||
187 | return; |
||
188 | end |
||
189 | |||
190 | if( InviteOMatic_IsDisabled() ) then |
||
191 | return; |
||
192 | end |
||
193 | |||
194 | local oldmsg = msg; |
||
195 | msg = string.lower(msg); |
||
196 | |||
197 | InviteOMatic.debug("Slashcommand: ("..msg..")"); |
||
198 | |||
199 | _, _, option, value = string.find(msg, "(%w*)%s*(%w*)"); |
||
200 | |||
201 | InviteOMatic.debug("Option: ("..option.."), Value: ("..value..")"); |
||
202 | |||
203 | if( option == "autoinvite" ) then |
||
204 | if( value == "on" ) then |
||
205 | InviteOMaticOptions["autoInvite"] = true; |
||
206 | elseif( value == "off" ) then |
||
207 | InviteOMaticOptions["autoInvite"] = false; |
||
208 | else |
||
209 | InviteOMaticOptions["autoInvite"] = not InviteOMaticOptions["autoInvite"]; |
||
210 | end |
||
211 | InviteOMatic.log("Auto invite set to: "..tostring(InviteOMaticOptions["autoInvite"])); |
||
212 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAutoInvite", "checked", InviteOMaticOptions["autoInvite"]); |
||
213 | if( IOM_BG_ACTIVE ) then |
||
214 | IOM_UPDATE_INVITE_TIMER = InviteOMaticOptions["autoInvite"]; |
||
215 | end |
||
216 | |||
217 | elseif( option == "whisperinvite" ) then |
||
218 | if( value == "on" ) then |
||
219 | InviteOMaticOptions["whisperInvite"] = true; |
||
220 | elseif( value == "off" ) then |
||
221 | InviteOMaticOptions["whisperInvite"] = false; |
||
222 | else |
||
223 | InviteOMaticOptions["whisperInvite"] = not InviteOMaticOptions["whisperInvite"]; |
||
224 | end |
||
225 | InviteOMatic.log("Whisper invite set to: "..tostring(InviteOMaticOptions["whisperInvite"])); |
||
226 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteWhisperInvite", "checked", InviteOMaticOptions["whisperInvite"]); |
||
227 | |||
228 | elseif( option == "autopurge" ) then |
||
229 | if( value == "on" ) then |
||
230 | InviteOMaticOptions["autoPurge"] = true; |
||
231 | elseif( value == "off" ) then |
||
232 | InviteOMaticOptions["autoPurge"] = false; |
||
233 | else |
||
234 | InviteOMaticOptions["autoPurge"] = not InviteOMaticOptions["autoPurge"]; |
||
235 | end |
||
236 | InviteOMatic.log("Auto purge set to: "..tostring(InviteOMaticOptions["autoPurge"])); |
||
237 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAutoPurge", "checked", InviteOMaticOptions["autoPurge"]); |
||
238 | if( IOM_BG_ACTIVE ) then |
||
239 | IOM_UPDATE_PURGE_TIMER = InviteOMaticOptions["autoPurge"]; |
||
240 | end |
||
241 | |||
242 | elseif( option == "spam" ) then |
||
243 | if( value == "on" ) then |
||
244 | InviteOMaticOptions["sendInviteSpam"] = true; |
||
245 | elseif( value == "off") then |
||
246 | InviteOMaticOptions["sendInviteSpam"] = false; |
||
247 | else |
||
248 | InviteOMaticOptions["sendInviteSpam"] = not InviteOMaticOptions["sendInviteSpam"]; |
||
249 | end |
||
250 | InviteOMatic.log("Invite spam set to: "..tostring(InviteOMaticOptions["sendInviteSpam"])); |
||
251 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSendSpam", "checked", InviteOMaticOptions["sendInviteSpam"]); |
||
252 | |||
253 | elseif( option == "debug" ) then |
||
254 | if( value == "on" ) then |
||
255 | InviteOMaticOptions["debug"] = true; |
||
256 | elseif( value == "off") then |
||
257 | InviteOMaticOptions["debug"] = false; |
||
258 | else |
||
259 | InviteOMaticOptions["debug"] = not InviteOMaticOptions["debug"]; |
||
260 | end |
||
261 | InviteOMatic.log("Debug messages set to: "..tostring(InviteOMaticOptions["debug"])); |
||
262 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteDebug", "checked", InviteOMaticOptions["debug"]); |
||
263 | |||
264 | elseif( option == "ignore" ) then |
||
265 | if( value ~= nil ) then |
||
266 | local lowerName = string.lower(value); |
||
267 | InviteOMaticOptions["ignoreList"][lowerName] = lowerName; |
||
268 | else |
||
269 | InviteOMatic.log("You need to specify a playername you wish to add to the ignore-list, /iom ignore playername"); |
||
270 | end |
||
271 | InviteOMatic.log(value.." added to ignore list"); |
||
272 | |||
273 | elseif( option == "removeignore" ) then |
||
274 | if( value ~= nil ) then |
||
275 | local lowerName = string.lower(value); |
||
276 | InviteOMaticOptions["ignoreList"][lowerName] = nil; |
||
277 | else |
||
278 | InviteOMatic.log("You need to specify a playername you wish to remove from the ignore-list, /iom ignore playername"); |
||
279 | end |
||
280 | InviteOMatic.log(value.." removed from ignore list"); |
||
281 | |||
282 | elseif( option == "spammsg" ) then |
||
283 | if( value == "default" ) then |
||
284 | InviteOMaticOptions["inviteMsg"] = IOM_FIRST_INVITE_SPAM_DEFAULT; |
||
285 | InviteOMatic.log("First spam msg set to default: "..InviteOMaticOptions["inviteMsg"]); |
||
286 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSpamMsg", "value", InviteOMaticOptions["inviteMsg"]); |
||
287 | return; |
||
288 | end |
||
289 | |||
290 | sS, sE = string.find(msg, "\".*\""); |
||
291 | |||
292 | if( not sS ) then |
||
293 | InviteOMatic.log("You need to specify a new message ex. /iom spammsg \"newmsg\""); |
||
294 | return; |
||
295 | end |
||
296 | |||
297 | newmsg = string.sub(oldmsg, sS+1, sE-1); |
||
298 | InviteOMatic.debug("New message is: ("..newmsg..")"); |
||
299 | InviteOMaticOptions["inviteMsg"] = newmsg; |
||
300 | InviteOMatic.log("First spam msg set to: "..InviteOMaticOptions["inviteMsg"]); |
||
301 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteSpamMsg", "value", InviteOMaticOptions["inviteMsg"]); |
||
302 | |||
303 | elseif( option == "aigmsg" ) then |
||
304 | if( value == "default" ) then |
||
305 | InviteOMaticOptions["aigMsg"] = IOM_ERROR_AIG_DEFAULT; |
||
306 | InviteOMatic.log("AIG spam msg set to default: "..InviteOMaticOptions["aigMsg"]); |
||
307 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAIGSpamMsg", "value", InviteOMaticOptions["aigMsg"]); |
||
308 | return; |
||
309 | end |
||
310 | |||
311 | sS, sE = string.find(msg, "\".*\""); |
||
312 | |||
313 | if( not sS ) then |
||
314 | InviteOMatic.log("You need to specify a new message ex. /iom aigmsg \"newmsg\""); |
||
315 | return; |
||
316 | end |
||
317 | |||
318 | newmsg = string.sub(oldmsg, sS+1, sE-1); |
||
319 | InviteOMatic.debug("New message is: ("..newmsg..")"); |
||
320 | InviteOMaticOptions["aigMsg"] = newmsg; |
||
321 | InviteOMatic.log("AIG spam msg set to: "..InviteOMaticOptions["aigMsg"]); |
||
322 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAIGSpamMsg", "value", InviteOMaticOptions["aigMsg"]); |
||
323 | |||
324 | elseif( option == "magicword" ) then |
||
325 | if( value == "default" ) then |
||
326 | InviteOMaticOptions["magicWord"] = IOM_INVITE_REG_EXP; |
||
327 | InviteOMatic.log("Magic word set to default: "..InviteOMaticOptions["magicWord"]); |
||
328 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteMagicWord", "value", InviteOMaticOptions["magicWord"]); |
||
329 | return; |
||
330 | end |
||
331 | |||
332 | sS, sE = string.find(msg, "\".*\""); |
||
333 | |||
334 | if( not sS ) then |
||
335 | InviteOMatic.log("You need to specify a new magic word ex. /iom aigmsg \"[iI][nN][vV]\""); |
||
336 | return; |
||
337 | end |
||
338 | |||
339 | newmsg = string.sub(oldmsg, sS+1, sE-1); |
||
340 | InviteOMatic.debug("New magic word is: ("..newmsg..")"); |
||
341 | InviteOMaticOptions["magicWord"] = newmsg; |
||
342 | InviteOMatic.log("Magic word set to: "..InviteOMaticOptions["magicWord"]); |
||
343 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteMagicWord", "value", InviteOMaticOptions["magicWord"]); |
||
344 | |||
345 | elseif( option == "resetaiglist" ) then |
||
346 | InviteOMatic_ResetAIG(); |
||
347 | InviteOMatic.log("Already in group list reset"); |
||
348 | |||
349 | elseif( option == "promote" ) then |
||
350 | InviteOMatic_PromoteAll(); |
||
351 | |||
352 | elseif( option == "demote" ) then |
||
353 | InviteOMatic_DemoteAll(); |
||
354 | |||
355 | elseif( option == "aigttl" ) then |
||
356 | if( value ) then |
||
357 | local num = tonumber(value); |
||
358 | if( num ) then |
||
359 | if( num >= 0 and num <= 20 ) then |
||
360 | InviteOMaticOptions["aigttl"] = num; |
||
361 | InviteOMatic.log("Already in group retries set to: "..InviteOMaticOptions["aigttl"]); |
||
362 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteAIGRetry", "slider", InviteOMaticOptions["aigttl"]); |
||
363 | else |
||
364 | InviteOMatic.log("Number must be between 0 and 20"); |
||
365 | end |
||
366 | end |
||
367 | end |
||
368 | elseif( option == "ignorettl" ) then |
||
369 | if( value ) then |
||
370 | local num = tonumber(value); |
||
371 | if( num ) then |
||
372 | if( num >= 0 and num <= 10 ) then |
||
373 | InviteOMaticOptions["ignorettl"] = num; |
||
374 | InviteOMatic.log("Ignore retries set to: "..InviteOMaticOptions["ignorettl"]); |
||
375 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteIgnoreRetry", "slider", InviteOMaticOptions["ignorettl"]); |
||
376 | else |
||
377 | InviteOMatic.log("Number must be between 0 and 10"); |
||
378 | end |
||
379 | end |
||
380 | end |
||
381 | |||
382 | elseif( option == "declinettl" ) then |
||
383 | if( value ) then |
||
384 | local num = tonumber(value); |
||
385 | if( num ) then |
||
386 | if( num >= 0 and num <= 10 ) then |
||
387 | InviteOMaticOptions["declinettl"] = num; |
||
388 | InviteOMatic.log("Decline retries set to: "..InviteOMaticOptions["declinettl"]); |
||
389 | InviteOMatic_KhaosSetKey("InviteOMatic", "InviteDeclineRetry", "slider", InviteOMaticOptions["declinettl"]); |
||
390 | else |
||
391 | InviteOMatic.log("Number must be between 0 and 10"); |
||
392 | end |
||
393 | end |
||
394 | end |
||
395 | |||
396 | else |
||
397 | InviteOMatic.log("Unknown option: "..option); |
||
398 | InviteOMatic.log("Usage: /iom option value"); |
||
399 | InviteOMatic.log("Options:"); |
||
400 | InviteOMatic.log(" autoinvite on|off -- Turns autoinvite on/off"); |
||
401 | InviteOMatic.log(" autopurge on|off -- Turns autopurge on/off"); |
||
402 | InviteOMatic.log(" whisperinvite on|off -- Turns whisperinvite on/off"); |
||
403 | InviteOMatic.log(" debug on|off -- Turns debug messages on/off"); |
||
404 | InviteOMatic.log(" spam on|off -- Turns the invite spam on/off"); |
||
405 | InviteOMatic.log(" spammsg default|\"newmsg\" -- Sets invite msg to newmsg"); |
||
406 | InviteOMatic.log(" aigmsg default|\"newmsg\" -- Sets AIG msg to newmsg"); |
||
407 | InviteOMatic.log(" magicword default|\"word\" -- Sets the magic invite word (REGEXP)"); |
||
408 | InviteOMatic.log(" resetaiglist -- Resets the already in group list"); |
||
409 | InviteOMatic.log(" ignore playername -- Puts the player on the ignorelist (Will not be invited)"); |
||
410 | InviteOMatic.log(" removeignore playername -- Puts the player on the ignorelist (Will not be invited)"); |
||
411 | InviteOMatic.log(" promote -- Promotes all members of the raidgroup"); |
||
412 | InviteOMatic.log(" demote -- Demotes all members of the raidgroup"); |
||
413 | InviteOMatic.log(" aigttl num -- Set number of already in group retries to num"); |
||
414 | InviteOMatic.log(" ignorettl num -- Set number of ignore retries to num"); |
||
415 | InviteOMatic.log(" declinettl num -- Set number of decline retries to num"); |
||
416 | end |
||
417 | |||
418 | end |
||
419 | |||
420 | function InviteOMatic_KhaosSetKey(set, key, type, value) |
||
421 | if(Khaos) then |
||
422 | if(Khaos.getSetKey(set,key)) then |
||
423 | Khaos.setSetKeyParameter(set, key, type, value); |
||
424 | end |
||
425 | end |
||
426 | end |
||
427 | |||
428 | ---------------------------------------------------------------------- |
||
429 | -- Should this person be invited? (Do checks) |
||
430 | ---------------------------------------------------------------------- |
||
431 | function InviteOMatic_ShouldInvite(name) |
||
432 | if( not IOM_READY ) then |
||
433 | return; |
||
434 | end |
||
435 | if( InviteOMatic_IsDisabled() ) then |
||
436 | return; |
||
437 | end |
||
438 | |||
439 | if( name ~= nil ) then |
||
440 | local lowerName = string.lower(name); |
||
441 | |||
442 | if( InviteOMaticOptions["ignoreList"][lowerName] ~= nil ) then |
||
443 | -- This player is ignored, so dont invite |
||
444 | InviteOMatic.debug("Player "..charname.." is on ignore list, so will not get invited"); |
||
445 | return false; |
||
446 | end |
||
447 | |||
448 | -- Do checks on this specefic name (Will only reject, not accept) |
||
449 | |||
450 | if( IOM_AIG[name] and IOM_AIG[name] >= InviteOMaticOptions["aigttl"] ) then |
||
451 | |||
452 | if( not IOM_AIG_ERROR[name] ) then |
||
453 | IOM_AIG_ERROR[name] = true; |
||
454 | if( InviteOMaticOptions["sendAIGSpam"] ) then |
||
455 | SendChatMessage(InviteOMaticOptions["aigMsg"], "WHISPER",this.language,name); |
||
456 | end |
||
457 | end |
||
458 | |||
459 | return false; |
||
460 | |||
461 | end |
||
462 | if( IOM_DECLINE[name] and IOM_DECLINE[name] >= InviteOMaticOptions["declinettl"] ) then |
||
463 | return false; |
||
464 | end |
||
465 | |||
466 | if( IOM_IGNORE[name] and IOM_IGNORE[name] >= InviteOMaticOptions["ignorettl"] ) then |
||
467 | return false; |
||
468 | end |
||
469 | end |
||
470 | |||
471 | --Do general checks( Accept and reject ) |
||
472 | |||
473 | -- If raid officer or leader then ok |
||
474 | if( IsRaidLeader() or IsRaidOfficer() or IsPartyLeader() ) then |
||
475 | return true; |
||
476 | elseif( IOM_BG_ACTIVE and ((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) ) then |
||
477 | --We are in a BG, but not able to invite |
||
478 | return false; |
||
479 | end |
||
480 | |||
481 | return true; |
||
482 | end |
||
483 | |||
484 | ---------------------------------------------------------------------- |
||
485 | -- Invite the player with the given name, if its ok |
||
486 | ---------------------------------------------------------------------- |
||
487 | function InviteOMatic_InvitePlayer(name) |
||
488 | if( not IOM_READY ) then |
||
489 | return; |
||
490 | end |
||
491 | if( InviteOMatic_IsDisabled() ) then |
||
492 | return; |
||
493 | end |
||
494 | |||
495 | if( name == nil ) then |
||
496 | return; |
||
497 | end |
||
498 | |||
499 | local lowerName = string.lower(name); |
||
500 | |||
501 | if( InviteOMaticOptions["ignoreList"][lowerName] ~= nil ) then |
||
502 | -- This player is ignored, so dont invite |
||
503 | InviteOMatic.debug("Player "..lowerName.." is on ignore list, so will not get invited"); |
||
504 | return; |
||
505 | end |
||
506 | |||
507 | InviteOMatic.debug("Checking invite: ("..name..")"); |
||
508 | |||
509 | local ok = InviteOMatic_ShouldInvite(name); |
||
510 | |||
511 | if( ok ) then |
||
512 | InviteOMatic.debug("("..name..") checked ok, inviting"); |
||
513 | |||
514 | if( IOM_GROUPBUG[name] ~= nil ) then |
||
515 | InviteOMatic.debug("Group bug2 maybee found. Uninviting first..."); |
||
516 | |||
517 | UninviteByName(name); |
||
518 | end |
||
519 | |||
520 | InviteByName(name); |
||
521 | |||
522 | IOM_GROUPBUG[name] = true; |
||
523 | |||
524 | else |
||
525 | InviteOMatic.debug("("..name..") failed check!"); |
||
526 | end |
||
527 | end |
||
528 | |||
529 | ---------------------------------------------------------------------- |
||
530 | -- Convert to Raid |
||
531 | ---------------------------------------------------------------------- |
||
532 | function InviteOMatic_MakeRaid() |
||
533 | if( not IOM_READY ) then |
||
534 | return; |
||
535 | end |
||
536 | if( InviteOMatic_IsDisabled() ) then |
||
537 | return; |
||
538 | end |
||
539 | |||
540 | local raidMembers = GetNumRaidMembers(); |
||
541 | local isLeader = IsPartyLeader(); |
||
542 | |||
543 | if( (raidMembers == 0) and isLeader ) then |
||
544 | |||
545 | InviteOMatic.debug("Converting to raid..."); |
||
546 | |||
547 | ConvertToRaid(); |
||
548 | end |
||
549 | end |
||
550 | |||
551 | ---------------------------------------------------------------------- |
||
552 | -- Function to handle enter world event |
||
553 | ---------------------------------------------------------------------- |
||
554 | function InviteOMatic_BGEvent() |
||
555 | InviteOMatic.debug("Battlefield status changed..."); |
||
556 | |||
557 | NUMBER_OF_BATTLEFIELDS = 3; |
||
558 | |||
559 | if( not IOM_BG_ACTIVE ) then |
||
560 | for i=1,NUMBER_OF_BATTLEFIELDS do |
||
561 | status, mapName, instanceID = GetBattlefieldStatus(i); |
||
562 | |||
563 | InviteOMatic.debug("Status: "..status..", MapName: "..mapName..", InstanceID: "..instanceID); |
||
564 | |||
565 | if( status == "active" ) then |
||
566 | |||
567 | InviteOMatic_EnteredBG(i); |
||
568 | |||
569 | end |
||
570 | end |
||
571 | else |
||
572 | status, mapName, instanceID = GetBattlefieldStatus(IOM_BG_ACTIVE_INDEX); |
||
573 | if( status ~= "active" ) then |
||
574 | -- You have left BG |
||
575 | InviteOMatic_LeftBG(IOM_BG_ACTIVE_INDEX); |
||
576 | end |
||
577 | end |
||
578 | end |
||
579 | |||
580 | ---------------------------------------------------------------------- |
||
581 | -- Function to handle whisper events |
||
582 | ---------------------------------------------------------------------- |
||
583 | function InviteOMatic_WhisperEvent(text, name) |
||
584 | if( not IOM_READY ) then |
||
585 | return; |
||
586 | end |
||
587 | if( InviteOMatic_IsDisabled() ) then |
||
588 | return; |
||
589 | end |
||
590 | |||
591 | InviteOMatic.debug("Tell recieved..."); |
||
592 | |||
593 | --If whisper invites isnt enabled, just return |
||
594 | if( not InviteOMaticOptions["whisperInvite"] ) then |
||
595 | return; |
||
596 | end |
||
597 | |||
598 | --Check if tell contains the magic word invite |
||
599 | |||
600 | sStart, sEnd = string.find(text, InviteOMaticOptions["magicWord"], 1); |
||
601 | if( sStart ~= nil ) then |
||
602 | |||
603 | --Check if the word just after invite is a player |
||
604 | sStart2, sEnd2 = string.find(text, "%s[^%s%?%.!]+", sEnd); |
||
605 | |||
606 | if( sStart2 ~= nil ) then |
||
607 | local foundName = string.lower( string.sub(text, sStart2+1, sEnd2) ); |
||
608 | |||
609 | if( foundName == "me" or foundName == "please" or foundName == "plz" or foundName == "plez" or foundName == "pleaz") then |
||
610 | IOM_AIG[name] = nil; |
||
611 | IOM_AIG_ERROR[name] = nil; |
||
612 | IOM_IGNORE[name] = nil; |
||
613 | IOM_DECLINE[name] = nil; |
||
614 | InviteOMatic.invite(name); |
||
615 | else |
||
616 | InviteOMatic.debug(name.." wants you to invite ("..foundName..")"); |
||
617 | |||
618 | IOM_WHOIS = true; |
||
619 | |||
620 | this:RegisterEvent("WHO_LIST_UPDATE"); |
||
621 | FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE"); |
||
622 | SetWhoToUI(1); |
||
623 | |||
624 | -- Do lookup via Who command. |
||
625 | IOM_NAME_BY_WHO = string.lower(foundName); |
||
626 | IOM_NAME_BY_WHO_INVITER = name; |
||
627 | |||
628 | SendWho("n-\""..foundName.."\""); |
||
629 | end |
||
630 | else |
||
631 | IOM_AIG[name] = nil; |
||
632 | IOM_AIG_ERROR[name] = nil; |
||
633 | IOM_IGNORE[name] = nil; |
||
634 | IOM_DECLINE[name] = nil; |
||
635 | InviteOMatic.invite(name); |
||
636 | end |
||
637 | end |
||
638 | end |
||
639 | |||
640 | ---------------------------------------------------------------------- |
||
641 | -- Function to handle who events |
||
642 | ---------------------------------------------------------------------- |
||
643 | function InviteOMatic_WhoEvent() |
||
644 | |||
645 | if( IOM_WHOIS ) then |
||
646 | InviteOMatic.debug("WHO_LIST_UPDATED - ("..IOM_NAME_BY_WHO..")"); |
||
647 | |||
648 | local invited = false; |
||
649 | |||
650 | -- We saw our who, so reset everything back |
||
651 | |||
652 | SetWhoToUI(0); |
||
653 | FriendsFrame:RegisterEvent("WHO_LIST_UPDATE"); |
||
654 | this:UnregisterEvent("WHO_LIST_UPDATE"); |
||
655 | IOM_WHOIS = false; |
||
656 | |||
657 | -- Now process the who list |
||
658 | local length = GetNumWhoResults(); |
||
659 | |||
660 | for i=1,length do |
||
661 | charname, guildname, level, race, class, zone, unknown = GetWhoInfo(i); |
||
662 | |||
663 | InviteOMatic.debug("Found: "..charname); |
||
664 | |||
665 | charname = string.lower(charname); |
||
666 | |||
667 | if( charname == IOM_NAME_BY_WHO ) then |
||
668 | if( InviteOMaticOptions["ignoreList"][charname] ~= nil ) then |
||
669 | -- This player is ignored, so dont invite |
||
670 | InviteOMatic.log("Player "..charname.." is on ignore list, so will not get invited"); |
||
671 | return; |
||
672 | end |
||
673 | |||
674 | IOM_AIG[IOM_NAME_BY_WHO] = nil; |
||
675 | IOM_AIG_ERROR[IOM_NAME_BY_WHO] = nil; |
||
676 | IOM_IGNORE[IOM_NAME_BY_WHO] = nil; |
||
677 | IOM_DECLINE[IOM_NAME_BY_WHO] = nil; |
||
678 | InviteOMatic.invite(IOM_NAME_BY_WHO); |
||
679 | invited = true; |
||
680 | end |
||
681 | end |
||
682 | |||
683 | if( not invited ) then |
||
684 | if( InviteOMaticOptions["ignoreList"][IOM_NAME_BY_WHO_INVITER] ~= nil ) then |
||
685 | -- This player is ignored, so dont invite |
||
686 | InviteOMatic.log("Player "..charname.." is on ignore list, so will not get invited"); |
||
687 | return; |
||
688 | end |
||
689 | |||
690 | IOM_AIG[IOM_NAME_BY_WHO_INVITER] = nil; |
||
691 | IOM_AIG_ERROR[IOM_NAME_BY_WHO_INVITER] = nil; |
||
692 | IOM_IGNORE[IOM_NAME_BY_WHO_INVITER] = nil; |
||
693 | IOM_DECLINE[IOM_NAME_BY_WHO_INVITER] = nil; |
||
694 | |||
695 | InviteByName(IOM_NAME_BY_WHO_INVITER); |
||
696 | end |
||
697 | |||
698 | -- Done processing, reset IOM_NAME_BY_WHO, IOM_NAME_BY_WHO_INVITER |
||
699 | IOM_NAME_BY_WHO = "----"; |
||
700 | IOM_NAME_BY_WHO_INVITER = "----"; |
||
701 | end |
||
702 | end |
||
703 | |||
704 | ---------------------------------------------------------------------- |
||
705 | -- Called when InviteOMatic detects that you have entered a BG |
||
706 | -- |
||
707 | -- Sets up the events we want to listen for while in BG, and starts invite script |
||
708 | ---------------------------------------------------------------------- |
||
709 | function InviteOMatic_EnteredBG(index) |
||
710 | IOM_BG_ACTIVE_INDEX = index; |
||
711 | IOM_BG_ACTIVE = true; |
||
712 | |||
713 | status, mapName, instanceID = GetBattlefieldStatus(index); |
||
714 | |||
715 | local runtime = GetBattlefieldInstanceRunTime(); |
||
716 | |||
717 | InviteOMatic.debug("You entered "..mapName.." Runtime: "..runtime); |
||
718 | |||
719 | if( InviteOMaticOptions["autoInvite"] ) then |
||
720 | IOM_UPDATE_INVITE_TIMER = true; |
||
721 | end |
||
722 | |||
723 | if( InviteOMaticOptions["autoPurge"] ) then |
||
724 | IOM_UPDATE_PURGE_TIMER = true; |
||
725 | end |
||
726 | |||
727 | this:RegisterEvent("CHAT_MSG_SYSTEM"); |
||
728 | end |
||
729 | |||
730 | ---------------------------------------------------------------------- |
||
731 | -- This function purges players that are offline or has left the BG |
||
732 | ---------------------------------------------------------------------- |
||
733 | function InviteOMatic_DoPurge() |
||
734 | if( not IOM_READY ) then |
||
735 | return; |
||
736 | end |
||
737 | if( InviteOMatic_IsDisabled() ) then |
||
738 | return; |
||
739 | end |
||
740 | |||
741 | if( not InviteOMaticOptions["autoPurge"] ) then |
||
742 | return; |
||
743 | end |
||
744 | |||
745 | for i=1,GetNumRaidMembers() do |
||
746 | --do som check for each member determing if he is online, if he isnt, purge him |
||
747 | end |
||
748 | end |
||
749 | |||
750 | ---------------------------------------------------------------------- |
||
751 | -- Promotes all memebers of a raid group |
||
752 | ---------------------------------------------------------------------- |
||
753 | function InviteOMatic_PromoteAll() |
||
754 | if( not IOM_READY ) then |
||
755 | return; |
||
756 | end |
||
757 | if( InviteOMatic_IsDisabled() ) then |
||
758 | return; |
||
759 | end |
||
760 | |||
761 | for i=1,GetNumRaidMembers() do |
||
762 | local name = GetRaidRosterInfo(i); |
||
763 | |||
764 | if( IsRaidLeader() ) then |
||
765 | PromoteToAssistant(name); |
||
766 | end |
||
767 | |||
768 | end |
||
769 | end |
||
770 | |||
771 | ---------------------------------------------------------------------- |
||
772 | -- Demotes all memebers of a raid group |
||
773 | ---------------------------------------------------------------------- |
||
774 | function InviteOMatic_DemoteAll() |
||
775 | if( not IOM_READY ) then |
||
776 | return; |
||
777 | end |
||
778 | if( InviteOMatic_IsDisabled() ) then |
||
779 | return; |
||
780 | end |
||
781 | |||
782 | for i=1,GetNumRaidMembers() do |
||
783 | local name = GetRaidRosterInfo(i); |
||
784 | |||
785 | if( IsRaidLeader() ) then |
||
786 | DemoteAssistant(name); |
||
787 | end |
||
788 | |||
789 | end |
||
790 | end |
||
791 | |||
792 | ---------------------------------------------------------------------- |
||
793 | -- Disbands the raid group uninviting every member |
||
794 | ---------------------------------------------------------------------- |
||
795 | function InviteOMatic_DisbandRaidGroup() |
||
796 | if( not IOM_READY ) then |
||
797 | return; |
||
798 | end |
||
799 | if( InviteOMatic_IsDisabled() ) then |
||
800 | return; |
||
801 | end |
||
802 | |||
803 | for i=1,GetNumRaidMembers() do |
||
804 | --Remove player from raid |
||
805 | local name = GetRaidRosterInfo(i); |
||
806 | |||
807 | if( IsRaidLeader() or IsRaidOfficer() or IsPartyLeader() ) then |
||
808 | UninviteByName(name); |
||
809 | end |
||
810 | |||
811 | end |
||
812 | |||
813 | for i=1,GetNumPartyMembers() do |
||
814 | --Remove player from group |
||
815 | end |
||
816 | end |
||
817 | |||
818 | ---------------------------------------------------------------------- |
||
819 | -- This function tries to invite everyone that is not already in our group |
||
820 | ---------------------------------------------------------------------- |
||
821 | function InviteOMatic_SendInvites() |
||
822 | if( not IOM_READY ) then |
||
823 | return; |
||
824 | end |
||
825 | if( InviteOMatic_IsDisabled() ) then |
||
826 | return; |
||
827 | end |
||
828 | |||
829 | if( not InviteOMaticOptions["autoInvite"] ) then |
||
830 | return; |
||
831 | end |
||
832 | |||
833 | local bfCount = GetNumBattlefieldPositions(); |
||
834 | |||
835 | if( bfCount == 0 ) then |
||
836 | return; |
||
837 | end |
||
838 | |||
839 | InviteOMatic.debug("Sending invites - InviteOMatic_SendInvites()"); |
||
840 | |||
841 | if( not IOM_BG_ACTIVE ) then |
||
842 | InviteOMatic.debug("Not in a BG"); |
||
843 | return; |
||
844 | end |
||
845 | |||
846 | local now = GetTime(); |
||
847 | |||
848 | local delta = now - IOM_LAST_INVITE; |
||
849 | |||
850 | if( delta < IOM_INVITE_WAIT ) then |
||
851 | InviteOMatic.debug("Wait a little longer...("..delta..")"); |
||
852 | return; |
||
853 | end |
||
854 | |||
855 | if( not InviteOMatic_ShouldInvite(nil) ) then |
||
856 | -- We got a negative from ShouldInvite, so we stop here |
||
857 | return; |
||
858 | end |
||
859 | |||
860 | if( IOM_INVITE_FIRST ) then |
||
861 | IOM_INVITE_FIRST = false; |
||
862 | |||
863 | if( InviteOMaticOptions["sendInviteSpam"] ) then |
||
864 | SendChatMessage(InviteOMaticOptions["inviteMsg"], "SAY"); |
||
865 | end |
||
866 | end |
||
867 | |||
868 | -- Convert to raid if any members is in party |
||
869 | InviteOMatic_MakeRaid(); |
||
870 | |||
871 | local count = GetNumBattlefieldPositions(); -- Number of players not in our raid |
||
872 | |||
873 | if( (count > 4) and (GetNumRaidMembers() == 0) ) then |
||
874 | -- Not a raid yet so only invite 4 people |
||
875 | count = 5 - GetNumPartyMembers(); |
||
876 | end |
||
877 | |||
878 | for i=1,count do |
||
879 | posX, posY, name = GetBattlefieldPosition(i); |
||
880 | |||
881 | InviteOMatic.invite(name); |
||
882 | end |
||
883 | |||
884 | IOM_LAST_INVITE = GetTime(); |
||
885 | |||
886 | end |
||
887 | |||
888 | ---------------------------------------------------------------------- |
||
889 | -- Function to handle system messages |
||
890 | ---------------------------------------------------------------------- |
||
891 | function InviteOMatic_ChannelSystem(arg1) |
||
892 | if( not IOM_READY ) then |
||
893 | return; |
||
894 | end |
||
895 | if( InviteOMatic_IsDisabled() ) then |
||
896 | return; |
||
897 | end |
||
898 | |||
899 | local name = ""; |
||
900 | |||
901 | if( string.find(arg1, "has joined the battle") ) then |
||
902 | sS, sE = string.find(arg1, "%["); |
||
903 | sS2, sE2 = string.find(arg1, "%]"); |
||
904 | name = string.sub(arg1,sS+1,sS2-1); |
||
905 | InviteOMatic_PlayerJoinedBattle(name); |
||
906 | |||
907 | elseif( string.find(arg1, "has left the battle") ) then |
||
908 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
909 | name = string.sub(arg1,sS,sE); |
||
910 | InviteOMatic_PlayerLeftBattle(name); |
||
911 | |||
912 | elseif( string.find(arg1, "declines your group invitation") ) then |
||
913 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
914 | name = string.sub(arg1,sS,sE); |
||
915 | InviteOMatic_PlayerDeclined(name); |
||
916 | |||
917 | elseif( string.find(arg1, "is ignoring you") ) then |
||
918 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
919 | name = string.sub(arg1,sS,sE); |
||
920 | InviteOMatic_PlayerIgnores(name); |
||
921 | |||
922 | elseif( string.find(arg1, "is already in a group") ) then |
||
923 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
924 | name = string.sub(arg1,sS,sE); |
||
925 | InviteOMatic_PlayerAlreadyGrouped(name); |
||
926 | |||
927 | elseif( string.find(arg1, "joins the party") ) then |
||
928 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
929 | name = string.sub(arg1,sS,sE); |
||
930 | InviteOMatic_PlayerJoinedGroup(name); |
||
931 | |||
932 | elseif( string.find(arg1, "has joined the raid group") ) then |
||
933 | sS, sE = string.find(arg1, "[^%s%!%?]+"); |
||
934 | name = string.sub(arg1,sS,sE); |
||
935 | InviteOMatic_PlayerJoinedGroup(name); |
||
936 | |||
937 | elseif( string.find(arg1, "You have invited") ) then |
||
938 | sS, sE = string.find(arg1, "You have invited"); |
||
939 | sS2, sE2 = string.find(arg1, "[^%s%!%?]+", sE+1); |
||
940 | name = string.sub(arg1,sS2,sE2); |
||
941 | InviteOMatic_PlayerInvitedEvent(name); |
||
942 | |||
943 | else |
||
944 | InviteOMatic.debug("Unhandled sysmsg: "..arg1); |
||
945 | |||
946 | end |
||
947 | |||
948 | end |
||
949 | |||
950 | ---------------------------------------------------------------------- |
||
951 | -- Remove this player from the groupbug table |
||
952 | ---------------------------------------------------------------------- |
||
953 | function InviteOMatic_PlayerInvitedEvent(name) |
||
954 | InviteOMatic.debug("You invited: ("..name..")"); |
||
955 | |||
956 | IOM_GROUPBUG[name] = nil; |
||
957 | end |
||
958 | |||
959 | ---------------------------------------------------------------------- |
||
960 | -- Resets AIG list |
||
961 | ---------------------------------------------------------------------- |
||
962 | function InviteOMatic_ResetAIG() |
||
963 | if( not IOM_READY ) then |
||
964 | return; |
||
965 | end |
||
966 | if( InviteOMatic_IsDisabled() ) then |
||
967 | return; |
||
968 | end |
||
969 | |||
970 | InviteOMatic.debug("Resetting AIG list..."); |
||
971 | IOM_AIG = {}; |
||
972 | IOM_AIG_ERROR = {}; |
||
973 | end |
||
974 | |||
975 | ---------------------------------------------------------------------- |
||
976 | -- Resets DECLINE list |
||
977 | ---------------------------------------------------------------------- |
||
978 | function InviteOMatic_ResetDecline() |
||
979 | if( not IOM_READY ) then |
||
980 | return; |
||
981 | end |
||
982 | if( InviteOMatic_IsDisabled() ) then |
||
983 | return; |
||
984 | end |
||
985 | |||
986 | InviteOMatic.debug("Resetting Decline list..."); |
||
987 | IOM_DECLINE = {}; |
||
988 | end |
||
989 | |||
990 | ---------------------------------------------------------------------- |
||
991 | -- Resets IGNORE list |
||
992 | ---------------------------------------------------------------------- |
||
993 | function InviteOMatic_ResetIgnore() |
||
994 | if( not IOM_READY ) then |
||
995 | return; |
||
996 | end |
||
997 | if( InviteOMatic_IsDisabled() ) then |
||
998 | return; |
||
999 | end |
||
1000 | |||
1001 | InviteOMatic.debug("Resetting Ignore list..."); |
||
1002 | IOM_IGNORE = {}; |
||
1003 | end |
||
1004 | |||
1005 | ---------------------------------------------------------------------- |
||
1006 | -- Player Joined Group |
||
1007 | ---------------------------------------------------------------------- |
||
1008 | function InviteOMatic_PlayerJoinedGroup(name) |
||
1009 | if( IOM_BG_ACTIVE ) then |
||
1010 | InviteOMatic_MakeRaid(); |
||
1011 | |||
1012 | IOM_AIG[name] = nil; |
||
1013 | IOM_AIG_ERROR[name] = nil; |
||
1014 | IOM_IGNORE[name] = nil; |
||
1015 | IOM_DECLINE[name] = nil; |
||
1016 | |||
1017 | end |
||
1018 | end |
||
1019 | |||
1020 | ---------------------------------------------------------------------- |
||
1021 | -- Player Joined Battle |
||
1022 | ---------------------------------------------------------------------- |
||
1023 | function InviteOMatic_PlayerJoinedBattle(name) |
||
1024 | |||
1025 | if( InviteOMaticOptions["autoInvite"] ) then |
||
1026 | InviteOMatic.invite(name); |
||
1027 | end |
||
1028 | end |
||
1029 | |||
1030 | ---------------------------------------------------------------------- |
||
1031 | -- Player Left Battle |
||
1032 | ---------------------------------------------------------------------- |
||
1033 | function InviteOMatic_PlayerLeftBattle(name) |
||
1034 | -- If purge is enabled, then uninvite this player |
||
1035 | |||
1036 | if( InviteOMaticOptions["autoPurge"] ) then |
||
1037 | if( IsRaidLeader() or IsRaidOfficer() or IsPartyLeader() ) then |
||
1038 | for i=1,GetNumRaidMembers() do |
||
1039 | --Remove player from raid |
||
1040 | local name2 = GetRaidRosterInfo(i); |
||
1041 | if( name == name2 ) then |
||
1042 | UninviteByName(name); |
||
1043 | return; |
||
1044 | end |
||
1045 | end |
||
1046 | if( GetNumRaidMembers() == 0 ) then |
||
1047 | UninviteByName(name); |
||
1048 | end |
||
1049 | end |
||
1050 | end |
||
1051 | end |
||
1052 | |||
1053 | ---------------------------------------------------------------------- |
||
1054 | -- Player Declined |
||
1055 | ---------------------------------------------------------------------- |
||
1056 | function InviteOMatic_PlayerDeclined(name) |
||
1057 | -- Player declined our group invite |
||
1058 | if( IOM_DECLINE[name] == nil ) then |
||
1059 | IOM_DECLINE[name] = 1; |
||
1060 | else |
||
1061 | IOM_DECLINE[name] = IOM_DECLINE[name] + 1; |
||
1062 | |||
1063 | if( IOM_DECLINE[name] > InviteOMaticOptions["declinettl"] ) then |
||
1064 | IOM_DECLINE[name] = InviteOMaticOptions["declinettl"]; |
||
1065 | end |
||
1066 | end |
||
1067 | |||
1068 | InviteOMatic.debug(name.." declined invitation "..(InviteOMaticOptions["declinettl"] - IOM_DECLINE[name]).." retries left"); |
||
1069 | |||
1070 | end |
||
1071 | |||
1072 | ---------------------------------------------------------------------- |
||
1073 | -- Player Ignores |
||
1074 | ---------------------------------------------------------------------- |
||
1075 | function InviteOMatic_PlayerIgnores(name) |
||
1076 | -- Player ignored you |
||
1077 | if( IOM_IGNORE[name] == nil ) then |
||
1078 | IOM_IGNORE[name] = 0; |
||
1079 | else |
||
1080 | IOM_IGNORE[name] = IOM_IGNORE[name] + 1; |
||
1081 | |||
1082 | if( IOM_IGNORE[name] > InviteOMaticOptions["ignorettl"] ) then |
||
1083 | IOM_IGNORE[name] = InviteOMaticOptions["ignorettl"]; |
||
1084 | end |
||
1085 | end |
||
1086 | |||
1087 | InviteOMatic.debug(name.." ingored you "..(InviteOMaticOptions["ignorettl"] - IOM_IGNORE[name]).." retries left"); |
||
1088 | |||
1089 | end |
||
1090 | |||
1091 | ---------------------------------------------------------------------- |
||
1092 | -- Player Already in group |
||
1093 | ---------------------------------------------------------------------- |
||
1094 | function InviteOMatic_PlayerAlreadyGrouped(name) |
||
1095 | -- Player is already grouped |
||
1096 | if( IOM_AIG[name] == nil ) then |
||
1097 | IOM_AIG[name] = 0; |
||
1098 | else |
||
1099 | IOM_AIG[name] = IOM_AIG[name] + 1; |
||
1100 | |||
1101 | if( IOM_AIG[name] > InviteOMaticOptions["aigttl"] ) then |
||
1102 | IOM_AIG[name] = InviteOMaticOptions["aigttl"]; |
||
1103 | end |
||
1104 | end |
||
1105 | |||
1106 | InviteOMatic.debug(name.." was already in group "..(InviteOMaticOptions["aigttl"] - IOM_AIG[name]).." retries left"); |
||
1107 | |||
1108 | end |
||
1109 | |||
1110 | ---------------------------------------------------------------------- |
||
1111 | -- Called when InviteOMatic detects that you have left a BG |
||
1112 | ---------------------------------------------------------------------- |
||
1113 | function InviteOMatic_LeftBG() |
||
1114 | IOM_BG_ACTIVE_INDEX = -1; |
||
1115 | IOM_BG_ACTIVE = false; |
||
1116 | IOM_LAST_INVITE = 0; |
||
1117 | IOM_INVITE_FIRST = true; |
||
1118 | |||
1119 | IOM_AIG = {}; |
||
1120 | IOM_AIG_ERROR = {}; |
||
1121 | IOM_DECLINE = {}; |
||
1122 | IOM_IGNORE = {}; |
||
1123 | |||
1124 | IOM_GROUPBUG = {}; |
||
1125 | |||
1126 | |||
1127 | InviteOMatic.debug("You left the BattleGround"); |
||
1128 | |||
1129 | IOM_UPDATE_PURGE_TIMER = false; |
||
1130 | IOM_UPDATE_INVITE_TIMER = false; |
||
1131 | |||
1132 | this:UnregisterEvent("CHAT_MSG_SYSTEM"); |
||
1133 | end |
||
1134 | |||
1135 | ---------------------------------------------------------------------- |
||
1136 | -- Called On_Update |
||
1137 | ---------------------------------------------------------------------- |
||
1138 | function InviteOMatic_OnUpdate(dt) |
||
1139 | if( not IOM_READY ) then |
||
1140 | return; |
||
1141 | end |
||
1142 | if( InviteOMatic_IsDisabled() ) then |
||
1143 | return; |
||
1144 | end |
||
1145 | |||
1146 | if( dt == nil ) then |
||
1147 | return; |
||
1148 | end |
||
1149 | |||
1150 | if( not IOM_READY ) then |
||
1151 | return; |
||
1152 | end |
||
1153 | |||
1154 | if( IOM_UPDATE_INVITE_TIMER ) then |
||
1155 | IOM_INVITE_TIMER = IOM_INVITE_TIMER - dt; |
||
1156 | if( IOM_INVITE_TIMER <= 0 ) then |
||
1157 | InviteOMatic.debug("Invite Timer fired..."); |
||
1158 | IOM_INVITE_TIMER = InviteOMaticOptions.inviteDelay; |
||
1159 | if( InviteOMaticOptions.autoInvite ) then |
||
1160 | InviteOMatic_SendInvites(); |
||
1161 | end |
||
1162 | end |
||
1163 | end |
||
1164 | |||
1165 | if( IOM_UPDATE_PURGE_TIMER ) then |
||
1166 | IOM_PURGE_TIMER = IOM_PURGE_TIMER - dt; |
||
1167 | if( IOM_PURGE_TIMER <= 0 ) then |
||
1168 | InviteOMatic.debug("Purge Timer fired..."); |
||
1169 | IOM_PURGE_TIMER = InviteOMaticOptions.purgeDelay; |
||
1170 | if( InviteOMaticOptions.autoPurge ) then |
||
1171 | InviteOMatic_DoPurge(); |
||
1172 | end |
||
1173 | end |
||
1174 | end |
||
1175 | end |
||
1176 | |||
1177 | ---------------------------------------------------------------------- |
||
1178 | -- Logs the msg to the default chat frame |
||
1179 | -- |
||
1180 | -- @param msg The message to output |
||
1181 | ---------------------------------------------------------------------- |
||
1182 | function IOM_PrintMsg(msg) |
||
1183 | if( not IOM_READY ) then |
||
1184 | return; |
||
1185 | end |
||
1186 | if( InviteOMatic_IsDisabled() ) then |
||
1187 | return; |
||
1188 | end |
||
1189 | |||
1190 | if (DEFAULT_CHAT_FRAME) then |
||
1191 | DEFAULT_CHAT_FRAME:AddMessage(msg); |
||
1192 | end |
||
1193 | end |
||
1194 | |||
1195 | ---------------------------------------------------------------------- |
||
1196 | -- Logs the debug msg to the default chat frame |
||
1197 | -- |
||
1198 | -- @param msg The message to output |
||
1199 | ---------------------------------------------------------------------- |
||
1200 | function IOM_PrintDebugMsg(msg) |
||
1201 | if( InviteOMaticOptions["debug"] ) then |
||
1202 | InviteOMatic.log("IOM Debug - "..msg); |
||
1203 | end |
||
1204 | end |
||
1205 | |||
1206 | ---------------------------------------------------------------------- |
||
1207 | -- Checks if addon has been disabled in Khaos, and disables addon accordingly :) |
||
1208 | ---------------------------------------------------------------------- |
||
1209 | function InviteOMatic_IsDisabled() |
||
1210 | if( Khaos ) then |
||
1211 | return not Khaos.getSetEnabled("InviteOMatic"); |
||
1212 | else |
||
1213 | -- InviteOMatic.log("Khaos not detected, so cant check status"); |
||
1214 | return false; |
||
1215 | end |
||
1216 | end |
||
1217 | |||
1218 | |||
1219 | ---------------------------------------------------------------------- |
||
1220 | -- Register a Khaos config |
||
1221 | ---------------------------------------------------------------------- |
||
1222 | function InviteOMatic_RegisterKhaos() |
||
1223 | if( Khaos ) then |
||
1224 | Khaos.registerFolder( |
||
1225 | { |
||
1226 | id = "invite"; |
||
1227 | text = "Invite"; |
||
1228 | helptext = "Invite helpers"; |
||
1229 | difficulty = 1; |
||
1230 | } |
||
1231 | ); |
||
1232 | local optionSet = |
||
1233 | { |
||
1234 | id="InviteOMatic"; |
||
1235 | text="InviteOMatic"; |
||
1236 | helptext="Invite Helper, with a twist!"; |
||
1237 | difficulty=1; |
||
1238 | options = { |
||
1239 | { |
||
1240 | id="InviteHeader"; |
||
1241 | text="InviteOMatic Settings"; |
||
1242 | helptext="InviteOMatic"; |
||
1243 | type = K_HEADER; |
||
1244 | }; |
||
1245 | { |
||
1246 | id="InviteAutoInvite"; |
||
1247 | text="Auto Invite"; |
||
1248 | helptext="Automatically invites everyone in a BG instance."; |
||
1249 | type = K_TEXT; |
||
1250 | check = true; |
||
1251 | callback = InviteOMatic_InviteAutoInviteCheck; |
||
1252 | feedback = function(state) end; |
||
1253 | default = { |
||
1254 | checked = true; |
||
1255 | }; |
||
1256 | disabled = { |
||
1257 | checked = false; |
||
1258 | }; |
||
1259 | }; |
||
1260 | { |
||
1261 | id="InviteAutoPurge"; |
||
1262 | text="Auto Purge"; |
||
1263 | helptext="Automatically purges offline players, and players that leaves the BG."; |
||
1264 | type = K_TEXT; |
||
1265 | check = true; |
||
1266 | callback = InviteOMatic_InviteAutoPurgeCheck; |
||
1267 | feedback = function(state) end; |
||
1268 | default = { |
||
1269 | checked = true; |
||
1270 | }; |
||
1271 | disabled = { |
||
1272 | checked = false; |
||
1273 | }; |
||
1274 | }; |
||
1275 | { |
||
1276 | id="InviteWhisperInvite"; |
||
1277 | text="Whisper Invite"; |
||
1278 | helptext="Automatically invites people whispering you the magic word 'invite'"; |
||
1279 | type = K_TEXT; |
||
1280 | check = true; |
||
1281 | callback = InviteOMatic_InviteWhisperCheck; |
||
1282 | feedback = function(state) end; |
||
1283 | default = { |
||
1284 | checked = true; |
||
1285 | }; |
||
1286 | disabled = { |
||
1287 | checked = false; |
||
1288 | }; |
||
1289 | }; |
||
1290 | { |
||
1291 | id="InviteDelay"; |
||
1292 | key="InviteDelay"; |
||
1293 | value=true; |
||
1294 | text="Time between invites:"; |
||
1295 | helptext="This value represents the time InviteOMatic will wait between each invite cycle, the value is in seconds."; |
||
1296 | type = K_SLIDER; |
||
1297 | check = false; |
||
1298 | setup = { |
||
1299 | sliderMin = 1; |
||
1300 | sliderMax = 20; |
||
1301 | sliderLowText = "Fast"; |
||
1302 | sliderHighText = "Slow"; |
||
1303 | sliderStep = 1; |
||
1304 | sliderText = "Invite Cycle"; |
||
1305 | sliderDisplayfunc = function (state) return state.slider; end; |
||
1306 | }; |
||
1307 | callback = InviteOMatic_InviteCycleSliderCallback; |
||
1308 | feedback = function(state) end; |
||
1309 | default = { |
||
1310 | slider = 10; |
||
1311 | }; |
||
1312 | disabled = { |
||
1313 | slider = 10; |
||
1314 | }; |
||
1315 | }; |
||
1316 | { |
||
1317 | id="PurgeDelay"; |
||
1318 | key="PurgeDelay"; |
||
1319 | value=true; |
||
1320 | text="Time between purges:"; |
||
1321 | helptext="This value represents the time InviteOMatic will wait between each purge cycle, the value is in seconds."; |
||
1322 | type = K_SLIDER; |
||
1323 | check = false; |
||
1324 | setup = { |
||
1325 | sliderMin = 1; |
||
1326 | sliderMax = 20; |
||
1327 | sliderLowText = "Fast"; |
||
1328 | sliderHighText = "Slow"; |
||
1329 | sliderStep = 1; |
||
1330 | sliderText = "Purge Cycle"; |
||
1331 | sliderDisplayfunc = function (state) return state.slider; end; |
||
1332 | }; |
||
1333 | callback = InviteOMatic_PurgeCycleSliderCallback; |
||
1334 | feedback = function(state) end; |
||
1335 | default = { |
||
1336 | slider = 10; |
||
1337 | }; |
||
1338 | disabled = { |
||
1339 | slider = 10; |
||
1340 | }; |
||
1341 | }; |
||
1342 | { |
||
1343 | id="InviteRetryHeader"; |
||
1344 | text="InviteOMatic Retry Settings"; |
||
1345 | helptext="InviteOMatic"; |
||
1346 | type = K_HEADER; |
||
1347 | }; |
||
1348 | { |
||
1349 | id="InviteAIGRetry"; |
||
1350 | value=true; |
||
1351 | text="Already in group retries:"; |
||
1352 | helptext="Number of retries to invite people that are already in group."; |
||
1353 | type = K_SLIDER; |
||
1354 | check = false; |
||
1355 | setup = { |
||
1356 | sliderMin = 0; |
||
1357 | sliderMax = 20; |
||
1358 | sliderLowText = "None"; |
||
1359 | sliderHighText = "Many"; |
||
1360 | sliderStep = 1; |
||
1361 | sliderText = "Number of Retries"; |
||
1362 | sliderDisplayfunc = function (state) return state.slider; end; |
||
1363 | }; |
||
1364 | callback = InviteOMatic_InviteAIGRetry; |
||
1365 | feedback = function(state) end; |
||
1366 | default = { |
||
1367 | slider = 10; |
||
1368 | }; |
||
1369 | disabled = { |
||
1370 | slider = 10; |
||
1371 | }; |
||
1372 | }; |
||
1373 | { |
||
1374 | id="InviteDeclineRetry"; |
||
1375 | key="InviteDeclineRetry"; |
||
1376 | value=true; |
||
1377 | text="Decline retries:"; |
||
1378 | helptext="Number of retries to invite people that decline an invitation."; |
||
1379 | type = K_SLIDER; |
||
1380 | check = false; |
||
1381 | setup = { |
||
1382 | sliderMin = 0; |
||
1383 | sliderMax = 10; |
||
1384 | sliderLowText = "None"; |
||
1385 | sliderHighText = "Many"; |
||
1386 | sliderStep = 1; |
||
1387 | sliderText = "Number of Retries"; |
||
1388 | sliderDisplayfunc = function (state) return state.slider; end; |
||
1389 | }; |
||
1390 | callback = InviteOMatic_InviteDeclineRetry; |
||
1391 | feedback = function(state) end; |
||
1392 | default = { |
||
1393 | slider = 1; |
||
1394 | }; |
||
1395 | disabled = { |
||
1396 | slider = 1; |
||
1397 | }; |
||
1398 | }; |
||
1399 | { |
||
1400 | id="InviteIgnoreRetry"; |
||
1401 | key="InviteIgnoreRetry"; |
||
1402 | value=true; |
||
1403 | text="Ignore retries:"; |
||
1404 | helptext="Number of retries to invite people that are ignoring you."; |
||
1405 | type = K_SLIDER; |
||
1406 | check = false; |
||
1407 | setup = { |
||
1408 | sliderMin = 0; |
||
1409 | sliderMax = 10; |
||
1410 | sliderLowText = "None"; |
||
1411 | sliderHighText = "Many"; |
||
1412 | sliderStep = 1; |
||
1413 | sliderText = "Number of Retries"; |
||
1414 | sliderDisplayfunc = function (state) return state.slider; end; |
||
1415 | }; |
||
1416 | callback = InviteOMatic_InviteIgnoreRetry; |
||
1417 | feedback = function(state) end; |
||
1418 | default = { |
||
1419 | slider = 1; |
||
1420 | }; |
||
1421 | disabled = { |
||
1422 | slider = 1; |
||
1423 | }; |
||
1424 | }; |
||
1425 | { |
||
1426 | id="InviteMagicHeader"; |
||
1427 | text="InviteOMatic Magic Word"; |
||
1428 | helptext="InviteOMatic"; |
||
1429 | type = K_HEADER; |
||
1430 | }; |
||
1431 | { |
||
1432 | id="InviteMagicWord"; |
||
1433 | value={IOM_INVITE_REG_EXP}; |
||
1434 | text="Magic Word (REGEXP)"; |
||
1435 | helptext="A reqular expression for the magic invite word."; |
||
1436 | type = K_EDITBOX; |
||
1437 | callback = InivteOMatic_InviteMagicWord; |
||
1438 | feedback = function(state) end; |
||
1439 | |||
1440 | setup = { |
||
1441 | callOn = {"enter"}; |
||
1442 | multiLine = true; |
||
1443 | }; |
||
1444 | default = { |
||
1445 | value = IOM_INVITE_REG_EXP; |
||
1446 | }; |
||
1447 | disabled = { |
||
1448 | value = ""; |
||
1449 | }; |
||
1450 | }; |
||
1451 | { |
||
1452 | id="InviteMsgHeader"; |
||
1453 | text="InviteOMatic Messages"; |
||
1454 | helptext="InviteOMatic"; |
||
1455 | type = K_HEADER; |
||
1456 | }; |
||
1457 | { |
||
1458 | id="InviteSendSpam"; |
||
1459 | text="Send spam message at invite"; |
||
1460 | helptext="Should the addon send a spam message over SAY when doing first invite."; |
||
1461 | type = K_TEXT; |
||
1462 | check = true; |
||
1463 | callback = InviteOMatic_SendSpamOption; |
||
1464 | feedback = function(state) end; |
||
1465 | default = { |
||
1466 | checked = true; |
||
1467 | }; |
||
1468 | disabled = { |
||
1469 | checked = false; |
||
1470 | }; |
||
1471 | }; |
||
1472 | { |
||
1473 | id="InviteSpamMsg"; |
||
1474 | value={IOM_FIRST_INVITE_SPAM_DEFAULT}; |
||
1475 | text="Invite Spam Message"; |
||
1476 | helptext="Message to spam when doing first invite round."; |
||
1477 | type = K_EDITBOX; |
||
1478 | callback = InivteOMatic_InviteSpamMsg; |
||
1479 | feedback = function(state) end; |
||
1480 | |||
1481 | setup = { |
||
1482 | callOn = {"enter"}; |
||
1483 | multiLine = true; |
||
1484 | }; |
||
1485 | default = { |
||
1486 | value = IOM_FIRST_INVITE_SPAM_DEFAULT; |
||
1487 | }; |
||
1488 | disabled = { |
||
1489 | value = ""; |
||
1490 | }; |
||
1491 | }; |
||
1492 | { |
||
1493 | id="InviteSendAIGSpam"; |
||
1494 | text="Send AIG spam"; |
||
1495 | helptext="Should a message be sent to a player who has reached the max number of Already in group retries."; |
||
1496 | type = K_TEXT; |
||
1497 | check = true; |
||
1498 | callback = InviteOMatic_SendAIGSpamOption; |
||
1499 | feedback = function(state) end; |
||
1500 | default = { |
||
1501 | checked = true; |
||
1502 | }; |
||
1503 | disabled = { |
||
1504 | checked = false; |
||
1505 | }; |
||
1506 | }; |
||
1507 | { |
||
1508 | id="InviteAIGSpamMsg"; |
||
1509 | value={IOM_ERROR_AIG_DEFAULT}; |
||
1510 | text="AIG Spam Message"; |
||
1511 | helptext="Message to send to a player who reaches the maximum number of Already in group retries."; |
||
1512 | type = K_EDITBOX; |
||
1513 | callback = InivteOMatic_AIGSpamMsg; |
||
1514 | feedback = function(state) end; |
||
1515 | setup = { |
||
1516 | callOn = {"enter"}; |
||
1517 | multiLine = true; |
||
1518 | }; |
||
1519 | default = { |
||
1520 | value = IOM_ERROR_AIG_DEFAULT; |
||
1521 | }; |
||
1522 | disabled = { |
||
1523 | value = ""; |
||
1524 | }; |
||
1525 | }; |
||
1526 | { |
||
1527 | id="InviteDebug"; |
||
1528 | text="Show debug messages"; |
||
1529 | helptext="Disable/Enable showing of debug strings, messages. (Mostly used for development)"; |
||
1530 | type = K_TEXT; |
||
1531 | check = true; |
||
1532 | callback = InviteOMatic_InviteDebugCheck; |
||
1533 | feedback = function(state) end; |
||
1534 | default = { |
||
1535 | checked = false; |
||
1536 | }; |
||
1537 | disabled = { |
||
1538 | checked = false; |
||
1539 | }; |
||
1540 | }; |
||
1541 | { |
||
1542 | id="InviteClearHeader"; |
||
1543 | text="InviteOMatic Clear Lists"; |
||
1544 | helptext="InviteOMatic"; |
||
1545 | type = K_HEADER; |
||
1546 | }; |
||
1547 | { |
||
1548 | id="InviteResetAIG"; |
||
1549 | text="Reset Already in group"; |
||
1550 | helptext="Resets the list of players that are already in a group"; |
||
1551 | type = K_BUTTON; |
||
1552 | callback = InviteOMatic_ResetAIG; |
||
1553 | setup={buttonText="Reset AIG"}; |
||
1554 | }; |
||
1555 | { |
||
1556 | id="InviteResetDecline"; |
||
1557 | text="Reset Decline"; |
||
1558 | helptext="Resets the list of players that declined the invite"; |
||
1559 | type = K_BUTTON; |
||
1560 | callback = InviteOMatic_ResetDecline; |
||
1561 | setup={buttonText="Reset Declines"}; |
||
1562 | }; |
||
1563 | { |
||
1564 | id="InviteResetIgnore"; |
||
1565 | text="Reset Ignore"; |
||
1566 | helptext="Resets the list of players that ignored you"; |
||
1567 | type = K_BUTTON; |
||
1568 | callback = InviteOMatic_ResetIgnore; |
||
1569 | setup={buttonText="Reset Ignores"}; |
||
1570 | }; |
||
1571 | }; |
||
1572 | default = true; |
||
1573 | }; |
||
1574 | |||
1575 | Khaos.registerOptionSet( |
||
1576 | "invite", optionSet |
||
1577 | ); |
||
1578 | else |
||
1579 | InviteOMatic.debug("Khaos not found"); |
||
1580 | end |
||
1581 | end |
||
1582 | |||
1583 | function InviteOMatic_InviteAutoInviteCheck(state) |
||
1584 | if( state.checked ) then |
||
1585 | InviteOMatic.debug("Auto invite enabled"); |
||
1586 | InviteOMaticOptions["autoInvite"] = true; |
||
1587 | |||
1588 | if( IOM_BG_ACTIVE ) then |
||
1589 | IOM_UPDATE_INVITE_TIMER = true; |
||
1590 | end |
||
1591 | |||
1592 | else |
||
1593 | InviteOMatic.debug("Auto invite disabled"); |
||
1594 | InviteOMaticOptions["autoInvite"] = false; |
||
1595 | |||
1596 | IOM_UPDATE_INVITE_TIMER = false; |
||
1597 | end |
||
1598 | end |
||
1599 | |||
1600 | function InviteOMatic_InviteWhisperCheck(state) |
||
1601 | if( state.checked ) then |
||
1602 | InviteOMatic.debug("Whisper invite enabled"); |
||
1603 | InviteOMaticOptions["whisperInvite"] = true; |
||
1604 | |||
1605 | else |
||
1606 | InviteOMatic.debug("Whisper invite disabled"); |
||
1607 | InviteOMaticOptions["whisperInvite"] = false; |
||
1608 | end |
||
1609 | end |
||
1610 | |||
1611 | function InviteOMatic_InviteAutoPurgeCheck(state) |
||
1612 | if( state.checked ) then |
||
1613 | InviteOMatic.debug("Auto purge enabled"); |
||
1614 | InviteOMaticOptions["autoPurge"] = true; |
||
1615 | |||
1616 | if( IOM_BG_ACTIVE ) then |
||
1617 | IOM_UPDATE_PURGE_TIMER = true; |
||
1618 | end |
||
1619 | |||
1620 | else |
||
1621 | InviteOMatic.debug("Auto purge disabled"); |
||
1622 | InviteOMaticOptions["autoPurge"] = false; |
||
1623 | |||
1624 | IOM_UPDATE_PURGE_TIMER = false; |
||
1625 | end |
||
1626 | end |
||
1627 | |||
1628 | function InviteOMatic_InviteIgnoreRetry(state) |
||
1629 | InviteOMatic.debug("Ignore retries set to: "..state.slider); |
||
1630 | InviteOMaticOptions["ignorettl"] = state.slider; |
||
1631 | |||
1632 | -- Update old TTL values, if one is bigger |
||
1633 | |||
1634 | end |
||
1635 | |||
1636 | function InviteOMatic_InviteDeclineRetry(state) |
||
1637 | InviteOMatic.debug("Decline retries set to: "..state.slider); |
||
1638 | InviteOMaticOptions["declinettl"] = state.slider; |
||
1639 | |||
1640 | -- Update old TTL values, if one is bigger |
||
1641 | |||
1642 | end |
||
1643 | |||
1644 | function InviteOMatic_InviteAIGRetry(state) |
||
1645 | InviteOMatic.debug("Already in group retries set to: "..state.slider); |
||
1646 | InviteOMaticOptions["aigttl"] = state.slider; |
||
1647 | |||
1648 | -- Update old TTL values, if one is bigger |
||
1649 | |||
1650 | end |
||
1651 | |||
1652 | function InviteOMatic_SendAIGSpamOption(state) |
||
1653 | if( state.checked ) then |
||
1654 | InviteOMatic.debug("Sending spam message when max aig retries is reached."); |
||
1655 | InviteOMatic.sendAIGSpam = true; |
||
1656 | else |
||
1657 | InviteOMatic.debug("Not sending spam message when max aig retries is reached."); |
||
1658 | InviteOMatic.sendAIGSpam = false; |
||
1659 | end |
||
1660 | end |
||
1661 | |||
1662 | function InviteOMatic_SendSpamOption(state) |
||
1663 | if( state.checked ) then |
||
1664 | InviteOMatic.debug("Sending spam message at first invite"); |
||
1665 | InviteOMaticOptions["sendInviteSpam"] = true; |
||
1666 | else |
||
1667 | InviteOMatic.debug("Not sending spam message at first invite"); |
||
1668 | InviteOMaticOptions["sendInviteSpam"] = false; |
||
1669 | end |
||
1670 | end |
||
1671 | |||
1672 | function InviteOMatic_InviteDebugCheck(state) |
||
1673 | if( state.checked ) then |
||
1674 | InviteOMatic.debug("Debug output enabled."); |
||
1675 | InviteOMaticOptions["debug"] = true; |
||
1676 | else |
||
1677 | InviteOMatic.debug("Debug output disabled."); |
||
1678 | InviteOMaticOptions["debug"] = false; |
||
1679 | end |
||
1680 | end |
||
1681 | |||
1682 | function InviteOMatic_PurgeCycleSliderCallback(state) |
||
1683 | InviteOMatic.debug("Purge Cycle set to: "..state.slider.." seconds"); |
||
1684 | InviteOMaticOptions["purgeDelay"] = state.slider; |
||
1685 | |||
1686 | IOM_PURGE_TIMER = InviteOMaticOptions["purgeDelay"]; |
||
1687 | end; |
||
1688 | |||
1689 | function InviteOMatic_InviteCycleSliderCallback(state) |
||
1690 | InviteOMatic.debug("Invite Cycle set to: "..state.slider.." seconds"); |
||
1691 | InviteOMaticOptions["inviteDelay"] = state.slider; |
||
1692 | |||
1693 | IOM_INVITE_TIMER = InviteOMaticOptions["inviteDelay"]; |
||
1694 | |||
1695 | end; |
||
1696 | |||
1697 | function InivteOMatic_InviteMagicWord(state) |
||
1698 | InviteOMaticOptions["magicWord"] = state.value; |
||
1699 | InviteOMatic.debug("Magic word regexp set to: "..InviteOMaticOptions["magicWord"]); |
||
1700 | end; |
||
1701 | |||
1702 | function InivteOMatic_InviteSpamMsg(state) |
||
1703 | InviteOMaticOptions["inviteMsg"] = state.value; |
||
1704 | InviteOMatic.debug("First spam message set to: "..InviteOMaticOptions["inviteMsg"]); |
||
1705 | end; |
||
1706 | |||
1707 | function InivteOMatic_AIGSpamMsg(state) |
||
1708 | InviteOMaticOptions["aigMsg"] = state.value; |
||
1709 | InviteOMatic.debug("AIG spam message set to: "..InviteOMaticOptions["aigMsg"]); |
||
1710 | end; |
||
1711 | |||
1712 | InviteOMatic = { |
||
1713 | log = IOM_PrintMsg, |
||
1714 | debug = IOM_PrintDebugMsg, |
||
1715 | invite = InviteOMatic_InvitePlayer, |
||
1716 | sendInvites = InviteOMatic_SendInvites, |
||
1717 | disbandGroup = InviteOMatic_DisbandRaidGroup, |
||
1718 | } |