This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoL_Data_Tool.py
67 lines (54 loc) · 1.77 KB
/
LoL_Data_Tool.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
from typing import List
# caution, ugly code |
# V
def read_store_transactions() -> List[List[str]]:
fp = file_check("storeTransactions.json")
lines = fp.readlines()
amnt = int((len(lines) - 1) / 12)
batches = [list(lines[i * 12 + 1:i * 12 + 13]) for i in range(amnt)]
fp.close()
return batches
def check_rp_spent():
sum_spent = 0
sum_bought = 0
for i in range(len(batches_global)):
txt = batches_global[i][5]
val = int(txt[9:len(txt) - 2])
if val < 0:
sum_spent -= val
if val > 0:
sum_bought += val
print("RP Bought: {:d}".format(sum_bought))
print("RP Spent: {:d}\n".format(sum_spent))
def check_ip_spent():
sum_ip = 0
for i in range(len(batches_global)):
txt = batches_global[i][4]
val = int(txt[9:len(txt) - 2])
sum_ip -= val
print("IP Spent: {:d}\n".format(sum_ip))
def check_money_spent():
sum_money = 0
fp = file_check("rpPurchases.json")
lines = fp.readlines()
amnt = int((len(lines) - 1) / 12)
batches = [list(lines[i * 12 + 1:i * 12 + 13]) for i in range(amnt)]
fp.close()
for i in range(len(batches)):
txt = batches[i][8]
sum_money += float(txt[13:len(txt) - 2])
print("Money Spent: {:.0f} (of your currency)\n".format(sum_money))
def file_check(name: str):
try:
fn = open(name)
except IOError:
print(
"Error: '{:s}' does not exist in the current directory.\n\nMove the executable/script into your Data Folder.\n".format(name))
input("PRESS ENTER TO CONTINUE")
raise SystemExit
return fn
batches_global = read_store_transactions()
check_rp_spent()
check_ip_spent()
check_money_spent()
input("PRESS ENTER TO CONTINUE.")