Skip to content

Commit 5fc8971

Browse files
Add protocol support for Terraria 1.4.3.2
Adds version support for 1.4.3.2 Terraria servers + maintains compatibility with clients on 1.4.3.1
1 parent c08eb0b commit 5fc8971

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Crossplay/CrossplayPlugin.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public class CrossplayPlugin : TerrariaPlugin
2222
public override string Name => "Crossplay";
2323
public override string Author => "Moneylover3246";
2424
public override string Description => "Enables crossplay for terraria";
25-
public override Version Version => new Version("1.6.0");
25+
public override Version Version => new Version("1.7.0");
2626

27-
private readonly List<int> AllowedVersions = new List<int>() { 230, 233, 234, 235, 236, 237, 238, 242 };
27+
private readonly List<int> AllowedVersions = new List<int>() { 230, 233, 234, 235, 236, 237, 238, 242, 243 };
2828

2929
public static string ConfigPath => Path.Combine("tshock", "Crossplay.json");
3030

@@ -41,6 +41,7 @@ public class CrossplayPlugin : TerrariaPlugin
4141
{ 237, 666 },
4242
{ 238, 667 },
4343
{ 242, 669 },
44+
{ 243, 669 },
4445
};
4546
public static readonly Dictionary<int, int> MaxTileType = new Dictionary<int, int>()
4647
{
@@ -52,6 +53,7 @@ public class CrossplayPlugin : TerrariaPlugin
5253
{ 237, 623 },
5354
{ 238, 623 },
5455
{ 242, 624 },
56+
{ 243, 624 },
5557
};
5658
public static readonly Dictionary<int, int> MaxBuffType = new Dictionary<int, int>()
5759
{
@@ -63,6 +65,7 @@ public class CrossplayPlugin : TerrariaPlugin
6365
{ 237, 329 },
6466
{ 238, 329 },
6567
{ 242, 335 },
68+
{ 243, 335 },
6669
};
6770
public static readonly Dictionary<int, int> MaxProjectileType = new Dictionary<int, int>()
6871
{
@@ -74,6 +77,7 @@ public class CrossplayPlugin : TerrariaPlugin
7477
{ 237, 955 },
7578
{ 238, 955 },
7679
{ 242, 970 },
80+
{ 243, 970 },
7781
};
7882
public static readonly Dictionary<int, int> MaxItemType = new Dictionary<int, int>()
7983
{
@@ -85,6 +89,7 @@ public class CrossplayPlugin : TerrariaPlugin
8589
{ 237, 5087 },
8690
{ 238, 5087 },
8791
{ 242, 5124 },
92+
{ 243, 5124 },
8893
};
8994

9095
public CrossplayPlugin(Main game) : base(game)
@@ -274,7 +279,7 @@ private void SendBytes(SendBytesEventArgs args)
274279
byte[] bytes = reader.ReadBytes(22);
275280
string worldName = reader.ReadString();
276281
byte[] bytes2 = reader.ReadBytes(103);
277-
reader.ReadByte(); // Main.tenthAnniversaryWorld
282+
reader.BaseStream.Position++; // bitFlags[8]
278283
byte[] bytes3 = reader.ReadBytes(27);
279284
byte[] worldInfo = new PacketFactory()
280285
.SetType(7)
@@ -436,7 +441,7 @@ private void SendBytes(SendBytesEventArgs args)
436441
}
437442
Log($"/ ProjectileUpdate - swapped type from {old} -> {projType} from previously exceeded maxType", true, ConsoleColor.DarkGreen);
438443
}
439-
if (playerVersion < 237)
444+
if (playerVersion > 236)
440445
{
441446
return;
442447
}
@@ -462,14 +467,14 @@ private void SendBytes(SendBytesEventArgs args)
462467
break;
463468
case PacketTypes.NpcUpdate:
464469
{
465-
reader.ReadBytes(20);
470+
reader.BaseStream.Position += 20;
466471
BitsByte npcFlags = reader.ReadByte();
467-
reader.ReadByte();
472+
reader.BaseStream.Position++;
468473
for (int i = 2; i < 6; i++)
469474
{
470475
if (npcFlags[i])
471476
{
472-
reader.ReadSingle();
477+
reader.BaseStream.Position += 4;
473478
}
474479
}
475480
int type = reader.ReadInt16();
@@ -484,7 +489,6 @@ private void SendBytes(SendBytesEventArgs args)
484489
case PacketTypes.PlayerBuff:
485490
{
486491
var playerId = reader.ReadByte();
487-
488492
var buffWrite = new PacketFactory();
489493
buffWrite.SetType(50);
490494
buffWrite.PackByte(playerId);
@@ -615,6 +619,8 @@ private string Convert(int version)
615619
return "v1.4.3";
616620
case "Terraria243":
617621
return "v1.4.3.1";
622+
case "Terraria244":
623+
return "v1.4.3.2";
618624
}
619625
return $"Unknown{version}";
620626
}

Crossplay/obj/Release/net45/Crossplay.AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
[assembly: System.Reflection.AssemblyCompanyAttribute("Crossplay")]
1515
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
16-
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.6.0")]
17-
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.6.0")]
16+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.7.0")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.7.0")]
1818
[assembly: System.Reflection.AssemblyProductAttribute("Crossplay")]
1919
[assembly: System.Reflection.AssemblyTitleAttribute("Crossplay")]
20-
[assembly: System.Reflection.AssemblyVersionAttribute("1.6.0")]
20+
[assembly: System.Reflection.AssemblyVersionAttribute("1.7.0")]
2121

2222
// Generated by the MSBuild WriteCodeFragment class.
2323

References/OTAPI.dll

5.5 KB
Binary file not shown.

References/TerrariaServer.exe

-8.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)