vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -------------------------------------------------------------------------- |
2 | -- TitanBGinfo.lua |
||
3 | -------------------------------------------------------------------------- |
||
4 | --[[ |
||
5 | |||
6 | Titan Panel [BGinfo] |
||
7 | Plug-in for Titan Panel that displays Battleground info. When you are |
||
8 | in a queue to enter a Battleground, the estimated wait time and your |
||
9 | current wait time will be displayed when hovering over BGinfo. When you |
||
10 | are in a Battleground your BG stats will be displayed. Can be used to |
||
11 | replace the Minimap Battleground icon (which can be hidden). |
||
12 | |||
13 | Author: Corgi - corgiwow@gmail.com |
||
14 | |||
15 | v0.06 (January 6, 2006 11:05 PST) |
||
16 | - updated for 1.90 patch |
||
17 | |||
18 | v0.05 (September 15, 2005 11:37 PST) |
||
19 | - updated toc# for 1.70 patch |
||
20 | - added support for Arathi Basin Battleground |
||
21 | |||
22 | v0.04 (June 13, 2005 20:05 PST) |
||
23 | - added BattleField Instance Run Time |
||
24 | - updated toc# for 1.60 patch |
||
25 | - updated for Titan Panel 1.24 |
||
26 | - added French localization |
||
27 | |||
28 | v0.03 (June 12, 2005 22:35 PST) |
||
29 | - renamed "Honor Gained" to "Bonus Honor" |
||
30 | |||
31 | v0.02 (June 11, 2005 15:00 PST) |
||
32 | - added estimated wait time and time waited to the BGinfo button when |
||
33 | in a queue to enter a Battleground |
||
34 | - clicking on the BGinfo icon while in a Battleground will toggle the Stats |
||
35 | window |
||
36 | - added abbreviated Battleground map name to the BGinfo button when in a |
||
37 | queue or a Battleground |
||
38 | - added the ability to handle "confirm" state |
||
39 | |||
40 | v0.01 (June 10, 2005 12:40 PST) |
||
41 | - Initial Release |
||
42 | |||
43 | TODO: German, French and Korean translations. |
||
44 | |||
45 | NOTE: Requires Titan Panel version 1.22+ |
||
46 | |||
47 | ]]-- |
||
48 | |||
49 | TITAN_BGINFO_ID = "BGinfo"; |
||
50 | |||
51 | -- default icon |
||
52 | TITAN_BGINFO_ICON = "Interface\\PvPRankBadges\\PvPRankAlliance"; |
||
53 | |||
54 | -- |
||
55 | -- OnFuctions |
||
56 | -- |
||
57 | function TitanPanelBGinfoButton_OnLoad() |
||
58 | this.registry = { |
||
59 | id = TITAN_BGINFO_ID, |
||
60 | menuText = TITAN_BGINFO_MENU_TEXT, |
||
61 | buttonTextFunction = "TitanPanelBGinfoButton_GetButtonText", |
||
62 | tooltipTitle = TITAN_BGINFO_TOOLTIP, |
||
63 | tooltipTextFunction = "TitanPanelBGinfoButton_GetTooltipText", |
||
64 | icon = TITAN_BGINFO_ICON, |
||
65 | iconWidth = 16, |
||
66 | savedVariables = { |
||
67 | ShowIcon = 1, |
||
68 | ShowLabelText = 1, |
||
69 | HideMinimap = TITAN_NIL, |
||
70 | BGINFO_AutoRes = 0, |
||
71 | BGINFO_AutoJoin = 0, |
||
72 | BGINFO_AutoRel = 0, |
||
73 | } |
||
74 | }; |
||
75 | this:RegisterEvent("UPDATE_WORLD_STATES"); |
||
76 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
77 | |||
78 | this:RegisterEvent("BATTLEFIELDS_SHOW"); |
||
79 | this:RegisterEvent("BATTLEFIELDS_CLOSED"); |
||
80 | |||
81 | this:RegisterEvent("UPDATE_BATTLEFIELD_SCORE"); |
||
82 | this:RegisterEvent("UPDATE_BATTLEFIELD_STATUS"); |
||
83 | |||
84 | this:RegisterEvent("PLAYER_PVP_KILLS_CHANGED"); |
||
85 | --this:RegisterEvent("PLAYER_PVP_RANK_CHANGED"); |
||
86 | |||
87 | this:RegisterEvent("PLAYER_DEAD"); |
||
88 | end |
||
89 | |||
90 | function TitanPanelBGinfoButton_OnEvent() |
||
91 | |||
92 | --TitanPanelBGinfo_ChatPrint("BGinfo: OnEvent MAIN : "..event); |
||
93 | |||
94 | if ( event == "UPDATE_WORLD_STATES" ) then |
||
95 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Update_World_State\n"); |
||
96 | RequestBattlefieldScoreData(); |
||
97 | end |
||
98 | |||
99 | if ( event == "PLAYER_ENTERING_WORLD" ) then |
||
100 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Player_Entering_World"); |
||
101 | if ( UnitFactionGroup("player") == FACTION_ALLIANCE ) then |
||
102 | TITAN_BGINFO_ICON = "Interface\\PvPRankBadges\\PvPRankAlliance"; |
||
103 | else |
||
104 | TITAN_BGINFO_ICON = "Interface\\PvPRankBadges\\PvPRankHorde"; |
||
105 | end |
||
106 | TitanPlugins[TITAN_BGINFO_ID].icon = TITAN_BGINFO_ICON; |
||
107 | RequestBattlefieldScoreData(); |
||
108 | end |
||
109 | |||
110 | if ( event == "BATTLEFIELDS_SHOW" ) then |
||
111 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Battlefields_Show\n"); |
||
112 | end |
||
113 | |||
114 | if ( event == "BATTLEFIELDS_CLOSED" ) then |
||
115 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Battlefields_Closed\n"); |
||
116 | end |
||
117 | |||
118 | if ( event == "UPDATE_BATTLEFIELD_SCORE" ) then |
||
119 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Update_Battlefield_Score\n"); |
||
120 | RequestBattlefieldScoreData(); |
||
121 | end |
||
122 | |||
123 | if ( event == "UPDATE_BATTLEFIELD_STATUS" ) then |
||
124 | --TitanPanelBGinfo_ChatPrint("In OnEvent => Update_Battlefield_Status\n"); |
||
125 | RequestBattlefieldScoreData(); |
||
126 | end |
||
127 | |||
128 | if ( event == "PLAYER_PVP_KILLS_CHANGED" ) then |
||
129 | --TitanPanelBG_ChatPrint("In OnEvent => Player_PVP_Kills_Changed\n"); |
||
130 | RequestBattlefieldScoreData(); |
||
131 | end |
||
132 | |||
133 | if (event == "PLAYER_DEAD") then |
||
134 | --TitanPanelBGinfo_AutoRes(); |
||
135 | -- Auto-Release upon death. But not when soulstoned, and only in battlegrounds. |
||
136 | --local status, _, _ = GetBattlefieldStatus(); |
||
137 | --local queueID; |
||
138 | --local status, mapName, instanceID; |
||
139 | --for queueID = 1, MAX_BATTLEFIELD_QUEUES do |
||
140 | -- status, mapName, instanceID = GetBattlefieldStatus(queueID); |
||
141 | -- if (status == "active") and (not HasSoulstone()) and (TitanGetVar(TITAN_BGINFO_ID, "BGINFO_AutoRel") == 1) then |
||
142 | -- RepopMe(); |
||
143 | -- break; |
||
144 | -- end |
||
145 | --end |
||
146 | end |
||
147 | |||
148 | --if ( UnitIsDeadOrGhost("player") ) then |
||
149 | -- TitanPanelBGinfo_AutoRes(); |
||
150 | -- TitanPanelBGinfo_AutoRelease(); |
||
151 | --end |
||
152 | |||
153 | if ( TitanGetVar(TITAN_BGINFO_ID, "HideMinimap") ) then |
||
154 | MiniMapBattlefieldFrame:Hide(); |
||
155 | end |
||
156 | |||
157 | TitanPanelButton_UpdateButton(TITAN_BGINFO_ID); |
||
158 | TitanPanelButton_UpdateTooltip(); |
||
159 | end |
||
160 | |||
161 | function TitanPanelBGinfoButton_OnClick(button) |
||
162 | if ( button == "LeftButton" ) then |
||
163 | local queueID; |
||
164 | local status, mapName, instanceID; |
||
165 | for queueID=1,MAX_BATTLEFIELD_QUEUES do |
||
166 | status, mapName, instanceID = GetBattlefieldStatus(queueID); |
||
167 | if ( status == "active" ) then |
||
168 | ToggleWorldStateScoreFrame(); |
||
169 | break; |
||
170 | end |
||
171 | end |
||
172 | end |
||
173 | end |
||
174 | |||
175 | -- |
||
176 | -- Titan functions |
||
177 | -- |
||
178 | function TitanPanelBGinfoButton_GetButtonText(id) |
||
179 | local buttonRichText = ""; |
||
180 | |||
181 | local queueID; |
||
182 | local status, mapName, instanceID |
||
183 | |||
184 | for queueID=1, MAX_BATTLEFIELD_QUEUES do |
||
185 | |||
186 | status, mapName, instanceID = GetBattlefieldStatus(queueID); |
||
187 | |||
188 | local abbrmapName = TitanPanelBGinfo_MapNameAbbr(mapName); |
||
189 | |||
190 | if ( abbrmapName == nil ) then |
||
191 | abbrmapName = ""; |
||
192 | end |
||
193 | |||
194 | if ( instanceID ~= 0 ) then |
||
195 | abbrmapName = abbrmapName..instanceID; |
||
196 | end |
||
197 | |||
198 | if ( status == "queued" ) then |
||
199 | |||
200 | local waitTime = GetBattlefieldEstimatedWaitTime(queueID); |
||
201 | local timeInQueue = GetBattlefieldTimeWaited(queueID); |
||
202 | |||
203 | if ( waitTime == 0 ) then |
||
204 | waitTime = UNAVAILABLE; |
||
205 | elseif ( waitTime < 60000 ) then |
||
206 | waitTime = LESS_THAN_ONE_MINUTE; |
||
207 | else |
||
208 | waitTime = TitanPanelBGinfo_SecondsToTimeAbbrev(waitTime/1000); |
||
209 | end |
||
210 | |||
211 | if ( timeInQueue == 0 ) then |
||
212 | timeInQueue = UNAVAILABLE; |
||
213 | elseif ( timeInQueue < 60000 ) then |
||
214 | timeInQueue = LESS_THAN_ONE_MINUTE; |
||
215 | else |
||
216 | timeInQueue = TitanPanelBGinfo_SecondsToTimeAbbrev(timeInQueue/1000); |
||
217 | end |
||
218 | |||
219 | buttonRichText = buttonRichText.." "..TitanUtils_GetGreenText(abbrmapName)..":"..TitanUtils_GetHighlightText(waitTime)..TitanUtils_GetNormalText(" / ")..TitanUtils_GetHighlightText(timeInQueue); |
||
220 | |||
221 | elseif ( status == "confirm" ) then |
||
222 | |||
223 | buttonRichText = buttonRichText.." "..TitanUtils_GetGreenText(abbrmapName)..":"..TitanUtils_GetHighlightText(TITAN_BGINFO_CONFIRM_TEXT); |
||
224 | |||
225 | elseif ( status == "active" ) then |
||
226 | |||
227 | --local numStatColumns = GetNumBattlefieldStats(); |
||
228 | |||
229 | --if ( numStatColumns == 2 ) then |
||
230 | -- buttonRichText = TitanUtils_GetHighlightText(" CTF: "..abbrmapName); |
||
231 | --elseif ( numStatColumns == 7 ) then |
||
232 | buttonRichText = TitanUtils_GetHighlightText(" "..abbrmapName); |
||
233 | --end |
||
234 | |||
235 | else |
||
236 | --buttonRichText = buttonRichText.." "..TitanUtils_GetHighlightText(" N/A"); |
||
237 | end |
||
238 | end |
||
239 | |||
240 | return TITAN_BGINFO_BUTTON_LABEL, buttonRichText; |
||
241 | end |
||
242 | |||
243 | function TitanPanelBGinfoButton_GetTooltipText() |
||
244 | local tooltipRichText = ""; |
||
245 | local bgName = nil; |
||
246 | |||
247 | RequestBattlefieldScoreData(); |
||
248 | |||
249 | local playerName = UnitName("player"); |
||
250 | |||
251 | local queueID; |
||
252 | local status, mapName, instanceID; |
||
253 | for queueID=1,MAX_BATTLEFIELD_QUEUES do |
||
254 | status, mapName, instanceID = GetBattlefieldStatus(queueID); |
||
255 | |||
256 | local abbrmapName = TitanPanelBGinfo_MapNameAbbr(mapName); |
||
257 | |||
258 | if ( abbrmapName == nil ) then |
||
259 | abbrmapName = ""; |
||
260 | end |
||
261 | |||
262 | if ( instanceID ~= 0 ) then |
||
263 | mapName = mapName.." "..instanceID; |
||
264 | end |
||
265 | |||
266 | if ( status == "none" ) then |
||
267 | |||
268 | --tooltipRichText = tooltipRichText.."Queue"..queueID..": "..TITAN_BGINFO_NOTIN_TEXT.."\n"; |
||
269 | |||
270 | elseif ( status == "queued" ) then |
||
271 | |||
272 | local waitTime = GetBattlefieldEstimatedWaitTime(queueID); |
||
273 | local timeInQueue = GetBattlefieldTimeWaited(queueID)/1000; |
||
274 | if ( waitTime == 0 ) then |
||
275 | waitTime = UNAVAILABLE; |
||
276 | elseif ( waitTime < 60000 ) then |
||
277 | waitTime = LESS_THAN_ONE_MINUTE; |
||
278 | else |
||
279 | waitTime = SecondsToTime(waitTime/1000, 1); |
||
280 | end |
||
281 | tooltipRichText = tooltipRichText..format(BATTLEFIELD_IN_QUEUE, mapName, TitanUtils_GetHighlightText(waitTime), TitanUtils_GetHighlightText(SecondsToTime(timeInQueue))).."\n\n"; |
||
282 | |||
283 | elseif ( status == "confirm" ) then |
||
284 | |||
285 | tooltipRichText = tooltipRichText..format(BATTLEFIELD_QUEUE_CONFIRM, mapName, TitanUtils_GetHighlightText(SecondsToTime(GetBattlefieldPortExpiration(queueID)/1000))).."\n\n"; |
||
286 | |||
287 | elseif ( status == "active" ) then |
||
288 | |||
289 | local numScores = GetNumBattlefieldScores(); |
||
290 | local name, kills, killingBlows, deaths, honorGained, faction, rank, race, class; |
||
291 | |||
292 | --TitanPanelBGinfo_ChatPrint("numScores: "..numScores.."\n"); |
||
293 | |||
294 | tooltipRichText = tooltipRichText..mapName.."\n"; |
||
295 | |||
296 | for i=1, 80 do |
||
297 | name, killingBlows, honorableKills, deaths, honorGained, faction, rank, race, class = GetBattlefieldScore(i); |
||
298 | |||
299 | if ( name == playerName ) then |
||
300 | --TitanPanelBGinfo_ChatPrint(i..":"..name..":"..killingBlows..":"..honorableKills..":"..deaths.."\n"); |
||
301 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(KILLING_BLOWS..":").."\t"..TitanUtils_GetHighlightText(killingBlows).."\n"; |
||
302 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(HONORABLE_KILLS..":").."\t"..TitanUtils_GetHighlightText(honorableKills).."\n"; |
||
303 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(DEATHS..":").."\t"..TitanUtils_GetHighlightText(deaths).."\n"; |
||
304 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_BONUS_HONOR_TEXT..":").."\t"..TitanUtils_GetHighlightText(honorGained).."\n"; |
||
305 | |||
306 | local numStatColumns = GetNumBattlefieldStats(); |
||
307 | --TitanPanelBGinfo_ChatPrint(numStatColumns); |
||
308 | |||
309 | for j=1, MAX_NUM_STAT_COLUMNS do |
||
310 | if ( j <= numStatColumns ) then |
||
311 | columnData = GetBattlefieldStatData(i, j); |
||
312 | |||
313 | if ( abbrmapName == TITAN_BGINFO_WG_TEXT) then |
||
314 | if ( j == 1 ) then |
||
315 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_FLAGS_CAPTURED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
316 | elseif ( j == 2) then |
||
317 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_FLAGS_RETURNED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
318 | end |
||
319 | elseif ( abbrmapName == TITAN_BGINFO_AV_TEXT ) then |
||
320 | if ( j == 1 ) then |
||
321 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_GRAVEYARDS_ASSAULTED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
322 | elseif ( j == 2 ) then |
||
323 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_GRAVEYARDS_DEFENDED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
324 | elseif ( j == 3 ) then |
||
325 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_TOWERS_ASSAULTED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
326 | elseif ( j == 4 ) then |
||
327 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_TOWERS_DEFENDED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
328 | elseif ( j == 5 ) then |
||
329 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_MINES_CAPTURED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
330 | elseif ( j == 6 ) then |
||
331 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_LEADERS_KILLED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
332 | elseif ( j == 7 ) then |
||
333 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_SECONDARY_OBJECTIVES_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
334 | end |
||
335 | elseif ( abbrmapName == TITAN_BGINFO_AB_TEXT ) then |
||
336 | if ( j == 1 ) then |
||
337 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_BASES_ASSAULTED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
338 | elseif ( j == 2) then |
||
339 | tooltipRichText = tooltipRichText..TitanUtils_GetGreenText(TITAN_BGINFO_BASES_DEFENDED_TEXT..": ").."\t"..TitanUtils_GetHighlightText(columnData).."\n"; |
||
340 | end |
||
341 | end |
||
342 | end |
||
343 | end |
||
344 | break; |
||
345 | end |
||
346 | end |
||
347 | break; |
||
348 | end |
||
349 | |||
350 | local bgtime = GetBattlefieldInstanceRunTime(); |
||
351 | end |
||
352 | |||
353 | tooltipRichText = tooltipRichText.."\n"..TitanUtils_GetGreenText(TITAN_BGINFO_HINT_TEXT); |
||
354 | |||
355 | return tooltipRichText; |
||
356 | end |
||
357 | |||
358 | -- |
||
359 | -- create menus |
||
360 | -- |
||
361 | function TitanPanelRightClickMenu_PrepareBGinfoMenu() |
||
362 | local info = {}; |
||
363 | |||
364 | if ( UIDROPDOWNMENU_MENU_LEVEL == 2 ) then |
||
365 | if ( UIDROPDOWNMENU_MENU_VALUE == "DisplayAbout" ) then |
||
366 | info = {}; |
||
367 | info.text = TITAN_BGINFO_ABOUT_POPUP_TEXT; |
||
368 | info.value = "AboutTextPopUP"; |
||
369 | info.notClickable = 1; |
||
370 | info.isTitle = 0; |
||
371 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
372 | end |
||
373 | |||
374 | if ( UIDROPDOWNMENU_MENU_VALUE == "BGINFO_Options" ) then |
||
375 | --info = {}; |
||
376 | --info.text = TITANBG_MENU_AUTOJOIN; |
||
377 | --info.value = "B_AutoJoin"; |
||
378 | --info.func = TitanPanelTitanBGButton_ToggleVar; |
||
379 | --info.checked = TitanGetVar(TITAN_TITANBG_ID, "B_AutoJoin"); |
||
380 | --info.keepShownOnClick = 1; |
||
381 | --UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
382 | |||
383 | --TitanPanelRightClickMenu_AddSpacer(UIDROPDOWNMENU_MENU_LEVEL); |
||
384 | |||
385 | --info = {}; |
||
386 | --info.text = TITAN_BGINFO_AUTORES_TEXT; |
||
387 | --info.value = "BGINFO_AutoRes"; |
||
388 | --info.func = TitanPanelBGinfo_ToggleVar; |
||
389 | --info.checked = TitanGetVar(TITAN_BGINFO_ID, "BGINFO_AutoRes"); |
||
390 | --info.keepShownOnClick = 1; |
||
391 | --UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
392 | |||
393 | --info = {}; |
||
394 | --info.text = TITAN_BGINFO_AUTOREL_TEXT; |
||
395 | --info.value = "BGINFO_AutoRel"; |
||
396 | --info.func = TitanPanelBGinfo_ToggleVar; |
||
397 | --info.checked = TitanGetVar(TITAN_BGINFO_ID, "BGINFO_AutoRel"); |
||
398 | --info.keepShownOnClick = 1; |
||
399 | --UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
400 | end |
||
401 | |||
402 | return; |
||
403 | end |
||
404 | |||
405 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_BGINFO_ID].menuText); |
||
406 | |||
407 | local queueID; |
||
408 | local status, mapName, instanceID; |
||
409 | local numQueued = 0; |
||
410 | local activeBG = 0; |
||
411 | for queueID=1,MAX_BATTLEFIELD_QUEUES do |
||
412 | status, mapName, instanceID = GetBattlefieldStatus(queueID); |
||
413 | |||
414 | if ( status == "queued" or status == "confirm") then |
||
415 | numQueued = numQueued+1; |
||
416 | -- Add a spacer if there were dropdown items before this |
||
417 | if ( numQueued > 1 ) then |
||
418 | info = {}; |
||
419 | info.text = ""; |
||
420 | info.isTitle = 1; |
||
421 | --info.notCheckable = 1; |
||
422 | UIDropDownMenu_AddButton(info); |
||
423 | end |
||
424 | info = {}; |
||
425 | info.text = mapName; |
||
426 | info.isTitle = 1; |
||
427 | --info.notCheckable = 1; |
||
428 | UIDropDownMenu_AddButton(info); |
||
429 | |||
430 | if ( status == "queued" ) then |
||
431 | info = {}; |
||
432 | info.text = CHANGE_INSTANCE; |
||
433 | info.func = ShowBattlefieldList; |
||
434 | info.arg1 = queueID; |
||
435 | --info.notCheckable = 1; |
||
436 | UIDropDownMenu_AddButton(info); |
||
437 | info = {}; |
||
438 | info.text = LEAVE_QUEUE; |
||
439 | info.func = AcceptBattlefieldPort; |
||
440 | info.arg1 = queueID; |
||
441 | info.arg2 = nil; |
||
442 | --info.notCheckable = 1; |
||
443 | UIDropDownMenu_AddButton(info); |
||
444 | |||
445 | |||
446 | elseif ( status == "confirm") then |
||
447 | info = {}; |
||
448 | info.text = ENTER_BATTLE; |
||
449 | info.func = AcceptBattlefieldPort; |
||
450 | info.arg1 = queueID; |
||
451 | info.arg2 = 1; |
||
452 | --info.notCheckable = 1; |
||
453 | UIDropDownMenu_AddButton(info); |
||
454 | info = {}; |
||
455 | info.text = LEAVE_QUEUE; |
||
456 | info.func = AcceptBattlefieldPort; |
||
457 | info.arg1 = queueID; |
||
458 | info.arg2 = nil; |
||
459 | --info.notCheckable = 1; |
||
460 | UIDropDownMenu_AddButton(info); |
||
461 | end |
||
462 | elseif ( status == "active" ) then |
||
463 | activeBG = 1; |
||
464 | info = {}; |
||
465 | info.text = TITAN_BGINFO_TOGGLE_SCORES_TEXT; |
||
466 | info.func = ToggleWorldStateScoreFrame; |
||
467 | UIDropDownMenu_AddButton(info); |
||
468 | break; |
||
469 | end |
||
470 | end |
||
471 | |||
472 | TitanPanelRightClickMenu_AddSpacer(); |
||
473 | |||
474 | if ( activeBG == 1 or numQueued > 0 ) then |
||
475 | info = {}; |
||
476 | info.text = TITAN_BGINFO_TOGGLE_MINIMAP_TEXT; |
||
477 | info.value = "ToggleMiniIcon"; |
||
478 | info.func = function () |
||
479 | if ( MiniMapBattlefieldFrame ~= nil) then |
||
480 | if ( MiniMapBattlefieldFrame:IsVisible() ) then |
||
481 | TitanSetVar(TITAN_BGINFO_ID,"HideMinimap",1); |
||
482 | MiniMapBattlefieldFrame:Hide(); |
||
483 | else |
||
484 | TitanSetVar(TITAN_BGINFO_ID,"HideMinimap",nil); |
||
485 | MiniMapBattlefieldFrame:Show(); |
||
486 | end |
||
487 | end |
||
488 | end |
||
489 | UIDropDownMenu_AddButton(info); |
||
490 | end |
||
491 | |||
492 | -- options (autores, autorelease) |
||
493 | --info = {}; |
||
494 | --info.text = TITAN_BGINFO_OPTIONS_TEXT; |
||
495 | --info.value = "BGINFO_Options"; |
||
496 | --info.hasArrow = 1; |
||
497 | --UIDropDownMenu_AddButton(info); |
||
498 | |||
499 | TitanPanelRightClickMenu_AddSpacer(); |
||
500 | TitanPanelRightClickMenu_AddToggleLabelText(TITAN_BGINFO_ID); |
||
501 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, TITAN_BGINFO_ID, TITAN_PANEL_MENU_FUNC_HIDE); |
||
502 | |||
503 | -- info about plugin |
||
504 | local info = {}; |
||
505 | info.text = TITAN_BGINFO_ABOUT_TEXT; |
||
506 | info.value = "DisplayAbout"; |
||
507 | info.hasArrow = 1; |
||
508 | UIDropDownMenu_AddButton(info); |
||
509 | end |
||
510 | |||
511 | -- |
||
512 | -- BGinfo functions |
||
513 | -- |
||
514 | function TitanPanelBGinfo_MapNameAbbr(mapName) |
||
515 | |||
516 | if ( mapName == TITAN_BGINFO_AV_FULL_TEXT ) then |
||
517 | mapName = TITAN_BGINFO_AV_TEXT; |
||
518 | elseif ( mapName == TITAN_BGINFO_WG_FULL_TEXT ) then |
||
519 | mapName = TITAN_BGINFO_WG_TEXT; |
||
520 | elseif ( mapName == TITAN_BGINFO_AB_FULL_TEXT ) then |
||
521 | mapName = TITAN_BGINFO_AB_TEXT; |
||
522 | end |
||
523 | |||
524 | return mapName; |
||
525 | end |
||
526 | |||
527 | function TitanPanelBGinfo_SecondsToTimeAbbrev(seconds) |
||
528 | local time = ""; |
||
529 | local tempTime; |
||
530 | if ( seconds > 86400 ) then |
||
531 | tempTime = floor(seconds / 86400); |
||
532 | time = tempTime.." "..DAY_ONELETTER_ABBR; |
||
533 | return time; |
||
534 | end |
||
535 | if ( seconds > 3600 ) then |
||
536 | tempTime = floor(seconds / 3600); |
||
537 | time = tempTime.." "..HOUR_ONELETTER_ABBR; |
||
538 | return time; |
||
539 | end |
||
540 | if ( seconds > 60 ) then |
||
541 | tempTime = floor(seconds / 60); |
||
542 | time = tempTime.." "..MINUTE_ONELETTER_ABBR; |
||
543 | return time; |
||
544 | end |
||
545 | tempTime = format("%d", seconds); |
||
546 | time = tempTime.." "..SECOND_ONELETTER_ABBR; |
||
547 | return time; |
||
548 | end |
||
549 | |||
550 | function TitanPanelBGinfo_ToggleVar() |
||
551 | TitanToggleVar(TITAN_BGINFO_ID, this.value); |
||
552 | TitanPanelButton_UpdateButton(TITAN_BFINFO_ID); |
||
553 | end |
||
554 | |||
555 | function TitanPanelBGinfo_AutoRes() |
||
556 | --if ( TitanGetVar(TITAN_BGINFO_ID, "BGINFO_AutoRes") ) then |
||
557 | -- local status, _, _ = GetBattlefieldStatus(); |
||
558 | -- if ( status == "active" ) then |
||
559 | -- if ( UnitIsGhost("player") ) then |
||
560 | -- AcceptAreaSpiritHeal(); |
||
561 | |||
562 | -- for index = 1, STATICPOPUP_NUMDIALOGS, 1 do |
||
563 | -- local frame = getglobal("StaticPopup"..index); |
||
564 | -- if ( frame:IsVisible() and frame.which == "AREA_SPIRIT_HEAL" ) then |
||
565 | -- getglobal("StaticPopup"..index.."Button1"):Hide(); |
||
566 | -- getglobal("StaticPopup"..index.."Button2"):Hide(); |
||
567 | -- end |
||
568 | -- end |
||
569 | -- end |
||
570 | -- end |
||
571 | --end |
||
572 | end |
||
573 | |||
574 | function TitanPanelBGinfo_AutoRelease() |
||
575 | --if ( TitanGetVar(TITAN_BGINFO_ID, "BGINFO_AutoRel") ) then |
||
576 | -- local status, _, _ = GetBattlefieldStatus(); |
||
577 | -- if ( status == "active" ) then |
||
578 | -- RepopMe(); |
||
579 | -- end |
||
580 | --end |
||
581 | end |
||
582 | |||
583 | function TitanPanelBGinfo_ChatPrint(msg) |
||
584 | DEFAULT_CHAT_FRAME:AddMessage(msg); |
||
585 | end |