mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Add various chat related checks
This commit is contained in:
parent
2e4ba0b82d
commit
5fc313657d
8 changed files with 114 additions and 3 deletions
|
@ -61,6 +61,11 @@
|
||||||
"no_telescope":"You do not have a telescope to use! You try making circles with your hands and placing them in front of one eye, but it is of minimal aid...",
|
"no_telescope":"You do not have a telescope to use! You try making circles with your hands and placing them in front of one eye, but it is of minimal aid...",
|
||||||
"starved_horse":"You have been sent to Prison Isle for starving one of your horses! They have been fed for you.",
|
"starved_horse":"You have been sent to Prison Isle for starving one of your horses! They have been fed for you.",
|
||||||
"message_queue":"<B>OFFLINE MESSAGE:</B>",
|
"message_queue":"<B>OFFLINE MESSAGE:</B>",
|
||||||
|
"chat_errors":{
|
||||||
|
"cant_find_player":"Could not find player to Private chat!",
|
||||||
|
"ads_once_per_minute":"Ads may only be posted once per minute.",
|
||||||
|
"global_chats_limited":"<B>CHAT NOT SENT:</B> Global chats are limited (+1 earned per 2 minutes). Please chat using CHAT NEAR/ISLAND/BUDDIES when possible."
|
||||||
|
},
|
||||||
"events":{
|
"events":{
|
||||||
"real_time_riddle":{
|
"real_time_riddle":{
|
||||||
"event_start":"<B>CHAT RIDDLE:</B> %RIDDLETEXT% <I>(answer first via any chat method)</I>",
|
"event_start":"<B>CHAT RIDDLE:</B> %RIDDLETEXT% <I>(answer first via any chat method)</I>",
|
||||||
|
|
|
@ -124,6 +124,7 @@ namespace HISP.Game.Chat
|
||||||
try{
|
try{
|
||||||
User bannedUser = GameServer.GetUserByName(args[0]);
|
User bannedUser = GameServer.GetUserByName(args[0]);
|
||||||
bannedUser.LoggedinClient.Kick(Messages.KickReasonBanned);
|
bannedUser.LoggedinClient.Kick(Messages.KickReasonBanned);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(KeyNotFoundException){};
|
catch(KeyNotFoundException){};
|
||||||
|
|
||||||
|
@ -357,7 +358,10 @@ namespace HISP.Game.Chat
|
||||||
string moves = string.Join(" ", args).ToLower();
|
string moves = string.Join(" ", args).ToLower();
|
||||||
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
||||||
|
|
||||||
new Dance(user, moves);
|
if (user.ActiveDance != null)
|
||||||
|
user.ActiveDance.Dispose();
|
||||||
|
|
||||||
|
user.ActiveDance = new Dance(user, moves);
|
||||||
|
|
||||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||||
user.LoggedinClient.SendPacket(chatPacket);
|
user.LoggedinClient.SendPacket(chatPacket);
|
||||||
|
|
|
@ -40,6 +40,11 @@ namespace HISP.Game
|
||||||
|
|
||||||
public static string CantSendPrivateMessagePlayerMutedFormat;
|
public static string CantSendPrivateMessagePlayerMutedFormat;
|
||||||
|
|
||||||
|
// Chat Errors
|
||||||
|
public static string CantFindPlayerToPrivateMessage;
|
||||||
|
public static string AdsOnlyOncePerMinute;
|
||||||
|
public static string GlobalChatLimited;
|
||||||
|
|
||||||
// Auto Sell
|
// Auto Sell
|
||||||
public static string AutoSellNotStandingInSamePlace;
|
public static string AutoSellNotStandingInSamePlace;
|
||||||
public static string AutoSellSuccessFormat;
|
public static string AutoSellSuccessFormat;
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace HISP.Player
|
||||||
public Dance(User BaseUser, string DanceMoves)
|
public Dance(User BaseUser, string DanceMoves)
|
||||||
{
|
{
|
||||||
baseUser = BaseUser;
|
baseUser = BaseUser;
|
||||||
|
baseUser.ActiveDance = this;
|
||||||
Moves = DanceMoves.ToLower();
|
Moves = DanceMoves.ToLower();
|
||||||
MoveIndex = -1;
|
MoveIndex = -1;
|
||||||
danceTimer = new Timer(new TimerCallback(onDanceTick), null, DanceSpeed, DanceSpeed);
|
danceTimer = new Timer(new TimerCallback(onDanceTick), null, DanceSpeed, DanceSpeed);
|
||||||
|
@ -79,6 +80,7 @@ namespace HISP.Player
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
baseUser.ActiveDance = null;
|
||||||
baseUser = null;
|
baseUser = null;
|
||||||
Moves = null;
|
Moves = null;
|
||||||
danceTimer.Dispose();
|
danceTimer.Dispose();
|
||||||
|
|
|
@ -101,11 +101,14 @@ namespace HISP.Player
|
||||||
public User SocializingWith;
|
public User SocializingWith;
|
||||||
public List<User> BeingSocializedBy = new List<User>();
|
public List<User> BeingSocializedBy = new List<User>();
|
||||||
public User PendingBuddyRequestTo;
|
public User PendingBuddyRequestTo;
|
||||||
|
public Dance ActiveDance;
|
||||||
|
public bool CanUseAdsChat = true;
|
||||||
public int CapturingHorseId;
|
public int CapturingHorseId;
|
||||||
public DateTime LoginTime;
|
public DateTime LoginTime;
|
||||||
public string LastSeenWeather;
|
public string LastSeenWeather;
|
||||||
public int LastClickedRanchBuilding = 0;
|
public int LastClickedRanchBuilding = 0;
|
||||||
public bool ListingAuction = false;
|
public bool ListingAuction = false;
|
||||||
|
public int TotalGlobalChatMessages = 1;
|
||||||
|
|
||||||
public string GetWeatherSeen()
|
public string GetWeatherSeen()
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace HISP.Server
|
||||||
private int warnInterval = GameServer.IdleWarning * 60 * 1000;
|
private int warnInterval = GameServer.IdleWarning * 60 * 1000;
|
||||||
private int kickInterval = GameServer.IdleTimeout * 60 * 1000;
|
private int kickInterval = GameServer.IdleTimeout * 60 * 1000;
|
||||||
|
|
||||||
|
|
||||||
private bool dcLock = false;
|
private bool dcLock = false;
|
||||||
|
|
||||||
private void minuteTimerTick(object state)
|
private void minuteTimerTick(object state)
|
||||||
|
@ -55,7 +56,14 @@ namespace HISP.Server
|
||||||
totalMinutesElapsed++;
|
totalMinutesElapsed++;
|
||||||
if (LoggedIn)
|
if (LoggedIn)
|
||||||
{
|
{
|
||||||
|
LoggedinUser.CanUseAdsChat = true;
|
||||||
LoggedinUser.FreeMinutes -= 1;
|
LoggedinUser.FreeMinutes -= 1;
|
||||||
|
|
||||||
|
if(totalMinutesElapsed % 2 == 0)
|
||||||
|
{
|
||||||
|
LoggedinUser.TotalGlobalChatMessages++;
|
||||||
|
}
|
||||||
|
|
||||||
if (LoggedinUser.FreeMinutes <= 0)
|
if (LoggedinUser.FreeMinutes <= 0)
|
||||||
{
|
{
|
||||||
LoggedinUser.FreeMinutes = 0;
|
LoggedinUser.FreeMinutes = 0;
|
||||||
|
|
|
@ -882,6 +882,11 @@ namespace HISP.Server
|
||||||
|
|
||||||
Messages.CantSendPrivateMessagePlayerMutedFormat = gameData.messages.meta.mute_command.cant_send_pm_player_muted;
|
Messages.CantSendPrivateMessagePlayerMutedFormat = gameData.messages.meta.mute_command.cant_send_pm_player_muted;
|
||||||
|
|
||||||
|
// Chat Errors
|
||||||
|
Messages.CantFindPlayerToPrivateMessage = gameData.messages.chat_errors.cant_find_player;
|
||||||
|
Messages.AdsOnlyOncePerMinute = gameData.messages.chat_errors.ads_once_per_minute;
|
||||||
|
Messages.GlobalChatLimited = gameData.messages.chat_errors.global_chats_limited;
|
||||||
|
|
||||||
// Warp Command
|
// Warp Command
|
||||||
|
|
||||||
Messages.SuccessfullyWarpedToPlayer = gameData.messages.commands.warp.player;
|
Messages.SuccessfullyWarpedToPlayer = gameData.messages.commands.warp.player;
|
||||||
|
|
|
@ -204,7 +204,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
Database.IncPlayerTirednessForOfflineUsers();
|
Database.IncPlayerTirednessForOfflineUsers();
|
||||||
|
|
||||||
// Offline player handling w sql magic...
|
// Offline player handling w sql black magic...
|
||||||
|
|
||||||
Database.DecrementHorseLeaseTimeForOfflinePlayers();
|
Database.DecrementHorseLeaseTimeForOfflinePlayers();
|
||||||
Database.TpOfflinePlayersBackToUniterForOfflinePlayers();
|
Database.TpOfflinePlayersBackToUniterForOfflinePlayers();
|
||||||
|
@ -5391,7 +5391,51 @@ namespace HISP.Server
|
||||||
|
|
||||||
if (message == "")
|
if (message == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(message.StartsWith("/"))
|
||||||
|
{
|
||||||
|
string channelString = message.Split(' ')[0].ToLower();
|
||||||
|
string newMessage = string.Join(' ', message.Split(' ').Skip(1));
|
||||||
|
message = newMessage;
|
||||||
|
switch(channelString)
|
||||||
|
{
|
||||||
|
case "/$":
|
||||||
|
case "/ads":
|
||||||
|
channel = Chat.ChatChannel.Ads;
|
||||||
|
break;
|
||||||
|
case "/all":
|
||||||
|
channel = Chat.ChatChannel.All;
|
||||||
|
break;
|
||||||
|
case "/here":
|
||||||
|
channel = Chat.ChatChannel.Here;
|
||||||
|
break;
|
||||||
|
case "/near":
|
||||||
|
channel = Chat.ChatChannel.Near;
|
||||||
|
break;
|
||||||
|
case "/buddy":
|
||||||
|
channel = Chat.ChatChannel.Buddies;
|
||||||
|
break;
|
||||||
|
case "/island":
|
||||||
|
channel = Chat.ChatChannel.Isle;
|
||||||
|
break;
|
||||||
|
case "/admin":
|
||||||
|
if (sender.LoggedinUser.Administrator)
|
||||||
|
channel = Chat.ChatChannel.Admin;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
case "/mod":
|
||||||
|
if (sender.LoggedinUser.Moderator)
|
||||||
|
channel = Chat.ChatChannel.Mod;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
channel = Chat.ChatChannel.Dm;
|
||||||
|
nameTo = channelString.Substring(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Chat.ProcessCommand(sender.LoggedinUser, message))
|
if (Chat.ProcessCommand(sender.LoggedinUser, message))
|
||||||
{
|
{
|
||||||
|
@ -5446,6 +5490,41 @@ namespace HISP.Server
|
||||||
|
|
||||||
GameClient[] recipiants = Chat.GetRecipiants(sender.LoggedinUser, channel, nameTo);
|
GameClient[] recipiants = Chat.GetRecipiants(sender.LoggedinUser, channel, nameTo);
|
||||||
|
|
||||||
|
// Spam Protection
|
||||||
|
|
||||||
|
if(channel == Chat.ChatChannel.Dm)
|
||||||
|
{
|
||||||
|
if(recipiants.Length <= 0)
|
||||||
|
{
|
||||||
|
byte[] cantFindPlayer = PacketBuilder.CreateChat(Messages.CantFindPlayerToPrivateMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(cantFindPlayer);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(channel == Chat.ChatChannel.Ads)
|
||||||
|
{
|
||||||
|
if(!sender.LoggedinUser.CanUseAdsChat)
|
||||||
|
{
|
||||||
|
byte[] cantSendInAds = PacketBuilder.CreateChat(Messages.AdsOnlyOncePerMinute, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(cantSendInAds);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.LoggedinUser.CanUseAdsChat = false;
|
||||||
|
}
|
||||||
|
else if(channel == Chat.ChatChannel.All)
|
||||||
|
{
|
||||||
|
if(sender.LoggedinUser.TotalGlobalChatMessages <= 0)
|
||||||
|
{
|
||||||
|
byte[] globalLimited = PacketBuilder.CreateChat(Messages.GlobalChatLimited, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(globalLimited);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.LoggedinUser.TotalGlobalChatMessages--;
|
||||||
|
}
|
||||||
|
|
||||||
// Muted user checks
|
// Muted user checks
|
||||||
if(channel == Chat.ChatChannel.Dm)
|
if(channel == Chat.ChatChannel.Dm)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue