Terraria 1.3.5.3 Source Code
This commit is contained in:
commit
4b21dac4b6
503 changed files with 409032 additions and 0 deletions
50
GameContent/NetModules/NetLiquidModule.cs
Normal file
50
GameContent/NetModules/NetLiquidModule.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.NetModules.NetLiquidModule
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Terraria.Net;
|
||||
|
||||
namespace Terraria.GameContent.NetModules
|
||||
{
|
||||
public class NetLiquidModule : NetModule
|
||||
{
|
||||
public static NetPacket Serialize(HashSet<int> changes)
|
||||
{
|
||||
NetPacket packet = NetModule.CreatePacket<NetLiquidModule>(changes.Count * 6 + 2);
|
||||
packet.Writer.Write((ushort) changes.Count);
|
||||
foreach (int change in changes)
|
||||
{
|
||||
int index1 = change >> 16 & (int) ushort.MaxValue;
|
||||
int index2 = change & (int) ushort.MaxValue;
|
||||
packet.Writer.Write(change);
|
||||
packet.Writer.Write(Main.tile[index1, index2].liquid);
|
||||
packet.Writer.Write(Main.tile[index1, index2].liquidType());
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
|
||||
public override bool Deserialize(BinaryReader reader, int userId)
|
||||
{
|
||||
int num1 = (int) reader.ReadUInt16();
|
||||
for (int index1 = 0; index1 < num1; ++index1)
|
||||
{
|
||||
int num2 = reader.ReadInt32();
|
||||
byte num3 = reader.ReadByte();
|
||||
byte num4 = reader.ReadByte();
|
||||
int index2 = num2 >> 16 & (int) ushort.MaxValue;
|
||||
int index3 = num2 & (int) ushort.MaxValue;
|
||||
Tile tile = Main.tile[index2, index3];
|
||||
if (tile != null)
|
||||
{
|
||||
tile.liquid = num3;
|
||||
tile.liquidType((int) num4);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
65
GameContent/NetModules/NetTextModule.cs
Normal file
65
GameContent/NetModules/NetTextModule.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.NetModules.NetTextModule
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.IO;
|
||||
using Terraria.Chat;
|
||||
using Terraria.GameContent.UI.Chat;
|
||||
using Terraria.Localization;
|
||||
using Terraria.Net;
|
||||
using Terraria.UI.Chat;
|
||||
|
||||
namespace Terraria.GameContent.NetModules
|
||||
{
|
||||
public class NetTextModule : NetModule
|
||||
{
|
||||
public static NetPacket SerializeClientMessage(ChatMessage message)
|
||||
{
|
||||
NetPacket packet = NetModule.CreatePacket<NetTextModule>(message.GetMaxSerializedSize());
|
||||
message.Serialize(packet.Writer);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static NetPacket SerializeServerMessage(NetworkText text, Color color) => NetTextModule.SerializeServerMessage(text, color, byte.MaxValue);
|
||||
|
||||
public static NetPacket SerializeServerMessage(
|
||||
NetworkText text,
|
||||
Color color,
|
||||
byte authorId)
|
||||
{
|
||||
NetPacket packet = NetModule.CreatePacket<NetTextModule>(1 + text.GetMaxSerializedSize() + 3);
|
||||
packet.Writer.Write(authorId);
|
||||
text.Serialize(packet.Writer);
|
||||
packet.Writer.WriteRGB(color);
|
||||
return packet;
|
||||
}
|
||||
|
||||
private bool DeserializeAsClient(BinaryReader reader, int senderPlayerId)
|
||||
{
|
||||
byte num = reader.ReadByte();
|
||||
string str = NetworkText.Deserialize(reader).ToString();
|
||||
Color c = reader.ReadRGB();
|
||||
if (num < byte.MaxValue)
|
||||
{
|
||||
Main.player[(int) num].chatOverhead.NewMessage(str, Main.chatLength / 2);
|
||||
str = NameTagHandler.GenerateTag(Main.player[(int) num].name) + " " + str;
|
||||
}
|
||||
Main.NewTextMultiline(str, c: c);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DeserializeAsServer(BinaryReader reader, int senderPlayerId)
|
||||
{
|
||||
ChatMessage message = ChatMessage.Deserialize(reader);
|
||||
ChatManager.Commands.ProcessReceivedMessage(message, senderPlayerId);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void BroadcastRawMessage(ChatMessage message, byte author, Color messageColor) => NetManager.Instance.Broadcast(NetTextModule.SerializeServerMessage(NetworkText.FromLiteral(message.Text), messageColor));
|
||||
|
||||
public override bool Deserialize(BinaryReader reader, int senderPlayerId) => this.DeserializeAsClient(reader, senderPlayerId);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue