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:
erik 2026-02-27 06:18:15 +00:00
parent ad8fb3a4ba
commit c53aa4b31b
3 changed files with 40 additions and 7 deletions

View file

@ -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)
{