-
Notifications
You must be signed in to change notification settings - Fork 0
/
TFedit.py
34 lines (25 loc) · 941 Bytes
/
TFedit.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
#!/usr/bin/env python3
import argparse
import pickle
import sys
from classes import *
# Manually set the ranking value of one or all players to a specific value and set status to ranked
# Usage: ./TFedit.py <playerid>|all <rank>
if __name__ == '__main__':
with open('data.pickle', 'rb') as data_file:
data = pickle.load(data_file)
player_id = sys.argv[1]
if player_id == 'del':
player = data.get_player(sys.argv[2])
data.players.remove(player)
else:
ranking_value = int(sys.argv[2])
if player_id == 'all':
for player in data.players:
player.rank = ranking_value
player.get_player(player_id).unranked = False
else:
data.get_player(player_id).rank = ranking_value
data.get_player(player_id).unranked = False
with open('data.pickle', 'wb') as data_file:
pickle.dump(data, data_file)