vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 assert( oRA, "oRA not found!")
2  
3 ------------------------------
4 -- Are you local? --
5 ------------------------------
6  
7 local L = AceLibrary("AceLocale-2.2"):new("oRALInvite")
8  
9 ----------------------------
10 -- Localization --
11 ----------------------------
12  
13 L:RegisterTranslations("enUS", function() return {
14 ["inviteleader"] = true,
15 ["invite"] = true,
16 ["Invite"] = true,
17 ["Leader/Invite"] = true,
18 ["<oRA> Sorry, the group is full."] = true,
19 ["Inviting: "] = true,
20 ["^([^%s]+) has joined the raid group"] = true,
21 ["Autopromoting: "] = true,
22 ["Keyword inviting disabled."] = true,
23 ["Invitation keyword set to: "] = true,
24 ["To turn off keyword inviting set it to 'off'."] = true,
25 ["<oRA> Raid disbanding on request by: "] = true,
26 ["Disabling Auto-Promote for: "] = true,
27 ["Enabling Auto-Promote for: "] = true,
28 ["Autopromoting: "] = true,
29 ["You have no-one in your Auto-Promote list"] = true,
30 ["Options for invite."] = true,
31 ["Autopromote"] = true,
32 ["autopromote"] = true,
33 ["Set/Unset an autopromotion."] = true,
34 ["<name>"] = true,
35 ["keyword"] = true,
36 ["Keyword"] = true,
37 ["Set/Unset an invitation keyword."] = true,
38 ["<keyword>"] = true,
39 ["disband"] = true,
40 ["Disband"] = true,
41 ["Disband the raid."] = true,
42 ["list"] = true,
43 ["List"] = true,
44 ["List autopromotions."] = true,
45 ["guild"] = true,
46 ["Invite Guild"] = true,
47 ["Invite all level 60 characters in the guild to raid."] = true,
48 ["You are not in a guild."] = true,
49 ["You are not in a raid group."] = true,
50 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = true,
51 ["off"] = true,
52 } end )
53  
54 L:RegisterTranslations("deDE", function() return {
55 ["<oRA> Sorry, the group is full."] = "<oRA> Sorry, die Gruppe ist voll",
56 ["Inviting: "] = "Einladen: ",
57 ["^([^%s]+) has joined the raid group"] = "^([^%s]+) hat sich der Schlachtgruppe angeschlossen",
58 ["Autopromoting: "] = "Autobef\195\182rderung: ",
59 ["Keyword inviting disabled."] = "Passwort Einladungen deaktiviert.",
60 ["Invitation keyword set to: "] = "Einladungs-Passwort gesetzt auf: ",
61 ["To turn off keyword inviting set it to 'off'."] = "Auf 'off' setzen um Passwort Einladungen zu deaktivieren",
62 ["<oRA> Raid disbanding on request by: "] = "<oRA> Schlachtzugsaufl\195\182sung angefordert von: ",
63 ["Disabling Auto-Promote for: "] = "Autobef\195\182rdung deaktiviert f\195\188r: ",
64 ["Enabling Auto-Promote for: "] = "Autobef\195\182rdung aktiviert f\195\188r: ",
65 ["Autopromoting: "] = "Autobef\195\182rdung: ",
66 ["You have no-one in your Auto-Promote list"] = "Ihr habt keinen in der Autobef\195\182rderungsliste",
67 ["Options for invite."] = "Einladungs Optionen",
68 ["Autopromote"] = "Autobef\195\182rdung",
69 ["Set/Unset an autopromotion."] = "Autobef\195\182rdung setzen/l\195\182schen",
70 ["Keyword"] = "Passwort",
71 ["Set/Unset an invitation keyword."] = "Einladungs-Passwort setzen/l\195\182schen",
72 ["Disband"] = "Aufl\195\182sen",
73 ["Disband the raid."] = "Schlachtzug aufl\195\182sen",
74 ["List"] = "Auflisten",
75 ["List autopromotions."] = "Autobef\195\182rderungen auflisten",
76 ["Invite Guild"] = "Gilde einladen",
77 ["Invite all level 60 characters in the guild to raid."] = "Alle level 60 Charaktere in der Gilde in den Schlachtzug einladen.",
78 ["You are not in a guild."] = "Ihr seid nicht in einer Gilde.",
79 ["You are not in a raid group."] = "Ihr seid nicht in einer Schlachtzugs Gruppe.",
80 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = "Alle Charakter der Stufe 60 werde in 10 Sekunden eingeladen. Bitte verlasst eure Gruppen.",
81 } end )
82  
83 L:RegisterTranslations("koKR", function() return {
84  
85 ["Invite"] = "초대",
86 ["Leader/Invite"] = "공격대장/초대",
87 ["<oRA> Sorry, the group is full."] = "<oRA> 죄송합니다. 공격대의 정원이 찼습니다",
88 ["Inviting: "] = "초대",
89 ["^([^%s]+) has joined the raid group"] = "^(.+)님이 공격대에 합류했습니다",
90 ["Autopromoting: "] = "자동승급",
91 ["Keyword inviting disabled."] = "키워드 초대 기능을 사용하지 않습니다",
92 ["Invitation keyword set to: "] = "초대 키워드 설정",
93 ["To turn off keyword inviting set it to 'off'."] = "키워드를 '끔'으로 설정하면 키워드 초대 기능을 사용하지 않습니다.",
94 ["<oRA> Raid disbanding on request by: "] = "<oRA> 공격대 해산 요청: ",
95 ["Disabling Auto-Promote for: "] = "자동승급 사용안함: ",
96 ["Enabling Auto-Promote for: "] = "자동승급 사용: ",
97 ["Autopromoting: "] = "자동승급: ",
98 ["You have no-one in your Auto-Promote list"] = "자동승급 목록이 비어 있습니다",
99 ["Options for invite."] = "초대 설정",
100 ["Autopromote"] = "자동승급",
101 ["Set/Unset an autopromotion."] = "자동승급 대상을 설정/설정해지 합니다.",
102 ["<name>"] = "<이름>",
103 ["Keyword"] = "키워드",
104 ["Set/Unset an invitation keyword."] = "초대 키워드를 설정/설정해지 합니다.",
105 ["<keyword>"] = "<키워드>",
106 ["Disband"] = "해산",
107 ["Disband the raid."] = "공격대를 해산합니다.",
108 ["List"] = "목록",
109 ["List autopromotions."] = "자동승급 목록을 출력합니다",
110 ["Invite Guild"] = "길드원 초대",
111 ["Invite all level 60 characters in the guild to raid."] = "길드의 60레벨 길드원을 모두 공격대에 초대합니다.",
112 ["You are not in a guild."] = "길드에 속해 있지 않습니다",
113 ["You are not in a raid group."] = "공격대에 속해 있지 않습니다",
114 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = "10초 동안 60레벨의 길드원을 공격대에 초대합니다. 파티에서 나와 주세요.",
115 ["off"] = "끔",
116 } end )
117  
118 L:RegisterTranslations("zhCN", function() return {
119 ["inviteleader"] = "邀请助手",
120 ["invite"] = "邀请",
121 ["Invite"] = "邀请",
122 ["Leader/Invite"] = "Leader/Invite",
123 ["<oRA> Sorry, the group is full."] = "<oRA>抱歉,团队已满",
124 ["Inviting: "] = "邀请",
125 ["^([^%s]+) has joined the raid group"] = "^([^%s]+) 加入了队伍",
126 ["Autopromoting: "] = "自动提升",
127 ["Keyword inviting disabled."] = "禁止关键字邀请",
128 ["Invitation keyword set to: "] = "邀请关键字设置为",
129 ["To turn off keyword inviting set it to 'off'."] = "要关掉关键词邀请的话,选择'关'",
130 ["<oRA> Raid disbanding on request by: "] = "<oRA>解散团队请求:",
131 ["Disabling Auto-Promote for: "] = "禁止自动提升对:",
132 ["Enabling Auto-Promote for: "] = "允许自动提升对:",
133 ["Autopromoting: "] = "自动提升",
134 ["You have no-one in your Auto-Promote list"] = "你的自动提升列表为空",
135 ["Options for invite."] = "邀请助手选项",
136 ["Autopromote"] = "自动提升",
137 ["autopromote"] = "自动提升",
138 ["Set/Unset an autopromotion."] = "设定/取消自动提升",
139 ["<name>"] = "<名字>",
140 ["keyword"] = "关键字",
141 ["Keyword"] = "关键字",
142 ["Set/Unset an invitation keyword."] = "设定/取消邀请关键字",
143 ["<keyword>"] = "关键词",
144 ["disband"] = "解散",
145 ["Disband"] = "解散",
146 ["Disband the raid."] = "解散团队",
147 ["list"] = "列表",
148 ["List"] = "列表",
149 ["List autopromotions."] = "自动提升列表",
150 ["guild"] = "公会",
151 ["Invite Guild"] = "公会邀请",
152 ["Invite all level 60 characters in the guild to raid."] = "邀请公会中所有的60级玩家",
153 ["You are not in a guild."] = "你不在一个公会中",
154 ["You are not in a raid group."] = "你不在一个团队中",
155 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = "所有60级人物都将在10秒后邀请到团队中。请离开你当前队伍。",
156 ["off"] = "关闭",
157 } end )
158  
159 L:RegisterTranslations("zhTW", function() return {
160 ["inviteleader"] = "inviteleader",
161 ["invite"] = "邀請",
162 ["Invite"] = "邀請",
163 ["Leader/Invite"] = "領隊/邀請",
164 ["<oRA> Sorry, the group is full."] = "<oRA>抱歉,團隊已滿。",
165 ["Inviting: "] = "正邀請:",
166 ["^([^%s]+) has joined the raid group"] = "^([^%s]+) 已加入團隊",
167 ["Autopromoting: "] = "自動提升: ",
168 ["Keyword inviting disabled."] = "禁止關鍵字邀請",
169 ["Invitation keyword set to: "] = "邀請關鍵字設置為:",
170 ["To turn off keyword inviting set it to 'off'."] = "要關掉關鍵詞邀請的話,選擇'關閉'",
171 ["<oRA> Raid disbanding on request by: "] = "<oRA>解散團隊請求:",
172 ["Disabling Auto-Promote for: "] = "禁止自動提升對:",
173 ["Enabling Auto-Promote for: "] = "允許自動提升對:",
174 ["Autopromoting: "] = "自動提升:",
175 ["You have no-one in your Auto-Promote list"] = "你的自動提升列表為空",
176 ["Options for invite."] = "邀請助手選項",
177 ["Autopromote"] = "自動提升",
178 ["autopromote"] = "自動提升",
179 ["Set/Unset an autopromotion."] = "設定/取消自動提升",
180 ["<name>"] = "<名字>",
181 ["keyword"] = "關鍵字",
182 ["Keyword"] = "關鍵字",
183 ["Set/Unset an invitation keyword."] = "設定/取消邀請關鍵字",
184 ["<keyword>"] = "關鍵詞",
185 ["disband"] = "解散",
186 ["Disband"] = "解散",
187 ["Disband the raid."] = "解散團隊",
188 ["list"] = "列表",
189 ["List"] = "列表",
190 ["List autopromotions."] = "自動提升列表",
191 ["guild"] = "公會",
192 ["Invite Guild"] = "公會邀請",
193 ["Invite all level 60 characters in the guild to raid."] = "邀請公會中所有的60級玩家",
194 ["You are not in a guild."] = "你不在一個公會中",
195 ["You are not in a raid group."] = "你不在一個團隊中",
196 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = "所有60級人物都將在10秒後邀請到團隊中。請離開你當前隊伍。",
197 ["off"] = "關閉",
198 } end )
199  
200 L:RegisterTranslations("frFR", function() return {
201 --["inviteleader"] = true,
202 --["invite"] = true,
203 ["Invite"] = "Invitation",
204 ["Leader/Invite"] = "Chef/Invitation",
205 ["<oRA> Sorry, the group is full."] = "<oRA> D\195\169sol\195\169, le groupe est complet.",
206 ["Inviting: "] = "Invitation : ",
207 ["^([^%s]+) has joined the raid group"] = "^([^%s]+) a rejoint le groupe de raid",
208 ["Autopromoting: "] = "Promotion automatique : ",
209 ["Keyword inviting disabled."] = "Invitation par mot-cl\195\169 d\195\169sactiv\195\169e.",
210 ["Invitation keyword set to: "] = "Invitation par mot-cl\195\169 d\195\169finie à : ",
211 ["To turn off keyword inviting set it to 'off'."] = "Pour d\195\169sactiver l'invitation par mot-cl\195\169, d\195\169finissez-le \195\160 'off'.",
212 ["<oRA> Raid disbanding on request by: "] = "<oRA> Dissolution du raid \195\160 la demande de : ",
213 ["Disabling Auto-Promote for: "] = "Retrait de la promotion automatique pour : ",
214 ["Enabling Auto-Promote for: "] = "Ajout de la promotion automatique de : ",
215 ["You have no-one in your Auto-Promote list"] = "Vous n'avez personne dans votre liste des personnes promues automatiquement.",
216 ["Options for invite."] = "Options concernant les invitations.",
217 ["Autopromote"] = "Promotion automatique",
218 ["Set/Unset an autopromotion."] = "Ajoute/Enl\195\168ve une personne de la liste des personnes promues automatiquement.",
219 ["<name>"] = "<nom>",
220 --["keyword"] = true,
221 ["Keyword"] = "Mot-cl\195\169",
222 ["Set/Unset an invitation keyword."] = "D\195\169termine/Enl\195\168ve le mot-cl\195\169 d'invitation.",
223 ["<keyword>"] = "<mot-cl\195\169>",
224 --["disband"] = true,
225 ["Disband"] = "Dissoudre",
226 ["Disband the raid."] = "Dissous le raid.",
227 --["list"] = true,
228 ["List"] = "Liste",
229 ["List autopromotions."] = "Affiche la liste des personnes promues automatiquement.",
230 --["guild"] = true,
231 ["Invite Guild"] = "Inviter la guilde",
232 ["Invite all level 60 characters in the guild to raid."] = "Invite tous les personnages de niveau 60 de la guilde dans le raid.",
233 ["You are not in a guild."] = "Vous n'\195\170tes pas dans une guilde.",
234 ["You are not in a raid group."] = "Vous n'\195\170tes pas dans un groupe de raid.",
235 ["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."] = "Tous les personnages de niveau 60 seront invit\195\169s dans le raid dans 10 secondes. Veuillez quitter vos groupes.",
236 --["off"] = true,
237 } end )
238  
239 ----------------------------------
240 -- Module Declaration --
241 ----------------------------------
242  
243 oRALInvite = oRA:NewModule(L["inviteleader"])
244 oRALInvite.defaults = {
245 }
246 oRALInvite.leader = true
247 oRALInvite.name = L["Leader/Invite"]
248 oRALInvite.shouldEnable = true -- Prevents the module from disabling when out of raids.
249 oRALInvite.consoleCmd = L["invite"]
250 oRALInvite.consoleOptions = {
251 type = "group",
252 desc = L["Options for invite."],
253 name = L["Invite"],
254 args = {
255 [L["autopromote"]] = {
256 name = L["Autopromote"], type = "text",
257 desc = L["Set/Unset an autopromotion."],
258 usage = L["<name>"],
259 get = function() return "" end,
260 set = function(v)
261 oRALInvite:SetAutoPromote(v)
262 end,
263 get = false,
264 validate = function(v)
265 return string.find(v, "(.*)")
266 end,
267 },
268 [L["list"]] = {
269 name = L["List"], type = "execute",
270 desc = L["List autopromotions."],
271 func = function() oRALInvite:ShowPromoteList() end,
272 },
273 [L["disband"]] = {
274 name = L["Disband"], type = "execute",
275 desc = L["Disband the raid."],
276 func = function() oRALInvite:DisbandRaid() end,
277 disabled = function() return not oRALInvite:IsValidRequest() end,
278 },
279 [L["keyword"]] = {
280 name = L["Keyword"], type = "text",
281 desc = L["Set/Unset an invitation keyword."],
282 usage = L["<keyword>"],
283 get = function() return oRALInvite.db.profile.keyword or "" end,
284 set = function(v)
285 oRALInvite:SetKeyword(v)
286 end,
287 validate = function(v)
288 return string.find(v, "(.*)")
289 end,
290 disabled = function() return not oRA:IsModuleActive(oRALInvite) end,
291 },
292 [L["guild"]] = {
293 name = L["Invite Guild"], type = "execute",
294 desc = L["Invite all level 60 characters in the guild to raid."],
295 func = function() oRALInvite:InviteGuild() end,
296 },
297 }
298 }
299  
300 ------------------------------
301 -- Initialization --
302 ------------------------------
303  
304 function oRALInvite:OnEnable()
305 if not self.db.profile.promotes then self.db.profile.promotes = {} end
306  
307 self:RegisterEvent("CHAT_MSG_WHISPER")
308 self:RegisterEvent("CHAT_MSG_SYSTEM")
309  
310 self:RegisterShorthand("rakw", function(k) self:SetKeyword(k) end)
311 self:RegisterShorthand("rakeyword", function(k) self:SetKeyword(k) end)
312 self:RegisterShorthand("radisband", function() self:DisbandRaid() end)
313 self:RegisterShorthand("rainvite", function() self:InviteGuild() end)
314 end
315  
316  
317 function oRALInvite:OnDisable()
318 self:UnregisterAllEvents()
319 self:UnregisterShorthand("rakw")
320 self:UnregisterShorthand("rakeyword")
321 self:UnregisterShorthand("radisband")
322 self:UnregisterShorthand("rainvite")
323 end
324  
325 ----------------------
326 -- Event Handlers --
327 ----------------------
328  
329 function oRALInvite:CHAT_MSG_WHISPER( msg, author )
330 if self.db.profile.keyword and strlower(msg) == strlower(self.db.profile.keyword) then
331 if GetNumPartyMembers() == 4 and GetNumRaidMembers() == 0 then ConvertToRaid() end
332 if GetNumRaidMembers() == 40 then
333 SendChatMessage( L["<oRA> Sorry, the group is full."], "WHISPER", nil, author)
334 else
335 self:Print( L["Inviting: "] .. author )
336 InviteByName(author)
337 end
338 end
339 end
340  
341 function oRALInvite:CHAT_MSG_SYSTEM( msg )
342 if UnitInRaid("player") and IsRaidLeader() then
343 local _,_,name = string.find( msg, L["^([^%s]+) has joined the raid group"])
344 if name then
345 name = strlower(name)
346 if self.db.profile.promotes[name] then
347 self:Print( L["Autopromoting: "] .. name )
348 self:ScheduleEvent( PromoteToAssistant, 2, name )
349 end
350 end
351 end
352 end
353  
354 ----------------------
355 -- Command Handlers --
356 ----------------------
357  
358 function oRALInvite:InviteGuild()
359 if not IsInGuild() then
360 self:Print(L["You are not in a guild."])
361 return
362 end
363 if GetNumRaidMembers() == 0 then
364 self:Print(L["You are not in a raid group."])
365 return
366 end
367  
368 SendChatMessage(L["All level 60 characters will be invited to raid in 10 seconds. Please leave your groups."], "GUILD")
369 self:ScheduleEvent(self.DoGuildInvites, 10, self)
370 end
371  
372 function oRALInvite:DoGuildInvites()
373 local offline = GetGuildRosterShowOffline()
374 local selection = GetGuildRosterSelection()
375 SetGuildRosterShowOffline(0)
376 SetGuildRosterSelection(0)
377 GetGuildRosterInfo(0)
378  
379 local numGuildMembers = GetNumGuildMembers()
380 for i = 1, numGuildMembers, 1 do
381 local name, _, _, level, _, _, _, _, online, status = GetGuildRosterInfo(i)
382 if level == 60 and name ~= UnitName("player") and online then
383 InviteByName(name)
384 end
385 end
386  
387 SetGuildRosterShowOffline(offline)
388 SetGuildRosterSelection(selection)
389 end
390  
391 function oRALInvite:SetKeyword( keyword )
392 if keyword == nil or keyword == "" or strlower( keyword ) == L["off"] then
393 self.db.profile.keyword = nil
394 self:Print( L["Keyword inviting disabled."] )
395 else
396 self.db.profile.keyword = keyword
397 self:Print( L["Invitation keyword set to: "] .. keyword )
398 self:Print( L["To turn off keyword inviting set it to 'off'."])
399 end
400 end
401  
402  
403 function oRALInvite:DisbandRaid()
404 if not self:IsPromoted() then return end
405 SendChatMessage( L["<oRA> Raid disbanding on request by: "] .. UnitName("player"), "RAID")
406 for i = 1, GetNumRaidMembers(), 1 do
407 local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i)
408 if online and name ~= UnitName("player") then
409 UninviteByName(name)
410 end
411 end
412 self:SendMessage("DB")
413 LeaveParty()
414 end
415  
416 function oRALInvite:SetAutoPromote(pname)
417 if( pname ~= nil and pname ~= "" ) then
418 pname = strlower( pname )
419 if( self.db.profile.promotes[pname] ) then
420 self.db.profile.promotes[pname] = nil
421 self:Print( L["Disabling Auto-Promote for: "] .. pname )
422 else
423 self.db.profile.promotes[pname] = 1
424 self:Print( L["Enabling Auto-Promote for: "] .. pname )
425 if( IsRaidLeader() ) then
426 for i = 1, GetNumRaidMembers(), 1 do
427 local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i)
428 name = strlower(name)
429 if( pname == name ) then
430 self:Print( L["Autopromoting: "] .. name )
431 PromoteToAssistant( name )
432 end
433 end
434 end
435 end
436 end
437 end
438  
439 function oRALInvite:ShowPromoteList()
440 if(not self:IsEmpty(self.db.profile.promotes) ) then
441 local i = 0
442 local list = ""
443 self:Print( L["Autopromoting: "] )
444 for name, yesno in pairs(self.db.profile.promotes) do
445 i = i + 1
446 list = list .. name .. " "
447 if( i == 5 ) then
448 self:Print( list )
449 i = 0
450 list = ""
451 end
452 end
453 if( list ~= "" ) then
454 self:Print( list )
455 end
456 else
457 self:Print( L["You have no-one in your Auto-Promote list"] )
458 end
459 end
460  
461 -----------------------
462 -- Utility Functions --
463 -----------------------
464  
465 function oRALInvite:IsEmpty( t )
466 for _ in pairs(t) do
467 return false
468 end
469 return true
470 end