Added new discord plugin alert - online player count change.

This commit is contained in:
Brett Hewitson 2022-06-23 00:09:02 +10:00
parent c7da511d1e
commit c2374f3106
15 changed files with 89 additions and 10 deletions

View file

@ -915,6 +915,9 @@
<setting name="AutoStart_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="Alert_OnlinePlayerCountChange" serializeAs="String">
<value>Online Player Count:</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -3252,5 +3252,17 @@ namespace ServerManagerTool {
return ((string)(this["DiscordUrl"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Online Player Count:")]
public string Alert_OnlinePlayerCountChange {
get {
return ((string)(this["Alert_OnlinePlayerCountChange"]));
}
set {
this["Alert_OnlinePlayerCountChange"] = value;
}
}
}
}

View file

@ -893,5 +893,8 @@
<Setting Name="DiscordUrl" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://discord.gg/cJdHJSG</Value>
</Setting>
<Setting Name="Alert_OnlinePlayerCountChange" Type="System.String" Scope="User">
<Value Profile="(Default)">Online Player Count:</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -713,6 +713,8 @@
<sys:String x:Key="GlobalSettings_Alerts_ServerStatusChangeTooltip">This message will be displayed when the status of the server changes.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ModUpdateDetectedLabel">Mod Update Detected:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ModUpdateDetectedTooltip">This message will be displayed when the server manager detects one or more mods are out of date.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_OnlinePlayerCountChangeLabel">Online Player Count Change:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_OnlinePlayerCountChangeTooltip">This message will be displayed when the online player count changes.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ForceRespawnDinosLabel">Force Respawn Dinos Warning:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ForceRespawnDinosTooltip">This message will be displayed when the server is being started and a wild dino wipe is scheduled.</sys:String>

View file

@ -333,6 +333,10 @@ namespace ServerManagerTool.Lib
break;
}
if (this.Players != update.OnlinePlayerCount)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {update.OnlinePlayerCount}");
}
this.Players = update.OnlinePlayerCount;
this.MaxPlayers = update.ServerInfo?.MaxPlayers ?? this.ProfileSnapshot.MaxPlayerCount;

View file

@ -8,7 +8,6 @@
xmlns:globcntrls="clr-namespace:WPFSharp.Globalizer.Controls;assembly=WPFSharp.Globalizer"
mc:Ignorable="d"
d:DesignWidth="800"
FocusManager.FocusedElement="{Binding ElementName=DataPathTextBox}"
x:Name="GlobalSettings">
<UserControl.Resources>
<ResourceDictionary>
@ -77,7 +76,7 @@
<ComboBox Name="WindowStateServerMonitorComboBox" Grid.Row="4" Grid.Column="1" Margin="1,2,1,2" ItemsSource="{Binding ElementName=GlobalSettings, Path=WindowStatesServerMonitor}" SelectedValue="{Binding Config.ServerMonitorWindow_WindowState}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="5" Grid.Column="0" Margin="1" Content="{DynamicResource GlobalSettings_DataDirectoryLabel}" VerticalAlignment="Center"/>
<TextBox x:Name="DataPathTextBox" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.DataDir, Mode=TwoWay}" IsReadOnly="True" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.DataDir, Mode=TwoWay}" IsReadOnly="True" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" />
<Button Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,1,0,1" VerticalAlignment="Center" HorizontalAlignment="Right" Content="{DynamicResource DataDirectoryButtonContent}" Click="SetDataDir_Click" Visibility="Hidden" />
<Button Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,1,0,1" VerticalAlignment="Center" HorizontalAlignment="Right" Content="{DynamicResource DataDirectoryResetButtonContent}" Click="ResetDataDir_Click" />
@ -571,6 +570,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="100"/>
@ -613,9 +613,12 @@
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_ModUpdateDetectedLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_ModUpdateDetected}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_ModUpdateDetectedTooltip}"/>
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_ForceRespawnDinosLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="12" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_ForceRespawnDinos}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_ForceRespawnDinosTooltip}"/>
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_OnlinePlayerCountChangeLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="12" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_OnlinePlayerCountChange}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_OnlinePlayerCountChangeTooltip}"/>
<Label Grid.Row="13" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_ForceRespawnDinosLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="13" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_ForceRespawnDinos}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_ForceRespawnDinosTooltip}"/>
</Grid>
</GroupBox>

View file

@ -7,10 +7,35 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2022-06-22T00:00:00Z</updated>
<entry>
<id>urn:uuid:F3965FC7-685F-47DF-9E5B-3BA4D928127F</id>
<title>1.1.434 (1.1.434.4)</title>
<summary>1.1.434.4</summary>
<link href="" />
<updated>2022-06-22T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Availability Status - Changed the Waiting for Publication status into two new statuses, to clarify the issue.</li>
<li>Server Monitor - Added a Ports column that shows the main server ports.</li>
<li>zh-CN Translation file updated.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:F3965FC7-685F-47DF-9E5B-3BA4D928127F</id>
<title>1.1.434 (1.1.434.3)</title>
<summary>1.1.434.2</summary>
<summary>1.1.434.3</summary>
<link href="" />
<updated>2022-06-22T00:00:00Z</updated>
<content type="xhtml">

View file

@ -690,6 +690,9 @@
<setting name="AutoStart_TaskPriority" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="Alert_OnlinePlayerCountChange" serializeAs="String">
<value>Online Player Count:</value>
</setting>
</ServerManagerTool.Config>
</userSettings>
</configuration>

