merge general-devel into fix-sts

This commit is contained in:
Chris 2020-06-01 15:21:55 +09:30
commit e658af32ef
8 changed files with 141 additions and 68 deletions

View file

@ -5,68 +5,62 @@ on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
mode: ["Debug", "Release"]
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: Install 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
cd .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Debug
TShock.Modifications.Bootstrapper.exe
- name: OTAPI Release
nuget restore TShock.sln
- name: Build OTAPI
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
"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: 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: 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: TerrariaServerAPI Release
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
"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\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
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)
if: contains(matrix.mode, '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)
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
- uses: actions/upload-artifact@master
- 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
path: .\TerrariaServerAPI\TShock.Modifications.Bootstrapper\bin\Release\TShock.Modifications.Bootstrapper.exe

View file

@ -2,20 +2,37 @@
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:
## 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)
* 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.
* `-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. (@moisterrific)
* Updated `/spawnboss` command to include Empress of Light and Queen Slime. (@moisterrific)
* Added journey mode permissions to owner group by default. (@moisterrific)
* 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)
* 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)
* 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).
* 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)

View file

@ -1344,7 +1344,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;
}
@ -1840,7 +1840,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);
@ -1876,7 +1876,7 @@ namespace TShockAPI
/// <param name="args"></param>
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);
@ -1905,12 +1905,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;

View file

@ -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")
@ -2378,7 +2382,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 +2446,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 +2486,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;
@ -5302,6 +5316,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

View file

@ -64,7 +64,8 @@ namespace TShockAPI.DB
Permissions.canlogin,
Permissions.canpartychat,
Permissions.cantalkinthird,
Permissions.canchat));
Permissions.canchat,
Permissions.synclocalarea));
AddDefaultGroup("default", "guest",
string.Join(",",
@ -172,7 +173,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_setspawnrate));
}
// Load Permissions from the DB

View file

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

View file

@ -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
/// <summary>
/// Lists all commands associated with a given permission

View file

@ -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)
{
@ -1635,7 +1633,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 +1659,6 @@ namespace TShockAPI
}
}
}
}
}