Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion TrClient/TClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class TClient
private TcpClient client;

public byte PlayerSlot { get; private set; }
public string CurRelease = "Terraria279";
public string CurRelease = "Terraria315";
public string Username = "";
public bool IsPlaying { get; private set; }

Expand Down Expand Up @@ -156,6 +156,7 @@ private void InternalOn()
On<LoadPlayer>(player =>
{
PlayerSlot = player.PlayerSlot;
Send(new ClientUUID() { UUID = Guid.NewGuid().ToString() });
SendPlayer();
Send(new RequestWorldInfo());
});
Expand Down
6 changes: 3 additions & 3 deletions TrClientTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Program
static void Main(string[] args)
{
var client = new TClient();
var ip = "43.248.184.35";
ushort port = 1001;
var ip = "127.0.0.1";
ushort port = 7777;
/*
ip = "43.248.184.35";
port = 7777;*/
Expand All @@ -35,7 +35,7 @@ static void Main(string[] args)
bool shouldSpam = false;

client.On<LoadPlayer>(_ =>
client.Send(new ClientUUID { UUID = Guid.Empty.ToString() }));
client.Send(new ClientUUID { UUID = Guid.NewGuid().ToString() }));
client.On<WorldData>(_ =>
{
if (!shouldSpam)
Expand Down
49 changes: 39 additions & 10 deletions TrProtocol/MessageID.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace TrProtocol;
using System.Runtime.InteropServices;

namespace TrProtocol;

public enum MessageID : byte
{
Expand All @@ -13,10 +15,12 @@ public enum MessageID : byte
RequestTileData = 8,
StatusText = 9,
TileSection = 10,
FrameSection = 11,
[Obsolete("Deprecated. Framing happens as needed after TileSection is sent.")]
FrameSection = 11,
SpawnPlayer = 12,
PlayerControls = 13,
Unused15 = 15,
[Obsolete("Deprecated.")]
Unused15 = 15,
PlayerHealth = 16,
TileChange = 17,
MenuSunMoon = 18,
Expand Down Expand Up @@ -49,7 +53,8 @@ public enum MessageID : byte
KillPlayer = 44,
RequestReadSign = 46,
ReadSign = 47,
LiquidUpdate = 48,
[Obsolete("Deprecated. Use NetLiquidModule instead.")]
LiquidUpdate = 48,
StartPlaying = 49,
PlayerBuffs = 50,
Assorted1 = 51,
Expand All @@ -74,14 +79,17 @@ public enum MessageID : byte
InvasionProgressReport = 78,
CombatTextInt = 81,
NetModules = 82,
NPCKillCountDeathTally = 83,
[Obsolete("Deprecated.")]
NPCKillCountDeathTally = 83,
QuickStackChests = 85,
TileEntitySharing = 86,
TileEntityPlacement = 87,
ItemTweaker = 88,
ItemFrameTryPlacing = 89,
[Obsolete("Deprecated.")]
InstancedItem = 90,
SyncEmoteBubble = 91,
[Obsolete("Deprecated.")]
Unused94 = 94,
MurderSomeoneElsesProjectile = 95,
TeleportPlayerThroughPortal = 96,
Expand Down Expand Up @@ -109,7 +117,6 @@ public enum MessageID : byte
TileGetSection = 8,
Status = 9,
TileSendSection = 10,
TileFrameSection = 11,
PlayerSpawn = 12,
PlayerUpdate = 13,
PlayerActive = 14,
Expand Down Expand Up @@ -142,7 +149,6 @@ public enum MessageID : byte
PlayerTeam = 45,
SignRead = 46,
SignNew = 47,
LiquidSet = 48,
PlayerSpawnSelf = 49,
PlayerBuff = 50,
NpcSpecial = 51,
Expand Down Expand Up @@ -177,7 +183,6 @@ public enum MessageID : byte
SyncPlayerChestIndex = 80,
CreateCombatText = 81,
LoadNetModule = 82,
NpcKillCount = 83,
PlayerStealth = 84,
ForceItemIntoNearestChest = 85,
UpdateTileEntity = 86,
Expand All @@ -201,18 +206,23 @@ public enum MessageID : byte
NpcShopItem = 104,
GemLockToggle = 105,
PoofOfSmoke = 106,
[Obsolete("Deprecated. Use NetTextModule instead.")]
SmartTextMessage = 107,
WiredCannonShot = 108,
MassWireOperation = 109,
MassWireOperationPay = 110,
[Obsolete("Deprecated.")]
ToggleParty = 111,
TreeGrowFX = 112,
CrystalInvasionStart = 113,
[Obsolete]
CrystalInvasionWipeAll = 114,
[Obsolete]
MinionAttackTargetUpdate = 115,
CrystalInvasionSendWaitTime = 116,
PlayerHurtV2 = 117,
PlayerDeathV2 = 118,
[Obsolete]
CreateCombatTextExtended = 119,
Emoji = 120,
TileEntityDisplayDollItemSync = 121,
Expand All @@ -223,6 +233,7 @@ public enum MessageID : byte
SyncRevengeMarker = 126,
RemoveRevengeMarker = 127,
LandGolfBallInCup = 128,
[Obsolete]
FinishedConnectingToServer = 129,
FishOutNPC = 130,
TamperWithNPC = 131,
Expand All @@ -232,18 +243,36 @@ public enum MessageID : byte
DeadPlayer = 135,
SyncCavernMonsterType = 136,
RequestNPCBuffRemoval = 137,
[Obsolete]
ClientSyncedInventory = 138,
SetCountsAsHostForGameplay = 139,
SetMiscEventValues = 140,
RequestLucyPopup = 141,
SyncProjectileTrackers = 142,
[Obsolete]
CrystalInvasionRequestedToSkipWaitTime = 143,
[Obsolete]
RequestQuestEffect = 144,
[Obsolete]
SyncItemsWithShimmer = 145,
ShimmerActions = 146,
SyncLoadout = 147,
[Obsolete]
SyncItemCannotBeTakenByEnemies = 148,
DeadCellsDisplayJarTryPlacing = 149,

ServerInfo = 149,
PlayerPlatformInfo = 150
ServerInfo = 180,
PlayerPlatformInfo = 170,
SpectatePlayer = 150,
SyncItemDespawn = 151,
ItemUseSound = 152,
NPCDebuffDamage = 153,
Ping = 154,
SyncChestSize = 155,
TELeashedEntityAnchorPlaceItem = 156,
TeamChangeFromUI = 157,
ExtraSpawnSectionLoaded = 158,
RequestSection = 159,
ItemPosition = 160,
HostToken = 161,
}
16 changes: 16 additions & 0 deletions TrProtocol/Models/BannersMessageType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrProtocol.Models;

public enum BannersMessageType : byte
{
FullState,
KillCountUpdate,
ClaimCountUpdate,
ClaimRequest,
ClaimResponse
}
2 changes: 1 addition & 1 deletion TrProtocol/Models/Buff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ namespace TrProtocol.Models;
public partial struct Buff
{
public ushort BuffType { get; set; }
public short BuffTime { get; set; }
public ushort BuffTime { get; set; }
}
13 changes: 13 additions & 0 deletions TrProtocol/Models/ExtraSpawnPointData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrProtocol.Models;

public partial struct ExtraSpawnPointData
{
public byte Count { get; set; }
public ShortPosition[] SpawnPoints { get; set; }
}
16 changes: 10 additions & 6 deletions TrProtocol/Models/NetModuleType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ public enum NetModuleType : short
NetPingModule = 2,
NetAmbienceModule = 3,
NetBestiaryModule = 4,
NetCreativeUnlocksModule = 5,
NetCreativePowersModule = 6,
NetCreativeUnlocksPlayerReportModule = 7,
NetTeleportPylonModule = 8,
NetParticlesModule = 9,
NetCreativePowerPermissionsModule = 10
NetCreativePowersModule = 5,
NetCreativeUnlocksPlayerReportModule = 6,
NetTeleportPylonModule = 7,
NetParticlesModule = 8,
NetCreativePowerPermissionsModule = 9,
BannerSystemNetBannersModule = 10,
CraftingRequestsNetCraftingRequestsModule = 11,
TagEffectStateNetModule = 12,
LeashedEntityNetModule = 13,
UnbreakableWallScanNetModule = 14
}
2 changes: 1 addition & 1 deletion TrProtocol/Models/ParticleOrchestraSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public static ParticleOrchestraSettings DeserializeFrom(BinaryReader reader)

public byte IndexOfPlayerWhoInvokedThis;

public const int SerializationSize = 21;
public const int SerializationSize = 22;
}

