-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokeBorg.cmd
More file actions
1298 lines (1132 loc) · 40.6 KB
/
PokeBorg.cmd
File metadata and controls
1298 lines (1132 loc) · 40.6 KB
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
@ECHO off
@setlocal enableextensions enabledelayedexpansion
%~d0
cd %~dp0
Title = PokeBorg Advanced Automation NinjaBotter
:: =========================================
:: Name : PokeBorg.cmd
:: Purpose : Primary controller of Ninja bots
:: Location : InstallHome\PokeBorg.cmd
:: Author: Lou Langelier
:: Email: dilborg@hotmail.com
:: https://github.com/dilborg/AdvancedAutomationScripts
:: =========================================
:: -- Version History --
:: Revision:01.100-beta May 12 2017 - initial version 100 bot manager
:: 02.101-beta Jun 01 2017 - added support for CSV Import
SET version=02.102-beta&REM Jun 03 2017 - installation and configurations support
:passedVars
REM -- Determine assigned variables
SET "debug=%1"
IF NOT DEFINED debug SET debug=0
:initVars
REM -- Initialize local variables
SET "situation=%~n0"
:debugMode
:: Local debug dependent on global debug and parameters
SET "_debug=0"
:: SET _debug here 0-no 1-yes 2-log
IF %debug% EQU 1 ( CHOICE /C YN /M "Enable %situation% debug?" )
IF %ERRORLEVEL% EQU 1 SET "_debug=%debug%"
IF %_debug% EQU 1 ( ECHO: Debug mode activated - debug: %debug% _debug: %_debug% para1: %1 )
IF %_debug% EQU 1 ( CHOICE /C YN /M "Turn ECHO on?" )
IF %ERRORLEVEL% EQU 1 ECHO ON
:checkSettings
REM -- TEST for PB LOG directory detect First Run
IF NOT EXIST "PBN-LOGS" GOTO NOPOKEBORG
REM TODO add a test for Configuration such as Pokeborg.ini
REM -- TEST for PB directory and settings
IF NOT EXIST "PokeBorg\PokeBorg-settings.cmd" GOTO NEWPOKEBORG
:initSettings
REM -- Initialize the persistent variables from the storage
CALL "PokeBorg\PokeBorg-settings.cmd"
:initMain
mode con: cols=%cols% lines=%lines%
COLOR %colour%
IF %_debug%==0 GOTO startBatch
:logbatch
(ECHO:
ECHO: DATE : %DATE%, %TIME%
ECHO: Current CMD : %situation%
ECHO: Current func : logBatch
)>> "%log%"
GOTO startBatch
:startBatch
IF %_debug%==1 CALL :T1 >> %log% 2>&1
IF %_debug%==1 CALL :TSTART >> %log% 2>&1
REM -- TEST if Borg is created and ask to create if needed
IF NOT EXIST %borgDir% GOTO NOBORG
REM -- Test for Mode 1-10 2-100 3-1000
IF botMode==1 DO (
CALL :STBORG 0
GOTO PBN
REM if botMode==2 SET Borg0 matrix 0 GOTO Matrix
REM if botMode==3 SET Borg0 GOTO Borg
REM if botMode==0 GOTO what
:PBN
REM -- Main Menu Display
IF %_debug%==1 ECHO: --Current func : PBN >> %log%
Title = PokeBorg %myMatrix% Command Console
CLS
color %colour%
ECHO:
ECHO: Working Dir: %matrixDir%
ECHO: +============== PokeBorg Advanced Automation NinjaBotter ==============+
ECHO: +-------------------------- COMMAND CONSOLE ---------------------------+
ECHO: : %fstOrder%-%borg% Loaded%TAB%%TAB%%TAB%%COL%
ECHO: : %myMatrix% ready to receive commands %TAB%%COL%
ECHO: +----------------------------------------------------------------------+
REM ECHO: :1%TAB%2%TAB%3%TAB%4%TAB%5%TAB%6%TAB%7%TAB%8%TAB%%COL%
REM ECHO: 1234567:9112345:7892123:5678931:3456789:1234567:9512345:7896123:5678901:3456
REM ECHO: : %TAB%Option 1 %COL% Option 2 %COL% Option 3 %COL% Option 4%COL%
ECHO: : %TAB%R - Initiate %myMatrix% %trdOrder% in Regular Farm Mode %TAB%%COL%
ECHO: : %TAB%G - Initiate %myMatrix% %trdOrder% to do Gym Battle %TAB%%TAB%%COL%
ECHO: : %TAB%S - Initiate %myMatrix% %trdOrder% for Sniper Mode %TAB%%TAB%%COL%
ECHO: : %TAB%O - Open Windows Explorer to this %sndOrder% %TAB%%TAB%%COL%
ECHO: : %TAB%J - JSON functions submenu (import, extract, merge)%TAB%%COL%
ECHO: +----------------------------------------------------------------------+
ECHO: : %TAB%C - Load/Create other %myOrder% %TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%B - Load/Create other %fstOrder% %TAB%%TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%M - Load/Create other %sndOrder% %TAB%%TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%D - Single %trdOrder% operations %TAB%%TAB%%TAB%%TAB%%COL%
ECHO: +----------------------------------------------------------------------+
ECHO: : %TAB%P - Edit PokeBorg Settings %TAB%%TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%X - Exit %TAB%%TAB%%TAB%%TAB%%TAB%%TAB%%COL%
ECHO: +========================== PRESS X TO EXIT ===========================+
CHOICE /C RGSOJCBMDPX /M " Enter your selection:"
SET C=%ERRORLEVEL%
IF %_debug%==1 ECHO:db CC Selection: %C% >> %log%
IF %C% == 11 EXIT
IF %C% == 10 GOTO mySettings
IF %C% == 9 GOTO DRONE
IF %C% == 8 GOTO MATRIX
IF %C% == 7 GOTO BORG
IF %C% == 6 GOTO COLL
IF %C% == 5 GOTO jsMenu
IF %C% == 4 GOTO D1
IF %C% == 3 GOTO launchSNIPER
IF %C% == 2 GOTO launchGYM
IF %C% == 1 GOTO launchFARM
EXIT
:D1
REM -- Open Directory to Matrix
IF %_debug%==1 ECHO: --Current func : D1 >> %log%
REM Open directory at location of matrix
start %matrixDir%
GOTO PBN
:A1
REM -- Previous Matrix Drone Launcher
IF %_debug%==1 ECHO: --Current func : A1 >> %log%
Title = PokeBorg %myMatrix% Command Console
cls
Title = PokeBorg %myMatrix% Bot Initiation
:A1A
if not exist %matrixDir% GOTO NOMATRIX
cd %matrixDir%
ECHO Please wait until all %trdOrder% of %myMatrix% are initiated ...
REM if not exist %droneDir% GOTO NOBORG
REM
REM if not exist ninja.json GOTO NEWDRONE
SET unitMode=1
FOR /L %%A IN (0,1,9) DO (
ECHO Running %trdOrder%%order%%borg%%matrix%%%A
START cmd /c %pbDir%\PokeBorgUnit.cmd %order% %borg% %matrix% %%A %unitMode%
TIMEOUT /T %myDelay%
)
cd %myPogoDir%
ECHO ......................................
ECHO . All %myMatrix% %trdOrder% are running!
GOTO A2
:A2
REM Decision model based on FullAuto settings
SET /a nMatrix=%iMatrix%+10
REM Test end at 99, if end auto
IF %nMatrix%==100 GOTO SE1
REM TESTING
REM ECHO Botmode %botMode%
REM Full auto decide Next or ask . . . A3 or A4
IF %botMode%==0 GOTO SE1
IF %botMode%==1 GOTO A3
IF %botMode%==2 GOTO A4
:A3
REM Sub end test for 10 botters
IF %nMatrix%==100 GOTO SE1
ECHO . Do you want to Run the next %sndOrder%?
ECHO ......................................
ECHO:
ECHO: Y - Yes, run next %sndOrder%
ECHO: N - No, go back to %myMatrix% menu.
ECHO:
choice /C YN /M "Close this window to quit:"
IF %ERRORLEVEL%==1 GOTO A4
IF %ERRORLEVEL%==2 GOTO PBN
EXIT
:A4
ECHO ......................................
SET /a iMatrix=%nMatrix%
SET /a matrix=%matrix%+1
SET myMatrix=%sndOrder%-%borg%%matrix%
SET matrixDir=%borgDir%\%myMatrix%
GOTO A1
:B1
REM -- Copy the JSON files from PokeBorg\JSON to each Drone Dir -- obsolete
IF %_debug%==1 ECHO: --Current func : B1 >> %log%
Title = PokeBorg %myMatrix% JSON Update
CLS
REM TODO rename this to JSON reset . . . like new JSON import
if not exist %matrixDir% GOTO NOMATRIX
For /f "tokens=1-2 delims=/:" %%a in ("%TIME: =0%") do (SET myTime=%%a%%b)
SET backupFilename=ninja-%DATE%_%myTime%.json
ECHO:
ECHO: Making a backup of your Ninja JSONs!
ECHO:
for /d %%a in (%matrixDir%\*) do (
IF EXIST %%a\ninja.json (
copy %%a\ninja.json %%a\%backupFilename% >> nul
)
)
ECHO: JSON Backup completed.
ECHO:
ECHO: About to copy JSON files from JSON Source:
ECHO: %jsnDir%
ECHO: To each %trdOrder% directory in:
ECHO: %matrixDir%
ECHO:
for /d %%a in (%matrixDir%\*) do (
xcopy /y %jsnDir%*.* %%a\ >>nul
ECHO: Successfully copied JSONs to %%a
)
ECHO:
ECHO: Finished updating %myMatrix% Ninja JSON files
ECHO:
ECHO: Press any key to return to %myMatrix% options . . .
PAUSE
GOTO PBN
:C1
REM -- Copy the JAR files from PokeBorg\JAR to each Drone Dir -- obsolete
IF %_debug%==1 ECHO: --Current func : C! >> %log%
Title = PokeBorg %myMatrix% Ninja Update
CLS
if not exist %matrixDir% GOTO NOMATRIX
ECHO .....................................................
ECHO . %sndOrder% Loaded : %myMatrix%
ECHO . Are you certain you want to update Ninja Files?
ECHO .....................................................
ECHO:
ECHO Y - Yes
ECHO N - No
ECHO:
choice /C YN /M "Enter Y to Continue or N to go back to the main menu:"
IF %M%==Y GOTO C2
IF %M%==N GOTO PBN
:C2
ECHO:
ECHO: Copying Ninja.Bot files from %jarDir% to each %trdOrder%
ECHO:
for /d %%a in (%matrixDir%\*) do (
ECHO: Successfully copied JAR files to %%a
xcopy /y %jarDir%*.* %%a\ >>nul
)
ECHO:
ECHO: Finished updating %myMatrix% Ninja.Bot files
ECHO:
ECHO Press any key to return to %myMatrix% options . . .
PAUSE
GOTO PBN
:IMPORT FROM CSV FUNCTION
:IMPORT
REM -- IMPORT CSV username/pass in a PBN3 file to each Drone Dir
IF %_debug%==1 ECHO: --Current func : IMPORT >> %log%
TITLE = PokeBorg CSV Import Function
CLS
ECHO:
ECHO Beginning CSV Import
ECHO:
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=activity_00
REM Coordinates JSON File
SET coords=elpaso
REM Target JSON
REM SET targetJSON=%myDrone%%activity%.json
SET targetJSON=ninja.json
REM eventually want to autodetect the drone count start
IF %_debug%==1 ECHO:db iDrone : %iDrone% (s/b 0) >> %log%
IF %_debug%==1 ECHO:db iMatrix: %iMatrix% (s/b X0) >> %log%
IF %debug%==2 PAUSE
REM Post Launch: unitMode set to Normal
SET unitMode=1
REM Create PBN3 and copy to directories
SET importFile=%ptcDir%\%order%%borg%%matrix%%drone%.CSV
REM SET dronePBN3=droneDir\PBN3myDrone.json - is set againg later
SET newPBN3=%jsnDir%\PBN3droneXXX.json
IF %_debug%==1 ECHO:db importFile: %importFile% >> %log%
IF %_debug%==1 CALL :TLOCAL >> %log%
REM Go through each line in the import file
FOR /F "tokens=1-2* delims=:" %%A IN (%importFile%) DO (
Set user=%%A
Set pass=%%B
CALL :IMPORTREPL
)
ECHO:
ECHO: Completed CSV Read
ECHO: Created Account JSON file for each %trdOrder%
ECHO: Proceeding to build the full ninja. json
ECHO:
PAUSE
REM eventually want to autodetect the drone count start
REM - Reset the drone count and Merge PBN1,2,3,4,5
SET iDrone=0
SET drone=0
SET myDrone=%trdOrder%-%borg%%matrix%%drone%
SET droneDir=%matrixDir%\%myDrone%
IF %_debug%==1 ECHO:db iDrone : %iDrone% >> %log%
REM CALL JSON FUNCTION
CALL :NewJSON
ECHO End of Import Function: Returning to Command Console
PAUSE
GOTO PBN
:IMPORTREPL
IF %_debug%==1 ECHO: -- Start of IMPORTREPL process >> %log%
REM Begin the replace process for individual drone
SET drone=%iDrone%
SET myDrone=%trdOrder%-%borg%%matrix%%drone%
SET droneDir=%matrixDir%\%myDrone%
IF %_debug%==1 ECHO: && ECHO:db drone: %drone% >> %log%
IF %_debug%==1 ECHO:db myDrone: %myDrone% >> %log%
IF %_debug%==1 ECHO:db matrixDir: %matrixDir% >> %log%
IF %_debug%==1 ECHO:db iDrone: %iDrone% >> %log%
REM Display the extracted data about to be used
ECHO:
ECHO Processing Account: %iDrone%
ECHO username: "%user%"
ECHO password: "%pass%"
FOR /F %%a IN ('POWERSHELL -COMMAND "$([guid]::NewGuid().ToString())"') DO ( SET NEWGUID=%%a )
REM The JSON file to be created
SET dronePBN3=%droneDir%\PBN3%myDrone%.json
SET dronePBNa=%droneDir%\PBN3%myDrone%a.json
SET dronePBNb=%droneDir%\PBN3%myDrone%b.json
REM Create new GUID
set NEWGUID=%NEWGUID:-=%
ECHO New GUID: %NEWGUID%
IF %_debug%==1 ECHO:db New GUID: %NEWGUID% - username: "%user%" - password: "%pass%" >> %log%
REM - > CALL jsonREPL %search% %replace% /M /F %source% /O %target%
IF %_debug%==1 ECHO:db newPBN3 : %newPBN3% >> %log%
IF %_debug%==1 ECHO:db dronePBN3: %dronePBN3% >> %log%
IF %_debug%==1 ECHO:db dronePBN3a: %dronePBN3a% >> %log%
IF %_debug%==1 ECHO:db dronePBN3b: %dronePBN3b% >> %log%
IF %debug%==2 PAUSE
CALL jrepl.bat "\bPTCNAME\b" %%user%% /F %%newPBN3%% /O %%dronePBNa%%
CALL jrepl.bat "\PTCPASS\b" %%pass%% /F %%dronePBNa%% /O %%dronePBNb%%
CALL jrepl.bat "\GUID\b" %%NEWGUID%% /F %%dronePBNb%% /O %%dronePBN3%%
DEL %dronePBNa%
DEL %dronePBNb%
SET /a iDrone+=1
IF %_debug%==1 ECHO:db iDrone : %iDrone% >> %log%
GOTO :EOF
: DRONE UNIT LAUNCHER FUNCTIONS
:PRELAUNCH
ECHO:db Begin PRELAUNCH process >> %log%
REM Target JSONs
SET activityJSON=PBN4%activity%.json
SET locationJSON=PBN5%coords%.json
REM TODO TEST existance of TargetJSONs
REM This is a redundant test, but could ask here to create JSON
REM IF NOT EXIST %jsnDir%\%activityJSON% GOTO NOJSON
REM IF NOT EXIST %jsnDir%\%coordsJSON% GOTO NOJSON
ECHO:
ECHO: PROCESS: PRE-LAUNCH
ECHO:
ECHO: About to Run %myMatrix% %trdOrder%s using:
ECHO:
ECHO: - Activity: %activity%
ECHO: - JSON : %targetJSON%
ECHO: - UnitMode: %unitMode%
ECHO:
CALL :TLOCAL >> %log%
IF %_debug%==1 ECHO:db PRESS ANY KEY to confirm these settings . . .
IF %_debug%==1 PAUSE > NUL
ECHO:
ECHO: Please wait while drones are loaded . . .
GOTO :EOF
:PokeUnit
REM Test Bot launcher
REM add /MIN
REM add echo to a file .
ECHO:db ECHO Starting bot %trdOrder%%order%%borg%%matrix%%drone% >> %log%
IF %_debug%==1 START cmd /k %pbDir%\PokeBorgUnit.cmd %order% %borg% %matrix% %drone% %unitMode% %activity% %lat% %lng%
IF %_debug%==0 START /min cmd /c %pbDir%\PokeBorgUnit.cmd %order% %borg% %matrix% %drone% %unitMode% %activity% %lat% %lng%
GOTO :eof
:Poke10Unit
ECHO: && ECHO: Starting %myMatrix% && ECHO:
set /a delay=%myDelay%*10
FOR /L %%A IN (0,1,9) DO (
SET drone=%%A
IF %_debug%==1 CALL :TSTEP
CALL :PokeUnit
ECHO | set /p=: Processing %trdOrder% : %order%-%borg%-%matrix%-%%A please wait . . .
TIMEOUT /T %delay% > nul
ECHO | set /p=Next!
ECHO:
)
REM - TODO ask to cascade windows
GOTO :eof
:LAUNCHFARM
ECHO:db Begin Farm process - ninja activity selected >> %log%
IF %debug%==2 PAUSE
REM Initiate Launch Variables for Farm
SET unitMode=1
SET activity=ninja
REM Target JSONs
SET targetJSON=%activity%.json
CALL :PRELAUNCH
CALL :Poke10Unit
ECHO: && ECHO Completed loading Drones
REM go back to menu or run next matrix
PAUSE
GOTO rerun
EXIT
:LAUNCHGYM
ECHO:db Begin GYM process - gymstrat activity selected >> %log%
IF %debug%==2 PAUSE
REM Initiate Launch Variables for GYM
SET unitMode=6
SET activity=gymstrat
REM Target JSONs
SET targetJSON=%activity%.json
CALL :PRELAUNCH
CALL :Poke10Unit
ECHO: && ECHO Completed loading Drones
REM go back to menu or run next matrix
PAUSE
GOTO rerun
EXIT
:LAUNCHSNIPER
IF %_debug%==1 ECHO:db Start of Sniper launch process >> %log%
IF %debug%==2 PAUSE
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=sniper
REM SET targetJSON=%myDrone%%activity%.json
SET targetJSON=%activity%.json
REM Launch unitMode set to Gym
SET unitMode=2
SET lat=36.17785253
SET lng=-115.21675114
REM Modes 0-Test 1-Farm 2-Snipe 3-Maintain 5-New 6-Battle
SET unitMode=2
IF %_debug%==1 CALL :TLOCAL >> %log%
IF %debug%==2 PAUSE
CALL :PRELAUNCH
CALL :Poke10Unit
ECHO: && ECHO Completed loading Drones
REM go back to menu or run next matrix
PAUSE
GOTO rerun
EXIT
:: JSON HELPER FUNCTIONS
:: JSON EXTRACTION HELPERS
:JS10EXT
REM TESTING JSON Ninja.JSON - extracting bot data
REM PBN1 / PBN2 / PBN3-account PBN3-lastcheck/warning PBN3-Keep PBN-4 PBNSettings PBN-5 Path and location
ECHO: && ECHO: Extracting %sections% data from %targetJSON% for %myMatrix% && ECHO:
set /a delay=%myDelay%*8
FOR /L %%A IN (0,1,9) DO (
SET drone=%%A
IF %_debug%==1 CALL :TSTEP
REM Once the Ninja json is soft coded
REM SET targetJSON=%trdOrder%-%borg%%matrix%%%A%activity%.json
CALL :JSEXT
ECHO | set /p=Processing Drone : %order%-%borg%-%matrix%-%%A please wait . . .
TIMEOUT /T %delay% > nul
ECHO | set /p=Next!
ECHO:
)
GOTO :eof
:JSEXT
REM TESTING JSON Ninja.JSON - extracting bot data
REM SET sections options Ninja(PBN1,PBN2), Account(PBN3abc), Seen(PBN3b,PBN3c), Config(PBN4), Path(PBN5), Display(run display)
IF %_debug%==1 ECHO:db ECHO Extracting %sections% data from %targetJSON% for %trdOrder%%order%%borg%%matrix%%drone%
IF %_debug%==1 START cmd /k %pbDir%\jsonextract.cmd %order% %borg% %matrix% %drone% %targetJSON% %sections% %newSettings%
IF %_debug%==0 START cmd /c %pbDir%\jsonextract.cmd %order% %borg% %matrix% %drone% %targetJSON% %sections% %newSettings%
GOTO :eof
: JSON MERGE FUNCTIONS
:JSONMERGE
REM TESTING JSON File creator - merger
IF %_debug%==1 ECHO:db ECHO Creating new %targetJSON% JSON for %trdOrder%%order%%borg%%matrix%%drone%
IF %_debug%==1 START cmd /k %pbDir%\jsonmerger.cmd %order% %borg% %matrix% %drone% %activity% %coords% %targetJSON%
IF %_debug%==0 START cmd /c %pbDir%\jsonmerger.cmd %order% %borg% %matrix% %drone% %activity% %coords% %targetJSON%
GOTO :eof
:JSON10MERGE
REM TESTING JSON File creator - merger
ECHO: && ECHO: Assimilating new %targetJSON% JSON with Activity: %activity% Location: %coords% for %myMatrix% && ECHO:
set /a delay=%myDelay%*1
FOR /L %%A IN (0,1,9) DO (
SET drone=%%A
IF %_debug%==1 CALL :TSTEP
SET targetJSON=%trdOrder%-%borg%%matrix%%%A%activity%.json
CALL :JSONMERGE
ECHO | set /p=Processing Drone : %order%-%borg%-%matrix%-%%A please wait . . .
TIMEOUT /T %delay% > nul
ECHO | set /p=Next!
ECHO:
)
GOTO :eof
: JSON FULL EXTRACT - COMPILE - RUN
:NewUSER
IF %_debug%==1 ECHO:db Start of new BOSS key process
IF %_debug%==1 PAUSE
REM Launch Notepad with JSNUser.json
REM Allow to edit
REM Test the new settings on a single account . . .
REM Decide which Matrix to work with
REM Loop - start with first matrix, roll through to end
REM Current hard coded to ninja.json
REM SET targetJSON=%myDrone%%activity%.json
SET targetJSON=ninja.json
REM - extract latest account
SET sections=Account
SET newSettings=blank
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=activity_33
REM Coordinates JSON File
SET coords=ottawa
SET unitMode=1
IF %_debug%==1 CALL :TLOCAL
IF %_debug%==1 CALL :T4
IF %_debug%==1 PAUSE
CALL :NB0
CALL :extractHELPER
CALL :NB0
CALL :rewriteHELPER
CALL :NB0
CALL :launcherHELPER
REM END OF EXTRACT
ECHO: && ECHO Completed new user extract, rewrite and launch
REM go back to menu or run next matrix ?
PAUSE
GOTO PBN
:NB0
IF %debug%==1 CLS
ECHO:
ECHO: Updating user JSON is a three step proccess:
ECHO: Extract - copy %sections% data from each %trdOrder% %targetJSON%
ECHO: ReWrite - Create a new %targetJSON% with new settings
ECHO: Launch - Run each %trdOrder% to test and correct %targetJSON% order
ECHO:
GOTO :EOF
:NewJSON
REM Needs to have PNB3 updated recently
IF %_debug%==1 ECHO: -- Start of new JSON process >> %log%
IF %debug%==2 PAUSE
REM - need to accept Variables
REM Activity : 1
REM Coords : 2
REM Test, etc
REM TargetJSON definition
REM HARD coded to ninja.json
REM COULD BE SET targetJSON=%myDrone%%activity%.json
SET targetJSON=ninja.json
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=activity_00
REM Coordinates JSON File
SET coords=vegas
REM MATRIX-19 ottawa activity_25
REM Post UnitMore for test of NEW JSON file . . .
SET unitMode=1
IF %_debug%==1 CALL :TLOCAL >> %log%
IF %_debug%==1 CALL :T4 >> %log%
IF %debug%==2 PAUSE
CALL :NJ0
IF %_debug%==1 ECHO: -- Calling reWriteHelper from NewJSON >> %log%
CALL :rewriteHELPER
CALL :NJ0
IF %_debug%==1 ECHO: -- Calling launcherHelper from NewJSON >> %log%
CALL :launcherHELPER
REM END OF new JSON
ECHO: && ECHO Completed JSON rewrite and launch
REM go back to menu or run next matrix ?
PAUSE
GOTO PBN
:NJ0
IF %debug%==1 CLS
ECHO:
ECHO: Updating ninja JSON is a 2 step proccess:
ECHO: ReWrite - Create a new %targetJSON% with new settings
ECHO: Launch - Run each %trdOrder% to test and correct %targetJSON% order
ECHO:
GOTO :EOF
:NewGYM
IF %_debug%==1 ECHO:db Start of new GYM process >> %log%
IF %debug%==2 PAUSE
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=gymstrat
REM Coordinates JSON File
SET coords=gympink
REM Target JSON
SET targetJSON=%myDrone%%activity%.json
REM Done now in the loop
REM Launch unitMode set to Gym
SET unitMode=3
CALL :NG0
CALL :specwriteHELPER
CALL :NG0
CALL :launcherHELPER
REM END OF GYM
ECHO: && ECHO Completed GYM JSON rewrite and launch
REM go back to menu or run next matrix ?
PAUSE
GOTO PBN
:NG0
IF %debug%==1 CLS
ECHO:
ECHO: Creating new GYM JSON is a two step proccess:
ECHO: ReWrite - Create a new %targetJSON% with new settings
ECHO: Launch - Run each %trdOrder% to test and correct %targetJSON% order
ECHO:
GOTO :EOF
:NewSNIPER
IF %_debug%==1 ECHO:db Start of new SNIPER process >> %log%
IF %_debug%==1 PAUSE
REM TODO - collect the current activity / location from CSV - confirm with user
SET activity=sniper
REM Coordinates JSON File
SET coords=vegas
REM Target JSON
REM SET targetJSON=%myDrone%%activity%.json
SET gymFile=%activity%.json
SET targetJSON=%gymFile%
SET lat=36.17785253
SET lng=-115.21675114
REM Launch unitMode set to Gym
SET unitMode=2
CALL :NG0
CALL :specwriteHELPER
CALL :NG0
CALL :launcherHELPER
REM END OF EXTRACT
ECHO: && ECHO Completed JSON rewrite and launch
REM go back to menu or run next matrix ?
PAUSE
GOTO PBN
:NS0
IF %debug%==1 CLS
ECHO:
ECHO: Creating Sniper JSON is a 2 step proccess:
ECHO: Step 1 - Rewrite a new %targetJSON% with %activity% settings
ECHO: Step 2 - Run each %trdOrder% to test and correct %targetJSON% order
ECHO:
GOTO :EOF
:specwriteHELPER
ECHO:
ECHO: Step : REWRITE
ECHO: About to Rewrite %targetJSON% for %myMatrix% using:
ECHO: - PBN4 Activity JSON : %activity%
ECHO: - PBN5 Coords JSON : %coords%
ECHO:
IF %_debug%==1 CALL :TLOCAL
ECHO: PRESS ANY KEY to confirm these settings . . .
PAUSE > NUL
ECHO:
ECHO: Please wait while the rewrite functions completes
REM - rewrite JSONs
CALL :JSON10MERGE
REM completed the reconstructor
ECHO: && ECHO Completed the JSON update
ECHO Check the JSONs to ensure correctness before continuing to launch
REM Open directory at location of matrix
start %matrixDir%
PAUSE
GOTO :EOF
:extractHELPER
ECHO: Step : EXTRACT
ECHO: About to copy current drone settings from %myMatrix%
ECHO: This process will update/create the Drone PNB3 JSON
ECHO: PRESS ANY KEY to confirm these settings . . .
PAUSE > NUL
ECHO: Please wait while the extraction function begins
IF %_debug%==1 CALL :TLOCAL
IF %_debug%==1 PAUSE
REM Call the extractor
CALL :JS10EXT
REM TODO - detect when last seen file is done writing
ECHO: && ECHO: WARNING *** WAIT FOR ALL WINDOWS TO CLOSE BEFORE PROCEEDING
PAUSE
GOTO :EOF
:rewriteHELPER
ECHO:
ECHO: Step : REWRITE
ECHO: About to Rewrite %targetJSON% for %myMatrix% using:
ECHO: - PBN4 Activity JSON : %activity%
ECHO: - PBN5 Coords JSON : %coords%
ECHO:
IF %_debug%==1 CALL :TLOCAL
ECHO: PRESS ANY KEY to confirm these settings . . .
PAUSE > NUL
ECHO:
ECHO: Please wait while the rewrite functions completes
REM Rewrite JSONs
ECHO: && ECHO: Creating new %targetJSON% JSON with Activity: %activity% Location: %coords% for %myMatrix% && ECHO:
set /a delay=%myDelay%*1
FOR /L %%A IN (0,1,9) DO (
SET drone=%%A
IF %_debug%==1 CALL :TSTEP
CALL :JSONMERGE
ECHO | set /p=Processing Drone : %order%-%borg%-%matrix%-%%A please wait . . .
TIMEOUT /T %delay% > nul
ECHO | set /p=Next!
ECHO:
)
ECHO: && ECHO Completed the JSON update
ECHO Check the JSONs to ensure correctness before continuing to launch
REM Open directory at location of matrix
start %matrixDir%
PAUSE
GOTO :EOF
:launcherHELPERlauncherHELPER
CALL :NB0
ECHO: Step : Drone initiation - post merger
ECHO: Warning! Do not skip this step. Running the drones fixes the order
ECHO: of the keys and values in the JSON. Running another extract if this
ECHO: is not done can reault in problems with extraction.
PAUSE > NUL
CALL :PRELAUNCH
CALL :Poke10Unit
ECHO: && ECHO Completed loading Drones
GOTO :EOF
:: MENU FUNCTIONS
:JSMENU
Title = PokeBorg JSON Function Selection
cls
color %colour%
ECHO:
ECHO: Working Dir: %matrixDir%
ECHO: +============== PokeBorg Advanced Automation NinjaBotter ==============+
ECHO: +--------------------------- JSON FUNCTIONS ---------------------------+
ECHO: : %fstOrder%-%borg% Loaded%TAB%%TAB%%TAB%%COL%
ECHO: : %myMatrix% ready to receive commands %TAB%%COL%
ECHO: +----------------------------------------------------------------------+
ECHO: : %TAB%Option 1 - Extract Account 'PBN3' data from ninja.json%TAB%%COL%
ECHO: : %TAB%Option 2 - Extract Activity data from JSON - new PBN4%TAB%%COL%
ECHO: : %TAB%Option 3 - Extract Path data from JSON - new PBN5%TAB%%COL%
ECHO: +----------------------------------------------------------------------+
ECHO: : %TAB%Option 4 - Search for JSONs in %myMatrix% sub-dirs %TAB%%COL%
ECHO: : %TAB%Option 5 - Edit PBN2 JSON in Notepad++ %TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%Option 6 - Import JSON data from CSV %TAB%%TAB%%TAB%%COL%
ECHO: +----------------------------------------------------------------------+
ECHO: : %TAB%Option 7 - Update user.json ie-NewKEY %TAB%%TAB%%TAB%%COL%
ECHO: : %TAB%Option 8 - Build new GYM JSONs for %myMatrix% %TAB%%TAB%%COL%
ECHO: : %TAB%Option 9 - Build new Sniper JSONs for %myMatrix% %TAB%%COL%
ECHO: +========================= PRESS R TO RETURN ==========================+
REM TODO Option 10 Search Remplace specific term
REM Back to Command Console
CHOICE /C 123456789R /M " Enter your selection:"
SET C=%ERRORLEVEL%
IF %C% == 10 GOTO PBN
IF %C% == 9 GOTO newSNIPER
IF %C% == 8 GOTO newGYM
IF %C% == 7 GOTO newUSER
IF %C% == 6 GOTO import
IF %C% == 5 GOTO editPBN2
IF %C% == 4 GOTO showJSON
IF %C% == 3 GOTO extractHELPER
IF %C% == 2 GOTO extractHELPER
IF %C% == 1 GOTO extractHELPER
GOTO PBN
:COLL
REM -- Order / Collection Selection Menu
IF %_debug%==1 ECHO: --Current func : BORG >> %log%
Title = PokeBorg %fstOrder% Selection
REM TODO Need to confirm the Collective and Borg assignments ie: order = '-' borg =0
REM TODO - clean up the selection menus and add - option to collective
ECHO: Eh, I haven't reached 1000 accounts yet. . . so stick with up to 999 bots
choice /C 1234567890 /M "Select the %Order% to load:"
SET O=%ERRORLEVEL%
IF %O%==10 GOTO O10
CALL :STCOLL %M%
:O10
IF %O%==10 CALL :STCOLL -
GOTO PBN
:BORG
REM -- Borg Selection Menu
IF %_debug%==1 ECHO: --Current func : BORG >> %log%
Title = PokeBorg %fstOrder% Selection
cls
color %pickCLR%
ECHO %myPogoDir%
ECHO PokeBorg Advanced Automation NinjaBotter
ECHO ::::::::::::::::::::: PokeBorg %fstOrder%-%borg%00 - %borg%99 ::::::::::::::::::::::
ECHO :: ::
ECHO :: %fstOrder% Unit Selection ::
ECHO :: ::
ECHO :: 0 - Load/New %fstOrder%-0 (%trdOrder% 000-099) ::
ECHO :: 1 - Load/New %fstOrder%-1 (%trdOrder% 100-199) ::
ECHO :: 2 - Load/New %fstOrder%-2 (%trdOrder% 200-299) ::
ECHO :: 3 - Load/New %fstOrder%-3 (%trdOrder% 300-399) ::
ECHO :: 4 - Load/New %fstOrder%-4 (%trdOrder% 400-499) ::
ECHO :: 5 - Load/New %fstOrder%-5 (%trdOrder% 500-599) ::
ECHO :: 6 - Load/New %fstOrder%-6 (%trdOrder% 600-699) ::
ECHO :: 7 - Load/New %fstOrder%-7 (%trdOrder% 700-799) ::
ECHO :: 8 - Load/New %fstOrder%-8 (%trdOrder% 800-899) ::
ECHO :: 9 - Load/New %fstOrder%-9 (%trdOrder% 900-999) ::
ECHO :: ::
ECHO ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
choice /C 1234567890 /M "Select the %fstOrder% to load:"
SET B=%ERRORLEVEL%
IF %B%==10 GOTO B10
CALL :STBORG %B%
:B10
IF %B%==10 CALL :STBORG 0
GOTO PBN
:MATRIX
REM -- Borg Selection Menu
IF %_debug%==1 ECHO: --Current func : MATRIX >> %log%
Title = PokeBorg Matrix Selection
cls
color %pickCLR%
REM Detect Date of JSON
ECHO %borgDir%
ECHO PokeBorg Advanced Automation NinjaBotter
ECHO ::::::::::::::::::::: PokeBorg %fstOrder% %borg%00 - %borg%99 ::::::::::::::::::::::
ECHO :: ::
ECHO :: %fstOrder%-%borg% Loaded ::
ECHO :: Select %sndOrder% from %fstOrder%-%borg% ::
ECHO :: ::
ECHO :: 0 - Load %sndOrder%-%borg%0 (%trdOrder% %borg%00-%borg%09) ::
ECHO :: 1 - Load %sndOrder%-%borg%1 (%trdOrder% %borg%10-%borg%19) ::
ECHO :: 2 - Load %sndOrder%-%borg%2 (%trdOrder% %borg%20-%borg%29) ::
ECHO :: 3 - Load %sndOrder%-%borg%3 (%trdOrder% %borg%30-%borg%39) ::
ECHO :: 4 - Load %sndOrder%-%borg%4 (%trdOrder% %borg%40-%borg%49) ::
ECHO :: 5 - Load %sndOrder%-%borg%5 (%trdOrder% %borg%50-%borg%59) ::
ECHO :: 6 - Load %sndOrder%-%borg%6 (%trdOrder% %borg%60-%borg%69) ::
ECHO :: 7 - Load %sndOrder%-%borg%7 (%trdOrder% %borg%70-%borg%79) ::
ECHO :: 8 - Load %sndOrder%-%borg%8 (%trdOrder% %borg%80-%borg%89) ::
ECHO :: 9 - Load %sndOrder%-%borg%9 (%trdOrder% %borg%90-%borg%99) ::
ECHO :: ::
ECHO ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
choice /C 1234567890 /M "Select the %sndOrder% to load:"
SET M=%ERRORLEVEL%
IF %M%==10 GOTO M10
CALL :STMATRIX %M%
:M10
IF %M%==10 CALL :STMATRIX 0
GOTO PBN
:DRONE
REM -- Borg Selection Menu
IF %_debug%==1 ECHO: --Current func : DRONE >> %log%
Title = PokeBorg %sndOrder% Selection
cls
color %pickCLR%
ECHO %matrixDir%
ECHO PokeBorg Advanced Automation NinjaBotter
ECHO ::::::::::::::::::::: PokeBorg %fstOrder% %borg%%matrix%0 - %borg%%matrix%9 ::::::::::::::::::::::
ECHO :: ::
ECHO :: %sndOrder%-%borg%%matrix% Loaded ::
ECHO :: Select %trdOrder% from %sndOrder%-%borg%%matrix% ::
ECHO :: ::
ECHO :: 0 - Load/New %trdOrder%-%borg%%matrix%0 ::
ECHO :: 1 - Load/New %trdOrder%-%borg%%matrix%1 ::
ECHO :: 2 - Load/New %trdOrder%-%borg%%matrix%2 ::
ECHO :: 3 - Load/New %trdOrder%-%borg%%matrix%3 ::
ECHO :: 4 - Load/New %trdOrder%-%borg%%matrix%4 ::
ECHO :: 5 - Load/New %trdOrder%-%borg%%matrix%5 ::
ECHO :: 6 - Load/New %trdOrder%-%borg%%matrix%6 ::
ECHO :: 7 - Load/New %trdOrder%-%borg%%matrix%7 ::
ECHO :: 8 - Load/New %trdOrder%-%borg%%matrix%8 ::
ECHO :: 9 - Load/New %trdOrder%-%borg%%matrix%9 ::
ECHO :: ::
ECHO ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
choice /C 1234567890 /M "Select the %trdOrder% to load:"
SET D=%ERRORLEVEL%
IF %D%==10 GOTO D10
CALL :STDRONE %D%
:D10
IF %D%==10 CALL :STDRONE 0
GOTO PBN
:: -------------------------------
:: POST SELECTION DRONE REASSIGNMENT
:: -------------------------------
:STCOLL
REM -- SET Collective AKA Order - should not be required for some time
IF %_debug%==1 ECHO: --Current func : STCOLL - %1 >> %log%
REM Need to set Order to '-' when less than 1k and then add a 0
REM then if bots exceeds 9999, switch to hexidecimal for 65k max
SET order=%1
SET myOrder=%fstOrder%-%borg%
SET /a iOrder=%borg%*100+%iMatrix%
REM COLL DIR remains the same -> Pogo
CALL :STBORG 0
GOTO :EOF
:STBORG
REM -- SET Borg
IF %_debug%==1 ECHO: --Current func : STBORG - %1 >> %log%
SET borg=%1