Added server start success message

This commit is contained in:
Chomp
2025-01-18 16:26:11 +00:00
parent cedd175702
commit 5f488fb4cd
2 changed files with 25 additions and 9 deletions
+24 -9
View File
@@ -5,6 +5,7 @@ using Core.Models.Spt.Config;
using Core.Models.Utils; using Core.Models.Utils;
using Core.Servers; using Core.Servers;
using Core.Services; using Core.Services;
using Server;
namespace Core.Utils; namespace Core.Utils;
@@ -14,19 +15,21 @@ public class App
protected Dictionary<string, long> _onUpdateLastRun; protected Dictionary<string, long> _onUpdateLastRun;
protected CoreConfig _coreConfig; protected CoreConfig _coreConfig;
private ISptLogger<App> _logger; protected ISptLogger<App> _logger;
private TimeUtil _timeUtil; protected TimeUtil _timeUtil;
private LocalisationService _localisationService; protected readonly RandomUtil _randomUtil;
private ConfigServer _configServer; protected LocalisationService _localisationService;
private EncodingUtil _encodingUtil; protected ConfigServer _configServer;
private HttpServer _httpServer; protected EncodingUtil _encodingUtil;
private DatabaseService _databaseService; protected HttpServer _httpServer;
private IEnumerable<OnLoad> _onLoad; protected DatabaseService _databaseService;
private IEnumerable<OnUpdate> _onUpdate; protected IEnumerable<OnLoad> _onLoad;
protected IEnumerable<OnUpdate> _onUpdate;
public App( public App(
ISptLogger<App> logger, ISptLogger<App> logger,
TimeUtil timeUtil, TimeUtil timeUtil,
RandomUtil randomUtil,
LocalisationService localisationService, LocalisationService localisationService,
ConfigServer configServer, ConfigServer configServer,
EncodingUtil encodingUtil, EncodingUtil encodingUtil,
@@ -38,6 +41,7 @@ public class App
{ {
_logger = logger; _logger = logger;
_timeUtil = timeUtil; _timeUtil = timeUtil;
_randomUtil = randomUtil;
_localisationService = localisationService; _localisationService = localisationService;
_configServer = configServer; _configServer = configServer;
_encodingUtil = encodingUtil; _encodingUtil = encodingUtil;
@@ -74,6 +78,17 @@ public class App
await onLoad.OnLoad(); await onLoad.OnLoad();
new Timer(_ => Update(_onUpdate), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000)); new Timer(_ => Update(_onUpdate), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000));
_logger.Success(GetRandomisedStartMessage());
}
protected string GetRandomisedStartMessage() {
if (_randomUtil.GetInt(1, 1000) > 999) {
return _localisationService.GetRandomTextThatMatchesPartialKey("server_start_meme_");
}
return _localisationService.GetText("server_start_success");
} }
protected async Task Update(IEnumerable<OnUpdate> onUpdateComponents) protected async Task Update(IEnumerable<OnUpdate> onUpdateComponents)
+1
View File
@@ -18,6 +18,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gifter/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Gifter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=peacefull/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=peacefull/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ragfair/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tagilla/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Tagilla/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=USEC/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=USEC/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zryachiy/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=Zryachiy/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>