vanilla-wow-addons – Blame information for rev 1
?pathlinks?
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("oRALAssist") |
||
9 | |||
10 | ---------------------------- |
||
11 | -- Localization -- |
||
12 | ---------------------------- |
||
13 | |||
14 | L:RegisterTranslations("enUS", function() return { |
||
15 | ["assist"] = true, |
||
16 | ["Assist"] = true, |
||
17 | ["assistleader"] = true, |
||
18 | ["Options for assist."] = true, |
||
19 | ["Leader/Assist"] = true, |
||
20 | ["Tank %s. not available."] = true, |
||
21 | ["You need to have a target to assign it to a tank."] = true, |
||
22 | ["Assigning %s to %s."] = true, |
||
23 | ["No free tanks found."] = true, |
||
24 | ["assign"] = true, |
||
25 | ["Assign Target"] = true, |
||
26 | ["Assign a target to a maintank."] = true, |
||
27 | ["Assign Maintank"] = true, |
||
28 | ["free"] = true, |
||
29 | ["First Free"] = true, |
||
30 | ["Assign the first free MainTank."] = true, |
||
31 | ["Request Assist"] = true, |
||
32 | } end ) |
||
33 | |||
34 | L:RegisterTranslations("koKR", function() return { |
||
35 | |||
36 | ["Assist"] = "지원", |
||
37 | ["Options for assist."] = "지원 기능에 대한 설정", |
||
38 | ["Leader/Assist"] = "공격대장/지원", |
||
39 | ["Tank %s. not available."] = "%s 메인탱커를 사용할 수 없습니다.", |
||
40 | ["You need to have a target to assign it to a tank."] = "먼저 탱커로 지정할 대상을 선택해야 합니다.", |
||
41 | ["Assigning %s to %s."] = "%s|1을;를; %s|1로;으로; 지정합니다.", |
||
42 | ["No free tanks found."] = "빈 탱커목록을 찾을 수가 없습니다.", |
||
43 | ["assign"] = "지정", |
||
44 | ["Assign Target"] = "대상 지정", |
||
45 | ["Assign a target to a maintank."] = "대상을 메인탱커로 지정합니다", |
||
46 | ["Assign Maintank"] = "메인탱커 지정", |
||
47 | ["free"] = "공란", |
||
48 | ["First Free"] = "첫번재 공란", |
||
49 | ["Assign the first free MainTank."] = "메인탱커의 첫번재 공란으로 지정합니다.", |
||
50 | ["Request Assist"] = "지원요청", |
||
51 | |||
52 | } end ) |
||
53 | |||
54 | L:RegisterTranslations("zhCN", function() return { |
||
55 | ["assist"] = "协助MT", |
||
56 | ["Assist"] = "协助MT", |
||
57 | ["assistleader"] = "assistleader", |
||
58 | ["Options for assist."] = "协助MT的选项", |
||
59 | ["Leader/Assist"] = "Leader/Assist", |
||
60 | ["Tank %s. not available."] = "MT%s不存在", |
||
61 | ["You need to have a target to assign it to a tank."] = "你必需先选中一个目标然后再分配给MT", |
||
62 | ["Assigning %s to %s."] = "%s分配给%s", |
||
63 | ["No free tanks found."] = "没有空闲的MT", |
||
64 | ["assign"] = "分配", |
||
65 | ["Assign Target"] = "分配目标", |
||
66 | ["Assign a target to a maintank."] = "分配目标给MT", |
||
67 | ["Assign Maintank"] = "分配MT", |
||
68 | ["free"] = "空闲", |
||
69 | ["First Free"] = "第一个空闲", |
||
70 | ["Assign the first free MainTank."] = "分配给第一个空闲的MT", |
||
71 | ["Request Assist"] = "需要协助", |
||
72 | } end ) |
||
73 | |||
74 | L:RegisterTranslations("zhTW", function() return { |
||
75 | ["assist"] = "協助主坦", |
||
76 | ["Assist"] = "協助主坦", |
||
77 | ["assistleader"] = "assistleader", |
||
78 | ["Options for assist."] = "協助主坦的選項", |
||
79 | ["Leader/Assist"] = "領隊/協助", |
||
80 | ["Tank %s. not available."] = "主坦 %s 不存在", |
||
81 | ["You need to have a target to assign it to a tank."] = "你必需先選中一個目標然後再分配給主坦", |
||
82 | ["Assigning %s to %s."] = "%s 分配給 %s", |
||
83 | ["No free tanks found."] = "沒有空閒的主坦", |
||
84 | ["assign"] = "分配", |
||
85 | ["Assign Target"] = "分配目標", |
||
86 | ["Assign a target to a maintank."] = "分配目標給主坦", |
||
87 | ["Assign Maintank"] = "分配主坦", |
||
88 | ["free"] = "空閑", |
||
89 | ["First Free"] = "第一個空閒", |
||
90 | ["Assign the first free MainTank."] = "分配給第一個空閒的主坦", |
||
91 | ["Request Assist"] = "請求協助", |
||
92 | } end ) |
||
93 | |||
94 | L:RegisterTranslations("frFR", function() return { |
||
95 | --["assist"] = true, |
||
96 | ["Assist"] = "Aide", |
||
97 | --["assistleader"] = true, |
||
98 | ["Options for assist."] = "Options concernant l'aide.", |
||
99 | ["Leader/Assist"] = "Chef/Aide", |
||
100 | ["Tank %s. not available."] = "Tank %s non disponible.", |
||
101 | ["You need to have a target to assign it to a tank."] = "Vous devez avoir une cible pour l'assigner \195\160 un tank.", |
||
102 | ["Assigning %s to %s."] = "Assignation de %s \195\160 %s.", |
||
103 | ["No free tanks found."] = "Aucun tank libre n'a \195\169t\195\169 trouv\195\169.", |
||
104 | --["assign"] = true, |
||
105 | ["Assign Target"] = "Assigner une cible", |
||
106 | ["Assign a target to a maintank."] = "Assigne une cible \195\160 un maintank.", |
||
107 | ["Assign Maintank"] = "Assigner un maintank", |
||
108 | --["free"] = true, |
||
109 | ["First Free"] = "Premier libre", |
||
110 | ["Assign the first free MainTank."] = "Assigne le premier maintank libre.", |
||
111 | ["Request Assist"] = "Demander de l'aide", |
||
112 | } end ) |
||
113 | |||
114 | ---------------------------------- |
||
115 | -- Module Declaration -- |
||
116 | ---------------------------------- |
||
117 | |||
118 | oRALAssist = oRA:NewModule(L["assistleader"]) |
||
119 | oRALAssist.defaults = { |
||
120 | } |
||
121 | oRALAssist.leader = true |
||
122 | oRALAssist.name = L["Leader/Assist"] |
||
123 | oRALAssist.consoleCmd = L["assist"] |
||
124 | oRALAssist.consoleOptions = { |
||
125 | type = "group", |
||
126 | desc = L["Options for assist."], |
||
127 | name = L["Assist"], |
||
128 | args = { |
||
129 | [L["assign"]] = { |
||
130 | name = L["Assign Target"], type = "group", |
||
131 | desc = L["Assign a target to a maintank."], |
||
132 | disabled = function() return not oRA:IsModuleActive(oRALAssist) or not oRALAssist:IsValidRequest() end, |
||
133 | args = { |
||
134 | ["1"] = { |
||
135 | name = "1.", type = "execute", desc = L["Assign Maintank"].." 1", |
||
136 | func = function() oRALAssist:AssignNumber("1") end, |
||
137 | disabled = function() return not oRALAssist.core.maintanktable[1] end, |
||
138 | order = 1, |
||
139 | }, |
||
140 | ["2"] = { |
||
141 | name = "2.", type = "execute", desc = L["Assign Maintank"].." 2", |
||
142 | func = function() oRALAssist:AssignNumber("2") end, |
||
143 | disabled = function() return not oRALAssist.core.maintanktable[2] end, |
||
144 | order = 2, |
||
145 | }, |
||
146 | ["3"] = { |
||
147 | name = "3.", type = "execute", desc = L["Assign Maintank"].." 3", |
||
148 | func = function() oRALAssist:AssignNumber("3") end, |
||
149 | disabled = function() return not oRALAssist.core.maintanktable[3] end, |
||
150 | order = 3, |
||
151 | }, |
||
152 | ["4"] = { |
||
153 | name = "4.", type = "execute", desc = L["Assign Maintank"].." 4", |
||
154 | func = function() oRALAssist:AssignNumber("4") end, |
||
155 | disabled = function() return not oRALAssist.core.maintanktable[4] end, |
||
156 | order = 4, |
||
157 | }, |
||
158 | ["5"] = { |
||
159 | name = "5.", type = "execute", desc = L["Assign Maintank"].." 5", |
||
160 | func = function() oRALAssist:AssignNumber("5") end, |
||
161 | disabled = function() return not oRALAssist.core.maintanktable[5] end, |
||
162 | order = 5, |
||
163 | }, |
||
164 | ["6"] = { |
||
165 | name = "6.", type = "execute", desc = L["Assign Maintank"].." 6", |
||
166 | func = function() oRALAssist:AssignNumber("6") end, |
||
167 | disabled = function() return not oRALAssist.core.maintanktable[6] end, |
||
168 | order = 6, |
||
169 | }, |
||
170 | ["7"] = { |
||
171 | name = "7.", type = "execute", desc = L["Assign Maintank"].." 7", |
||
172 | func = function() oRALAssist:AssignNumber("7") end, |
||
173 | disabled = function() return not oRALAssist.core.maintanktable[7] end, |
||
174 | order = 7, |
||
175 | }, |
||
176 | ["8"] = { |
||
177 | name = "8.", type = "execute", desc = L["Assign Maintank"].." 8", |
||
178 | func = function() oRALAssist:AssignNumber("8") end, |
||
179 | disabled = function() return not oRALAssist.core.maintanktable[8] end, |
||
180 | order = 8, |
||
181 | }, |
||
182 | ["9"] = { |
||
183 | name = "9.", type = "execute", desc = L["Assign Maintank"].." 9", |
||
184 | func = function() oRALAssist:AssignNumber("9") end, |
||
185 | disabled = function() return not oRALAssist.core.maintanktable[9] end, |
||
186 | order = 9, |
||
187 | }, |
||
188 | ["10"] = { |
||
189 | name = "10.", type = "execute", desc = L["Assign Maintank"].." 10", |
||
190 | func = function() oRALAssist:AssignNumber("10") end, |
||
191 | disabled = function() return not oRALAssist.core.maintanktable[10] end, |
||
192 | order = 10, |
||
193 | }, |
||
194 | ["free"] = { |
||
195 | name = L["First Free"], type="execute", desc = L["Assign the first free MainTank."], |
||
196 | func = function() |
||
197 | oRALAssist:AssignFree() |
||
198 | end, |
||
199 | order = 11, |
||
200 | } |
||
201 | |||
202 | } |
||
203 | }, |
||
204 | } |
||
205 | } |
||
206 | |||
207 | ------------------------------ |
||
208 | -- Initialization -- |
||
209 | ------------------------------ |
||
210 | |||
211 | function oRALAssist:OnEnable() |
||
212 | self:RegisterEvent("oRA_MainTankUpdate") |
||
213 | self:RegisterEvent("oRA_JoinedRaid", "oRA_MainTankUpdate") |
||
214 | self:RegisterEvent("RosterLib_RosterChanged", function() self:oRA_MainTankUpdate() end) |
||
215 | end |
||
216 | |||
217 | function oRALAssist:OnDisable() |
||
218 | self:UnregisterAllEvents() |
||
219 | end |
||
220 | |||
221 | ------------------------------ |
||
222 | -- Event Handlers -- |
||
223 | ------------------------------ |
||
224 | |||
225 | function oRALAssist:oRA_MainTankUpdate( maintanktable ) |
||
226 | if not maintanktable then maintanktable = self.core.maintanktable end |
||
227 | for k = 1, 10, 1 do |
||
228 | self.core.consoleOptions.args[L["assist"]].args[L["assign"]].args[tostring(k)].name = tostring(k).."." |
||
229 | end |
||
230 | for k,v in pairs(maintanktable) do |
||
231 | if self:IsValidRequest(v,true) then |
||
232 | self.core.consoleOptions.args[L["assist"]].args[L["assign"]].args[tostring(k)].name = tostring(k)..". "..v |
||
233 | end |
||
234 | end |
||
235 | end |
||
236 | |||
237 | ------------------------------ |
||
238 | -- Command Handlers -- |
||
239 | ------------------------------ |
||
240 | |||
241 | function oRALAssist:AssignNumber( number ) |
||
242 | if not self:IsPromoted() then return end |
||
243 | number = tonumber(number) |
||
244 | if not UnitName("target") then |
||
245 | self:Print( L["You need to have a target to assign it to a tank."] ) |
||
246 | return |
||
247 | end |
||
248 | if not self.core.maintanktable[number] or not self.core.roster:GetUnitIDFromName(self.core.maintanktable[number]) then |
||
249 | self:Print( string.format( L["Tank %s. not available."], number) ) |
||
250 | return |
||
251 | end |
||
252 | self:SendMessage("ASSISTME "..self.core.maintanktable[number] ) |
||
253 | self:Print( string.format( L["Assigning %s to %s."], UnitName("target"), self.core.maintanktable[number] ) ) |
||
254 | end |
||
255 | |||
256 | function oRALAssist:AssignFree( ) |
||
257 | if not self:IsPromoted() then return end |
||
258 | if not UnitName("target") then |
||
259 | self:Print( L["You need to have a target to assign it to a tank."] ) |
||
260 | return |
||
261 | end |
||
262 | for k,v in pairs(self.core.maintanktable) do |
||
263 | local unitid = self.core.roster:GetUnitIDFromName(v) |
||
264 | if unitid and not UnitName( unitid .. "target" ) then |
||
265 | self:AssignNumber( k ) |
||
266 | return |
||
267 | end |
||
268 | end |
||
269 | self:Print( L["No free tanks found."] ) |
||
270 | end |