From e2afd4a745f8d6b480caff630b59c7379cc627c6 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 23 May 2020 20:27:56 -0700 Subject: [PATCH 01/25] Update workflow --- .github/workflows/build.yml | 92 ++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67a3ae87..b4f9a045 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,67 +6,83 @@ jobs: build: runs-on: windows-latest steps: - - uses: actions/checkout@v1 + - name: Git checkout + uses: actions/checkout@v1 with: submodules: recursive - - name: Install nuget - run: choco install nuget.commandline - - name: OTAPI Debug - shell: cmd + - name: Add MSBuild to environment variable + shell: pwsh + run: | + $msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent + echo "::set-env name=PATH::$msbuildPath;$env:PATH" + - name: Installer NuGet client + uses: nuget/setup-nuget@v1 + - name: Restore NuGet packages run: | nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug + nuget restore TShock.sln + - name: Build OTAPI (Debug) + shell: cmd + run: | + MSBuild.exe .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug TShock.Modifications.Bootstrapper.exe - - name: OTAPI Release - shell: cmd - run: | - nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release - cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release - TShock.Modifications.Bootstrapper.exe - - name: TerrariaServerAPI Debug + - name: Build TerrariaServerAPI (Debug) shell: cmd run: | cd .\TerrariaServerAPI - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Debug - - name: TShock Debug + MSBuild.exe .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Debug + - name: Build TShock (Debug) shell: cmd run: | nuget restore TShock.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Debug - - name: TerrariaServerAPI Release + MSBuild.exe .\TShockAPI\TShockAPI.csproj /p:Configuration=Debug + - name: Prepare packaging shell: cmd run: | - cd .\TerrariaServerAPI - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release - - name: TShock Release - shell: cmd - run: | - nuget restore TShock.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Release - - name: Normalize release packaging - shell: cmd - run: | - xcopy /Y prebuilts\*.* TShockAPI\bin\Release xcopy /Y prebuilts\*.* TShockAPI\bin\Debug mkdir TShockAPI\bin\Debug\ServerPlugins - mkdir TShockAPI\bin\Release\ServerPlugins - move TShockAPI\bin\Release\TShockAPI.dll TShockAPI\bin\Release\ServerPlugins move TShockAPI\bin\Debug\TShockAPI.dll TShockAPI\bin\Debug\ServerPlugins - - uses: actions/upload-artifact@master - with: - name: Experimental TShock (not debug) - path: TShockAPI\bin\Release - - uses: actions/upload-artifact@master + - name: Upload TShock (Debug) + uses: actions/upload-artifact@master with: name: Experimental TShock (debug) path: TShockAPI\bin\Debug - - uses: actions/upload-artifact@master + - name: Upload OTAPI Bootstrapper (Debug) + uses: actions/upload-artifact@master with: name: Experimental (debug) OTAPI Bootstrapper path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug\TShock.Modifications.Bootstrapper.exe - - uses: actions/upload-artifact@master + - name: Build OTAPI (Release) + shell: cmd + run: | + nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln + MSBuild.exe .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release + cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release + TShock.Modifications.Bootstrapper.exe + - name: Build TerrariaServerAPI (Release) + shell: cmd + run: | + cd .\TerrariaServerAPI + MSBuild.exe .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release + - name: Build TShock (Release) + shell: cmd + run: | + nuget restore TShock.sln + MSBuild.exe .\TShockAPI\TShockAPI.csproj /p:Configuration=Release + - name: Prepare packaging + shell: cmd + run: | + xcopy /Y prebuilts\*.* TShockAPI\bin\Release + mkdir TShockAPI\bin\Release\ServerPlugins + move TShockAPI\bin\Release\TShockAPI.dll TShockAPI\bin\Release\ServerPlugins + - name: Upload TShock (Release) + uses: actions/upload-artifact@master + with: + name: Experimental TShock (not debug) + path: TShockAPI\bin\Release + - name: Upload OTAPI Bootstrapper (Release) + uses: actions/upload-artifact@master with: name: Experimental (not debug) OTAPI Bootstrapper path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release\TShock.Modifications.Bootstrapper.exe From f999e3dbe922b7567569b87664d1901db65d8097 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 23 May 2020 23:35:22 -0700 Subject: [PATCH 02/25] Use 'not debug' instead of release to avoid ambiguity --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4f9a045..52245365 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,19 +53,19 @@ jobs: with: name: Experimental (debug) OTAPI Bootstrapper path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug\TShock.Modifications.Bootstrapper.exe - - name: Build OTAPI (Release) + - name: Build OTAPI (Not Debug) shell: cmd run: | nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln MSBuild.exe .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release TShock.Modifications.Bootstrapper.exe - - name: Build TerrariaServerAPI (Release) + - name: Build TerrariaServerAPI (Not Debug) shell: cmd run: | cd .\TerrariaServerAPI MSBuild.exe .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release - - name: Build TShock (Release) + - name: Build TShock (Not Debug) shell: cmd run: | nuget restore TShock.sln @@ -76,12 +76,12 @@ jobs: xcopy /Y prebuilts\*.* TShockAPI\bin\Release mkdir TShockAPI\bin\Release\ServerPlugins move TShockAPI\bin\Release\TShockAPI.dll TShockAPI\bin\Release\ServerPlugins - - name: Upload TShock (Release) + - name: Upload TShock (Not Debug) uses: actions/upload-artifact@master with: name: Experimental TShock (not debug) path: TShockAPI\bin\Release - - name: Upload OTAPI Bootstrapper (Release) + - name: Upload OTAPI Bootstrapper (Not Debug) uses: actions/upload-artifact@master with: name: Experimental (not debug) OTAPI Bootstrapper From 7e5490a9993899b452c86cbf5bce1988adab8bb0 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sun, 24 May 2020 00:41:06 -0700 Subject: [PATCH 03/25] Update 'release' wording --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52245365..ef4cd3b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,7 +70,7 @@ jobs: run: | nuget restore TShock.sln MSBuild.exe .\TShockAPI\TShockAPI.csproj /p:Configuration=Release - - name: Prepare packaging + - name: Normalize release packaging shell: cmd run: | xcopy /Y prebuilts\*.* TShockAPI\bin\Release From 50b246c4a34b9c3f6563a4072eeb3a5d5e55c963 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sun, 24 May 2020 14:05:57 -0700 Subject: [PATCH 04/25] Revert MSBuild PATH variable --- .github/workflows/build.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef4cd3b0..a796464b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,11 +10,6 @@ jobs: uses: actions/checkout@v1 with: submodules: recursive - - name: Add MSBuild to environment variable - shell: pwsh - run: | - $msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent - echo "::set-env name=PATH::$msbuildPath;$env:PATH" - name: Installer NuGet client uses: nuget/setup-nuget@v1 - name: Restore NuGet packages @@ -24,19 +19,19 @@ jobs: - name: Build OTAPI (Debug) shell: cmd run: | - MSBuild.exe .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug TShock.Modifications.Bootstrapper.exe - name: Build TerrariaServerAPI (Debug) shell: cmd run: | cd .\TerrariaServerAPI - MSBuild.exe .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Debug + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Debug - name: Build TShock (Debug) shell: cmd run: | nuget restore TShock.sln - MSBuild.exe .\TShockAPI\TShockAPI.csproj /p:Configuration=Debug + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Debug - name: Prepare packaging shell: cmd run: | @@ -57,19 +52,19 @@ jobs: shell: cmd run: | nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln - MSBuild.exe .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release TShock.Modifications.Bootstrapper.exe - name: Build TerrariaServerAPI (Not Debug) shell: cmd run: | cd .\TerrariaServerAPI - MSBuild.exe .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release - name: Build TShock (Not Debug) shell: cmd run: | nuget restore TShock.sln - MSBuild.exe .\TShockAPI\TShockAPI.csproj /p:Configuration=Release + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Release - name: Normalize release packaging shell: cmd run: | From 0d2b59176047bc6777241c7a44b29adfe7b4d6e6 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 13:45:31 -0400 Subject: [PATCH 05/25] Update NPCAddBuff to include Sparkle Slime debuff It's a new cosmetic debuff added in 1.4, like Wet and Slimed that can be applied to Town NPCs. Wiki: https://terraria.gamepedia.com/Sparkle_Slime_Balloon --- TShockAPI/Bouncer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index ad6e516a..b58681a4 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1537,7 +1537,7 @@ namespace TShockAPI if (npc.townNPC && npc.netID != NPCID.Guide && npc.netID != NPCID.Clothier) { if (type != BuffID.Lovestruck && type != BuffID.Stinky && type != BuffID.DryadsWard && - type != BuffID.Wet && type != BuffID.Slimed) + type != BuffID.Wet && type != BuffID.Slimed && type != BuffID.GelBalloonBuff) { detectedNPCBuffTimeCheat = true; } From 1f045c9a92373aa2195358c6c1d06d6a7c5623a2 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 15:53:58 -0400 Subject: [PATCH 06/25] Update /spawnboss to include the 2 new bosses Added Empress of Light and Queen Slime to the list of bosses that can be spawned individually and "all". Also removed the queen case because there are two bosses with queen in their name now. --- TShockAPI/Commands.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8d131588..8b5db356 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2378,7 +2378,7 @@ namespace TShockAPI { case "*": case "all": - int[] npcIds = { 4, 13, 35, 50, 125, 126, 127, 134, 222, 245, 262, 266, 370, 398 }; + int[] npcIds = { 4, 13, 35, 50, 125, 126, 127, 134, 222, 245, 262, 266, 370, 398, 636, 657 }; TSPlayer.Server.SetTime(false, 0.0); foreach (int i in npcIds) { @@ -2442,7 +2442,6 @@ namespace TShockAPI TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron Prime {1} time(s).", args.Player.Name, amount); return; - case "queen": case "queen bee": npc.SetDefaults(222); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); @@ -2483,6 +2482,17 @@ namespace TShockAPI TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); TSPlayer.All.SendSuccessMessage("{0} has spawned the Moon Lord {1} time(s).", args.Player.Name, amount); return; + case "empress": + case "empress of light": + npc.SetDefaults(636); + TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); + TSPlayer.All.SendSuccessMessage("{0} has spawned the Empress of Light {1} time(s).", args.Player.Name, amount); + return; + case "queen slime": + npc.SetDefaults(657); + TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); + TSPlayer.All.SendSuccessMessage("{0} has spawned the Queen Slime {1} time(s).", args.Player.Name, amount); + return; default: args.Player.SendErrorMessage("Invalid boss type!"); return; From 2c384aaaeb70f6b284676ae8890e864763ef1045 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 17:17:01 -0400 Subject: [PATCH 07/25] Add journey permissions to trustedadmin and owner hope im doing this right lol --- TShockAPI/DB/GroupManager.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 6405b5bc..b843f119 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -172,7 +172,19 @@ namespace TShockAPI.DB Permissions.settempgroup, Permissions.spawnrate, Permissions.tpoverride, - Permissions.createdumps)); + Permissions.createdumps, + Permissions.journey_timefreeze, + Permissions.journey_timeset, + Permissions.journey_timespeed, + Permissions.journey_godmode, + Permissions.journey_windstrength, + Permissions.journey_windfreeze, + Permissions.journey_rainstrength, + Permissions.journey_rainfreeze, + Permissions.journey_placementrange, + Permissions.journey_setdifficulty, + Permissions.journey_biomespreadfreeze, + Permissions.journey_setdawn)); } // Load Permissions from the DB From 51d2d9af6907ec3a357faac28298a2faeb696959 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 18:51:15 -0400 Subject: [PATCH 08/25] Fix error in previous change there's no setdawn, made the mistake of looking at a prev commit instead of the most current version of permissions --- TShockAPI/DB/GroupManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index b843f119..8c9515a6 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -184,7 +184,7 @@ namespace TShockAPI.DB Permissions.journey_placementrange, Permissions.journey_setdifficulty, Permissions.journey_biomespreadfreeze, - Permissions.journey_setdawn)); + Permissions.journey_setspawnrate)); } // Load Permissions from the DB From 54aa2dc070490c28390819866fca7f84b720af73 Mon Sep 17 00:00:00 2001 From: moisterrific <57187883+moisterrific@users.noreply.github.com> Date: Tue, 26 May 2020 19:00:24 -0400 Subject: [PATCH 09/25] updated the changelog with my stuff --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0eb992..697b8d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `-worldselectpath` is identical to the old `-worldpath`. If you specify `-worldselectpath` and `-world` without specifying an absolute path the server will crash for sure. * Thank you again to @fjfnaranjo for supplying a [detailed feature request](https://github.com/Pryaxis/TShock/issues/1914) explaining precisely why this option should be available. Without this, we would have had no context as to why this feature was useful or important. Thank you, @fjfnaranjo! * This change was implemented by (@QuiCM, @hakusaro). +* Updated Bouncer to include Sparkle Slime debuff that can be applied to town NPCs. +* Updated /spawnboss command to include Empress of Light and Queen Slime. +* Added journey mode permissions to owner group by default. ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From ecb1a8a4e724fbd305af6d09de8550b8d72d94c0 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:14:56 +0930 Subject: [PATCH 10/25] Update GetDataHandlers.cs --- TShockAPI/GetDataHandlers.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 74dbff85..b6d35d62 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2316,6 +2316,14 @@ namespace TShockAPI { var player = args.Player; var size = args.Data.ReadInt16(); + + var changeType = TileChangeType.None; + bool hasChangeType = ((size & 0x7FFF) & 0x8000) != 0; + if (hasChangeType) + { + changeType = (TileChangeType)args.Data.ReadInt8(); + } + var tileX = args.Data.ReadInt16(); var tileY = args.Data.ReadInt16(); var data = args.Data; From 2e0e5596b0df770cdb94de5d1251716aa02c4fa1 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:17:24 +0930 Subject: [PATCH 11/25] Fix wall read bug in NetTile --- TShockAPI/Net/NetTile.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs index 76d8e943..62896c10 100644 --- a/TShockAPI/Net/NetTile.cs +++ b/TShockAPI/Net/NetTile.cs @@ -30,7 +30,7 @@ namespace TShockAPI.Net public short FrameX { get; set; } public short FrameY { get; set; } public bool Lighted { get; set; } - public byte Wall { get; set; } + public ushort Wall { get; set; } public byte Liquid { get; set; } public byte LiquidType { get; set; } public bool Wire { get; set; } @@ -175,7 +175,7 @@ namespace TShockAPI.Net } if (HasWall) - stream.WriteInt8(Wall); + stream.WriteInt16((short)Wall);; if (HasLiquid) { @@ -218,7 +218,7 @@ namespace TShockAPI.Net if (flags[2]) { - Wall = stream.ReadInt8(); + Wall = stream.ReadUInt16(); } if (flags[3]) From cdeac344b8fbf6a4db73335cefd4c2ef242f2764 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Fri, 29 May 2020 17:18:11 +0930 Subject: [PATCH 12/25] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b9e1ba..169d1271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) +* Fixed an offset error in NetTile that impacted SendTileSquare ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From 0c3242a6f543c88622a0d788219bf5ad0eb02a6a Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 10:56:40 -0700 Subject: [PATCH 13/25] Tuned changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 169d1271..02cdc3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * This change was implemented by (@QuiCM, @hakusaro). * Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) -* Add HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) -* Fixed an offset error in NetTile that impacted SendTileSquare +* Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) +* Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From fd6913f7dfad0a9982c301977510c2a0b38bcb75 Mon Sep 17 00:00:00 2001 From: Olink Date: Fri, 29 May 2020 16:44:03 -0400 Subject: [PATCH 14/25] Update GetDataHandlers ExtraValue packet handling to match the network protocol. Update the validation logic to be accurate: * use pixels and not tiles * allow master mode * use npc position and not player position Cleanup some style inconsistencies in NetHooks_SendData. --- TShockAPI/GetDataHandlers.cs | 44 ++++++++++++++++++++++++++++++------ TShockAPI/TShock.cs | 4 ++-- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index b6d35d62..a81ff597 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -151,7 +151,8 @@ namespace TShockAPI { PacketTypes.CrystalInvasionStart, HandleOldOnesArmy }, { PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 }, { PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 }, - { PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing } + { PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing }, + { PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker } }; } @@ -3383,24 +3384,38 @@ namespace TShockAPI private static bool HandleSyncExtraValue(GetDataHandlerArgs args) { var npcIndex = args.Data.ReadInt16(); - var extraValue = args.Data.ReadSingle(); + var extraValue = args.Data.ReadInt32(); var position = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle()); - if (position.X < 0 || position.X >= Main.maxTilesX || position.Y < 0 || position.Y >= Main.maxTilesY) + if (position.X < 0 || position.X >= (Main.maxTilesX * 16.0f) || position.Y < 0 || position.Y >= (Main.maxTilesY * 16.0f)) { TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected extents check {0}", args.Player.Name); return true; } - if (!Main.expertMode) + if (!Main.expertMode && !Main.masterMode) { - TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected expert mode check {0}", args.Player.Name); + TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected expert/master mode check {0}", args.Player.Name); return true; } - if (!args.Player.IsInRange((int)position.X, (int)position.Y)) + if (npcIndex < 0 || npcIndex >= Main.npc.Length) { - TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected range check {0}", args.Player.Name); + TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected npc id out of bounds check - NPC ID: {0}", npcIndex); + return true; + } + + var npc = Main.npc[npcIndex]; + if (npc == null) + { + TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected npc is null - NPC ID: {0}", npcIndex); + return true; + } + + var distanceFromCoinPacketToNpc = Utils.Distance(position, npc.position); + if (distanceFromCoinPacketToNpc >= (5*16f)) //5 tile range + { + TShock.Log.ConsoleDebug("GetDataHandlers / HandleSyncExtraValue rejected range check {0},{1} vs {2},{3} which is {4}", npc.position.X, npc.position.Y, position.X, position.Y, distanceFromCoinPacketToNpc); return true; } @@ -3628,6 +3643,21 @@ namespace TShockAPI return false; } + private static bool HandleSyncRevengeMarker(GetDataHandlerArgs args) + { + int uniqueID = args.Data.ReadInt32(); + Vector2 location = args.Data.ReadVector2(); + int netId = args.Data.ReadInt32(); + float npcHpPercent = args.Data.ReadSingle(); + int npcTypeAgainstDiscouragement = args.Data.ReadInt32(); //tfw the argument is Type Against Discouragement + int npcAiStyleAgainstDiscouragement = args.Data.ReadInt32(); //see ^ + int coinsValue = args.Data.ReadInt32(); + float baseValue = args.Data.ReadSingle(); + bool spawnedFromStatus = args.Data.ReadBoolean(); + + return false; + } + public enum EditAction { KillTile = 0, diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0d19a6fb..9d14ba24 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1635,7 +1635,8 @@ namespace TShockAPI e.Handled = true; return; } - } else if (e.MsgId == PacketTypes.ProjectileNew) + } + else if (e.MsgId == PacketTypes.ProjectileNew) { if (e.number >= 0 && e.number < Main.projectile.Length) { @@ -1660,7 +1661,6 @@ namespace TShockAPI } } } - } } From 7d467224074d43b372ad9ddc70ffe0fbcdca196c Mon Sep 17 00:00:00 2001 From: Olink Date: Fri, 29 May 2020 16:47:43 -0400 Subject: [PATCH 15/25] Update changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cdc3b2..6282150e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) +* Fixed coins not dropping after being picked up by npcs. The ExtraValue packet was not being read correctly. (@Olink) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From 44ad2d2effcc2c0e3e82c1944c8737586a78c532 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 19:50:07 -0700 Subject: [PATCH 16/25] Remove extra debug info from OnGetData Per packet debug logs are redundant for people with the packet monitor plugin. If you need packet monitoring, please install the packet monitor plugin. --- CHANGELOG.md | 9 +++++---- TShockAPI/TShock.cs | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cdc3b2..d409b244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,10 @@ This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. ## Upcoming Release -* Fix pet licenses. (@Olink) -* Initial support for Journey mode in SSC worlds. (@Olink) -* Make TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) -* Reintroduce `-worldselectpath` per feedback from @fjfnaranjo. This command line argument should be used to specify the place where the interactive server startup will look for worlds to show on the world select screen. The original version of this argument, `-worldpath`, was removed because several game service providers have broken configurations that stop the server from running with an unhelpful error. This specific configuration was `-world` and `-worldpath`. In the new world, you can do the following: +* Fixed pet licenses. (@Olink) +* Added initial support for Journey mode in SSC worlds. (@Olink) +* Made TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) +* Reintroduced `-worldselectpath` per feedback from @fjfnaranjo. This command line argument should be used to specify the place where the interactive server startup will look for worlds to show on the world select screen. The original version of this argument, `-worldpath`, was removed because several game service providers have broken configurations that stop the server from running with an unhelpful error. This specific configuration was `-world` and `-worldpath`. In the new world, you can do the following: * `-worldselectpath` should be used if you want to customize the server interactive boot world list (so that you can select from a number of worlds in non-standard locations). * `-world` will behave as an absolute path to the world to load. This is the most common thing you want if you're starting the server and have a specific world in mind. * `-worldselectpath` and `-worldname` should work together enabling you to select from a world from the list that you specify. This is *not* a world file name, but a world name as described by Terraria. @@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) +* Removed packet monitoring from debug logs. To achieve the same results, install @QuiCM's packet monitor plugin (it does better things). (@hakusaro) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0d19a6fb..3839a5ec 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1493,8 +1493,6 @@ namespace TShockAPI PacketTypes type = e.MsgID; - Log.ConsoleDebug("Recv: {0:X}: {2} ({1:XX})", e.Msg.whoAmI, (byte)type, type); - var player = Players[e.Msg.whoAmI]; if (player == null || !player.ConnectionAlive) { From f82ab41a254f893f332900e5f22d6bc8cf5f08a2 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 29 May 2020 21:04:48 -0700 Subject: [PATCH 17/25] Add /sync command to alleviate door related sadness Run /sync if your doors disappear. This will resync your local client with the server state. For more information, please see the associated changelog entry. --- CHANGELOG.md | 6 ++++++ TShockAPI/Bouncer.cs | 6 ++++-- TShockAPI/Commands.cs | 11 +++++++++++ TShockAPI/DB/GroupManager.cs | 3 ++- TShockAPI/Permissions.cs | 3 +++ 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d409b244..fd59e1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) * Removed packet monitoring from debug logs. To achieve the same results, install @QuiCM's packet monitor plugin (it does better things). (@hakusaro) +* Updated packet monitoring in send tile square handler for Bouncer debugging. (@hakusaro) +* Added `/sync`, activated with `tshock.synclocalarea`. This is a default guest permission. When the command is issued, the server will resync area around the player in the event of a desync issue. (@hakusaro) + * If your doors disappear, this command will allow a player to resync without having to disconnect from the server. + * The default group that gets this permission is `Guest` for the time being. + * To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`. + * This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed). ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index abd5fe05..c3a62dae 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -558,6 +558,8 @@ namespace TShockAPI return; } + bool changed = false; + bool failed = false; try { var tiles = new NetTile[size, size]; @@ -569,7 +571,6 @@ namespace TShockAPI } } - bool changed = false; for (int x = 0; x < size; x++) { int realx = tileX + x; @@ -709,9 +710,10 @@ namespace TShockAPI catch { args.Player.SendTileSquare(tileX, tileY, size); + failed = true; } - TShock.Log.ConsoleDebug("Bouncer / SendTileSquare reimplemented from spaghetti from {0}", args.Player.Name); + TShock.Log.ConsoleDebug("Bouncer / SendTileSquare from {0} {1} {2}", args.Player.Name, changed, failed); args.Handled = true; } diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8d131588..fd3f5e9e 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -589,6 +589,10 @@ namespace TShockAPI { HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder." }); + add(new Command(Permissions.synclocalarea, SyncLocalArea, "sync") + { + HelpText = "Sends all tiles from the server to the player to resync the client with the actual world state." + }); #endregion add(new Command(Aliases, "aliases") @@ -5302,6 +5306,13 @@ namespace TShockAPI return; } + private static void SyncLocalArea(CommandArgs args) + { + args.Player.SendTileSquare((int) args.Player.TileX, (int) args.Player.TileY, 32); + args.Player.SendWarningMessage("Sync'd!"); + return; + } + #endregion General Commands #region Cheat Commands diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 6405b5bc..c9a3b760 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -64,7 +64,8 @@ namespace TShockAPI.DB Permissions.canlogin, Permissions.canpartychat, Permissions.cantalkinthird, - Permissions.canchat)); + Permissions.canchat, + Permissions.synclocalarea)); AddDefaultGroup("default", "guest", string.Join(",", diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 322b1199..baf21a73 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -465,6 +465,9 @@ namespace TShockAPI [Description("Player can see advanced information about any user account.")] public static readonly string advaccountinfo = "tshock.accountinfo.details"; + + [Description("Player can resync themselves with server state.")] + public static readonly string synclocalarea = "tshock.synclocalarea"; #endregion /// /// Lists all commands associated with a given permission From 52365078b61184485b3cb5779df79c33efb680b0 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 30 May 2020 00:28:40 -0700 Subject: [PATCH 18/25] Remove extra space from sentence in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6282150e..88173ecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) * Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) * Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) -* Fixed coins not dropping after being picked up by npcs. The ExtraValue packet was not being read correctly. (@Olink) +* Fixed coins not dropping after being picked up by npcs. The ExtraValue packet was not being read correctly. (@Olink) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) From 791a6be8319fb14310585c33a5e6ed3424880395 Mon Sep 17 00:00:00 2001 From: Patrikkk <58985873+Patrikkk@users.noreply.github.com> Date: Sat, 30 May 2020 09:39:40 +0200 Subject: [PATCH 19/25] Add additional FoodPlatter event check. Update range check. (#1941) This is a combination of 3 commits: * @Olink was right. Adding additional check. Modifying range check. There are two ways to place food into a plate. One is by having it in hand (mouse) and right clicking, the other is by having the item selected in the... "inventory bar"(?) and right clicking the plate. Tested range, if player is outside the range, they should not get their item back. * FoodPlatterHotfix - Update IsInRange range value. To suggestion of Olink, to consider player lag and increase the range check. Co-authored-by: Lucas Nicodemus --- TShockAPI/Bouncer.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 68089abc..edf05800 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2072,7 +2072,7 @@ namespace TShockAPI /// internal void OnFoodPlatterTryPlacing(object sender, GetDataHandlers.FoodPlatterTryPlacingEventArgs args) { - if (args.Player.ItemInHand.type != args.ItemID) + if ((args.Player.SelectedItem.type != args.ItemID && args.Player.ItemInHand.type != args.ItemID)) { TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected item not placed by hand from {0}", args.Player.Name); args.Player.SendTileSquare(args.TileX, args.TileY, 1); @@ -2101,12 +2101,9 @@ namespace TShockAPI return; } - if (!args.Player.IsInRange(args.TileX, args.TileY)) + if (!args.Player.IsInRange(args.TileX, args.TileY, range: 13)) // To my knowledge, max legit tile reach with accessories. { TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected range checks from {0}", args.Player.Name); - Item item = new Item(); - item.netDefaults(args.ItemID); - args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix); args.Player.SendTileSquare(args.TileX, args.TileY, 1); args.Handled = true; return; From 0932cc821a2c6c3faf26818ff6176a64970e0f59 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 30 May 2020 14:10:24 -0700 Subject: [PATCH 20/25] Split workflow into Debug and Release --- .github/workflows/build.yml | 49 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a796464b..38d5ba73 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: [push, pull_request] jobs: build: runs-on: windows-latest + strategy: + matrix: + mode: ["Debug", "Release"] steps: - name: Git checkout uses: actions/checkout@v1 @@ -16,28 +19,27 @@ jobs: run: | nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln nuget restore TShock.sln - - name: Build OTAPI (Debug) + - name: Build OTAPI shell: cmd run: | - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Debug - cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=${{ matrix.mode }} + cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\${{ matrix.mode }} TShock.Modifications.Bootstrapper.exe - - name: Build TerrariaServerAPI (Debug) + - name: Build TerrariaServerAPI shell: cmd run: | cd .\TerrariaServerAPI - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Debug - - name: Build TShock (Debug) + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=${{ matrix.mode }} + - name: Build TShock shell: cmd run: | - nuget restore TShock.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Debug - - name: Prepare packaging + "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=${{ matrix.mode }} + - name: Normalize release packaging shell: cmd run: | - xcopy /Y prebuilts\*.* TShockAPI\bin\Debug - mkdir TShockAPI\bin\Debug\ServerPlugins - move TShockAPI\bin\Debug\TShockAPI.dll TShockAPI\bin\Debug\ServerPlugins + xcopy /Y prebuilts\*.* TShockAPI\bin\${{ matrix.mode }} + mkdir TShockAPI\bin\${{ matrix.mode }}\ServerPlugins + move TShockAPI\bin\${{ matrix.mode }}\TShockAPI.dll TShockAPI\bin\${{ matrix.mode }}\ServerPlugins - name: Upload TShock (Debug) uses: actions/upload-artifact@master with: @@ -48,29 +50,6 @@ jobs: with: name: Experimental (debug) OTAPI Bootstrapper path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug\TShock.Modifications.Bootstrapper.exe - - name: Build OTAPI (Not Debug) - shell: cmd - run: | - nuget restore .\TerrariaServerAPI\TShock.4.OTAPI.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TShock.4.OTAPI.sln /p:Configuration=Release - cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release - TShock.Modifications.Bootstrapper.exe - - name: Build TerrariaServerAPI (Not Debug) - shell: cmd - run: | - cd .\TerrariaServerAPI - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TerrariaServerAPI\TerrariaServerAPI.csproj /p:Configuration=Release - - name: Build TShock (Not Debug) - shell: cmd - run: | - nuget restore TShock.sln - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" .\TShockAPI\TShockAPI.csproj /p:Configuration=Release - - name: Normalize release packaging - shell: cmd - run: | - xcopy /Y prebuilts\*.* TShockAPI\bin\Release - mkdir TShockAPI\bin\Release\ServerPlugins - move TShockAPI\bin\Release\TShockAPI.dll TShockAPI\bin\Release\ServerPlugins - name: Upload TShock (Not Debug) uses: actions/upload-artifact@master with: From a815b7556d07f97597fe72c0b9e3ed255effeb78 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 30 May 2020 14:58:46 -0700 Subject: [PATCH 21/25] Upload artifacts with condition --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38d5ba73..54c3555f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,21 +41,25 @@ jobs: mkdir TShockAPI\bin\${{ matrix.mode }}\ServerPlugins move TShockAPI\bin\${{ matrix.mode }}\TShockAPI.dll TShockAPI\bin\${{ matrix.mode }}\ServerPlugins - name: Upload TShock (Debug) + if: contains(matrix.mode, 'Debug') uses: actions/upload-artifact@master with: name: Experimental TShock (debug) path: TShockAPI\bin\Debug - name: Upload OTAPI Bootstrapper (Debug) + if: contains(matrix.mode, 'Debug') uses: actions/upload-artifact@master with: name: Experimental (debug) OTAPI Bootstrapper path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug\TShock.Modifications.Bootstrapper.exe - name: Upload TShock (Not Debug) + if: contains(matrix.mode, 'Release') uses: actions/upload-artifact@master with: name: Experimental TShock (not debug) path: TShockAPI\bin\Release - name: Upload OTAPI Bootstrapper (Not Debug) + if: contains(matrix.mode, 'Release') uses: actions/upload-artifact@master with: name: Experimental (not debug) OTAPI Bootstrapper From 770d17c236cd8691014680fc81f4db590f035524 Mon Sep 17 00:00:00 2001 From: Stargazing Koishi Date: Sat, 30 May 2020 16:07:12 -0700 Subject: [PATCH 22/25] Update .github/workflows/build.yml Co-authored-by: Lucas Nicodemus --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54c3555f..8173267b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v1 with: submodules: recursive - - name: Installer NuGet client + - name: Install NuGet client uses: nuget/setup-nuget@v1 - name: Restore NuGet packages run: | From ac76ccf5893f704836a1887c683daa9cc7eccd66 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 30 May 2020 23:43:51 -0700 Subject: [PATCH 23/25] Fix doors in the lamest way possible (!) Fixes #1774. This commit is designed to fix the clientside door desync issue. Based on the order of events that I've been able to see, the way that door opening works is like this: 1. Client sends a door open request. 2. Server echoes request back to client. 3. Both server and client simulate door opening. 4. The client that requests the initial door open sends a tile square to the server for some reason. In TShock, under all circumstances, we send a tile square back to the client that sends one in, unless you have the `tshock.ignore.sendtilesquare` permission. This adds a deviation: it does not network data back if the event is just a door change. Doing this is safe from the perspective of actual gameplay. A previous iteration of this commit synchronized data to other clients, but that seemed superfluous. This does not really solve the underlying problem or answer the question as to why sending a tile square back to the client seems to throw it off, but it does. I was not able to replicate the desync issue anymore with this branch. I expect that it will be safe to keep, because the improved logic will only happen if the tile square had no effective changes in addition to the door changes. --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a69b28a0..cda3e58e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * The default group that gets this permission is `Guest` for the time being. * To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`. * This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed). +* Fixed smart door automatic door desync and deletion issue. (@hakusaro) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index edf05800..fb7c7182 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -560,6 +560,7 @@ namespace TShockAPI bool changed = false; bool failed = false; + bool doorRelated = false; try { var tiles = new NetTile[size, size]; @@ -591,6 +592,11 @@ namespace TShockAPI continue; } + if (newtile.Active && Terraria.ID.TileID.Sets.RoomNeeds.CountsAsDoor.Contains(newtile.Type)) + { + doorRelated = true; + } + // Fixes the Flower Boots not creating flowers issue if (size == 1 && args.Player.Accessories.Any(i => i.active && i.netID == ItemID.FlowerBoots)) { @@ -704,7 +710,8 @@ namespace TShockAPI } else { - args.Player.SendTileSquare(tileX, tileY, size); + if (!doorRelated) + args.Player.SendTileSquare(tileX, tileY, size); } } catch From 1a35713e3e1d8d62a800bb6ffd67c6cd867f94be Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 31 May 2020 00:46:13 -0700 Subject: [PATCH 24/25] Update changelog for PR 9 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cda3e58e..775dc6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. -## Upcoming Release +## Upcoming release +* Your change goes here! + +## TShock 4.4.0 (Pre-release 9) * Fixed pet licenses. (@Olink) * Added initial support for Journey mode in SSC worlds. (@Olink) * Made TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) From 6ca9a98a913a120f554f8cbbaccc70b382f7d873 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 31 May 2020 13:11:01 -0700 Subject: [PATCH 25/25] Bump max player damage to 42,000 for empress of light Based on feedback from #1936, empress of light needs to do more damage, so we're going to boost it to a higher arbitrary number than it was before. --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 775dc6d3..e8c895eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`. * This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed). * Fixed smart door automatic door desync and deletion issue. (@hakusaro) +* Bump default max damage received cap to 42,000 to accommodate the Empress of Light's instant kill death amount. (@hakusaro, @moisterrific, @Irethia, @Ayrawei) ## TShock 4.4.0 (Pre-release 8) * Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index fb7c7182..eb0cd7b0 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -2043,7 +2043,7 @@ namespace TShockAPI short id = args.PlayerId; PlayerDeathReason playerDeathReason = args.PlayerDeathReason; - if (damage > 20000) //Abnormal values have the potential to cause infinite loops in the server. + if (damage > 42000) //Abnormal values have the potential to cause infinite loops in the server. { TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected high damage from {0} {1}", args.Player.Name, damage); args.Player.Kick("Failed to shade polygon normals.", true, true);