Add purse update chatlog message
This commit is contained in:
parent
06c5802d7a
commit
5b633de981
16 changed files with 327 additions and 16 deletions
|
|
@ -3,6 +3,7 @@ package com.pixelized.shared.lwa.model.inventory.factory
|
|||
import com.pixelized.shared.lwa.model.inventory.Inventory
|
||||
import com.pixelized.shared.lwa.model.inventory.InventoryJson
|
||||
import com.pixelized.shared.lwa.model.inventory.InventoryJsonV1
|
||||
import com.pixelized.shared.lwa.protocol.rest.ApiPurseJson
|
||||
|
||||
class InventoryJsonFactory(
|
||||
private val v1: InventoryJsonFactoryV1,
|
||||
|
|
@ -16,4 +17,16 @@ class InventoryJsonFactory(
|
|||
fun convertToJson(inventory: Inventory): InventoryJson {
|
||||
return v1.convertToJson(inventory = inventory)
|
||||
}
|
||||
|
||||
fun convertToApiPurse(
|
||||
characterSheetId: String,
|
||||
purse: Inventory.Purse,
|
||||
): ApiPurseJson {
|
||||
return ApiPurseJson(
|
||||
characterSheetId = characterSheetId,
|
||||
gold = purse.gold,
|
||||
silver = purse.silver,
|
||||
copper = purse.copper,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.pixelized.shared.lwa.protocol.rest
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ApiPurseJson(
|
||||
val characterSheetId: String,
|
||||
val gold: Int,
|
||||
val silver: Int,
|
||||
val copper: Int,
|
||||
)
|
||||
|
|
@ -53,6 +53,16 @@ sealed interface ApiSynchronisation : SocketMessage {
|
|||
@Serializable
|
||||
sealed interface InventoryApiSynchronisation : ApiSynchronisation, CharacterSheetIdMessage
|
||||
|
||||
@Serializable
|
||||
data class PurseUpdate(
|
||||
override val timestamp: Long,
|
||||
override val characterSheetId: String,
|
||||
val add : Boolean,
|
||||
val gold: Int,
|
||||
val silver: Int,
|
||||
val copper: Int,
|
||||
) : InventoryApiSynchronisation
|
||||
|
||||
@Serializable
|
||||
data class InventoryUpdate(
|
||||
override val timestamp: Long,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue