-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnew_stat_helper.py
44 lines (39 loc) · 2.22 KB
/
new_stat_helper.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
def create_code(new_stats):
templates = {
'schema.sql > create table': " `{statname}` bigint(20) unsigned DEFAULT NULL,\n",
'schema.sql > stored procedure': " `stats`.`{statname}`,\n",
'Stat.py > fields': ", {statnodash}",
'Stat.py > db_load()': " self.{statnodash} = row.{statnodash}\n",
'Stat.py > table_load()': " self.{statnodash} = row.get('{statname}', 0)\n",
'Stat.py > save(1)': " {statbacktick}='{{{statnodash}}}',\n",
'Stat.py > save(2)': " {statbacktick}='{{{statnodash}}}',\n",
'agent_stats.py > get_stats() > definitions': " '{statname}': '({description})',\n",
'agent_stats.py > get_badges() > categories (or 3 tier categories) (skip if not officialy badged stat)': " '{statname}': [{tiers}],\n",
'agent_stats.py > summary() > headers (skip if not officialy badged stat)': " '{statnodash}',\n",
'agent_stats.py > summary() > sql_before & sql_after (skip if not officialy badged stat)': ", {statname}",
'templates': "{{{{ high_scores(chart{stattemplate}) -}}}}\n"}
for place, template in templates.items():
print(place + ':')
for stat, description, tiers in new_stats:
stat_dict = {'description': description,
'tiers': ', '.join([tier.strip().replace(',', '') for tier in tiers.split('\t')[1:] if tier != 'N/A']),
'statname': stat,
'statnodash': stat.replace('-', '_'),
'statbacktick': f'`{stat}`' if '-' in stat else stat,
'stattemplate': f"['{stat}']" if '-' in stat else f'.{stat}',
}
print(template.format(**stat_dict), end='')
print('\n')
#https://www.agent-stats.com/faq.php
#copy the new stat(s) from the table and paste them here as is
a = '''cryptic_memories_op
Cryptic Memories Global Op Points
1,500 15,000 N/A N/A N/A
research_bounties
Research Bounties Completed
50 150 500 1,500 5,000
research_days
Research Days Completed
15 30 60 180 360'''
it = iter(a.split('\n'))
create_code(list(zip(it, it, it)))