game-common / pragma.inventory / InstancedItemPlugin /

InstancedItemPlugin #

interface InstancedItemPlugin

Plugin to define the behavior of creating and updating instanced items.

Functions #

NameSummary

newInstanced

abstract fun newInstanced(instancedSpec: InventoryContent.InstancedSpec, inventoryContent: InventoryServiceContent, startingInventory: InventoryData, pendingInventory: InventoryData, clientRequestExt: ExtPurchaseRequest?, serverRequestExt: ExtInstancedItemServerGrant?): InstancedItemPlugin.InstancedItemPluginResult

When granting a new Instanced Item, the newInstanced function will allow you to interact with the ext data that will be saved within each item. newInstance is called with either a valid client sourced ext or a valid server sourced ext. The other ext will be null. ExtPurchaseRequest might contain untrusted or unverified information, since it might come directly from the client. ExtInstancedItemServerGrant contains information only provided by other internal flows such as crafting.

onDelete

open fun onDelete(deletedItem: InstancedItem, instancedSpec: InventoryContent.InstancedSpec, inventoryContent: InventoryServiceContent, startingInventory: InventoryData, pendingInventory: InventoryData): InventoryModifications

Called any time an instanced item is being deleted. This plugin allows chaining of additional item operations from the delete event.

update

abstract fun update(initialInstancedItem: InstancedItem, instancedSpec: InventoryContent.InstancedSpec, updateEntry: InventoryContent.UpdateEntry, inventoryContent: InventoryServiceContent, startingInventory: InventoryData, pendingInventory: InventoryData, clientRequestExt: ExtInstancedItemUpdate?, serverRequestExt: ExtInstancedItemServerUpdate?): InstancedItemPlugin.InstancedItemPluginResult

When modifying an existing Instanced Item, the update function will allow you to interact with the ext data that will be saved within the item. update is called with either a valid client sourced ext or a valid server sourced ext. The other ext will be null. ExtInstancedItemUpdate might contain untrusted or unverified information, since it might come directly from the client. ExtInstancedItemServerUpdate contains information only provided by other internal flows such as from inventory match end updates.