diff --git a/Crossplay/Crossplay.cs b/Crossplay/CrossplayPlugin.cs similarity index 96% rename from Crossplay/Crossplay.cs rename to Crossplay/CrossplayPlugin.cs index c651ab4..ac779f8 100644 --- a/Crossplay/Crossplay.cs +++ b/Crossplay/CrossplayPlugin.cs @@ -16,21 +16,22 @@ namespace Crossplay { [ApiVersion(2, 1)] - public class Crossplay : TerrariaPlugin + public class CrossplayPlugin : TerrariaPlugin { public static int Header = 3; public override string Name => "Crossplay"; public override string Author => "Moneylover3246"; public override string Description => "Enables crossplay for terraria"; - public override Version Version => new Version("1.4.2.1"); + public override Version Version => new Version("1.5.0"); + + private readonly List AllowedVersions = new List() { 230, 233, 234, 235, 236, 237, 238 }; - private static List AllowedVersions = new List() { 230, 233, 234, 235, 236, 237 }; public static string ConfigPath => Path.Combine("tshock", "Crossplay.json"); public static CrossplayConfig Config = new CrossplayConfig(); - private static readonly int[] ClientVersions = new int[Main.maxPlayers]; - private static readonly Dictionary MaxNPCID = new Dictionary() + private readonly int[] ClientVersions = new int[Main.maxPlayers]; + public static readonly Dictionary MaxNPCID = new Dictionary() { { 230, 662 }, { 233, 664 }, @@ -38,6 +39,7 @@ public class Crossplay : TerrariaPlugin { 235, 664 }, { 236, 664 }, { 237, 666 }, + { 238, 667 }, }; public static readonly Dictionary MaxTileType = new Dictionary() { @@ -47,6 +49,7 @@ public class Crossplay : TerrariaPlugin { 235, 623 }, { 236, 623 }, { 237, 623 }, + { 238, 623 }, }; public static readonly Dictionary MaxBuffType = new Dictionary() { @@ -56,6 +59,7 @@ public class Crossplay : TerrariaPlugin { 235, 329 }, { 236, 329 }, { 237, 329 }, + { 238, 329 }, }; public static readonly Dictionary MaxProjectileType = new Dictionary() { @@ -65,6 +69,7 @@ public class Crossplay : TerrariaPlugin { 235, 955 }, { 236, 955 }, { 237, 955 }, + { 238, 955 } }; public static readonly Dictionary MaxItemType = new Dictionary() { @@ -74,9 +79,10 @@ public class Crossplay : TerrariaPlugin { 235, 5087 }, { 236, 5087 }, { 237, 5087 }, + { 238, 5087 }, }; - public Crossplay(Main game) : base(game) + public CrossplayPlugin(Main game) : base(game) { Order = -1; } @@ -153,7 +159,7 @@ private void GetData(GetDataEventArgs args) .SetType(1) .PackString($"Terraria{Main.curRelease}") .GetByteData(); - Log($"Changing version of index {args.Msg.whoAmI} from {Convert(version)} => v1.4.2.3", color: ConsoleColor.Green); + Log($"Changing version of index {args.Msg.whoAmI} from {Convert(version)} => {Convert(Main.curRelease)}", color: ConsoleColor.Green); Buffer.BlockCopy(connectRequest, 0, args.Msg.readBuffer, args.Index - 3, connectRequest.Length); } @@ -254,6 +260,10 @@ private void SendBytes(SendBytesEventArgs args) { case PacketTypes.WorldInfo: { + if (playerVersion >= 238) + { + return; + } byte[] bytes = reader.ReadBytes(22); string worldName = reader.ReadString(); byte[] bytes2 = reader.ReadBytes(103); @@ -585,8 +595,10 @@ private string Convert(int version) return "v1.4.2.2"; case "Terraria238": return "v1.4.2.3"; + case "Terraria242": + return "v1.4.3"; } - return ""; + return $"Unknown{version}"; } public static void Log(string message, bool debug = false, ConsoleColor color = ConsoleColor.White) diff --git a/Crossplay/SectionHelper.cs b/Crossplay/SectionHelper.cs index da3e395..4410030 100644 --- a/Crossplay/SectionHelper.cs +++ b/Crossplay/SectionHelper.cs @@ -12,7 +12,7 @@ public class SectionHelper { public static byte[] WriteDecompressedSection(MemoryStream decompressionStream, int version) { - int maxTileType = Crossplay.MaxTileType[version]; + int maxTileType = CrossplayPlugin.MaxTileType[version]; using (BinaryReader reader = new BinaryReader(decompressionStream)) { BinaryWriter writer = new BinaryWriter(decompressionStream); @@ -61,7 +61,7 @@ public static byte[] WriteDecompressedSection(MemoryStream decompressionStream, } writer.BaseStream.Position -= 2; writer.Write((ushort)newType); - Crossplay.Log($"/ SendSection - Processed a tile conversion from {(typeLong << 8) | typeShort} -> {newType}", true, ConsoleColor.Red); + CrossplayPlugin.Log($"/ SendSection - Processed a tile conversion from {(typeLong << 8) | typeShort} -> {newType}", true, ConsoleColor.Red); } } else diff --git a/Crossplay/obj/Release/net40/.NETFramework,Version=v4.0.AssemblyAttributes.cs b/Crossplay/obj/Release/net40/.NETFramework,Version=v4.0.AssemblyAttributes.cs deleted file mode 100644 index 5d01041..0000000 --- a/Crossplay/obj/Release/net40/.NETFramework,Version=v4.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] diff --git a/Crossplay/obj/Release/net40/Crossplay.AssemblyInfo.cs b/Crossplay/obj/Release/net40/Crossplay.AssemblyInfo.cs deleted file mode 100644 index b0e00b9..0000000 --- a/Crossplay/obj/Release/net40/Crossplay.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyTitleAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/Crossplay/obj/Release/net45/Crossplay.AssemblyInfo.cs b/Crossplay/obj/Release/net45/Crossplay.AssemblyInfo.cs index b0e00b9..0563f5e 100644 --- a/Crossplay/obj/Release/net45/Crossplay.AssemblyInfo.cs +++ b/Crossplay/obj/Release/net45/Crossplay.AssemblyInfo.cs @@ -13,11 +13,11 @@ [assembly: System.Reflection.AssemblyCompanyAttribute("Crossplay")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.5.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.5.0")] [assembly: System.Reflection.AssemblyProductAttribute("Crossplay")] [assembly: System.Reflection.AssemblyTitleAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.5.0")] // Generated by the MSBuild WriteCodeFragment class. diff --git a/Crossplay/obj/Release/net45/Crossplay.GeneratedMSBuildEditorConfig.editorconfig b/Crossplay/obj/Release/net45/Crossplay.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..38d350e --- /dev/null +++ b/Crossplay/obj/Release/net45/Crossplay.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,3 @@ +is_global = true +build_property.RootNamespace = Crossplay +build_property.ProjectDir = C:\Users\Evan\Downloads\Crossplay\Crossplay\ diff --git a/Crossplay/obj/Release/net472/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/Crossplay/obj/Release/net472/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs deleted file mode 100644 index 3871b18..0000000 --- a/Crossplay/obj/Release/net472/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/Crossplay/obj/Release/net472/Crossplay.AssemblyInfo.cs b/Crossplay/obj/Release/net472/Crossplay.AssemblyInfo.cs deleted file mode 100644 index b7ea82b..0000000 --- a/Crossplay/obj/Release/net472/Crossplay.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.4.2.1")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyTitleAttribute("Crossplay")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.4.2.1")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/References/OTAPI.dll b/References/OTAPI.dll index e8b0911..b10fe00 100644 Binary files a/References/OTAPI.dll and b/References/OTAPI.dll differ diff --git a/References/TShockAPI.dll b/References/TShockAPI.dll index 333a863..31194c8 100644 Binary files a/References/TShockAPI.dll and b/References/TShockAPI.dll differ diff --git a/References/TerrariaServer.exe b/References/TerrariaServer.exe index 9bb2390..9d2c61f 100644 Binary files a/References/TerrariaServer.exe and b/References/TerrariaServer.exe differ