Add ability to turn off spam filters

This commit is contained in:
Bluzume 2021-11-09 01:21:59 -05:00
parent 9b32c8edeb
commit b6997c1cf6
4 changed files with 51 additions and 26 deletions

View file

@ -40,9 +40,15 @@ enable_corrections=true
# and FULL CAPS messages.
non_violation=true
# Wether or not to consider all users "Subscribers"
# Should the server consider all users "Subscribers"
# (warning might make ranches be in use forever.)
all_users_subscribed=false
# Limits ad and global chat
# to just a few messages every minute
# by each user
enable_spam_filter=true
# Equation is: BANK_BALANCE * (1/INTREST_RATE);
# on All servers except Black its 3333, on black its 1000.
# but of course you can make it whatever you want

View file

@ -21,6 +21,7 @@ namespace HISP.Server
public static string CrossDomainPolicyFile;
public static int LogLevel = 0;
public static bool EnableSpamFilter = true;
public static bool AllUsersSubbed = false;
public static bool BadWords = true;
public static bool DoCorrections = true;
@ -103,6 +104,9 @@ namespace HISP.Server
case "non_violation":
DoNonViolations = data == "true";
break;
case "enable_spam_filter":
EnableSpamFilter = data == "true";
break;
case "enable_word_filter":
BadWords = data == "true";
break;

View file

@ -189,12 +189,15 @@ namespace HISP.Server
totalMinutesElapsed++;
if (LoggedIn)
{
GameServer.UpdatePlayer(this);
LoggedinUser.CanUseAdsChat = true;
LoggedinUser.FreeMinutes -= 1;
if(totalMinutesElapsed % 2 == 0)
GameServer.DoItemPurchases(this);
if (totalMinutesElapsed % 2 == 0)
{
LoggedinUser.TotalGlobalChatMessages++;
}

View file

@ -3727,17 +3727,9 @@ namespace HISP.Server
if (RiddleEvent != null)
if (RiddleEvent.Active)
RiddleEvent.ShowStartMessage(sender);
// Give Queued Itmes
Item.ItemPurchaseQueueItem[] queueItems = Database.GetItemPurchaseQueue(sender.LoggedinUser.Id);
foreach (Item.ItemPurchaseQueueItem queueItem in queueItems)
{
for(int i = 0; i < queueItem.ItemCount; i++)
{
sender.LoggedinUser.Inventory.AddIgnoringFull(new ItemInstance(queueItem.ItemId));
}
}
Database.ClearItemPurchaseQueue(sender.LoggedinUser.Id);
DoItemPurchases(sender);
// Send Queued Messages
string[] queuedMessages = Database.GetMessageQueue(sender.LoggedinUser.Id);
@ -5902,29 +5894,33 @@ namespace HISP.Server
}
// Spam filter
if(channel == Chat.ChatChannel.Ads)
if(ConfigReader.EnableSpamFilter)
{
if(!sender.LoggedinUser.CanUseAdsChat && !sender.LoggedinUser.Administrator)
if (channel == Chat.ChatChannel.Ads)
{
byte[] cantSendInAds = PacketBuilder.CreateChat(Messages.AdsOnlyOncePerMinute, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(cantSendInAds);
if (!sender.LoggedinUser.CanUseAdsChat && !sender.LoggedinUser.Administrator)
{
byte[] cantSendInAds = PacketBuilder.CreateChat(Messages.AdsOnlyOncePerMinute, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(cantSendInAds);
return;
return;
}
sender.LoggedinUser.CanUseAdsChat = false;
}
sender.LoggedinUser.CanUseAdsChat = false;
}
else if(channel == Chat.ChatChannel.All)
{
if(sender.LoggedinUser.TotalGlobalChatMessages <= 0 && !sender.LoggedinUser.Administrator)
else if (channel == Chat.ChatChannel.All)
{
byte[] globalLimited = PacketBuilder.CreateChat(Messages.GlobalChatLimited, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(globalLimited);
if (sender.LoggedinUser.TotalGlobalChatMessages <= 0 && !sender.LoggedinUser.Administrator)
{
byte[] globalLimited = PacketBuilder.CreateChat(Messages.GlobalChatLimited, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(globalLimited);
return;
return;
}
sender.LoggedinUser.TotalGlobalChatMessages--;
}
sender.LoggedinUser.TotalGlobalChatMessages--;
}
// Muted user checks
if(channel == Chat.ChatChannel.Dm)
{
@ -8090,6 +8086,22 @@ namespace HISP.Server
if (sender.LoggedinUser.HorseWindowOpen)
UpdateArea(sender);
}
public static void DoItemPurchases(GameClient sender)
{
if (!sender.LoggedIn)
return;
Item.ItemPurchaseQueueItem[] queueItems = Database.GetItemPurchaseQueue(sender.LoggedinUser.Id);
foreach (Item.ItemPurchaseQueueItem queueItem in queueItems)
{
for (int i = 0; i < queueItem.ItemCount; i++)
{
sender.LoggedinUser.Inventory.AddIgnoringFull(new ItemInstance(queueItem.ItemId));
}
}
Database.ClearItemPurchaseQueue(sender.LoggedinUser.Id);
}
public static void StopRidingHorse(GameClient sender)
{
sender.LoggedinUser.CurrentlyRidingHorse = null;