diff --git a/TShockAPI/Net/ProjectileRemoveMsg.cs b/TShockAPI/Net/ProjectileRemoveMsg.cs index ea76e54d..1f7907e6 100644 --- a/TShockAPI/Net/ProjectileRemoveMsg.cs +++ b/TShockAPI/Net/ProjectileRemoveMsg.cs @@ -25,8 +25,7 @@ namespace TShockAPI.Net { public override PacketTypes ID { - get{ return 0; } - //PacketTypes.ProjectileNew; } + get{ return PacketTypes.ProjectileNew; } } public short Index { get; set; } diff --git a/TShockAPI/Net/WorldInfoMsg.cs b/TShockAPI/Net/WorldInfoMsg.cs index d95a8bf9..472fd861 100644 --- a/TShockAPI/Net/WorldInfoMsg.cs +++ b/TShockAPI/Net/WorldInfoMsg.cs @@ -24,7 +24,7 @@ using System.Text; namespace TShockAPI.Net { [Flags] - public enum WorldInfoFlag : byte + public enum BossFlags : byte { None = 0, OrbSmashed = 1, @@ -35,12 +35,25 @@ namespace TShockAPI.Net 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 int Time { get; set; } public bool DayTime { get; set; } public byte MoonPhase { get; set; } public bool BloodMoon { get; set; } + public bool Eclipse { get; set; } public int MaxTilesX { get; set; } public int MaxTilesY { get; set; } public int SpawnX { get; set; } @@ -48,7 +61,37 @@ namespace TShockAPI.Net public int WorldSurface { get; set; } public int RockLayer { 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 override PacketTypes ID @@ -62,6 +105,7 @@ namespace TShockAPI.Net stream.WriteBoolean(DayTime); stream.WriteInt8(MoonPhase); stream.WriteBoolean(BloodMoon); + stream.WriteBoolean(Eclipse); stream.WriteInt32(MaxTilesX); stream.WriteInt32(MaxTilesY); stream.WriteInt32(SpawnX); @@ -69,7 +113,37 @@ namespace TShockAPI.Net stream.WriteInt32(WorldSurface); stream.WriteInt32(RockLayer); 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)); } } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 763f5b83..1cf6d7a9 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -457,12 +457,47 @@ namespace TShockAPI //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. WorldID = !fakeid ? Main.worldID : -1, - WorldFlags = (WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) | - (NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) | - (NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) | - (NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) | - (Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) | - (NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None), + MoonType = (byte)Main.moonType, + TreeX0 = Main.treeX[0], + TreeX1 = Main.treeX[1], + TreeX2 = Main.treeX[2], + TreeStyle0 = (byte)Main.treeStyle[0], + 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); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 43dcad60..602cf63b 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1194,26 +1194,62 @@ namespace TShockAPI { var msg = new WorldInfoMsg { - Time = (int)Main.time, - DayTime = Main.dayTime, - MoonPhase = (byte)Main.moonPhase, - BloodMoon = Main.bloodMoon, - MaxTilesX = Main.maxTilesX, - MaxTilesY = Main.maxTilesY, - SpawnX = Main.spawnTileX, - SpawnY = Main.spawnTileY, - WorldSurface = (int)Main.worldSurface, - RockLayer = (int)Main.rockLayer, - WorldID = Main.worldID, - WorldFlags = - (WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) | - (NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) | - (NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) | - (NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) | - (Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) | - (NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None), - WorldName = Config.ServerName - }; + Time = (int) Main.time, + DayTime = Main.dayTime, + MoonPhase = (byte) Main.moonPhase, + BloodMoon = Main.bloodMoon, + MaxTilesX = Main.maxTilesX, + MaxTilesY = Main.maxTilesY, + SpawnX = Main.spawnTileX, + SpawnY = Main.spawnTileY, + WorldSurface = (int) Main.worldSurface, + RockLayer = (int) Main.rockLayer, + //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. + WorldID = Main.worldID, + MoonType = (byte)Main.moonType, + TreeX0 = Main.treeX[0], + TreeX1 = Main.treeX[1], + TreeX2 = Main.treeX[2], + TreeStyle0 = (byte)Main.treeStyle[0], + 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); player.SendRawData(ms.ToArray()); } diff --git a/TerrariaServerBins/TerrariaServer.exe b/TerrariaServerBins/TerrariaServer.exe index 9c644bac..237891c4 100644 Binary files a/TerrariaServerBins/TerrariaServer.exe and b/TerrariaServerBins/TerrariaServer.exe differ