-
Notifications
You must be signed in to change notification settings - Fork 2
/
GetDotaLobby.as
3017 lines (2507 loc) · 109 KB
/
GetDotaLobby.as
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
package {
// Valve Libaries
import ValveLib.Globals;
import ValveLib.ResizeManager;
// Hacky stuff
import flash.utils.getQualifiedClassName;
import flash.utils.getDefinitionByName;
import flash.utils.Timer;
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import scaleform.clik.events.ButtonEvent;
import scaleform.clik.controls.*;
import flash.geom.Point;
import scaleform.gfx.DisplayObjectEx;
import scaleform.gfx.Extensions;
import scaleform.gfx.MouseEventEx;
import scaleform.gfx.InteractiveObjectEx;
import fl.motion.Color;
import flash.text.TextFormat;
import scaleform.gfx.TextFieldEx;
import flash.text.TextField;
import flash.text.TextFormatAlign;
import flash.text.TextFieldType;
import scaleform.clik.data.DataProvider;
import dota2Net.D2HTTPSocket;
import com.adobe.serialization.json.*;
import flashx.textLayout.formats.BackgroundColor;
import flash.geom.ColorTransform;
import scaleform.clik.events.ListEvent;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.FocusEvent;
import flash.ui.Keyboard;
import fl.transitions.TweenEvent;
import fl.transitions.Tween;
import flash.net.URLVariables;
import flash.net.URLLoaderDataFormat;
import flash.desktop.Clipboard;
import flash.desktop.ClipboardFormats;
import flash.globalization.DateTimeFormatter;
import flash.globalization.LocaleID;
import flash.globalization.DateTimeStyle;
import flash.text.TextFieldAutoSize;
import flash.utils.Dictionary;
import flash.display.Loader;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.display.BitmapData;
public class GetDotaLobby extends MovieClip {
// Game API related stuff
public var gameAPI:Object;
public var globals:Object;
public var elementName:String;
public var version:String = "0.39";
private var DEBUG:Boolean = false;
private var versionChecked:Boolean = false;
private var lxClip = this;
public var buttonCount:int = 1;
public var correctedRatio:Number = 1;
public var screenWidth:Number = 1600;
public var screenHeight:Number = 900;
public var hostGameClip:MovieClip;
public var lobbyBrowserClip:MovieClip;
public var lobbyNameField:TextField;
public var mapNameField:TextField;
public var lobbyMapNameField:TextField;
public var lobbySearchField:TextField;
public var scalingTopBarPanel:MovieClip;
public var joinPanelBg:MovieClip;
public var optionsPanelBg:MovieClip;
public var minigamesPanelBg:MovieClip;
public var chatLoader:Loader = null;
public var chat = null;
public var originalXScale = -1;
public var originalYScale = -1;
public var lastReload:Date = null;
public var lobbyData:Object = new Object();
public var currentOptions:Array;
public var gmiToModID:Object;
public var gmiToProvider:Object;
public var gmiToLobbyProvider:Object;
public var gmiToName:Object;
public var gmiToOptions:Object;
public var retryCount:int = -1;
public var currentUrl:String = "";
public var lobbyState:Object;
public var lobbyStateTimer:Timer;
public var but:MovieClip = null;
public var but2:MovieClip = null;
public var but3:MovieClip = null;
public var chatButton:MovieClip = null;
public var currentMinigameClip = null;
public var currentMinigame = null;
public var currentMinigameName = null;
public var minigameLoading = false;
public var minigameLastPositions:Object = new Object();
public var fields:Vector.<Object> = new Vector.<Object>();
public var modsProvider:DataProvider = new DataProvider();
public var lobbyModsProvider:DataProvider = new DataProvider();
public var regionProvider:DataProvider = new DataProvider(
[{"label": "US East", "data":1},
{"label": "US West", "data":2},
{"label": "EU West", "data":3},
{"label": "EU East", "data":4},
{"label": "Russia", "data":5},
{"label": "China", "data":6},
{"label": "Australia", "data":7},
{"label": "SE Asia", "data":8},
{"label": "Peru", "data":9},
{"label": "South America", "data":10},
{"label": "Middle East", "data":11},
{"label": "South Africa", "data":12},
{"label": "South Asia", "data":13}]);
public var lobbyRegionProvider:DataProvider = new DataProvider(
[{"label": "<ANY REGION>", "data":-1},
{"label": "US East", "data":1},
{"label": "US West", "data":2},
{"label": "EU West", "data":3},
{"label": "EU East", "data":4},
{"label": "Russia", "data":5},
{"label": "China", "data":6},
{"label": "Australia", "data":7},
{"label": "SE Asia", "data":8},
{"label": "Peru", "data":9},
{"label": "South America", "data":10},
{"label": "Middle East", "data":11},
{"label": "South Africa", "data":12},
{"label": "South Asia", "data":13}]);
private var currentLanguage:String = "english";
private var langTest:String = "#DOTA_join_private_error1";
private var languageTable:Object = {
"The password entered does not match the password created by the lobby-leader.":"english",
"A senha inserida não corresponde à senha criada pelo líder da sala.":"brazilian",
"Въведената парола не съвпада със зададената от лидера на лобито.":"bulgarian",
"Zadané heslo se neshoduje s heslem vytvořeným správcem lobby.":"czech",
"Den indtastede adgangskode er ikke den samme som adgangskoden lavet af lederen af lobbyen.":"danish",
"Het wachtwoord wat je hebt ingevoerd komt niet overeen met het wachtwoord dat de lobbyleider gekozen heeft.":"dutch",
"Antamasi salasana ei täsmää aulan johtajan asettaman salasanan kanssa.":"finnish",
"Le mot de passe ne correspond pas à celui créé par le leader de la salle d'attente.":"french",
"Das eingegebene Passwort stimmt nicht mit dem Passwort überein, das vom Lobbyleiter festgelegt wurde.":"german",
"Ο κωδικός που εισήγατε δεν ταιριάζει με τον κωδικό του υπεύθυνου παιχνιδιού.":"greek",
"A beírt jelszó nem egyezik meg a várószoba-főnök által létrehozottal.":"hungarian",
"La password inserita non corrisponde a quella creata dal leader della lobby.":"italian",
"入力されたパスワードは、ロビーリーダーが設定したパスワードと一致しません。":"japanese",
"입력하신 비밀번호는 방장이 정한 비밀번호와 맞지 않습니다.":"korean",
//"입력하신 비밀번호는 방장이 정한 비밀번호와 맞지 않습니다.":"koreana",
"Passordet du skrev inn stemmer ikke med passordet laget av lobbylederen.":"norwegian",
"Wprowadzono niepoprawne hasło.":"polish",
"A palavra-passe introduzida não combina com a palavra-passe criada pelo líder do lobby.":"portuguese",
"Parola introdusă nu se potrivește cu parola creată de liderul camerei.":"romanian",
"Введенный пароль не соответствует установленному руководителем лобби паролю.":"russian",
"输入的密码与房主设置的不符。":"schinese",
"La contraseña introducida no coincide con la establecida por el anfitrión de la sala.":"spanish",
"Lösenordet du angav matchar inte lösenordet som skapades av lobbyledaren.":"swedish",
"輸入的密碼與廳主設定的密碼不符。":"tchinese",
"รหัสผ่านที่ใส่ไม่ตรงกับที่หัวหน้าห้องกำหนดไว้":"thai",
"Bu parola, lobi lideri tarafından yaratılan parola ile uyuşmuyor.":"turkish",
"Уведений пароль не збігається з тим, який зазначив господар лобі.":"ukrainian",
"Уведений пароль не збігається з тим, який зазначив господар лобі.":"ukrainian"
};
//These are test values, when API is available, read from them
//var target_gamemode:int = 322254016;
var target_gamemode:int; //Warchasers
var target_password:String;
var target_lobby:int;
var socket:D2HTTPSocket;
var clickTarget:Object = null;
var clickedOnce:Boolean = false;
var dclickTimer:Timer = new Timer(150, 1);
public var minigameKV:Object = null;
public var minigameData:Object = null;
var lxOptions:Object = null;
var oldTab = -1;
var cleanupInit:Timer;
var hasSetupLink = false;
var tempLink = "";
public function GetDotaLobby() {
// constructor code
}
public function traceLX(obj:Object){
trace(obj);
var now:Date = new Date();
var ds:String = String(now.hours);
if (now.hours < 10)
ds = "0" + ds;
ds += ":";
if (now.minutes < 10)
ds += "0";
ds += now.minutes + ":";
if (now.seconds < 10)
ds += "0";
ds += now.seconds + ".";
if (now.milliseconds < 10)
ds += "00";
else if (now.milliseconds < 100)
ds += "0";
ds += now.milliseconds;
logPanel.logText.text += "[" + ds + "] " + obj.toString() + "\n";
logPanel.logText.textField.scrollV = logPanel.logText.textField.maxScrollV;
}
public function sendMMR(e:TimerEvent, statsEnabled = true){
var profileTimer:Timer = new Timer(300,0);
/*var fun:Function = function(e:TimerEvent){
var lvl:String;
try{
lvl = globals.Loader_profile.movieClip.main.overview.LevelValue.text; // Games Lost
}catch(e:Error){
return;
}
traceLX(lvl);
var losses:String = globals.Loader_profile.movieClip.main.overview.LossesValue.text; // Games Lost
traceLX(losses);
var wins:String = globals.Loader_profile.movieClip.main.overview.GamesWon.text; // Games Won
traceLX(wins);
var abandonPercent:String = globals.Loader_profile.movieClip.main.overview.LeaverCount.text; // Abandon %
traceLX(abandonPercent);
var soloMMR:String = globals.Loader_profile.movieClip.main.overview.rank.rank_solo_value.text; // Solo MMR
traceLX(soloMMR);
var partyMMR:String = globals.Loader_profile.movieClip.main.overview.rank.rank_party_value.text; // Party MMR
traceLX(partyMMR);
var friendly:String = globals.Loader_profile.movieClip.main.overview.tabcontentoverview.blocks.content.commendations.FriendlyCount.text // Friendly
traceLX(friendly);
var forgiving:String = globals.Loader_profile.movieClip.main.overview.tabcontentoverview.blocks.content.commendations.ForgivingCount.text // Forgiving
traceLX(forgiving);
var teaching:String = globals.Loader_profile.movieClip.main.overview.tabcontentoverview.blocks.content.commendations.TeachingCount.text // Teaching
traceLX(teaching);
var leading:String = globals.Loader_profile.movieClip.main.overview.tabcontentoverview.blocks.content.commendations.LeadingCount.text // Leading
traceLX(leading);
if (wins == "--" && lvl != "1")
return;
profileTimer.stop();
}
profileTimer.addEventListener(TimerEvent.TIMER, fun);
//profileTimer.start();*/
globals.Loader_play.movieClip.setCurrentTab(10);
var fun2:Function = function(e:TimerEvent){
var party:String = globals.Loader_play.movieClip.PlayWindow.PlayMain.FindMatchPanel.FindRankedMatchOptions.RankedEnabledControls.rank_general_value.text;
var solo:String = globals.Loader_play.movieClip.PlayWindow.PlayMain.FindMatchPanel.FindRankedMatchOptions.RankedEnabledControls.rank_solo_value.text;
if (party == "9999" && solo == "9999")
return;
var gamesPlayed:String = globals.Loader_profile_mini.movieClip.ProfileMini_main.ProfileMini.Persona.WinsValue.text;
var uid:String = Globals.instance.Loader_profile_mini.movieClip.ProfileMini_main.ProfileMini.Persona.steamIDNumber.text;
var username:String = Globals.instance.Loader_profile_mini.movieClip.ProfileMini_main.ProfileMini.Persona.Player.PlayerNameIngame.text;
var statsDisabled = "1";
if (statsEnabled)
statsDisabled = "0";
traceLX("Sending MMR: " + solo + " -- " + party);
var fun3:Function = function(statusCode:int, data:String){
traceLX("MMR Sent");
};
socket.getDataAsync("d2mods/api/stat_user.php?uid=" + uid
+ "&un=" + escape(username)
+ "&tg=" + gamesPlayed
+ "&sm=" + solo
+ "&tm=" + party
+ "&sd=" + statsDisabled, fun3);
profileTimer.stop();
};
profileTimer.addEventListener(TimerEvent.TIMER, fun2);
profileTimer.start();
}
public function startMinigame(gameName:String, file:String, debug:Boolean = false){
minigamesPanelBg.visible = false;
file = "minigames/" + gameName + "/" + file;
traceLX('##Start Minigame: ' + gameName + " -- " + file + " -- " + debug);
var loader:Loader = new Loader();
loader.load(new URLRequest(file));
//var waitToLoadTimer:Timer = new Timer(200,0);
var loadComplete:Function = function(e:Event){
traceLX("MINIGAME LOAD COMPLETE");
var mc:MovieClip = new MovieClip();
var panelClass:Class = getDefinitionByName("DB_inset") as Class;
var panel:MovieClip = new panelClass();
panel.visible = true;
panel.enabled = true;
panel.y = -5;
panel.width = loader.width + 15;
panel.height = loader.height + 15;
var indentClass:Class = getDefinitionByName("indent_hilite") as Class;
var indent:MovieClip = new indentClass();
indent.y = -35;
indent.height = 30;
indent.width = loader.width + 14;
var outerClass:Class = getDefinitionByName("DB4_outerpanel") as Class;
var outer:MovieClip = new outerClass();
outer.y = -30;
outer.height = 35+loader.height;
outer.width = loader.width + 18;
var title:TextField = createTextField(22, 0xFFFFFF, TextFormatAlign.CENTER);
title.y = -32;
title.width = loader.width + 18;
var close:CloseButton = new CloseButton();
close.width = 16;
close.height = 16;
close.y = -25;
close.x = loader.width + 12;
mc.addChild(outer);
mc.addChild(title);
mc.addChild(panel);
mc.addChild(loader);
mc.addChild(indent);
mc.addChild(close);
var dragging:Boolean = false;
var handleDown:Function = function(event:MouseEvent){
if (event.target == outer || event.target == indent || event.target == title){
dragging = true;
mc.startDrag();
}
};
var handleUp:Function = function(event:MouseEvent){
if (dragging)
mc.stopDrag();
};
mc.addEventListener(MouseEvent.MOUSE_DOWN, handleDown);
mc.addEventListener(MouseEvent.MOUSE_UP, handleUp);
if (minigameLastPositions[gameName] != null){
mc.x = minigameLastPositions[gameName].x;
mc.y = minigameLastPositions[gameName].y;
}
else{
mc.x = screenWidth / 2 - mc.width / 2 * correctedRatio;
mc.y = screenHeight / 2 - mc.height / 2 * correctedRatio;
}
globals.Loader_top_bar.movieClip.addChild(mc);
var mg:Minigame = loader.content as Minigame;
var gameCloseClicked:Function = function(e:MouseEvent){
traceLX('Minigame Close Clicked')
if (mg.close()){
traceLX('CLOSING Minigame');
closeMinigame();
}
};
close.addEventListener(MouseEvent.CLICK, gameCloseClicked);
PrintTable(minigameKV);
var uid:String = Globals.instance.Loader_profile_mini.movieClip.ProfileMini_main.ProfileMini.Persona.steamIDNumber.text;
mg.minigameAPI = new MinigameAPI(mg, mc, panel, indent, outer, title, close, lxClip, gameName, debug, uid, currentLanguage);
title.text = mg.minigameAPI.translate(mg.title);
mg.globals = globals;
mg.gameAPI = gameAPI;
mg.debug = debug;
mg.initialize();
if (mg.resize(screenWidth, screenHeight, correctedRatio)){
mc.scaleX = correctedRatio;
mc.scaleY = correctedRatio;
}
currentMinigameClip = mc;
currentMinigame = mg;
currentMinigameName = gameName;
minigameLoading = false;
};
/*var waitToLoad:Function = function(e:TimerEvent){
if (loader.content != null){
waitToLoadTimer.stop();
//loadComplete(e);
}
};*/
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
//waitToLoadTimer.addEventListener(TimerEvent.TIMER, waitToLoad);//, false, 0, true);
//waitToLoadTimer.start();
minigameLoading = true;
}
public function closeMinigame() : void{
minigameLastPositions[currentMinigameName] = {x:currentMinigameClip.x, y:currentMinigameClip.y};
currentMinigameClip.visible = false;
currentMinigameClip.parent.removeChild(currentMinigameClip);
currentMinigameClip = null;
currentMinigameName = null;
currentMinigame = null;
}
public function test7(){
traceLX('Load called');
if (chatLoader != null)
test8();
var completed:Function = function(e:Event){
traceLX('Chat Loaded');
var chatClass = getDefinitionByName("LXChat");
var token = globals.GameInterface.LoadKVFile('resource/flash3/token.kv');
chat = new chatClass(lxClip, token.token);
chat.scaleX = correctedRatio;
chat.scaleY = correctedRatio;
};
chatLoader = new Loader();
chatLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completed);
chatLoader.load(new URLRequest("LXChat.swf"));
}
public function test8(){
traceLX('Unload called');
if (chatLoader == null)
return;
chat.close();
chat = null;
chatLoader.unloadAndStop();
chatLoader = null;
}
public function onLoaded() : void {
//traceLX("injected by SinZ!\n\n\n");
socket = new D2HTTPSocket("getdotastats.com", "176.31.182.87");
this.gameAPI.OnReady();
var lang:String = languageTable[globals.GameInterface.Translate(langTest)];
if (lang == null){
traceLX("Unable to determine client language. Defaulting to english");
}
else{
traceLX("Client language: " + lang);
currentLanguage = lang;
}
var kv:Object = globals.GameInterface.LoadKVFile('resource/flash3/minigames.kv');
lxOptions = globals.GameInterface.LoadKVFile('resource/flash3/options.kv');
minigameKV = new Object();
minigameKV.Games = new Object();
for (var gameName:String in kv){
if (kv[gameName] == "1"){
var gameKV:Object = globals.GameInterface.LoadKVFile('resource/flash3/minigames/' + gameName + '/game.kv');
if (gameKV != null && gameKV.File != null){
traceLX("Minigame '" + gameName + "' Found.");
minigameKV.Games[gameName] = gameKV;
}
else{
traceLX("Unable to find game.kv for minigame '" + gameName + "'");
}
}
}
if (DEBUG){
createTestButton("Create Game", test1);
createTestButton("Join Game", test2);
createTestButton("Dump Globals", test3);
createTestButton("hook clicks", test4);
createTestButton("Get Lobbies", test5);
createTestButton("Lobby Status", test6);
createTestButton("Test 8", sendMMR);
createTestButton("Load", test7);
createTestButton("Unload", test8);
}
// backdrop for host game panel
var bgClass:Class = getDefinitionByName("DB_inset") as Class;
var mc = new bgClass();
var redClass:Class = getDefinitionByName("chrome_button_primary_short") as Class;
// Play tab buttons
but = createTestButton("HOST CUSTOM LOBBY", hostGame);
but2 = createTestButton("CUSTOM LOBBY BROWSER", lobbyBrowser);
but3 = new redClass();//createTestButton("MINIGAMES!", showMinigames);
chatButton = new redClass();
this.removeChild(but);
this.removeChild(but2);
//this.removeChild(but3);
var customButton:MovieClip = globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.tab12;
var checkClass:Class = getDefinitionByName("DotaCheckBoxDota") as Class;
var checkBox:MovieClip = new checkClass();
checkBox.label = "Share MMR with GDS?";
if (lxOptions.shareMMR != null && lxOptions.shareMMR.toLowerCase() == "true"){
checkBox.selected = true;
var mmrTimer:Timer = new Timer(2000,1);
mmrTimer.addEventListener(TimerEvent.TIMER, sendMMR);
mmrTimer.start();
var goToPlay:Function = function(e:TimerEvent){
globals.Loader_top_bar.movieClip.gameAPI.DashboardSwitchToSection(2);
};
var mmrTimer2:Timer = new Timer(1500,1);
mmrTimer2.addEventListener(TimerEvent.TIMER, goToPlay);
mmrTimer2.start();
}
else
checkBox.selected = false;
var setupLinks:Function = function(e:TimerEvent){
SetupLink("http://www.dota2.com/workshop/requirements#uvs");
};
var urlTimer:Timer = new Timer(1000,1);
urlTimer.addEventListener(TimerEvent.TIMER, setupLinks);
urlTimer.start();
checkBox.addEventListener(ButtonEvent.CLICK, shareMMRClicked);
but.x = customButton.x;
but.y = customButton.y + 50;
but2.x = customButton.x;
but2.y = but.y + but.height + 2;
checkBox.x = customButton.x;
checkBox.y = but2.y + but2.height + 25;
//var point:Point = globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.localToGlobal(new Point(but2.x, but2.y + but2.height + 2));
//var point2:Point = globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.localToGlobal(new Point(but2.x + but2.width, but2.y + but2.height + 2));
//point = globals.Loader_top_bar.movieClip.globalToLocal(point);
//point2 = globals.Loader_top_bar.movieClip.globalToLocal(point2);
//but3.x = point.x
//but3.y = point.y;
//var scale:Number = (point2.x - point.x) / but3.width;
//but3.scaleX = scale;
//but3.scaleY = scale;
var tabs = globals.Loader_top_bar.movieClip.section_menu_main.section_menu.tabs;
var playButton = globals.Loader_top_bar.movieClip.section_menu_main.section_menu.tabs.PlayButton;
var watchButton = globals.Loader_top_bar.movieClip.section_menu_main.section_menu.tabs.WatchButton;
but3.x = playButton.x + 4;
but3.width = playButton.width;
but3.y = playButton.y + 36.9 + 40;
but3.visible = true;
but3.label = "MINIGAMES!";
but3.addEventListener(MouseEvent.CLICK, showMinigames);
chatButton.x = watchButton.x + 4;
chatButton.width = watchButton.width;
chatButton.y = watchButton.y + 36.9 + 40;
chatButton.visible = true;
chatButton.label = "CUSTOM CHAT";
chatButton.addEventListener(MouseEvent.CLICK, showChat);
var showChat2:Function = function(e:TimerEvent){
if (chat == null)
showChat(null);
};
var chatTimer:Timer = new Timer(1100,1);
chatTimer.addEventListener(TimerEvent.TIMER, showChat2);
chatTimer.start();
globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.addChild(but);
globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.addChild(but2);
globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.addChild(checkBox);
//globals.Loader_play.movieClip.PlayWindow.PlayMain.Nav.addChild(but3);
//globals.Loader_top_bar.movieClip.addChild(but3);
globals.Loader_top_bar.movieClip.section_menu_main.section_menu.tabs.addChild(but3);
globals.Loader_top_bar.movieClip.section_menu_main.section_menu.tabs.addChild(chatButton);
/*var oldDBSwitch:Function = globals.Loader_top_bar.movieClip.gameAPI.DashboardSwitchToSection;
globals.Loader_top_bar.movieClip.gameAPI.DashboardSwitchToSection = function(tab:int){
if (tab == 2)
but3.visible = true;
else
but3.visible = false;
oldDBSwitch(tab);
};*/
// Scaling top bar container panel
scalingTopBarPanel = new MovieClip();
globals.Loader_top_bar.movieClip.addChild(scalingTopBarPanel);
scalingTopBarPanel.x = 0;
scalingTopBarPanel.y = 0;
scalingTopBarPanel.width = 1600;
scalingTopBarPanel.height = 900;
scalingTopBarPanel.scaleX = 1;
scalingTopBarPanel.scaleY = 1;
scalingTopBarPanel.visible = true;
// Place help panel
joinPanelBg = new bgClass();
joinPanelBg.width = joinPanel.width;
joinPanelBg.height = joinPanel.height;
globals.Loader_play_matchmaking_status.movieClip.play_matchmaking_status.addChild(joinPanelBg);
joinPanelBg.x = joinPanel.width / 2 - 15;
joinPanelBg.visible = false;
this.removeChild(joinPanel);
joinPanel.x = joinPanel.width / 2 - 15;
joinPanel.y = 0;
joinPanel.visible = false;
globals.Loader_play_matchmaking_status.movieClip.play_matchmaking_status.addChild(joinPanel);
// Log panel background
mc = new bgClass();
logPanel.addChildAt(mc, 0);
mc.visible = true;
mc.width = logPanel.width;
mc.height = logPanel.height;
// Log button
this.removeChild(logButton);
scalingTopBarPanel.addChild(logButton);
logButton.x = 75;
logButton.y = 2;
logButton.gotoAndStop(1);
var logRollOver:Function = function(e:MouseEvent){logButton.gotoAndStop(2);};
var logRollOut:Function = function(e:MouseEvent){logButton.gotoAndStop(1);};
logButton.addEventListener(MouseEvent.CLICK, showLogPanel, false, 0, true);
logButton.addEventListener(MouseEvent.ROLL_OVER, logRollOver, false, 0, true);
logButton.addEventListener(MouseEvent.ROLL_OUT, logRollOut, false, 0, true);
// Log panel
this.removeChild(logPanel);
scalingTopBarPanel.addChild(logPanel);
logPanel.x = 800 - logPanel.width / 2;
logPanel.y = 450 - logPanel.height / 2;
logPanel.visible = false;
logPanel.closeButton.addEventListener(MouseEvent.CLICK, closeClicked, false, 0, true);
mc = new bgClass();
hostGameClip = new MovieClip();
hostGameClip.addChild(mc);
//this.addChild(hostGameClip);
globals.Loader_top_bar.movieClip.addChild(hostGameClip);
hostGameClip.visible = false;
hostGameClip.width = 1600 * .4;
hostGameClip.height = 900 * .5;
hostGameClip.x = 1600 * .3;
hostGameClip.y = 900 * .25;
hostGameClip.scaleX = 1;
hostGameClip.scaleY = 1;
mc.width = 1600 * .4;
mc.height = 900 * .5;
// Move in stage panel to backdrop
this.hostClip.x = 0;
this.hostClip.y = 0;
this.removeChild(this.hostClip);
hostGameClip.addChild(this.hostClip);
this.hostClip.closeButton.addEventListener(MouseEvent.CLICK, closeClicked, false, 0, true);
// Version string
this.hostClip.versionText.text = "Ver " + version;
this.lobbyClip.versionText.text = "Ver " + version;
// Create Lobby button
this.hostClip.hostGameButton = replaceWithValveComponent(this.hostClip.hostGameButton, "button_big");
this.hostClip.hostGameButton.x = 320 - this.hostClip.hostGameButton.width / 2;
this.hostClip.hostGameButton.textField.text = "CREATE LOBBY";
this.hostClip.hostGameButton.label = "CREATE LOBBY";
this.hostClip.hostGameButton.addEventListener(MouseEvent.CLICK, createLobbyClick, false, 0 ,true);
// Lobby name Input box
this.lobbyNameField = createTextInput(this.hostClip.lobbyNameClip);
this.hostClip.addChild(this.lobbyNameField);
// Create gamemode dropdown
this.hostClip.gameModeClip = replaceWithValveComponent(this.hostClip.gameModeClip, "ComboBoxSkinned", true);
this.hostClip.gameModeClip.rowHeight = 24;
this.hostClip.gameModeClip.visibleRows = 15;
this.hostClip.gameModeClip.showScrollBar = true;
this.hostClip.gameModeClip.setDataProvider(this.modsProvider);
/*this.hostClip.gameModeClip.setDataProvider(new DataProvider(
[{"label": "Reflex", "data":299093466},
{"label": "Warchasers", "data":300989405},
{"label": "Legends of Dota", "data":300989405},
{"label": "Clash of the Titans", "data":310942705}]));*/
this.hostClip.gameModeClip.setSelectedIndex(0);
this.hostClip.gameModeClip.menuList.addEventListener(ListEvent.INDEX_CHANGE, hostModeChange, false, 0, true);
// Create Map Name input box
//this.mapNameField = createTextInput(this.hostClip.mapNameClip, 14);
//this.hostClip.addChild(this.mapNameField);
this.hostClip.mapNameClip = replaceWithValveComponent(this.hostClip.mapNameClip, "ComboBoxSkinned", true);
this.hostClip.mapNameClip.rowHeight = 24;
// Create Region dropdown
this.hostClip.regionClip = replaceWithValveComponent(this.hostClip.regionClip, "ComboBoxSkinned", true);
this.hostClip.regionClip.rowHeight = 24;
this.hostClip.regionClip.setDataProvider(this.regionProvider);
this.hostClip.regionClip.setSelectedIndex(0);
this.hostClip.regionClip.menuList.addEventListener(ListEvent.INDEX_CHANGE, hostRegionChange, false, 0, true);
if (lxOptions.region != null){
var regionID:int = int(lxOptions.region) - 1;
this.hostClip.regionClip.setSelectedIndex(regionID);
}
// Create Min dropdown
this.hostClip.maxClip = replaceWithValveComponent(this.hostClip.maxClip, "ComboBoxSkinned", true);
this.hostClip.maxClip.rowHeight = 24;
this.hostClip.maxClip.visibleRows = 10;
this.hostClip.maxClip.showScrollBar = true;
this.hostClip.maxClip.setDataProvider(new DataProvider(
[{"label": "2", "data":2},
{"label": "3", "data":3},
{"label": "4", "data":4},
{"label": "5", "data":5},
{"label": "6", "data":6},
{"label": "7", "data":7},
{"label": "8", "data":8},
{"label": "9", "data":9},
{"label": "10", "data":10},
{"label": "11", "data":11},
{"label": "12", "data":12},
{"label": "13", "data":13},
{"label": "14", "data":14},
{"label": "15", "data":15},
{"label": "16", "data":16},
{"label": "17", "data":17},
{"label": "18", "data":18},
{"label": "19", "data":19},
{"label": "20", "data":20}]));
this.hostClip.maxClip.setSelectedIndex(8);
// Create lobby browser backdrop
var bgClass2 = getDefinitionByName("DB4_outerpanel") as Class;
var mc2 = new bgClass2();
lobbyBrowserClip = new MovieClip();
lobbyBrowserClip.addChild(mc2);
//this.addChild(lobbyBrowserClip);
globals.Loader_top_bar.movieClip.addChild(lobbyBrowserClip);
this.lobbyClip.x = 0;
this.lobbyClip.y = 0;
this.removeChild(this.lobbyClip);
lobbyBrowserClip.addChild(this.lobbyClip);
this.lobbyClip.closeButton.addEventListener(MouseEvent.CLICK, closeClicked, false, 0, true);
lobbyBrowserClip.visible = false;
lobbyBrowserClip.width = 1600 * .6;
lobbyBrowserClip.height = 900 * .7;
lobbyBrowserClip.x = 1600 * .2;
lobbyBrowserClip.y = 900 * .15;
lobbyBrowserClip.scaleX = 1;
lobbyBrowserClip.scaleY = 1;
mc2.width = 1600 * .6;
mc2.height = 900 * .7;
// Create Mode dropdown
this.lobbyClip.gameModeClip = replaceWithValveComponent(this.lobbyClip.gameModeClip, "ComboBoxSkinned", true);
this.lobbyClip.gameModeClip.rowHeight = 24;
this.lobbyClip.gameModeClip.visibleRows = 15;
this.lobbyClip.gameModeClip.showScrollBar = true;
this.lobbyClip.gameModeClip.setDataProvider(this.modsProvider);
this.lobbyClip.gameModeClip.setSelectedIndex(0);
this.lobbyClip.gameModeClip.menuList.addEventListener(ListEvent.INDEX_CHANGE, lobbyModeChange, false, 0, true);
// Lobby name Input box
this.lobbySearchField = createTextInput(this.lobbyClip.searchClip, 14);
this.lobbyClip.addChild(this.lobbySearchField);
this.lobbySearchField.addEventListener(KeyboardEvent.KEY_DOWN, lobbySearchKeyDown, false, 0, true);
this.lobbySearchField.addEventListener(FocusEvent.FOCUS_OUT, redrawLobbyList, false, 0, true);
// Create Map Name input box
//this.lobbyMapNameField = createTextInput(this.lobbyClip.mapNameClip, 14);
//this.lobbyClip.addChild(this.lobbyMapNameField);
this.lobbyClip.mapNameClip = replaceWithValveComponent(this.lobbyClip.mapNameClip, "ComboBoxSkinned", true);
this.lobbyClip.mapNameClip.rowHeight = 24;
this.lobbyClip.mapNameClip.setDataProvider(new DataProvider());
this.lobbyClip.mapNameClip.setSelectedIndex(0);
this.lobbyClip.mapNameClip.menuList.addEventListener(ListEvent.INDEX_CHANGE, redrawLobbyList, false, 0, true);
// Create Region dropdown
this.lobbyClip.regionClip = replaceWithValveComponent(this.lobbyClip.regionClip, "ComboBoxSkinned", true);
this.lobbyClip.regionClip.rowHeight = 24;
this.lobbyClip.regionClip.setDataProvider(this.lobbyRegionProvider);
this.lobbyClip.regionClip.setSelectedIndex(0);
this.lobbyClip.regionClip.menuList.addEventListener(ListEvent.INDEX_CHANGE, redrawLobbyList, false, 0, true);
// Create Lobby scrolling lobby view
this.lobbyClip.lobbies = replaceWithValveComponent(this.lobbyClip.lobbies, "ScrollViewTest", true, 0);
var sbClass:Class = getDefinitionByName("ScrollBarDota") as Class;
var sb:MovieClip = new sbClass();
sb.enabled = true;
sb.visible = true;
this.lobbyClip.addChild(sb);
this.lobbyClip.lobbies.scrollBar = sb;
this.lobbyClip.lobbies.enabled = true;
this.lobbyClip.lobbies.visible = true;
this.lobbyClip.lobbies.content.removeChild(this.lobbyClip.lobbies.content.Offline);
this.lobbyClip.lobbies.content.removeChild(this.lobbyClip.lobbies.content.Online);
this.lobbyClip.lobbies.content.removeChild(this.lobbyClip.lobbies.content.PlayingDota);
this.lobbyClip.lobbies.content.removeChild(this.lobbyClip.lobbies.content.Pending);
var panelClass:Class = getDefinitionByName("DB_inset") as Class;
var panel:MovieClip = new panelClass();
panel.visible = true;
panel.enabled = true;
panel.x = this.lobbyClip.lobbies.content.x;
panel.y = this.lobbyClip.lobbies.content.y;
panel.width = 930;
panel.height = 509;
this.lobbyClip.lobbies.addChildAt(panel, 0);
sb.x = this.lobbyClip.lobbies.width + this.lobbyClip.lobbies.x - sb.width;
sb.y = this.lobbyClip.lobbies.y;
sb.height = 509;
this.lobbyClip.removeChild(this.lobbyClip.exLobby);
//this.lobbyClip.exLobby.x = 10;
//this.lobbyClip.exLobby.y = 15;
//this.lobbyClip.lobbies.content.addChild(this.lobbyClip.exLobby);
//this.lobbyClip.exLobby.visible = true;
this.lobbyClip.refreshClip = replaceWithValveComponent(this.lobbyClip.refreshClip, "ButtonRefresh2", true);
//this.lobbyClip.refreshClip.scaleX = 1.0;
//this.lobbyClip.refreshClip.scaleY = 1.0;
this.lobbyClip.refreshClip.addEventListener(MouseEvent.CLICK, getLobbyList, false, 0, true);
this.lobbyClip.lobbies.content.x = 5;
this.lobbyClip.lobbies.contentMask.x = -10;
this.lobbyClip.lobbies.contentMask.y = 15;
this.lobbyClip.lobbies.contentMask.width = 915;
this.lobbyClip.lobbies.contentMask.height = 494;
// Minigames panel
mc2 = new bgClass2();
minigamesPanelBg = new MovieClip();
minigamesPanelBg.addChild(mc2);
globals.Loader_top_bar.movieClip.addChild(minigamesPanelBg);
this.minigamesPanel.x = 0;
this.minigamesPanel.y = 0;
this.removeChild(this.minigamesPanel);
minigamesPanelBg.addChild(this.minigamesPanel);
this.minigamesPanel.closeButton.addEventListener(MouseEvent.CLICK, closeClicked, false, 0, true);
minigamesPanelBg.visible = false;
minigamesPanelBg.width = this.minigamesPanel.width;
minigamesPanelBg.height = this.minigamesPanel.height;
minigamesPanelBg.scaleX = 1;
minigamesPanelBg.scaleY = 1;
mc2.width = this.minigamesPanel.width;
mc2.height = this.minigamesPanel.height;
this.minigamesPanel.minigames = replaceWithValveComponent(this.minigamesPanel.minigames, "ScrollViewTest", true, 0);
sb = new sbClass();
sb.enabled = true;
sb.visible = true;
this.minigamesPanel.addChild(sb);
this.minigamesPanel.minigames.scrollBar = sb;
this.minigamesPanel.minigames.enabled = true;
this.minigamesPanel.minigames.visible = true;
panel = new panelClass();
panel.visible = true;
panel.enabled = true;
panel.x = this.minigamesPanel.minigames.content.x;
panel.y = this.minigamesPanel.minigames.content.y;
panel.width = 530;
panel.height = 516;
this.minigamesPanel.minigames.addChildAt(panel, 0);
this.minigamesPanel.minigames.content.removeChild(this.minigamesPanel.minigames.content.Offline);
this.minigamesPanel.minigames.content.removeChild(this.minigamesPanel.minigames.content.Online);
this.minigamesPanel.minigames.content.removeChild(this.minigamesPanel.minigames.content.PlayingDota);
this.minigamesPanel.minigames.content.removeChild(this.minigamesPanel.minigames.content.Pending);
sb.x = this.minigamesPanel.minigames.width + this.minigamesPanel.minigames.x - sb.width;
sb.y = this.minigamesPanel.minigames.y;
sb.height = 516;
this.minigamesPanel.minigames.content.x = 5;
this.minigamesPanel.minigames.contentMask.x = -10;
this.minigamesPanel.minigames.contentMask.y = 15;
this.minigamesPanel.minigames.contentMask.width = 530;
this.minigamesPanel.minigames.contentMask.height = 488;
this.minigamesPanel.removeChild(this.minigamesPanel.ex1);
this.minigamesPanel.removeChild(this.minigamesPanel.ex2);
this.minigamesPanel.removeChild(this.minigamesPanel.ex3);
var miniTimer = new Timer(3000,1);
miniTimer.addEventListener(TimerEvent.TIMER, populateMinigames);
miniTimer.start();
var games:Object = minigameKV.Games;
globals.PrecacheImage("images/spellicons/invoker_empty1.png");
for (var gName:String in games){
var game:Object = games[gName];
if (game.Image != null){
globals.PrecacheImage(game.Image);
}
}
// Options panel
mc2 = new bgClass2();
optionsPanelBg = new MovieClip();
optionsPanelBg.addChild(mc2);
//this.addChild(lobbyBrowserClip);
globals.Loader_top_bar.movieClip.addChild(optionsPanelBg);
this.optionsPanel.x = 0;
this.optionsPanel.y = 0;
this.removeChild(this.optionsPanel);
optionsPanelBg.addChild(this.optionsPanel);
this.optionsPanel.closeButton.addEventListener(MouseEvent.CLICK, closeClicked, false, 0, true);
optionsPanelBg.visible = false;
optionsPanelBg.width = this.optionsPanel.width;
optionsPanelBg.height = this.optionsPanel.height;
optionsPanelBg.scaleX = 1;
optionsPanelBg.scaleY = 1;
mc2.width = this.optionsPanel.width;
mc2.height = this.optionsPanel.height;
this.optionsPanel.options = replaceWithValveComponent(this.optionsPanel.options, "ScrollViewTest", true, 0);
sb = new sbClass();
sb.enabled = true;
sb.visible = true;
this.optionsPanel.addChild(sb);
this.optionsPanel.options.scrollBar = sb;
this.optionsPanel.options.enabled = true;
this.optionsPanel.options.visible = true;
panel = new panelClass();
panel.visible = true;
panel.enabled = true;