-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
1311 lines (1012 loc) · 59.1 KB
/
main.py
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
version = "1.4"
try:
import win32api, win32con, win32gui, win32process, psutil, time, threading, random, winsound, os, json, subprocess, sys, asyncio, itertools, re, keyboard
import dearpygui.dearpygui as dpg
from pypresence import Presence
except:
from os import system
system("pip install -r requirements.txt")
import win32api, win32con, win32gui, win32process, psutil, time, threading, random, winsound, os, json, subprocess, sys, asyncio, itertools, re, keyboard
import dearpygui.dearpygui as dpg
from pypresence import Presence
class configListener(dict): # Detecting changes to config
def __init__(self, initialDict):
for k, v in initialDict.items():
if isinstance(v, dict):
initialDict[k] = configListener(v)
super().__init__(initialDict)
def __setitem__(self, item, value):
if isinstance(value, dict):
_value = configListener(value)
else:
_value = value
super().__setitem__(item, _value)
try: # Trash way of checking if soda class is initialized
sodaClass
except:
while True:
try:
sodaClass
break
except:
time.sleep(0.1)
pass
if sodaClass.config["misc"]["saveSettings"]:
json.dump(sodaClass.config, open(f"{os.environ['LOCALAPPDATA']}\\temp\\{hwid}", "w", encoding="utf-8"), indent=4)
class soda():
def __init__(self, hwid: str):
self.config = {
"left": {
"enabled": False,
"mode": "Hold",
"bind": 0,
"averageCPS": 18,
"onlyWhenFocused": True,
"breakBlocks": False,
"RMBLock": False,
"blockHit": False,
"blockHitChance": 20,
"shakeEffect": False,
"shakeEffectForce": 5,
"soundPath": "",
"workInMenus": False,
"blatant": False,
"AutoRod": False,
"AutoRodChance": 10,
},
"right": {
"enabled": False,
"mode": "Hold",
"bind": 0,
"averageCPS": 12,
"onlyWhenFocused": True,
"LMBLock": False,
"shakeEffect": False,
"shakeEffectForce": False,
"soundPath": "",
"workInMenus": False,
"blatant": False
},
"recorder": {
"enabled": False,
"record": [0.08] # Default 12 CPS
},
"overlay": {
"enabled": False,
"onlyWhenFocused": True,
"x": 0,
"y": 0
},
"misc": {
"saveSettings": True,
"guiHidden": False,
"bindHideGUI": 0,
"consoleFaker": "NullBind",
"discordRichPresence": False,
"rodBind": 0,
"rodDelay": 0.2,
"rodSlot": "2",
"pearlBind": 0,
"pearlSlot": "8",
"movementFix": False,
"swordSlot": "1",
"theme": "purple",
"red": 0,
"green": 0,
"blue": 0,
},
"potions": {
"enabled": False,
"potBind": 0,
"throwDelay": 0.7,
"switchBackSlot": "1",
"potResetBind": 0,
"lowestSlot": 1,
"highestSlot": 9
}
}
self.current_pot_slot = 0
if os.path.isfile(f"{os.environ['LOCALAPPDATA']}\\temp\\{hwid}"):
try:
config = json.loads(open(f"{os.environ['LOCALAPPDATA']}\\temp\\{hwid}", encoding="utf-8").read())
isConfigOk = True
for key in self.config:
if not key in config or len(self.config[key]) != len(config[key]):
isConfigOk = False
break
if isConfigOk:
if not config["misc"]["saveSettings"]:
self.config["misc"]["saveSettings"] = False
else:
self.config = config
except:
pass
self.config = configListener(self.config)
self.record = itertools.cycle(self.config["recorder"]["record"])
threading.Thread(target=self.discordRichPresence, daemon=True).start()
threading.Thread(target=self.windowListener, daemon=True).start()
threading.Thread(target=self.leftBindListener, daemon=True).start()
threading.Thread(target=self.rightBindListener, daemon=True).start()
threading.Thread(target=self.hideGUIBindListener, daemon=True).start()
threading.Thread(target=self.bindListener, daemon=True).start()
threading.Thread(target=self.leftClicker, daemon=True).start()
threading.Thread(target=self.rightClicker, daemon=True).start()
def discordRichPresence(self):
asyncio.set_event_loop(asyncio.new_event_loop())
discordRPC = Presence("1044302531272126534")
discordRPC.connect()
startTime = time.time()
states = [
"Being the best player in the world",
"Get shit on <3",
"Herro! Is anybody home?",
"CatClicker",
]
while True:
if self.config["misc"]["discordRichPresence"]:
discordRPC.update(state=random.choice(states), start=startTime, large_image="logo", large_text="I'm him, ur not", buttons=[{"label": "Website", "url": "https://github.com/Dream23322/Soda-Autoclicker/"}])
else:
discordRPC.clear()
time.sleep(15)
def windowListener(self):
while True:
currentWindow = win32gui.GetForegroundWindow()
self.realTitle = win32gui.GetWindowText(currentWindow)
self.window = win32gui.FindWindow("LWJGL", None)
try:
self.focusedProcess = psutil.Process(win32process.GetWindowThreadProcessId(currentWindow)[-1]).name()
except:
self.focusedProcess = ""
time.sleep(0.5)
def leftClicker(self):
while True:
if not self.config["recorder"]["enabled"]:
if self.config["left"]["blatant"]:
delay = 1 / self.config["left"]["averageCPS"]
else:
delay = random.random() % (2 / self.config["left"]["averageCPS"])
else:
delay = float(next(self.record))
if self.config["left"]["enabled"]:
if self.config["left"]["mode"] == "Hold" and not win32api.GetAsyncKeyState(0x01) < 0:
time.sleep(delay)
continue
if self.config["left"]["RMBLock"]:
if win32api.GetAsyncKeyState(0x02) < 0:
time.sleep(delay)
continue
if self.config["left"]["onlyWhenFocused"]:
if not "java" in self.focusedProcess and not "AZ-Launcher" in self.focusedProcess:
time.sleep(delay)
continue
if not self.config["left"]["workInMenus"]:
cursorInfo = win32gui.GetCursorInfo()[1]
if cursorInfo > 50000 and cursorInfo < 100000:
time.sleep(delay)
continue
if self.config["left"]["onlyWhenFocused"]:
threading.Thread(target=self.leftClick, args=(True,), daemon=True).start()
else:
threading.Thread(target=self.leftClick, args=(None,), daemon=True).start()
time.sleep(delay)
def doRod(self):
# Switch to the rod slot
char_to_vk = {
'0': 0x30,
'1': 0x31,
'2': 0x32,
'3': 0x33,
'4': 0x34,
'5': 0x35,
'6': 0x36,
'7': 0x37,
'8': 0x38,
'9': 0x39,
}
# Use rodSlot to get the slot number
VK_2 = char_to_vk.get(self.config["misc"]["rodSlot"], None)
# Press the '2' key
win32api.keybd_event(VK_2, 0, 0, 0)
time.sleep(round(float(self.config["misc"]["rodDelay"]) / 3, 3)) # Brief pause to simulate a key press
# Release the '2' key
win32api.keybd_event(VK_2, 0, win32con.KEYEVENTF_KEYUP, 0)
# Send Rod by right clicking
win32api.SendMessage(self.window, win32con.WM_RBUTTONDOWN, 0, 0)
time.sleep(0.02)
win32api.SendMessage(self.window, win32con.WM_RBUTTONUP, 0, 0)
time.sleep(float(self.config["misc"]["rodDelay"])) # Brief pause to simulate a key press
# Switch back to slot 1
VK_2 = 0x31
# Press the '2' key
win32api.keybd_event(VK_2, 0, 0, 0)
time.sleep(float(self.config["misc"]["rodDelay"]) / 5) # Brief pause to simulate a key press
# Release the '2' key
win32api.keybd_event(VK_2, 0, win32con.KEYEVENTF_KEYUP, 0)
def doPotion(self):
if(self.config["potions"]["lowestSlot"] > self.current_pot_slot):
self.current_pot_slot = self.config["potions"]["lowestSlot"]
else:
if(self.current_pot_slot <= self.config["potions"]["highestSlot"]):
# Switch to the potion slot
char_to_vk = {
'0': 0x30,
'1': 0x31,
'2': 0x32,
'3': 0x33,
'4': 0x34,
'5': 0x35,
'6': 0x36,
'7': 0x37,
'8': 0x38,
'9': 0x39,
}
VK_TO_SLOT = char_to_vk.get(str(self.current_pot_slot), None)
# Press the slot key
win32api.keybd_event(VK_TO_SLOT, 0, 0, 0)
time.sleep(int(self.config["potions"]["throwDelay"]))
win32api.keybd_event(VK_TO_SLOT, 0, win32con.KEYEVENTF_KEYUP, 0)
# Send Rod by right clicking
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0)
time.sleep(0.02)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0)
time.sleep(0.6)
win32api.keybd_event(char_to_vk.get(self.config["misc"]["swordSlot"]), 0, 0, 0)
self.current_pot_slot += 1
else:
print("No Potions Left!")
def leftClick(self, focused):
if focused != None:
if self.config["left"]["breakBlocks"]:
win32api.SendMessage(self.window, win32con.WM_LBUTTONDOWN, 0, 0)
else:
win32api.SendMessage(self.window, win32con.WM_LBUTTONDOWN, 0, 0)
time.sleep(0.02)
win32api.SendMessage(self.window, win32con.WM_LBUTTONUP, 0, 0)
if self.config["left"]["blockHit"] or (self.config["left"]["blockHit"] and self.config["right"]["enabled"] and self.config["right"]["LMBLock"] and not win32api.GetAsyncKeyState(0x02) < 0):
if random.uniform(0, 1) <= self.config["left"]["blockHitChance"] / 100.0:
win32api.SendMessage(self.window, win32con.WM_RBUTTONDOWN, 0, 0)
time.sleep(0.02)
win32api.SendMessage(self.window, win32con.WM_RBUTTONUP, 0, 0)
if self.config["left"]["AutoRod"] or (self.config["left"]["AutoRod"] and self.config["right"]["enabled"] and self.config["right"]["RMBLock"] and not win32api.GetAsyncKeyState(0x01) < 0):
if random.uniform(0, 1) <= self.config["left"]["AutoRodChance"] / 100.0:
self.doRod()
else:
if self.config["left"]["breakBlocks"]:
# time.sleep(0.02)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
# win32api.SendMessage(self.window, win32con.WM_LBUTTONUP, 0, 0)
else:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
time.sleep(0.02)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
if self.config["left"]["blockHit"] or (self.config["left"]["blockHit"] and self.config["right"]["enabled"] and self.config["right"]["LMBLock"] and not win32api.GetAsyncKeyState(0x02) < 0):
if random.uniform(0, 1) <= self.config["left"]["blockHitChance"] / 100.0:
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0)
time.sleep(0.02)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0)
if self.config["left"]["AutoRod"] or (self.config["left"]["AutoRod"] and self.config["right"]["enabled"] and self.config["right"]["RMBLock"] and not win32api.GetAsyncKeyState(0x01) < 0):
if random.uniform(0, 1) <= self.config["left"]["AutoRodChance"] / 100.0:
self.doRod()
if self.config["left"]["soundPath"] != "" and os.path.isfile(self.config["left"]["soundPath"]):
winsound.PlaySound(self.config["left"]["soundPath"], winsound.SND_ASYNC)
if self.config["left"]["shakeEffect"]:
currentPos = win32api.GetCursorPos()
direction = random.randint(0, 3)
pixels = random.randint(-self.config["left"]["shakeEffectForce"], self.config["left"]["shakeEffectForce"])
if direction == 0:
win32api.SetCursorPos((currentPos[0] + pixels, currentPos[1] - pixels))
elif direction == 1:
win32api.SetCursorPos((currentPos[0] - pixels, currentPos[1] + pixels))
elif direction == 2:
win32api.SetCursorPos((currentPos[0] + pixels, currentPos[1] + pixels))
elif direction == 3:
win32api.SetCursorPos((currentPos[0] - pixels, currentPos[1] - pixels))
def leftBindListener(self):
while True:
if win32api.GetAsyncKeyState(self.config["left"]["bind"]) != 0:
if "java" in self.focusedProcess or "AZ-Launcher" in self.focusedProcess:
cursorInfo = win32gui.GetCursorInfo()[1]
if cursorInfo > 50000 and cursorInfo < 100000:
time.sleep(0.001)
continue
self.config["left"]["enabled"] = not self.config["left"]["enabled"]
while True:
try:
dpg.set_value(checkboxToggleLeftClicker, not dpg.get_value(checkboxToggleLeftClicker))
break
except:
time.sleep(0.1)
pass
while win32api.GetAsyncKeyState(self.config["left"]["bind"]) != 0:
time.sleep(0.001)
time.sleep(0.001)
def rightClicker(self):
while True:
if self.config["right"]["blatant"]:
delay = 1 / self.config["right"]["averageCPS"]
else:
delay = random.random() % (2 / self.config["right"]["averageCPS"])
if self.config["right"]["enabled"]:
if self.config["right"]["mode"] == "Hold" and not win32api.GetAsyncKeyState(0x02) < 0:
time.sleep(delay)
continue
if self.config["right"]["LMBLock"]:
if win32api.GetAsyncKeyState(0x01) < 0:
time.sleep(delay)
continue
if self.config["right"]["onlyWhenFocused"]:
if not "java" in self.focusedProcess and not "AZ-Launcher" in self.focusedProcess:
time.sleep(delay)
continue
if not self.config["right"]["workInMenus"]:
cursorInfo = win32gui.GetCursorInfo()[1]
if cursorInfo > 50000 and cursorInfo < 100000:
time.sleep(delay)
continue
if self.config["right"]["onlyWhenFocused"]:
threading.Thread(target=self.rightClick, args=(True,), daemon=True).start()
else:
threading.Thread(target=self.rightClick, args=(None,), daemon=True).start()
time.sleep(delay)
def doPearl(self):
# Switch to the rod slot
char_to_vk = {
'0': 0x30,
'1': 0x31,
'2': 0x32,
'3': 0x33,
'4': 0x34,
'5': 0x35,
'6': 0x36,
'7': 0x37,
'8': 0x38,
'9': 0x39,
}
# Use rodSlot to get the slot number
VK_2 = char_to_vk.get(self.config["misc"]["pearlSlot"], None)
# Press the '2' key
win32api.keybd_event(VK_2, 0, 0, 0)
time.sleep(0.06) # Brief pause to simulate a key press
# Release the '2' key
win32api.keybd_event(VK_2, 0, win32con.KEYEVENTF_KEYUP, 0)
# Send Rod by right clicking
win32api.SendMessage(self.window, win32con.WM_RBUTTONDOWN, 0, 0)
time.sleep(0.02)
win32api.SendMessage(self.window, win32con.WM_RBUTTONUP, 0, 0)
# Switch back to slot 1
VK_2 = char_to_vk.get(self.config["misc"]["swordSlot"], None)
# Press the '2' key
win32api.keybd_event(VK_2, 0, 0, 0)
time.sleep(0.8)
# Release the '2' key
win32api.keybd_event(VK_2, 0, win32con.KEYEVENTF_KEYUP, 0)
def rightClick(self, focused):
if focused != None:
win32api.SendMessage(self.window, win32con.WM_RBUTTONDOWN, 0, 0)
time.sleep(0.02)
win32api.SendMessage(self.window, win32con.WM_RBUTTONUP, 0, 0)
else:
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0)
time.sleep(0.02)
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0)
if self.config["right"]["soundPath"] != "" and os.path.isfile(self.config["right"]["soundPath"]):
winsound.PlaySound(self.config["right"]["soundPath"], winsound.SND_ASYNC)
if self.config["right"]["shakeEffect"]:
currentPos = win32api.GetCursorPos()
direction = random.randint(0, 3)
pixels = random.randint(-self.config["right"]["shakeEffectForce"], self.config["right"]["shakeEffectForce"])
if direction == 0:
win32api.SetCursorPos((currentPos[0] + pixels, currentPos[1] - pixels))
elif direction == 1:
win32api.SetCursorPos((currentPos[0] - pixels, currentPos[1] + pixels))
elif direction == 2:
win32api.SetCursorPos((currentPos[0] + pixels, currentPos[1] + pixels))
elif direction == 3:
win32api.SetCursorPos((currentPos[0] - pixels, currentPos[1] - pixels))
def rightBindListener(self):
while True:
if win32api.GetAsyncKeyState(self.config["right"]["bind"]) != 0:
if "java" in self.focusedProcess or "AZ-Launcher" in self.focusedProcess:
cursorInfo = win32gui.GetCursorInfo()[1]
if cursorInfo > 50000 and cursorInfo < 100000:
time.sleep(0.001)
continue
self.config["right"]["enabled"] = not self.config["right"]["enabled"]
while True:
try:
dpg.set_value(checkboxToggleRightClicker, not dpg.get_value(checkboxToggleRightClicker))
break
except:
time.sleep(0.1)
pass
while win32api.GetAsyncKeyState(self.config["right"]["bind"]) != 0:
time.sleep(0.001)
time.sleep(0.001)
def movementFix(self):
self.key_a_pressed = False
self.key_d_pressed = False
def on_key_event(e):
if self.config["misc"]["movementFix"]:
if e.name == 'a':
if e.event_type == 'down':
self.key_a_pressed = True
if self.key_d_pressed:
keyboard.block_key('d')
elif e.event_type == 'up':
self.key_a_pressed = False
keyboard.unblock_key('d')
if e.name == 'd':
if e.event_type == 'down':
self.key_d_pressed = True
if self.key_a_pressed:
keyboard.block_key('a')
elif e.event_type == 'up':
self.key_d_pressed = False
keyboard.unblock_key("a")
keyboard.hook(on_key_event)
def isFocused(self, config1: str, config2: str, config3: str):
return ("java" in self.focusedProcess or "AZ-Launcher" in self.focusedProcess or not self.config[config1][config2]) and (self.config[config1][config3] or win32gui.GetCursorInfo()[1] > 200000)
def bindListener(self):
while True:
if win32api.GetAsyncKeyState(self.config["misc"]["rodBind"]) != 0 and self.isFocused("left", "onlyWhenFocused", "workInMenus"):
self.doRod()
elif win32api.GetAsyncKeyState(self.config["misc"]["pearlBind"]) != 0 and self.isFocused("left", "onlyWhenFocused", "workInMenus"):
self.doPearl()
# Do movement correction
elif self.config["misc"]["movementFix"]:
# Run movement correction with current pressed key
self.movementFix()
elif win32api.GetAsyncKeyState(self.config["potions"]["potBind"]) != 0 and self.isFocused("left", "onlyWhenFocused", "workInMenus"):
self.doPotion()
time.sleep(0.5)
elif win32api.GetAsyncKeyState(self.config["potions"]["potResetBind"]) != 0:
self.current_pot_slot = int(self.config["potions"]["lowestSlot"])
time.sleep(0.001)
def hideGUIBindListener(self):
while True:
if win32api.GetAsyncKeyState(self.config["misc"]["bindHideGUI"]) != 0:
self.config["misc"]["guiHidden"] = not self.config["misc"]["guiHidden"]
if(self.config["misc"]["consoleFaker"] == "NullBind"):
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nNullBind - Rampage 1.0.4 Beta\n\n\n\n\n\n")
elif(self.config["misc"]["consoleFaker"] == "Optimiser"):
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nEntropy Optimiser - Eagle 1.0.4 Beta\n\n\n\n\n\n")
else:
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBetterRGB - Hawk 1.0.4 Beta\n\n\n\n\n\n")
if not self.config["misc"]["guiHidden"]:
win32gui.ShowWindow(guiWindows, win32con.SW_SHOW)
else:
win32gui.ShowWindow(guiWindows, win32con.SW_HIDE)
while win32api.GetAsyncKeyState(self.config["misc"]["bindHideGUI"]) != 0:
time.sleep(0.001)
time.sleep(0.001)
if __name__ == "__main__":
try:
if os.name != "nt":
input("Soda Autoclicker is only working on Windows.")
os._exit(0)
(suppost_sid, error) = subprocess.Popen("wmic useraccount where name='%username%' get sid", stdout=subprocess.PIPE, shell=True).communicate()
hwid = suppost_sid.split(b"\n")[1].strip().decode()
currentWindow = win32gui.GetForegroundWindow()
processName = psutil.Process(win32process.GetWindowThreadProcessId(currentWindow)[-1]).name()
if processName == "cmd.exe" or processName in sys.argv[0]:
win32gui.ShowWindow(currentWindow, win32con.SW_HIDE)
sodaClass = soda(hwid)
dpg.create_context()
def toggleLeftClicker(id: int, value: bool):
sodaClass.config["left"]["enabled"] = value
waitingForKeyLeft = False
def statusBindLeftClicker(id: int):
global waitingForKeyLeft
if not waitingForKeyLeft:
with dpg.handler_registry(tag="Left Bind Handler"):
dpg.add_key_press_handler(callback=setBindLeftClicker)
dpg.set_item_label(buttonBindLeftClicker, "...")
waitingForKeyLeft = True
def setBindLeftClicker(id: int, value: str):
global waitingForKeyLeft
if waitingForKeyLeft:
sodaClass.config["left"]["bind"] = value
dpg.set_item_label(buttonBindLeftClicker, f"Bind: {chr(value)}")
dpg.delete_item("Left Bind Handler")
waitingForKeyLeft = False
def setLeftMode(id: int, value: str):
sodaClass.config["left"]["mode"] = value
def setLeftAverageCPS(id: int, value: int):
sodaClass.config["left"]["averageCPS"] = value
def toggleLeftOnlyWhenFocused(id: int, value:bool):
sodaClass.config["left"]["onlyWhenFocused"] = value
def toggleLeftBreakBlocks(id: int, value: bool):
sodaClass.config["left"]["breakBlocks"] = value
def toggleLeftRMBLock(id: int, value: bool):
sodaClass.config["left"]["RMBLock"] = value
def toggleLeftBlockHit(id: int, value: bool):
sodaClass.config["left"]["blockHit"] = value
def setLeftBlockHitChance(id: int, value: int):
sodaClass.config["left"]["blockHitChance"] = value
def toggleLeftShakeEffect(id: int, value: bool):
sodaClass.config["left"]["shakeEffect"] = value
def setLeftShakeEffectForce(id: int, value: int):
sodaClass.config["left"]["shakeEffectForce"] = value
def setLeftClickSoundPath(id: int, value: str):
sodaClass.config["left"]["soundPath"] = value
def toggleLeftWorkInMenus(id: int, value: bool):
sodaClass.config["left"]["workInMenus"] = value
def toggleLeftBlatantMode(id: int, value: bool):
sodaClass.config["left"]["blatant"] = value
def toggleRightClicker(id: int, value: bool):
sodaClass.config["right"]["enabled"] = value
def toggleLeftAutoRod(id: int, value: bool):
sodaClass.config["left"]["AutoRod"] = value
def setLeftAutoRodChance(id: int, value: int):
sodaClass.config["left"]["AutoRodChance"] = value
def toggleMovementFix(id: int, value: bool):
sodaClass.config["misc"]["movementFix"] = value
waitingForKeyRight = False
def statusBindRightClicker(id: int):
global waitingForKeyRight
if not waitingForKeyRight:
with dpg.handler_registry(tag="Right Bind Handler"):
dpg.add_key_press_handler(callback=setBindRightClicker)
dpg.set_item_label(buttonBindRightClicker, "...")
waitingForKeyRight = True
def setBindRightClicker(id: int, value: str):
global waitingForKeyRight
if waitingForKeyRight:
sodaClass.config["right"]["bind"] = value
dpg.set_item_label(buttonBindRightClicker, f"Bind: {chr(value)}")
dpg.delete_item("Right Bind Handler")
waitingForKeyRight = False
def statusBindRod(id: int):
global waitingForKeyRight
if not waitingForKeyRight:
with dpg.handler_registry(tag="Rod Bind Handler"):
dpg.add_key_press_handler(callback=setBindRod)
dpg.set_item_label(buttonBindRodKey, "...")
waitingForKeyRight = True
def setBindRod(id: int, value: str):
global waitingForKeyRight
if waitingForKeyRight:
sodaClass.config["misc"]["rodBind"] = value
dpg.set_item_label(buttonBindRodKey, f"Bind: {chr(value)}")
dpg.delete_item("Rod Bind Handler")
waitingForKeyRight = False
def statusBindPearl(id: int):
global waitingForKeyRight
if not waitingForKeyRight:
with dpg.handler_registry(tag="Pearl Bind Handler"):
dpg.add_key_press_handler(callback=setBindPearl)
dpg.set_item_label(buttonBindPearlKey, "...")
waitingForKeyRight = True
def setBindPearl(id: int, value: str):
global waitingForKeyRight
if waitingForKeyRight:
sodaClass.config["misc"]["pearlBind"] = value
dpg.set_item_label(buttonBindPearlKey, f"Bind: {chr(value)}")
dpg.delete_item("Pearl Bind Handler")
waitingForKeyRight = False
def statusBindPot(id: int):
global waitingForKeyRight
if not waitingForKeyRight:
with dpg.handler_registry(tag="Pot Bind Handler"):
dpg.add_key_press_handler(callback=setBindPot)
dpg.set_item_label(buttonBindPotKey, "...")
waitingForKeyRight = True
def setBindPot(id: int, value: str):
global waitingForKeyRight
if waitingForKeyRight:
sodaClass.config["potions"]["potBind"] = value
dpg.set_item_label(buttonBindPotKey, f"Bind: {chr(value)}")
dpg.delete_item("Pot Bind Handler")
waitingForKeyRight = False
def statusBindPotReset(id: int):
global waitingForKeyRight
if not waitingForKeyRight:
with dpg.handler_registry(tag="Pot Reset Bind Handler"):
dpg.add_key_press_handler(callback=setBindPotReset)
dpg.set_item_label(buttonBindPotResetKey, "...")
waitingForKeyRight = True
def setBindPotReset(id: int, value: str):
global waitingForKeyRight
if waitingForKeyRight:
sodaClass.config["potions"]["potResetBind"] = value
dpg.set_item_label(buttonBindPotResetKey, f"Bind: {chr(value)}")
dpg.delete_item("Pot Reset Bind Handler")
waitingForKeyRight = False
def setRodSlot(id: int, value: str):
sodaClass.config["misc"]["rodSlot"] = value
def setSwordSlot(id: int, value: str):
sodaClass.config["misc"]["swordSlot"] = value
def setPearlSlot(id: int, value: str):
sodaClass.config["misc"]["pearlSlot"] = value
def setRightMode(id: int, value: str):
sodaClass.config["right"]["mode"] = value
def setPotDelay(id: int, value: float):
sodaClass.config["potions"]["throwDelay"] = value
def setRightAverageCPS(id: int, value: int):
sodaClass.config["right"]["averageCPS"] = value
def toggleRightOnlyWhenFocused(id: int, value: int):
sodaClass.config["right"]["onlyWhenFocused"] = True
def toggleRightLMBLock(id: int, value: bool):
sodaClass.config["right"]["LMBLock"] = value
def toggleRightShakeEffect(id: int, value: bool):
sodaClass.config["right"]["shakeEffect"] = value
def setRightShakeEffectForce(id: int, value: int):
sodaClass.config["right"]["shakeEffectForce"] = value
def setRightClickSoundPath(id: int, value: str):
sodaClass.config["right"]["soundPath"] = value
def toggleRightWorkInMenus(id: int, value: bool):
sodaClass.config["right"]["workInMenus"] = value
def toggleRightBlatantMode(id: int, value: bool):
sodaClass.config["right"]["blatant"] = value
def toggleRecorder(id: int, value: bool):
sodaClass.config["recorder"]["enabled"] = value
recording = False
def recorder():
global recording
recording = True
dpg.set_value(recordingStatusText, f"Recording: True")
recorded = []
start = 0
while True:
if not recording:
if len(recorded) < 2: # Avoid saving a record with 0 click
recorded[0] = 0.08
else:
recorded[0] = 0 # No delay for the first click
del recorded[-1] # Deleting last record time because that's when you click on stop button and it can take some time
sodaClass.config["recorder"]["record"] = recorded
sodaClass.record = itertools.cycle(recorded)
totalTime = 0
for clickTime in recorded:
totalTime += float(clickTime)
dpg.set_value(averageRecordCPSText, f"Average CPS of previous Record: {round(len(recorded) / totalTime, 2)}")
break
if win32api.GetAsyncKeyState(0x01) < 0:
recorded.append(time.time() - start)
dpg.set_value(recordingStatusText, f"Recording: True - Recorded clicks: {len(recorded)}")
start = time.time()
while win32api.GetAsyncKeyState(0x01) < 0:
time.sleep(0.001)
def setRodDelay(id: int, value: float):
sodaClass.config["misc"]["rodDelay"] = value
def setLowestSlot(id: int, value: int):
sodaClass.config["potions"]["lowestSlot"] = value
def setHighestSlot(id: int, value: int):
sodaClass.config["potions"]["highestSlot"] = value
def setSwitchDelay(id: int, value: float):
sodaClass.config["potions"]["switchDelay"] = value
def startRecording():
if not recording:
threading.Thread(target=recorder, daemon=True).start()
def togglePotions(id:int, value: bool):
sodaClass.config["potions"]["enabled"] = value
def setTheme(id: int, value: str):
sodaClass.config["misc"]["theme"] = value
def setConsoleFaker(id: int, value: str):
sodaClass.config["misc"]["consoleFaker"] = value
def stopRecording():
global recording
recording = False
dpg.set_value(recordingStatusText, f"Recording: False")
def selfDestruct():
dpg.destroy_context()
waitingForKeyHideGUI = False
def statusBindHideGUI():
global waitingForKeyHideGUI
if not waitingForKeyHideGUI:
with dpg.handler_registry(tag="Hide GUI Bind Handler"):
dpg.add_key_press_handler(callback=setBindHideGUI)
dpg.set_item_label(buttonBindHideGUI, "...")
waitingForKeyHideGUI = True
# set RGB
def setRed(id: int, value: int):
sodaClass.config["misc"]["red"] = value
def setGreen(id: int, value: int):
sodaClass.config["misc"]["green"] = value
def setBlue(id: int, value: int):
sodaClass.config["misc"]["blue"] = value
def setBindHideGUI(id: int, value: str):
global waitingForKeyHideGUI
if waitingForKeyHideGUI:
sodaClass.config["misc"]["bindHideGUI"] = value
dpg.set_item_label(buttonBindHideGUI, f"Bind: {chr(value)}")
dpg.delete_item("Hide GUI Bind Handler")
waitingForKeyHideGUI = False
def toggleSaveSettings(id: int, value: bool):
sodaClass.config["misc"]["saveSettings"] = value
def toggleAlwaysOnTop(id: int, value: bool):
if value:
win32gui.SetWindowPos(guiWindows, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)
else:
win32gui.SetWindowPos(guiWindows, win32con.HWND_NOTOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)
def toggleDiscordRPC(id: int, value: bool):
sodaClass.config["misc"]["discordRichPresence"] = value
def themeToRGB(theme: str):
try:
themeMap = {
"light": (250, 250, 250),
"dark": (40, 40, 40),
"sakura": (217, 156, 195),
"purple": (181, 92, 224),
"blue": (58, 110, 230),
"lightblue": (113, 190, 235),
"orange": (232, 165, 22),
"red": (222, 90, 90),
"beach_green": (133, 207, 182),
"forest_green": (51, 120, 78),
}
return themeMap[theme]
except:
return None
with dpg.theme() as container_theme:
if(sodaClass.config["misc"]["theme"] != "custom"):
rgb_data = themeToRGB(sodaClass.config["misc"]["theme"])
else:
rgb_data = (sodaClass.config["misc"]["red"], sodaClass.config["misc"]["green"], sodaClass.config["misc"]["blue"])
with dpg.theme_component(dpg.mvAll):
dpg.add_theme_color(dpg.mvThemeCol_Tab, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_TabHovered, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_TabActive, rgb_data, category=dpg.mvThemeCat_Core),
dpg.add_theme_color(dpg.mvThemeCol_CheckMark, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_SliderGrab, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrab, rgb_data, category=dpg.mvThemeCat_Core)
if(sodaClass.config["misc"]["theme"] == "light"):
# Set all items to white except text
dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 0, 0), category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_WindowBg, (230, 230, 230), category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, rgb_data, category=dpg.mvThemeCat_Core)
dpg.add_theme_color(dpg.mvThemeCol_Button, rgb_data, category=dpg.mvThemeCat_Core)
dpg.create_viewport(title=f"[v{version}] Soda - AutoClicker.ontop", width=860, height=645)
with dpg.window(tag="Primary Window"):
dpg.bind_item_theme("Primary Window", container_theme)
with dpg.tab_bar():
with dpg.tab(label="Left Clicker"):
dpg.add_spacer(width=75)
with dpg.group(horizontal=True):
checkboxToggleLeftClicker = dpg.add_checkbox(label="Toggle", default_value=sodaClass.config["left"]["enabled"], callback=toggleLeftClicker)
buttonBindLeftClicker = dpg.add_button(label="Click to Bind", callback=statusBindLeftClicker)
dropdownLeftMode = dpg.add_combo(label="Mode", items=["Hold", "Always"], default_value=sodaClass.config["left"]["mode"], callback=setLeftMode)
bind = sodaClass.config["left"]["bind"]
if bind != 0:
dpg.set_item_label(buttonBindLeftClicker, f"Bind: {chr(bind)}")
dpg.add_spacer(width=75)
sliderLeftAverageCPS = dpg.add_slider_int(label="Average CPS", default_value=sodaClass.config["left"]["averageCPS"], min_value=1, callback=setLeftAverageCPS)
dpg.add_spacer(width=75)
dpg.add_separator()
dpg.add_spacer(width=75)
checkboxLeftBlockHit = dpg.add_checkbox(label="BlockHit", default_value=sodaClass.config["left"]["blockHit"], callback=toggleLeftBlockHit)
sliderLeftBlockHitChance = dpg.add_slider_int(label="BlockHit Chance", default_value=sodaClass.config["left"]["blockHitChance"], min_value=1, max_value=100, callback=setLeftBlockHitChance)
dpg.add_text(default_value="Randomly right clicks to do a blockhit (MC version < 1.8.9). This can help reduce damage.\nWarning: Having the amount higher than 50 can cause it to be very hard to move while using the clicker")
dpg.add_spacer(width=125)