-
Notifications
You must be signed in to change notification settings - Fork 8
/
Weapon.py
17 lines (16 loc) · 828 Bytes
/
Weapon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import requests
import json
class weapon:
def __init__(self, uuid: str, cost: int):
self.uuid = uuid
self.cost = cost
self.weapon_id = None
with open('assets/dict/zh_CN.json') as f:
data = json.loads(f.read())
f.close()
self.name = requests.get(f'https://valorant-api.com/v1/weapons/skinlevels/{self.uuid}?language=zh-CN', timeout=30).json()['data']['displayName']
self.uid = data[self.name] # the real series skin uuid for the weapon, not a level uuid
self.data = requests.get(f'https://valorant-api.com/v1/weapons/skins/{self.uid}?language=zh-CN', timeout=30).json()['data']
self.level = self.data['levels'] # Skin Levels
self.chroma = self.data['chromas'] # Skin Chromas
self.base_img = self.data['displayIcon']