vanilla-wow-addons – Blame information for rev 1
?pathlinks?
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("oRAPMainTank") |
||
8 | |||
9 | ---------------------------- |
||
10 | -- Localization -- |
||
11 | ---------------------------- |
||
12 | |||
13 | L:RegisterTranslations("enUS", function() return { |
||
14 | ["maintank"] = true, |
||
15 | ["MainTank"] = true, |
||
16 | ["mt"] = true, |
||
17 | ["Options for the maintanks."] = true, |
||
18 | ["refresh"] = true, |
||
19 | ["The local maintank list has been refreshed."] = true, |
||
20 | ["Refresh Maintanks"] = true, |
||
21 | ["Refresh the local maintank list."] = true, |
||
22 | ["Participant/MainTank"] = true, |
||
23 | ["notifydeath"] = true, |
||
24 | ["Notify deaths"] = true, |
||
25 | ["Notifies you when a main tank dies."] = true, |
||
26 | ["Tank %s has died!"] = true, |
||
27 | |||
28 | maintankdies = "^([^%s]+) dies%.$", |
||
29 | } end ) |
||
30 | |||
31 | L:RegisterTranslations("koKR", function() return { |
||
32 | |||
33 | ["MainTank"] = "메인탱커", |
||
34 | ["Options for the maintanks."] = "메인탱커 설정", |
||
35 | ["The local maintank list has been refreshed."] = "로컬 메인탱커 목록이 갱신되었습니다.", |
||
36 | ["Refresh Maintanks"] = "메인탱커 갱신", |
||
37 | ["Refresh the local maintank list."] = "로컬 메인탱커 목록을 갱신합니다.", |
||
38 | ["Participant/MainTank"] = "부분/메인탱커", |
||
39 | ["Notify deaths"] = "사망 알림", |
||
40 | ["Notifies you when a main tank dies."] = "메인탱커가 사망시 이를 알려줍니다.", |
||
41 | ["Tank %s has died!"] = "메인탱커 %s|1이;가; 죽었습니다!", |
||
42 | |||
43 | maintankdies = "^([^%s]+)|1이;가; 죽었습니다%.$", |
||
44 | } end ) |
||
45 | |||
46 | L:RegisterTranslations("zhCN", function() return { |
||
47 | ["maintank"] = "MT目标", |
||
48 | ["MainTank"] = "MT目标", |
||
49 | ["mt"] = "MT目标", |
||
50 | ["Options for the maintanks."] = "MT选项", |
||
51 | ["refresh"] = "刷新", |
||
52 | ["The local maintank list has been refreshed."] = "本地MT已刷新", |
||
53 | ["Refresh Maintanks"] = "刷新MT", |
||
54 | ["Refresh the local maintank list."] = "刷新本地MT名单", |
||
55 | ["Participant/MainTank"] = "Participant/MainTank", |
||
56 | ["notifydeath"] = "死亡通知", |
||
57 | ["Notify deaths"] = "死亡通知", |
||
58 | ["Notifies you when a main tank dies."] = "当MT死亡是通知你", |
||
59 | ["Tank %s has died!"] = "MT %s 已死亡!", |
||
60 | |||
61 | maintankdies = "^(.+)死亡了.", |
||
62 | } end ) |
||
63 | |||
64 | L:RegisterTranslations("zhTW", function() return { |
||
65 | ["maintank"] = "主坦", |
||
66 | ["MainTank"] = "主坦", |
||
67 | ["mt"] = "主坦", |
||
68 | ["Options for the maintanks."] = "主坦選項", |
||
69 | ["refresh"] = "更新", |
||
70 | ["The local maintank list has been refreshed."] = "個人主坦名單已更新", |
||
71 | ["Refresh Maintanks"] = "更新主坦", |
||
72 | ["Refresh the local maintank list."] = "更新個人主坦名單", |
||
73 | ["Participant/MainTank"] = "隊員/主坦", |
||
74 | ["notifydeath"] = "死亡通知", |
||
75 | ["Notify deaths"] = "死亡通知", |
||
76 | ["Notifies you when a main tank dies."] = "當主坦死亡時通知你", |
||
77 | ["Tank %s has died!"] = "主坦 %s 已死亡!", |
||
78 | |||
79 | maintankdies = "^(.+)死亡了.", |
||
80 | } end ) |
||
81 | |||
82 | L:RegisterTranslations("frFR", function() return { |
||
83 | --["maintank"] = true, |
||
84 | --["MainTank"] = true, |
||
85 | --["mt"] = true, |
||
86 | ["Options for the maintanks."] = "Options concernant les maintanks.", |
||
87 | --["refresh"] = true, |
||
88 | ["The local maintank list has been refreshed."] = "La liste locale des maintanks a \195\169t\195\169 rafra\195\174chie.", |
||
89 | ["Refresh Maintanks"] = "Rafra\195\174chir les maintanks", |
||
90 | ["Refresh the local maintank list."] = "Rafra\195\174chit la liste locale des maintanks.", |
||
91 | ["Participant/MainTank"] = "Participant/MainTank", |
||
92 | --["notifydeath"] = true, |
||
93 | ["Notify deaths"] = "Annoncer les morts", |
||
94 | ["Notifies you when a main tank dies."] = "Pr\195\169viens quand un maintank meurt.", |
||
95 | ["Tank %s has died!"] = "Le tank %s est mort !", |
||
96 | |||
97 | maintankdies = "^([^%s]+) meurt%.$", |
||
98 | } end ) |
||
99 | |||
100 | L:RegisterTranslations("deDE", function() return { |
||
101 | ["Tank %s has died!"] = "Tank %s ist gestorben!", |
||
102 | maintankdies = "^([^%s]+) stirbt%.$", |
||
103 | } end ) |
||
104 | |||
105 | ---------------------------------- |
||
106 | -- Module Declaration -- |
||
107 | ---------------------------------- |
||
108 | |||
109 | oRAPMainTank = oRA:NewModule(L["maintank"]) |
||
110 | oRAPMainTank.defaults = { |
||
111 | notifydeath = false, |
||
112 | } |
||
113 | oRAPMainTank.participant = true |
||
114 | oRAPMainTank.name = L["Participant/MainTank"] |
||
115 | oRAPMainTank.consoleCmd = L["mt"] |
||
116 | oRAPMainTank.consoleOptions = { |
||
117 | type = "group", |
||
118 | desc = L["Options for the maintanks."], |
||
119 | name = L["MainTank"], |
||
120 | args = { |
||
121 | [L["refresh"]] = { |
||
122 | name = L["Refresh Maintanks"], type = "execute", |
||
123 | desc = L["Refresh the local maintank list."], |
||
124 | func = function() |
||
125 | oRAPMainTank:Refresh() |
||
126 | end, |
||
127 | disabled = function() return not oRA:IsModuleActive(oRAPMainTank) end, |
||
128 | }, |
||
129 | [L["notifydeath"]] = { |
||
130 | name = L["Notify deaths"], type = "toggle", |
||
131 | desc = L["Notifies you when a main tank dies."], |
||
132 | get = function() return oRAPMainTank.db.profile.notifydeath end, |
||
133 | set = function(v) oRAPMainTank.db.profile.notifydeath = v end, |
||
134 | }, |
||
135 | } |
||
136 | } |
||
137 | |||
138 | |||
139 | ------------------------------ |
||
140 | -- Initialization -- |
||
141 | ------------------------------ |
||
142 | |||
143 | function oRAPMainTank:OnRegister() |
||
144 | if not self.core.maintanktable then |
||
145 | self.core.maintanktable = self.core.db.profile.maintanktable or {} |
||
146 | end |
||
147 | end |
||
148 | |||
149 | function oRAPMainTank:OnEnable() |
||
150 | self:RegisterEvent("CHAT_MSG_COMBAT_FRIENDLY_DEATH") |
||
151 | self:RegisterEvent("oRA_LeftRaid") |
||
152 | self:RegisterCheck("SET", "oRA_SetMainTank") |
||
153 | self:RegisterCheck("R", "oRA_RemoveMainTank") |
||
154 | end |
||
155 | |||
156 | function oRAPMainTank:OnDisable() |
||
157 | |||
158 | self:UnregisterAllEvents() |
||
159 | |||
160 | self:UnregisterCheck("SET") |
||
161 | self:UnregisterCheck("R") |
||
162 | end |
||
163 | |||
164 | |||
165 | ------------------------------- |
||
166 | -- Event Handlers -- |
||
167 | ------------------------------- |
||
168 | |||
169 | function oRAPMainTank:CHAT_MSG_COMBAT_FRIENDLY_DEATH(msg) |
||
170 | if not self.db.profile.notifydeath then return end |
||
171 | local _, _, tank = string.find(msg, L["maintankdies"]) |
||
172 | if not tank then return end |
||
173 | for k, name in pairs(self.core.maintanktable) do |
||
174 | if name == tank then |
||
175 | -- I'm pretty sure this is the same sound that CTRA uses, someone |
||
176 | -- should confirm. |
||
177 | if BigWigs then |
||
178 | self:TriggerEvent("BigWigs_Message", string.format(L["Tank %s has died!"], name), "Red", true, false) |
||
179 | elseif RaidWarningFrame then |
||
180 | RaidWarningFrame:AddMessage(string.format(L["Tank %s has died!"], name), 1.0, 0, 0, 1.0, UIERRORS_HOLD_TIME) |
||
181 | end |
||
182 | PlaySound("igQuestFailed") |
||
183 | end |
||
184 | end |
||
185 | end |
||
186 | |||
187 | function oRAPMainTank:oRA_SetMainTank(msg, author) |
||
188 | if not self:IsValidRequest( author, true ) then return end |
||
189 | msg = self:CleanMessage(msg) |
||
190 | |||
191 | local _, _, num, name = string.find(msg, "^SET (%d+) (.+)$") |
||
192 | if not num or not name then return end |
||
193 | |||
194 | self:RemoveTank(name) |
||
195 | |||
196 | self.core.maintanktable[tonumber(num)] = name |
||
197 | self.core.db.profile.maintanktable = self.core.maintanktable |
||
198 | self:TriggerEvent("oRA_MainTankUpdate", self.core.maintanktable) |
||
199 | end |
||
200 | |||
201 | function oRAPMainTank:oRA_RemoveMainTank(msg, author) |
||
202 | if not self:IsValidRequest( author, true ) then return end |
||
203 | msg = self:CleanMessage(msg) |
||
204 | local _, _, name = string.find( msg, "^R (.+)$") |
||
205 | if not name then return end |
||
206 | |||
207 | self:RemoveTank(name) |
||
208 | |||
209 | self:TriggerEvent("oRA_MainTankUpdate", self.core.maintanktable) |
||
210 | end |
||
211 | |||
212 | function oRAPMainTank:oRA_LeftRaid() |
||
213 | self.core.maintanktable = {} |
||
214 | self.core.db.profile.maintanktable = nil |
||
215 | self:TriggerEvent("oRA_MainTankUpdate", self.core.maintanktable ) |
||
216 | end |
||
217 | |||
218 | ------------------------------- |
||
219 | -- Utility Functions -- |
||
220 | ------------------------------- |
||
221 | |||
222 | function oRAPMainTank:RemoveTank(name) |
||
223 | if not name then return end |
||
224 | for n, t in pairs(self.core.maintanktable) do |
||
225 | if t == name then |
||
226 | self.core.maintanktable[n] = nil |
||
227 | end |
||
228 | end |
||
229 | self.core.db.profile.maintanktable = self.core.maintanktable |
||
230 | end |
||
231 | |||
232 | ------------------------------- |
||
233 | -- Command Handlers -- |
||
234 | ------------------------------- |
||
235 | |||
236 | function oRAPMainTank:Refresh() |
||
237 | self:TriggerEvent("oRA_MainTankUpdate", self.core.maintanktable) |
||
238 | self:Print(L["The local maintank list has been refreshed."]) |
||
239 | end |