forked from mikebaldi/Idle-Champions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple-6towns.ahk
1414 lines (1205 loc) · 33.7 KB
/
Simple-6towns.ahk
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
#SingleInstance force
#include %A_ScriptDir%\SharedFunctions\json.ahk
#include %A_ScriptDir%\ServerCalls\IC_ServerCalls_Class.ahk
#include %A_ScriptDir%\SharedFunctions\IC_SharedFunctions_Class.ahk
#include %A_ScriptDir%\SharedFunctions\IC_ArrayFunctions_Class.ahk
#include %A_ScriptDir%\SharedFunctions\IC_KeyHelper_Class.ahk
#include %A_ScriptDir%\SharedFunctions\IC_GUIFunctions_Class.ahk
#include %A_ScriptDir%\SharedFunctions\IC_UpdateClass_Class.ahk
global g_ServerCall
global g_UserSettings := {}
global g_SF := new IC_SharedFunctions_Class
g_UserSettings := g_SF.LoadObjectFromJSON( A_LineFile . "\..\Settings.json" )
Process, Exist, % "IdleDragons.exe"
g_SF.PID := ErrorLevel
Process, Priority, % g_SF.PID, High
g_SF.Memory.OpenProcessReader()
g_SF.CurrentAdventure := 31
g_SF.ResetServerCall()
g_ServerCall.UpdatePlayServer()
;Change of @Montrose Script by @CirusDane
;Simply here for newer players
; ------ READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ------ ;
; ;
; REQUIREMENTS ;
; -- Resolution Setting must be 1280x720 ;
; -- You must have a formation saved to the "Q" ;
; -- You must have the champions that you wish to be in your formation, in their appropriatte places in the "Q" formation ;
; -- You must have at least two familiars saved in your "Q" formation --> One on click damage and one on the field clicking ;
; -- You must not have a familiar levelling a champion. If you do, their special dialog will pop and the script will fail ;
; -- You should not place a familiar on ultimates, as champions will not be levelled to the point that they have ultimates ;
; ;
; ------ READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ----- READ THIS SECTION ------ ;
;-----------------------------------------------------------------------------------------------------------------------------------;
; Mad Wizard Gem Farming Script ;
; This script is designed to farm gems through low level areas, then reset and start over again ;
; This script is based on a fantastic script by Bootch, thanks Bootch! ;
; The original script was written by Hikibla, thanks Hikibla! ;
;-----------------------------------------------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------------------------------------------;
; Known issues - Known problems with the script ;
; Having the title bar turned off will create a shift in the Y values and script won't be able find several Locations. ;
; Pausing the script while on a boss level may confuse the level counter. The script may still work but will run an extra level. ;
; The script may not work if you are running game in full screen mode ;
; Updates from CNE occassionally break the script ;
;-----------------------------------------------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------------------------------------------;
; Hotkeys - Controls for the script ;
; ` : Pause the script ;
; F1 : Toggle the tooltip with the hotkey Info ;
; F2 : Start the script to farm Mad Wizard ;
; F5 : Nothing to see here (Reserved for debugging) ;
; F9 : Reload the script ;
; F10 : Exit the script ;
; Up : Increase the Target Level by 10 ;
; DOWN : Decrease the Target Level by 10 ;
; Q/W/E : Temporarily use the Q/W/E formation until the next script reload ;
;-----------------------------------------------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------------------------------------------;
; User Settings - Settings to allow the user to customize how the script behaves ;
;-----------------------------------------------------------------------------------------------------------------------------------;
; This variable controls the maximum level that the script will run to. You should lower this if your champions cannot complete to level 30
global nMax_Level := 210 ;sets the level that the script will run to for each iteration
; These variables control the mouse behavior. You can set whether or not you want to continually click and/or sweep the mouse
global gEnableAutoClick := 1 ;script will auto-click 10x for 100ms (upto 60 clicks/second)
global gEnableMouseSweep := 0 ;script will sweep to collect gold/items
; These variables control the formation to use during your gem farming. Don't change these unless you are confident you know what you're doing
global gFormation_NP := "Q" ;Values: Q/W/E sets which formation to use when No Patron is Active (if changing use capital letters)
global gFormation_M := "Q" ;Values: Q/W/E sets which formation to use when Mirt is Active Patron (if changing use capital letters)
global gFormation_V := "Q" ;Values: Q/W/E sets which formation to use when Vajra is Active Active (if changing use capital letters)
;-----------------------------------------------------------------------------------------------------------------------------------;
; Script Settings - DO NOT MODIFY THESE UNLESS YOU KNOW WHAT YOU ARE DOING OR THE SCRIPT MAY (will) BREAK ;
;-----------------------------------------------------------------------------------------------------------------------------------;
; Seriously though. Don't mess with these unless you are confident.
;design window sizes
global gWindowWidth_Default := 1296
global gWindowHeight_Default := 759
;campaign buttons/locations
global worldmap_favor_x := 1250 ; pixel in favor box (top right of world map screen)
global worldmap_favor_y := 115
global worldmap_favor_c1 := 0x292729 ;dark brown/gray
global worldmap_favor_c2 := 0x282827 ;second color added to correct for possible error when last campaign was an Event
global swordcoast_x := 70 ; horizontal location of the tomb button
global swordcoast_y := 185 ; vertical location of the tomb button
global toa_x := 70 ; horizontal location of the sword coast button
global toa_y := 185 ; vertical location of the sword coast button
;Sword Coast Town with Mad Wizard Adventure
global townsearch_L := 400
global townsearch_R := 1100
global townsearch_T := 135
global townsearch_B := 700
global townsearch_C := 0xB5AFA9
;Patron Detect
global patron_X := 1105
global patron_Y := 245
global patron_NP_C := 0x303030
global patron_M_C := 0xBB9E97
global patron_V_C := 0xA37051
; red pixel for the Close Button on the Adventure Select window
global select_win_x := 1043
global select_win_y := 56
global select_win_c1 := 0xAD0400
; pixel to check if list is scrolled to the top (if valid then list needs to scroll up)
global list_top_x := 550
global list_top_y := 115
global list_top_c1 := 0x0A0A0A
;searchbox for a pixel in the MadWizard FP Picture displayed in the Adventure Select List
global MW_Find_L := 255
global MW_Find_R := 475
global MW_Find_T := 65
global MW_Find_B := 670
global MW_Find_C := 0x728E57 ;pixel in Mad Wizard's Eye
global MW_Find_C2 := 0x7C9861 ;pixel in Mad Wizard's Eye (when hovered)
;searchbox to find Blue-ish pixel in the Mad Wizard Start Button
global MW_Start_L := 575
global MW_Start_R := 1025
global MW_Start_T := 550
global MW_Start_B := 700
global MW_Start_C := 0x477FC0 ; pixel in middle of the 'O' in Objective
;adventure window pixel (redish pixel in the Redish Flag behind the gold coin in the DPS/Gold InfoBox)
global adventure_dps_x := 70
global adventure_dps_y := 35
global adventure_dps_c1 := 0x91181B
global adventure_dps_c2 := 0x731316
;search box for 1st mob
global mob_area_L := 750
global mob_area_R := 1225
global mob_area_T := 225
global mob_area_B := 525
global mob_area_C := 0xFEFEFE
;variables for checking if a transition is occurring (center of screen and towards top)
global transition_y := 35
global transition_c1 := 0x0F0F0F
;Searchbox to find the Reset Button
global reset_complete_T := 475
global reset_complete_B := 600
global reset_complete_L := 500
global reset_complete_R := 625
global reset_complete_C := 0x479A26
global reset_complete_C2 := 0x4AA629
;Pixel location for the Skip Button (During Reset)
global reset_skip_x := 1148
global reset_skip_y := 664
global reset_skip_c1 := 0x55B52E
;Pixel location for the Continue Button (During Reset)
global reset_continue_x := 560
global reset_continue_y := 615
global reset_continue_c1 := 0x479D2C
;internal globals
global gFound_Error := 0
global gFormation := "-1"
global gLevel_Number := 0
global dtPrevRunTime := "00:00:00"
global dtLoopStartTime := "00:00:00"
global SpecTeam := 0
;-----------------------------------------------------------------------------------------------------------------------------------;
; The mechanics of the script begin below. ;
; DO NOT EDIT ANYTHING BELOW THIS COMMENT BOX UNLESS YOU ARE CONFIDENT YOU KNOW WHAT YOU ARE DOING!! ;
;-----------------------------------------------------------------------------------------------------------------------------------;
GetWindowSettings()
Adjust_YValues()
Init()
ShowHelpTip()
return
;HotKeys
{
#IfWinActive Idle Champions
F1:: ;Show Help
{
ShowHelpTip()
return
}
#IfWinActive Idle Champions
F2:: ; Start the gem farm
{
Loop_GemRuns()
return
}
#IfWinActive Idle Champions
F5:: ;testing hotkey -- Ignore this if you are not doing script development on this script! By default (and by design) this does nothing
{
test := g_SF.VerifyAdventureLoaded()
ToolTip, Val = %test%
return ; Whee! Wasn't that fun?
}
#IfWinActive Idle Champions
F9:: ;Reset/Reload Script
{
Reload
return
}
#IfWinActive Idle Champions
F10:: ; Quit the script
{
Send {Shift Up}
Send {Alt Up}
exitapp
}
#IfWinActive Idle Champions
~Q::
{
gFormation := "Q"
return
}
#IfWinActive Idle Champions
~W::
{
gFormation := "W"
return
}
#IfWinActive Idle Champions
~E::
{
gFormation := "E"
return
}
#IfWinActive Idle Champions
~Up:: ;+10 levels to Target Level
{
nMax_Level := nMax_Level + 10
ToolTip, % "Max Level: " nMax_Level, 25, 475, 2
SetTimer, ClearToolTip, -1000
UpdateToolTip()
return
}
#IfWinActive Idle Champions
~Down:: ;-10 levels to Target Level
{
nMax_Level := nMax_Level - 10
ToolTip, % "Max Level: " nMax_Level, 25, 475, 2
SetTimer, ClearToolTip, -1000
UpdateToolTip()
return
}
#IfWinActive Idle Champions
~`:: ;toggle Pause on/off
{
Pause, , 1
return
}
}
;ToolTips
{
UpdateToolTip()
{
dtNow := A_Now
dtCurrentRunTime := DateTimeDiff(dtLoopStartTime, dtNow)
sToolTip := "Prev Run: " dtPrevRunTime
sToolTip := sToolTip "`nCurrent Run: " dtCurrentRunTime
sToolTip := sToolTip "`nTarget Level: " nMax_Level
sToolTip := sToolTip "`nCurrent Level: " gLevel_Number
sToolTip := sToolTip "`nPatron: " (gCurrentPatron = "NP" ? "None" : (gCurrentPatron = "M" ? "Mirt" : (gCurrentPatron = "V" ? "Vajra" : "None")))
ToolTip, % sToolTip, 25, 475, 1
}
global gShowHelpTip := ""
ShowHelpTip()
{
gShowHelpTip := !gShowHelpTip
if (gShowHelpTip)
{
ToolTip, % "F1: Show Help`nF2: Start Gem Farm`nF9: Reload Script`nF10: Quit the script`nUP: +10 to Target Levels`nDOWN: -10 to Target Levels`n``: Pause Script", 25, 325, 3
SetTimer, ClearToolTip, -5000
}
else
{
ToolTip, , , ,3
}
}
; A common tooltip with up to 5 lines
; limits the tooltip to last 5 messages in event script is spamming messages
global gToolTip := ""
ShowToolTip(sText := "")
{
if (!sText)
{
gToolTip := ""
}
dataitems := StrSplit(gToolTip, "`n")
nCount := dataitems.Count()
gToolTip := ""
nMaxLineCount := 5
nStartIndex := 0
if (nCount >= nMaxLineCount)
{
nStartIndex := nCount - nMaxLineCount + 1
}
for k,v in dataitems
{
if (A_Index > nStartIndex)
{
if (gToolTip)
{
gToolTip := gToolTip "`n"
}
gToolTip := gToolTip v
}
}
if (gToolTip)
{
gToolTip := gToolTip "`n" sText
}
else
{
gToolTip := sText
}
ToolTip, % gToolTip, 50, 150, 5
return
}
ClearToolTip:
{
ToolTip, , , ,2
ToolTip, , , ,3
gToolTip := ""
gShowHelpTip := 0
gShowStatTip := 0
return
}
}
global gWindowSettings := ""
GetWindowSettings()
{
if (!gWindowSettings)
{
if WinExist("Idle Champions")
{
WinActivate
WinGetPos, outWinX, outWinY, outWidth, outHeight, Idle Champions
gWindowSettings := []
gWindowSettings.X := outWinX
gWindowSettings.Y := outWinY
gWindowSettings.Width := (outWidth - 1)
gWindowSettings.Height := (outHeight - 1)
gWindowSettings.HeightAdjust := (outHeight - gWindowHeight_Default)
}
else
{
MsgBox Idle Champions not running
return
}
}
return gWindowSettings
}
;Init Globals/Settings
{
Adjust_YValues()
{
worldmap_favor_y := worldmap_favor_y + gWindowSettings.HeightAdjust
swordcoast_y := swordcoast_y + gWindowSettings.HeightAdjust
toa_y := toa_y + gWindowSettings.HeightAdjust
select_win_y := select_win_y + gWindowSettings.HeightAdjust
list_top_y := list_top_y + gWindowSettings.HeightAdjust
adventure_dps_y := adventure_dps_y + gWindowSettings.HeightAdjust
transition_y := transition_y + gWindowSettings.HeightAdjust
reset_continue_y := reset_continue_y + gWindowSettings.HeightAdjust
patron_Y := patron_Y + gWindowSettings.HeightAdjust
}
global oPixReset_Complete := "" ;pixel search box to find green Complete Button (1st window on reset)
global oPixReset_Skip := "" ;pixel object to find green Continue Button (2nd window on reset)
global oPixReset_Continue := "" ;pixel object to find green Continue Button (2nd window on reset)
Init()
{
gFound_Error := 0
oPixReset_Complete := {}
oPixReset_Complete.StartX := reset_complete_L
oPixReset_Complete.EndX := reset_complete_R
oPixReset_Complete.StartY := reset_complete_T
oPixReset_Complete.EndY := reset_complete_B
oPixReset_Complete.Color_1 := reset_complete_C
oPixReset_Complete.Color_2 := reset_complete_C2
oPixReset_Skip := {}
oPixReset_Skip.X := reset_skip_x
oPixReset_Skip.Y := reset_skip_y
oPixReset_Skip.Color_1 := reset_skip_c1
oPixReset_Continue := {}
oPixReset_Continue.X := reset_continue_x
oPixReset_Continue.Y := reset_continue_y
oPixReset_Continue.Color_1 := reset_continue_c1
}
}
;Main Loop
Loop_GemRuns()
{
; Check to see if there is already an adventure running. If so, this will force a reset
;bAdventureWindowFound := AdventureWindow_Check(1)
;if (bAdventureWindowFound)
;{
; ResetAdventure()
;}
while (1 == 1)
{
dtStart := A_Now
dtLoopStartTime := A_Now
dtPrevRunTime := DateTimeDiff(dtPrev, dtStart)
UpdateToolTip()
dtPrev := dtStart
;bAdventureSelected := SelectAdventure()
;if (bAdventureSelected)
;{
;
;}
RunAdventure()
ResetAdventure()
;bAdventureWindowFound := AdventureWindow_Check(1)
;if (bAdventureWindowFound)
;{
; ResetAdventure()
;}
}
}
;Start a Run
{
SelectAdventure()
{
bAdventureWindowFound := AdventureWindow_Check(1)
if (bAdventureWindowFound)
return 0
; Ensure we are on the world map before trying find/click buttons
if (!WorldMapWindow_Check())
return 0
; Zooms out campaign map
CenterMouse()
Loop 15
{
MouseClick, WheelDown
Sleep 5
}
Sleep 100
;get Current Patron
FindPatron()
Sleep, 100
; Campaign switching to force world map resets/positions
; Select Tomb of Annihilation
Click %toa_x%, %toa_y%
Sleep 100
; Select A Grand Tour
Click %swordcoast_x%, %swordcoast_y%
Sleep 500
if (!FindTown(town_x, town_y))
{
MsgBox, ERROR: Failed to find the Town
return 0
}
MouseClick, L, town_x, town_y
Sleep 250
if (!StartAdventure(townX, townY))
return 0
return 1
}
global oCornerPixel := ""
WorldMapWindow_Check()
{
if (!oCornerPixel)
{
oCornerPixel := {}
oCornerPixel.X := worldmap_favor_x
oCornerPixel.Y := worldmap_favor_y
oCornerPixel.Color_1 := worldmap_favor_c1
oCornerPixel.Color_2 := worldmap_favor_c2
}
; Wait for up to 5 second with 4 checks per second for the pixel to show
if (!WaitForPixel(oCornerPixel, 5000))
{
return 0
}
return 1
}
global gCurrentPatron := ""
FindPatron()
{
oPatron_NP := {}
oPatron_NP.X := patron_X
oPatron_NP.Y := patron_Y
oPatron_NP.Color_1 := patron_NP_C
oPatron_M := {}
oPatron_M.X := patron_X
oPatron_M.Y := patron_Y
oPatron_M.Color_1 := patron_M_C
oPatron_V := {}
oPatron_V.X := patron_X
oPatron_V.Y := patron_Y
oPatron_V.Color_1 := patron_V_C
gCurrentPatron := "NP"
if (CheckPixel(oPatron_M))
{
gCurrentPatron := "M"
gFormation := gFormation_M
return
}
if (CheckPixel(oPatron_V))
{
gCurrentPatron := "V"
gFormation := gFormation_V
return
}
if (gFormation = -1)
{
gFormation := gFormation_%gCurrentPatron%
}
return
}
global oTown := ""
FindTown(ByRef townX, ByRef townY)
{
if(!oTown)
{
oTown := {}
oTown.StartX := townsearch_L
oTown.EndX := townsearch_R
oTown.StartY := townsearch_T
oTown.EndY := townsearch_B
oTown.Color_1 := townsearch_C
oTown.HasFound := -1
oTown.FoundX := ""
oTown.FoundY := ""
}
if (oTown.HasFound = 1)
{
townX := oTown.FoundX
townY := oTown.FoundY
return 1
}
oTown.StartY := townsearch_T
nTownCount := 0
bFound := 1
bFoundTown := 0
while (bFound = 1)
{
bFound := FindPixel(oTown, found%A_Index%_X, found%A_Index%_Y)
if (bFound = 1)
{
nTownCount := nTownCount + 1
oTown.StartY := found%A_Index%_Y + 25
bFoundTown := 1
}
sleep, 50
}
if (nTownCount = 6)
{
townX := found5_X
townY := found5_Y
}
if (nTownCount = 5)
{
townX := found4_X
townY := found4_Y
}
else if (nTownCount = 4)
{
townX := found3_X
townY := found3_Y
}
; NOTE: for current map this should not occur and handled by (nTownCount = 2)
else if (nTownCount = 3)
{
townX := found3_X
townY := found3_Y
}
else if (nTownCount = 2)
{
; An arbitrary position between the location of Town2 for Newer Players
; for brand new players -> Town1 is Tutorial and Town2 is MadWizard
; when WaterDeep unlocks -> Town1 is MadWizard and Town2 is WaterDeep (tutorial is off top of map)
nX := 600
;2 Towns Total - Tutorial + MadWizard
if (found2_X < nX)
{
townX := found2_X
townY := found2_Y
}
; 3 Towns Total - Tutorial + MadWizard + WaterDeep
; Tutorial Town off/at edge top of screen
else
{
townX := found1_X
townY := found1_Y
}
}
else if (nTownCount = 1) ;MadWizard not available yet
{
bFoundTown := 0
MsgBox, Error: It appears that you haven't completed the tutorial yet.
}
if (bFoundTown = 1)
{
oTown.HasFound := 1
townY := townY + 10 ;move the Y locations slightly lower
oTown.FoundX := townX
oTown.FoundY := townY
return 1
}
return 0
}
global oSelect_WinChecker := ""
global oListScroll_Checker := ""
global oAdventureSelect := ""
global oAdventureStart := ""
StartAdventure(townX, townY)
{
; Ensure the adventure select window is open
if (!oSelect_WinChecker)
{
oSelect_WinChecker := {}
oSelect_WinChecker.X := select_win_x
oSelect_WinChecker.Y := select_win_y
oSelect_WinChecker.Color_1 := select_win_c1
}
; Check 10 times in 5s intervals for the adventure select window
; Server lag can cause issues between clicking the town and selector window displaying
ctr := 0
while (!bFound and ctr < 10)
{
; Open the adventure select window
Click %town_x%, %town_y% ; Click the town button for mad wizard adventure
Sleep 100
; Wait for 10 seconds for the selector window to show
if (WaitForPixel(oSelect_WinChecker, 5000))
bFound := 1
ctr := ctr + 1
}
ctr := 0
if (!bFound)
{
return 0
}
; Ensure the adventure select window is scrolled to top
if (!oListScroll_Checker)
{
oListScroll_Checker := {}
oListScroll_Checker.X := list_top_x
oListScroll_Checker.Y := list_top_y
oListScroll_Checker.Color_1 := list_top_c1
}
; Select mad wizard
if (!oAdventureSelect)
{
oAdventureSelect := {}
oAdventureSelect.StartX := MW_Find_L
oAdventureSelect.EndX := MW_Find_R
oAdventureSelect.StartY := MW_Find_T
oAdventureSelect.EndY := MW_Find_B
oAdventureSelect.Color_1 := MW_Find_C
oAdventureSelect.HasFound := -1
oAdventureSelect.FoundX := ""
oAdventureSelect.FoundY := ""
}
nX := ((MW_Find_L + MW_Find_R) / 2)
nY := ((MW_Find_T + MW_Find_B) / 2)
MouseMove, %nX%, %nY%
bIsNotAtTop := CheckPixel(oListScroll_Checker)
while (bIsNotAtTop)
{
MouseClick, WheelUp
bIsNotAtTop := CheckPixel(oListScroll_Checker)
if (bIsNotAtTop)
sleep, 50
}
if (oAdventureSelect.HasFound = 1)
{
foundX := oAdventureSelect.FoundX
foundY := oAdventureSelect.FoundY
MouseClick, Left, %foundX%,%foundY%
sleep, 500
}
else
{
CenterMouse()
sleep, 250
if (FindPixel(oAdventureSelect, foundX, foundY))
{
oAdventureSelect.HasFound := 1
oAdventureSelect.FoundX := foundX
oAdventureSelect.FoundY := foundY
MouseClick, Left, %foundX%,%foundY%
sleep, 500
}
else
{
MsgBox, Error Failed to find Mad Wizard in the Select List
return 0
}
}
if (!oAdventureStart)
{
oAdventureStart := {}
oAdventureStart.StartX := MW_Start_L
oAdventureStart.EndX := MW_Start_R
oAdventureStart.StartY := MW_Start_T
oAdventureStart.EndY := MW_Start_B
oAdventureStart.Color_1 := MW_Start_C
oAdventureStart.HasFound := -1
oAdventureStart.FoundX := ""
oAdventureStart.FoundY := ""
}
if (oAdventureStart.HasFound = 1)
{
foundX := oAdventureStart.FoundX
foundY := oAdventureStart.FoundY
MouseClick, L, foundX, foundY
return 1
}
else
{
if (FindPixel(oAdventureStart, foundX, foundY))
{
oAdventureStart.HasFound := 1
oAdventureStart.FoundX := foundX
oAdventureStart.FoundY := foundY
MouseClick, L, foundX, foundY
return 1
}
else
{
return 0
}
}
return 0
}
}
; Handle Start/Transition/Reset
{
RunAdventure()
{
; Allow up to 30 seconds to find the Adventure Window as server/game lag can cause varying time delays
;bAdventureWindowFound := AdventureWindow_Check(30000)
;if (!bAdventureWindowFound)
; return 0
; Wait for 1st mob to enter screen. Will wait up to 1min before failing
;if (FindFirstMob())
;{
; sleep, 100
; Send, %gFormation%
; sleep, 100
; Send, %gFormation% ; Send twice, just in case.
;}
;else
;{
; return 0
;}
bContinueRun := 1
gLevel_Number := g_SF.Memory.ReadCurrentZone()
UpdateToolTip()
SpecTeam := 1
while (bContinueRun)
{
gLevel_Number := g_SF.Memory.ReadCurrentZone()
bRunComplete := DoLevel(gLevel_Number)
UpdateToolTip()
if (gLevel_Number > nMax_Level)
{
bContinueRun := 0
}
}
}
global oAdventureWindowCheck := 0
; Allow up to 5 seconds to find the adventure window
AdventureWindow_Check(wait_time := 5000)
{
return 1
; Redish pixel in the Gold/Dps InfoBox while an adventure is running
if (!oAdventureWindowCheck)
{
oAdventureWindowCheck := {}
oAdventureWindowCheck.X := adventure_dps_x
oAdventureWindowCheck.Y := adventure_dps_y
oAdventureWindowCheck.Color_1 := adventure_dps_c1
oAdventureWindowCheck.Color_2 := adventure_dps_c2
}
; Wait for up to 5 second with 4 checks per second for the pixel to show
if (!WaitForPixel(oAdventureWindowCheck, wait_time))
{
return 0
}
return 1
}
global oMobName := ""
FindFirstMob()
{
if (!gMobName)
{
oMobName := {}
oMobName.StartX := mob_area_L
oMobName.EndX := mob_area_R
oMobName.StartY := mob_area_T
oMobName.EndY := mob_area_B
oMobName.Color_1 := mob_area_C
}
bFound := 0
bFound := WaitForFindPixel(oMobName, outX, outY)
return bFound
}
DoLevel(nLevel_Number)
{
; Wait until level 4 to buy champs to allow more gold to accumulate. This helps low-favor players.
if (1 = 2)
{
; Buy all the champs at level one. Or try to anyway. Skip f12 because that can conflict with screenshots
sleep, 2000
MouseClick, L, 770, 605
sleep, 500
MouseClick, L, 890, 605
sleep, 500
MouseClick, L, 390, 605
sleep, 500
MouseClick, L, 640, 605
sleep, 500
MouseClick, L, 640, 605
sleep, 500
MouseClick, L, 390, 605
sleep, 500
MouseClick, L, 770, 605
sleep, 500
MouseClick, L, 770, 605
sleep, 500
}
; Get the wave number and mod it to be 1 through 5
nWaveNumber := Mod(nLevel_Number, 5)
bContinueWave := 1
while (bContinueWave)
{
IfWinActive, Idle Champions
{
Send, {Right}
sleep, 100
Send, Q
sleep, 500
if (g_SF.Memory.ReadChampLvlByID(47) < 230)
{
Send {F6}
sleep, 1000
if (g_SF.Memory.ReadChampLvlByID(47) >= 230)
{
MouseClick, L, 390, 640
sleep, 1000
}
continue
}
if (g_SF.Memory.ReadChampLvlByID(75) < 240)
{
Send {F8}
sleep, 1000
if (g_SF.Memory.ReadChampLvlByID(75) >= 240)
{
MouseClick, L, 770, 640
sleep, 1000
}
continue
}
if (g_SF.Memory.ReadChampLvlByID(52) < 225)
{
Send {F4}
sleep, 1000
if (g_SF.Memory.ReadChampLvlByID(52) >= 225)
{
MouseClick, L, 640, 640
sleep, 1000