inspect icon indicating copy to clipboard operation
inspect copied to clipboard

Add support keychain and Bumps globaloffensive from 3.1.0 to 3.2.0.

Open wangxingzhen opened this issue 1 year ago • 6 comments

Summary of Changes:

  • Bumped globaloffensive from 3.1.0 to 3.2.0.
  • Bumped steam-user from 4.29.1 to 5.2.0.
  • Added support for keychains in item data.

Detailed Changes:

  • globaloffensive v3.2.0 now supports keychains: The keychains field has been added to the items table to store keychain data. Each keychain has a unique identifier, similar to paintseed and paintindex.
  • steam-user upgrade to 5.2.0: This upgrade resolves a known issue where the app would quit unexpectedly due to a buffer-related error. More details can be found here: RangeError: err_buffer_out_of_bounds.
  • The keychains field is added to the items table to store the keychain data, because each keychain has a unique number similar to paintseed and paintindex.

Example of Keychain Data:

{
    "iteminfo": {
        "stickers": [],
        "keychains": [
            {
                "slot": 0,
                "sticker_id": 26,
                "pattern": 34826,
                "name": "Backsplash"
            }
        ],
        "itemid": "39944764900",
        "defindex": 1355,
        "paintindex": 0,
        "rarity": 3,
        "quality": 4,
        "paintseed": 0,
        "inventory": 256,
        "origin": 0,
        "s": "76561198291921905",
        "a": "39944764900",
        "d": "2795652543548536571",
        "m": "0",
        "floatvalue": 0,
        "high_rank": 1,
        "low_rank": 1,
        "min": 0.06,
        "max": 0.8,
        "weapon_type": "Charm",
        "item_name": "-",
        "rarity_name": "High Grade",
        "quality_name": "Unique",
        "origin_name": "Timed Drop",
        "full_item_name": "Charm | Backsplash"
    }
}

Example of a Weapon with Keychain Data:

{
    "iteminfo": {
        "origin": 8,
        "quality": 9,
        "rarity": 3,
        "a": "39944034003",
        "d": "7514256289686965781",
        "paintseed": 238,
        "defindex": 19,
        "paintindex": 335,
        "stickers": [
            {
                "stickerId": 6704,
                "slot": 1,
                "wear": 1,
                "codename": "paris2023_team_blst",
                "material": "paris2023/blst",
                "name": "BLAST.tv | Paris 2023"
            },
            {
                "stickerId": 6680,
                "slot": 2,
                "wear": 0.45351898670196533,
                "codename": "paris2023_team_ence",
                "material": "paris2023/ence",
                "name": "ENCE | Paris 2023"
            },
            {
                "stickerId": 7049,
                "slot": 3,
                "wear": 0.24873122572898865,
                "codename": "paris2023_signature_woro2k_1",
                "material": "paris2023/sig_woro2k",
                "name": "Woro2k | Paris 2023"
            },
            {
                "stickerId": 7242,
                "slot": 2,
                "rotation": 18,
                "offset_x": -0.6566545963287354,
                "offset_y": -0.028296619653701782,
                "codename": "paper_angry_t",
                "material": "community/community_2024/paper_angry_t",
                "name": "Angry T"
            },
            {
                "stickerId": 7663,
                "slot": 2,
                "offset_x": -0.5516186952590942,
                "offset_y": -0.06244167685508728,
                "codename": "cph2024_signature_isak_1",
                "material": "cph2024/sig_isak",
                "name": "isak | Copenhagen 2024"
            }
        ],
        "floatid": "39944034003",
        "keychains": [
            {
                "sticker_id": 32,
                "slot": 0,
                "pattern": 59677,
                "name": "Stitch-Loaded",
                "offset_x": 8.399561882019043,
                "offset_y": 1.0077831745147705,
                "offset_z": 6.040674686431885
            }
        ],
        "low_rank": 1,
        "high_rank": 1,
        "killeatervalue": 0,
        "floatvalue": 0.060655467212200165,
        "s": "76561198291921905",
        "m": "0",
        "imageurl": "http://media.steampowered.com/apps/730/icons/econ/default_generated/weapon_p90_an_royalbleed_light_large.58dfb4851908d78c31e205477793a620923737db.png",
        "min": 0,
        "max": 0.35,
        "weapon_type": "P90",
        "item_name": "Module",
        "rarity_name": "Mil-Spec Grade",
        "quality_name": "StatTrak™",
        "origin_name": "Found in Crate",
        "wear_name": "Factory New",
        "full_item_name": "StatTrak™ P90 | Module (Factory New)"
    }
}

Thanks for the review!

wangxingzhen avatar Oct 11 '24 12:10 wangxingzhen

Hi @wangxingzhen, thanks for you precious work. I noticed the cache mechanism for charms is being skipped entirely because of their float value being equal to 0. You can easily fix this by expanding the check responsible to skip the postgres table INSERT operation in postgres.js (your code, as the original one from @Step7750, is covering only the Vanilla Karambit special case): if (item.floatvalue <= 0 && item.defindex !== 507 && item.defindex !== 1355) ...

I might be wrong but the defindex for charms should always be that 1355 value

cheers, gaelsuv

EDIT: there's more stuff to do but modifying that check is a must

Hi @gaelsuv .First of all, thank you for your feedback. I believe you’re referring to the cache handling of charms data. I added item.defindex !== 1355 because charms have a pattern field, similar to weapon paintseed, and I think it's necessary to cache them. Without this condition, charms would skip caching.

Additionally, I noticed that globaloffensive returns stickerId for stickers but sticker_id for keychains. Should we unify these fields? Looking forward to your thoughts.

Please let me know if I understood your suggestion correctly. Since my English isn't perfect, I want to make sure I didn't miss any important details. Thanks again for your feedback. I appreciate your patience and look forward to your response.

wangxingzhen avatar Oct 17 '24 06:10 wangxingzhen

Hi @wangxingzhen, thanks for you precious work. I noticed the cache mechanism for charms is being skipped entirely because of their float value being equal to 0. You can easily fix this by expanding the check responsible to skip the postgres table INSERT operation in postgres.js (your code, as the original one from @Step7750, is covering only the Vanilla Karambit special case): if (item.floatvalue <= 0 && item.defindex !== 507 && item.defindex !== 1355) ... I might be wrong but the defindex for charms should always be that 1355 value cheers, gaelsuv EDIT: there's more stuff to do but modifying that check is a must

Hi @gaelsuv .First of all, thank you for your feedback. I believe you’re referring to the cache handling of charms data. I added item.defindex !== 1355 because charms have a pattern field, similar to weapon paintseed, and I think it's necessary to cache them. Without this condition, charms would skip caching.

Additionally, I noticed that globaloffensive returns stickerId for stickers but sticker_id for keychains. Should we unify these fields? Looking forward to your thoughts.

Please let me know if I understood your suggestion correctly. Since my English isn't perfect, I want to make sure I didn't miss any important details. Thanks again for your feedback. I appreciate your patience and look forward to your response.

Hello @wangxingzhen, I've deleted my comment because I was facing a completely different problem coming from my client interaction with the API response. I might have spotted a different bug though: are we sure the current upsert logic on items table is correct? I noticed the merge tuple is (defindex, paintindex, paintwear, paintseed), which for charms right now should be always (1355, 0, 0, 0). Am I missing something?

thanks

EDIT: expanding the items unique index and the ON CONFLICT clause under table INSERT to also include keychains->0->>'pattern' seems to solve the issue on my installation, but this has to be thoroughly tested on a clean environment (and mine is not lol)

gaelsuv avatar Oct 18 '24 06:10 gaelsuv

I am trying to inspect charm on steam (steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M5252977499532233326A39982530324D12117712579169360507), and I am getting response without charm pattern. { "iteminfo": { "stickers": [], "itemid": "39982530324", "defindex": 1355, "paintindex": 0, "rarity": 4, "quality": 4, "paintseed": 0, "inventory": 125, "origin": 0, "s": "0", "a": "39982530324", "d": "12117712579169360507", "m": "5252977499532233326", "floatvalue": 0, "min": 0.06, "max": 0.8, "weapon_type": "Charm", "item_name": "-", "rarity_name": "Remarkable", "quality_name": "Unique", "origin_name": "Timed Drop", "full_item_name": "Charm" } } How can I get pattern or it is not possible?

Also trying to inspect skin with Charm (steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561199175645974A39945477466D4676502401872163723) that's response: { "error": "Valve's servers didn't reply in time", "code": 4, "status": 500 }

SPr3D avatar Oct 18 '24 10:10 SPr3D

I am trying to inspect charm on steam (steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20M5252977499532233326A39982530324D12117712579169360507), and I am getting response without charm pattern. { "iteminfo": { "stickers": [], "itemid": "39982530324", "defindex": 1355, "paintindex": 0, "rarity": 4, "quality": 4, "paintseed": 0, "inventory": 125, "origin": 0, "s": "0", "a": "39982530324", "d": "12117712579169360507", "m": "5252977499532233326", "floatvalue": 0, "min": 0.06, "max": 0.8, "weapon_type": "Charm", "item_name": "-", "rarity_name": "Remarkable", "quality_name": "Unique", "origin_name": "Timed Drop", "full_item_name": "Charm" } } How can I get pattern or it is not possible?

Also trying to inspect skin with Charm (steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561199175645974A39945477466D4676502401872163723) that's response: { "error": "Valve's servers didn't reply in time", "code": 4, "status": 500 }

It seems that your code does not utilize the code from this PR.

wangxingzhen avatar Oct 19 '24 16:10 wangxingzhen

    "keychains": [
        {
            "sticker_id": 32,
            "slot": 0,
            "pattern": 59677,
            "name": "Stitch-Loaded",
            "offset_x": 8.399561882019043,
            "offset_y": 1.0077831745147705,
            "offset_z": 6.040674686431885
        }

This is cool, but maybe naming the field "paintseed" instead of "pattern". It confuses my code :)

OlegBarspinov avatar Oct 19 '24 19:10 OlegBarspinov

    "keychains": [
        {
            "sticker_id": 32,
            "slot": 0,
            "pattern": 59677,
            "name": "Stitch-Loaded",
            "offset_x": 8.399561882019043,
            "offset_y": 1.0077831745147705,
            "offset_z": 6.040674686431885
        }

This is cool, but maybe naming the field "paintseed" instead of "pattern". It confuses my code :)

At first, I was as confused as you, and I was also entangled, but the cs2 proto code was named like this, and I chose to be consistent with cs2. IMG_7738

wangxingzhen avatar Oct 20 '24 03:10 wangxingzhen

Guys, will you finish this PR?

Thanks for this repo!

Kikky avatar Nov 28 '24 15:11 Kikky

Thanks for this repo!

Hi, thank you for your interest! I’ve already submitted the PR, and it’s currently waiting for the author’s review. I’m looking forward to any feedback or suggestions from them. Thanks again for supporting this repo!

wangxingzhen avatar Nov 29 '24 02:11 wangxingzhen

@Step7750 Hi, can you please review changes and approbe this PR, also waiting this. Thanks!

alter-wave avatar Dec 16 '24 12:12 alter-wave

Also patiently waiting for the approval of this PR :)

jmgsilva avatar Dec 29 '24 15:12 jmgsilva