dsjj15012 2014-04-20 18:57
浏览 70
已采纳

使用php和api显示蒸汽库存

At the moment im getting a json reponse when i query http://api.steampowered.com/IEconItems_{appid}/GetPlayerItems/v0001/?key={apikey}&steamid={steamid}&format=json

The problem however is that i dont know what to do with this reponse without any aditional info that i cant find anywhere. A part of response im getting when looking at my own cs:go inventory:

            {
            "id": 235322185,
            "original_id": 190991409,
            "defindex": 19,
            "level": 1,
            "quality": 4,
            "inventory": 70,
            "quantity": 1,
            "rarity": 4,
            "attributes": [
                {
                    "defindex": 6,
                    "value": 1130627072,
                    "float_value": 228
                },
                {
                    "defindex": 7,
                    "value": 1148436480,
                    "float_value": 975
                },
                {
                    "defindex": 8,
                    "value": 1031063904,
                    "float_value": 0.059762358665466309
                },
                {
                    "defindex": 147,
                    "value": "models\/weapons\/stattrack.mdl"
                },
                {
                    "defindex": 145,
                    "value": "models\/weapons\/w_smg_p90_mag.mdl"
                }
            ]

        },
        {
            "id": 236527226,
            "original_id": 236502674,
            "defindex": 27,
            "level": 1,
            "quality": 9,
            "inventory": 82,
            "quantity": 1,
            "rarity": 3,
            "attributes": [
                {
                    "defindex": 6,
                    "value": 1133608960,
                    "float_value": 291
                },
                {
                    "defindex": 7,
                    "value": 1142240880,
                    "float_value": 596.8505859375
                },
                {
                    "defindex": 8,
                    "value": 994750258,
                    "float_value": 0.0030927178449928761
                },
                {
                    "defindex": 80,
                    "value": 0,
                    "float_value": 0
                },
                {
                    "defindex": 81,
                    "value": 0,
                    "float_value": 0
                },
                {
                    "defindex": 147,
                    "value": "models\/weapons\/stattrack.mdl"
                },
                {
                    "defindex": 145,
                    "value": "models\/weapons\/w_shot_mag7_mag.mdl"
                }
            ]

        },
        {
            "id": 236529059,
            "original_id": 136971214,
            "defindex": 35,
            "level": 1,
            "quality": 4,
            "inventory": 77,
            "quantity": 1,
            "rarity": 2,
            "attributes": [
                {
                    "defindex": 6,
                    "value": 1077936128,
                    "float_value": 3
                },
                {
                    "defindex": 7,
                    "value": 1141712676,
                    "float_value": 564.611572265625
                },
                {
                    "defindex": 8,
                    "value": 1031160533,
                    "float_value": 0.060122329741716385
                },
                {
                    "defindex": 147,
                    "value": "models\/weapons\/stattrack.mdl"
                }
            ]

        }

The id's correnspond with the weapons and the rarity and quantity makes sense too. But i cant be expected to manually find every id of every weapon in every state right? Am i missing a different API that i can use to see what weapon corrensponds with what id?

ps: Sorry for bad english

  • 写回答

3条回答 默认 最新

  • dso407787736 2014-04-20 20:47
    关注

    You will call the GetSchema to determine which items these are. You'll compare DefIndex values against the ones returned by GetSchema

    Your work flow will look like this:

    • Call GetSchema and store result of result['items'] some place to look up later
    • Call your current call and parse through the items. For each item, look up a result in your stored value from above
    • GetSchema also has rarities and other values you may need (ie. those attributes)
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