OnPlayerConsumableFinalizeRequested
onPlayerConsumableFinalizeRequested
AVAILABLE FROM UPDATE 0.1.3
This event is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.
Triggered after the inventory removal is durable and the server has applied the authoritative instant effect, requesting persistence of the final settlement snapshot.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerConsumableFinalizeRequested(playerId, itemKey, inventoryItemId, sequence, generation, commitKey, quantityRemaining, health, maxHealth, mana, maxMana, strength, dexterity, alcohol, swampweed, appliedHealth, appliedMana, periodicTicks, periodicHealthPerTick, periodicManaPerTick)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The player using the consumable. |
itemKey |
string |
The stable native inventory key of the consumable. |
inventoryItemId |
int |
The native numeric consumable ID. |
sequence |
int |
The positive client request sequence. |
generation |
int |
The positive settlement generation; a newer snapshot uses a higher value. |
commitKey |
string |
The opaque durable-operation key supplied by the commit request. |
quantityRemaining |
int |
The current authoritative inventory quantity. |
health |
number |
Canonical health in the settlement snapshot. |
maxHealth |
number |
Canonical maximum health in the settlement snapshot. |
mana |
number |
Canonical mana in the settlement snapshot. |
maxMana |
number |
Canonical maximum mana in the settlement snapshot. |
strength |
number |
Canonical strength in the settlement snapshot. |
dexterity |
number |
Canonical dexterity in the settlement snapshot. |
alcohol |
number |
Canonical alcohol progression value. |
swampweed |
number |
Canonical swampweed progression value. |
appliedHealth |
number |
Instant health change applied by this operation. |
appliedMana |
number |
Instant mana change applied by this operation. |
periodicTicks |
int |
The number of periodic ticks authored for the item. |
periodicHealthPerTick |
number |
Authored health change per periodic tick. |
periodicManaPerTick |
number |
Authored mana change per periodic tick. |
Examples
Handle the event:
addEventHandler("onPlayerConsumableFinalizeRequested", root, function(playerId, itemKey, inventoryItemId, sequence, generation, commitKey, quantityRemaining, health, maxHealth, mana, maxMana, strength, dexterity, alcohol, swampweed, appliedHealth, appliedMana, periodicTicks, periodicHealthPerTick, periodicManaPerTick)
outputDebugString("Consumable finalize requested: " .. commitKey .. " generation=" .. generation)
end)
Notes
- This advanced durability-lifecycle callback is part of the stable server-side Lua contract beginning with update 0.1.3.
- The bundled
gothic_rpresource owns persistence and is the only resource authorized to acknowledge this request withcompletePlayerConsumableFinalize. Other resources must treat it as read-only. - The same generation can be delivered again after a persistence failure. A concurrent authoritative progression change can produce a newer generation that supersedes an older snapshot.
- A Lua return value does not complete the operation. Do not reapply the item effect or overwrite progression from an older generation.