Update grammar on stack cheat messages.
This commit is contained in:
parent
8a43c701a3
commit
f9a1819e26
3 changed files with 26 additions and 32 deletions
|
|
@ -1916,9 +1916,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (!args.Player.HasPermission(Permissions.ignorestackhackdetection))
|
if (!args.Player.HasPermission(Permissions.ignorestackhackdetection))
|
||||||
{
|
{
|
||||||
// TODO: When checkignores gets merged, this needs to set the hacked item stack flag
|
args.Player.IsDisabledForStackDetection = args.Player.HasHackedItemStacks(true);
|
||||||
// and get moved to bouncer
|
|
||||||
args.Player.HasHackedItemStacks(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TShock.Utils.ActivePlayers() + 1 > TShock.Config.MaxSlots &&
|
if (TShock.Utils.ActivePlayers() + 1 > TShock.Config.MaxSlots &&
|
||||||
|
|
|
||||||
|
|
@ -308,10 +308,12 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Checks to see if a player has hacked item stacks in their inventory, and messages them as it checks.</summary>
|
/// <summary>Checks to see if a player has hacked item stacks in their inventory, and messages them as it checks.</summary>
|
||||||
/// <param name="message">If the check should send a message to the player with the results of the check.</param>
|
/// <param name="shouldSendMessage">If the check should send a message to the player with the results of the check.</param>
|
||||||
/// <returns>True if any stacks don't conform.</returns>
|
/// <returns>True if any stacks don't conform.</returns>
|
||||||
public bool HasHackedItemStacks(bool shouldSendMessage = false)
|
public bool HasHackedItemStacks(bool shouldSendMessage = false)
|
||||||
{
|
{
|
||||||
|
// Iterates through each inventory location a player has.
|
||||||
|
// This section is sub divided into number ranges for what each range of slots corresponds to.
|
||||||
bool check = false;
|
bool check = false;
|
||||||
|
|
||||||
Item[] inventory = TPlayer.inventory;
|
Item[] inventory = TPlayer.inventory;
|
||||||
|
|
@ -327,6 +329,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (i < NetItem.InventoryIndex.Item2)
|
if (i < NetItem.InventoryIndex.Item2)
|
||||||
{
|
{
|
||||||
|
// From above: this is slots 0-58 in the inventory.
|
||||||
// 0-58
|
// 0-58
|
||||||
Item item = new Item();
|
Item item = new Item();
|
||||||
if (inventory[i] != null && inventory[i].netID != 0)
|
if (inventory[i] != null && inventory[i].netID != 0)
|
||||||
|
|
@ -334,7 +337,7 @@ namespace TShockAPI
|
||||||
item.netDefaults(inventory[i].netID);
|
item.netDefaults(inventory[i].netID);
|
||||||
item.Prefix(inventory[i].prefix);
|
item.Prefix(inventory[i].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
if (inventory[i].stack > item.maxStack)
|
if (inventory[i].stack > item.maxStack || inventory[i].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
@ -354,7 +357,7 @@ namespace TShockAPI
|
||||||
item.netDefaults(armor[index].netID);
|
item.netDefaults(armor[index].netID);
|
||||||
item.Prefix(armor[index].prefix);
|
item.Prefix(armor[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
if (armor[index].stack > item.maxStack)
|
if (armor[index].stack > item.maxStack || armor[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
@ -374,7 +377,7 @@ namespace TShockAPI
|
||||||
item.netDefaults(dye[index].netID);
|
item.netDefaults(dye[index].netID);
|
||||||
item.Prefix(dye[index].prefix);
|
item.Prefix(dye[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
if (dye[index].stack > item.maxStack)
|
if (dye[index].stack > item.maxStack || dye[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
@ -394,7 +397,7 @@ namespace TShockAPI
|
||||||
item.netDefaults(miscEquips[index].netID);
|
item.netDefaults(miscEquips[index].netID);
|
||||||
item.Prefix(miscEquips[index].prefix);
|
item.Prefix(miscEquips[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
if (miscEquips[index].stack > item.maxStack)
|
if (miscEquips[index].stack > item.maxStack || miscEquips[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
@ -414,7 +417,7 @@ namespace TShockAPI
|
||||||
item.netDefaults(miscDyes[index].netID);
|
item.netDefaults(miscDyes[index].netID);
|
||||||
item.Prefix(miscDyes[index].prefix);
|
item.Prefix(miscDyes[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
if (miscDyes[index].stack > item.maxStack)
|
if (miscDyes[index].stack > item.maxStack || miscDyes[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
@ -435,12 +438,12 @@ namespace TShockAPI
|
||||||
item.Prefix(piggy[index].prefix);
|
item.Prefix(piggy[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
|
|
||||||
if (piggy[index].stack > item.maxStack)
|
if (piggy[index].stack > item.maxStack || piggy[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
{
|
{
|
||||||
SendErrorMessage("Stack cheat detected. Remove Piggy-bank item {0} ({1}) and then rejoin.", item.Name, piggy[index].stack);
|
SendErrorMessage("Stack cheat detected. Remove piggy-bank item {0} ({1}) and then rejoin.", item.Name, piggy[index].stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -456,12 +459,12 @@ namespace TShockAPI
|
||||||
item.Prefix(safe[index].prefix);
|
item.Prefix(safe[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
|
|
||||||
if (safe[index].stack > item.maxStack)
|
if (safe[index].stack > item.maxStack || safe[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
{
|
{
|
||||||
SendErrorMessage("Stack cheat detected. Remove Safe item {0} ({1}) and then rejoin.", item.Name, safe[index].stack);
|
SendErrorMessage("Stack cheat detected. Remove safe item {0} ({1}) and then rejoin.", item.Name, safe[index].stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -497,7 +500,7 @@ namespace TShockAPI
|
||||||
item.Prefix(forge[index].prefix);
|
item.Prefix(forge[index].prefix);
|
||||||
item.AffixName();
|
item.AffixName();
|
||||||
|
|
||||||
if (forge[index].stack > item.maxStack)
|
if (forge[index].stack > item.maxStack || forge[index].stack < 0)
|
||||||
{
|
{
|
||||||
check = true;
|
check = true;
|
||||||
if (shouldSendMessage)
|
if (shouldSendMessage)
|
||||||
|
|
|
||||||
|
|
@ -1096,17 +1096,10 @@ namespace TShockAPI
|
||||||
else if (!Main.ServerSideCharacter || (Main.ServerSideCharacter && player.IsLoggedIn))
|
else if (!Main.ServerSideCharacter || (Main.ServerSideCharacter && player.IsLoggedIn))
|
||||||
{
|
{
|
||||||
string check = "none";
|
string check = "none";
|
||||||
foreach (Item item in player.TPlayer.inventory)
|
if (!player.HasPermission(Permissions.ignorestackhackdetection))
|
||||||
{
|
{
|
||||||
if (!player.HasPermission(Permissions.ignorestackhackdetection) && (item.stack > item.maxStack || item.stack < 0) &&
|
player.IsDisabledForStackDetection = player.HasHackedItemStacks(true);
|
||||||
item.type != 0)
|
|
||||||
{
|
|
||||||
check = "Remove item " + item.Name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
|
|
||||||
player.SendErrorMessage(check);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
player.IsDisabledForStackDetection = true;
|
|
||||||
check = "none";
|
check = "none";
|
||||||
// Please don't remove this for the time being; without it, players wearing banned equipment will only get debuffed once
|
// Please don't remove this for the time being; without it, players wearing banned equipment will only get debuffed once
|
||||||
foreach (Item item in player.TPlayer.armor)
|
foreach (Item item in player.TPlayer.armor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue