Removed the onsenddata hook and added a raw send command.
Added WorldInfoMsg for constructing the world info packet.
This commit is contained in:
parent
2a212629dc
commit
27adb98b6f
4 changed files with 135 additions and 70 deletions
|
|
@ -18,12 +18,70 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Terraria;
|
||||
using TerrariaAPI;
|
||||
using XNAHelpers;
|
||||
|
||||
namespace TShockAPI.Net
|
||||
{
|
||||
class WorldInfoMsg
|
||||
[Flags]
|
||||
public enum WorldInfoFlag : byte
|
||||
{
|
||||
None = 0,
|
||||
OrbSmashed = 1,
|
||||
DownedBoss1 = 2,
|
||||
DownedBoss2 = 4,
|
||||
DownedBoss3 = 8,
|
||||
}
|
||||
public class WorldInfoMsg : IPackable
|
||||
{
|
||||
public int Time { get; set; }
|
||||
public bool DayTime { get; set; }
|
||||
public byte MoonPhase { get; set; }
|
||||
public bool BloodMoon { get; set; }
|
||||
public int MaxTilesX { get; set; }
|
||||
public int MaxTilesY { get; set; }
|
||||
public int SpawnX { get; set; }
|
||||
public int SpawnY { get; set; }
|
||||
public int WorldSurface { get; set; }
|
||||
public int RockLayer { get; set; }
|
||||
public int WorldID { get; set; }
|
||||
public WorldInfoFlag WorldFlags { get; set; }
|
||||
public string WorldName { get; set; }
|
||||
public void PackFull(Stream stream)
|
||||
{
|
||||
long start = stream.Position;
|
||||
stream.WriteInt32(1);
|
||||
stream.WriteInt8((byte)PacketTypes.WorldInfo);
|
||||
Pack(stream);
|
||||
long end = stream.Position;
|
||||
stream.Position = start;
|
||||
stream.WriteInt32((int)(end - start) - 4);
|
||||
stream.Position = end;
|
||||
}
|
||||
public void Pack(Stream stream)
|
||||
{
|
||||
stream.Write(Time);
|
||||
stream.Write(DayTime);
|
||||
stream.Write(MoonPhase);
|
||||
stream.Write(BloodMoon);
|
||||
stream.Write(MaxTilesX);
|
||||
stream.Write(MaxTilesY);
|
||||
stream.Write(SpawnX);
|
||||
stream.Write(SpawnY);
|
||||
stream.Write(WorldSurface);
|
||||
stream.Write(RockLayer);
|
||||
stream.Write(WorldID);
|
||||
stream.Write((byte)WorldFlags);
|
||||
stream.Write(Encoding.ASCII.GetBytes(WorldName));
|
||||
}
|
||||
|
||||
public void Unpack(Stream stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue