-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcd-overlay.py
95 lines (73 loc) · 2.49 KB
/
cd-overlay.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
from classes import *
# Initialize
equipmentList = []
equipmentSlotList = []
## Key to reset all countdowns
resetKey = '-'
## Key to change Arcs when mounted
mountKey = '='
## DO NOT DELETE EQUIPMENT SLOTS
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.RING))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.BOOTS))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.WEAPON))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.HELMET))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.SHIELD))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.ARMOR))
equipmentSlotList.append(TrackedEquipmentSlot(EquipmentType.LEGS))
# Separators for the tracked actions section
emptyLines = []
def debugMode():
print('Debug Mode: press hotkeys to see how to add them in the script')
while(True):
s = keyboard.read_hotkey(suppress=False)
print(s)
def main(options):
# Checks for flag
if len(options) > 1:
charName = options[1]
setup = False
else:
print("Starting in setup mode.")
charName = "Knight"
setup = True
# Parse configs
optionsHandler = OptionsHandler(charName)
# Create position handler
positionHandler = PositionHandler(optionsHandler)
# Create transparent window
windowHandler = WindowHandler(optionsHandler,equipmentList,emptyLines, positionHandler)
# Thread that detects keyboard hotkeys
tHotkeyTracker = HotkeyTracker(optionsHandler,equipmentList,windowHandler,positionHandler,resetKey,mountKey)
# Thread that detects mouse buttons
tMouseTracker = MouseTracker(optionsHandler,positionHandler)
# Thread that tracks actions
tActionTracker = ActionTracker(optionsHandler,equipmentList,equipmentSlotList)
# Setup mode
if setup:
windowHandler.setupMode()
tMouseTracker.setupMode()
tHotkeyTracker.setupMode()
tActionTracker.setupMode()
# Start threads
tMouseTracker.start()
tHotkeyTracker.start()
tActionTracker.start()
try:
while(True):
win32gui.RedrawWindow(windowHandler.hWindow, None, None, win32con.RDW_INVALIDATE | win32con.RDW_ERASE)
win32gui.PumpWaitingMessages()
time.sleep(0.05)
except KeyboardInterrupt:
print("\nScript interrupted")
tActionTracker.abort = True
tActionTracker.join()
print("Action Tracker Stopped")
tMouseTracker.join()
print("Mouse Tracker Stopped")
tHotkeyTracker.join()
print("Hotkey Tracker Stopped")
win32gui.DestroyWindow(windowHandler.hWindow)
print("Overlay window destroyed")
print("Closing...")
if __name__ == '__main__':
main(sys.argv)