Android build v1.0.44

This commit is contained in:
Warren H
2026-06-20 23:04:39 -04:00
parent 6e10b37f8e
commit 4b45483ac3
10 changed files with 520 additions and 99 deletions
+11 -1
View File
@@ -858,6 +858,8 @@ export function getProfile(database, characterId, accountId) {
quantity,
owned,
}))
const hasRequiredComponents = components.length > 0
&& components.every((component) => component.quantity > 0)
const { itemId, slug, name, slot, rarity, itemLevel, healingPower, maxResourceBonus, glyph, description, setId, setSlug, setName } = recipe
return {
id: recipe.id,
@@ -880,7 +882,8 @@ export function getProfile(database, characterId, accountId) {
setName,
},
components,
canCraft: components.every((component) => component.owned >= component.quantity),
canCraft: hasRequiredComponents
&& components.every((component) => component.owned >= component.quantity),
}
}),
dungeons: dungeons.map((dungeon) => ({
@@ -1746,6 +1749,9 @@ function craftItem(database, characterId, recipeId) {
WHERE crafting_recipe_components.recipe_id = ?
`).all(characterId, recipeId)
if (components.length === 0) throw new Error('That recipe has no component requirements.')
if (components.some((component) => component.quantity <= 0)) {
throw new Error('Recipe components must require at least one item.')
}
const missing = components.find((component) => component.owned < component.quantity)
if (missing) {
const item = itemById(database, missing.itemId)
@@ -1845,6 +1851,10 @@ function upgradeItem(database, characterId, itemId) {
AND character_inventory.character_id = ?
WHERE crafting_recipe_components.recipe_id = ?
`).all(characterId, targetRecipe.id)
if (components.length === 0) throw new Error('That upgrade has no component requirements.')
if (components.some((component) => component.quantity <= 0)) {
throw new Error('Upgrade components must require at least one item.')
}
const missing = components.find((component) => component.owned < component.quantity)
if (missing) {
const componentItem = itemById(database, missing.itemId)