diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index c8d37d33..801e6273 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1259,6 +1259,7 @@ namespace TShockAPI { PacketTypes.KillPortal, HandleKillPortal }, { PacketTypes.PlaceTileEntity, HandlePlaceTileEntity }, { PacketTypes.PlaceItemFrame, HandlePlaceItemFrame }, + { PacketTypes.SyncExtraValue, HandleSyncExtraValue }, { PacketTypes.ToggleParty, HandleToggleParty } }; } @@ -4203,11 +4204,35 @@ namespace TShockAPI 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 HandleToggleParty(GetDataHandlerArgs args) { 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; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 858b4ba9..95feb980 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -198,8 +198,14 @@ namespace TShockAPI /// public int LoginAttempts { get; set; } + /// + /// Unused. + /// public Vector2 TeleportCoords = new Vector2(-1, -1); + /// + /// The player's last known position from PlayerUpdate packet. + /// public Vector2 LastNetPosition = Vector2.Zero; /// @@ -247,6 +253,9 @@ namespace TShockAPI /// public bool HasBeenNaggedAboutLoggingIn; + /// + /// Whether other players can teleport to the player. + /// public bool TPAllow = true; /// @@ -435,7 +444,7 @@ namespace TShockAPI } /// - /// Saves the player's inventory to SSI + /// Saves the player's inventory to SSC /// /// bool - True/false if it saved successfully public bool SaveServerCharacter() @@ -534,7 +543,7 @@ namespace TShockAPI } /// - /// Gets the player's X tile coordinate. + /// Player X coordinate divided by 16. Supposed X world coordinate. /// public int TileX { @@ -542,13 +551,16 @@ namespace TShockAPI } /// - /// Gets the player's Y tile coordinate. + /// Player Y cooridnate divided by 16. Supposed Y world coordinate. /// public int TileY { get { return (int) (Y/16); } } + /// + /// Unused. + /// public bool TpLock; /// @@ -630,6 +642,10 @@ namespace TShockAPI return null; } + /// + /// Initializes a new instance of the class. + /// + /// The player's index in the. public TSPlayer(int index) { TilesDestroyed = new Dictionary(); @@ -640,6 +656,10 @@ namespace TShockAPI AwaitingResponse = new Dictionary>(); } + /// + /// Initializes a new instance of the class. + /// + /// The player's name. protected TSPlayer(String playerName) { TilesDestroyed = new Dictionary(); @@ -686,7 +706,7 @@ namespace TShockAPI } /// - /// Teleports a player to the given coordinates in the world. + /// Teleports the player to the given coordinates in the world. /// /// The X coordinate. /// The Y coordinate. @@ -989,7 +1009,7 @@ namespace TShockAPI } /// - /// Sends a message to a player with the specified RGB color. + /// Sends a message to the player with the specified RGB color. /// /// The message. /// The amount of red color to factor in. Max: 255. @@ -1116,6 +1136,10 @@ namespace TShockAPI TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()."); } + /// + /// Annoys the player for a specified amount of time. + /// + /// The public virtual void Whoopie(object time) { var time2 = (int) time;