Added packet changes for 1.2 protocol up to 7(world info)
This commit is contained in:
parent
7731bc46f1
commit
e148d29c66
5 changed files with 175 additions and 31 deletions
|
|
@ -25,8 +25,7 @@ namespace TShockAPI.Net
|
||||||
{
|
{
|
||||||
public override PacketTypes ID
|
public override PacketTypes ID
|
||||||
{
|
{
|
||||||
get{ return 0; }
|
get{ return PacketTypes.ProjectileNew; }
|
||||||
//PacketTypes.ProjectileNew; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public short Index { get; set; }
|
public short Index { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ using System.Text;
|
||||||
namespace TShockAPI.Net
|
namespace TShockAPI.Net
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum WorldInfoFlag : byte
|
public enum BossFlags : byte
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
OrbSmashed = 1,
|
OrbSmashed = 1,
|
||||||
|
|
@ -35,12 +35,25 @@ namespace TShockAPI.Net
|
||||||
DownedClown = 32
|
DownedClown = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum BossFlags2 : byte
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
DownedMechBoss1 = 1,
|
||||||
|
DownedMechBoss2 = 2,
|
||||||
|
DownedMechBoss3 = 4,
|
||||||
|
DownedMechBossAny = 8,
|
||||||
|
CloudBg = 16,
|
||||||
|
Crimson = 32
|
||||||
|
}
|
||||||
|
|
||||||
public class WorldInfoMsg : BaseMsg
|
public class WorldInfoMsg : BaseMsg
|
||||||
{
|
{
|
||||||
public int Time { get; set; }
|
public int Time { get; set; }
|
||||||
public bool DayTime { get; set; }
|
public bool DayTime { get; set; }
|
||||||
public byte MoonPhase { get; set; }
|
public byte MoonPhase { get; set; }
|
||||||
public bool BloodMoon { get; set; }
|
public bool BloodMoon { get; set; }
|
||||||
|
public bool Eclipse { get; set; }
|
||||||
public int MaxTilesX { get; set; }
|
public int MaxTilesX { get; set; }
|
||||||
public int MaxTilesY { get; set; }
|
public int MaxTilesY { get; set; }
|
||||||
public int SpawnX { get; set; }
|
public int SpawnX { get; set; }
|
||||||
|
|
@ -48,7 +61,37 @@ namespace TShockAPI.Net
|
||||||
public int WorldSurface { get; set; }
|
public int WorldSurface { get; set; }
|
||||||
public int RockLayer { get; set; }
|
public int RockLayer { get; set; }
|
||||||
public int WorldID { get; set; }
|
public int WorldID { get; set; }
|
||||||
public WorldInfoFlag WorldFlags { get; set; }
|
public byte MoonType { get; set; }
|
||||||
|
public int TreeX0 { get; set; }
|
||||||
|
public int TreeX1 { get; set; }
|
||||||
|
public int TreeX2 { get; set; }
|
||||||
|
public byte TreeStyle0 { get; set; }
|
||||||
|
public byte TreeStyle1 { get; set; }
|
||||||
|
public byte TreeStyle2 { get; set; }
|
||||||
|
public byte TreeStyle3 { get; set; }
|
||||||
|
public int CaveBackX0 { get; set; }
|
||||||
|
public int CaveBackX1 { get; set; }
|
||||||
|
public int CaveBackX2 { get; set; }
|
||||||
|
public byte CaveBackStyle0 { get; set; }
|
||||||
|
public byte CaveBackStyle1 { get; set; }
|
||||||
|
public byte CaveBackStyle2 { get; set; }
|
||||||
|
public byte CaveBackStyle3 { get; set; }
|
||||||
|
public byte SetBG0 { get; set; }
|
||||||
|
public byte SetBG1 { get; set; }
|
||||||
|
public byte SetBG2 { get; set; }
|
||||||
|
public byte SetBG3 { get; set; }
|
||||||
|
public byte SetBG4 { get; set; }
|
||||||
|
public byte SetBG5 { get; set; }
|
||||||
|
public byte SetBG6 { get; set; }
|
||||||
|
public byte SetBG7 { get; set; }
|
||||||
|
public byte IceBackStyle { get; set; }
|
||||||
|
public byte JungleBackStyle { get; set; }
|
||||||
|
public byte HellBackStyle { get; set; }
|
||||||
|
public float WindSpeed { get; set; }
|
||||||
|
public byte NumberOfClouds { get; set; }
|
||||||
|
public BossFlags BossFlags { get; set; }
|
||||||
|
public BossFlags2 BossFlags2 { get; set; }
|
||||||
|
public float Rain { get; set; }
|
||||||
public string WorldName { get; set; }
|
public string WorldName { get; set; }
|
||||||
|
|
||||||
public override PacketTypes ID
|
public override PacketTypes ID
|
||||||
|
|
@ -62,6 +105,7 @@ namespace TShockAPI.Net
|
||||||
stream.WriteBoolean(DayTime);
|
stream.WriteBoolean(DayTime);
|
||||||
stream.WriteInt8(MoonPhase);
|
stream.WriteInt8(MoonPhase);
|
||||||
stream.WriteBoolean(BloodMoon);
|
stream.WriteBoolean(BloodMoon);
|
||||||
|
stream.WriteBoolean(Eclipse);
|
||||||
stream.WriteInt32(MaxTilesX);
|
stream.WriteInt32(MaxTilesX);
|
||||||
stream.WriteInt32(MaxTilesY);
|
stream.WriteInt32(MaxTilesY);
|
||||||
stream.WriteInt32(SpawnX);
|
stream.WriteInt32(SpawnX);
|
||||||
|
|
@ -69,7 +113,37 @@ namespace TShockAPI.Net
|
||||||
stream.WriteInt32(WorldSurface);
|
stream.WriteInt32(WorldSurface);
|
||||||
stream.WriteInt32(RockLayer);
|
stream.WriteInt32(RockLayer);
|
||||||
stream.WriteInt32(WorldID);
|
stream.WriteInt32(WorldID);
|
||||||
stream.WriteInt8((byte) WorldFlags);
|
stream.WriteByte(MoonType);
|
||||||
|
stream.WriteInt32(TreeX0);
|
||||||
|
stream.WriteInt32(TreeX1);
|
||||||
|
stream.WriteInt32(TreeX2);
|
||||||
|
stream.WriteByte(TreeStyle0);
|
||||||
|
stream.WriteByte(TreeStyle1);
|
||||||
|
stream.WriteByte(TreeStyle2);
|
||||||
|
stream.WriteByte(TreeStyle3);
|
||||||
|
stream.WriteInt32(CaveBackX0);
|
||||||
|
stream.WriteInt32(CaveBackX1);
|
||||||
|
stream.WriteInt32(CaveBackX2);
|
||||||
|
stream.WriteByte(CaveBackStyle0);
|
||||||
|
stream.WriteByte(CaveBackStyle1);
|
||||||
|
stream.WriteByte(CaveBackStyle2);
|
||||||
|
stream.WriteByte(CaveBackStyle3);
|
||||||
|
stream.WriteByte(SetBG0);
|
||||||
|
stream.WriteByte(SetBG1);
|
||||||
|
stream.WriteByte(SetBG2);
|
||||||
|
stream.WriteByte(SetBG3);
|
||||||
|
stream.WriteByte(SetBG4);
|
||||||
|
stream.WriteByte(SetBG5);
|
||||||
|
stream.WriteByte(SetBG6);
|
||||||
|
stream.WriteByte(SetBG7);
|
||||||
|
stream.WriteByte(IceBackStyle);
|
||||||
|
stream.WriteByte(JungleBackStyle);
|
||||||
|
stream.WriteByte(HellBackStyle);
|
||||||
|
stream.WriteSingle(WindSpeed);
|
||||||
|
stream.WriteByte(NumberOfClouds);
|
||||||
|
stream.WriteInt8((byte) BossFlags);
|
||||||
|
stream.WriteInt8((byte)BossFlags2);
|
||||||
|
stream.WriteSingle(Rain);
|
||||||
stream.WriteBytes(Encoding.UTF8.GetBytes(WorldName));
|
stream.WriteBytes(Encoding.UTF8.GetBytes(WorldName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -457,12 +457,47 @@ namespace TShockAPI
|
||||||
//Sending a fake world id causes the client to not be able to find a stored spawnx/y.
|
//Sending a fake world id causes the client to not be able to find a stored spawnx/y.
|
||||||
//This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn.
|
//This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn.
|
||||||
WorldID = !fakeid ? Main.worldID : -1,
|
WorldID = !fakeid ? Main.worldID : -1,
|
||||||
WorldFlags = (WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) |
|
MoonType = (byte)Main.moonType,
|
||||||
(NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) |
|
TreeX0 = Main.treeX[0],
|
||||||
(NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) |
|
TreeX1 = Main.treeX[1],
|
||||||
(NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) |
|
TreeX2 = Main.treeX[2],
|
||||||
(Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) |
|
TreeStyle0 = (byte)Main.treeStyle[0],
|
||||||
(NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None),
|
TreeStyle1 = (byte)Main.treeStyle[1],
|
||||||
|
TreeStyle2 = (byte)Main.treeStyle[2],
|
||||||
|
TreeStyle3 = (byte)Main.treeStyle[3],
|
||||||
|
CaveBackX0 = Main.caveBackX[0],
|
||||||
|
CaveBackX1 = Main.caveBackX[1],
|
||||||
|
CaveBackX2 = Main.caveBackX[2],
|
||||||
|
CaveBackStyle0 = (byte)Main.caveBackStyle[0],
|
||||||
|
CaveBackStyle1 = (byte)Main.caveBackStyle[1],
|
||||||
|
CaveBackStyle2 = (byte)Main.caveBackStyle[2],
|
||||||
|
CaveBackStyle3 = (byte)Main.caveBackStyle[3],
|
||||||
|
SetBG0 = (byte)WorldGen.treeBG,
|
||||||
|
SetBG1 = (byte)WorldGen.corruptBG,
|
||||||
|
SetBG2 = (byte)WorldGen.jungleBG,
|
||||||
|
SetBG3 = (byte)WorldGen.snowBG,
|
||||||
|
SetBG4 = (byte)WorldGen.hallowBG,
|
||||||
|
SetBG5 = (byte)WorldGen.crimsonBG,
|
||||||
|
SetBG6 = (byte)WorldGen.desertBG,
|
||||||
|
SetBG7 = (byte)WorldGen.oceanBG,
|
||||||
|
IceBackStyle = (byte)Main.iceBackStyle,
|
||||||
|
JungleBackStyle = (byte)Main.jungleBackStyle,
|
||||||
|
HellBackStyle = (byte)Main.hellBackStyle,
|
||||||
|
WindSpeed = Main.windSpeed,
|
||||||
|
NumberOfClouds = (byte)Main.numClouds,
|
||||||
|
BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) |
|
||||||
|
(NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) |
|
||||||
|
(NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) |
|
||||||
|
(NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) |
|
||||||
|
(Main.hardMode ? BossFlags.HardMode : BossFlags.None) |
|
||||||
|
(NPC.downedClown ? BossFlags.DownedClown : BossFlags.None),
|
||||||
|
BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) |
|
||||||
|
(Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) |
|
||||||
|
(WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None),
|
||||||
|
Rain = Main.maxRaining,
|
||||||
WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName
|
WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName
|
||||||
};
|
};
|
||||||
msg.PackFull(ms);
|
msg.PackFull(ms);
|
||||||
|
|
|
||||||
|
|
@ -1194,26 +1194,62 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
var msg = new WorldInfoMsg
|
var msg = new WorldInfoMsg
|
||||||
{
|
{
|
||||||
Time = (int)Main.time,
|
Time = (int) Main.time,
|
||||||
DayTime = Main.dayTime,
|
DayTime = Main.dayTime,
|
||||||
MoonPhase = (byte)Main.moonPhase,
|
MoonPhase = (byte) Main.moonPhase,
|
||||||
BloodMoon = Main.bloodMoon,
|
BloodMoon = Main.bloodMoon,
|
||||||
MaxTilesX = Main.maxTilesX,
|
MaxTilesX = Main.maxTilesX,
|
||||||
MaxTilesY = Main.maxTilesY,
|
MaxTilesY = Main.maxTilesY,
|
||||||
SpawnX = Main.spawnTileX,
|
SpawnX = Main.spawnTileX,
|
||||||
SpawnY = Main.spawnTileY,
|
SpawnY = Main.spawnTileY,
|
||||||
WorldSurface = (int)Main.worldSurface,
|
WorldSurface = (int) Main.worldSurface,
|
||||||
RockLayer = (int)Main.rockLayer,
|
RockLayer = (int) Main.rockLayer,
|
||||||
WorldID = Main.worldID,
|
//Sending a fake world id causes the client to not be able to find a stored spawnx/y.
|
||||||
WorldFlags =
|
//This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn.
|
||||||
(WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) |
|
WorldID = Main.worldID,
|
||||||
(NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) |
|
MoonType = (byte)Main.moonType,
|
||||||
(NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) |
|
TreeX0 = Main.treeX[0],
|
||||||
(NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) |
|
TreeX1 = Main.treeX[1],
|
||||||
(Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) |
|
TreeX2 = Main.treeX[2],
|
||||||
(NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None),
|
TreeStyle0 = (byte)Main.treeStyle[0],
|
||||||
WorldName = Config.ServerName
|
TreeStyle1 = (byte)Main.treeStyle[1],
|
||||||
};
|
TreeStyle2 = (byte)Main.treeStyle[2],
|
||||||
|
TreeStyle3 = (byte)Main.treeStyle[3],
|
||||||
|
CaveBackX0 = Main.caveBackX[0],
|
||||||
|
CaveBackX1 = Main.caveBackX[1],
|
||||||
|
CaveBackX2 = Main.caveBackX[2],
|
||||||
|
CaveBackStyle0 = (byte)Main.caveBackStyle[0],
|
||||||
|
CaveBackStyle1 = (byte)Main.caveBackStyle[1],
|
||||||
|
CaveBackStyle2 = (byte)Main.caveBackStyle[2],
|
||||||
|
CaveBackStyle3 = (byte)Main.caveBackStyle[3],
|
||||||
|
SetBG0 = (byte)WorldGen.treeBG,
|
||||||
|
SetBG1 = (byte)WorldGen.corruptBG,
|
||||||
|
SetBG2 = (byte)WorldGen.jungleBG,
|
||||||
|
SetBG3 = (byte)WorldGen.snowBG,
|
||||||
|
SetBG4 = (byte)WorldGen.hallowBG,
|
||||||
|
SetBG5 = (byte)WorldGen.crimsonBG,
|
||||||
|
SetBG6 = (byte)WorldGen.desertBG,
|
||||||
|
SetBG7 = (byte)WorldGen.oceanBG,
|
||||||
|
IceBackStyle = (byte)Main.iceBackStyle,
|
||||||
|
JungleBackStyle = (byte)Main.jungleBackStyle,
|
||||||
|
HellBackStyle = (byte)Main.hellBackStyle,
|
||||||
|
WindSpeed = Main.windSpeed,
|
||||||
|
NumberOfClouds = (byte)Main.numClouds,
|
||||||
|
BossFlags = (WorldGen.shadowOrbSmashed ? BossFlags.OrbSmashed : BossFlags.None) |
|
||||||
|
(NPC.downedBoss1 ? BossFlags.DownedBoss1 : BossFlags.None) |
|
||||||
|
(NPC.downedBoss2 ? BossFlags.DownedBoss2 : BossFlags.None) |
|
||||||
|
(NPC.downedBoss3 ? BossFlags.DownedBoss3 : BossFlags.None) |
|
||||||
|
(Main.hardMode ? BossFlags.HardMode : BossFlags.None) |
|
||||||
|
(NPC.downedClown ? BossFlags.DownedClown : BossFlags.None),
|
||||||
|
BossFlags2 = (NPC.downedMechBoss1 ? BossFlags2.DownedMechBoss1 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) |
|
||||||
|
(NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) |
|
||||||
|
(Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) |
|
||||||
|
(WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None),
|
||||||
|
Rain = Main.maxRaining,
|
||||||
|
WorldName = TShock.Config.UseServerName ? TShock.Config.ServerName : Main.worldName
|
||||||
|
};
|
||||||
msg.PackFull(ms);
|
msg.PackFull(ms);
|
||||||
player.SendRawData(ms.ToArray());
|
player.SendRawData(ms.ToArray());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue