Merge pull request #1270 from ProfessorXZ/syncextravalue-validation
SyncExtraValue validation. Fixes #1024
This commit is contained in:
commit
66f5f9f540
3 changed files with 65 additions and 7 deletions
|
|
@ -18,6 +18,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Players can no longer quick stack items into region protected chests (@ProfessorXZ)
|
* Players can no longer quick stack items into region protected chests (@ProfessorXZ)
|
||||||
* Rope placement is no longer blocked by range checks (@ProfessorXZ)
|
* Rope placement is no longer blocked by range checks (@ProfessorXZ)
|
||||||
* The Drill Containment Unit breaks blocks properly now (@ProfessorXZ)
|
* The Drill Containment Unit breaks blocks properly now (@ProfessorXZ)
|
||||||
|
* Fixed Expert mode coin duplication (@ProfessorXZ)
|
||||||
|
* Players are no longer able to place liquids using LoadNetModule packet (@ProfessorXZ)
|
||||||
|
|
||||||
## TShock 4.3.17
|
## TShock 4.3.17
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ namespace TShockAPI
|
||||||
public int TileY { get; set; }
|
public int TileY { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TileKill - When a tile is removed fromt he world
|
/// TileKill - When a tile is removed from the world
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<TileKillEventArgs> TileKill;
|
public static HandlerList<TileKillEventArgs> TileKill;
|
||||||
|
|
||||||
|
|
@ -1259,6 +1259,8 @@ namespace TShockAPI
|
||||||
{ PacketTypes.KillPortal, HandleKillPortal },
|
{ PacketTypes.KillPortal, HandleKillPortal },
|
||||||
{ PacketTypes.PlaceTileEntity, HandlePlaceTileEntity },
|
{ PacketTypes.PlaceTileEntity, HandlePlaceTileEntity },
|
||||||
{ PacketTypes.PlaceItemFrame, HandlePlaceItemFrame },
|
{ PacketTypes.PlaceItemFrame, HandlePlaceItemFrame },
|
||||||
|
{ PacketTypes.SyncExtraValue, HandleSyncExtraValue },
|
||||||
|
{ PacketTypes.LoadNetModule, HandleLoadNetModule },
|
||||||
{ PacketTypes.ToggleParty, HandleToggleParty }
|
{ PacketTypes.ToggleParty, HandleToggleParty }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -4203,11 +4205,41 @@ namespace TShockAPI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool HandleSyncExtraValue(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
var npcIndex = args.Data.ReadInt16();
|
||||||
|
var extraValue = args.Data.ReadSingle();
|
||||||
|
var position = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
|
||||||
|
|
||||||
|
if (position.X < 0 || position.X >= Main.maxTilesX || position.Y < 0 || position.Y >= Main.maxTilesY)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Main.expertMode)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TShock.CheckRangePermission(args.Player, (int)position.X, (int)position.Y))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool HandleLoadNetModule(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
// Since this packet is never actually sent to us, every attempt at sending it can be considered as a liquid exploit attempt
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
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))
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("You do not have permission to start a party");
|
args.Player.SendErrorMessage("You do not have permission to start a party.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,14 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int LoginAttempts { get; set; }
|
public int LoginAttempts { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unused.
|
||||||
|
/// </summary>
|
||||||
public Vector2 TeleportCoords = new Vector2(-1, -1);
|
public Vector2 TeleportCoords = new Vector2(-1, -1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The player's last known position from PlayerUpdate packet.
|
||||||
|
/// </summary>
|
||||||
public Vector2 LastNetPosition = Vector2.Zero;
|
public Vector2 LastNetPosition = Vector2.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -247,6 +253,9 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasBeenNaggedAboutLoggingIn;
|
public bool HasBeenNaggedAboutLoggingIn;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether other players can teleport to the player.
|
||||||
|
/// </summary>
|
||||||
public bool TPAllow = true;
|
public bool TPAllow = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -435,7 +444,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the player's inventory to SSI
|
/// Saves the player's inventory to SSC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>bool - True/false if it saved successfully</returns>
|
/// <returns>bool - True/false if it saved successfully</returns>
|
||||||
public bool SaveServerCharacter()
|
public bool SaveServerCharacter()
|
||||||
|
|
@ -534,7 +543,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the player's X tile coordinate.
|
/// Player X coordinate divided by 16. Supposed X world coordinate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TileX
|
public int TileX
|
||||||
{
|
{
|
||||||
|
|
@ -542,13 +551,16 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the player's Y tile coordinate.
|
/// Player Y cooridnate divided by 16. Supposed Y world coordinate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TileY
|
public int TileY
|
||||||
{
|
{
|
||||||
get { return (int) (Y/16); }
|
get { return (int) (Y/16); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unused.
|
||||||
|
/// </summary>
|
||||||
public bool TpLock;
|
public bool TpLock;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -630,6 +642,10 @@ namespace TShockAPI
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TSPlayer"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index">The player's index in the.</param>
|
||||||
public TSPlayer(int index)
|
public TSPlayer(int index)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
||||||
|
|
@ -640,6 +656,10 @@ namespace TShockAPI
|
||||||
AwaitingResponse = new Dictionary<string, Action<object>>();
|
AwaitingResponse = new Dictionary<string, Action<object>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TSPlayer"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playerName">The player's name.</param>
|
||||||
protected TSPlayer(String playerName)
|
protected TSPlayer(String playerName)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
||||||
|
|
@ -686,7 +706,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Teleports a player to the given coordinates in the world.
|
/// Teleports the player to the given coordinates in the world.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="x">The X coordinate.</param>
|
/// <param name="x">The X coordinate.</param>
|
||||||
/// <param name="y">The Y coordinate.</param>
|
/// <param name="y">The Y coordinate.</param>
|
||||||
|
|
@ -989,7 +1009,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a message to a player with the specified RGB color.
|
/// Sends a message to the player with the specified RGB color.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg">The message.</param>
|
/// <param name="msg">The message.</param>
|
||||||
/// <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>
|
||||||
|
|
@ -1116,6 +1136,10 @@ namespace TShockAPI
|
||||||
TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable().");
|
TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable().");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Annoys the player for a specified amount of time.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The</param>
|
||||||
public virtual void Whoopie(object time)
|
public virtual void Whoopie(object time)
|
||||||
{
|
{
|
||||||
var time2 = (int) time;
|
var time2 = (int) time;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue