New visual feedback when disabled for security reasons.
This commit is contained in:
parent
e8a4cb6ae9
commit
a227369cdc
3 changed files with 41 additions and 21 deletions
|
|
@ -138,11 +138,6 @@ namespace TShockAPI
|
||||||
item.netDefaults(type);
|
item.netDefaults(type);
|
||||||
item.Prefix(prefix);
|
item.Prefix(prefix);
|
||||||
|
|
||||||
if (stack > item.maxStack && type != 0 && args.Player.IgnoreActionsForCheating != "none" && !args.Player.Group.HasPermission(Permissions.ignorestackhackdetection))
|
|
||||||
{
|
|
||||||
args.Player.IgnoreActionsForCheating = "Item Hack: " + item.name + " (" + stack + ") exceeds max stack of " + item.maxStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.Player.IsLoggedIn)
|
if (args.Player.IsLoggedIn)
|
||||||
{
|
{
|
||||||
args.Player.PlayerData.StoreSlot(slot, type, prefix, stack);
|
args.Player.PlayerData.StoreSlot(slot, type, prefix, stack);
|
||||||
|
|
@ -699,6 +694,11 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TShock.Config.PvPMode == "disabled")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.TPlayer.hostile != pvp)
|
if (args.TPlayer.hostile != pvp)
|
||||||
{
|
{
|
||||||
long seconds = (long)(DateTime.UtcNow - args.Player.LastPvpChange).TotalSeconds;
|
long seconds = (long)(DateTime.UtcNow - args.Player.LastPvpChange).TotalSeconds;
|
||||||
|
|
@ -713,13 +713,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (TShock.Config.PvPMode == "always")
|
if (TShock.Config.PvPMode == "always")
|
||||||
{
|
{
|
||||||
if (pvp == true)
|
if (!pvp)
|
||||||
args.Player.IgnoreActionsForPvP = false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args.Player.Spawn();
|
args.Player.Spawn();
|
||||||
args.Player.IgnoreActionsForPvP = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", args.Player.Index);
|
NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, "", args.Player.Index);
|
||||||
|
|
@ -765,7 +760,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("You need to rejoin to ensure your trash can is cleared!", Color.Red);
|
args.Player.SendMessage("You need to rejoin to ensure your trash can is cleared!", Color.Red);
|
||||||
}
|
}
|
||||||
else if (args.Player.IgnoreActionsForPvP)
|
else if (TShock.Config.PvPMode == "always" && !args.TPlayer.hostile)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage("PvP is forced! Enable PvP else you can't move or do anything!", Color.Red);
|
args.Player.SendMessage("PvP is forced! Enable PvP else you can't move or do anything!", Color.Red);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ namespace TShockAPI
|
||||||
public string Country = "??";
|
public string Country = "??";
|
||||||
public int Difficulty;
|
public int Difficulty;
|
||||||
private string CacheIP;
|
private string CacheIP;
|
||||||
public bool IgnoreActionsForPvP = false;
|
|
||||||
public string IgnoreActionsForInventory = "none";
|
public string IgnoreActionsForInventory = "none";
|
||||||
public string IgnoreActionsForCheating = "none";
|
public string IgnoreActionsForCheating = "none";
|
||||||
public string IgnoreActionsForDisabledArmor = "none";
|
public string IgnoreActionsForDisabledArmor = "none";
|
||||||
|
|
@ -353,10 +352,9 @@ namespace TShockAPI
|
||||||
public virtual void Disable()
|
public virtual void Disable()
|
||||||
{
|
{
|
||||||
LastThreat = DateTime.UtcNow;
|
LastThreat = DateTime.UtcNow;
|
||||||
SetBuff(35, 330); //Silenced
|
SetBuff(33, 330, true); //Weak
|
||||||
SetBuff(33, 330); //Weak
|
SetBuff(32, 330, true); //Slow
|
||||||
SetBuff(32, 330); //Slow
|
SetBuff(23, 330, true); //Cursed
|
||||||
SetBuff(23, 330); //Cursed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Whoopie(object time)
|
public virtual void Whoopie(object time)
|
||||||
|
|
@ -372,8 +370,11 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetBuff(int type, int time = 3600)
|
public virtual void SetBuff(int type, int time = 3600, bool bypass = false)
|
||||||
{
|
{
|
||||||
|
if ((DateTime.UtcNow - LastThreat).TotalMilliseconds < 5000 && !bypass)
|
||||||
|
return;
|
||||||
|
|
||||||
SendData(PacketTypes.PlayerAddBuff, number: Index, number2: (float)type, number3: (float)time);
|
SendData(PacketTypes.PlayerAddBuff, number: Index, number2: (float)type, number3: (float)time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -532,12 +532,35 @@ namespace TShockAPI
|
||||||
player.Spawn();
|
player.Spawn();
|
||||||
}
|
}
|
||||||
string check = "none";
|
string check = "none";
|
||||||
|
foreach (Item item in player.TPlayer.inventory)
|
||||||
|
{
|
||||||
|
if (!player.Group.HasPermission(Permissions.ignorestackhackdetection) && item.stack > item.maxStack && item.type != 0)
|
||||||
|
{
|
||||||
|
check = "Remove Item " + item.name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.IgnoreActionsForCheating = check;
|
||||||
|
check = "none";
|
||||||
foreach (Item item in player.TPlayer.armor)
|
foreach (Item item in player.TPlayer.armor)
|
||||||
{
|
{
|
||||||
if (!player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(item.name, player))
|
if (!player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(item.name, player))
|
||||||
check = "Remove Armor/Accessory (" + item.name + ")";
|
{
|
||||||
|
player.SetBuff(30, 120); //Bleeding
|
||||||
|
player.SetBuff(36, 120); //Broken Armor
|
||||||
|
check = "Remove Armor/Accessory " + item.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
player.IgnoreActionsForDisabledArmor = check;
|
player.IgnoreActionsForDisabledArmor = check;
|
||||||
|
if (CheckIgnores(player))
|
||||||
|
{
|
||||||
|
player.SetBuff(33, 120); //Weak
|
||||||
|
player.SetBuff(32, 120); //Slow
|
||||||
|
player.SetBuff(23, 120); //Cursed
|
||||||
|
}
|
||||||
|
else if(!player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))
|
||||||
|
{
|
||||||
|
player.SetBuff(23, 120); //Cursed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.Title = string.Format("TerrariaShock Version {0} ({1}) ({2}/{3})", Version, VersionCodename, count, Config.MaxSlots);
|
Console.Title = string.Format("TerrariaShock Version {0} ({1}) ({2}/{3})", Version, VersionCodename, count, Config.MaxSlots);
|
||||||
|
|
@ -796,7 +819,6 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (Config.PvPMode == "always" && !player.TPlayer.hostile)
|
if (Config.PvPMode == "always" && !player.TPlayer.hostile)
|
||||||
{
|
{
|
||||||
player.IgnoreActionsForPvP = true;
|
|
||||||
player.SendMessage("PvP is forced! Enable PvP else you can't move or do anything!", Color.Red);
|
player.SendMessage("PvP is forced! Enable PvP else you can't move or do anything!", Color.Red);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1235,7 +1257,7 @@ namespace TShockAPI
|
||||||
public static bool CheckIgnores(TSPlayer player)
|
public static bool CheckIgnores(TSPlayer player)
|
||||||
{
|
{
|
||||||
bool check = false;
|
bool check = false;
|
||||||
if (player.IgnoreActionsForPvP)
|
if (Config.PvPMode == "always" && !player.TPlayer.hostile)
|
||||||
check = true;
|
check = true;
|
||||||
if (player.IgnoreActionsForInventory != "none")
|
if (player.IgnoreActionsForInventory != "none")
|
||||||
check = true;
|
check = true;
|
||||||
|
|
@ -1243,6 +1265,8 @@ namespace TShockAPI
|
||||||
check = true;
|
check = true;
|
||||||
if (player.IgnoreActionsForDisabledArmor != "none")
|
if (player.IgnoreActionsForDisabledArmor != "none")
|
||||||
check = true;
|
check = true;
|
||||||
|
if (player.IgnoreActionsForClearingTrashCan)
|
||||||
|
check = true;
|
||||||
if (!player.IsLoggedIn && Config.RequireLogin)
|
if (!player.IsLoggedIn && Config.RequireLogin)
|
||||||
check = true;
|
check = true;
|
||||||
return check;
|
return check;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue