<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=OnPlayerConsumableDetachedSnapshot</id>
	<title>OnPlayerConsumableDetachedSnapshot - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=OnPlayerConsumableDetachedSnapshot"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=OnPlayerConsumableDetachedSnapshot&amp;action=history"/>
	<updated>2026-09-19T07:26:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=OnPlayerConsumableDetachedSnapshot&amp;diff=784&amp;oldid=prev</id>
		<title>QCherry: Document stable consumable lifecycle callbacks for 0.1.3</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=OnPlayerConsumableDetachedSnapshot&amp;diff=784&amp;oldid=prev"/>
		<updated>2026-09-08T14:06:27Z</updated>

		<summary type="html">&lt;p&gt;Document stable consumable lifecycle callbacks for 0.1.3&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= onPlayerConsumableDetachedSnapshot =&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; font-weight:bold; letter-spacing:0.04em;&amp;quot;&amp;gt;AVAILABLE FROM UPDATE 0.1.3&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; margin-top:0.25rem;&amp;quot;&amp;gt;This event is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Triggered during disconnect when a consumable operation is still awaiting its durable inventory result, providing both rollback and success snapshots for detached recovery.&lt;br /&gt;
&lt;br /&gt;
== Availability ==&lt;br /&gt;
This event is available in &amp;#039;&amp;#039;&amp;#039;server-side&amp;#039;&amp;#039;&amp;#039; scripts.&lt;br /&gt;
&lt;br /&gt;
== Callback signature ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
onPlayerConsumableDetachedSnapshot(playerId, itemKey, sequence, commitKey, baseHealth, baseMaxHealth, baseMana, baseMaxMana, baseStrength, baseDexterity, baseAlcohol, baseSwampweed, successHealth, successMaxHealth, successMana, successMaxMana, successStrength, successDexterity, successAlcohol, successSwampweed, appliedHealth, appliedMana)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;playerId&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; || The disconnecting player&amp;#039;s last authoritative ID.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;itemKey&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; || The stable native inventory key of the consumable.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;sequence&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; || The positive client request sequence.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;commitKey&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; || The opaque durable-operation key.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseHealth&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Health to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseMaxHealth&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Maximum health to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseMana&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Mana to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseMaxMana&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Maximum mana to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseStrength&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Strength to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseDexterity&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Dexterity to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseAlcohol&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Alcohol value to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;baseSwampweed&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Swampweed value to preserve if stage-one persistence failed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successHealth&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected health if the reserved item is durably consumed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successMaxHealth&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected maximum health after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successMana&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected mana after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successMaxMana&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected maximum mana after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successStrength&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected strength after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successDexterity&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected dexterity after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successAlcohol&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected alcohol value after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;successSwampweed&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected swampweed value after durable success.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;appliedHealth&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected instant health change for the success outcome.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;appliedMana&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Projected instant mana change for the success outcome.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Handle the event:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; line&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerConsumableDetachedSnapshot&amp;quot;, root, function(playerId, itemKey, sequence, commitKey, baseHealth, baseMaxHealth, baseMana, baseMaxMana, baseStrength, baseDexterity, baseAlcohol, baseSwampweed, successHealth, successMaxHealth, successMana, successMaxMana, successStrength, successDexterity, successAlcohol, successSwampweed, appliedHealth, appliedMana)&lt;br /&gt;
    outputDebugString(&amp;quot;Detached consumable recovery: &amp;quot; .. itemKey .. &amp;quot; #&amp;quot; .. sequence)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* This advanced disconnect-recovery callback is part of the stable server-side Lua contract beginning with update 0.1.3.&lt;br /&gt;
* It is emitted only when the player disconnects while stage-one inventory persistence is unresolved. A disconnect during final settlement reuses &amp;lt;code&amp;gt;onPlayerConsumableFinalizeRequested&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
* The bundled &amp;lt;code&amp;gt;gothic_rp&amp;lt;/code&amp;gt; resource selects and persists the correct snapshot after reconciling the durable receipt. Other resources must treat both snapshots as read-only.&lt;br /&gt;
* The player session is being removed; do not defer ordinary player getters or assume that the player remains connected after this callback.&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua Events]]&lt;br /&gt;
[[Category:Server Events]]&lt;br /&gt;
[[Category:Magic Events]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>