Initial Commit of 1.2.4, all data handlers are currently off.
This commit is contained in:
parent
8d32d16bff
commit
871ad1fd2a
11 changed files with 109 additions and 88 deletions
|
|
@ -4634,7 +4634,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
if (args.Parameters.Count == 2)
|
if (args.Parameters.Count == 2)
|
||||||
int.TryParse(args.Parameters[1], out time);
|
int.TryParse(args.Parameters[1], out time);
|
||||||
if (id > 0 && id < Main.maxBuffs)
|
if (id > 0 && id < Main.maxBuffTypes)
|
||||||
{
|
{
|
||||||
if (time < 0 || time > short.MaxValue)
|
if (time < 0 || time > short.MaxValue)
|
||||||
time = 60;
|
time = 60;
|
||||||
|
|
@ -4685,7 +4685,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
if (args.Parameters.Count == 3)
|
if (args.Parameters.Count == 3)
|
||||||
int.TryParse(args.Parameters[2], out time);
|
int.TryParse(args.Parameters[2], out time);
|
||||||
if (id > 0 && id < Main.maxBuffs)
|
if (id > 0 && id < Main.maxBuffTypes)
|
||||||
{
|
{
|
||||||
if (time < 0 || time > short.MaxValue)
|
if (time < 0 || time > short.MaxValue)
|
||||||
time = 60;
|
time = 60;
|
||||||
|
|
|
||||||
|
|
@ -1198,7 +1198,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
#region Blacklists
|
#region Blacklists
|
||||||
|
|
||||||
WhitelistBuffMaxTime = new int[Main.maxBuffs];
|
WhitelistBuffMaxTime = new int[Main.maxBuffTypes];
|
||||||
WhitelistBuffMaxTime[20] = 600;
|
WhitelistBuffMaxTime[20] = 600;
|
||||||
WhitelistBuffMaxTime[0x18] = 1200;
|
WhitelistBuffMaxTime[0x18] = 1200;
|
||||||
WhitelistBuffMaxTime[0x1f] = 120;
|
WhitelistBuffMaxTime[0x1f] = 120;
|
||||||
|
|
@ -3218,7 +3218,7 @@ namespace TShockAPI
|
||||||
if (OnPlayerBuffUpdate(id))
|
if (OnPlayerBuffUpdate(id))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < Terraria.Player.maxBuffs; i++)
|
||||||
{
|
{
|
||||||
var buff = args.Data.ReadInt8();
|
var buff = args.Data.ReadInt8();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@ namespace TShockAPI.Net
|
||||||
public void PackFull(Stream stream)
|
public void PackFull(Stream stream)
|
||||||
{
|
{
|
||||||
long start = stream.Position;
|
long start = stream.Position;
|
||||||
stream.WriteInt32(1);
|
stream.WriteInt16(0);
|
||||||
stream.WriteInt8((byte) ID);
|
stream.WriteInt8((byte) ID);
|
||||||
Pack(stream);
|
Pack(stream);
|
||||||
long end = stream.Position;
|
long end = stream.Position;
|
||||||
stream.Position = start;
|
stream.Position = start;
|
||||||
stream.WriteInt32((int) (end - start) - 4);
|
stream.WriteInt16((short)end);
|
||||||
stream.Position = end;
|
stream.Position = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,7 @@ namespace TShockAPI.Net
|
||||||
stream.WriteSingle(0);
|
stream.WriteSingle(0);
|
||||||
stream.WriteInt16(0);
|
stream.WriteInt16(0);
|
||||||
stream.WriteByte(Owner);
|
stream.WriteByte(Owner);
|
||||||
stream.WriteByte(0);
|
stream.WriteInt16(0);
|
||||||
stream.WriteSingle(0);
|
|
||||||
stream.WriteSingle(0);
|
stream.WriteSingle(0);
|
||||||
stream.WriteSingle(0);
|
stream.WriteSingle(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ namespace TShockAPI.Net
|
||||||
get { return PacketTypes.PlayerSpawn; }
|
get { return PacketTypes.PlayerSpawn; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int TileX { get; set; }
|
public short TileX { get; set; }
|
||||||
public int TileY { get; set; }
|
public short TileY { get; set; }
|
||||||
public byte PlayerIndex { get; set; }
|
public byte PlayerIndex { get; set; }
|
||||||
|
|
||||||
public override void Pack(Stream stream)
|
public override void Pack(Stream stream)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Streams;
|
using System.IO.Streams;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Terraria;
|
||||||
|
|
||||||
namespace TShockAPI.Net
|
namespace TShockAPI.Net
|
||||||
{
|
{
|
||||||
|
|
@ -58,12 +59,12 @@ namespace TShockAPI.Net
|
||||||
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 bool Eclipse { get; set; }
|
||||||
public int MaxTilesX { get; set; }
|
public short MaxTilesX { get; set; }
|
||||||
public int MaxTilesY { get; set; }
|
public short MaxTilesY { get; set; }
|
||||||
public int SpawnX { get; set; }
|
public short SpawnX { get; set; }
|
||||||
public int SpawnY { get; set; }
|
public short SpawnY { get; set; }
|
||||||
public int WorldSurface { get; set; }
|
public short WorldSurface { get; set; }
|
||||||
public int RockLayer { get; set; }
|
public short RockLayer { get; set; }
|
||||||
public int WorldID { get; set; }
|
public int WorldID { get; set; }
|
||||||
public byte MoonType { get; set; }
|
public byte MoonType { get; set; }
|
||||||
public int TreeX0 { get; set; }
|
public int TreeX0 { get; set; }
|
||||||
|
|
@ -105,50 +106,71 @@ namespace TShockAPI.Net
|
||||||
|
|
||||||
public override void Pack(Stream stream)
|
public override void Pack(Stream stream)
|
||||||
{
|
{
|
||||||
stream.WriteInt32(Time);
|
BinaryWriter writer = new BinaryWriter(stream);
|
||||||
stream.WriteBoolean(DayTime);
|
writer.Write(Time);
|
||||||
stream.WriteInt8(MoonPhase);
|
BitsByte worldinfo = new BitsByte(DayTime, BloodMoon, Eclipse);
|
||||||
stream.WriteBoolean(BloodMoon);
|
writer.Write(worldinfo);
|
||||||
stream.WriteBoolean(Eclipse);
|
writer.Write(MoonPhase);
|
||||||
stream.WriteInt32(MaxTilesX);
|
writer.Write(MaxTilesX);
|
||||||
stream.WriteInt32(MaxTilesY);
|
writer.Write(MaxTilesY);
|
||||||
stream.WriteInt32(SpawnX);
|
writer.Write(SpawnX);
|
||||||
stream.WriteInt32(SpawnY);
|
writer.Write(SpawnY);
|
||||||
stream.WriteInt32(WorldSurface);
|
writer.Write(WorldSurface);
|
||||||
stream.WriteInt32(RockLayer);
|
writer.Write(RockLayer);
|
||||||
stream.WriteInt32(WorldID);
|
writer.Write(WorldID);
|
||||||
stream.WriteByte(MoonType);
|
writer.Write(WorldName);
|
||||||
stream.WriteInt32(TreeX0);
|
writer.Write(MoonType);
|
||||||
stream.WriteInt32(TreeX1);
|
|
||||||
stream.WriteInt32(TreeX2);
|
writer.Write(SetBG0);
|
||||||
stream.WriteByte(TreeStyle0);
|
writer.Write(SetBG1);
|
||||||
stream.WriteByte(TreeStyle1);
|
writer.Write(SetBG2);
|
||||||
stream.WriteByte(TreeStyle2);
|
writer.Write(SetBG3);
|
||||||
stream.WriteByte(TreeStyle3);
|
writer.Write(SetBG4);
|
||||||
stream.WriteInt32(CaveBackX0);
|
writer.Write(SetBG5);
|
||||||
stream.WriteInt32(CaveBackX1);
|
writer.Write(SetBG6);
|
||||||
stream.WriteInt32(CaveBackX2);
|
writer.Write(SetBG7);
|
||||||
stream.WriteByte(CaveBackStyle0);
|
writer.Write(IceBackStyle);
|
||||||
stream.WriteByte(CaveBackStyle1);
|
writer.Write(JungleBackStyle);
|
||||||
stream.WriteByte(CaveBackStyle2);
|
writer.Write(HellBackStyle);
|
||||||
stream.WriteByte(CaveBackStyle3);
|
writer.Write(WindSpeed);
|
||||||
stream.WriteByte(SetBG0);
|
writer.Write(NumberOfClouds);
|
||||||
stream.WriteByte(SetBG1);
|
|
||||||
stream.WriteByte(SetBG2);
|
writer.Write(TreeX0);
|
||||||
stream.WriteByte(SetBG3);
|
writer.Write(TreeX1);
|
||||||
stream.WriteByte(SetBG4);
|
writer.Write(TreeX2);
|
||||||
stream.WriteByte(SetBG5);
|
writer.Write(TreeStyle0);
|
||||||
stream.WriteByte(SetBG6);
|
writer.Write(TreeStyle1);
|
||||||
stream.WriteByte(SetBG7);
|
writer.Write(TreeStyle2);
|
||||||
stream.WriteByte(IceBackStyle);
|
writer.Write(TreeStyle3);
|
||||||
stream.WriteByte(JungleBackStyle);
|
writer.Write(CaveBackX0);
|
||||||
stream.WriteByte(HellBackStyle);
|
writer.Write(CaveBackX1);
|
||||||
stream.WriteSingle(WindSpeed);
|
writer.Write(CaveBackX2);
|
||||||
stream.WriteByte(NumberOfClouds);
|
writer.Write(CaveBackStyle0);
|
||||||
stream.WriteInt8((byte)BossFlags);
|
writer.Write(CaveBackStyle1);
|
||||||
stream.WriteInt8((byte)BossFlags2);
|
writer.Write(CaveBackStyle2);
|
||||||
stream.WriteSingle(Rain);
|
writer.Write(CaveBackStyle3);
|
||||||
stream.WriteBytes(Encoding.UTF8.GetBytes(WorldName));
|
|
||||||
|
writer.Write(Rain);
|
||||||
|
|
||||||
|
BitsByte bosses1 = new BitsByte((BossFlags & BossFlags.OrbSmashed) == BossFlags.OrbSmashed,
|
||||||
|
(BossFlags & BossFlags.DownedBoss1) == BossFlags.DownedBoss1,
|
||||||
|
(BossFlags & BossFlags.DownedBoss2) == BossFlags.DownedBoss2,
|
||||||
|
(BossFlags & BossFlags.DownedBoss3) == BossFlags.DownedBoss3,
|
||||||
|
(BossFlags & BossFlags.HardMode) == BossFlags.HardMode,
|
||||||
|
(BossFlags & BossFlags.DownedClown) == BossFlags.DownedClown,
|
||||||
|
(BossFlags & BossFlags.ServerSideCharacter) == BossFlags.ServerSideCharacter,
|
||||||
|
(BossFlags & BossFlags.DownedPlantBoss) == BossFlags.DownedPlantBoss);
|
||||||
|
writer.Write(bosses1);
|
||||||
|
|
||||||
|
BitsByte bosses2 = new BitsByte((BossFlags2 & BossFlags2.DownedMechBoss1) == BossFlags2.DownedMechBoss1,
|
||||||
|
(BossFlags2 & BossFlags2.DownedMechBoss2) == BossFlags2.DownedMechBoss2,
|
||||||
|
(BossFlags2 & BossFlags2.DownedMechBoss3) == BossFlags2.DownedMechBoss3,
|
||||||
|
(BossFlags2 & BossFlags2.DownedMechBossAny) == BossFlags2.DownedMechBossAny,
|
||||||
|
(BossFlags2 & BossFlags2.CloudBg) == BossFlags2.CloudBg,
|
||||||
|
(BossFlags2 & BossFlags2.Crimson) == BossFlags2.Crimson,
|
||||||
|
(BossFlags2 & BossFlags2.PumpkinMoon) == BossFlags2.PumpkinMoon,
|
||||||
|
(BossFlags2 & BossFlags2.SnowMoon) == BossFlags2.SnowMoon);
|
||||||
|
writer.Write(bosses2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,12 +125,12 @@ namespace TShockAPI
|
||||||
if (task.direct)
|
if (task.direct)
|
||||||
{
|
{
|
||||||
OnSaveWorld(new WorldSaveEventArgs());
|
OnSaveWorld(new WorldSaveEventArgs());
|
||||||
WorldFile.realsaveWorld(task.resetTime);
|
WorldFile.RealSaveWorld(task.resetTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WorldFile.saveWorld(task.resetTime);
|
WorldFile.saveWorld(task.resetTime);
|
||||||
TShock.Utils.Broadcast("World saved.", Color.Yellow);
|
TShock.Utils.Broadcast("World saved.", Color.Yellow);
|
||||||
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -525,12 +525,12 @@ namespace TShockAPI
|
||||||
DayTime = Main.dayTime,
|
DayTime = Main.dayTime,
|
||||||
MoonPhase = (byte)Main.moonPhase,
|
MoonPhase = (byte)Main.moonPhase,
|
||||||
BloodMoon = Main.bloodMoon,
|
BloodMoon = Main.bloodMoon,
|
||||||
MaxTilesX = Main.maxTilesX,
|
MaxTilesX = (short)Main.maxTilesX,
|
||||||
MaxTilesY = Main.maxTilesY,
|
MaxTilesY = (short)Main.maxTilesY,
|
||||||
SpawnX = Main.spawnTileX,
|
SpawnX = (short)Main.spawnTileX,
|
||||||
SpawnY = Main.spawnTileY,
|
SpawnY = (short)Main.spawnTileY,
|
||||||
WorldSurface = (int)Main.worldSurface,
|
WorldSurface = (short)Main.worldSurface,
|
||||||
RockLayer = (int)Main.rockLayer,
|
RockLayer = (short)Main.rockLayer,
|
||||||
//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 = Main.worldID,
|
WorldID = Main.worldID,
|
||||||
|
|
@ -636,8 +636,8 @@ namespace TShockAPI
|
||||||
var msg = new SpawnMsg
|
var msg = new SpawnMsg
|
||||||
{
|
{
|
||||||
PlayerIndex = (byte) Index,
|
PlayerIndex = (byte) Index,
|
||||||
TileX = tilex,
|
TileX = (short)tilex,
|
||||||
TileY = tiley
|
TileY = (short)tiley
|
||||||
};
|
};
|
||||||
msg.PackFull(ms);
|
msg.PackFull(ms);
|
||||||
SendRawData(ms.ToArray());
|
SendRawData(ms.ToArray());
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
[ApiVersion(1, 15)]
|
[ApiVersion(1, 16)]
|
||||||
public class TShock : TerrariaPlugin
|
public class TShock : TerrariaPlugin
|
||||||
{
|
{
|
||||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
|
@ -1149,8 +1149,8 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (e.Handled)
|
if (e.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PacketTypes type = e.MsgID;
|
/*PacketTypes type = e.MsgID;
|
||||||
|
|
||||||
Debug.WriteLine("Recv: {0:X}: {2} ({1:XX})", e.Msg.whoAmI, (byte) type, type);
|
Debug.WriteLine("Recv: {0:X}: {2} ({1:XX})", e.Msg.whoAmI, (byte) type, type);
|
||||||
|
|
||||||
|
|
@ -1174,11 +1174,11 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var data = new MemoryStream(e.Msg.readBuffer, e.Index, e.Length))
|
using (var data = new MemoryStream(e.Msg.readBuffer, e.Index, e.Length - 1))
|
||||||
{
|
{
|
||||||
// Exceptions are already handled
|
// Exceptions are already handled
|
||||||
e.Handled = GetDataHandlers.HandlerGetData(type, player, data);
|
e.Handled = GetDataHandlers.HandlerGetData(type, player, data);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGreetPlayer(GreetPlayerEventArgs args)
|
private void OnGreetPlayer(GreetPlayerEventArgs args)
|
||||||
|
|
@ -1359,12 +1359,12 @@ namespace TShockAPI
|
||||||
DayTime = Main.dayTime,
|
DayTime = Main.dayTime,
|
||||||
MoonPhase = (byte)Main.moonPhase,
|
MoonPhase = (byte)Main.moonPhase,
|
||||||
BloodMoon = Main.bloodMoon,
|
BloodMoon = Main.bloodMoon,
|
||||||
MaxTilesX = Main.maxTilesX,
|
MaxTilesX = (short)Main.maxTilesX,
|
||||||
MaxTilesY = Main.maxTilesY,
|
MaxTilesY = (short)Main.maxTilesY,
|
||||||
SpawnX = Main.spawnTileX,
|
SpawnX = (short)Main.spawnTileX,
|
||||||
SpawnY = Main.spawnTileY,
|
SpawnY = (short)Main.spawnTileY,
|
||||||
WorldSurface = (int)Main.worldSurface,
|
WorldSurface = (short)Main.worldSurface,
|
||||||
RockLayer = (int)Main.rockLayer,
|
RockLayer = (short)Main.rockLayer,
|
||||||
//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 = Main.worldID,
|
WorldID = Main.worldID,
|
||||||
|
|
@ -1408,7 +1408,7 @@ namespace TShockAPI
|
||||||
(NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) |
|
(NPC.downedMechBoss2 ? BossFlags2.DownedMechBoss2 : BossFlags2.None) |
|
||||||
(NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) |
|
(NPC.downedMechBoss3 ? BossFlags2.DownedMechBoss3 : BossFlags2.None) |
|
||||||
(NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) |
|
(NPC.downedMechBossAny ? BossFlags2.DownedMechBossAny : BossFlags2.None) |
|
||||||
(Main.cloudBGActive == 1f ? BossFlags2.CloudBg : BossFlags2.None) |
|
(Main.cloudBGActive >= 1f ? BossFlags2.CloudBg : BossFlags2.None) |
|
||||||
(WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) |
|
(WorldGen.crimson ? BossFlags2.Crimson : BossFlags2.None) |
|
||||||
(Main.pumpkinMoon ? BossFlags2.PumpkinMoon : BossFlags2.None) |
|
(Main.pumpkinMoon ? BossFlags2.PumpkinMoon : BossFlags2.None) |
|
||||||
(Main.snowMoon ? BossFlags2.SnowMoon : BossFlags2.None) ,
|
(Main.snowMoon ? BossFlags2.SnowMoon : BossFlags2.None) ,
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ namespace TShockAPI
|
||||||
/// <returns>name</returns>
|
/// <returns>name</returns>
|
||||||
public string GetBuffName(int id)
|
public string GetBuffName(int id)
|
||||||
{
|
{
|
||||||
return (id > 0 && id < Main.maxBuffs) ? Main.buffName[id] : "null";
|
return (id > 0 && id < Main.maxBuffTypes) ? Main.buffName[id] : "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -452,7 +452,7 @@ namespace TShockAPI
|
||||||
/// <returns>description</returns>
|
/// <returns>description</returns>
|
||||||
public string GetBuffDescription(int id)
|
public string GetBuffDescription(int id)
|
||||||
{
|
{
|
||||||
return (id > 0 && id < Main.maxBuffs) ? Main.buffTip[id] : "null";
|
return (id > 0 && id < Main.maxBuffTypes) ? Main.buffTip[id] : "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -463,13 +463,13 @@ namespace TShockAPI
|
||||||
public List<int> GetBuffByName(string name)
|
public List<int> GetBuffByName(string name)
|
||||||
{
|
{
|
||||||
string nameLower = name.ToLower();
|
string nameLower = name.ToLower();
|
||||||
for (int i = 1; i < Main.maxBuffs; i++)
|
for (int i = 1; i < Main.maxBuffTypes; i++)
|
||||||
{
|
{
|
||||||
if (Main.buffName[i].ToLower() == nameLower)
|
if (Main.buffName[i].ToLower() == nameLower)
|
||||||
return new List<int> {i};
|
return new List<int> {i};
|
||||||
}
|
}
|
||||||
var found = new List<int>();
|
var found = new List<int>();
|
||||||
for (int i = 1; i < Main.maxBuffs; i++)
|
for (int i = 1; i < Main.maxBuffTypes; i++)
|
||||||
{
|
{
|
||||||
if (Main.buffName[i].ToLower().StartsWith(nameLower))
|
if (Main.buffName[i].ToLower().StartsWith(nameLower))
|
||||||
found.Add(i);
|
found.Add(i);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 32544b409a0c40f2be57d27071fd97c36dbe73e4
|
Subproject commit 330a7f067c5ebd3f5dd9020f5f27a5e323ffdb1a
|
||||||
Loading…
Add table
Add a link
Reference in a new issue