-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmsmFarmer.py
More file actions
145 lines (124 loc) · 3.82 KB
/
Copy pathmsmFarmer.py
File metadata and controls
145 lines (124 loc) · 3.82 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
from keypress import keyPress
import random
import threading
import time
import datetime
# Auto Battle Integration
autoDuration = 15
autoMacroDur = 60
manualOn = 1
manualFirst = 1
# Movement related vars
movementDirection = 1
movementDistMin = 0.2
movementDistMax = 0.6
movementDuration = 0.0
movementCountMin = 6
movementCountMax = 9
movementCount = random.choice(range(movementCountMin,movementCountMax,1))
# Numbers of times to triggers and buttons binded for attacks
# 0 if you wish to trigger a double move
skillRand = [0, 2, 2, 2]
#skillRand = [0, 3, 3, 2, 3]
skillButton = ["skill1"]
skillSlpMin = 0.3
skillSlpMax = 0.5
# Buttons binded for character buff spells
buffEnabled = 1
buffNow = 1
buffWaitMin = 20
buffWaitMax = 35
buffButton = ["skill5"]
buffSlpMin = 0.4
buffSlpMax = 0.9
# For switching to buff
buffButtonSwitch = "toggle"
buffSwitch = 0
# Buttons binded for summon spells
summonEnabled = 1
summonNow = 1
summonWaitMin = 120
summonWaitMax = 220
summonButton = ["skill3","skill4"]
summonSlpMin = 0.4
summonSlpMax = 0.9
def toggleAuto():
global manualOn, manualFirst
manualOn = not manualOn
if manualFirst:
manualOn = not manualOn
if manualOn:
if not manualFirst:
manualOn = 0
time.sleep(random.uniform(1,1.3))
keyPress("ab", random.uniform(0.7,1.1))
time.sleep(random.uniform(0.3,0.7))
manualOn = 1
else:
manualFirst = 0
threading.Timer(autoMacroDur, toggleAuto).start()
else:
manualOn = 0
time.sleep(random.uniform(0.8,1.1))
keyPress("ab", random.uniform(0.7,1.1))
time.sleep(random.uniform(0.9,1.3))
keyPress("abs", random.uniform(0.7,1.1))
manualOn = 0
threading.Timer(autoDuration, toggleAuto).start()
def castSkill():
if manualOn:
if buffEnabled:
if buffNow:
castBuffNow()
castBuff()
rand = random.choice(random.sample(range(buffWaitMin,buffWaitMax),1))
print ("[" + datetime.datetime.fromtimestamp(time.time()).strftime('%d-%m %H:%M:%S') + "] - " + "'" + str(rand) + "'" + " seconds until next castBuff()")
threading.Timer(rand, castBuffNow).start()
if summonEnabled:
if summonNow:
castSummonNow()
castSummon()
rand = random.choice(random.sample(range(summonWaitMin,summonWaitMax),7))
print ("[" + datetime.datetime.fromtimestamp(time.time()).strftime('%d-%m %H:%M:%S') + "] - " + "'" + str(rand) + "'" + " seconds until next castSummon()")
threading.Timer(rand, castSummonNow).start()
for x in range(random.choice(skillRand)):
keyPress(random.choice(skillButton), random.uniform(0.1,0.3))
time.sleep(random.uniform(skillSlpMin,skillSlpMax))
def castBuff():
if buffSwitch:
keyPress(buffButtonSwitch, random.uniform(0.1,0.3))
for keyValue in buffButton:
keyPress(keyValue, random.uniform(0.1,0.3))
time.sleep(random.uniform(buffSlpMin,buffSlpMax))
if buffSwitch:
keyPress(buffButtonSwitch, random.uniform(0.1,0.3))
def castBuffNow():
global buffNow
buffNow = not buffNow
def castSummon():
for keyValue in summonButton:
keyPress(keyValue, random.uniform(0.1,0.3))
time.sleep(random.uniform(summonSlpMin,summonSlpMax))
def castSummonNow():
global summonNow
summonNow = not summonNow
def charMove():
if manualOn:
global movementDirection, movementDuration, movementCount
duration = random.uniform(movementDistMin,movementDistMax)
if movementDirection:
movementDuration += duration
keyPress('right', duration)
else:
movementDuration -= duration
keyPress('left', duration)
if movementCount <= 0:
if movementDuration > 0:
keyPress('left', movementDuration)
else:
keyPress('right', movementDuration * -1)
print ("[" + datetime.datetime.fromtimestamp(time.time()).strftime('%d-%m %H:%M:%S') + "] - " + "Zero-ing character to starting point")
movementCount = random.choice(range(movementCountMin,movementCountMax,1))
movementDuration = 0.0
movementDirection = not movementDirection
movementCount -= 1