From 662719519c42fdfe431cc5714cf33716eb6da994 Mon Sep 17 00:00:00 2001 From: Lloyd Dilley Date: Sun, 8 Aug 2021 13:08:58 -0500 Subject: [PATCH 1/4] Allow $world_name in bot status and channel topic --- Terracord/Discord.cs | 2 ++ Terracord/Terracord.cs | 1 + TerracordTest/TerracordTest.cs | 4 ++-- terracord.xml | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Terracord/Discord.cs b/Terracord/Discord.cs index 56ca966..7765a11 100644 --- a/Terracord/Discord.cs +++ b/Terracord/Discord.cs @@ -86,6 +86,7 @@ public async Task Connect() { // Set game/playing status string status = Config.BotGame.Replace("$server_name", TShock.Config.Settings.ServerName); + status = status.Replace("$world_name", Terraria.Main.worldName); status = status.Replace("$player_count", TShock.Utils.GetActivePlayerCount().ToString()); status = status.Replace("$player_slots", TShock.Config.Settings.MaxSlots.ToString()); await Client.SetGameAsync(status).ConfigureAwait(true); @@ -287,6 +288,7 @@ private async Task UpdateTopic() while(true) { string topic = Config.OnlineTopic.Replace("$server_name", TShock.Config.Settings.ServerName); + topic = topic.Replace("$world_name", Terraria.Main.worldName); topic = topic.Replace("$player_count", TShock.Utils.GetActivePlayerCount().ToString()); topic = topic.Replace("$player_slots", TShock.Config.Settings.MaxSlots.ToString()); topic = topic.Replace("$uptime", Command.Uptime()); diff --git a/Terracord/Terracord.cs b/Terracord/Terracord.cs index 7e3877c..a3c9d0e 100644 --- a/Terracord/Terracord.cs +++ b/Terracord/Terracord.cs @@ -254,6 +254,7 @@ private void PlayerEventNotify(object eventArgs, string message) { message = message.Replace("$player_name", playerName); string status = Config.BotGame.Replace("$server_name", TShock.Config.Settings.ServerName); + status = status.Replace("$world_name", Terraria.Main.worldName); status = status.Replace("$player_count", playerCount.ToString()); status = status.Replace("$player_slots", TShock.Config.Settings.MaxSlots.ToString()); Discord.UpdateBotGame(discord.Client, status).ConfigureAwait(true); diff --git a/TerracordTest/TerracordTest.cs b/TerracordTest/TerracordTest.cs index 0cba02f..cadf7fd 100644 --- a/TerracordTest/TerracordTest.cs +++ b/TerracordTest/TerracordTest.cs @@ -57,13 +57,13 @@ public void ConfigParseTest() Assert.IsType(Config.RemoteCommands); Assert.Equal("Administrators Moderators", Config.AuthorizedRoles); Assert.IsType(Config.AuthorizedRoles); - Assert.Equal("$server_name: $player_count/$player_slots", Config.BotGame); + Assert.Equal("$server_name: $world_name: $player_count/$player_slots", Config.BotGame); Assert.IsType(Config.BotGame); Assert.Equal("300", Config.TopicInterval.ToString()); Assert.IsType(Config.TopicInterval); Assert.Equal("Relay offline", Config.OfflineTopic); Assert.IsType(Config.OfflineTopic); - Assert.Equal("$server_name | $player_count/$player_slots players online | Server online for $uptime | Last update: $current_time", Config.OnlineTopic); + Assert.Equal("$server_name: $world_name | $player_count/$player_slots players online | Server online for $uptime | Last update: $current_time", Config.OnlineTopic); Assert.IsType(Config.OnlineTopic); Assert.Equal("255", Config.BroadcastColor[0].ToString()); Assert.IsType(Config.BroadcastColor[0]); diff --git a/terracord.xml b/terracord.xml index c8d9f4e..0a83e88 100644 --- a/terracord.xml +++ b/terracord.xml @@ -25,10 +25,10 @@ - + - + From 514fbfce9a2f079718dedcb224ae0e5481ecc4e0 Mon Sep 17 00:00:00 2001 From: Lloyd Dilley Date: Sun, 8 Aug 2021 13:30:06 -0500 Subject: [PATCH 2/4] Increment version --- Terracord/Terracord.cs | 4 ++-- Terracord/Terracord.csproj | 8 ++++---- Terracord/Terracord.nuspec | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Terracord/Terracord.cs b/Terracord/Terracord.cs index a3c9d0e..ac9b7f2 100644 --- a/Terracord/Terracord.cs +++ b/Terracord/Terracord.cs @@ -39,7 +39,7 @@ public class Terracord:TerrariaPlugin /// /// Plugin version /// - public override Version Version => new Version(1, 3, 0); + public override Version Version => new Version(1, 3, 1); /// /// Plugin author(s) @@ -52,7 +52,7 @@ public class Terracord:TerrariaPlugin public override string Description => "A Discord <-> Terraria bridge plugin for TShock"; // Plugin version - public const string PluginVersion = "1.3.0"; + public const string PluginVersion = "1.3.1"; // Discord bot client private readonly Discord discord; // Plugin start time diff --git a/Terracord/Terracord.csproj b/Terracord/Terracord.csproj index af96ba3..ac4a338 100644 --- a/Terracord/Terracord.csproj +++ b/Terracord/Terracord.csproj @@ -5,11 +5,11 @@ - + netstandard2.1;netstandard2.0;net461 x86 Frag Land - 1.3.0 + 1.3.1 http://www.frag.land/ git https://github.com/FragLand/terracord @@ -27,8 +27,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Terracord/Terracord.nuspec b/Terracord/Terracord.nuspec index 9aa247d..09846c3 100644 --- a/Terracord/Terracord.nuspec +++ b/Terracord/Terracord.nuspec @@ -2,7 +2,7 @@ Terracord - 1.2.3 + 1.3.1 Lloyd Dilley GPL-3.0-or-later https://github.com/FragLand/terracord From 88845972c98aa9a7d242ecfc2d4dd43b4d41a3fa Mon Sep 17 00:00:00 2001 From: Lloyd Dilley Date: Sun, 8 Aug 2021 13:34:24 -0500 Subject: [PATCH 3/4] Update TShock release for CI builds --- .travis.yml | 8 ++++---- appveyor.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index dda29a4..d0659b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,10 @@ jobs: - nuget install xunit.runner.console -Version 2.4.1 -OutputDirectory testrunner - TMPDIR=tmp - mkdir $TMPDIR - - ZIPFILE=TShock.4.5.1.Terraria.1.4.2.1.zip + - ZIPFILE=TShock4.5.5_Terraria_1.4.2.3.zip #- ZIPDIR=TShock.4.5.1.Terraria.1.4.2.1 - cd $TMPDIR - - curl -fsSLJo $ZIPFILE https://github.com/Pryaxis/TShock/releases/download/v4.5.1/TShock.4.5.1.Terraria.1.4.2.1.zip + - curl -fsSLJo $ZIPFILE https://github.com/Pryaxis/TShock/releases/download/v4.5.5/TShock4.5.5_Terraria_1.4.2.3.zip #- unzip -jq $ZIPFILE $ZIPDIR/OTAPI.dll $ZIPDIR/TerrariaServer.exe $ZIPDIR/ServerPlugins/TShockAPI.dll - unzip -jq $ZIPFILE OTAPI.dll TerrariaServer.exe ServerPlugins/TShockAPI.dll - mkdir -p ../lib @@ -36,10 +36,10 @@ jobs: - dotnet restore - TMPDIR=tmp - mkdir $TMPDIR - - ZIPFILE=TShock.4.5.1.Terraria.1.4.2.1.zip + - ZIPFILE=TShock4.5.5_Terraria_1.4.2.3.zip #- ZIPDIR=TShock.4.5.1.Terraria.1.4.2.1 - cd $TMPDIR - - curl -fsSLJo $ZIPFILE https://github.com/Pryaxis/TShock/releases/download/v4.5.1/TShock.4.5.1.Terraria.1.4.2.1.zip + - curl -fsSLJo $ZIPFILE https://github.com/Pryaxis/TShock/releases/download/v4.5.5/TShock4.5.5_Terraria_1.4.2.3.zip #- unzip -jq $ZIPFILE $ZIPDIR/OTAPI.dll $ZIPDIR/TerrariaServer.exe $ZIPDIR/ServerPlugins/TShockAPI.dll - unzip -jq $ZIPFILE OTAPI.dll TerrariaServer.exe ServerPlugins/TShockAPI.dll - mkdir -p ../lib diff --git a/appveyor.yml b/appveyor.yml index 3a3fcc9..bac2205 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,14 +1,14 @@ -version: 1.2.3.{build} +version: 1.3.1.{build} image: Visual Studio 2019 platform: x86 configuration: Debug before_build: - nuget restore - SET TEMPDIR=temp - - SET ZIPFILE=TShock.4.5.1.Terraria.1.4.2.1.zip + - SET ZIPFILE=TShock4.5.5_Terraria_1.4.2.3.zip - md %TEMPDIR% - cd %TEMPDIR% - - curl -fsSLJo %ZIPFILE% https://github.com/Pryaxis/TShock/releases/download/v4.5.1/TShock.4.5.1.Terraria.1.4.2.1.zip + - curl -fsSLJo %ZIPFILE% https://github.com/Pryaxis/TShock/releases/download/v4.5.5/TShock4.5.5_Terraria_1.4.2.3.zip - 7z e %ZIPFILE% -o..\lib\ OTAPI.dll TerrariaServer.exe TShockAPI.dll -r build: # Ignore TerracordTest From 6e353291727cde52027f217461afba192be4d31d Mon Sep 17 00:00:00 2001 From: Lloyd Dilley Date: Sun, 8 Aug 2021 13:44:32 -0500 Subject: [PATCH 4/4] Update generated config with $world_name --- Terracord/Config.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Terracord/Config.cs b/Terracord/Config.cs index b89deac..321ac53 100644 --- a/Terracord/Config.cs +++ b/Terracord/Config.cs @@ -217,7 +217,7 @@ public static void Generate() Util.Log($"Attempting to generate {TerracordPath}terracord.xml since the file did not exist...", Util.Severity.Info); StreamWriter newConfigFile = new StreamWriter($"{TerracordPath}terracord.xml", false); newConfigFile.WriteLine("\n"); - newConfigFile.WriteLine(""); + newConfigFile.WriteLine(""); newConfigFile.WriteLine("\n"); newConfigFile.WriteLine(" "); newConfigFile.WriteLine(" \n"); @@ -234,9 +234,9 @@ public static void Generate() newConfigFile.WriteLine(" "); newConfigFile.WriteLine(" \n"); newConfigFile.WriteLine(" "); - newConfigFile.WriteLine(" \n"); + newConfigFile.WriteLine(" \n"); newConfigFile.WriteLine(" "); - newConfigFile.WriteLine(" \n"); + newConfigFile.WriteLine(" \n"); newConfigFile.WriteLine(" "); newConfigFile.WriteLine(" \n"); newConfigFile.WriteLine(" ");