vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- BGAssist |
2 | -- Copyright 2005 original author. Copyright is expressly not transferred to Blizzard. |
||
3 | -- |
||
4 | -- Battleground helper functionality |
||
5 | -- |
||
6 | -- Author: Marc aka Saien on Hyjal |
||
7 | -- WoWSaien@gmail.com |
||
8 | -- http://64.168.251.69/wow |
||
9 | -- |
||
10 | -- Changes: |
||
11 | -- 2006.01.03 |
||
12 | -- Updated to 1.9 TOC |
||
13 | -- Updated to supported multiple BG Queues. |
||
14 | -- Auto Join will not auto join if you're already in another BG. |
||
15 | -- AFK works like this: When you zone in to a BG, you lose your AFK but |
||
16 | -- are almost immediately reflagged. This zones you out, losing your space |
||
17 | -- in the queue. This is verified as of 1.9. Due to this, Autojoin will |
||
18 | -- once again not join when AFK. |
||
19 | -- 2005.10.10 |
||
20 | -- Due to Blizzard changes, Autojoin will again join when you're AFK. |
||
21 | -- Autorez in BG option removed as it has been implemented by Blizzard |
||
22 | -- 2005.09.13 |
||
23 | -- TOC change to 1700 and adjust to 1.7 changes |
||
24 | -- Arathi Basin timers work. |
||
25 | -- Timers have been changed to match the mainmap colors. Timer will show the color |
||
26 | -- of the attacking faction. This is opposite previous versions. |
||
27 | -- To avoid group-bug problems, Autoleave group leaves the group at the win/loss screen. |
||
28 | -- If you /afk out it will still leave the group after you zone. |
||
29 | -- WSG/AB: Config option to not autojoin instances that exist at the time you queue up. |
||
30 | -- 2005.09.03 |
||
31 | -- Will no longer popup an error when more than 10 targets are to be displayed on target list |
||
32 | -- Target list will show/hide when checking/unchecking the config option immediately, |
||
33 | -- not just when you zone. |
||
34 | -- 2005.08.24 |
||
35 | -- Alliance sites being captured now are cyan in the timer. Dark blue just too hard to see. |
||
36 | -- Timer countdowns will now only show the first word of the name. |
||
37 | -- Fixed bug causing error popup in AV. |
||
38 | -- Option to autoaccept group invites when in a BG |
||
39 | -- Option to autoleave your group when leaving BG |
||
40 | -- Will not auto enter BG when dead or ghost. |
||
41 | -- Fixed Slidore's quest name -again-. Hey, I'm horde and can't test it |
||
42 | -- 2005.08.13 |
||
43 | -- Class breakdown on score window. |
||
44 | -- Targetting assistance window. See web. |
||
45 | -- Fixed typo in Sildore's quest name. |
||
46 | -- Warsong Gulch: Flag carrier named onscreen now. Needs translations for |
||
47 | -- filthy foreigners to work. |
||
48 | -- German updates, though quests need more work for autocomplete. Frogs are mostly done now, except for new stuff. |
||
49 | -- 2005.07.19 |
||
50 | -- Will not autoenter if you're AFK |
||
51 | -- French localization partially in place. Still requires update, German is |
||
52 | -- completly undone. Note that quest turnins will not work unless setup for |
||
53 | -- your language properly. As I speak neither language (and proud of it) this |
||
54 | -- is all on your shoulders, not mine. |
||
55 | -- Rez timer in place. Might not be entirely accurate (based on your network lag) |
||
56 | -- and won't start counting down until you die once after zoning in. |
||
57 | -- Checkmark for not showing the window at zonein was being set backwards. |
||
58 | -- 2007.07.15-2 |
||
59 | -- Unnecessary zone restriction on autorez removed (aka Should work in Gulch now) |
||
60 | -- 2005.07.15 |
||
61 | -- Auto release in BG |
||
62 | -- Keybinding to toggle window on or off regardless of in BG or not |
||
63 | -- Config option to not turn window on when entering BG |
||
64 | -- Player per faction counts are unncessary now. |
||
65 | -- |
||
66 | |||
67 | BGASSIST_VERSION = "2006.01.03"; |
||
68 | |||
69 | BINDING_HEADER_BGASSIST_SEP = "BGAssist"; |
||
70 | BINDING_NAME_BGASSIST_TOGGLE = "Toggle BGAssist Window"; |
||
71 | |||
72 | local BGAssist_ItemTrack = { |
||
73 | [17422] = "INV_Shoulder_19", -- "Armor Scraps" |
||
74 | -- Horde |
||
75 | [17306] = "INV_Potion_50", -- "Stormpike Soldier's Blood" |
||
76 | [17642] = "INV_Misc_Pelt_Bear_02", -- "Alterac Ram Hide" |
||
77 | [18142] = "INV_Misc_Head_Elf_02", -- "Severed Night Elf Head" |
||
78 | [18143] = "INV_Misc_MonsterTail_02", -- "Tuft of Gnome Hair" |
||
79 | [18206] = "INV_Misc_Bone_03", -- "Dwarf Spine" |
||
80 | [18144] = "INV_Misc_Bone_07", -- "Human Bone Chip" |
||
81 | [17326] = "INV_Misc_Food_52", -- "Stormpike Soldier's Flesh", |
||
82 | [17327] = "INV_Misc_Food_72", -- "Stormpike Lieutenant's Flesh" |
||
83 | [17328] = "INV_Misc_Food_69", -- "Stormpike Commander's Flesh", |
||
84 | -- Alliance |
||
85 | [17423] = "INV_Misc_Gem_Pearl_06", -- "Storm Crystal" |
||
86 | [17643] = "INV_Misc_Pelt_Bear_02", -- "Frostwolf Hide" |
||
87 | [18145] = "INV_Misc_Foot_Centaur", -- "Tauren Hoof" |
||
88 | [18146] = "INV_Potion_82", -- "Darkspear Troll Mojo" |
||
89 | [18207] = "INV_Misc_Bone_08", -- "Orc Tooth" |
||
90 | [18147] = "INV_Misc_Organ_01", -- "Forsaken Heart" |
||
91 | [17502] = "INV_Jewelry_Talisman_06", -- "Frostwolf Soldier's Medal" |
||
92 | [17503] = "INV_Jewelry_Talisman_04", -- "Frostwolf Lieutenant's Medal" |
||
93 | [17504] = "INV_Jewelry_Talisman_12", -- "Frostwolf Commander's Medal" |
||
94 | }; |
||
95 | local BGAssist_Alterac_Quests = { |
||
96 | ["Irondeep Supplies"] = true, |
||
97 | ["Coldtooth Supplies"] = true, |
||
98 | ["Master Ryson's All Seeing Eye"] = true, |
||
99 | ["Empty Stables"] = true, -- Wolf/Ram turnin |
||
100 | -- Horde |
||
101 | ["More Booty!"] = { item = 17422, min=20 }, |
||
102 | ["Lokholar the Ice Lord"] = { item = 17306, max=4 }, |
||
103 | ["A Gallon of Blood"] = { item = 17306, min=5 }, |
||
104 | ["Ram Hide Harnesses"] = { item = 17642 }, |
||
105 | ["Darkspear Defense"] = { item = 18142 }, |
||
106 | ["Tuft it Out"] = { item = 18143 }, |
||
107 | ["Wanted: MORE DWARVES!"] = { item = 18206 }, |
||
108 | ["I've Got A Fever For More Bone Chips"]= { item = 18144 }, |
||
109 | ["Call of Air - Guse's Fleet"] = { item = 17326 }, |
||
110 | ["Call of Air - Jeztor's Fleet"] = { item = 17327 }, |
||
111 | ["Call of Air - Mulverick's Fleet"] = { item = 17328 }, |
||
112 | -- Alliance |
||
113 | ["More Armor Scraps"] = { item = 17422, min=20 }, |
||
114 | ["Ivus the Forest Lord"] = { item = 17423, max=4 }, |
||
115 | ["Crystal Cluster"] = { item = 17423, min=5 }, |
||
116 | ["Ram Riding Harnesses"] = { item = 17643 }, |
||
117 | ["What the Hoof?"] = { item = 18145 }, |
||
118 | ["Staghelm's Mojo Jamboree"] = { item = 18146 }, |
||
119 | ["Wanted: MORE ORCS!"] = { item = 18207 }, |
||
120 | ["One Man's Love"] = { item = 18147 }, |
||
121 | ["Call of Air - Slidore's Fleet"] = { item = 17502 }, |
||
122 | ["Call of Air - Vipore's Fleet"] = { item = 17503 }, |
||
123 | ["Call of Air - Ichman's Fleet"] = { item = 17504 }, |
||
124 | }; |
||
125 | local BGAssist_FlagRegexp = { |
||
126 | ["RESET"] = { ["regexp"] = "The flags are now placed at their bases." }, |
||
127 | ["PICKED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
128 | ["regexp"] = "The ([^ ]*) [fF]lag was picked up by ([^!]*)!" }, |
||
129 | ["DROPPED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
130 | ["regexp"] = "The ([^ ]*) [fF]lag was dropped by ([^!]*)!" }, |
||
131 | ["RETURNED"] ={ ["one"] = "FACTION", ["two"] = "PLAYER", |
||
132 | ["regexp"] = "The ([^ ]*) [fF]lag was returned to its base by ([^!]*)!" }, |
||
133 | ["CAPTURED"] ={ ["one"] = "PLAYER", ["two"] = "FACTION", |
||
134 | ["regexp"] = "([^ ]*) captured the ([^ ]*) flag!" }, |
||
135 | }; |
||
136 | local ALTERACVALLEY = "Alterac Valley"; |
||
137 | local WARSONGGULCH = "Warsong Gulch"; |
||
138 | local ARATHIBASIN = "Arathi Basin"; |
||
139 | |||
140 | local DISPLAY_MENU_LOCKWINDOW = "Lock Window Position"; |
||
141 | local DISPLAY_MENU_AUTOSHOW = "Auto Show Window when Entering BG"; |
||
142 | local DISPLAY_MENU_AUTORELEASE = "Auto Release in BG"; |
||
143 | local DISPLAY_MENU_AUTOQUEST = "Auto Confirm Quests"; |
||
144 | local DISPLAY_MENU_AUTOENTER = "Auto Enter BG"; |
||
145 | local DISPLAY_MENU_AUTOSIGNUP = "Auto Signup for BG"; |
||
146 | local DISPLAY_MENU_TIMERSHOW = "Show Capture Timers"; |
||
147 | local DISPLAY_MENU_ITEMSHOW = "Show BG Item Counts"; |
||
148 | local DISPLAY_MENU_GYCOUNTDOWN = "Show Timer for GY Rezzing"; |
||
149 | local DISPLAY_MENU_FLAGTRACKING = "Track Flags"; |
||
150 | local DISPLAY_MENU_TARGETTINGASSISTANCE = "Use Targetting Assistance Window"; |
||
151 | local DISPLAY_MENU_AUTOACCEPTGROUP = "Auto accept group invites in BG"; |
||
152 | local DISPLAY_MENU_AUTOLEAVEGROUP = "Auto leave group when leaving BG"; |
||
153 | local DISPLAY_MENU_NOPREEXISTING = "No pre-existing instances"; |
||
154 | local DISPLAY_MENU_SHOWCAPTUREDFLAGS = "Show flags already captured"; |
||
155 | local DISPLAY_TITLEDISPLAY_CAPTURE = "Captures"; |
||
156 | local DISPLAY_TITLEDISPLAY_ITEMS = "Items"; |
||
157 | local DISPLAY_TITLEDISPLAY_TARGETS = "Targets"; |
||
158 | local DISPLAY_TEXT_PREEXISTING = "Offered BG instance is pre-existing"; |
||
159 | local DISPLAY_TEXT_ENTERINGBATTLEGROUNDS = "Entering Battlegrounds"; |
||
160 | local DISPLAY_TEXT_LEFTBATTLEGROUNDS = "Left Battlegrounds"; |
||
161 | local DISPLAY_TEXT_TIMEUNTILREZ = "Time Until Ressurection"; |
||
162 | local DISPLAY_TEXT_TIMELEFT = "Time Left"; |
||
163 | local DISPLAY_TEXT_SECONDS = "seconds"; |
||
164 | local DISPLAY_TEXT_MINUTES = "minutes"; |
||
165 | local DISPLAY_TEXT_NOTENTERINGAFK = "Not entering BG because you are AFK"; |
||
166 | local DISPLAY_TEXT_FLAGHOLDERNOTCLOSEENOUGH = "Flag Holder not close enough to target."; |
||
167 | local BATTLEGROUND_GOSSIP_TEXT = "I would like to go to the battleground."; |
||
168 | local MATCHING_MARKED_AFK = "You are now AFK"; |
||
169 | local MATCHING_CLEARED_AFK = "You are no longer AFK."; |
||
170 | local FACTION_ALLIANCE = "Alliance"; |
||
171 | local FACTION_HORDE = "Horde"; |
||
172 | local CLASS_WARRIOR = "Warrior"; |
||
173 | local CLASS_MAGE = "Mage"; |
||
174 | local CLASS_ROGUE = "Rogue"; |
||
175 | local CLASS_DRUID = "Druid"; |
||
176 | local CLASS_HUNTER = "Hunter"; |
||
177 | local CLASS_SHAMAN = "Shaman"; |
||
178 | local CLASS_PRIEST = "Priest"; |
||
179 | local CLASS_WARLOCK = "Warlock"; |
||
180 | local CLASS_PALADIN = "Paladin" |
||
181 | |||
182 | if ( GetLocale() == "frFR" ) then |
||
183 | -- Mail updates to WoWSaien@gmail.com |
||
184 | -- DISPLAY_xxx variables can be anything you want to display |
||
185 | -- EVERYTHING ELSE MUST MATCH THE GAME |
||
186 | BINDING_NAME_BGASSIST_TOGGLE = "Toggle BGAssist Window"; |
||
187 | BGAssist_Alterac_Quests = { |
||
188 | ["Fournitures d'Irondeep"] = true, |
||
189 | ["Fournitures de Coldtooth"] = true, |
||
190 | ["L'Oeil qui voit tout de maître Ryson"] = true, |
||
191 | ["Ecuries vides"] = true, |
||
192 | -- Horde |
||
193 | ["Plus de butin !"] = { item = 17422, min=20 }, |
||
194 | ["Lokholar le Seigneur des Glaces"] = { item = 17306, max=4 }, |
||
195 | ["Quelques litres de sang"] = { item = 17306, min=5 }, |
||
196 | ["Harnais en cuir de bélier"] = { item = 17642 }, |
||
197 | ["La défense des Darkspear"] = { item = 18142 }, |
||
198 | ["Pour une poignée de cheuveux"] = { item = 18143 }, |
||
199 | ["On recherche : PLUS DE NAINS !"] = { item = 18206 }, |
||
200 | ["I've Got A Fever For More Bone Chips"]= { item = 18144 }, |
||
201 | ["L'appel des airs - l'escadrille de Guse"] = { item = 17326 }, |
||
202 | ["L'appel des airs - l'escadrille de Jeztor"] = { item = 17327 }, |
||
203 | ["L'appel des airs - l'escadrille de Mulverick"]= { item = 17328 }, |
||
204 | -- Alliance |
||
205 | ["Plus de morceaux d'armure !"] = { item = 17422, min=20 }, |
||
206 | ["Ivus le Seigneur des for\195\170ts"] = { item = 17423, max=4 }, |
||
207 | ["Crystal Cluster"] = { item = 17423, min=5 }, |
||
208 | ["Harnais pour b\195\169liers"] = { item = 17643 }, |
||
209 | ["Chasse aux sabots !"] = { item = 18145 }, |
||
210 | ["La collection de mojos de Staghelm"] = { item = 18146 }, |
||
211 | ["On recherche : PLUS D'ORCS !"] = { item = 18207 }, |
||
212 | ["L'amour d'un homme"] = { item = 18147 }, |
||
213 | ["L'appel des airs - l'escadrille de Slidore"] = { item = 17502 }, |
||
214 | ["L'appel des airs - l'escadrille de Vipore"] = { item = 17503 }, |
||
215 | ["L'appel des airs - l'escadrille d'Ichman"] = { item = 17504 }, |
||
216 | }; |
||
217 | BGAssist_FlagRegexp = { |
||
218 | ["RESET"] = { ["regexp"] = "The flags are now placed at their bases." }, |
||
219 | ["PICKED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
220 | ["regexp"] = "The ([^ ]*) flag was picked up by ([^!]*)!" }, |
||
221 | ["DROPPED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
222 | ["regexp"] = "The ([^ ]*) flag was dropped by ([^!]*)!" }, |
||
223 | ["RETURNED"] ={ ["one"] = "FACTION", ["two"] = "PLAYER", |
||
224 | ["regexp"] = "The ([^ ]*) flag was returned to its base by ([^!]*)!" }, |
||
225 | ["CAPTURED"] ={ ["one"] = "PLAYER", ["two"] = "FACTION", |
||
226 | ["regexp"] = "([^ ]*) captured the ([^ ]*) flag!" }, |
||
227 | }; |
||
228 | ALTERACVALLEY = "Vall\195\169e d'Alterac"; |
||
229 | WARSONGGULCH = "Goulet des Warsong"; |
||
230 | ARATHIBASIN = "Arathi Basin"; |
||
231 | DISPLAY_MENU_LOCKWINDOW = "Verrouiller la position de la fen\195\170tre de BGAssist"; |
||
232 | DISPLAY_MENU_AUTOSHOW = "Afficher automatiquement la fen\195\170tre de BGAssist dans le BG"; |
||
233 | DISPLAY_MENU_AUTORELEASE = "R\195\169surrection automatique au cimeti\195\168re"; |
||
234 | DISPLAY_MENU_AUTOQUEST = "Confirmer automatiquement les qu\195\170tes"; |
||
235 | DISPLAY_MENU_AUTOENTER = "Entrer automatiquement dans le BG"; |
||
236 | DISPLAY_MENU_TIMERSHOW = "Afficher le temps de capture des cimeti\195\168res et des tours"; |
||
237 | DISPLAY_MENU_ITEMSHOW = "Afficher le nombre d'items de qu\195\170tes que vous poss\195\169dez"; |
||
238 | DISPLAY_MENU_GYCOUNTDOWN = "Afficher le temps restant avant r\195\169surrection au cimeti\195\168re"; |
||
239 | DISPLAY_MENU_FLAGTRACKING = "Track Flags"; |
||
240 | DISPLAY_MENU_TARGETTINGASSISTANCE = "Targetting Assistance Window"; |
||
241 | DISPLAY_MENU_AUTOACCEPTGROUP = "Auto accept group invites in BG"; |
||
242 | DISPLAY_MENU_AUTOLEAVEGROUP = "Auto leave group when leaving BG"; |
||
243 | DISPLAY_MENU_NOPREEXISTING = "No pre-existing instances"; |
||
244 | DISPLAY_TITLETEXT_CAPTURE = "Capture"; |
||
245 | DISPLAY_TITLETEXT_ITEMS = "Items"; |
||
246 | DISPLAY_TITLEDISPLAY_TARGETS = "Targets"; |
||
247 | DISPLAY_TEXT_ENTERINGBATTLEGROUNDS = "Vous entrez dans le BG"; |
||
248 | DISPLAY_TEXT_LEFTBATTLEGROUNDS = "Vous quittez le BG"; |
||
249 | DISPLAY_TEXT_TIMELEFT = "Temps restant"; |
||
250 | DISPLAY_TEXT_SECONDS = "secondes"; |
||
251 | DISPLAY_TEXT_MINUTES = "minutes"; |
||
252 | DISPLAY_TEXT_NOTENTERINGAFK = "N'entre pas dans le BG pendant que vous \195\170tes ABS"; |
||
253 | DISPLAY_TEXT_FLAGHOLDERNOTCLOSEENOUGH = "Flag Holder not close enough to target."; |
||
254 | DISPLAY_TEXT_PREEXISTING = "Offered BG instance is pre-existing"; |
||
255 | BATTLEGROUND_GOSSIP_TEXT = "I would like to go to the battleground."; |
||
256 | MATCHING_MARKED_AFK = "You are now AFK"; |
||
257 | MATCHING_CLEARED_AFK = "You are no longer AFK."; |
||
258 | FACTION_ALLIANCE = "Alliance"; |
||
259 | FACTION_HORDE = "Horde"; |
||
260 | CLASS_DRUID = "Druide"; |
||
261 | CLASS_HUNTER = "Chasseur"; |
||
262 | CLASS_MAGE = "Mage"; |
||
263 | CLASS_PALADIN = "Paladin" |
||
264 | CLASS_PRIEST = "Prêtre"; |
||
265 | CLASS_ROGUE = "Voleur"; |
||
266 | CLASS_SHAMAN = "Chaman"; |
||
267 | CLASS_WARRIOR = "Guerrier"; |
||
268 | CLASS_WARLOCK = "Démoniste"; |
||
269 | end |
||
270 | |||
271 | if ( GetLocale() == "deDE" ) then |
||
272 | -- Mail updates to WoWSaien@gmail.com |
||
273 | -- DISPLAY_xxx variables can be anything you want to display |
||
274 | -- EVERYTHING ELSE MUST MATCH THE GAME |
||
275 | BINDING_NAME_BGASSIST_TOGGLE = "BGAssist Fenster ein- oder ausblenden"; |
||
276 | BGAssist_Alterac_Quests = { |
||
277 | ["Irondeep-Vorr\195\164te"] = true, |
||
278 | ["Coldtooth-Vorr\195\164te"] = true, |
||
279 | ["Meister Rysons Allsehendes Auge"] = true, |
||
280 | ["Verwaiste St\195\164lle"] = true, -- Wolf/Ram turnin |
||
281 | -- Horde |
||
282 | ["Mehr Beute!"] = { item= 17422, min=20 }, |
||
283 | ["Lokholar der Eislord"] = { item= 17306, max=4 }, |
||
284 | ["Eine Gallone Blut"] = { item= 17306, min=5 }, |
||
285 | ["Widderledernes Zaumzeug"] = { item= 17642 }, |
||
286 | ["Verteidigung der Darkspear"] = { item= 18142 }, |
||
287 | ["Mehr Gnomhaar"] = { item= 18143 }, |
||
288 | ["Gesucht: MEHR ZWERGE"] = { item= 18206 }, |
||
289 | ["Knochensplitterjagd"] = { item= 18144 }, |
||
290 | ["Ruf der L\195\188fte - Guses Luftflotte"] = { item= 17326 }, |
||
291 | ["Ruf der L\195\188fte - Jeztors Luftflotte"] = { item= 17327 }, |
||
292 | ["Ruf der L\195\188fte - Mulvericks Luftflotte"]= { item= 17328 }, |
||
293 | -- Alliance |
||
294 | ["More Armor Scraps"] = { item = 17422, min=20 }, |
||
295 | ["Ivus der Waldf\195\188rst"] = { item = 17423, max=4 }, |
||
296 | ["Crystal Cluster"] = { item = 17423, min=5 }, |
||
297 | ["Ram Riding Harnesses"] = { item = 17643 }, |
||
298 | ["What the Hoof?"] = { item = 18145 }, |
||
299 | ["Staghelm's Mojo Jamboree"] = { item = 18146 }, |
||
300 | ["Gesucht: MEHR ORCS"] = { item = 18207 }, |
||
301 | ["One Man's Love"] = { item = 18147 }, |
||
302 | ["Ruf der L\195\188fte - Slidores Luftflotte"] = { item = 17502 }, |
||
303 | ["Ruf der L\195\188fte - Vipores Luftflotte"] = { item = 17503 }, |
||
304 | ["Ruf der L\195\188fte - Ichmans Luftflotte"] = { item = 17504 }, |
||
305 | }; |
||
306 | BGAssist_FlagRegexp = { |
||
307 | ["RESET"] = { ["regexp"] = "The flags are now placed at their bases." }, |
||
308 | ["PICKED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
309 | ["regexp"] = "The ([^ ]*) flag was picked up by ([^!]*)!" }, |
||
310 | ["DROPPED"] = { ["one"] = "FACTION", ["two"] = "PLAYER", |
||
311 | ["regexp"] = "The ([^ ]*) flag was dropped by ([^!]*)!" }, |
||
312 | ["RETURNED"] ={ ["one"] = "FACTION", ["two"] = "PLAYER", |
||
313 | ["regexp"] = "The ([^ ]*) flag was returned to its base by ([^!]*)!" }, |
||
314 | ["CAPTURED"] ={ ["one"] = "PLAYER", ["two"] = "FACTION", |
||
315 | ["regexp"] = "([^ ]*) captured the ([^ ]*) flag!" }, |
||
316 | }; |
||
317 | ALTERACVALLEY = "Alteractal"; |
||
318 | WARSONGGULCH = "Warsongschlucht"; |
||
319 | ARATHIBASIN = "Arathi Basin"; |
||
320 | DISPLAY_MENU_LOCKWINDOW = "Fensterposition fixieren"; |
||
321 | DISPLAY_MENU_AUTOSHOW = "Fenster automatisch anzeigen, wenn Schlachtfeld betreten wird"; |
||
322 | DISPLAY_MENU_AUTORELEASE = "Automatisch Geist im Schlachtfeld freilassen"; |
||
323 | DISPLAY_MENU_AUTOQUEST = "Automatisch Schlachtfeld-Quests best\195\164tigen"; |
||
324 | DISPLAY_MENU_AUTOENTER = "Automatisch Schlachtfeld betreten"; |
||
325 | DISPLAY_MENU_TIMERSHOW = "Eroberungs-Timer anzeigen"; |
||
326 | DISPLAY_MENU_ITEMSHOW = "Anzahl der Schlachtfeld-Gegenst\195\164nde anzeigen"; |
||
327 | DISPLAY_MENU_GYCOUNTDOWN = "Timer f\195\188r Wiederbelebung beim Friedhof anzeigen"; |
||
328 | DISPLAY_MENU_FLAGTRACKING = "Track Flags"; |
||
329 | DISPLAY_MENU_TARGETTINGASSISTANCE = "Targetting Assistance Window"; |
||
330 | DISPLAY_MENU_AUTOACCEPTGROUP = "Auto accept group invites in BG"; |
||
331 | DISPLAY_MENU_AUTOLEAVEGROUP = "Auto leave group when leaving BG"; |
||
332 | DISPLAY_MENU_NOPREEXISTING = "No pre-existing instances"; |
||
333 | DISPLAY_TITLEDISPLAY_CAPTURE = "Eroberungen"; |
||
334 | DISPLAY_TITLEDISPLAY_ITEMS = "Gegenst\195\164nde"; |
||
335 | DISPLAY_TITLEDISPLAY_TARGETS = "Targets"; |
||
336 | DISPLAY_TEXT_CURRENTCOUNT = "Momentane Anzahl"; |
||
337 | DISPLAY_TEXT_ENTERINGBATTLEGROUNDS = "Betrete Schlachtfeld"; |
||
338 | DISPLAY_TEXT_LEFTBATTLEGROUNDS = "Verlasse Schlachtfeld"; |
||
339 | DISPLAY_TEXT_TIMEUNTILREZ = "Zeit bis zur Wiederbelebung"; |
||
340 | DISPLAY_TEXT_TIMELEFT = "Verbleibende Zeit"; |
||
341 | DISPLAY_TEXT_SECONDS = "sekunden"; |
||
342 | DISPLAY_TEXT_MINUTES = "minuten"; |
||
343 | DISPLAY_TEXT_NOTENTERINGAFK = "Betrete das Schlachtfeld nicht, da Ihr AFK seid"; |
||
344 | DISPLAY_TEXT_FLAGHOLDERNOTCLOSEENOUGH = "Flag Holder not close enough to target."; |
||
345 | DISPLAY_TEXT_PREEXISTING = "Offered BG instance is pre-existing"; |
||
346 | BATTLEGROUND_GOSSIP_TEXT = "I would like to go to the battleground."; |
||
347 | MATCHING_MARKED_AFK = "You are now AFK"; |
||
348 | MATCHING_CLEARED_AFK = "You are no longer AFK."; |
||
349 | FACTION_ALLIANCE = "Alliance"; |
||
350 | FACTION_HORDE = "Horde"; |
||
351 | CLASS_DRUID = "Druide"; |
||
352 | CLASS_HUNTER = "J\195\164ger"; |
||
353 | CLASS_MAGE = "Magier"; |
||
354 | CLASS_PALADIN = "Paladin" |
||
355 | CLASS_PRIEST = "Priester"; |
||
356 | CLASS_ROGUE = "Schurke"; |
||
357 | CLASS_SHAMAN = "Schamane"; |
||
358 | CLASS_WARRIOR = "Krieger"; |
||
359 | CLASS_WARLOCK = "Hexenmeister"; |
||
360 | end |
||
361 | |||
362 | -- Is stolen from Interface/GlueXML/CharacterCreate.lua |
||
363 | local CLASS_ICON_TCOORDS = { |
||
364 | [string.upper(CLASS_WARRIOR)] = {0, 0.25, 0, 0.25}, |
||
365 | [string.upper(CLASS_MAGE)] = {0.25, 0.49609375, 0, 0.25}, |
||
366 | [string.upper(CLASS_ROGUE)] = {0.49609375, 0.7421875, 0, 0.25}, |
||
367 | [string.upper(CLASS_DRUID)] = {0.7421875, 0.98828125, 0, 0.25}, |
||
368 | [string.upper(CLASS_HUNTER)] = {0, 0.25, 0.25, 0.5}, |
||
369 | [string.upper(CLASS_PRIEST)] = {0.49609375, 0.7421875, 0.25, 0.5}, |
||
370 | [string.upper(CLASS_WARLOCK)] = {0.7421875, 0.98828125, 0.25, 0.5}, |
||
371 | [string.upper(CLASS_SHAMAN)] = {0.25, 0.49609375, 0.25, 0.5}, |
||
372 | [string.upper(CLASS_PALADIN)] = {0, 0.25, 0.5, 0.75} |
||
373 | }; |
||
374 | |||
375 | local BATTLEFIELD_INDEXES = { |
||
376 | [1] = ALTERACVALLEY; |
||
377 | [2] = WARSONGGULCH; |
||
378 | [3] = ARATHIBASIN; |
||
379 | }; |
||
380 | |||
381 | local MAXTIMERS = 6; |
||
382 | local MAXICONS = 10; |
||
383 | local EVENTSINBATTLEGROUND = { |
||
384 | -- Bag item tracking |
||
385 | "BAG_UPDATE", |
||
386 | -- Track into quest windows for autocomplete |
||
387 | "QUEST_PROGRESS", |
||
388 | "QUEST_COMPLETE", |
||
389 | "QUEST_GREETING", |
||
390 | "QUEST_DETAIL", |
||
391 | -- "GOSSIP_SHOW", |
||
392 | -- Autorez |
||
393 | "AREA_SPIRIT_HEALER_IN_RANGE", |
||
394 | -- People counting |
||
395 | "UPDATE_BATTLEFIELD_SCORE", |
||
396 | -- Chat messages |
||
397 | "CHAT_MSG_MONSTER_YELL", |
||
398 | "CHAT_MSG_BG_SYSTEM_NEUTRAL", |
||
399 | "CHAT_MSG_BG_SYSTEM_ALLIANCE", |
||
400 | "CHAT_MSG_BG_SYSTEM_HORDE", |
||
401 | -- Warsaw flag tracking |
||
402 | "UPDATE_WORLD_STATES", |
||
403 | -- PARTAHHHH |
||
404 | "PARTY_INVITE_REQUEST", |
||
405 | "PARTY_MEMBERS_CHANGED", |
||
406 | "PARTY_LEADER_CHANGED", |
||
407 | -- Well duh |
||
408 | "PLAYER_DEAD", |
||
409 | }; |
||
410 | |||
411 | BGAssist_Player = nil; -- global; |
||
412 | local BGAssist_Config_Loaded = nil; |
||
413 | local BGAssist_CountedPlayers = nil; |
||
414 | local BGAssist_Scheduled_MapCheck = nil; |
||
415 | local BGAssist_InBattleGround = nil; |
||
416 | local BGAssist_TimersActive = nil; |
||
417 | local BGAssist_LastTimersProc = 0; |
||
418 | local BGAssist_MapItems = {}; |
||
419 | local BGAssist_TrackedItems = {}; |
||
420 | local BGAssist_ItemInfo = {}; |
||
421 | local BGAssist_RezSyncTime = nil; |
||
422 | local BGAssist_FlagLocs = { }; |
||
423 | local BGAssist_LastUpdate = 0; |
||
424 | local BGAssist_MaintainingGroup = nil; |
||
425 | local BGAssist_PreExistingInstances = nil; |
||
426 | local BGAssist_InAFK = nil; |
||
427 | |||
428 | local function BGAssist_LinkDecode(link) |
||
429 | local id, name; |
||
430 | _, _, id, name = string.find(link,"|Hitem:(%d+):%d+:%d+:%d+|h%[([^]]+)%]|h|r$"); |
||
431 | -- Only first number of itemid is significant in this. |
||
432 | if (id and name) then |
||
433 | id = id * 1; |
||
434 | return name, id; |
||
435 | end |
||
436 | end |
||
437 | |||
438 | local function BGAssist_BagCheck() |
||
439 | local bag, slot, size; |
||
440 | BGAssist_TrackedItems = {}; |
||
441 | for bag = 0, 4, 1 do |
||
442 | if (bag == 0) then |
||
443 | size = 16; |
||
444 | else |
||
445 | size = GetContainerNumSlots(bag); |
||
446 | end |
||
447 | if (size and size > 0) then |
||
448 | for slot = 1, size, 1 do |
||
449 | local itemLink = GetContainerItemLink(bag,slot); |
||
450 | if (itemLink) then |
||
451 | local itemName, itemID = BGAssist_LinkDecode(itemLink); |
||
452 | local texture, itemCount = GetContainerItemInfo(bag,slot); |
||
453 | if (itemID and BGAssist_ItemTrack[itemID]) then |
||
454 | if (not BGAssist_TrackedItems[itemID]) then |
||
455 | BGAssist_TrackedItems[itemID] = 0; |
||
456 | end |
||
457 | BGAssist_ItemInfo[itemID] = { |
||
458 | ["name"] = itemName, |
||
459 | ["texture"] = texture; |
||
460 | }; |
||
461 | BGAssist_TrackedItems[itemID] = BGAssist_TrackedItems[itemID] + itemCount; |
||
462 | end |
||
463 | end |
||
464 | end |
||
465 | end |
||
466 | end |
||
467 | if (BGAssist_Timers:IsVisible()) then |
||
468 | BGAssist_Timers_OnShow(); |
||
469 | end |
||
470 | end |
||
471 | |||
472 | local function BGAssist_CheckMap() |
||
473 | local OUTOFZONEDATA = { |
||
474 | [1] = { "Dead Guys", "", 3 }; |
||
475 | [2] = { "Bar", "Drink Here", 8}; |
||
476 | [3] = { "Elves Head Point", "ELVES DIE", 11 }; |
||
477 | [4] = { "Monkey", "Monkey", 13 }; |
||
478 | }; |
||
479 | local totallandmarks = GetNumMapLandmarks() |
||
480 | local name, description, typ, x, y; |
||
481 | local i; |
||
482 | for i = 1, totallandmarks, 1 do |
||
483 | name, description, typ, x, y = GetMapLandmarkInfo(i); |
||
484 | -- typ: |
||
485 | -- Alterac Valley |
||
486 | -- 0 = Mines, no icon |
||
487 | -- 1 = Horde controlled mine |
||
488 | -- 2 = Alliance controlled mine |
||
489 | -- 3 = Horde graveyard attacked by Alliance |
||
490 | -- 4 = Towns (Booty Bay, Stonard, etc) |
||
491 | -- 5 = Destroyed tower |
||
492 | -- 6 = |
||
493 | -- 7 = Uncontrolled Graveyard (Snowfall at start) |
||
494 | -- 8 = Horde tower attacked by Alliance |
||
495 | -- 9 = Horde controlled tower |
||
496 | -- 10 = Alliance controlled tower |
||
497 | -- 11 = Alliance tower attacked by Horde |
||
498 | -- 12 = Horde controlled graveyard |
||
499 | -- 13 = Alliance graveyard attacked by Horde |
||
500 | -- 14 = Alliance controlled graveyard |
||
501 | -- 15 = Garrisons/Caverns, no icon |
||
502 | -- Arathi Basin |
||
503 | -- 16 - Gold Mine - Uncontrolled |
||
504 | -- 17 - Gold Mine .. in conflict (Alliance capturing) |
||
505 | -- 18 - Gold Mine - Alliance controlled |
||
506 | -- 19 = Gold Mine .. in conflict (Horde capturing) |
||
507 | -- 20 = Gold Mine - Horde Controlled |
||
508 | -- 21 = Lumber Mill - Uncontrolled |
||
509 | -- 22 = Lumber Mill .. in conflict (Alliance capturing) |
||
510 | -- 23 = Lumber Mill - Alliance controlled |
||
511 | -- 24 = Lumber Mill .. in conflict (Horde capturing) |
||
512 | -- 25 = Lumber Mill - Horde Controlled |
||
513 | -- 26 = Blacksmith - Uncontrolled |
||
514 | -- 27 = Blacksmith .. in conflict (Alliance capturing) |
||
515 | -- 28 = Blacksmith - Alliance controlled |
||
516 | -- 29 = Blacksmith .. in conflict (Horde capturing) |
||
517 | -- 30 = Blacksmith - Horde controlled |
||
518 | -- 31 = Farm - Uncontrolled |
||
519 | -- 32 = Farm .. in conflict (Alliance capturing) |
||
520 | -- 33 = Farm - Alliance controlled |
||
521 | -- 34 = Farm .. in conflict (Horde capturing) |
||
522 | -- 35 = Farm - Horde controlled |
||
523 | -- 36 = Stables - Uncontrolled |
||
524 | -- 37 = Stables .. in conflict (Alliance capturing) |
||
525 | -- 38 = Stables - Alliance controlled |
||
526 | -- 39 = Stables .. in conflict (Horde capturing) |
||
527 | -- 40 = Stables - Horde controlled |
||
528 | if (not BGAssist_MapItems[name]) then BGAssist_MapItems[name] = {} end |
||
529 | if (typ == 11 or typ == 13 or typ == 9 or typ == 12 -- AV |
||
530 | or typ == 20 or typ == 25 or typ == 30 or typ == 35 or typ == 40 -- AB |
||
531 | or typ == 19 or typ == 24 or typ == 29 or typ == 34 or typ == 39 -- AB captures |
||
532 | ) then |
||
533 | if (BGAssist_MapItems[name].owner ~= "HORDE") then |
||
534 | BGAssist_MapItems[name].owner = "HORDE"; |
||
535 | BGAssist_MapItems[name].conflictstart = nil; |
||
536 | end |
||
537 | elseif (typ == 10 or typ == 3 or typ == 8 or typ == 14 -- AV |
||
538 | or typ == 18 or typ == 23 or typ == 28 or typ == 33 or typ == 38 -- AB |
||
539 | or typ == 17 or typ == 22 or typ == 27 or typ == 32 or typ == 37 -- AB captures |
||
540 | ) then |
||
541 | if (BGAssist_MapItems[name].owner ~= "ALLIANCE") then |
||
542 | BGAssist_MapItems[name].owner = "ALLIANCE"; |
||
543 | BGAssist_MapItems[name].conflictstart = nil; |
||
544 | end |
||
545 | elseif (typ == 0 or typ == 5 or typ == 15 -- AV |
||
546 | ) then |
||
547 | BGAssist_MapItems[name].owner = nil; |
||
548 | end |
||
549 | --[[ |
||
550 | if ( typ == 17 or typ == 22 or typ == 27 or typ == 32 or typ == 37 or -- AB |
||
551 | typ == 19 or typ == 24 or typ == 29 or typ == 34 or typ == 39 -- AB |
||
552 | ) then |
||
553 | Debug ("UNKNOWN: ",name," = ",description," = ",typ,": ",BGAssist_MapItems[name].owner); |
||
554 | end |
||
555 | ]] |
||
556 | |||
557 | if (typ == 3 or typ == 13 or typ == 8 or typ == 11) then -- AV |
||
558 | if (not BGAssist_MapItems[name].conflictstart) then |
||
559 | BGAssist_MapItems[name].conflictstart = GetTime(); |
||
560 | BGAssist_MapItems[name].conflictduration = 300; |
||
561 | end |
||
562 | elseif (typ == 17 or typ == 22 or typ == 27 or typ == 32 or typ == 37 or |
||
563 | typ == 19 or typ == 24 or typ == 29 or typ == 34 or typ == 39) then |
||
564 | if (not BGAssist_MapItems[name].conflictstart) then |
||
565 | BGAssist_MapItems[name].conflictstart = GetTime(); |
||
566 | BGAssist_MapItems[name].conflictduration = 60; |
||
567 | end |
||
568 | else |
||
569 | BGAssist_MapItems[name].conflictstart = nil |
||
570 | end |
||
571 | if (typ == 6 or typ > 40) then |
||
572 | if (Debug) then Debug ("UNKNOWN: "..name.." = "..description.." = "..typ); end |
||
573 | end |
||
574 | end |
||
575 | if (not BGAssist_Config.timerhide) then |
||
576 | BGAssist_Timers_OnShow(); |
||
577 | end |
||
578 | end |
||
579 | |||
580 | function BGAssist_CountPlayers() |
||
581 | local players = GetNumBattlefieldScores(); |
||
582 | if (players > 0) then |
||
583 | local i; |
||
584 | BGAssist_CountedPlayers = { |
||
585 | ["Horde"] = { |
||
586 | ["count"] = 0, |
||
587 | [CLASS_DRUID] = 0, [CLASS_HUNTER] = 0, [CLASS_MAGE] = 0, |
||
588 | [CLASS_PRIEST] = 0, [CLASS_ROGUE] = 0, [CLASS_SHAMAN] = 0, |
||
589 | [CLASS_WARRIOR] = 0, [CLASS_WARLOCK] = 0, |
||
590 | }, |
||
591 | ["Alliance"] = { |
||
592 | ["count"] = 0, |
||
593 | [CLASS_DRUID] = 0, [CLASS_HUNTER] = 0, [CLASS_MAGE] = 0, |
||
594 | [CLASS_PALADIN] = 0, [CLASS_PRIEST] = 0, [CLASS_ROGUE] = 0, |
||
595 | [CLASS_WARRIOR] = 0, [CLASS_WARLOCK] = 0, |
||
596 | }, |
||
597 | }; |
||
598 | |||
599 | for i = 1, players, 1 do |
||
600 | _, _, _, _, _, faction, _, _, class = GetBattlefieldScore(i); |
||
601 | if (faction == 0) then faction = "Horde"; else faction = "Alliance"; end |
||
602 | BGAssist_CountedPlayers[faction].count = BGAssist_CountedPlayers[faction].count + 1; |
||
603 | BGAssist_CountedPlayers[faction][class] = BGAssist_CountedPlayers[faction][class] + 1; |
||
604 | end |
||
605 | |||
606 | local faction = { "Alliance", "Horde" }; |
||
607 | local classes = { CLASS_WARRIOR, CLASS_MAGE, CLASS_ROGUE, CLASS_DRUID, CLASS_HUNTER, |
||
608 | CLASS_PRIEST, CLASS_WARLOCK, CLASS_SHAMAN }; |
||
609 | local i, j |
||
610 | for i = 1, 2, 1 do |
||
611 | for j = 1, 8, 1 do |
||
612 | if (i == 1 and j == 8) then |
||
613 | getglobal("WorldStateScoreFrame_"..faction[i]..j.."Text"):SetText(CLASS_PALADIN..": "..BGAssist_CountedPlayers[faction[i]][CLASS_PALADIN]); |
||
614 | else |
||
615 | getglobal("WorldStateScoreFrame_"..faction[i]..j.."Text"):SetText(classes[j]..": "..BGAssist_CountedPlayers[faction[i]][classes[j]]); |
||
616 | end |
||
617 | end |
||
618 | end |
||
619 | end |
||
620 | end |
||
621 | |||
622 | local function BGAssist_Alterac_SelectQuest(...) |
||
623 | local i; |
||
624 | local idx = 0; |
||
625 | for i = 1, arg.n, 2 do |
||
626 | idx = idx + 1; |
||
627 | if (BGAssist_Alterac_Quests[arg[i]]) then |
||
628 | local item, min, max; |
||
629 | if (type(BGAssist_Alterac_Quests[arg[i]]) == "table") then |
||
630 | item = BGAssist_Alterac_Quests[arg[i]].item; |
||
631 | min = BGAssist_Alterac_Quests[arg[i]].min; |
||
632 | max = BGAssist_Alterac_Quests[arg[i]].max; |
||
633 | else |
||
634 | item = true; |
||
635 | end |
||
636 | if (not min or min < 1) then min = 1; end |
||
637 | if (not max) then max = 1000; end |
||
638 | local count = BGAssist_TrackedItems[item]; |
||
639 | if (not count) then count = 0; end |
||
640 | if (item == true or (count >= min and count <= max)) then |
||
641 | if (not BGAssist_Config[BGAssist_Player].turnins[arg[i]]) then |
||
642 | BGAssist_Config[BGAssist_Player].turnins[arg[i]] = 0; |
||
643 | end |
||
644 | BGAssist_Config[BGAssist_Player].turnins[arg[i]] = BGAssist_Config[BGAssist_Player].turnins[arg[i]] + min; |
||
645 | SelectGossipAvailableQuest(idx); |
||
646 | end |
||
647 | end |
||
648 | end |
||
649 | end |
||
650 | |||
651 | local function BGAssist_SignUpForBG(...) |
||
652 | local i; |
||
653 | local idx = 0; |
||
654 | for i = 1, arg.n, 2 do |
||
655 | idx = idx + 1; |
||
656 | if (arg[i] == BATTLEGROUND_GOSSIP_TEXT) then |
||
657 | SelectGossipOption(idx); |
||
658 | end |
||
659 | end |
||
660 | end |
||
661 | |||
662 | local function BGAssist_Alterac_AutoProcess(method) |
||
663 | if (BGAssist_Alterac_Quests[GetTitleText()]) then |
||
664 | if (method == "QUEST_COMPLETE") then |
||
665 | QuestRewardCompleteButton_OnClick(); |
||
666 | elseif (method == "QUEST_PROGRESS") then |
||
667 | QuestProgressCompleteButton_OnClick(); |
||
668 | elseif (method == "QUEST_DETAIL") then |
||
669 | QuestDetailAcceptButton_OnClick(); |
||
670 | elseif (Debug) then |
||
671 | Debug ("Unknown METHOD: "..method.." for "..GetTitleText()); |
||
672 | end |
||
673 | end |
||
674 | end |
||
675 | |||
676 | local function BGAssist_ConfigInit() |
||
677 | if (not BGAssist_Config) then |
||
678 | BGAssist_Config = {}; |
||
679 | end |
||
680 | if (not BGAssist_Config[BGAssist_Player]) then |
||
681 | BGAssist_Config[BGAssist_Player] = {}; |
||
682 | end |
||
683 | if (not BGAssist_Config[BGAssist_Player].turnins) then |
||
684 | BGAssist_Config[BGAssist_Player].turnins = {}; |
||
685 | end |
||
686 | |||
687 | if (BGAssist_InBattleGround == ALTERACVALLEY or BGAssist_InBattleGround == ARATHIBASIN) then |
||
688 | BGAssist_CheckMap(); |
||
689 | end |
||
690 | BGAssist_ToggleAutoEntry("ON") |
||
691 | end |
||
692 | |||
693 | function BGAssist_OnLoad() |
||
694 | this:RegisterEvent("VARIABLES_LOADED"); |
||
695 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
696 | -- Autoenter |
||
697 | this:RegisterEvent("BATTLEFIELDS_SHOW"); |
||
698 | this:RegisterEvent("UPDATE_BATTLEFIELD_STATUS"); |
||
699 | this:RegisterEvent("CHAT_MSG_SYSTEM"); |
||
700 | this:RegisterEvent("GOSSIP_SHOW"); |
||
701 | |||
702 | local playerName = UnitName("player"); |
||
703 | if (playerName ~= UKNOWNBEING and playerName ~= UNKNOWNOBJECT) then |
||
704 | BGAssist_Player = playerName; |
||
705 | end |
||
706 | end |
||
707 | |||
708 | function BGAssist_OnEvent(event) |
||
709 | if (event == "VARIABLES_LOADED") then |
||
710 | BGAssist_Config_Loaded = 1; |
||
711 | if (BGAssist_Player) then |
||
712 | BGAssist_ConfigInit(); |
||
713 | end |
||
714 | elseif (event == "PLAYER_ENTERING_WORLD") then |
||
715 | BGAssist_InAFK = nil; |
||
716 | elseif (event == "CHAT_MSG_SYSTEM") then |
||
717 | if (string.find(arg1,MATCHING_MARKED_AFK)) then |
||
718 | BGAssist_InAFK = true; |
||
719 | elseif (string.find(arg1,MATCHING_CLEARED_AFK)) then |
||
720 | BGAssist_InAFK = nil; |
||
721 | end |
||
722 | elseif (event == "BATTLEFIELDS_SHOW") then |
||
723 | local mapName = GetBattlefieldInfo(); |
||
724 | if (mapName == WARSONGGULCH or mapName == ARATHIBASIN) then |
||
725 | BGAssist_PreExistingInstances = {}; |
||
726 | local numBattlefields = GetNumBattlefields(); |
||
727 | local i; |
||
728 | for i = 1, numBattlefields, 1 do |
||
729 | BGAssist_PreExistingInstances[GetBattlefieldInstanceInfo(i)] = GetTime(); |
||
730 | end |
||
731 | end |
||
732 | if (BGAssist_Config.autosignup) then |
||
733 | if (((GetNumPartyMembers() > 0) or (GetNumRaidMembers() > 0)) and IsPartyLeader()) then |
||
734 | JoinBattlefield(0,1); |
||
735 | else |
||
736 | JoinBattlefield(0); |
||
737 | end |
||
738 | HideUIPanel(BattlefieldFrame); |
||
739 | end |
||
740 | elseif (event == "UPDATE_BATTLEFIELD_STATUS") then |
||
741 | local i, status, mapName, instanceID; |
||
742 | for i = 1, MAX_BATTLEFIELD_QUEUES, 1 do |
||
743 | local tmpstatus, tmpmapName, tmpinstanceID = GetBattlefieldStatus(i) |
||
744 | if (tmpstatus == "active" or (tmpstatus == "confirm" and not status)) then |
||
745 | status = tmpstatus; |
||
746 | mapName = tmpmapName; |
||
747 | instanceID = tmpinstanceID; |
||
748 | end |
||
749 | end |
||
750 | if (status=="active") then |
||
751 | BGAssist_PreExistingInstances = nil; |
||
752 | if (not BGAssist_InBattleGround) then |
||
753 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_ENTERINGBATTLEGROUNDS..": "..mapName); |
||
754 | BGAssist_RezSyncTime = nil; |
||
755 | BGAssist_InBattleGround = mapName; |
||
756 | BGAssist_BagCheck(); |
||
757 | local idx,event; |
||
758 | for idx,event in EVENTSINBATTLEGROUND do |
||
759 | BGAssist:RegisterEvent(event); |
||
760 | end |
||
761 | BGAssist_MaintainingGroup = nil; |
||
762 | if (not BGAssist_Config.noautoshow) then |
||
763 | BGAssist_Timers:Show(); |
||
764 | end |
||
765 | if (not BGAssist_Config.notargetwindow) then |
||
766 | BGAssist_Targets:Show(); |
||
767 | end |
||
768 | end |
||
769 | if (BGAssist_InBattleGround == WARSONGGULCH) then |
||
770 | BGAssist_FlagLocs = { }; |
||
771 | BGAssist_Flags:Show(); |
||
772 | end |
||
773 | if (BGAssist_InBattleGround == ALTERACVALLEY or BGAssist_InBattleGround == ARATHIBASIN) then |
||
774 | BGAssist_CheckMap(); |
||
775 | end |
||
776 | elseif (status=="confirm") then |
||
777 | --[[ |
||
778 | local goodtoenter = true; |
||
779 | if (((BGAssist_Config.avoidpreexistingwarsong and |
||
780 | mapName == WARSONGGULCH) or |
||
781 | (BGAssist_Config.avoidpreexistingarathi and |
||
782 | mapName == ARATHIBASIN )) and |
||
783 | BGAssist_PreExistingInstances and |
||
784 | BGAssist_PreExistingInstances[instanceID]) then |
||
785 | local timediff = GetTime() - BGAssist_PreExistingInstances[instanceID]; |
||
786 | if (timediff < 300) then |
||
787 | goodtoenter = false; |
||
788 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_PREEXISTING); |
||
789 | end |
||
790 | end |
||
791 | if (goodtoenter and not BGAssist_Config.noautoenter) then |
||
792 | if (BGAssist_InAFK) then |
||
793 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_NOTENTERINGAFK); |
||
794 | elseif (not (UnitIsDead("player") or UnitIsGhost("player"))) then |
||
795 | local status, mapName, instanceID, idx; |
||
796 | for i = 1, MAX_BATTLEFIELD_QUEUES, 1 do |
||
797 | local tmpstatus, tmpmapName, tmpinstanceID = GetBattlefieldStatus(i); |
||
798 | if (tmpstatus == "confirm") then |
||
799 | status = tmpstatus; |
||
800 | mapName = tmpmapName; |
||
801 | instanceID = tmpinstanceID; |
||
802 | idx = i; |
||
803 | end |
||
804 | end |
||
805 | if (status) then |
||
806 | StaticPopup_Hide("CONFIRM_BATTLEFIELD_ENTRY", idx); |
||
807 | AcceptBattlefieldPort(idx, 1); |
||
808 | end |
||
809 | end |
||
810 | end |
||
811 | ]] |
||
812 | elseif (BGAssist_InBattleGround) then |
||
813 | BGAssist_Timers:Hide(); |
||
814 | BGAssist_Flags:Hide(); |
||
815 | BGAssist_Targets:Hide(); |
||
816 | BGAssist_MaintainingGroup = nil; |
||
817 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_LEFTBATTLEGROUNDS..": "..BGAssist_InBattleGround); |
||
818 | BGAssist_InBattleGround = nil; |
||
819 | BGAssist_RezSyncTime = nil; |
||
820 | if (not BGAssist_Config.noautoleavegroup) then |
||
821 | LeaveParty(); |
||
822 | end |
||
823 | local idx, event; |
||
824 | for idx, event in EVENTSINBATTLEGROUND do |
||
825 | BGAssist:UnregisterEvent(event); |
||
826 | end |
||
827 | end |
||
828 | elseif (event == "CHAT_MSG_MONSTER_YELL" or event == "CHAT_MSG_BG_SYSTEM_NEUTRAL" or event == "CHAT_MSG_BG_SYSTEM_ALLIANCE" or event == "CHAT_MSG_BG_SYSTEM_HORDE") then |
||
829 | if (BGAssist_InBattleGround == ALTERACVALLEY or BGAssist_InBattleGround == ARATHIBASIN) then |
||
830 | BGAssist_Scheduled_MapCheck = GetTime()+0.1; |
||
831 | elseif (BGAssist_InBattleGround == WARSONGGULCH) then |
||
832 | BGAssist_LocateFlags(arg1); |
||
833 | end |
||
834 | elseif (event == "BAG_UPDATE") then |
||
835 | if (BGAssist_InBattleGround == ALTERACVALLEY) then |
||
836 | BGAssist_BagCheck(); |
||
837 | end |
||
838 | elseif (event == "AREA_SPIRIT_HEALER_IN_RANGE") then |
||
839 | BGAssist_RezSyncTime = GetTime() + GetAreaSpiritHealerTime(); |
||
840 | -- elseif (event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_GREETING" or event == "QUEST_DETAIL") then |
||
841 | elseif (event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE" or event == "QUEST_DETAIL") then |
||
842 | if (not BGAssist_Config.noautoquest and BGAssist_InBattleGround == ALTERACVALLEY) then |
||
843 | BGAssist_Alterac_AutoProcess(event); |
||
844 | end |
||
845 | elseif (event == "GOSSIP_SHOW") then |
||
846 | if (not BGAssist_InBattleGround and BGAssist_Config.autosignup) then |
||
847 | BGAssist_SignUpForBG(GetGossipOptions()); |
||
848 | elseif (not BGAssist_Config.noautoquest and BGAssist_InBattleGround == ALTERACVALLEY) then |
||
849 | BGAssist_Alterac_SelectQuest(GetGossipAvailableQuests()); |
||
850 | end |
||
851 | elseif (event == "PLAYER_DEAD") then |
||
852 | if (BGAssist_Config.autorelease) then |
||
853 | StaticPopup_Hide("DEATH"); |
||
854 | RepopMe(); |
||
855 | end |
||
856 | elseif (event == "UPDATE_BATTLEFIELD_SCORE") then |
||
857 | if (GetBattlefieldWinner() and not BGAssist_Config.noautoleavegroup) then |
||
858 | LeaveParty(); |
||
859 | end |
||
860 | BGAssist_CountPlayers(); |
||
861 | elseif (event == "UPDATE_WORLD_STATES") then |
||
862 | if (BGAssist_InBattleGround == WARSONGGULCH) then |
||
863 | BGAssist_WSGFlags_OnShow(); |
||
864 | end |
||
865 | elseif (event == "PARTY_INVITE_REQUEST") then |
||
866 | if (not BGAssist_Config.noacceptgroups) then |
||
867 | AcceptGroup(); |
||
868 | StaticPopupDialogs["PARTY_INVITE"].inviteAccepted = 1; |
||
869 | StaticPopup_Hide("PARTY_INVITE"); |
||
870 | end |
||
871 | elseif (event == "PARTY_MEMBER_CHANGED" or event == "PARTY_LEADER_CHANGED") then |
||
872 | if (GetNumRaidMembers() == 0) then |
||
873 | if (Debug) then Debug ("BGAssist: Party: ",event," PARTY: ",GetNumPartyMembers()," RAID: ",GetNumRaidMembers(), " MAINTAINING: ",BGAssist_MaintainingGroup," LEADER: ",IsPartyLeader()); end |
||
874 | end |
||
875 | if ((GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and BGAssist_MaintainingGroup) then |
||
876 | if (GetNumRaidMembers() > 0) then |
||
877 | if (IsRaidLeader()) then |
||
878 | else |
||
879 | BGAssist_MaintainingGroup = nil; |
||
880 | end |
||
881 | elseif (IsPartyLeader()) then |
||
882 | ConvertToRaid(); |
||
883 | else |
||
884 | BGAssist_MaintainingGroup = nil; |
||
885 | end |
||
886 | else |
||
887 | BGAssist_MaintainingGroup = nil; |
||
888 | end |
||
889 | end |
||
890 | end |
||
891 | |||
892 | function BGAssist_OnUpdate() |
||
893 | local time = GetTime(); |
||
894 | if (BGAssist_Scheduled_MapCheck and BGAssist_Scheduled_MapCheck <= time) then |
||
895 | BGAssist_Scheduled_MapCheck = nil; |
||
896 | BGAssist_CheckMap(); |
||
897 | end |
||
898 | end |
||
899 | |||
900 | function BGAssist_Timers_OnUpdate(elapsed) |
||
901 | local time = GetTime(); |
||
902 | local starttimer = 1; |
||
903 | if (BGAssist_Config.showgycountdown) then |
||
904 | local timerobj = getglobal("BGAssist_Timers1"); |
||
905 | if (timerobj.name == "Graveyard") then |
||
906 | if (BGAssist_RezSyncTime) then |
||
907 | local timeleft = BGAssist_RezSyncTime-GetTime(); |
||
908 | while (timeleft < 0) do |
||
909 | BGAssist_RezSyncTime = BGAssist_RezSyncTime + 30; |
||
910 | timeleft = math.floor(BGAssist_RezSyncTime-GetTime()); |
||
911 | end |
||
912 | timerobj:SetValue(timeleft); |
||
913 | else |
||
914 | timerobj:SetValue(30); |
||
915 | end |
||
916 | starttimer = 2; |
||
917 | end |
||
918 | end |
||
919 | |||
920 | if (BGAssist_TimersActive) then |
||
921 | if (BGAssist_TimersActive <= time) then |
||
922 | BGAssist_UpdateTimers(); |
||
923 | else |
||
924 | if (BGAssist_LastTimersProc+1 < time) then |
||
925 | local i; |
||
926 | for i = starttimer, MAXTIMERS, 1 do |
||
927 | local timer = getglobal("BGAssist_Timers"..i); |
||
928 | if (timer.endtime) then |
||
929 | local timeleft = timer.endtime - time; |
||
930 | timer:SetValue(timeleft); |
||
931 | end |
||
932 | end |
||
933 | BGAssist_LastTimersProc = time; |
||
934 | end |
||
935 | end |
||
936 | if (this.updateTooltip) then |
||
937 | this.updateTooltip = this.updateTooltip - elapsed; |
||
938 | if (this.updateTooltip < 0) then |
||
939 | BGAssist_Timer_SetTooltip(this.tooltipUpdate); |
||
940 | end |
||
941 | end |
||
942 | end |
||
943 | end |
||
944 | |||
945 | function BGAssist_DynamicResize() |
||
946 | local i; |
||
947 | local maxtimer = 0; |
||
948 | local maxicon = 0; |
||
949 | for i = 1, MAXICONS, 1 do |
||
950 | local icon = getglobal("BGAssist_Timers_Icon"..i); |
||
951 | if (icon:IsVisible()) then maxicon = i; end |
||
952 | end |
||
953 | for i = 1, MAXTIMERS, 1 do |
||
954 | local timerobj = getglobal("BGAssist_Timers"..i); |
||
955 | if (timerobj:IsVisible()) then maxtimer = i; end; |
||
956 | end |
||
957 | |||
958 | if (BGAssist_Config.timerhide) then maxtimer = 0; end |
||
959 | if (BGAssist_Config.itemhide or BGAssist_InBattleGround ~= ALTERACVALLEY) then maxicon = 0; end |
||
960 | |||
961 | -- Move Icons to under last timer |
||
962 | if (maxicon and maxicon > 0) then |
||
963 | BGAssist_Timers_Icon1:ClearAllPoints(); |
||
964 | if (maxtimer == 0) then |
||
965 | BGAssist_Timers_Icon1:SetPoint("TOPLEFT","BGAssist_Timers","TOPLEFT",6,-8); |
||
966 | else |
||
967 | BGAssist_Timers_Icon1:SetPoint("TOPLEFT","BGAssist_Timers"..maxtimer,"BOTTOMLEFT",0,-6); |
||
968 | end |
||
969 | end |
||
970 | local iconwidth = 36; |
||
971 | local iconheight = 36; |
||
972 | if (maxicon and maxicon > 3) then |
||
973 | if (maxicon > 4) then |
||
974 | iconwidth = 24; |
||
975 | else |
||
976 | iconwidth = 30; |
||
977 | end |
||
978 | if (maxicon > 5) then |
||
979 | iconheight = 18; |
||
980 | end |
||
981 | end |
||
982 | for i = 1, MAXICONS, 1 do |
||
983 | local icon = getglobal("BGAssist_Timers_Icon"..i); |
||
984 | local texture = getglobal("BGAssist_Timers_Icon"..i.."NormalTexture"); |
||
985 | icon:SetWidth(iconwidth); |
||
986 | icon:SetHeight(iconheight); |
||
987 | texture:SetWidth(iconwidth*2); |
||
988 | texture:SetHeight(iconheight*2); |
||
989 | end |
||
990 | local backdropheight = 16; -- Buffer at top and bottom and room for border |
||
991 | backdropheight = backdropheight + (maxtimer*12); |
||
992 | if (maxicon > 0 and maxtimer > 0) then backdropheight = backdropheight + 3; end |
||
993 | if (maxicon > 5) then |
||
994 | backdropheight = backdropheight + (iconheight*2) + 3; |
||
995 | elseif (maxicon > 0) then |
||
996 | backdropheight = backdropheight + iconheight; |
||
997 | end |
||
998 | BGAssist_Timers:SetHeight(backdropheight); |
||
999 | end |
||
1000 | |||
1001 | function BGAssist_Timers_OnShow() |
||
1002 | UIDropDownMenu_Initialize(BGAssist_Timers_Menu, BGAssist_MenuDropDown_Initialize, "MENU"); |
||
1003 | |||
1004 | BGAssist_UpdateTimers(); |
||
1005 | BGAssist_UpdateItems(); |
||
1006 | if (BGAssist_Timers2:IsVisible() or (BGAssist_Timers1:IsVisible() and BGAssist_Config.showgycountdown)) then |
||
1007 | BGAssist_Timers_TitleText:SetText(DISPLAY_TITLEDISPLAY_CAPTURE); |
||
1008 | else |
||
1009 | if (BGAssist_Timers_Icon1:IsVisible()) then |
||
1010 | BGAssist_Timers_TitleText:SetText(DISPLAY_TITLEDISPLAY_ITEMS); |
||
1011 | else |
||
1012 | BGAssist_Timers_TitleText:SetText("BGAssist"); |
||
1013 | end |
||
1014 | end |
||
1015 | BGAssist_DynamicResize(); |
||
1016 | end |
||
1017 | |||
1018 | function BGAssist_UpdateItems() |
||
1019 | local function findicon (item) |
||
1020 | local idx = 1; |
||
1021 | local found = 0; |
||
1022 | while (found == 0 and idx <= MAXICONS) do |
||
1023 | local icon = getglobal("BGAssist_Timers_Icon"..idx); |
||
1024 | if (icon and icon.item and icon.item == item) then |
||
1025 | found = idx; |
||
1026 | end |
||
1027 | idx = idx + 1; |
||
1028 | end |
||
1029 | return found; |
||
1030 | end |
||
1031 | local function fillicon (item, num) |
||
1032 | local icon = getglobal("BGAssist_Timers_Icon"..num); |
||
1033 | if (icon) then |
||
1034 | icon.item = item; |
||
1035 | icon:Show(); |
||
1036 | getglobal("BGAssist_Timers_Icon"..num.."Icon"):SetTexture(BGAssist_ItemInfo[item].texture); |
||
1037 | end |
||
1038 | end |
||
1039 | |||
1040 | local showitems = {}; |
||
1041 | local maxicon = 0; |
||
1042 | if (not BGAssist_Config.itemhide and BGAssist_InBattleGround == ALTERACVALLEY and BGAssist_TrackedItems and BGAssist_TrackedItems ~= {}) then |
||
1043 | local item; |
||
1044 | for item in BGAssist_TrackedItems do |
||
1045 | if (BGAssist_TrackedItems[item] > 0) then |
||
1046 | showitems[item] = findicon(item); |
||
1047 | end |
||
1048 | end |
||
1049 | for item in showitems do |
||
1050 | local idx = 1; |
||
1051 | if (showitems[item] == 0) then |
||
1052 | while (showitems[item] == 0 and idx <= MAXICONS) do |
||
1053 | local icon = getglobal("BGAssist_Timers_Icon"..idx); |
||
1054 | if (icon and not icon.item) then |
||
1055 | showitems[item] = idx; |
||
1056 | end |
||
1057 | idx = idx + 1; |
||
1058 | end |
||
1059 | end |
||
1060 | if (showitems[item] > maxicon) then maxicon = showitems[item]; end |
||
1061 | fillicon (item, showitems[item]) |
||
1062 | end |
||
1063 | local i; |
||
1064 | for i = 1, MAXICONS, 1 do |
||
1065 | local icon = getglobal("BGAssist_Timers_Icon"..i); |
||
1066 | if (not icon.item or not BGAssist_TrackedItems[icon.item] or BGAssist_TrackedItems[icon.item] < 1) then |
||
1067 | if (i < maxicon) then |
||
1068 | local j = i+1; |
||
1069 | local jicon = getglobal("BGAssist_Timers_Icon"..j); |
||
1070 | while (j <= MAXICONS and not jicon.item) do |
||
1071 | jicon = getglobal("BGAssist_Timers_Icon"..j); |
||
1072 | j = j + 1; |
||
1073 | end |
||
1074 | if (jicon.item) then |
||
1075 | fillicon (jicon.item, j-1); |
||
1076 | jicon.item = nil; |
||
1077 | end |
||
1078 | else |
||
1079 | icon.item = nil; |
||
1080 | icon:Hide(); |
||
1081 | end |
||
1082 | end |
||
1083 | end |
||
1084 | else |
||
1085 | local i; |
||
1086 | for i = 1, MAXICONS, 1 do |
||
1087 | local icon = getglobal("BGAssist_Timers_Icon"..i); |
||
1088 | icon:Hide(); |
||
1089 | icon.item = nil; |
||
1090 | end |
||
1091 | end |
||
1092 | end |
||
1093 | |||
1094 | function BGAssist_UpdateTimers() |
||
1095 | |||
1096 | local function sort_function (a, b) |
||
1097 | local endtime= BGAssist_MapItems[a].conflictstart + BGAssist_MapItems[a].conflictduration; |
||
1098 | local atime = endtime - GetTime(); |
||
1099 | endtime= BGAssist_MapItems[b].conflictstart + BGAssist_MapItems[b].conflictduration; |
||
1100 | local btime = endtime - GetTime(); |
||
1101 | if (atime < btime) then return true; else return false; end |
||
1102 | end |
||
1103 | |||
1104 | local starttimer = 1; |
||
1105 | local i, status, mapName, instanceID; |
||
1106 | for i = 1, MAX_BATTLEFIELD_QUEUES, 1 do |
||
1107 | local tmpstatus, tmpmapName, tmpinstanceID = GetBattlefieldStatus(i); |
||
1108 | if (tmpstatus == "active") then |
||
1109 | status = tmpstatus; |
||
1110 | mapName = tmpmapName; |
||
1111 | instanceID = tmpinstanceID; |
||
1112 | end |
||
1113 | end |
||
1114 | if (BGAssist_Config.showgycountdown) then |
||
1115 | local timerobj = getglobal("BGAssist_Timers1"); |
||
1116 | local text = getglobal("BGAssist_Timers1Text"); |
||
1117 | timerobj.name = "Graveyard"; |
||
1118 | timerobj:Show(); |
||
1119 | timerobj:SetStatusBarColor (0, 1, 0); |
||
1120 | timerobj:SetMinMaxValues(0,30); |
||
1121 | if (BGAssist_RezSyncTime) then |
||
1122 | local timeleft = math.floor(BGAssist_RezSyncTime-GetTime()); |
||
1123 | while (timeleft < 0) do |
||
1124 | BGAssist_RezSyncTime = BGAssist_RezSyncTime + 30; |
||
1125 | timeleft = math.floor(BGAssist_RezSyncTime-GetTime()); |
||
1126 | end |
||
1127 | timerobj:SetValue(timeleft); |
||
1128 | else |
||
1129 | timerobj:SetValue(30); |
||
1130 | end |
||
1131 | text:Show(); |
||
1132 | text:SetText("Graveyard"); |
||
1133 | starttimer = 2; |
||
1134 | end |
||
1135 | if (not BGAssist_Config.timerhide and status == "active") then |
||
1136 | if (BGAssist_MapItems == nil or BGAssist_MapItems == {}) then |
||
1137 | BGAssist_CheckMap(); |
||
1138 | if (BGAssist_MapItems == nil or BGAssist_MapItems == {}) then |
||
1139 | return; |
||
1140 | end |
||
1141 | end |
||
1142 | local conflicts = {}; |
||
1143 | local conflictcount = 0; |
||
1144 | local red, green, blue; |
||
1145 | local name; |
||
1146 | for name in BGAssist_MapItems do |
||
1147 | if (BGAssist_MapItems[name].conflictstart or (BGAssist_Config.showcapturedflags and BGAssist_InBattleGround == ARATHIBASIN)) then |
||
1148 | local endtime = BGAssist_MapItems[name].conflictstart + BGAssist_MapItems[name].conflictduration; |
||
1149 | local timeleft = endtime - GetTime(); |
||
1150 | if (timeleft > 0 or (BGAssist_Config.showcapturedflags and BGAssist_InBattleGround == ARATHIBASIN)) then |
||
1151 | conflictcount = conflictcount + 1; |
||
1152 | conflicts[conflictcount] = name; |
||
1153 | end |
||
1154 | end |
||
1155 | end |
||
1156 | table.sort(conflicts, sort_function); |
||
1157 | local timer = starttimer; |
||
1158 | local idx = 1; |
||
1159 | while (timer <= MAXTIMERS and conflicts[idx]) do |
||
1160 | local timerobj = getglobal("BGAssist_Timers"..timer); |
||
1161 | local text = getglobal("BGAssist_Timers"..timer.."Text"); |
||
1162 | red = 0; green = 0; blue = 0; |
||
1163 | if (BGAssist_MapItems[conflicts[idx]].owner == "HORDE") then |
||
1164 | red = 1; |
||
1165 | elseif (BGAssist_MapItems[conflicts[idx]].owner == "ALLIANCE") then |
||
1166 | green = 1; blue = 1; |
||
1167 | elseif (not BGAssist_MapItems[conflicts[idx]].owner) then |
||
1168 | -- Should only be when capturing neutral in AB at start |
||
1169 | red = 0.862; green = 0.862; blue = 0.862; |
||
1170 | end |
||
1171 | local endtime= BGAssist_MapItems[conflicts[idx]].conflictstart + |
||
1172 | BGAssist_MapItems[conflicts[idx]].conflictduration; |
||
1173 | local timeleft = endtime - GetTime(); |
||
1174 | if (timeleft < 1) then |
||
1175 | BGAssist_Scheduled_MapCheck = GetTime()+1; |
||
1176 | BGAssist_MapItems[conflicts[idx]].conflictstart = nil; |
||
1177 | end |
||
1178 | if (not BGAssist_TimersActive or endtime < BGAssist_TimersActive) then |
||
1179 | BGAssist_TimersActive = endtime; |
||
1180 | end |
||
1181 | timerobj.name = conflicts[idx]; |
||
1182 | timerobj.endtime = endtime; |
||
1183 | timerobj:Show(); |
||
1184 | timerobj:SetStatusBarColor (red, green, blue); |
||
1185 | if (BGAssist_InBattleGround == ALTERACVALLEY) then |
||
1186 | timerobj:SetMinMaxValues(0,300); |
||
1187 | elseif (BGAssist_InBattleGround == ARATHIBASIN) then |
||
1188 | timerobj:SetMinMaxValues(0,60); |
||
1189 | elseif (Debug) then |
||
1190 | Debug ("INVALID ZONE: ",BGAssist_InBattleGround); |
||
1191 | end |
||
1192 | timerobj:SetValue(timeleft); |
||
1193 | text:Show(); |
||
1194 | -- local sidx = string.find(conflicts[idx]," "); |
||
1195 | -- if (sidx) then |
||
1196 | -- text:SetText(string.sub(conflicts[idx],1,sidx-1)); |
||
1197 | -- else |
||
1198 | text:SetText(conflicts[idx]); |
||
1199 | -- end |
||
1200 | idx = idx + 1; |
||
1201 | timer = timer + 1; |
||
1202 | end |
||
1203 | while (timer <= MAXTIMERS) do |
||
1204 | local timerobj = getglobal("BGAssist_Timers"..timer); |
||
1205 | local text = getglobal("BGAssist_Timers"..timer.."Text"); |
||
1206 | timerobj.name = nil; |
||
1207 | timerobj.endtime = nil; |
||
1208 | timerobj:Hide(); |
||
1209 | text:SetText(""); |
||
1210 | text:Hide(); |
||
1211 | timer = timer + 1; |
||
1212 | end |
||
1213 | else |
||
1214 | for timer = starttimer, MAXTIMERS, 1 do |
||
1215 | local timerobj = getglobal("BGAssist_Timers"..timer); |
||
1216 | local text = getglobal("BGAssist_Timers"..timer.."Text"); |
||
1217 | timerobj:Hide(); |
||
1218 | text:Hide(); |
||
1219 | end |
||
1220 | end |
||
1221 | end |
||
1222 | |||
1223 | function BGAssist_TimersTitle_OnClick(button) |
||
1224 | if (arg1 == "RightButton") then |
||
1225 | ToggleDropDownMenu(1, nil, BGAssist_Timers_Menu, "BGAssist_Timers_Menu", 0, 50); |
||
1226 | else |
||
1227 | if (this:GetButtonState() == "PUSHED") then |
||
1228 | this:GetParent():StopMovingOrSizing(); |
||
1229 | elseif (not BGAssist_Config.windowlocked) then |
||
1230 | this:GetParent():StartMoving(); |
||
1231 | end |
||
1232 | end |
||
1233 | end |
||
1234 | |||
1235 | function BGAssist_Timer_SetTooltip(override) |
||
1236 | if (not override) then |
||
1237 | override = this; |
||
1238 | end |
||
1239 | local txt; |
||
1240 | local timeleft; |
||
1241 | if (override.name == "Graveyard") then |
||
1242 | txt = DISPLAY_TEXT_TIMEUNTILREZ; |
||
1243 | if (BGAssist_RezSyncTime) then |
||
1244 | timeleft = math.floor(BGAssist_RezSyncTime-GetTime()); |
||
1245 | else |
||
1246 | timeleft = 30; |
||
1247 | end |
||
1248 | elseif (override.name and override.endtime) then |
||
1249 | |||
1250 | txt = override.name; |
||
1251 | timeleft = math.floor(override.endtime - GetTime()); |
||
1252 | end |
||
1253 | if (txt and timeleft) then |
||
1254 | txt = txt.."\n"..DISPLAY_TEXT_TIMELEFT..": "..timeleft.." "..DISPLAY_TEXT_SECONDS.."."; |
||
1255 | if (timeleft > 60) then |
||
1256 | txt = txt.."\n("..(math.floor(timeleft/6)/10).." "..DISPLAY_TEXT_MINUTES..")"; |
||
1257 | end |
||
1258 | BGAssist_Timers.updateTooltip = TOOLTIP_UPDATE_TIME; |
||
1259 | BGAssist_Timers.tooltipUpdate = override; |
||
1260 | local left = override:GetLeft(); |
||
1261 | if (left > 800) then |
||
1262 | GameTooltip:SetOwner(override, "ANCHOR_LEFT"); |
||
1263 | else |
||
1264 | GameTooltip:SetOwner(override, "ANCHOR_RIGHT"); |
||
1265 | end |
||
1266 | GameTooltip:SetText(txt); |
||
1267 | end |
||
1268 | end |
||
1269 | |||
1270 | function BGAssist_Item_SetTooltip() |
||
1271 | if (this.item and BGAssist_ItemInfo[this.item] and BGAssist_ItemInfo[this.item].name) then |
||
1272 | local txt = BGAssist_ItemInfo[this.item].name.."\nCurrent Count: "..BGAssist_TrackedItems[this.item]; |
||
1273 | local left = this:GetLeft(); |
||
1274 | if (left > 800) then |
||
1275 | GameTooltip:SetOwner(this, "ANCHOR_LEFT"); |
||
1276 | else |
||
1277 | GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); |
||
1278 | end |
||
1279 | GameTooltip:SetText(txt); |
||
1280 | end |
||
1281 | end |
||
1282 | |||
1283 | function BGAssist_MenuDropDown_CheckedToggle() |
||
1284 | local mapping = { |
||
1285 | [DISPLAY_MENU_LOCKWINDOW] = "windowlocked", |
||
1286 | [DISPLAY_MENU_AUTOSHOW] = "noautoshow", |
||
1287 | [DISPLAY_MENU_AUTORELEASE] = "autorelease", |
||
1288 | [DISPLAY_MENU_AUTOQUEST] = "noautoquest", |
||
1289 | [DISPLAY_MENU_AUTOENTER] = "noautoenter", |
||
1290 | [DISPLAY_MENU_TIMERSHOW] = "timerhide", |
||
1291 | [DISPLAY_MENU_ITEMSHOW] = "itemhide", |
||
1292 | [DISPLAY_MENU_GYCOUNTDOWN] = "showgycountdown", |
||
1293 | [DISPLAY_MENU_FLAGTRACKING] = "noflags", |
||
1294 | [DISPLAY_MENU_TARGETTINGASSISTANCE] = "notargetwindow", |
||
1295 | [DISPLAY_MENU_AUTOACCEPTGROUP] = "noacceptgroups", |
||
1296 | [DISPLAY_MENU_AUTOLEAVEGROUP] = "noautoleavegroup", |
||
1297 | [DISPLAY_MENU_NOPREEXISTING] = "avoidpreexistingwarsong"; |
||
1298 | [DISPLAY_MENU_SHOWCAPTUREDFLAGS] = "showcapturedflags"; |
||
1299 | [DISPLAY_MENU_AUTOSIGNUP] = "autosignup"; |
||
1300 | }; |
||
1301 | if (UIDROPDOWNMENU_MENU_VALUE == ALTERACVALLEY) then |
||
1302 | elseif (UIDROPDOWNMENU_MENU_VALUE == ARATHIBASIN) then |
||
1303 | mapping[DISPLAY_MENU_NOPREEXISTING] = "avoidpreexistingarathi"; |
||
1304 | end |
||
1305 | local confoption = mapping[this.value]; |
||
1306 | if (confoption) then |
||
1307 | if (BGAssist_Config[confoption]) then |
||
1308 | BGAssist_Config[confoption] = nil; |
||
1309 | else |
||
1310 | BGAssist_Config[confoption] = true; |
||
1311 | end |
||
1312 | if (BGAssist_Config.notargetwindow) then |
||
1313 | BGAssist_Targets:Hide(); |
||
1314 | elseif (BGAssist_InBattleGround) then |
||
1315 | BGAssist_Targets:Show(); |
||
1316 | end |
||
1317 | BGAssist_Timers_OnShow(); |
||
1318 | end |
||
1319 | end |
||
1320 | |||
1321 | function BGAssist_MenuDropDown_Initialize() |
||
1322 | local info = {}; |
||
1323 | |||
1324 | if (UIDROPDOWNMENU_MENU_LEVEL == 2) then |
||
1325 | info.func = BGAssist_MenuDropDown_CheckedToggle; |
||
1326 | |||
1327 | if (UIDROPDOWNMENU_MENU_VALUE == ALTERACVALLEY) then |
||
1328 | info.text = DISPLAY_MENU_TIMERSHOW; |
||
1329 | info.checked = nil; |
||
1330 | if (not BGAssist_Config.timerhide) then info.checked = 1; end |
||
1331 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1332 | |||
1333 | info.text = DISPLAY_MENU_AUTOQUEST; |
||
1334 | info.checked = nil; |
||
1335 | if (not BGAssist_Config.noautoquest) then info.checked = 1; end |
||
1336 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1337 | |||
1338 | info.text = DISPLAY_MENU_ITEMSHOW; |
||
1339 | info.checked = nil; |
||
1340 | if (not BGAssist_Config.itemhide) then info.checked = 1; end |
||
1341 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1342 | elseif (UIDROPDOWNMENU_MENU_VALUE == WARSONGGULCH) then |
||
1343 | info.text = DISPLAY_MENU_FLAGTRACKING; |
||
1344 | info.checked = nil; |
||
1345 | if (not BGAssist_Config.noflags) then info.checked = 1; end |
||
1346 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1347 | |||
1348 | info.text = DISPLAY_MENU_NOPREEXISTING; |
||
1349 | info.checked = nil; |
||
1350 | if (BGAssist_Config.avoidpreexistingwarsong) then info.checked = 1; end |
||
1351 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1352 | elseif (UIDROPDOWNMENU_MENU_VALUE == ARATHIBASIN) then |
||
1353 | info.text = DISPLAY_MENU_NOPREEXISTING; |
||
1354 | info.checked = nil; |
||
1355 | if (BGAssist_Config.avoidpreexistingarathi) then info.checked = 1; end |
||
1356 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1357 | |||
1358 | info.text = DISPLAY_MENU_SHOWCAPTUREDFLAGS; |
||
1359 | info.checked = nil; |
||
1360 | if (BGAssist_Config.showcapturedflags) then info.checked = 1; end |
||
1361 | UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL); |
||
1362 | end |
||
1363 | else |
||
1364 | info.isTitle = true; |
||
1365 | info.text = "BGAssist "..BGASSIST_VERSION; |
||
1366 | UIDropDownMenu_AddButton(info); |
||
1367 | |||
1368 | info = {}; |
||
1369 | info.hasArrow = 1; |
||
1370 | info.notCheckable = 1; |
||
1371 | |||
1372 | info.text = ALTERACVALLEY; |
||
1373 | UIDropDownMenu_AddButton(info); |
||
1374 | |||
1375 | info.text = WARSONGGULCH; |
||
1376 | UIDropDownMenu_AddButton(info); |
||
1377 | |||
1378 | info.text = ARATHIBASIN; |
||
1379 | UIDropDownMenu_AddButton(info); |
||
1380 | |||
1381 | info = {}; |
||
1382 | info.func = BGAssist_MenuDropDown_CheckedToggle; |
||
1383 | |||
1384 | info.text = DISPLAY_MENU_LOCKWINDOW; |
||
1385 | info.checked = nil; |
||
1386 | if (BGAssist_Config.windowlocked) then info.checked = 1; end |
||
1387 | UIDropDownMenu_AddButton(info); |
||
1388 | |||
1389 | info.text = DISPLAY_MENU_AUTOSHOW; |
||
1390 | info.checked = nil; |
||
1391 | if (not BGAssist_Config.noautoshow) then info.checked = 1; end |
||
1392 | UIDropDownMenu_AddButton(info); |
||
1393 | |||
1394 | info.text = DISPLAY_MENU_AUTORELEASE; |
||
1395 | info.checked = nil; |
||
1396 | if (BGAssist_Config.autorelease) then info.checked = 1; end |
||
1397 | UIDropDownMenu_AddButton(info); |
||
1398 | |||
1399 | info.text = DISPLAY_MENU_AUTOENTER; |
||
1400 | info.checked = nil; |
||
1401 | if (not BGAssist_Config.noautoenter) then info.checked = 1; end |
||
1402 | UIDropDownMenu_AddButton(info); |
||
1403 | |||
1404 | info.text = DISPLAY_MENU_AUTOSIGNUP; |
||
1405 | info.checked = nil; |
||
1406 | if (BGAssist_Config.autosignup) then info.checked = 1; end |
||
1407 | UIDropDownMenu_AddButton(info); |
||
1408 | |||
1409 | info.text = DISPLAY_MENU_GYCOUNTDOWN; |
||
1410 | info.checked = nil; |
||
1411 | if (BGAssist_Config.showgycountdown) then info.checked = 1; end |
||
1412 | UIDropDownMenu_AddButton(info); |
||
1413 | |||
1414 | info.text = DISPLAY_MENU_TARGETTINGASSISTANCE; |
||
1415 | info.checked = nil; |
||
1416 | if (not BGAssist_Config.notargetwindow) then info.checked = 1; end |
||
1417 | UIDropDownMenu_AddButton(info); |
||
1418 | |||
1419 | info.text = DISPLAY_MENU_AUTOACCEPTGROUP; |
||
1420 | info.checked = nil; |
||
1421 | if (not BGAssist_Config.noacceptgroups) then info.checked = 1; end |
||
1422 | UIDropDownMenu_AddButton(info); |
||
1423 | |||
1424 | info.text = DISPLAY_MENU_AUTOLEAVEGROUP; |
||
1425 | info.checked = nil; |
||
1426 | if (not BGAssist_Config.noautoleavegroup) then info.checked = 1; end |
||
1427 | UIDropDownMenu_AddButton(info); |
||
1428 | end |
||
1429 | end |
||
1430 | |||
1431 | function BGAssist_LocateFlags(chatmsg) |
||
1432 | local idx, event, faction, player; |
||
1433 | for idx in BGAssist_FlagRegexp do |
||
1434 | local start, _, one, two = string.find (chatmsg,BGAssist_FlagRegexp[idx].regexp); |
||
1435 | if (start) then |
||
1436 | event = idx; |
||
1437 | player = nil; |
||
1438 | faction = nil; |
||
1439 | if (BGAssist_FlagRegexp[event].one == "PLAYER") then player = one; end |
||
1440 | if (BGAssist_FlagRegexp[event].one == "FACTION") then faction = one; end |
||
1441 | if (BGAssist_FlagRegexp[event].two == "PLAYER") then player = two; end |
||
1442 | if (BGAssist_FlagRegexp[event].two == "FACTION") then faction = two; end |
||
1443 | end |
||
1444 | end |
||
1445 | -- The text is reversed |
||
1446 | if (faction == FACTION_HORDE) then |
||
1447 | faction = "Alliance"; |
||
1448 | elseif (faction == FACTION_ALLIANCE) then |
||
1449 | faction = "Horde"; |
||
1450 | end |
||
1451 | --[[ |
||
1452 | if (event) then |
||
1453 | if (player and faction) then |
||
1454 | Debug ("EVENT: "..event.." for "..player.." at "..faction); |
||
1455 | else |
||
1456 | Debug ("EVENT: "..event); |
||
1457 | end |
||
1458 | else |
||
1459 | Debug ("NO EVENT: "..chatmsg); |
||
1460 | end |
||
1461 | ]] |
||
1462 | if (event == "RESET") then |
||
1463 | BGAssist_FlagLocs = { }; |
||
1464 | elseif (event == "PICKED") then |
||
1465 | BGAssist_FlagLocs[faction] = player; |
||
1466 | elseif (event == "DROPPED" or event == "RETURNED" or event == "CAPTURED") then |
||
1467 | BGAssist_FlagLocs[faction] = nil; |
||
1468 | end |
||
1469 | |||
1470 | BGAssist_WSGFlags_OnShow(); |
||
1471 | end |
||
1472 | |||
1473 | function BGAssist_ToggleWindow() |
||
1474 | if (BGAssist_Timers:IsVisible()) then |
||
1475 | BGAssist_Timers:Hide(); |
||
1476 | else |
||
1477 | BGAssist_Timers:Show(); |
||
1478 | end |
||
1479 | end |
||
1480 | |||
1481 | function BGAssist_WSGFlags_OnShow() |
||
1482 | local stateidx = { "Alliance", "Horde" }; |
||
1483 | local i; |
||
1484 | if (not BGAssist_Config.noflags) then |
||
1485 | for i = 1, 2, 1 do |
||
1486 | local text, icon, isFlashing = GetWorldStateUIInfo(i); |
||
1487 | local displayobj = getglobal ("BGAssist_Flags_"..stateidx[i].."_Text"); |
||
1488 | if (not isFlashing) then |
||
1489 | displayobj:SetText(""); |
||
1490 | elseif (BGAssist_FlagLocs[stateidx[i]]) then |
||
1491 | displayobj:SetText(BGAssist_FlagLocs[stateidx[i]]); |
||
1492 | else |
||
1493 | displayobj:SetText("(Unknown)"); |
||
1494 | end |
||
1495 | end |
||
1496 | else |
||
1497 | for i = 1, 2, 1 do |
||
1498 | local displayobj = getglobal ("BGAssist_Flags_"..stateidx[i].."_Text"); |
||
1499 | displayobj:SetText(""); |
||
1500 | end |
||
1501 | end |
||
1502 | end |
||
1503 | |||
1504 | function BGAssist_Flags_OnClick(override) |
||
1505 | if (not override) then override = this; end |
||
1506 | local stateidx = { ["Alliance"] = 1, ["Horde"] = 2 }; |
||
1507 | local _, _, isFlashing = GetWorldStateUIInfo(stateidx[override.faction]); |
||
1508 | if (isFlashing and BGAssist_FlagLocs[override.faction]) then |
||
1509 | TargetByName(BGAssist_FlagLocs[override.faction]); |
||
1510 | if (UnitName("target") ~= BGAssist_FlagLocs[override.faction]) then |
||
1511 | ClearTarget(); |
||
1512 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_FLAGHOLDERNOTCLOSEENOUGH); |
||
1513 | end |
||
1514 | end |
||
1515 | end |
||
1516 | |||
1517 | local function BGAssist_UpdateTargets() |
||
1518 | local idx; |
||
1519 | local unit; |
||
1520 | local targets = {}; |
||
1521 | local targetcounts = {}; |
||
1522 | local targetidx = 0; |
||
1523 | |||
1524 | local function sort_function (a,b) |
||
1525 | if (targetcounts[a.name] > targetcounts[b.name]) then |
||
1526 | return true; |
||
1527 | elseif (targetcounts[a.name] < targetcounts[b.name]) then |
||
1528 | return false; |
||
1529 | --[[ |
||
1530 | elseif (a.distance > b.distance) then |
||
1531 | return true; |
||
1532 | elseif (a.distance < b.distance) then |
||
1533 | return false; |
||
1534 | ]] |
||
1535 | elseif (a.name < b.name) then |
||
1536 | return true; |
||
1537 | else |
||
1538 | return false; |
||
1539 | end |
||
1540 | end |
||
1541 | |||
1542 | local max = 40; |
||
1543 | if (BGAssist_InBattleGround == WARSONGGULCH) then max = 10; end |
||
1544 | |||
1545 | for idx = 1, max, 1 do |
||
1546 | unit = "raid"..idx.."target"; |
||
1547 | if (UnitName(unit) and UnitCanAttack("player",unit)) then |
||
1548 | targetidx = targetidx + 1; |
||
1549 | local px,py = GetPlayerMapPosition("player"); |
||
1550 | local tx,ty = GetPlayerMapPosition("raid"..idx); |
||
1551 | local xdist = tx-px; |
||
1552 | local ydist = ty-py; |
||
1553 | local dist = sqrt(math.pow(xdist,2)+math.pow(ydist,2)); |
||
1554 | targets[targetidx] = { |
||
1555 | ["name"] = UnitName(unit); |
||
1556 | ["class"] = UnitClass(unit); |
||
1557 | ["unit"] = unit; |
||
1558 | ["distance"] = dist; |
||
1559 | }; |
||
1560 | if (not targetcounts[UnitName(unit)]) then |
||
1561 | targetcounts[UnitName(unit)] = 0; |
||
1562 | end |
||
1563 | targetcounts[UnitName(unit)] = targetcounts[UnitName(unit)] + 1; |
||
1564 | end |
||
1565 | end |
||
1566 | if (UnitName("target") and UnitCanAttack("player","target")) then |
||
1567 | targetidx = targetidx + 1; |
||
1568 | targets[targetidx] = { |
||
1569 | ["name"] = UnitName("target"); |
||
1570 | ["class"] = UnitClass(unit); |
||
1571 | ["unit"] = "target"; |
||
1572 | ["distance"] = 0; |
||
1573 | }; |
||
1574 | if (not targetcounts[UnitName("target")]) then |
||
1575 | targetcounts[UnitName("target")] = 0; |
||
1576 | end |
||
1577 | targetcounts[UnitName("target")] = targetcounts[UnitName("target")] + 1; |
||
1578 | end |
||
1579 | table.sort (targets, sort_function); |
||
1580 | |||
1581 | local lasttarget = nil; |
||
1582 | local targetidx = 1; |
||
1583 | for idx = 1, table.getn(targets), 1 do |
||
1584 | if (targetidx < 10 and not UnitIsDead(targets[idx].unit) and targets[idx].name ~= lasttarget) then |
||
1585 | local targetobj = getglobal("BGAssist_Targets"..targetidx); |
||
1586 | local targettxt = getglobal("BGAssist_Targets"..targetidx.."_Text"); |
||
1587 | local targethealth = getglobal("BGAssist_Targets"..targetidx.."_Bar_Health"); |
||
1588 | local iconobj = getglobal("BGAssist_Targets"..targetidx.."_Class"); |
||
1589 | |||
1590 | lasttarget = targets[idx].name; |
||
1591 | targetobj.name = targets[idx].name; |
||
1592 | targetobj.unit = targets[idx].unit; |
||
1593 | if (targets[idx].class) then |
||
1594 | targetobj.class = string.upper(targets[idx].class); |
||
1595 | local coords = CLASS_ICON_TCOORDS[targetobj.class]; |
||
1596 | iconobj:SetTexCoord(coords[1], coords[2], coords[3], coords[4]); |
||
1597 | iconobj:Show(); |
||
1598 | else |
||
1599 | targetobj.class = nil; |
||
1600 | iconobj:Hide(); |
||
1601 | end |
||
1602 | -- targettxt:SetText(targetcounts[targets[idx].name].." ("..targets[idx].distance..") = "..targets[idx].name); |
||
1603 | targettxt:SetText(targets[idx].name); |
||
1604 | local health = UnitHealth(targets[idx].unit); |
||
1605 | local maxhealth = UnitHealthMax(targets[idx].unit); |
||
1606 | if (maxhealth ~= 100) then |
||
1607 | health = math.floor(health/maxhealth*100); |
||
1608 | end |
||
1609 | targethealth:SetValue(health); |
||
1610 | targetobj:Show(); |
||
1611 | targetidx = targetidx + 1; |
||
1612 | end |
||
1613 | end |
||
1614 | for idx = targetidx, 10, 1 do |
||
1615 | local targetobj = getglobal("BGAssist_Targets"..idx); |
||
1616 | targetobj:Hide(); |
||
1617 | targetobj.name = nil; |
||
1618 | targetobj.unit = nil; |
||
1619 | targetobj.class = nil; |
||
1620 | --[[ |
||
1621 | targetobj:Show(); |
||
1622 | local targettxt = getglobal("BGAssist_Targets"..idx.."_Text"); |
||
1623 | targettxt:SetText("SpankingMonkeyAss"); |
||
1624 | local coords = CLASS_ICON_TCOORDS["SHAMAN"]; |
||
1625 | local iconobj = getglobal("BGAssist_Targets"..idx.."_Class"); |
||
1626 | iconobj:SetTexCoord(coords[1], coords[2], coords[3], coords[4]); |
||
1627 | ]] |
||
1628 | end |
||
1629 | end |
||
1630 | |||
1631 | function BGAssist_Targets_OnUpdate(elapsed) |
||
1632 | BGAssist_LastUpdate = BGAssist_LastUpdate+elapsed; |
||
1633 | if (BGAssist_LastUpdate > 0.1) then |
||
1634 | BGAssist_LastUpdate = 0; |
||
1635 | BGAssist_UpdateTargets(); |
||
1636 | end |
||
1637 | end |
||
1638 | |||
1639 | function BGAssist_TargetMenuDropDown_Initialize() |
||
1640 | local info = {}; |
||
1641 | |||
1642 | if (UIDROPDOWNMENU_MENU_LEVEL == 2) then |
||
1643 | else |
||
1644 | info.isTitle = true; |
||
1645 | info.text = "BGAssist "..BGASSIST_VERSION; |
||
1646 | UIDropDownMenu_AddButton(info); |
||
1647 | |||
1648 | info = {}; |
||
1649 | info.func = BGAssist_MenuDropDown_CheckedToggle; |
||
1650 | |||
1651 | info.text = DISPLAY_MENU_LOCKWINDOW; |
||
1652 | info.checked = nil; |
||
1653 | if (BGAssist_Config.windowlocked) then info.checked = 1; end |
||
1654 | UIDropDownMenu_AddButton(info); |
||
1655 | end |
||
1656 | end |
||
1657 | |||
1658 | function BGAssist_Targets_OnShow() |
||
1659 | UIDropDownMenu_Initialize(BGAssist_Targets_Menu, BGAssist_TargetMenuDropDown_Initialize, "MENU"); |
||
1660 | getglobal(this:GetName().."_TitleText"):SetText(DISPLAY_TITLEDISPLAY_TARGETS); |
||
1661 | BGAssist_UpdateTargets(); |
||
1662 | end |
||
1663 | |||
1664 | function BGAssist_TargetsTitle_OnClick() |
||
1665 | if (arg1 == "RightButton") then |
||
1666 | ToggleDropDownMenu(1, nil, BGAssist_Targets_Menu, "BGAssist_Targets_Menu", 0, 50); |
||
1667 | else |
||
1668 | if (this:GetButtonState() == "PUSHED") then |
||
1669 | this:GetParent():StopMovingOrSizing(); |
||
1670 | elseif (not BGAssist_Config.windowlocked) then |
||
1671 | this:GetParent():StartMoving(); |
||
1672 | end |
||
1673 | end |
||
1674 | end |
||
1675 | |||
1676 | function BGAssist_Target_OnClick() |
||
1677 | local unit = this:GetParent().unit; |
||
1678 | local name = this:GetParent().name; |
||
1679 | if (unit and name and UnitName(unit) == name) then |
||
1680 | if (SpellIsTargeting()) then |
||
1681 | SpellTargetUnit(unit); |
||
1682 | else |
||
1683 | TargetUnit(unit); |
||
1684 | end |
||
1685 | elseif (name) then |
||
1686 | TargetByName(name); |
||
1687 | end |
||
1688 | end |
||
1689 | |||
1690 | function BGAssist_ClassBreakdown_OnLoad() |
||
1691 | WorldStateScoreFrame_Alliance1:ClearAllPoints(); |
||
1692 | WorldStateScoreFrame_Alliance1:SetPoint("TOPRIGHT","WorldStateScoreFrame_Alliance","TOPRIGHT",-4,-4); |
||
1693 | WorldStateScoreFrame_Alliance8:SetTexCoord(0,0.25,0.5,0.75); |
||
1694 | |||
1695 | local i; |
||
1696 | for i = 1, 8, 1 do |
||
1697 | getglobal("WorldStateScoreFrame_Alliance"..i.."Text"):ClearAllPoints(); |
||
1698 | getglobal("WorldStateScoreFrame_Alliance"..i.."Text"):SetPoint("RIGHT","WorldStateScoreFrame_Alliance"..i,"LEFT",0,0); |
||
1699 | end |
||
1700 | end |
||
1701 | |||
1702 | function BGAssist_AutoInvite_OnClick() |
||
1703 | BGAssist_MaintainingGroup = true; |
||
1704 | if (GetNumPartyMembers() > 0 and IsPartyLeader()) then |
||
1705 | ConvertToRaid(); |
||
1706 | end |
||
1707 | local numNotInRaid = GetNumBattlefieldPositions; |
||
1708 | if (numNotInRaid and numNotInRaid > 0) then |
||
1709 | local i; |
||
1710 | for i = 1, numNotInRaid, 1 do |
||
1711 | local _,_,who = GetBattlefieldPosition(i); |
||
1712 | InviteByName(who); |
||
1713 | end |
||
1714 | end |
||
1715 | end |
||
1716 | |||
1717 | function BGAssist_AutomaticBGEntry(data) |
||
1718 | local i; |
||
1719 | local inbg = nil; |
||
1720 | for i = 1, MAX_BATTLEFIELD_QUEUES, 1 do |
||
1721 | local tmpstatus, tmpmapName, tmpinstanceID = GetBattlefieldStatus(i) |
||
1722 | if (tmpstatus == "active") then |
||
1723 | data = nil; |
||
1724 | inbg = true; |
||
1725 | elseif (not inbg and tmpstatus == "confirm") then |
||
1726 | data = i; |
||
1727 | end |
||
1728 | end |
||
1729 | if (not inbg and data) then |
||
1730 | local status, mapName, instanceID = GetBattlefieldStatus(data) |
||
1731 | local goodtoenter = data; |
||
1732 | if (((BGAssist_Config.avoidpreexistingwarsong and |
||
1733 | mapName == WARSONGGULCH) or |
||
1734 | (BGAssist_Config.avoidpreexistingarathi and |
||
1735 | mapName == ARATHIBASIN )) and |
||
1736 | BGAssist_PreExistingInstances and |
||
1737 | BGAssist_PreExistingInstances[instanceID]) then |
||
1738 | local timediff = GetTime() - BGAssist_PreExistingInstances[instanceID]; |
||
1739 | if (timediff < 300) then |
||
1740 | goodtoenter = false; |
||
1741 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_PREEXISTING); |
||
1742 | end |
||
1743 | end |
||
1744 | if (data and goodtoenter and not BGAssist_Config.noautoenter) then |
||
1745 | if (BGAssist_InAFK) then |
||
1746 | DEFAULT_CHAT_FRAME:AddMessage("BGAssist: "..DISPLAY_TEXT_NOTENTERINGAFK); |
||
1747 | elseif (not (UnitIsDead("player") or UnitIsGhost("player"))) then |
||
1748 | StaticPopup_Hide("CONFIRM_BATTLEFIELD_ENTRY"); |
||
1749 | AcceptBattlefieldPort(data, 1); |
||
1750 | end |
||
1751 | end |
||
1752 | end |
||
1753 | end |
||
1754 | |||
1755 | function BGAssist_ToggleAutoEntry(force) |
||
1756 | local current; |
||
1757 | if (StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].OnShow) then |
||
1758 | current = true; |
||
1759 | end |
||
1760 | if (force == "ON" or (not current and force ~= "OFF")) then |
||
1761 | StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].OnShow = function(data) |
||
1762 | BGAssist_AutomaticBGEntry(data); |
||
1763 | end |
||
1764 | elseif (force == "OFF" or (current and force ~= "ON")) then |
||
1765 | StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].OnShow = nil; |
||
1766 | end |
||
1767 | end |