Add quantity textfield to Inventory item add dialog.
This commit is contained in:
parent
763f575be4
commit
a2bfd6d775
10 changed files with 43 additions and 21 deletions
|
|
@ -78,6 +78,7 @@ class InventoryService(
|
|||
fun createInventoryItem(
|
||||
characterSheetId: String,
|
||||
itemId: String,
|
||||
count: Float,
|
||||
): String {
|
||||
// get the inventory of the character, if none create one.
|
||||
val inventory = inventoryStore.inventoryFlow().value[characterSheetId]
|
||||
|
|
@ -88,7 +89,7 @@ class InventoryService(
|
|||
val item = Inventory.Item(
|
||||
inventoryId = inventoryId,
|
||||
itemId = itemId,
|
||||
count = 1f,
|
||||
count = count,
|
||||
equipped = false,
|
||||
)
|
||||
// update the inventory with the updated item.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.pixelized.server.lwa.server.rest.inventory
|
|||
|
||||
import com.pixelized.server.lwa.server.Engine
|
||||
import com.pixelized.server.lwa.utils.extentions.characterSheetId
|
||||
import com.pixelized.server.lwa.utils.extentions.count
|
||||
import com.pixelized.server.lwa.utils.extentions.exception
|
||||
import com.pixelized.server.lwa.utils.extentions.itemId
|
||||
import com.pixelized.shared.lwa.protocol.rest.APIResponse
|
||||
|
|
@ -15,10 +16,12 @@ fun Engine.createInventoryItem(): suspend RoutingContext.() -> Unit {
|
|||
// get the query parameter
|
||||
val characterSheetId = call.queryParameters.characterSheetId
|
||||
val itemId = call.queryParameters.itemId
|
||||
val count = call.queryParameters.count
|
||||
// add the item to the inventory.
|
||||
val inventoryId = inventoryService.createInventoryItem(
|
||||
characterSheetId = characterSheetId,
|
||||
itemId = itemId,
|
||||
count = count,
|
||||
)
|
||||
// API & WebSocket responses.
|
||||
call.respond(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue