-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathautomated_script.py
91 lines (77 loc) · 3.27 KB
/
automated_script.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import time
import i18n
import src.Logger as logger
from src.WurzelBot import WurzelBot
def main():
parser = argparse.ArgumentParser()
parser.add_argument('server', type=int, help='server number')
parser.add_argument('user', type=str, help='username for login')
parser.add_argument('password', type=str, help='password for login', default=False)
parser.add_argument('-p', '--portal', help="If -p or --portal Argument is passed, Portal Account Login will be used.", action='store_true', default=False, required=False, dest="portalacc")
parser.add_argument('-l', '--log', help="If -l or --log Argument is passed, logging will be enabled.", action='store_true', default=False, required=False, dest="log")
parser.add_argument('lang', help="Set Language and Region for the Game and Bot", type=str, nargs='?', default=None, const='en')
args = parser.parse_args()
i18n.load_path.append('lang')
i18n.set('locale', args.lang)
i18n.set('fallback', 'en')
if args.log:
logger.logger()
# Init connection
# BG- Създаване на връзка
wurzelBot = WurzelBot()
succ = wurzelBot.login(args.server, args.user, args.password, args.lang, args.portalacc)
if not succ:
exit(-1)
try:
# Check if the bot should be stopped
# BG-Проверка дали бота трябва да бъде спрян
if wurzelBot.get_stop_bot_note():
print(i18n.t('wimpb.stop_wbot'))
wurzelBot.logout()
return
# Remove weed
# BG-Премахване на плевели
print(i18n.t('wimpb.remove_weed_from_all_gardens'))
wurzelBot.remove_weeds()
# Harvest
# BG-Жътва
wurzelBot.harvest()
# Plant plants
# BG-Посаждане на растения
while wurzelBot.hasEmptyFields():
lowest = wurzelBot.getLowestVegetableStockEntry()
if lowest == 'Your stock is empty':
break
print(i18n.t('wimpb.grow_plant_X', plant=lowest))
planted = wurzelBot.growVegetablesInGardens(lowest)
if planted == 0:
lowestSingle = wurzelBot.getLowestSingleVegetableStockEntry()
if lowestSingle == 'Your stock is empty':
break
print(i18n.t('wimpb.grow_plant_X', plant=lowestSingle))
wurzelBot.growVegetablesInGardens(lowestSingle)
# Water plants
# BG-Поливане на растенията
time.sleep(3)
print(i18n.t('wimpb.watering_all_plants'))
wurzelBot.water()
# Claim Daily
# BG-Събиране на дневният бонус
print(i18n.t('wimpb.claim_bonus'))
wurzelBot.get_daily_bonuses()
# Process Wimp Customers in Gardens
# BG-Изпълни нуждите на Wimps в градините
print(i18n.t('wimpb.process_wimps'))
wurzelBot.sell_to_wimps()
# Play minigames
print('Playing minigames...')
wurzelBot.minigames.play()
finally:
# Close connection
# BG-Затваряне на връзката
wurzelBot.logout()
if __name__ == "__main__":
main()