This commit is contained in:
parent
1aa430016a
commit
2f57336fe8
3 changed files with 45 additions and 8 deletions
|
|
@ -30,6 +30,8 @@ using TShockAPI.DB;
|
||||||
using TShockAPI.Net;
|
using TShockAPI.Net;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ObjectData;
|
using Terraria.ObjectData;
|
||||||
|
using Terraria.DataStructures;
|
||||||
|
using Terraria.GameContent.Tile_Entities;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
|
|
@ -1255,6 +1257,7 @@ namespace TShockAPI
|
||||||
{ PacketTypes.CatchNPC, HandleCatchNpc },
|
{ PacketTypes.CatchNPC, HandleCatchNpc },
|
||||||
{ PacketTypes.KillPortal, HandleKillPortal },
|
{ PacketTypes.KillPortal, HandleKillPortal },
|
||||||
{ PacketTypes.PlaceTileEntity, HandlePlaceTileEntity },
|
{ PacketTypes.PlaceTileEntity, HandlePlaceTileEntity },
|
||||||
|
{ PacketTypes.PlaceItemFrame, HandlePlaceItemFrame },
|
||||||
{ PacketTypes.ToggleParty, HandleToggleParty }
|
{ PacketTypes.ToggleParty, HandleToggleParty }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -4140,6 +4143,42 @@ namespace TShockAPI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool HandlePlaceItemFrame(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
var x = args.Data.ReadInt16();
|
||||||
|
var y = args.Data.ReadInt16();
|
||||||
|
var itemID = args.Data.ReadInt16();
|
||||||
|
var prefix = args.Data.ReadInt8();
|
||||||
|
var stack = args.Data.ReadInt16();
|
||||||
|
var itemFrame = (TEItemFrame)TileEntity.ByID[TEItemFrame.Find(x, y)];
|
||||||
|
|
||||||
|
if (TShock.CheckIgnores(args.Player))
|
||||||
|
{
|
||||||
|
NetMessage.SendData(86, -1, -1, "", itemFrame.ID, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TShock.CheckTilePermission(args.Player, x, y))
|
||||||
|
{
|
||||||
|
NetMessage.SendData(86, -1, -1, "", itemFrame.ID, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TShock.CheckRangePermission(args.Player, x, y))
|
||||||
|
{
|
||||||
|
NetMessage.SendData(86, -1, -1, "", itemFrame.ID, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemFrame.item?.netID == args.TPlayer.inventory[args.TPlayer.selectedItem]?.netID)
|
||||||
|
{
|
||||||
|
NetMessage.SendData(86, -1, -1, "", itemFrame.ID, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static bool HandleToggleParty(GetDataHandlerArgs args)
|
private static bool HandleToggleParty(GetDataHandlerArgs args)
|
||||||
{
|
{
|
||||||
if (args.Player != null && !args.Player.HasPermission(Permissions.toggleparty))
|
if (args.Player != null && !args.Player.HasPermission(Permissions.toggleparty))
|
||||||
|
|
|
||||||
|
|
@ -974,8 +974,7 @@ namespace TShockAPI
|
||||||
/// <param name="red">The amount of red color to factor in. Max: 255.</param>
|
/// <param name="red">The amount of red color to factor in. Max: 255.</param>
|
||||||
/// <param name="green">The amount of green color to factor in. Max: 255</param>
|
/// <param name="green">The amount of green color to factor in. Max: 255</param>
|
||||||
/// <param name="blue">The amount of blue color to factor in. Max: 255</param>
|
/// <param name="blue">The amount of blue color to factor in. Max: 255</param>
|
||||||
/// <param name="messageLength">The number of pixels before the message splits lines. Defaults to -1, which is the client's screen width.</param>
|
public virtual void SendMessage(string msg, byte red, byte green, byte blue)
|
||||||
public virtual void SendMessage(string msg, byte red, byte green, byte blue, int messageLength = -1)
|
|
||||||
{
|
{
|
||||||
if (msg.Contains("\n"))
|
if (msg.Contains("\n"))
|
||||||
{
|
{
|
||||||
|
|
@ -986,7 +985,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendData(PacketTypes.SmartTextMessage, msg, 255, red, green, blue, messageLength);
|
SendData(PacketTypes.SmartTextMessage, msg, 255, red, green, blue, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -997,8 +996,7 @@ namespace TShockAPI
|
||||||
/// <param name="green">The amount of green color to factor in. Max: 255.</param>
|
/// <param name="green">The amount of green color to factor in. Max: 255.</param>
|
||||||
/// <param name="blue">The amount of blue color to factor in. Max: 255.</param>
|
/// <param name="blue">The amount of blue color to factor in. Max: 255.</param>
|
||||||
/// <param name="ply">The player who receives the message.</param>
|
/// <param name="ply">The player who receives the message.</param>
|
||||||
/// <param name="messageLength">The number of pixels before the message splits lines. Defaults to -1, which is the client's screen width.</param>
|
public virtual void SendMessageFromPlayer(string msg, byte red, byte green, byte blue, int ply)
|
||||||
public virtual void SendMessageFromPlayer(string msg, byte red, byte green, byte blue, int ply, int messageLength = -1)
|
|
||||||
{
|
{
|
||||||
if (msg.Contains("\n"))
|
if (msg.Contains("\n"))
|
||||||
{
|
{
|
||||||
|
|
@ -1009,7 +1007,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SendDataFromPlayer(PacketTypes.SmartTextMessage, ply, msg, red, green, blue, messageLength);
|
SendDataFromPlayer(PacketTypes.SmartTextMessage, ply, msg, red, green, blue, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1246,7 +1244,7 @@ namespace TShockAPI
|
||||||
SendMessage(msg, color.R, color.G, color.B);
|
SendMessage(msg, color.R, color.G, color.B);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SendMessage(string msg, byte red, byte green, byte blue, int messageLength = -1)
|
public override void SendMessage(string msg, byte red, byte green, byte blue)
|
||||||
{
|
{
|
||||||
this.CommandOutput.Add(msg);
|
this.CommandOutput.Add(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace TShockAPI
|
||||||
SendMessage(msg, color.R, color.G, color.B);
|
SendMessage(msg, color.R, color.G, color.B);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SendMessage(string msg, byte red, byte green, byte blue, int messageLength = -1)
|
public override void SendMessage(string msg, byte red, byte green, byte blue)
|
||||||
{
|
{
|
||||||
Console.WriteLine(msg);
|
Console.WriteLine(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue