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.Servers;
using Core.Services;
using Server;
namespace Core.Utils;
@@ -14,19 +15,21 @@ public class App
protected Dictionary<string, long> _onUpdateLastRun;
protected CoreConfig _coreConfig;
private ISptLogger<App> _logger;
private TimeUtil _timeUtil;
private LocalisationService _localisationService;
private ConfigServer _configServer;
private EncodingUtil _encodingUtil;
private HttpServer _httpServer;
private DatabaseService _databaseService;
private IEnumerable<OnLoad> _onLoad;
private IEnumerable<OnUpdate> _onUpdate;
protected ISptLogger<App> _logger;
protected TimeUtil _timeUtil;
protected readonly RandomUtil _randomUtil;
protected LocalisationService _localisationService;
protected ConfigServer _configServer;
protected EncodingUtil _encodingUtil;
protected HttpServer _httpServer;
protected DatabaseService _databaseService;
protected IEnumerable<OnLoad> _onLoad;
protected IEnumerable<OnUpdate> _onUpdate;
public App(
ISptLogger<App> logger,
TimeUtil timeUtil,
RandomUtil randomUtil,
LocalisationService localisationService,
ConfigServer configServer,
EncodingUtil encodingUtil,
@@ -38,6 +41,7 @@ public class App
{
_logger = logger;
_timeUtil = timeUtil;
_randomUtil = randomUtil;
_localisationService = localisationService;
_configServer = configServer;
_encodingUtil = encodingUtil;
@@ -74,6 +78,17 @@ public class App
await onLoad.OnLoad();
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)
+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/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/=Ragfair/@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/=Zryachiy/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>