This repository has been archived by the owner on Sep 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Core.lua
19959 lines (17930 loc) · 576 KB
/
Core.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local addonName, OQ = ...
local L = OQ._T -- for literal string translations
if (OQ.table == nil) then
OQ.table = {}
end
local tbl = OQ.table
-------------------------------------------------------------------------------
local OQ_MAJOR = 2
local OQ_MINOR = 0
local OQ_REVISION = 3
local OQ_SPECIAL_TAG = ""
local OQ_BUILD_STR = tostring(OQ_MAJOR) .. tostring(OQ_MINOR) .. tostring(OQ_REVISION)
local OQ_BUILD = tonumber(OQ_BUILD_STR)
local OQUEUE_VERSION = tostring(OQ_MAJOR) .. '.' .. tostring(OQ_MINOR) .. '.' .. OQ_REVISION
local OQ_NOTIFICATION_CYCLE = 2 * 60 * 60 -- every 2 hrs
local OQ_HEADER = 'OQ'
local OQ_MSGHEADER = OQ_HEADER .. ','
local OQ_FLD_TO = '#to:'
local OQ_FLD_FROM = '#fr:'
local OQ_FLD_REALM = '#rlm:'
local OQ_REALM_CHANNEL = 'x.oqueue'
local OQ_TTL = 4
local OQ_PREMADE_STAT_LIFETIME = 5 * 60 -- 5 minutes
local OQ_GROUP_RECOVERY_TM = 5 * 60 -- 5 minutes
local OQ_SEC_BETWEEN_ADS = 20
local OQ_SEC_BETWEEN_PROMO = 20
-- local OQ_MIN_PROMO_TIME = (OQ_SEC_BETWEEN_ADS - 5) ; -- allow for mesh latency
local OQ_BOOKKEEPING_INTERVAL = 10
local OQ_MAX_ATOKEN_LIFESPAN = 120 -- 120 seconds before token removed from ATOKEN list
local OQ_MIN_ATOKEN_RELAY_TM = 30 -- do not relay atokens more then once every 30 seconds
local OQ_MAX_HONOR_WARNING = 3600
local OQ_MAX_HONOR = 4000
local OQ_MAX_WAITLIST = 30
local OQ_INVITEALL_CD = 5 -- seconds
local OQ_PENDINGNOTE_UPDATE_CD = 5
local OQ_CREATEPREMADE_CD = 5 -- seconds
local MAX_OQGENERAL_TALKERS = 9999
local my_group = 0
local my_slot = 0
local next_invite_tm = 0
local last_ident_tm = 0
local skip_stats = 0
local last_stats = ''
local player_name = nil
local player_class = nil
local player_realm = nil
local player_realm_id = 0
local player_level = 1
local player_ilevel = 1
local player_resil = 1
local player_role = 3
local player_deserter = nil
local player_queued = nil
local player_online = 1
local player_karma = 0
local _source = nil -- bnet, addon, bnfinvite, oqgeneral, party
local _msg_token = nil
local _inc_channel = nil
local _received = nil
local _reason = nil
local _ok2relay = 1
local _inside_bg = nil
local _winner = nil
local _msg = nil
local _msg_type = nil
local _msg_id = nil
local _core_msg = nil
local _to_name = nil
local _to_realm = nil
local _from = nil
local _lucky_charms = nil
local _map_open = nil
local _ui_open = nil
local _oqgeneral_id = nil
local _oqgeneral_count = 0
local _oqgeneral_lockdown = true -- restricted until unlocked once the # of members of oqgeneral are determined
local _flags = nil
local _enemy = nil
local _next_flag_check = 0
local _announcePremades = nil -- used for delayed announcements when loading
local _hop = 0
local player_away = nil
local _toon = nil
local _arg = nil
local _vars = nil
local _names = nil
local _items = nil
local oq_ascii = nil
local oq_mime64 = nil
OQ.TOP_LEVEL = 90
OQ.MAX_LOG_LINES = 43
OQ.MAX_SNITCH_LINES = 250
OQ.BUNDLE_EARLIEST_SEND = 3.0 -- seconds
OQ.BUNDLE_EXPIRATION = 4.0 -- seconds
OQ.MAX_BNET_MSG_SZ = 4078 -- max size as per blizz limitation
OQ.DEFAULT_WIDTH = 835
OQ.MIN_FRAME_HEIGHT = 475
OQ.BNET_CAPB4THECAP = 98 -- blizz increased the cap from 100 to 112 (also fixed the crash. capb4cap needed?).
OQ.MODEL_CHECK_TM = 3 -- check every 3 seconds
OQ.RELAY_OVERLOAD = 28 -- if sent msgs/sec exceeds 28, p8 msgs will stop sending
OQ.MAX_MSGS_PER_CYCLE = 6 -- cycles 4 times per second sending msgs
OQ.MAX_PENDING_NOTE = 70
local _ -- throw away (was getting taint warning; what happened blizz?)
local oq = {
my_tok = nil,
ui = nil,
channels = nil,
premades = nil,
raid = nil,
waitlist = nil,
pending = nil
}
local dtp = oq
function OQ:mod()
return oq
end
-------------------------------------------------------------------------------
-- local defines
-------------------------------------------------------------------------------
function oq.get_version_str(version)
if (version == nil) then
return 'Unknown'
end
version = tostring(version)
if (version == '') then
return 'Unknown'
end
local major, minor, rev = version:match('(%d)(%d)(%d)')
if (major == nil or minor == nil or rev == nil) then
return 'Unknown'
end
return major .. "." .. minor .. "." ..rev
end
-------------------------------------------------------------------------------
-- slash commands
-------------------------------------------------------------------------------
SLASH_OQUEUE1 = '/oqueue'
SLASH_OQUEUE2 = '/oq'
SlashCmdList['OQUEUE'] = function(msg)
if (msg == nil) or (msg == '') then
oq.ui_toggle()
return
end
local arg1 = msg
local opts = nil
if (msg ~= nil) and (msg:find(' ') ~= nil) then
arg1 = msg:sub(1, msg:find(' ') - 1)
opts = msg:sub(msg:find(' ') + 1, -1)
end
if (oq.options[arg1] ~= nil) then
oq.options[arg1](opts)
end
end
SLASH_OQLOG1 = '/oqlog'
SLASH_OQLOG2 = '/log'
SlashCmdList['OQLOG'] = function()
oq.toggle_log()
end
--------------------------------------------------------------------------
function oq.hook_options()
oq.options = tbl.new()
oq.options['?'] = oq.usage
oq.options['ban'] = oq.ban_user
oq.options['brb'] = oq.brb
oq.options['clear'] = oq.cmdline_clear
oq.options['debug'] = oq.debug_toggle
oq.options['delist'] = oq.clear_pending
oq.options['disband'] = oq.raid_disband
oq.options['dg'] = oq.quit_raid_now -- drop group
oq.options['dp'] = oq.quit_raid_now -- drop party
oq.options['ejectall'] = oq.ejectall
oq.options['find'] = oq.cmdline_find_member
oq.options['fixui'] = oq.reposition_ui
oq.options['harddrop'] = oq.harddrop
oq.options['help'] = oq.usage
oq.options['inviteall'] = oq.waitlist_invite_all
oq.options['log'] = oq.log_cmdline
oq.options['mbsync'] = oq.mbsync
oq.options['mycrew'] = oq.mycrew
oq.options['mini'] = oq.toggle_mini
oq.options['off'] = oq.oq_off
oq.options['on'] = oq.oq_on
oq.options['pending'] = oq.bn_show_pending
oq.options['ping'] = oq.ping_toon
oq.options['raw'] = oq.show_raw_numbers
oq.options['reset'] = oq.data_reset
oq.options['show'] = oq.show_data
oq.options['set'] = oq.set_params
oq.options['snitch'] = oq.snitch_toggle_ui
oq.options['spy'] = oq.battleground_spy
oq.options['stats'] = oq.dump_statistics
oq.options['toggle'] = oq.toggle_option
oq.options['tz'] = oq.timezone_adjust
oq.options['wallet'] = oq.show_wallet
end
function oq.on_update_instance_info()
local n = GetNumSavedInstances()
for index = 1, n do
local iName,
iID,
iReset,
iDiff,
locked,
extended,
iIDMostSig,
isRaid,
maxPlayers,
diffName,
maxBosses,
defeatedBosses = GetSavedInstanceInfo(index)
print(
tostring(index) ..
'. [' ..
tostring(iName) ..
'].' ..
tostring(iID) ..
' iReset(' ..
tostring(iReset) ..
') iDiff(' .. tostring(iDiff) .. ').(' .. tostring(diffName) .. ')'
)
print(
tostring(index) ..
'. locked(' ..
tostring(locked) .. ') ext(' .. tostring(extended) .. ') iIDMostSig(' .. tostring(iIDMostSig) .. ')'
)
print(
tostring(index) ..
'. isRaid(' ..
tostring(isRaid) ..
') maxPlayers(' ..
tostring(maxPlayers) ..
') bosses: ' .. tostring(defeatedBosses) .. ' / ' .. tostring(maxBosses)
)
print('-')
end
end
function oq.toggle_mini()
if (OQ_MinimapButton:IsVisible()) then
OQ_MinimapButton:Hide()
oq.toon.mini_hide = true
print(OQ.MINIMAP_HIDDEN)
else
OQ_MinimapButton:Show()
oq.toon.mini_hide = nil
print(OQ.MINIMAP_SHOWN)
end
end
local function comma_value(n) -- credit http://richard.warburton.it
local left, num, right = string.match(n or 0, '^([^%d]*%d)(%d*)(.-)$')
return left .. (num:reverse():gsub('(%d%d%d)', '%1,'):reverse()) .. right
end
function oq.csv(t)
if (t == nil) then
return t
end
local m
for _, v in pairs(t) do
if (m) then
m = m .. ',' .. v
else
m = v
end
end
return m
end
-- remove trailing and leading whitespace from string.
-- http://en.wikipedia.org/wiki/Trim_(8programming)
function oq.trim(s)
-- from PiL2 20.4
return (s:gsub('^%s*(.-)%s*$', '%1'))
end
-- remove leading whitespace from string.
-- http://en.wikipedia.org/wiki/Trim_(8programming)
function oq.ltrim(s)
return (s:gsub('^%s*', ''))
end
-- remove trailing whitespace from string.
-- http://en.wikipedia.org/wiki/Trim_(8programming)
function oq.rtrim(s)
local n = #s
while n > 0 and s:find('^%s', n) do
n = n - 1
end
return s:sub(1, n)
end
function oq.onLootAcceptanceHide(f)
oq.tremove_value(getglobal('UISpecialFrames'), f:GetName())
tinsert(getglobal('UISpecialFrames'), oq.ui:GetName())
PlaySound('igQuestLogClose')
end
function oq.onLootAcceptanceShow(f)
tinsert(getglobal('UISpecialFrames'), f:GetName())
oq.tremove_value(getglobal('UISpecialFrames'), oq.ui:GetName())
PlaySound('igQuestLogOpen')
end
function oq.create_loot_rule_contract()
local cx = 440
local cy = 220
local x = 30
local y = 25
local f = oq.panel(UIParent, 'LootContract', 100, 100, cx, cy)
f:SetScript(
'OnShow',
function(self)
oq.onLootAcceptanceShow(self)
end
)
f:SetScript(
'OnHide',
function(self)
oq.onLootAcceptanceHide(self)
end
)
f.closepb =
oq.closebox(
f,
function(self)
self:GetParent():Hide()
end
)
f.closepb:SetPoint('TOPRIGHT', f, 'TOPRIGHT', -15, -8)
f.closepb:Show()
local s = f:CreateTexture(nil, 'BORDER')
s:SetTexture('INTERFACE/LFGFRAME/UI-LFG-SCENARIO-Random.png')
s:SetTexCoord(0 / 512, 325 / 512, 0 / 512, 326 / 512)
s:SetAllPoints(f)
s:SetAlpha(1.0)
f._backdrop = s
f:SetAlpha(1.0)
f.line1 = oq.label(f, x, y, cx - 2 * x, 30, L['Loot method has changed.'], 'CENTER', 'CENTER')
f.line1:SetFont(OQ.FONT, 16, '')
y = y + 40
f.loot_text = oq.label(f, x, y, cx - 2 * x, 30, 'Loot Method', 'CENTER', 'CENTER')
f.loot_text:SetFont(OQ.FONT, 20, '')
f.loot_text:SetTextColor(1, 1, 1)
y = y + 40
f.line2 = oq.label(f, x, y, cx - 2 * x, 30, L['Do you accept the new loot method?'], 'CENTER', 'CENTER')
f.line2:SetFont(OQ.FONT, 16, '')
y = y + 40
y = y + 20
local x2 = x
f.accept_but =
oq.button(
f,
x2,
y,
110,
30,
L['Accept'],
function(self)
self:GetParent():accept()
end
)
x2 = x2 + 110 + 25
f.donot_but =
oq.button(
f,
x2,
y,
110,
30,
L['Do not Accept'],
function(self)
self:GetParent():donot_accept()
end
)
x2 = x2 + 110 + 25
f.reject_but =
oq.button(
f,
x2,
y,
110,
30,
L['Reject and Leave'],
function(self)
self:GetParent():reject_and_leave()
end
)
f:Hide()
f.accept = function(self)
-- don't send msg for affirmative, only negative
OQ_data.loot_method = self._method
self:Hide()
end
f.donot_accept = function(self)
local _, instanceType = IsInInstance()
if (instanceType ~= L['None']) then
oq.SendChatMessage(
string.format('%s: %s', L['Loot method unacceptable'], L['loot.' .. self._method]),
instanceType
)
end
OQ_data.loot_method = nil
self.donot_but:Disable()
oq.timer_oneshot(4, oq.enable_button, self.donot_but)
end
f.reject_and_leave = function(self)
local _, instanceType = IsInInstance()
if (instanceType ~= L['None']) then
oq.SendChatMessage(
string.format('%s: %s', L["I'm leaving due to loot method"], L['loot.' .. self._method]),
instanceType
)
end
OQ_data.loot_method = nil
self:Hide()
oq.quit_raid_now()
end
f._method = 'unspecified'
return f
end
function oq.verify_loot_rules_acceptance()
if (OQ_data.loot_acceptance ~= 1) or (UnitIsGroupLeader('player') == true) then
return
end
-- Do not show if you are solo running some dungeons/raids
if (not oq.iam_in_a_party()) then
return
end
local instance, instanceType = IsInInstance()
if (instance == nil) or ((instanceType ~= 'party') and (instanceType ~= 'raid')) then
return
end
local _, _, difficultyIndex = GetInstanceInfo()
-- 1 Normal - party
-- 2 Heroic - party
-- 3 10 Player
-- 4 25 Player
-- 5 10 Player (Heroic)
-- 6 25 Player (Heroic)
-- 9 40 Player raid
if (difficultyIndex > 6 and difficultyIndex ~= 9) then
return
end
oq._loot_rule_contract = oq._loot_rule_contract or oq.create_loot_rule_contract()
local f = oq._loot_rule_contract
local method = GetLootMethod()
if (OQ_data.loot_method == method) then
-- already accepted, leave
return
end
f._method = method
f.loot_text:SetText(L['loot.' .. method])
oq.moveto(f, floor((GetScreenWidth() - f:GetWidth()) / 2), 200)
f:Show()
end
-- new browser capability
-- might be able to show armory in-game (nice for quick lookups off waitlist)
-- not ready yet; doesn't seem to work and may break key binds
function oq.armory()
if (oq.browser == nil) then
oq.browser = oq.CreateFrame('Browser', 'oQueueBrowser', UIParent)
end
if (oq.browser:HasConnection() ~= true) then
print('oQueue browser - no connection')
return
end
print('oQueue browser - navigation')
oq.browser:Show()
-- oq.browser:NavigateHome();
oq.browser:OpenExternalLink('http://us.battle.net')
end
function oq.reposition_ui()
local x = 100
x = x + 400
-- main ui
local f = OQMainFrame
if (not f:IsVisible()) then
oq.ui_toggle()
end
f:SetWidth(OQ.DEFAULT_WIDTH)
f:SetHeight(OQ.MIN_FRAME_HEIGHT)
f:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', x, -150)
x = x + OQ.DEFAULT_WIDTH
-- toggle minimap button so it's on top
OQ_MinimapButton:Show()
OQ_MinimapButton:SetFrameStrata('MEDIUM')
OQ_MinimapButton:SetFrameLevel(50)
-- log
if (oq._log) then
oq._log:Show()
oq._log:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', x, -325)
oq._log:_save_position()
end
oq.snitch_ui_create()
if (oq._snitch) and (oq._snitch.ui) then
oq._snitch.ui:_fixui()
oq._snitch.ui:Show()
end
end
function oq.frame_resize()
local cy = OQ_data._height or OQ.MIN_FRAME_HEIGHT
local dy = cy - OQMainFrame:GetHeight()
OQTabPage1:SetHeight(OQTabPage1:GetHeight() + dy)
OQTabPage1:_resize()
OQTabPage2:SetHeight(OQTabPage2:GetHeight() + dy)
OQTabPage2:_resize()
OQTabPage3:SetHeight(OQTabPage3:GetHeight() + dy)
OQTabPage3:_resize()
OQTabPage5:SetHeight(OQTabPage6:GetHeight() + dy)
OQTabPage5:_resize()
OQTabPage6:SetHeight(OQTabPage6:GetHeight() + dy)
OQTabPage6:_resize()
OQTabPage7:SetHeight(OQTabPage7:GetHeight() + dy)
OQTabPage7:_resize()
oq.reshuffle_premades_now()
end
function oq.set_params(opt)
if (opt == nil) then
return
end
if (opt:find('rowheight')) then
OQ_data._rowheight = min(30, max(15, tonumber(opt:sub(opt:find(' ') or -1, -1)) or 0))
oq.reshuffle_premades()
print(L['row height set: '] .. tostring(OQ_data._rowheight))
elseif (opt:find('height')) then
OQ_data._height = min(1000, max(OQ.MIN_FRAME_HEIGHT, tonumber(opt:sub(opt:find(' ') or -1, -1)) or 0))
oq.ui:SetHeight(OQ_data._height or OQ.MIN_FRAME_HEIGHT)
oq.frame_resize()
end
end
function oq.show_count()
local nLeaders = 0
local nWaiting = 0
local nMembers = 0
for _, v in pairs(oq.premades) do
nLeaders = nLeaders + 1
nMembers = nMembers + v.nMembers
nWaiting = nWaiting + v.nWaiting
end
print('nLeaders: ' .. tostring(nLeaders))
print('nMembers: ' .. tostring(nMembers))
print('nWaiting: ' .. tostring(nWaiting))
end
function oq.show_data(opt)
if (opt == nil) or (opt == '?') then
print('oQueue v' .. OQUEUE_VERSION .. ' build ' .. OQ_BUILD .. ' (' .. tostring(OQ.REGION) .. ')')
print(' usage: /oq show <option>')
print(' count sum up LFM info')
print(' frames frame report (ie: show frames listingregion)')
print(' income currency report')
print(' inuse frames in use (ie: show inuse listingregion)')
print(' locals local premade leaders')
print(' premades list premades')
print(' raid show current raid members')
print(" remove list all the battle-tags that will be removed with 'remove now'")
print(' report show battleground reports yet to be filed')
print(' snitch list snitch info to chat area')
print(' stats list various stats')
print(" wallet what's in YOUR wallet?")
elseif (opt == 'count') then
oq.show_count()
elseif (opt == 'cache') then
oq.show_premade_cache()
elseif (opt:find('frames') == 1) then
oq.frame_report(opt)
elseif (opt == 'globals') then
oq.dump_globals()
elseif (opt == 'income') then
oq.check_currency()
elseif (opt:find('inuse') == 1) then
oq.frames_inuse_report(opt)
elseif (opt == 'locals') then
oq.show_locals()
elseif (opt:find('premades') == 1) then
oq.show_premades(opt)
elseif (opt == 'raid') or (opt == 'premade') then
oq.show_raid()
elseif (opt == 'reform') then
oq.reform_show_keys()
elseif (opt == 'report') then
oq.show_reports()
elseif (opt == 'snitch') then
oq.snitch('dump')
elseif (opt == 'stats') then
oq.dump_statistics()
elseif (opt:find('tables') == 1) then
tbl.fill_match(_arg, opt, ' ') -- args: tables cnt dump substring
tbl.dump_track(_arg[2], _arg[3], _arg[4])
elseif (opt:find('systables') == 1) then
tbl.fill_match(_arg, opt, ' ') -- args: tables cnt dump substring
oq.dump_tables(_arg[2], _arg[3])
elseif (opt:find('timers') == 1) then
oq.timer_dump(opt)
elseif (opt == 'waitlist') then
oq.show_waitlist()
elseif (opt == 'wallet') then
oq.show_wallet()
end
end
function oq.dump_tables(sub, dump)
local n, cnt
cnt = tonumber(sub)
for i, v in pairs(oq) do
if (type(v) == 'table') then
local s = tostring(v)
n = tbl.size(v)
if (sub == nil) or (i:find(sub)) or (s:find(sub)) or (cnt and (cnt < n)) then
print('oq.' .. tostring(i) .. ': ' .. tostring(v) .. ' #: ' .. tbl.size(v))
if (dump) then
for j, x in pairs(v) do
print(' ' .. tostring(j) .. ' (' .. type(j) .. ') [' .. tostring(x) .. ']')
end
end
end
end
end
for i, v in pairs(tbl) do
if (type(v) == 'table') then
local s = tostring(v)
n = tbl.size(v)
if (sub == nil) or (i:find(sub)) or (s:find(sub)) or (cnt and (cnt < n)) then
print('tbl.' .. tostring(i) .. ': ' .. tostring(v) .. ' #: ' .. tbl.size(v))
if (dump) then
for j, x in pairs(v) do
print(' ' .. tostring(j) .. ' (' .. type(j) .. ') [' .. tostring(x) .. ']')
end
end
end
end
end
end
function oq.show_waitlist()
print('-- waitlist rows')
for _, v in pairs(oq.tab7.waitlist) do
local btag = strlower(oq.waitlist[v.token].realid)
print(' ' .. tostring(v.token) .. ' btag: ' .. tostring(btag))
end
print(' ')
print('-- waitlist table')
for req_tok, v in pairs(oq.waitlist) do
print(' ' .. tostring(req_tok) .. ' btag: ' .. tostring(v.realid))
end
print('--')
end
function oq.dump_globals()
print('-- globals')
for i, v in pairs(OQ) do
local t = strupper(i)
if (t ~= i) then
print(' ' .. tostring(i) .. ': [' .. tostring(v) .. ']')
end
end
print('-- ')
end
function oq.show_wallet()
if (oq.toon.player_wallet == nil) then
return
end
print('--[ wallet ]--')
for i, v in pairs(oq.toon.player_wallet) do
print(' ' .. tostring(i) .. ' ' .. tostring(v))
end
print('--')
end
function oq.show_reports()
end
function oq.toggle_option(opt)
if (opt == nil) or (opt == '?') then
print('oQueue v' .. OQUEUE_VERSION .. ' build ' .. OQ_BUILD .. ' (' .. tostring(OQ.REGION) .. ')')
print(' usage: /oq toggle <option>')
print(' ads toggle the premade advertisements')
print(' mini toggle the minimap icon')
elseif (opt == 'mini') then
oq.toggle_mini()
elseif (opt == 'ads') then
if (OQ_data.show_premade_ads == nil) or (OQ_data.show_premade_ads == 0) then
OQ_data.show_premade_ads = 1
print('premade advertisements are now ON')
else
OQ_data.show_premade_ads = 0
print('premade advertisements are now OFF')
end
end
end
function oq.timezone_adjust(opt)
if (opt == nil) then
OQ_data.sk_adjust = 0
print(L['OQ: timezone adjustment cleared'])
return
end
if (opt == 'sk') then
OQ_data.sk_adjust = 0
OQ_data.sk_next_update = oq.utc_time('pure') + 3 * 24 * 60 * 60
return
end
local n = tonumber(opt or 0) or 0
if (n == 0) then
OQ_data.sk_adjust = 0
print(L['OQ: timezone adjustment cleared'])
return
end
print(string.format(L['OQ: timezone adjustment set to %d minutes'], n))
OQ_data.sk_adjust = n * 60
end
function oq.harddrop()
oq.raid_disband()
oq.raid_cleanup()
oq.raid_init()
print(L['OQ: group info reset'])
end
function oq.ban_user(tag)
if (tag == nil) then
return
end
local dialog = StaticPopup_Show('OQ_BanUser', tag)
if (dialog ~= nil) then
dialog.data2 = {flag = 3, btag = tag}
end
end
function oq.usage()
print('oQueue v' .. OQUEUE_VERSION .. ' build ' .. OQ_BUILD .. ' (' .. tostring(OQ.REGION) .. ')')
print(L['usage: /oq [command]'])
print(L['command such as:'])
print(L[' adds show the list of OQ added b.net friends'])
print(L[' ban [b-tag] manually add battle-tag to your ban list'])
print(L[' bnclear clear OQ enabled battle-net associations'])
print(L[" brb signal to the group that you'll be-right-back"])
print(L[' check force OQ capability check'])
print(L[' delist de-waitlist with any premades currently pending'])
print(L[' dg drop group. same as /script LeaveParty()'])
print(L[' fixui will reposition the UI to upper left area'])
print(L[' id show guid, id, and name of target'])
print(L[' log [clear] toggle log on/off or clear'])
print(L[' mini toggle the minimap button'])
print(L[' mycrew [clear] for boxers, populate the alt list'])
print(L[' now print the current utc time (only visible to user)'])
print(L[' off turn off OQ messaging'])
print(L[' on turn on OQ messaging'])
print(L[' pnow print the current utc time to party chat'])
print(L[' pos print your current location in the world'])
print(L[' purge purge friends list of OQ added b.net friends'])
print(L[' rc start role check (OQ premade leader only)'])
print(L[' refresh sends out a request to refresh find-premade list'])
print(L[' show <opt> show various information'])
print(L[' stats various statistics about the player'])
print(L[' spy [on|off] display summary of enemy class types'])
print(L[' toggle <opt> toggle specific option'])
print(L[' who list of OQ enabled battle-net friends'])
end
function oq.toon_init(t)
t.last_tm = 0
t.auto_role = 1
t.reports = tbl.new()
end
function oq.data_reset()
oq = {
my_tok = nil,
ui = tbl.new(),
channels = tbl.new(),
premades = tbl.new(),
raid = tbl.new(),
waitlist = tbl.new()
}
OQ_data = nil
oq.load_oq_data()
-- if (OQ_toon) then
-- OQ_toon = tbl.delete( OQ_toon ) ;
-- end
oq.load_toon_info()
oq.init_stats_data()
print('oQueue data reset. for it to take effect, type /reload')
end
function oq.debug_toggle(level)
if (level) then
if (level == 'off') then
oq._debug = nil
print('debug off')
elseif (level == 'on') then
oq._debug = true
print('debug on')
elseif (tonumber(level)) then
oq._debug_level = tonumber(level)
print('debug level: ' .. tostring(oq._debug_level))
end
else
if (oq._debug) then
oq._debug = nil
print('debug off')
else
oq._debug = true
print('debug on')
end
end
end
function oq.reset_stats()
oq.pkt_sent:reset()
oq.pkt_recv:reset()
oq.pkt_processed:reset()
oq.pkt_drift:reset()
oq.gmt_diff_track:reset()
end
function oq.oq_off()
oq.toon.disabled = true
oq.oqgeneral_leave()
oq.remove_all_premades()
oq.reset_stats()
print(OQ.DISABLED)
end
function oq.oq_on()
oq.toon.disabled = nil
oq.oqgeneral_join()
print(OQ.ENABLED)
end
local _consts = {
0x00000000,
0x77073096,
0xEE0E612C,
0x990951BA,
0x076DC419,
0x706AF48F,
0xE963A535,
0x9E6495A3,
0x0EDB8832,
0x79DCB8A4,
0xE0D5E91E,
0x97D2D988,
0x09B64C2B,
0x7EB17CBD,
0xE7B82D07,
0x90BF1D91,
0x1DB71064,
0x6AB020F2,
0xF3B97148,
0x84BE41DE,
0x1ADAD47D,
0x6DDDE4EB,
0xF4D4B551,
0x83D385C7,
0x136C9856,
0x646BA8C0,
0xFD62F97A,
0x8A65C9EC,
0x14015C4F,
0x63066CD9,
0xFA0F3D63,
0x8D080DF5,
0x3B6E20C8,
0x4C69105E,
0xD56041E4,
0xA2677172,
0x3C03E4D1,
0x4B04D447,
0xD20D85FD,
0xA50AB56B,
0x35B5A8FA,
0x42B2986C,
0xDBBBC9D6,
0xACBCF940,
0x32D86CE3,
0x45DF5C75,
0xDCD60DCF,
0xABD13D59,
0x26D930AC,
0x51DE003A,
0xC8D75180,
0xBFD06116,
0x21B4F4B5,
0x56B3C423,
0xCFBA9599,
0xB8BDA50F,
0x2802B89E,
0x5F058808,
0xC60CD9B2,
0xB10BE924,
0x2F6F7C87,
0x58684C11,
0xC1611DAB,
0xB6662D3D,
0x76DC4190,
0x01DB7106,
0x98D220BC,
0xEFD5102A,
0x71B18589,
0x06B6B51F,
0x9FBFE4A5,
0xE8B8D433,
0x7807C9A2,
0x0F00F934,
0x9609A88E,
0xE10E9818,
0x7F6A0DBB,
0x086D3D2D,
0x91646C97,
0xE6635C01,
0x6B6B51F4,
0x1C6C6162,
0x856530D8,
0xF262004E,
0x6C0695ED,
0x1B01A57B,
0x8208F4C1,
0xF50FC457,
0x65B0D9C6,
0x12B7E950,
0x8BBEB8EA,
0xFCB9887C,
0x62DD1DDF,
0x15DA2D49,
0x8CD37CF3,
0xFBD44C65,
0x4DB26158,
0x3AB551CE,
0xA3BC0074,
0xD4BB30E2,
0x4ADFA541,
0x3DD895D7,
0xA4D1C46D,
0xD3D6F4FB,
0x4369E96A,
0x346ED9FC,
0xAD678846,
0xDA60B8D0,
0x44042D73,
0x33031DE5,
0xAA0A4C5F,
0xDD0D7CC9,
0x5005713C,
0x270241AA,
0xBE0B1010,