remove event variables on event end

this should prevent the client from starting a new event right after the
current ends
This commit is contained in:
Spirtix 2025-04-12 09:04:13 +02:00
parent 783d02d4b2
commit 86314a84ee

View File

@ -160,25 +160,21 @@ class WorldEvent {
// send reward info // send reward info
private void PostEndEvent1(Object? source, ElapsedEventArgs e) { private void PostEndEvent1(Object? source, ElapsedEventArgs e) {
NetworkPacket packet = Utils.VlNetworkPacket( NetworkArray arr = new();
"WE_" + Configuration.ServerConfiguration.EventName + "_End",
lastResults,
room.Id
);
room.Send(packet);
NetworkArray vl = new(); arr.Add(NetworkArray.VlElement("WE_" + Configuration.ServerConfiguration.EventName + "_End", lastResults));
vl.Add(NetworkArray.VlElement("WE__AI", NetworkArray.NULL)); arr.Add(NetworkArray.VlElement("WE_" + Configuration.ServerConfiguration.EventName, NetworkArray.NULL));
foreach (var t in health) { arr.Add(NetworkArray.VlElement("WE__AI", NetworkArray.NULL));
vl.Add(NetworkArray.VlElement("WEH_" + t.Key, NetworkArray.NULL)); foreach (var t in health) {
vl.Add(NetworkArray.VlElement("WEF_" + t.Key, NetworkArray.NULL)); arr.Add(NetworkArray.VlElement("WEH_" + t.Key, NetworkArray.NULL));
} arr.Add(NetworkArray.VlElement("WEF_" + t.Key, NetworkArray.NULL));
packet = Utils.VlNetworkPacket(vl, room.Id); }
room.Send(packet);
Console.WriteLine($"Event {uid} sent _End"); room.Send(Utils.VlNetworkPacket(arr, room.Id));
SetTimer(60, PostEndEvent2); Console.WriteLine($"Event {uid} sent _End");
SetTimer(60, PostEndEvent2);
} }
// schedule next event, set timer to call PreInit() and send new WEN_ info // schedule next event, set timer to call PreInit() and send new WEN_ info