Invisibility Potions are now item banable.
New noclip detection, has ignore permission.
This commit is contained in:
parent
40973abb3f
commit
c11b944735
4 changed files with 56 additions and 6 deletions
|
|
@ -196,6 +196,9 @@ namespace TShockAPI
|
|||
[Description("Require all players to register or login before being allowed to play.")]
|
||||
public bool RequireLogin = false;
|
||||
|
||||
[Description("Disables Invisibility potions from being used in PvP (Note, they can use them on the client, but the effect isn't sent to the rest of the server)")]
|
||||
public bool DisableInvisPvP = false;
|
||||
|
||||
public static ConfigFile Read(string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ namespace TShockAPI
|
|||
{PacketTypes.NpcStrike, HandleNpcStrike},
|
||||
{PacketTypes.NpcSpecial, HandleSpecial},
|
||||
{PacketTypes.PlayerAnimation, HandlePlayerAnimation},
|
||||
{PacketTypes.PlayerBuff, HandlePlayerBuffUpdate}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -624,6 +625,22 @@ namespace TShockAPI
|
|||
args.Player.Spawn();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!args.Player.Group.HasPermission(Permissions.ignorenoclipdetection) && TShock.CheckPlayerCollision((int)(pos.X / 16f), (int)(pos.Y / 16f)))
|
||||
{
|
||||
int lastTileX = (int)(args.Player.LastNetPosition.X / 16f);
|
||||
int lastTileY = (int)(args.Player.LastNetPosition.Y / 16f);
|
||||
if(args.Player.Teleport(lastTileX, lastTileY))
|
||||
{
|
||||
args.Player.SendMessage("You got stuck in a solid object, Sent to last good position.");
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Player.SendMessage("You got stuck in a solid object, Sent to spawn point.");
|
||||
args.Player.Spawn();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
args.Player.LastNetPosition = pos;
|
||||
|
||||
|
|
@ -1063,7 +1080,7 @@ namespace TShockAPI
|
|||
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
|
||||
return true;
|
||||
}
|
||||
if (TShock.CheckRangePermission(args.Player, TShock.Players[id].TileX, TShock.Players[id].TileY, 64))
|
||||
if (TShock.CheckRangePermission(args.Player, TShock.Players[id].TileX, TShock.Players[id].TileY, 50))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
|
||||
return true;
|
||||
|
|
@ -1097,7 +1114,7 @@ namespace TShockAPI
|
|||
return false;
|
||||
}
|
||||
|
||||
if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f), 64))
|
||||
if (TShock.CheckRangePermission(args.Player, (int)(pos.X / 16f), (int)(pos.Y / 16f)))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
return true;
|
||||
|
|
@ -1163,7 +1180,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (TShock.CheckRangePermission(args.Player, TShock.Players[id].TileX, TShock.Players[id].TileY, 128))
|
||||
if (TShock.CheckRangePermission(args.Player, TShock.Players[id].TileX, TShock.Players[id].TileY, 100))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerHp, "", id);
|
||||
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
|
||||
|
|
@ -1209,7 +1226,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (TShock.Config.RangeChecks && ((Math.Abs(args.Player.TileX - (Main.npc[id].position.X / 16f)) > 128) || (Math.Abs(args.Player.TileY - (Main.npc[id].position.Y / 16f)) > 128)))
|
||||
if (TShock.Config.RangeChecks && TShock.CheckRangePermission(args.Player, (int)(Main.npc[id].position.X / 16f), (int)(Main.npc[id].position.Y / 16f), 100))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
|
||||
return true;
|
||||
|
|
@ -1255,5 +1272,33 @@ namespace TShockAPI
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool HandlePlayerBuffUpdate(GetDataHandlerArgs args)
|
||||
{
|
||||
var id = args.Data.ReadInt8();
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var buff = args.Data.ReadInt8();
|
||||
|
||||
if (buff == 10)
|
||||
{
|
||||
if (!args.Player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Invisibility Potion"))
|
||||
buff = 0;
|
||||
else if (TShock.Config.DisableInvisPvP && args.TPlayer.hostile)
|
||||
buff = 0;
|
||||
}
|
||||
|
||||
args.TPlayer.buffType[i] = buff;
|
||||
if (args.TPlayer.buffType[i] > 0)
|
||||
{
|
||||
args.TPlayer.buffTime[i] = 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
args.TPlayer.buffTime[i] = 0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ namespace TShockAPI
|
|||
[Description("Prevents you from being reverted by place tile abuse detection")]
|
||||
public static readonly string ignoreplacetiledetection;
|
||||
|
||||
[Description("Prevents you from being reverted by no clip detection")]
|
||||
public static readonly string ignorenoclipdetection;
|
||||
|
||||
[Description("Specific log messages are sent to users with this permission")]
|
||||
public static readonly string logs;
|
||||
|
||||
|
|
|
|||
|
|
@ -756,7 +756,6 @@ namespace TShockAPI
|
|||
{
|
||||
var pos = RememberedPos.GetLeavePos(player.Name, player.IP);
|
||||
player.Teleport((int) pos.X, (int) pos.Y);
|
||||
player.SendTileSquare((int)pos.X, (int)pos.Y);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue