-
Notifications
You must be signed in to change notification settings - Fork 8
Description
This is not only about improvements on variants, but also a feature request for set items.
I include them together as they are somewhat related.
Problem
- Variant items do not have any info on other variant items, requiring additional API request to find all variant items.
base_variant
is included regardless of whethervariants
is included as relation.- Unnecessary variant item data (such as
type
,sub_type
,manufacturer
, etc.) are the same across variant items. - Variant names (e.g.
Aqua
) are desired for display purposes. - Set items (e.g. finding other pieces of an armor piece) are desired.
Proposed solution
We can add a related_items
key that incorporate all the related items of the current item.
It can be set as a valid_relations
so it can be selectively included to reduce the size of the API request.
Example output for Lynx Arms Red
:
{
"related_items": {
"set_name": "Lynx Arms",
"base_item": {
"uuid": "48609392-c78c-4909-8714-387900059785",
"name": "Lynx Arms Base",
"variant_name": "Base",
"link": "https://api.star-citizen.wiki/api/v2/items/48609392-c78c-4909-8714-387900059785"
},
"variant_items": [
{
"uuid": "07244e7f-81af-428e-a49e-ae1b9a940997",
"name": "Lynx Arms Aqua",
"variant_name": "Aqua",
"link": "https://api.star-citizen.wiki/api/v2/items/07244e7f-81af-428e-a49e-ae1b9a940997"
},
{
"uuid": "fd7ca539-4462-43b4-b3b4-8f6246dc0362",
"name": "Lynx Arms Black",
"variant_name": "Black",
"link": "https://api.star-citizen.wiki/api/v2/items/fd7ca539-4462-43b4-b3b4-8f6246dc0362"
}
],
"set_items": [
{
"uuid": "c94881f7-6ce1-4fb3-8bd7-018e71d1d19a",
"name": "Oracle Helmet Red",
"type": "Char_Armor_Helmet",
"sub_type": "Light",
"link": "https://api.star-citizen.wiki/api/v2/items/c94881f7-6ce1-4fb3-8bd7-018e71d1d19a"
},
{
"uuid": "f345cdb7-287a-44aa-a588-0331848ac656",
"name": "Lynx Core Red",
"type": "Char_Armor_Core",
"sub_type": "Light",
"link": "https://api.star-citizen.wiki/api/v2/items/f345cdb7-287a-44aa-a588-0331848ac656"
},
{
"uuid": "60d89692-e306-46fb-8259-7bcca61f7deb",
"name": "Lynx Legs Red",
"type": "Char_Armor_Legs",
"sub_type": "Light",
"link": "https://api.star-citizen.wiki/api/v2/items/60d89692-e306-46fb-8259-7bcca61f7deb"
}
]
}
}
base_item
, variant_items
, and set_items
contain item objects that uses the following schema:
{
"uuid": "UUID of the item",
"name": "Name of the item",
"variant_name": "Variant name of the item, where the set_name is removed from the item name. Only included in variant_items",
"type": "Type of the item. Only included in set_items",
"sub_type": "Subtype of the item. Only included in set_items",
"link": "URL of the API"
}
set_items
represents a list of related items in the same set.
For clothing and armor, that will be other items that share the similar class names (e.g. Oracle Helmet Red (outlaw_legacy_armor_light_helmet_01_04_02
) is in the same set as Lynx Arms Red (outlaw_legacy_armor_light_arms_01_04_02
)).
It can be expanded to other item types in the future, like having different sizes of a vehicle component (e.g. M4A Cannon, M5A Cannon, etc.)
It can probably be found by checking if the class name exists:
For example, Lynx Arms Dark Red has a class name of
outlaw_legacy_armor_light_arms_01_04_13
.
Replacing thearms
part withhelmet
would yieldoutlaw_legacy_armor_light_helmet_01_04_13
, which is Oracle Helmet Dark Red.
With this method, we might have to hardcode what are the possible set item types.
There might be better way to handle this, but the class name method works.
variant_name
and set_name
can be found by comparing the names of the item,
it might be beneficial for build up a list of possible variant names for performance reason too.