| 201 | } |
| 202 | |
| 203 | void CraftingPane::upgradeTable() { |
| 204 | if (m_sourceEntityId != NullEntityId) { |
| 205 | // Checks that the upgrade path exists |
| 206 | if (m_upgradeRecipe) { |
| 207 | if (m_player->isAdmin() || ItemDatabase::canMakeRecipe(*m_upgradeRecipe, m_player->inventory()->availableItems(), m_player->inventory()->availableCurrencies())) { |
| 208 | if (!m_player->isAdmin()) |
| 209 | consumeIngredients(*m_upgradeRecipe, 1); |
| 210 | |
| 211 | // upgrade the old table |
| 212 | m_worldClient->sendEntityMessage(m_sourceEntityId, "requestUpgrade"); |
| 213 | |
| 214 | // unlock any recipes specified |
| 215 | if (auto recipeUnlocks = m_settings.opt("upgradeRecipeUnlocks")) { |
| 216 | for (String itemName : jsonToStringList(*recipeUnlocks)) |
| 217 | m_player->addBlueprint(ItemDescriptor(itemName)); |
| 218 | } |
| 219 | |
| 220 | // this closes the interface window |
| 221 | dismiss(); |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | size_t CraftingPane::itemCount(List<ItemPtr> const& store, ItemDescriptor const& item) { |
| 228 | auto itemDb = Root::singleton().itemDatabase(); |
nothing calls this directly
no test coverage detected