Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/game_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ class GameData {
Given returned iteminfo, finds the item's min/max float, name, weapon type, and image url using CSGO game data
*/
addAdditionalItemProperties(iteminfo) {
if (!this.items_game || !this.items_game_cdn || !this.csgo_english) return;
// items_game_cdn is optional: SteamDatabase/GameTracking-CS2 no longer ships
// items_game_cdn.txt (see https://github.com/csfloat/inspect/issues/250), so it
// will permanently be false in practice. Only the imageurl field depends on it —
// everything else (floatvalue/paintseed/paintindex/names) only needs items_game
// and csgo_english, so we must not let a missing CDN file block enrichment.
if (!this.items_game || !this.csgo_english) return;

// Get sticker codename/name
const stickerKits = this.items_game.sticker_kits;
Expand Down Expand Up @@ -222,11 +227,13 @@ class GameData {
weapon_name = this.items_game['items'][iteminfo.defindex]['name'];
}

// Get the image url
let image_name = weapon_name + skin_name;
// Get the image url (best-effort: items_game_cdn is frequently unavailable upstream)
if (this.items_game_cdn) {
let image_name = weapon_name + skin_name;

if (image_name in this.items_game_cdn) {
iteminfo['imageurl'] = this.items_game_cdn[image_name];
if (image_name in this.items_game_cdn) {
iteminfo['imageurl'] = this.items_game_cdn[image_name];
}
}

// Get the paint data and code name
Expand Down