MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / parseItemCollectable

Method parseItemCollectable

source/game/StarCollectionDatabase.cpp:109–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109Collectable CollectionDatabase::parseItemCollectable(String const& name, Json const& config) const {
110 Collectable collectable = parseGenericCollectable(name, config);
111 auto itemDatabase = Root::singleton().itemDatabase();
112 auto item = itemDatabase->itemShared(ItemDescriptor(config.getString("item")));
113
114 collectable.title = item->friendlyName();
115 collectable.description = item->description();
116
117 if (config.contains("icon")) {
118 collectable.icon = config.getString("icon");
119 } else {
120 auto inventoryIcon = item->instanceValue("inventoryIcon", "");
121 if (inventoryIcon.isType(Json::Type::String))
122 collectable.icon = AssetPath::relativeTo(itemDatabase->itemConfig(item->name(), JsonObject()).directory, inventoryIcon.toString());
123 }
124
125 return collectable;
126}
127
128}

Callers

nothing calls this directly

Calls 13

singletonClass · 0.85
ItemDescriptorClass · 0.85
itemDatabaseMethod · 0.80
itemSharedMethod · 0.80
getStringMethod · 0.80
instanceValueMethod · 0.80
friendlyNameMethod · 0.45
descriptionMethod · 0.45
containsMethod · 0.45
isTypeMethod · 0.45
itemConfigMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected