|
@@ -8,42 +8,44 @@ import view
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
|
- status = model.get_loot_level()
|
|
|
|
|
- # print(status)
|
|
|
|
|
- old_status = 0
|
|
|
|
|
- write_file_next = False
|
|
|
|
|
- try:
|
|
|
|
|
- old_status_file = open('status.json', 'r')
|
|
|
|
|
- if old_status_file.mode == 'r':
|
|
|
|
|
- old_status_raw = old_status_file.read()
|
|
|
|
|
- if old_status_raw:
|
|
|
|
|
- old_status_json = json.loads(old_status_raw)
|
|
|
|
|
- old_status = int(old_status_json['integer'])
|
|
|
|
|
- else:
|
|
|
|
|
- write_file_next = True
|
|
|
|
|
- old_status_file.close()
|
|
|
|
|
- except FileNotFoundError:
|
|
|
|
|
- empty_status_file = open('status.json', 'w+')
|
|
|
|
|
- print('Created new file ... Exiting')
|
|
|
|
|
- empty_status_file.close()
|
|
|
|
|
- sys.exit(1)
|
|
|
|
|
- # print(old_status)
|
|
|
|
|
- send_message = False
|
|
|
|
|
- # print('if old_status {} != status[1] {}'.format(old_status, status[1]))
|
|
|
|
|
- assert type(old_status) is int, f"old_status {old_status} is not an integer: {type(old_status)}"
|
|
|
|
|
- assert type(status['integer']) is int, f"status['integer'] {status['integer']} is not an integer: {type(status['integer'])}"
|
|
|
|
|
- if old_status != status['integer']:
|
|
|
|
|
- write_file_next = True
|
|
|
|
|
- send_message = True
|
|
|
|
|
- # print('write_file_next: {}'.format(write_file_next))
|
|
|
|
|
- if write_file_next:
|
|
|
|
|
- # summary = {'text': status["status"], 'roman': status["roman"], 'integer': status["integer"]}
|
|
|
|
|
- pprint(status)
|
|
|
|
|
- summary_json = json.dumps(status, indent=2)
|
|
|
|
|
- print(summary_json)
|
|
|
|
|
- write_file = open('status.json', 'w')
|
|
|
|
|
- write_file.write(summary_json)
|
|
|
|
|
- write_file.close()
|
|
|
|
|
|
|
+ for id in [4, 15]:
|
|
|
|
|
+ status = model.get_loot_level(id)
|
|
|
|
|
+ # print(status)
|
|
|
|
|
+ old_status = 0
|
|
|
|
|
+ write_file_next = False
|
|
|
|
|
+ try:
|
|
|
|
|
+ old_status_file = open(f'status-{id}.json', 'r')
|
|
|
|
|
+ if old_status_file.mode == 'r':
|
|
|
|
|
+ old_status_raw = old_status_file.read()
|
|
|
|
|
+ if old_status_raw:
|
|
|
|
|
+ old_status_json = json.loads(old_status_raw)
|
|
|
|
|
+ old_status = int(old_status_json['integer'])
|
|
|
|
|
+ else:
|
|
|
|
|
+ write_file_next = True
|
|
|
|
|
+ old_status_file.close()
|
|
|
|
|
+ except FileNotFoundError:
|
|
|
|
|
+ empty_status_file = open(f'status-{id}.json', 'w+')
|
|
|
|
|
+ print('Created new file ... Exiting')
|
|
|
|
|
+ empty_status_file.close()
|
|
|
|
|
+ sys.exit(1)
|
|
|
|
|
+ # print(old_status)
|
|
|
|
|
+ send_message = False
|
|
|
|
|
+ # print('if old_status {} != status[1] {}'.format(old_status, status[1]))
|
|
|
|
|
+ assert type(old_status) is int, f"old_status {old_status} is not an integer: {type(old_status)}"
|
|
|
|
|
+ assert type(status['integer']) is int, f"status['integer'] {status['integer']} is not an integer: {type(status['integer'])}"
|
|
|
|
|
+ if old_status != status['integer']:
|
|
|
|
|
+ write_file_next = True
|
|
|
|
|
+ send_message = True
|
|
|
|
|
+ # print('write_file_next: {}'.format(write_file_next))
|
|
|
|
|
+ if write_file_next:
|
|
|
|
|
+ # summary = {'text': status["status"], 'roman': status["roman"], 'integer': status["integer"]}
|
|
|
|
|
+ pprint(status)
|
|
|
|
|
+ summary_json = json.dumps(status, indent=2)
|
|
|
|
|
+ print(summary_json)
|
|
|
|
|
+ write_file = open(f'status-{id}.json', 'w')
|
|
|
|
|
+ write_file.write(summary_json)
|
|
|
|
|
+ write_file.close()
|
|
|
|
|
+ write_file.close()
|
|
|
|
|
|
|
|
- if send_message:
|
|
|
|
|
- view.send_message(status['integer'])
|
|
|
|
|
|
|
+ if send_message:
|
|
|
|
|
+ view.send_message(status)
|