Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 77394d9

Browse files
authored
Update hunt.py
1 parent b29617c commit 77394d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Fight/hunt.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def hunt(server, maxDmgForBh="500000", startTime="30", weaponQuality="5"):
1616
nick = get_nick_and_pw(server)[0]
1717
apiCitizen = requests.get(f"{URL}apiCitizenByName.html?name={nick.lower()}").json()
1818
while 1:
19+
try:
1920
battles_time = {}
2021
apiMap = requests.get(f'{URL}apiMap.html').json()
2122
for row in apiMap:
@@ -29,6 +30,9 @@ def hunt(server, maxDmgForBh="500000", startTime="30", weaponQuality="5"):
2930
if apiBattles['frozen']:
3031
continue
3132
time_to_sleep = apiBattles["hoursRemaining"]*3600 + apiBattles["minutesRemaining"]*60 + apiBattles["secondsRemaining"]
33+
round_time = 7000 is server in ("primera", "secura", "suna") else 3400
34+
if time_to_sleep > 7000:
35+
break
3236
print("Seconds till next battle:", time_to_sleep)
3337
try:
3438
time.sleep(time_to_sleep - startTime)
@@ -66,6 +70,7 @@ def fight(side, DamageDone, session):
6670
f = session.post(f"{URL}fight.html?weaponQuality={weaponQuality}&battleRoundId={hidden_id}&side={side}{value}")
6771
tree = fromstring(f.content)
6872
Damage = int(str(tree.xpath('//*[@id="DamageDone"]')[0].text).replace(",", ""))
73+
time.sleep(0.3)
6974
break
7075
except:
7176
time.sleep(2)
@@ -161,7 +166,8 @@ def hunting(side, side_dmg, session):
161166
hunting(side, dDMG, session)
162167
else:
163168
continue
164-
169+
except Exception as error:
170+
print(error)
165171
if __name__ == "__main__":
166172
print(hunt.__doc__)
167173
server = input("Server: ")

0 commit comments

Comments
 (0)