forked from rkhous/CSPM
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcspm_utils.py
More file actions
83 lines (72 loc) · 2.38 KB
/
cspm_utils.py
File metadata and controls
83 lines (72 loc) · 2.38 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from pokemonlist import pokemon, pokejson, pokejson_by_name
import datetime
import calendar
import time
def find_pokemon_id(name):
if name == 'Egg':
return 0
elif name == 'Nidoran-F':
return 29
elif name == 'Nidoran-M':
return 32
elif name == 'Mr-Mime':
return 122
elif name == 'Ho-Oh':
return 250
elif name == 'Mime-Jr':
return 439
else:
return int(pokejson_by_name.get(name, 0))
def get_time(minute):
future = datetime.datetime.utcnow() + datetime.timedelta(minutes=minute)
return calendar.timegm(future.timetuple())
def get_team_id(raw_team):
gym_team_id = 0
if raw_team.isnumeric() and ( raw_team >= '0' ) and ( raw_team <= '3' ):
gym_team_id = int(raw_team)
else:
team_name = str(raw_team).capitalize()
if ( team_name in 'Mystic' ) or ( team_name in 'Blue' ):
gym_team_id = 1
elif ( team_name in 'Valor' ) or ( team_name in 'Red' ):
gym_team_id = 2
elif ( team_name in 'Instinct') or ( team_name in 'Yellow' ):
gym_team_id = 3
else:
gym_team_id = 0
return gym_team_id
def get_team_name(team_id):
if ( team_id == 1 ):
team_name = 'Mystic'
elif ( team_id == 2 ):
team_name = 'Valor'
elif ( team_id == 3 ):
team_name = 'Instinct'
else:
team_name = 'Unknown'
return team_name
MYSTIC_COLOR = 0x005ef7
VALOR_COLOR = 0xdb0000
INSTINCT_COLOR = 0xfcd00a
UNKNOWN_COLOR = 0xbcbcbc
def get_team_color(team_id):
if ( team_id == 1 ):
color = MYSTIC_COLOR
elif ( team_id == 2 ):
color = VALOR_COLOR
elif ( team_id == 3 ):
color = INSTINCT_COLOR
else:
color = UNKNOWN_COLOR
return color
LEVEL_1_2_EGG_URL = 'https://raw.githubusercontent.com/ZeChrales/PogoAssets/master/static_assets/png/ic_raid_egg_normal.png'
LEVEL_3_4_EGG_URL = 'https://raw.githubusercontent.com/ZeChrales/PogoAssets/master/static_assets/png/ic_raid_egg_rare.png'
LEVEL_5_EGG_URL = 'https://raw.githubusercontent.com/ZeChrales/PogoAssets/master/static_assets/png/ic_raid_egg_legendary.png'
def get_egg_url(egg_level):
if ( egg_level == '1' ) or ( egg_level == '2' ):
egg_url = LEVEL_1_2_EGG_URL
elif ( egg_level == '3' ) or ( egg_level == '4' ):
egg_url = LEVEL_3_4_EGG_URL
else:
egg_url = LEVEL_5_EGG_URL
return egg_url