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

Commit cb5dc4c

Browse files
authored
Add files via upload
1 parent 4268f83 commit cb5dc4c

27 files changed

+88
-59
lines changed

Basic/buy_product.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import asyncio
22

3+
import __init__ # For IDLE
34
from Help_functions.bot_functions import fix_product_name
45
from login import get_content
56

67

78
async def products(server, product, amount):
89
"""Buy products at the LOCAL market (consider flying first)."""
910
URL = f"https://{server}.e-sim.org/"
10-
quality, product = await fix_product_name(product)
11+
quality, product = fix_product_name(product)
1112
if not quality:
1213
quality = 5
1314
if not product:

Basic/candidate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import asyncio
2-
3-
from login import get_content
2+
from datetime import datetime
43

54
try:
65
import pytz
76
game_time = True
87
except:
98
print("We recommend installing pytz (pip install pytz) in order to get e-sim time")
109
game_time = False
11-
from datetime import datetime
10+
11+
from login import get_content
1212

1313

1414
async def candidate(server):

Basic/fly.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22

3+
import __init__ # For IDLE
34
from Help_functions.bot_functions import random_sleep
45
from login import get_content
56

Basic/login.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from Help_functions.login import *
22

33
# This should help to run __main__ files.
4+
# Original File: Help_functions.login

Basic/rw.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22

3+
import __init__ # For IDLE
34
from Basic.fly import fly
45
from login import get_content
56

Basic/sell_eqs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22

3+
import __init__ # For IDLE
34
from Basic.wear_unwear import wear_unwear
45
from login import get_content
56

Basic/vote_elections.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import asyncio
2-
3-
from login import get_content
2+
from datetime import datetime
43

54
try:
65
import pytz
76
game_time = True
87
except:
98
print("We recommend installing pytz (pip install pytz) in order to get e-sim time")
109
game_time = False
11-
from datetime import datetime
10+
11+
from login import get_content
1212

1313

1414
async def elect(server, your_candidate):

Fight/auto_fight.py

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
from random import randint
33

