mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-22 20:55:52 +12:00
Implement Mute Function.
This commit is contained in:
parent
b15e6996fe
commit
5308b53c89
9 changed files with 302 additions and 55 deletions
|
@ -55,19 +55,19 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if (message[0] == '%')
|
||||
{
|
||||
if (message.StartsWith("%GIVE"))
|
||||
if (message.ToUpper().StartsWith("%GIVE"))
|
||||
return Command.Give(message, args, user);
|
||||
if (message.StartsWith("%GOTO"))
|
||||
if (message.ToUpper().StartsWith("%GOTO"))
|
||||
return Command.Goto(message, args, user);
|
||||
if (message.StartsWith("%KICK"))
|
||||
if (message.ToUpper().StartsWith("%KICK"))
|
||||
return Command.Kick(message, args, user);
|
||||
if (message.StartsWith("%NOCLIP"))
|
||||
if (message.ToUpper().StartsWith("%NOCLIP"))
|
||||
return Command.NoClip(message, args, user);
|
||||
if (message.StartsWith("%BAN"))
|
||||
if (message.ToUpper().StartsWith("%BAN"))
|
||||
return Command.Ban(message, args, user);
|
||||
if (message.StartsWith("%UNBAN"))
|
||||
if (message.ToUpper().StartsWith("%UNBAN"))
|
||||
return Command.UnBan(message, args, user);
|
||||
if (message.StartsWith("%ESCAPE"))
|
||||
if (message.ToUpper().StartsWith("%ESCAPE"))
|
||||
return Command.Escape(message, args, user);
|
||||
return false;
|
||||
}
|
||||
|
@ -75,33 +75,90 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
if (message[0] == '!')
|
||||
{
|
||||
|
||||
// Alias for !MUTE
|
||||
if (message.StartsWith("!MUTEALL"))
|
||||
if (message.ToUpper().StartsWith("!MUTEALL"))
|
||||
return Command.Mute(message, new string[] { "ALL" }, user);
|
||||
else if (message.StartsWith("!MUTEADS"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEADS"))
|
||||
return Command.Mute(message, new string[] { "ADS" }, user);
|
||||
else if (message.StartsWith("!MUTEGLOBAL"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEGLOBAL"))
|
||||
return Command.Mute(message, new string[] { "GLOBAL" }, user);
|
||||
else if (message.StartsWith("!MUTEISLAND"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEISLAND"))
|
||||
return Command.Mute(message, new string[] { "ISLAND" }, user);
|
||||
else if (message.StartsWith("!MUTENEAR"))
|
||||
else if (message.ToUpper().StartsWith("!MUTENEAR"))
|
||||
return Command.Mute(message, new string[] { "NEAR" }, user);
|
||||
else if (message.StartsWith("!MUTEHERE"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEHERE"))
|
||||
return Command.Mute(message, new string[] { "HERE" }, user);
|
||||
else if (message.StartsWith("!MUTEBUDDY"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEBUDDY"))
|
||||
return Command.Mute(message, new string[] { "BUDDY" }, user);
|
||||
else if (message.StartsWith("!MUTEPM"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEPM"))
|
||||
return Command.Mute(message, new string[] { "PM" }, user);
|
||||
else if (message.StartsWith("!MUTEBR"))
|
||||
else if (message.ToUpper().StartsWith("!MUTEBR"))
|
||||
return Command.Mute(message, new string[] { "BR" }, user);
|
||||
else if (message.StartsWith("!MUTESOCIALS"))
|
||||
else if (message.ToUpper().StartsWith("!MUTESOCIALS"))
|
||||
return Command.Mute(message, new string[] { "SOCIALS" }, user);
|
||||
else if (message.StartsWith("!MUTELOGINS"))
|
||||
else if (message.ToUpper().StartsWith("!MUTELOGINS"))
|
||||
return Command.Mute(message, new string[] { "LOGINS" }, user);
|
||||
|
||||
else if (message.StartsWith("!MUTE"))
|
||||
|
||||
else if (message.ToUpper().StartsWith("!MUTE"))
|
||||
return Command.Mute(message, args, user);
|
||||
else if (message.StartsWith("!WARP"))
|
||||
|
||||
// Alias for !UNMUTE
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEALL"))
|
||||
return Command.UnMute(message, new string[] { "ALL" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEADS"))
|
||||
return Command.UnMute(message, new string[] { "ADS" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEGLOBAL"))
|
||||
return Command.UnMute(message, new string[] { "GLOBAL" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEISLAND"))
|
||||
return Command.UnMute(message, new string[] { "ISLAND" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTENEAR"))
|
||||
return Command.UnMute(message, new string[] { "NEAR" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEHERE"))
|
||||
return Command.UnMute(message, new string[] { "HERE" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEBUDDY"))
|
||||
return Command.UnMute(message, new string[] { "BUDDY" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEPM"))
|
||||
return Command.UnMute(message, new string[] { "PM" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTEBR"))
|
||||
return Command.UnMute(message, new string[] { "BR" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTESOCIALS"))
|
||||
return Command.UnMute(message, new string[] { "SOCIALS" }, user);
|
||||
else if (message.ToUpper().StartsWith("!UNMUTELOGINS"))
|
||||
return Command.UnMute(message, new string[] { "LOGINS" }, user);
|
||||
|
||||
else if (message.ToUpper().StartsWith("!UNMUTE"))
|
||||
return Command.UnMute(message, args, user);
|
||||
|
||||
// Alias for !HEAR
|
||||
else if (message.ToUpper().StartsWith("!HEARALL"))
|
||||
return Command.UnMute(message, new string[] { "ALL" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARADS"))
|
||||
return Command.UnMute(message, new string[] { "ADS" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARGLOBAL"))
|
||||
return Command.UnMute(message, new string[] { "GLOBAL" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARISLAND"))
|
||||
return Command.UnMute(message, new string[] { "ISLAND" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARNEAR"))
|
||||
return Command.UnMute(message, new string[] { "NEAR" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARHERE"))
|
||||
return Command.UnMute(message, new string[] { "HERE" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARBUDDY"))
|
||||
return Command.UnMute(message, new string[] { "BUDDY" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARPM"))
|
||||
return Command.UnMute(message, new string[] { "PM" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARBR"))
|
||||
return Command.UnMute(message, new string[] { "BR" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARSOCIALS"))
|
||||
return Command.UnMute(message, new string[] { "SOCIALS" }, user);
|
||||
else if (message.ToUpper().StartsWith("!HEARLOGINS"))
|
||||
return Command.UnMute(message, new string[] { "LOGINS" }, user);
|
||||
|
||||
else if (message.ToUpper().StartsWith("!HEAR"))
|
||||
return Command.UnMute(message, args, user);
|
||||
|
||||
else if (message.ToUpper().StartsWith("!WARP"))
|
||||
return Command.Warp(message, args, user);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
if(args[0] == "OBJECT")
|
||||
if(args[0].ToUpper() == "OBJECT")
|
||||
{
|
||||
int itemId = 0;
|
||||
try
|
||||
|
@ -31,7 +31,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (args[0] == "MONEY")
|
||||
else if (args[0].ToUpper() == "MONEY")
|
||||
{
|
||||
int money = 0;
|
||||
try
|
||||
|
@ -44,7 +44,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (args[0] == "QUEST")
|
||||
else if (args[0].ToUpper() == "QUEST")
|
||||
{
|
||||
int questId = 0;
|
||||
try
|
||||
|
@ -52,7 +52,7 @@ namespace HISP.Game.Chat
|
|||
questId = int.Parse(args[1]);
|
||||
if(args.Length >= 3)
|
||||
{
|
||||
if (args[2] == "FORCE")
|
||||
if (args[0].ToUpper() == "FORCE")
|
||||
{
|
||||
Quest.CompleteQuest(user, Quest.GetQuestById(questId));
|
||||
goto msg;
|
||||
|
@ -190,7 +190,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
if(args[0] == "PLAYER")
|
||||
if(args[0].ToUpper() == "PLAYER")
|
||||
{
|
||||
if(args.Length < 2)
|
||||
return false;
|
||||
|
@ -204,7 +204,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if(args[0] == "AREA")
|
||||
else if(args[0].ToUpper() == "AREA")
|
||||
{
|
||||
if (args.Length < 2)
|
||||
return false;
|
||||
|
@ -230,7 +230,7 @@ namespace HISP.Game.Chat
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if(args[0] == "NPC")
|
||||
else if(args[0].ToUpper() == "NPC")
|
||||
{
|
||||
if (args.Length < 2)
|
||||
return false;
|
||||
|
@ -362,38 +362,38 @@ namespace HISP.Game.Chat
|
|||
|
||||
string muteType = args[0];
|
||||
|
||||
if (muteType == "GLOBAL")
|
||||
if (muteType.ToUpper() == "GLOBAL")
|
||||
{
|
||||
user.MuteGlobal = true;
|
||||
} else if (muteType == "ISLAND")
|
||||
} else if (muteType.ToUpper() == "ISLAND")
|
||||
{
|
||||
user.MuteIsland = true;
|
||||
} else if (muteType == "NEAR")
|
||||
} else if (muteType.ToUpper() == "NEAR")
|
||||
{
|
||||
user.MuteNear = true;
|
||||
} else if (muteType == "HERE")
|
||||
} else if (muteType.ToUpper() == "HERE")
|
||||
{
|
||||
user.MuteHere = true;
|
||||
} else if (muteType == "BUDDY")
|
||||
} else if (muteType.ToUpper() == "BUDDY")
|
||||
{
|
||||
user.MuteBuddy = true;
|
||||
} else if (muteType == "SOCIALS")
|
||||
} else if (muteType.ToUpper() == "SOCIALS")
|
||||
{
|
||||
user.MuteSocials = true;
|
||||
}
|
||||
else if (muteType == "PM")
|
||||
else if (muteType.ToUpper() == "PM")
|
||||
{
|
||||
user.MutePrivateMessage = true;
|
||||
}
|
||||
else if (muteType == "BR")
|
||||
else if (muteType.ToUpper() == "BR")
|
||||
{
|
||||
user.MuteBuddyRequests = true;
|
||||
}
|
||||
else if (muteType == "LOGINS")
|
||||
else if (muteType.ToUpper() == "LOGINS")
|
||||
{
|
||||
user.MuteLogins = true;
|
||||
}
|
||||
else if (muteType == "ALL")
|
||||
else if (muteType.ToUpper() == "ALL")
|
||||
{
|
||||
user.MuteAll = true;
|
||||
user.MuteGlobal = true;
|
||||
|
@ -419,5 +419,80 @@ namespace HISP.Game.Chat
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool UnMute(string message, string[] args, User user)
|
||||
{
|
||||
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
||||
|
||||
if (args.Length <= 0)
|
||||
{
|
||||
formattedmessage += Messages.UnMuteHelp;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
string muteType = args[0];
|
||||
|
||||
if (muteType.ToUpper() == "GLOBAL")
|
||||
{
|
||||
user.MuteGlobal = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "ISLAND")
|
||||
{
|
||||
user.MuteIsland = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "NEAR")
|
||||
{
|
||||
user.MuteNear = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "HERE")
|
||||
{
|
||||
user.MuteHere = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "BUDDY")
|
||||
{
|
||||
user.MuteBuddy = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "SOCIALS")
|
||||
{
|
||||
user.MuteSocials = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "PM")
|
||||
{
|
||||
user.MutePrivateMessage = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "BR")
|
||||
{
|
||||
user.MuteBuddyRequests = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "LOGINS")
|
||||
{
|
||||
user.MuteLogins = false;
|
||||
}
|
||||
else if (muteType.ToUpper() == "ALL")
|
||||
{
|
||||
user.MuteAll = false;
|
||||
user.MuteGlobal = false;
|
||||
user.MuteIsland = false;
|
||||
user.MuteNear = false;
|
||||
user.MuteHere = false;
|
||||
user.MuteBuddy = false;
|
||||
user.MuteSocials = false;
|
||||
user.MutePrivateMessage = false;
|
||||
user.MuteBuddyRequests = false;
|
||||
user.MuteLogins = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
formattedmessage += Messages.UnMuteHelp;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
leave:;
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue