From 8edd0393e5c8855fafc7aa23e96219aec9772e61 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 23 Nov 2021 20:49:41 +1000 Subject: [PATCH] Initial OTAPI3 port TODO: sqlite --- TShock.sln | 62 ++--- TShockAPI/Bouncer.cs | 1 - TShockAPI/Commands.cs | 1 - TShockAPI/GetDataHandlers.cs | 1 - TShockAPI/Handlers/SendTileRectHandler.cs | 4 +- TShockAPI/ItemBans.cs | 1 - TShockAPI/Properties/AssemblyInfo.cs | 57 ----- TShockAPI/TSPlayer.cs | 1 - TShockAPI/TSServerPlayer.cs | 1 - TShockAPI/TShock.cs | 11 +- TShockAPI/TShockAPI.csproj | 279 +++++----------------- TShockAPI/app.config | 9 - TShockAPI/packages.config | 6 - TShockAPI/web.config | 9 - TerrariaServerAPI | 2 +- 15 files changed, 86 insertions(+), 359 deletions(-) delete mode 100644 TShockAPI/Properties/AssemblyInfo.cs delete mode 100644 TShockAPI/app.config delete mode 100644 TShockAPI/packages.config delete mode 100644 TShockAPI/web.config diff --git a/TShock.sln b/TShock.sln index af79472c..45ac4bdb 100644 --- a/TShock.sln +++ b/TShock.sln @@ -1,13 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31825.309 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{755F5B05-0924-47E9-9563-26EB20FE3F67}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockAPI", "TShockAPI\TShockAPI.csproj", "{49606449-072B-4CF5-8088-AA49DA586694}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TShockAPI", "TShockAPI\TShockAPI.csproj", "{49606449-072B-4CF5-8088-AA49DA586694}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerrariaServerAPI", "TerrariaServerAPI\TerrariaServerAPI\TerrariaServerAPI.csproj", "{6877506E-ADC6-4142-98A6-79E4FA02855A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerrariaServerAPI", "TerrariaServerAPI\TerrariaServerAPI\TerrariaServerAPI.csproj", "{6877506E-ADC6-4142-98A6-79E4FA02855A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,10 +15,6 @@ Global Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Mono|Any CPU = Mono|Any CPU - Mono|Mixed Platforms = Mono|Mixed Platforms - Mono|x64 = Mono|x64 - Mono|x86 = Mono|x86 Release|Any CPU = Release|Any CPU Release|Mixed Platforms = Release|Mixed Platforms Release|x64 = Release|x64 @@ -32,14 +28,7 @@ Global {49606449-072B-4CF5-8088-AA49DA586694}.Debug|x64.ActiveCfg = Debug|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Debug|x64.Build.0 = Debug|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Debug|x86.ActiveCfg = Debug|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|Any CPU.ActiveCfg = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|Any CPU.Build.0 = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|Mixed Platforms.ActiveCfg = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|Mixed Platforms.Build.0 = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|x64.ActiveCfg = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|x64.Build.0 = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|x86.ActiveCfg = Release|Any CPU - {49606449-072B-4CF5-8088-AA49DA586694}.Mono|x86.Build.0 = Release|Any CPU + {49606449-072B-4CF5-8088-AA49DA586694}.Debug|x86.Build.0 = Debug|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|Any CPU.ActiveCfg = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|Any CPU.Build.0 = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -47,31 +36,30 @@ Global {49606449-072B-4CF5-8088-AA49DA586694}.Release|x64.ActiveCfg = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|x64.Build.0 = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|x86.ActiveCfg = Release|Any CPU - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Any CPU.ActiveCfg = Debug|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x64.ActiveCfg = Debug|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x64.Build.0 = Debug|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.ActiveCfg = Debug|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.Build.0 = Debug|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|Any CPU.ActiveCfg = Mono|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|Mixed Platforms.ActiveCfg = Mono|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|Mixed Platforms.Build.0 = Mono|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|x64.ActiveCfg = Mono|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|x64.Build.0 = Mono|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|x86.ActiveCfg = Mono|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Mono|x86.Build.0 = Mono|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Any CPU.ActiveCfg = Release|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.Build.0 = Release|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x64.ActiveCfg = Release|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x64.Build.0 = Release|x64 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.ActiveCfg = Release|x86 - {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.Build.0 = Release|x86 + {49606449-072B-4CF5-8088-AA49DA586694}.Release|x86.Build.0 = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x64.ActiveCfg = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x64.Build.0 = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.ActiveCfg = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Debug|x86.Build.0 = Debug|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Any CPU.Build.0 = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x64.ActiveCfg = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x64.Build.0 = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.ActiveCfg = Release|Any CPU + {6877506E-ADC6-4142-98A6-79E4FA02855A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B56F0765-BADD-48CF-8A19-436BD0EAD34A} + EndGlobalSection GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = Terraria.vsmdi EndGlobalSection diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 746904cd..c4985d84 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -22,7 +22,6 @@ using Terraria.ID; using TShockAPI.Net; using Terraria; using Microsoft.Xna.Framework; -using OTAPI.Tile; using TShockAPI.Localization; using static TShockAPI.GetDataHandlers; using Terraria.ObjectData; diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index dac563e4..d18992a1 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -33,7 +33,6 @@ using TerrariaApi.Server; using TShockAPI.Hooks; using Terraria.GameContent.Events; using Microsoft.Xna.Framework; -using OTAPI.Tile; using TShockAPI.Localization; using System.Text.RegularExpressions; using Terraria.DataStructures; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 0e6097f1..4d495209 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -34,7 +34,6 @@ using Terraria.DataStructures; using Terraria.GameContent.Tile_Entities; using Terraria.Localization; using Microsoft.Xna.Framework; -using OTAPI.Tile; using TShockAPI.Localization; using TShockAPI.Models; using TShockAPI.Models.PlayerUpdate; diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index b5c0bafd..5508aa52 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -1,6 +1,4 @@ -using OTAPI.Tile; - -using System; +using System; using System.Collections.Generic; using System.Linq; diff --git a/TShockAPI/ItemBans.cs b/TShockAPI/ItemBans.cs index 3556d38c..4e0594ae 100644 --- a/TShockAPI/ItemBans.cs +++ b/TShockAPI/ItemBans.cs @@ -23,7 +23,6 @@ using TShockAPI.DB; using TShockAPI.Net; using Terraria; using Microsoft.Xna.Framework; -using OTAPI.Tile; using TShockAPI.Localization; using static TShockAPI.GetDataHandlers; using TerrariaApi.Server; diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs deleted file mode 100644 index fc81908d..00000000 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* -TShock, a server mod for Terraria -Copyright (C) 2011-2019 Pryaxis & TShock Contributors - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("TShock for Terraria")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Re-Logic, Pryaxis & TShock Contributors")] -[assembly: AssemblyProduct("TShockAPI")] -[assembly: AssemblyCopyright("Copyright © Re-Logic, Pryaxis & TShock Contributors 2011-2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly: Guid("01e38989-993c-410c-9011-487f824a606d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Starting in version 4.2.5, we are no longer including the fourth decimal -// location, which previously held the date and time. - -// Also, be sure to release on github with the exact assembly version tag as below -// so that the update manager works correctly (via the Github releases api and mimic) - -[assembly: AssemblyVersion("4.5.7")] -[assembly: AssemblyFileVersion("4.5.7")] diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 7dfc377b..723c555c 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -25,7 +25,6 @@ using System.IO; using System.Text; using System.Threading; using System.Timers; -using OTAPI.Tile; using Terraria; using Terraria.DataStructures; using Terraria.ID; diff --git a/TShockAPI/TSServerPlayer.cs b/TShockAPI/TSServerPlayer.cs index 9f59da49..f6066267 100644 --- a/TShockAPI/TSServerPlayer.cs +++ b/TShockAPI/TSServerPlayer.cs @@ -17,7 +17,6 @@ along with this program. If not, see . */ using Microsoft.Xna.Framework; -using OTAPI.Tile; using System; using System.Collections.Generic; using Terraria; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index ae6b6e00..5f60c05a 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -197,17 +197,14 @@ namespace TShockAPI string logFilename; string logPathSetupWarning; - OTAPI.Hooks.Net.Socket.Create = () => + OTAPI.Hooks.Netplay.CreateTcpListener += (sender, args) => { - //Console.WriteLine($"Creating socket {nameof(LinuxTcpSocket)}"); - return new LinuxTcpSocket(); - //return new OTAPI.Sockets.PoolSocket(); - //return new Terraria.Net.Sockets.TcpSocket(); + args.Result = new LinuxTcpSocket(); }; - OTAPI.Hooks.Player.Announce = (int playerId) => + OTAPI.Hooks.NetMessage.PlayerAnnounce += (sender, args) => { //TShock handles this - return OTAPI.HookResult.Cancel; + args.Result = OTAPI.HookResult.Cancel; }; Main.SettingsUnlock_WorldEvil = true; diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 146fea27..71ffca84 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -1,242 +1,73 @@  - + + - Debug - AnyCPU - {49606449-072B-4CF5-8088-AA49DA586694} Library - Properties - TShockAPI - TShockAPI - v4.5 - 512 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + net5.0 true - bin\Debug\TShockAPI.XML - x86 - false - - - pdbonly - true - bin\Release\ - TRACE;COMPAT_SIGS - prompt - 4 - true - bin\Release\TShockAPI.XML - x86 - false + True + True + GPL-3.0-only + + 4.5.7 + 4.5.7 + 4.5.7 + TShock for Terraria + Re-Logic, Pryaxis & TShock Contributors + TShockAPI + Copyright © Re-Logic, Pryaxis & TShock Contributors 2011-2021 + + true + + + + + + + + + + + - - ..\packages\BCrypt.Net.0.1.0\lib\net35\BCrypt.Net.dll - True - ..\prebuilts\HttpServer.dll ..\prebuilts\Mono.Data.Sqlite.dll - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True - - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - False - ..\TerrariaServerAPI\TerrariaServerAPI\bin\$(ConfigurationName)\OTAPI.dll - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - - - - - - + + - - - - + + + - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - {6877506e-adc6-4142-98a6-79e4fa02855a} - TerrariaServerAPI - - - - - - - - - - - - - - - - - - + diff --git a/TShockAPI/app.config b/TShockAPI/app.config deleted file mode 100644 index 1565cd9f..00000000 --- a/TShockAPI/app.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/TShockAPI/packages.config b/TShockAPI/packages.config deleted file mode 100644 index 691052d5..00000000 --- a/TShockAPI/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/TShockAPI/web.config b/TShockAPI/web.config deleted file mode 100644 index 74c0d886..00000000 --- a/TShockAPI/web.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/TerrariaServerAPI b/TerrariaServerAPI index b9a0fdf6..87a3760c 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit b9a0fdf6d464d17c47f70ed9327779a78a0aaee4 +Subproject commit 87a3760c6c3e0b48d0efdff1e5bac18543d198f2