4+
import __init__ # For IDLE
45
from Basic.fly import fly
56
from Help_functions.bot_functions import fighting, get_battle_id, location, random_sleep
67
from login import double_click, get_content
@@ -13,41 +14,38 @@ async def auto_fight(server, battle_id="", side="attacker", wep="0", food="", gi
1314
for _ in range(int(restores)):
1415
restores_left -= 1
1516
try:
16-
try:
17-
int(battle_id) # user gave valid id
18-
except:
19-
battle_id = await get_battle_id(server, battle_id,first_run=True)
17+
if not battle_id.isdigit():
18+
battle_id = await get_battle_id(server, battle_id)
2019
print(f'{URL}battle.html?id={battle_id} side: {side}')
21-
if battle_id:
22-
tree = await get_content(URL, login_first=True)
23-
check = tree.xpath('//*[@id="taskButtonWork"]//@href') # checking if you can work
24-
A = randint(1, 4)
25-
if check and A == 2: # Don't work as soon as you can (suspicious)
26-
current_loc = await location(server)
27-
await double_click(server)
28-
await fly(server, current_loc)
29-
apiBattles = await get_content(f"{URL}apiBattles.html?battleId={battle_id}")
30-
if 8 in (apiBattles['attackerScore'], apiBattles['defenderScore']):
31-
print("Battle has finished, i will search for another one")
32-
battle_id = await get_battle_id(server, battle_id)
33-
34-
tree = await get_content(f'{URL}battle.html?id={battle_id}')
35-
fight_ability = tree.xpath("//*[@id='newFightView']//div[3]//div[3]//div//text()[1]")
36-
if any("You can't fight in this battle from your current location." in s for s in fight_ability):
37-
print("You can't fight in this battle from your current location.")
38-
return
39-
await fighting(server, battle_id, side, wep)
40-
if food:
41-
await get_content(f"{URL}eat.html", data={'quality': food})
42-
if gift:
43-
await get_content(f"{URL}gift.html", data={'quality': gift})
44-
if food or gift:
45-
await fighting(server, battle_id, side, wep)
46-
await random_sleep(restores_left)
47-
48-
else:
20+
if not battle_id:
4921
print("Can't fight in any battle. i will check again after the next restore")
5022
await random_sleep(restores_left)
23+
continue
24+
tree = await get_content(URL, login_first=True)
25+
check = tree.xpath('//*[@id="taskButtonWork"]//@href') # checking if you can work
26+
A = randint(1, 4)
27+
if check and A == 2: # Don't work as soon as you can (suspicious)
28+
current_loc = await location(server)
29+
await double_click(server)
30+
await fly(server, current_loc)
31+
apiBattles = await get_content(f"{URL}apiBattles.html?battleId={battle_id}")
32+
if 8 in (apiBattles['attackerScore'], apiBattles['defenderScore']):
33+
print("Battle has finished, i will search for another one")
34+
battle_id = await get_battle_id(server, battle_id)
35+
36+
tree = await get_content(f'{URL}battle.html?id={battle_id}')
37+
fight_ability = tree.xpath("//*[@id='newFightView']//div[3]//div[3]//div//text()[1]")
38+
if any("You can't fight in this battle from your current location." in s for s in fight_ability):
39+
print("You can't fight in this battle from your current location.")
40+
return
41+
await fighting(server, battle_id, side, wep)
42+
if food:
43+
await get_content(f"{URL}eat.html", data={'quality': food})
44+
if gift:
45+
await get_content(f"{URL}gift.html", data={'quality': gift})
46+
if food or gift:
47+
await fighting(server, battle_id, side, wep)
48+
await random_sleep(restores_left)
5149

5250
except Exception as error:
5351
print("error:", error)

Fight/fight.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import time
33

4+
import __init__ # For IDLE
45
from Basic.fly import fly
56
from login import get_content
67

@@ -24,7 +25,7 @@ async def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQualit
2425
gift_limit = tree.xpath('//*[@id="sgiftQ5"]/text()')[0]
2526
food = int(float(tree.xpath('//*[@id="foodLimit2"]')[0].text))
2627
gift = int(float(tree.xpath('//*[@id="giftLimit2"]')[0].text))
27-
if weaponQuality != "0":
28+
if int(weaponQuality):
2829
wep = tree.xpath(f'//*[@id="Q{weaponQuality}WeaponStock"]/text()')[0]
2930
else:
3031
wep = "unlimited"
@@ -52,7 +53,7 @@ async def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQualit
5253
Health = int(float(tree.xpath('//*[@id="actualHealth"]')[0].text))
5354
for _ in range(100):
5455
if time.time() - start > int(start_time):
55-
break # round is over
56+
break # round is over
5657

5758
if Health < 50:
5859
if (not food or not int(food_limit)) and (not gift or not int(gift_limit)):
@@ -71,8 +72,8 @@ async def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQualit
7172
await get_content(f"{URL}{use}.html", data={'quality': 5})
7273
for _ in range(5):
7374
try:
74-
tree, status = await get_content(
75-
f"{URL}fight.html?weaponQuality={weaponQuality}&battleRoundId={hidden_id}&side={side}&value=Berserk")
75+
data = {"weaponQuality": weaponQuality, "battleRoundId": hidden_id, "side": side, "value": "Berserk"}
76+
tree, status = await get_content(f"{URL}fight.html", data=data)
7677
Damage = int(str(tree.xpath('//*[@id="DamageDone"]')[0].text).replace(",", ""))
7778
Health = float(tree.xpath("//*[@id='healthUpdate']")[0].text.split()[0])
7879
if dmg < 1000:
@@ -86,6 +87,8 @@ async def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQualit
8687
break
8788
print("Slow down")
8889
await asyncio.sleep(2)
90+
if not Damage:
91+
break
8992
DamageDone += Damage
9093
hits_or_dmg = "hits" if dmg < 1000 else "dmg"
9194
if update % 4 == 0:

Fight/hunt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22

3+
import __init__ # For IDLE
34
from Basic.fly import fly
45
from login import get_content, get_nick_and_pw
56

@@ -13,7 +14,7 @@ async def hunt(server, maxDmgForBh="500000", startTime="30", weaponQuality="5"):
1314
maxDmgForBh, startTime = int(maxDmgForBh.replace("k", "000")), int(startTime)
1415
print(f"Startint to hunt at {server}.")
1516
nick = get_nick_and_pw(server)[0]
16-
apiCitizen = await get_content(f"{URL}apiCitizenByName.html?name={nick.lower()}", first_run=True)
17+
apiCitizen = await get_content(f"{URL}apiCitizenByName.html?name={nick.lower()}")
1718
apiRegions = await get_content(URL + "apiRegions.html")
1819
for _ in range(100):
1920
try:

0 commit comments

Comments
 (0)