vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 assert( oRA, "oRA not found!")
3  
4 ------------------------------
5 -- Are you local? --
6 ------------------------------
7  
8 local L = AceLibrary("AceLocale-2.2"):new("oRALRaidWarn")
9  
10 ----------------------------
11 -- Localization --
12 ----------------------------
13  
14 L:RegisterTranslations("enUS", function() return {
15 ["rw"] = true,
16 ["raidwarningleader"] = true,
17 ["Raidwarning"] = true,
18 ["Options for raid warning."] = true,
19 ["Leader/RaidWarn"] = true,
20 ["Send"] = true,
21 ["Send an RS Message."] = true,
22 ["<message>"] = true,
23 ["ToRaid"] = true,
24 ["OldStyle"] = true,
25 ["To Raid"] = true,
26 ["Old Style"] = true,
27 ["Send RS Messages to Raid as well."] = true,
28 ["Use CTRA RS Messages instead of RaidWarning."] = true,
29 } end )
30  
31 L:RegisterTranslations("koKR", function() return {
32 ["Raidwarning"] = "공격대경보",
33 ["Options for raid warning."] = "공격대 경보에 관한 설정",
34 ["Leader/RaidWarn"] = "공격대장/공격대경보",
35 ["Send"] = "보내기",
36 ["Send an RS Message."] = "RS메세지로 보내기",
37 ["<message>"] = "<메세지>",
38 ["ToRaid"] = "공격대",
39 ["OldStyle"] = "옛날방식",
40 ["To Raid"] = "공격대에 보내기",
41 ["Old Style"] = "옛 방식 사용",
42 ["Send RS Messages to Raid as well."] = "RS 메세지를 공격대 대화로도 표시합니다.",
43 ["Use CTRA RS Messages instead of RaidWarning."] = "공격대 경보 대신에 공격대 도우미의 RS 메세지를 사용합니다.",
44 } end )
45  
46 L:RegisterTranslations("zhCN", function() return {
47 ["rw"] = "rw",
48 ["raidwarningleader"] = "raidwarningleader",
49 ["Raidwarning"] = "团队报警",
50 ["Options for raid warning."] = "团队警报选项.",
51 ["Leader/RaidWarn"] = "Leader/RaidWarn",
52 ["Send"] = "发送",
53 ["Send an RS Message."] = "发送一条RS消息",
54 ["<message>"] = "<message>",
55 ["ToRaid"] = "发送到RAID",
56 ["OldStyle"] = "老样式",
57 ["To Raid"] = "进行RAID",
58 ["Old Style"] = "老样式",
59 ["Send RS Messages to Raid as well."] = "RS同时发送一条消息到团队聊天频道",
60 ["Use CTRA RS Messages instead of RaidWarning."] = "使用CTRA消息取代团队警报",
61 } end )
62  
63 L:RegisterTranslations("zhTW", function() return {
64 ["rw"] = "rw",
65 ["raidwarningleader"] = "raidwarningleader",
66 ["Raidwarning"] = "團隊報警",
67 ["Options for raid warning."] = "團隊警報選項",
68 ["Leader/RaidWarn"] = "領隊/團隊報警",
69 ["Send"] = "發送",
70 ["Send an RS Message."] = "發送RS訊息",
71 ["<message>"] = "<訊息>",
72 ["ToRaid"] = "發送到團隊",
73 ["OldStyle"] = "舊式風格",
74 ["To Raid"] = "發送到團隊",
75 ["Old Style"] = "舊式風格",
76 ["Send RS Messages to Raid as well."] = "發送RS訊息時也發送到團隊頻道",
77 ["Use CTRA RS Messages instead of RaidWarning."] = "使用團隊助手訊息取代團隊警報",
78 } end )
79  
80 L:RegisterTranslations("frFR", function() return {
81 --["rw"] = true,
82 --["raidwarningleader"] = true,
83 ["Raidwarning"] = "Avertissement du raid",
84 ["Options for raid warning."] = "Options concernant l'avertissement du raid.",
85 ["Leader/RaidWarn"] = "Chef/AvertirRaid",
86 ["Send"] = "Envoyer",
87 ["Send an RS Message."] = "Envoye un message RS.",
88 --["<message>"] = true,
89 --["ToRaid"] = true,
90 --["OldStyle"] = true,
91 ["To Raid"] = "Au raid",
92 ["Old Style"] = "Ancienne m\195\169thode",
93 ["Send RS Messages to Raid as well."] = "Envoye les messages RS \195\169galement au canal Raid.",
94 ["Use CTRA RS Messages instead of RaidWarning."] = "Utilise les messages RS de CTRA au lieu de l'Avertissement Raid.",
95 } end )
96  
97 ----------------------------------
98 -- Module Declaration --
99 ----------------------------------
100  
101 oRALRaidWarn = oRA:NewModule(L["raidwarningleader"])
102 oRALRaidWarn.defaults = {
103 oldstyle = false,
104 toraid = false,
105 }
106 oRALRaidWarn.leader = true
107 oRALRaidWarn.name = L["Leader/RaidWarn"]
108 oRALRaidWarn.consoleCmd = L["rw"]
109 oRALRaidWarn.consoleOptions = {
110 type = "group",
111 desc = L["Options for raid warning."],
112 name = L["Raidwarning"],
113 args = {
114 [L["Send"]] = {
115 name = L["Send"], type = "text",
116 desc = L["Send an RS Message."],
117 usage = L["<message>"],
118 get = false,
119 set = function(v)
120 oRALRaidWarn:SendRS(v)
121 end,
122 validate = function(v)
123 return string.find(v, "^(.+)$")
124 end,
125 disabled = function() return not oRA:IsModuleActive(oRALRaidWarn) or not oRALRaidWarn:IsValidRequest() end,
126 },
127 [L["ToRaid"]] = {
128 name = L["To Raid"], type = "toggle",
129 desc = L["Send RS Messages to Raid as well."],
130 get = function() return oRALRaidWarn.db.profile.toraid end,
131 set = function(v)
132 oRALRaidWarn.db.profile.toraid = v
133 end,
134 },
135 [L["OldStyle"]] = {
136 name = L["Old Style"], type = "toggle",
137 desc = L["Use CTRA RS Messages instead of RaidWarning."],
138 get = function() return oRALRaidWarn.db.profile.oldstyle end,
139 set = function(v)
140 oRALRaidWarn.db.profile.oldstyle = v
141 end,
142 },
143 }
144 }
145  
146 ------------------------------
147 -- Initialization --
148 ------------------------------
149  
150 function oRALRaidWarn:OnEnable()
151 self:RegisterShorthand("rs", function(msg) self:SendRS(msg) end )
152 end
153  
154 function oRALRaidWarn:OnDisable()
155 self:UnregisterShorthand("rs")
156 end
157  
158 ------------------------------
159 -- Command Handlers --
160 ------------------------------
161  
162 function oRALRaidWarn:SendRS(msg)
163 if not msg or not oRALRaidWarn:IsValidRequest() then return end
164 if self.db.profile.oldstyle then
165 self:SendMessage("MS ".. string.gsub(msg, "%%t", UnitName("target") or TARGET_TOKEN_NOT_FOUND) )
166 else
167 SendChatMessage(msg, "RAID_WARNING")
168 end
169 if self.db.profile.toraid then SendChatMessage(msg, "RAID") end
170 end