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

@ -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>