14 changes: 14 additions & 0 deletions TrProtocol/Models/QuickStackChestData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrProtocol.Models;

public partial struct QuickStackChestData
{
public int ItemCount { get; set; }
public short[] SlotIds { get; set; }
public short ChestSlot { get; set; }
}
12 changes: 12 additions & 0 deletions TrProtocol/Models/RequiredItemData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace TrProtocol.Models;

public partial struct RequiredItemData
{
public int ItemCount { get; set; }

public RequiredItemEntry[] ItemEntries { get; set; }

public int ChestCount { get; set; }

public int[] ChestSlots { get; set; }
}
7 changes: 7 additions & 0 deletions TrProtocol/Models/RequiredItemEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace TrProtocol.Models;

public struct RequiredItemEntry
{
public int ItemIdOrRecipeGroup { get; set; }
public int Stack { get; set; }
}
16 changes: 16 additions & 0 deletions TrProtocol/Models/TagEffectType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrProtocol.Models;

public enum TagEffectType
{
FullState,
ChangeActiveEffect,
ApplyTagToNPC,
EnableProcOnNPC,
ClearProcOnNPC
}
2 changes: 1 addition & 1 deletion TrProtocol/PacketSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public Packet Deserialize(BinaryReader br0)
using var br = new BinaryReader(ms);
Packet result = null;
var msgid = (MessageID)br.ReadByte();
if (msgid == MessageID.NetModules)
if (msgid == MessageID.LoadNetModule)
{
var moduletype = (NetModuleType)br.ReadInt16();
if (moduledeserializers.TryGetValue(moduletype, out var f))
Expand Down
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AchievementMessageEventHappened.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public class AchievementMessageEventHappened : Packet
{
public override MessageID Type => MessageID.AchievementMessageEventHappened;
public override MessageID Type => MessageID.NotifyPlayerOfEvent;
public short EventType { get; set; }
}
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AchievementMessageNPCKilled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

public class AchievementMessageNPCKilled : Packet
{
public override MessageID Type => MessageID.AchievementMessageNPCKilled;
public override MessageID Type => MessageID.NotifyPlayerNpcKilled;
public short NPCType { get; set; }
}
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AddNPCBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class AddNPCBuff : Packet, INPCSlot
{
public override MessageID Type => MessageID.AddNPCBuff;
public override MessageID Type => MessageID.NpcAddBuff;
public short NPCSlot { get; set; }
public ushort BuffType { get; set; }
public short BuffTime { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AddPlayerBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class AddPlayerBuff : Packet, IOtherPlayerSlot
{
public override MessageID Type => MessageID.AddPlayerBuff;
public override MessageID Type => MessageID.PlayerAddBuff;
public byte OtherPlayerSlot { get; set; }
public ushort BuffType { get; set; }
public int BuffTime { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AnglerQuestCountSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class AnglerQuestCountSync : Packet, IPlayerSlot
{
public override MessageID Type => MessageID.AnglerQuestCountSync;
public override MessageID Type => MessageID.NumberOfAnglerQuestsCompleted;
public byte PlayerSlot { get; set; }
public int AnglerQuestsFinished { get; set; }
public int GolferScoreAccumulated { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion TrProtocol/Packets/AnglerQuestFinished.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public class AnglerQuestFinished : Packet
{
public override MessageID Type => MessageID.AnglerQuestFinished;
public override MessageID Type => MessageID.CompleteAnglerQuest;
}
2 changes: 1 addition & 1 deletion TrProtocol/Packets/Assorted1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class Assorted1 : Packet, IPlayerSlot
{
public override MessageID Type => MessageID.Assorted1;
public override MessageID Type => MessageID.NpcSpecial;
public byte PlayerSlot { get; set; }
public byte Unknown { get; set; }
}
2 changes: 1 addition & 1 deletion TrProtocol/Packets/BugCatching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class BugCatching : Packet, IPlayerSlot, INPCSlot
{
public override MessageID Type => MessageID.BugCatching;
public override MessageID Type => MessageID.CatchNPC;
public short NPCSlot { get; set; }
public byte PlayerSlot { get; set; }
}
2 changes: 1 addition & 1 deletion TrProtocol/Packets/BugReleasing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class BugReleasing : Packet
{
public override MessageID Type => MessageID.BugReleasing;
public override MessageID Type => MessageID.ReleaseNPC;
public Position Position { get; set; }
public short NPCType { get; set; }
public byte Style { get; set; }
Expand Down
Loading