CS:GO 个人武器 StatTrak™ 记录
我对数据十分着迷,所以在玩游戏的时候,我也会想方设法地去记录各种各样的数据,或许这只是为了证明我来过,想在这个世界上留下一些痕迹,当然,我也很喜欢 Steam 中记录游戏时长的行为。在 CS:GO 中,官方有 StatTrak™ 计数器武器可以记录在游戏中击败玩家的数目,所以在 2020-11-02 12:17:04
起,我就开始将自己使用的武器全部替换为 StatTrak™,前后花了大概 100 多元。以下是将 StatTrak™ 计数器整合的代码,结果见最后。最后需要说明的是,由于前几天放松打休闲时又碰到外挂,因此短时间内我不会再碰 CS:GO 了。
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 | import pandas as pd
import requests
url = 'https://steamcommunity.com/inventory/76561199070253926/730/2'
params = {'l': 'schinese', 'count': 999}
data = requests.get(url, params=params).json()
weapons = []
stat_prefix = 'StatTrak™ 已认证杀敌数:'
icon_prefix = 'https://community.cloudflare.steamstatic.com/economy/image/'
for description in data['descriptions']:
for text in description['descriptions']:
if text['value'].startswith(stat_prefix):
weapons.append({
'name': description['market_name'],
'hash': description['market_hash_name'],
'stat': int(text['value'][len(stat_prefix):]),
'icon': icon_prefix + description['icon_url'],
})
weapons.sort(key=lambda x: x['stat'], reverse=True)
df = pd.DataFrame.from_dict(weapons)
df['hash'] = df['hash'].apply(lambda x: x.replace('|', '|'))
df['icon'] = df['icon'].apply(lambda x: f'![]({x})')
print(
df
.drop(columns=['name'])
.rename(columns={
'hash': 'Name',
'stat': 'StatTrak™',
'icon': 'Image',
})
.to_markdown(index=False)
)
|
Name |
StatTrak™ |
Image |
StatTrak™ AWP | Phobos (Field-Tested) |
20997 |
|
StatTrak™ AK-47 | Uncharted (Field-Tested) |
15836 |
|
StatTrak™ M4A4 | Evil Daimyo (Field-Tested) |
7113 |
|
StatTrak™ MAG-7 | Sonar (Minimal Wear) |
4849 |
|
StatTrak™ MP9 | Modest Threat (Battle-Scarred) |
3456 |
|
StatTrak™ Desert Eagle | Blue Ply (Well-Worn) |
3319 |
|
StatTrak™ P90 | Freight (Battle-Scarred) |
2990 |
|
StatTrak™ Five-SeveN | Flame Test (Field-Tested) |
2965 |
|
StatTrak™ Tec-9 | Fubar (Battle-Scarred) |
2076 |
|
StatTrak™ AUG | Triqua (Well-Worn) |
1982 |
|
StatTrak™ USP-S | Flashback (Field-Tested) |
1913 |
|
StatTrak™ MAC-10 | Carnivore (Well-Worn) |
1578 |
|
StatTrak™ SSG 08 | Slashed (Well-Worn) |
1423 |
|
StatTrak™ Glock-18 | Off World (Well-Worn) |
1200 |
|
StatTrak™ Negev | Dazzle (Field-Tested) |
1115 |
|
StatTrak™ SG 553 | Aloha (Field-Tested) |
905 |
|
StatTrak™ MP7 | Mischief (Well-Worn) |
659 |
|
StatTrak™ P250 | Ripple (Field-Tested) |
624 |
|
StatTrak™ Sawed-Off | Origami (Field-Tested) |
487 |
|
StatTrak™ SCAR-20 | Blueprint (Battle-Scarred) |
486 |
|
StatTrak™ XM1014 | Slipstream (Field-Tested) |
460 |
|
StatTrak™ FAMAS | Decommissioned (Field-Tested) |
405 |
|
StatTrak™ Galil AR | Rocket Pop (Battle-Scarred) |
365 |
|
StatTrak™ PP-Bizon | Night Riot (Field-Tested) |
355 |
|
StatTrak™ G3SG1 | Orange Crash (Field-Tested) |
170 |
|
StatTrak™ R8 Revolver | Crimson Web (Field-Tested) |
93 |
|