View file

@ -2435,5 +2435,17 @@ namespace ServerManagerTool {
return ((string)(this["DiscordUrl"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Online Player Count:")]
public string Alert_OnlinePlayerCountChange {
get {
return ((string)(this["Alert_OnlinePlayerCountChange"]));
}
set {
this["Alert_OnlinePlayerCountChange"] = value;
}
}
}
}

View file

@ -668,5 +668,8 @@
<Setting Name="DiscordUrl" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://discord.gg/cJdHJSG</Value>
</Setting>
<Setting Name="Alert_OnlinePlayerCountChange" Type="System.String" Scope="User">
<Value Profile="(Default)">Online Player Count:</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -870,8 +870,8 @@
<sys:String x:Key="GlobalSettings_Alerts_ServerStatusChangeTooltip">This message will be displayed when the status of the server changes.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ModUpdateDetectedLabel">Mod Update Detected:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ModUpdateDetectedTooltip">This message will be displayed when the server manager detects one or more mods are out of date.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ForceRespawnDinosLabel">Force Respawn Creatures Warning:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_ForceRespawnDinosTooltip">This message will be displayed when the server is being started and a wild creature wipe is scheduled.</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_OnlinePlayerCountChangeLabel">Online Player Count Change:</sys:String>
<sys:String x:Key="GlobalSettings_Alerts_OnlinePlayerCountChangeTooltip">This message will be displayed when the online player count changes.</sys:String>
<sys:String x:Key="GlobalSettings_DiscordBotLabel">Enable Discord Bot</sys:String>
<sys:String x:Key="GlobalSettings_DiscordBotInformationLabel">You will need to restart the server manager if you change any settings for the Discord Bot.</sys:String>

View file

@ -332,6 +332,10 @@ namespace ServerManagerTool.Lib
break;
}
if (this.Players != update.OnlinePlayerCount)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {update.OnlinePlayerCount}");
}
this.Players = update.OnlinePlayerCount;
this.MaxPlayers = update.ServerInfo?.MaxPlayers ?? this.ProfileSnapshot.MaxPlayerCount;

View file

@ -8,7 +8,6 @@
xmlns:gctl="clr-namespace:WPFSharp.Globalizer.Controls;assembly=WPFSharp.Globalizer"
mc:Ignorable="d"
d:DesignWidth="800"
FocusManager.FocusedElement="{Binding ElementName=DataPathTextBox}"
x:Name="GlobalSettings">
<UserControl.Resources>
<ResourceDictionary>
@ -79,7 +78,7 @@
<ComboBox Name="WindowStateServerMonitorComboBox" Grid.Row="4" Grid.Column="1" Margin="1,2,1,2" ItemsSource="{Binding ElementName=GlobalSettings, Path=WindowStatesServerMonitor}" SelectedValue="{Binding Config.ServerMonitorWindow_WindowState}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
<Label Grid.Row="5" Grid.Column="0" Margin="1" Content="{DynamicResource GlobalSettings_DataDirectoryLabel}" VerticalAlignment="Center"/>
<TextBox x:Name="DataPathTextBox" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.DataPath, Mode=TwoWay}" IsReadOnly="True" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.DataPath, Mode=TwoWay}" IsReadOnly="True" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" />
<Button Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,1,0,1" VerticalAlignment="Center" HorizontalAlignment="Left" Content="{DynamicResource DataDirectoryButtonContent}" Click="SetDataDir_Click" Visibility="Hidden"/>
<Button Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="2" Margin="5,1,0,1" VerticalAlignment="Center" HorizontalAlignment="Right" Content="{DynamicResource DataDirectoryResetButtonContent}" Click="ResetDataDir_Click" />
@ -519,6 +518,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="100"/>
@ -561,6 +561,9 @@
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_ModUpdateDetectedLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_ModUpdateDetected}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_ModUpdateDetectedTooltip}"/>
<Label Grid.Row="12" Grid.Column="0" Content="{DynamicResource GlobalSettings_Alerts_OnlinePlayerCountChangeLabel}" VerticalAlignment="Center"/>
<TextBox Grid.Row="12" Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Text="{Binding Config.Alert_OnlinePlayerCountChange}" IsReadOnlyCaretVisible="True" VerticalContentAlignment="Center" ToolTip="{DynamicResource GlobalSettings_Alerts_OnlinePlayerCountChangeTooltip}"/>
</Grid>
</GroupBox>

View file

@ -11,5 +11,6 @@
UpdateResults,
ServerStatusChange,
ModUpdateDetected,
OnlinePlayerCountChanged,
}
}

View file

@ -8,6 +8,7 @@
<sys:String x:Key="AlertType_Backup">Backup</sys:String>
<sys:String x:Key="AlertType_Error">Error</sys:String>
<sys:String x:Key="AlertType_ModUpdateDetected">Mod Update Detected</sys:String>
<sys:String x:Key="AlertType_OnlinePlayerCountChanged">Online Player Count Change</sys:String>
<sys:String x:Key="AlertType_Shutdown">Shutdown</sys:String>
<sys:String x:Key="AlertType_ShutdownMessage">Shutdown Message</sys:String>
<sys:String x:Key="AlertType_ShutdownReason">Shutdown Reason</sys:String>