mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 12:19:15 +12:00
Add %BAN
This commit is contained in:
parent
9f44620fd7
commit
49522e9fef
8 changed files with 165 additions and 6 deletions
|
@ -64,6 +64,8 @@ namespace HISP.Game.Chat
|
|||
return Command.Kick(message, args, user);
|
||||
if (message.StartsWith("%NOCLIP"))
|
||||
return Command.NoClip(message, args, user);
|
||||
if (message.StartsWith("%BAN"))
|
||||
return Command.Ban(message, args, user);
|
||||
return false;
|
||||
}
|
||||
if (message[0] == '!')
|
||||
|
|
|
@ -62,6 +62,34 @@ namespace HISP.Game.Chat
|
|||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
public static bool Ban(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
if(!user.Administrator || !user.Moderator)
|
||||
return false;
|
||||
try{
|
||||
string userName = args[0];
|
||||
int id = Database.GetUserid(userName);
|
||||
string ip = Database.GetIpAddress(id);
|
||||
string reason = "NONE SPECIFIED";
|
||||
if (args.Length >= 2)
|
||||
{
|
||||
reason = string.Join(" ", args, 1, args.Length - 1);
|
||||
}
|
||||
|
||||
Database.BanUser(id, ip, reason);
|
||||
User bannedUser = GameServer.GetUserByName(args[0]);
|
||||
bannedUser.LoggedinClient.Kick(Messages.KickReasonBanned);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Stickbug(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 0)
|
||||
|
|
|
@ -523,6 +523,10 @@ namespace HISP.Game
|
|||
public static string FountainDrankYourFull;
|
||||
public static string FountainDroppedMoneyFormat;
|
||||
|
||||
// Login Fail messages
|
||||
public static string LoginFailedReasonBanned;
|
||||
public static string LoginFailedReasonBannedIpFormat;
|
||||
|
||||
// Disconnect Messages
|
||||
public static string KickReasonBanned;
|
||||
public static string KickReasonKicked;
|
||||
|
@ -537,7 +541,10 @@ namespace HISP.Game
|
|||
|
||||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatIpBannedMessage(string Ip)
|
||||
{
|
||||
return LoginFailedReasonBannedIpFormat.Replace("%IP%", Ip);
|
||||
}
|
||||
public static string FormatAwardEntry(int iconId, string awardName, int bonusMoney, string description)
|
||||
{
|
||||
return AwardEntryFormat.Replace("%ICONID%", iconId.ToString()).Replace("%AWARDNAME%", awardName).Replace("%BONUSMONEY%",bonusMoney.ToString("N0")).Replace("%DESCRIPTION%",description);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue