From 7288957a7886dc2cb30699bf450bb22f677455f9 Mon Sep 17 00:00:00 2001 From: Robert Paciorek Date: Wed, 10 Apr 2024 20:47:37 +0000 Subject: [PATCH] add EventName settings variable --- src/Core/Configuration.cs | 1 + src/Core/WorldEvent.cs | 6 +++--- src/appsettings.json | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Core/Configuration.cs b/src/Core/Configuration.cs index 80d5b0d..20fb473 100644 --- a/src/Core/Configuration.cs +++ b/src/Core/Configuration.cs @@ -29,6 +29,7 @@ internal static class Configuration { internal sealed class ServerConfiguration { public string ListenIP { get; set; } = string.Empty; public int Port { get; set; } = 9933; + public string EventName { get; set; } = "ScoutAttack"; public int EventTimer { get; set; } = 30; public int FirstEventTimer { get; set; } = 10; public int RacingMaxPlayers { get; set; } = 6; diff --git a/src/Core/WorldEvent.cs b/src/Core/WorldEvent.cs index abc1bbb..6317caa 100644 --- a/src/Core/WorldEvent.cs +++ b/src/Core/WorldEvent.cs @@ -161,7 +161,7 @@ class WorldEvent { // send reward info private void PostEndEvent1(Object? source, ElapsedEventArgs e) { NetworkPacket packet = Utils.VlNetworkPacket( - "WE_ScoutAttack_End", + "WE_" + Configuration.ServerConfiguration.EventName + "_End", lastResults, room.Id ); @@ -218,10 +218,10 @@ class WorldEvent { public NetworkArray EventInfoArray(bool WE = true, bool WEN = true) { NetworkArray vl = new(); if (WE) { - vl.Add(NetworkArray.VlElement("WE_ScoutAttack", EventInfo(), isPersistent:true)); + vl.Add(NetworkArray.VlElement("WE_" + Configuration.ServerConfiguration.EventName, EventInfo(), isPersistent:true)); } if (WEN) { - vl.Add(NetworkArray.VlElement("WEN_ScoutAttack", nextStartTimeString, isPersistent:true)); + vl.Add(NetworkArray.VlElement("WEN_" + Configuration.ServerConfiguration.EventName, nextStartTimeString, isPersistent:true)); } return vl; } diff --git a/src/appsettings.json b/src/appsettings.json index 23e44fd..7a3cd19 100644 --- a/src/appsettings.json +++ b/src/appsettings.json @@ -12,6 +12,9 @@ "// EnableChat": "When true, in-game chat will be enabled", "EnableChat": true, + "// EventName": "World event name send to client (can be used to select ship type after modding WorldEventScoutAttack in client)", + "EventName": "ScoutAttack", + "// FirstEventTimer": "time to start of first world event (battle ship event) after start MMO server", "FirstEventTimer": 3,