Compare commits

..

3 Commits

Author SHA1 Message Date
1a24228d8a Bump version: 0.1.1 → 0.1.2 2019-07-19 11:00:20 +03:00
4e89f57b92 default, all enabled config file 2019-07-19 11:00:08 +03:00
a2af70a3ef cli update 2019-07-19 10:59:45 +03:00
6 changed files with 68 additions and 32 deletions

36
config.json Normal file
View File

@ -0,0 +1,36 @@
{
"air": true,
"all_in": true,
"auto_buy_raw": true,
"auto_sell": [
"food",
"weapon",
"house",
"airplane",
"foodRaw",
"weaponRaw",
"houseRaw",
"airplaneRaw"
],
"auto_sell_all": true,
"boosters": true,
"continuous_fighting": true,
"debug": true,
"email": "",
"employ": true,
"epic_hunt": true,
"epic_hunt_ebs": true,
"fight": true,
"gold_buy": true,
"ground": true,
"interactive": true,
"next_energy": true,
"ot": true,
"password": "",
"random_sleep": true,
"rw_def_side": true,
"train": true,
"travel_to_fight": true,
"wam": true,
"work": true
}

View File

@ -4,7 +4,7 @@
__author__ = """Eriks Karls"""
__email__ = 'eriks@72.lv'
__version__ = '0.1.1'
__version__ = '0.1.2'
__all__ = ["Citizen"]
from erepublik_script import classes, utils

View File

@ -2,10 +2,6 @@
"""Console script for erepublik_script."""
__author__ = """Eriks Karls"""
__email__ = 'eriks@72.lv'
__version__ = '0.1.0'
import json
import os
import random
@ -23,12 +19,37 @@ from erepublik_script.citizen import Citizen
__all__ = ["Citizen"]
INTERACTIVE = True
CONFIG = defaultdict(bool)
@click.command()
def main(args=None):
@click.option('--silent', help='Run silently', type=bool, is_flag=True)
def main(silent):
global CONFIG
assert sys.version_info >= (3, 7, 1)
if silent:
write_log = utils.write_silent_log
else:
write_log = utils.write_interactive_log
try:
with open('config.json', 'r') as f:
CONFIG = json.load(f)
write_log('Config file found. Checking...')
CONFIG = utils.parse_config(CONFIG)
except:
CONFIG = utils.parse_config()
with open('config.json', 'w') as f:
json.dump(CONFIG, f, indent=True, sort_keys=True)
if CONFIG['interactive']:
write_log = utils.write_interactive_log
else:
write_log = utils.write_silent_log
write_log('\nTo quit press [ctrl] + [c]', False)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
write_log('Version: ' + utils.VERSION)
player = None
try: # If errors before player is initialized
while True:
@ -395,29 +416,7 @@ def main(args=None):
if __name__ == "__main__":
assert sys.version_info >= (3, 7, 1)
write_log = utils.write_silent_log
try:
with open('config.json', 'r') as f:
CONFIG = json.load(f)
write_log('Config file found. Checking...')
CONFIG = utils.parse_config(CONFIG)
except:
CONFIG = utils.parse_config()
with open('config.json', 'w') as f:
json.dump(CONFIG, f, indent=True, sort_keys=True)
if CONFIG['interactive']:
write_log = utils.write_interactive_log
else:
write_log = utils.write_silent_log
write_log('\nTo quit press [ctrl] + [c]', False)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
write_log('Version: ' + utils.VERSION)
while True:
main()
write_log("Restarting after 1h")
utils.write_interactive_log("Restarting after 1h")
utils.interactive_sleep(60 * 60)

View File

@ -4,3 +4,4 @@ PyInstaller==3.4
python-slugify==2.0.1
pytz==2018.9
requests==2.21.0
Click>=6.0

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.1
current_version = 0.1.2
commit = True
tag = True

View File

@ -45,6 +45,6 @@ setup(
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/eeriks/erepublik_script',
version='0.1.1',
version='0.1.2',
zip_safe=False,
)