Fix luminance: hook ServerDispatch in Startup and handle 0x02CF updates
- Move Init() and ServerDispatch hook from LoginComplete to Startup so event 0x0013 (character properties) is caught during login sequence - Add handler for message 0x02CF (PrivateUpdatePropertyInt64) to capture runtime luminance changes when player earns/spends luminance in-game - Uses RawData byte parsing for 0x02CF since Decal messages.xml may not define this message type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ad8fb3a4ba
commit
c53aa4b31b
3 changed files with 40 additions and 7 deletions
|
|
@ -146,6 +146,33 @@ namespace MosswartMassacre
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process message 0x02CF - PrivateUpdatePropertyInt64.
|
||||
/// Sent during gameplay when an Int64 property changes (e.g., luminance earned/spent).
|
||||
/// Wire format after 4-byte type header: sequence(1) + key(4) + value(8).
|
||||
/// Uses RawData since Decal's messages.xml may not define this message type.
|
||||
/// </summary>
|
||||
internal static void ProcessPropertyInt64Update(NetworkMessageEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] raw = e.Message.RawData;
|
||||
if (raw.Length < 17) return; // 4 type + 1 seq + 4 key + 8 value
|
||||
|
||||
int key = BitConverter.ToInt32(raw, 5);
|
||||
long value = BitConverter.ToInt64(raw, 9);
|
||||
|
||||
if (key == 6) // AvailableLuminance
|
||||
luminanceEarned = value;
|
||||
else if (key == 7) // MaximumLuminance
|
||||
luminanceTotal = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginCore.WriteToChat($"[CharStats] Int64 property update error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process game event 0x0029 - Titles list.
|
||||
/// Extracts current title ID.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue