diff --git a/MosswartMassacre/CharacterStats.cs b/MosswartMassacre/CharacterStats.cs index 6d16f03..4a7248c 100644 --- a/MosswartMassacre/CharacterStats.cs +++ b/MosswartMassacre/CharacterStats.cs @@ -146,6 +146,33 @@ namespace MosswartMassacre } } + /// + /// 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. + /// + 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}"); + } + } + /// /// Process game event 0x0029 - Titles list. /// Extracts current title ID. diff --git a/MosswartMassacre/PluginCore.cs b/MosswartMassacre/PluginCore.cs index 244fc68..a111188 100644 --- a/MosswartMassacre/PluginCore.cs +++ b/MosswartMassacre/PluginCore.cs @@ -204,6 +204,12 @@ namespace MosswartMassacre // Note: View initialization moved to LoginComplete for VVS compatibility + // Initialize character stats and hook ServerDispatch early + // 0x0013 (character properties with luminance) fires DURING login, + // BEFORE LoginComplete — must hook here to catch it + CharacterStats.Init(); + CoreManager.Current.EchoFilter.ServerDispatch += EchoFilter_ServerDispatch; + // Enable TLS1.2 ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; //Enable vTank interface @@ -414,15 +420,11 @@ namespace MosswartMassacre WriteToChat($"[ERROR] Quest streaming initialization failed: {ex.Message}"); } - // Initialize character stats streaming + // Start character stats streaming + // Note: Init() and ServerDispatch hook are in Startup() so we catch + // 0x0013 (luminance/properties) which fires BEFORE LoginComplete try { - CharacterStats.Init(); - - // Subscribe to server messages for allegiance/luminance/title data - // Must be AFTER Init() to avoid Init() clearing already-captured data - CoreManager.Current.EchoFilter.ServerDispatch += EchoFilter_ServerDispatch; - // Start 10-minute character stats timer characterStatsTimer = new Timer(600000); // 10 minutes characterStatsTimer.Elapsed += OnCharacterStatsUpdate; @@ -1241,6 +1243,10 @@ namespace MosswartMassacre CharacterStats.ProcessSetTitleMessage(e); } } + else if (e.Message.Type == 0x02CF) // PrivateUpdatePropertyInt64 (runtime luminance changes) + { + CharacterStats.ProcessPropertyInt64Update(e); + } } catch (Exception ex) { diff --git a/MosswartMassacre/bin/Release/MosswartMassacre.dll b/MosswartMassacre/bin/Release/MosswartMassacre.dll index ad744f8..a5aee04 100644 Binary files a/MosswartMassacre/bin/Release/MosswartMassacre.dll and b/MosswartMassacre/bin/Release/MosswartMassacre.dll differ