蒸汽网页API得到物品标签(TF2) [英] Steam web api get items tag (TF2)
问题描述
我试图从一些项目获得的标签,但我不能找到给我这些标签功能..
我使用 GetPlayerItems
从蒸汽网络API来获取玩家的物品,但它不会给我
该项目的标签,我应该怎么办?
I am trying to get the tags from some items but i cant find a function that give me these tags..
I am using GetPlayerItems
from the steam web API to get the player items but it wont give me
the item tags, what should i do?
有没有办法给我的标签?
is there a way to give me the tags?
和我有另外一个问题,
有没有拉项目的图像的快速方法?不是通过将其存储在我的服务器?
我的意思是想通过蒸汽服务器或东西的URL的图像。
and i have another question, is there a fast way to pull the image of the item? not by storing it on my server? i mean like an URL to the image through steam server or something..
我曾尝试的getSchema
查找信息的项目,但我真的不得到它是如何工作的。
i have tried GetSchema
to find information for an item but i dont really get how it works.
谢谢!
推荐答案
您需要合并两个不同的API调用到GetPlayerItems链接到这些数据的实际意义。
You need to combine two separate API calls to link the GetPlayerItems to what the data actually means.
您执行 GetPlayerItems
调用和返回数据。在返回的数据,你会遍历结果['项目']
来得到玩家的物品列表。
Perform you GetPlayerItems
call and return data. In the return data, you will iterate over result['items']
to get a listing of the player items.
这是阵列中的一个项目可能是这样的:
One item in that array may look like this:
{
"id": 493336261,
"original_id": 493336261,
"defindex": 5050,
"level": 50,
"quality": 6,
"inventory": 2147483948,
"quantity": 1,
"origin": 2,
"attributes": [
{
"defindex": 195,
"value": 1065353216,
"float_value": 1.000000
}
]
},
使用这些数据,您可以使用返回的 defindex
看结果['项目']
阵列从的getSchema
电话。你将不得不通过每个这些项目的迭代比较 GetPlayerItems
defindex到的getSchema
defindex。当它匹配你必须知道这个项目是什么。
Using this data, you can use the defindex
to look at the result['items']
array returned from your GetSchema
call. You will have to iterate through each of those items comparing the GetPlayerItems
defindex to the GetSchema
defindex. When it matches you have know what the item is.
在上述情况下, 5050
是背包扩展
。您可以通过查看拉此项目的形象 IMAGE_URL
或 image_url_large
上的值的getSchema
匹配。
In the above case, 5050
is a Backpack Expander
. You can pull the image for this item by looking at the image_url
or image_url_large
values on the GetSchema
match.
有关你提到的,我假设你的意思属性
的标签。这些可以按照类似的过程,但对的getSchema
结果['属性']
阵列,而不是匹配匹配。同样,你将通过所有具有循环和比较 defindex
值。
For the "tags" that you mention, I am assuming you mean attributes
. These can be matched by following a similar process, but instead matching against the GetSchema
result['attributes']
array. Again, you'll have to loop through all and compare defindex
values.
对于上面的例子,与属性 defindex = 195
匹配这个:
For the above example, the attribute with defindex = 195
matches this:
{
"name": "always tradable",
"defindex": 195,
"attribute_class": "always_tradable",
"description_string": "#Attrib_Always_Tradable",
"description_format": "value_is_additive",
"effect_type": "negative",
"hidden": true,
"stored_as_integer": false
},
的 float_value
的 1.0
在 GetPlayerItems
属性表明该对象具有属性。所以,这个背包扩展始终流通。
The float_value
of 1.0
in the GetPlayerItems
attributes indicates that this object has that attribute. So, this backpack expander is always tradable.
这篇关于蒸汽网页API得到物品标签(TF2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!