add help text"

This commit is contained in:
Li 2022-05-08 16:55:40 +12:00
parent f14355bae8
commit 02d32f46a8
2 changed files with 35 additions and 38 deletions

View file

@ -33,36 +33,35 @@ namespace HISP.Game.Chat
public static void RegisterCommands() public static void RegisterCommands()
{ {
// Admin Commands // Admin Commands
new CommandRegister('%', "GIVE", Command.Give); new CommandRegister('%', "GIVE", "OBJECT <itemid / RANDOM> [username / ALL]\nMONEY <amount> [username]\nHORSE <breedid> [username]\nQUEST <questid> [FORCE]\nAWARD <awardid> [username]", Command.Give);
new CommandRegister('%', "SWF", Command.Swf); new CommandRegister('%', "SWF", "<swf> [username / ALL]", Command.Swf);
new CommandRegister('%', "GOTO", Command.Goto); new CommandRegister('%', "GOTO", "<x>,<y>\nPLAYER <playername>\nAREA <locationname>\nNPC <npcname>", Command.Goto);
new CommandRegister('%', "JUMP", Command.Jump); new CommandRegister('%', "JUMP", "<username> HERE", Command.Jump);
new CommandRegister('%', "KICK", Command.Kick); new CommandRegister('%', "KICK" , "<username> [reason]", Command.Kick);
new CommandRegister('%', "NOCLIP", Command.NoClip); new CommandRegister('%', "NOCLIP", "", Command.NoClip);
new CommandRegister('%', "MODHORSE", Command.ModHorse); new CommandRegister('%', "MODHORSE", "<slot id> <stat> <value>", Command.ModHorse);
new CommandRegister('%', "DELITEM", Command.DelItem); new CommandRegister('%', "DELITEM", "<item id> [username]", Command.DelItem);
new CommandRegister('%', "SHUTDOWN", Command.Shutdown); new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown);
new CommandRegister('%', "CALL", Command.CallHorse); new CommandRegister('%', "CALL", "HORSE", Command.CallHorse);
new CommandRegister('%', "MESSAGE", Command.Message); new CommandRegister('%', "MESSAGE", "<message>", Command.Message);
new CommandRegister('%', "%", Command.Message);
// Moderator commands // Moderator commands
new CommandRegister('%', "RULES", Command.Rules); new CommandRegister('%', "RULES", "<username>", Command.Rules);
new CommandRegister('%', "PRISON", Command.Prison); new CommandRegister('%', "PRISON", "<username>", Command.Prison);
new CommandRegister('%', "STEALTH", Command.Stealth); new CommandRegister('%', "STEALTH", "", Command.Stealth);
new CommandRegister('%', "BAN", Command.Ban); new CommandRegister('%', "BAN", "<username> [reason]", Command.Ban);
new CommandRegister('%', "UNBAN", Command.UnBan); new CommandRegister('%', "UNBAN", "<username>", Command.UnBan);
new CommandRegister('%', "ESCAPE", Command.Escape); new CommandRegister('%', "ESCAPE", "", Command.Escape);
// User commands // User commands
new CommandRegister('!', "MUTE", Command.Mute); new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.Mute);
new CommandRegister('!', "UNMUTE", Command.UnMute); new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.UnMute);
new CommandRegister('!', "HEAR", Command.UnMute); new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.UnMute);
new CommandRegister('!', "AUTOREPLY", Command.AutoReply); new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply);
new CommandRegister('!', "QUIZ", Command.Quiz); new CommandRegister('!', "QUIZ", "", Command.Quiz);
new CommandRegister('!', "WARP", Command.Warp); new CommandRegister('!', "WARP", "<username / location>", Command.Warp);
new CommandRegister('!', "DANCE", Command.Dance); new CommandRegister('!', "DANCE", "<udlr>", Command.Dance);
new CommandRegister('!', "VERSION", Command.Version); new CommandRegister('!', "VERSION", "", Command.Version);
} }
public static bool Message(string message, string[] args, User user) public static bool Message(string message, string[] args, User user)
@ -252,7 +251,7 @@ namespace HISP.Game.Chat
public static bool Swf(string message, string[] args, User user) public static bool Swf(string message, string[] args, User user)
{ {
if (args.Length <= 2) if (args.Length <= 0)
return false; return false;
if (!user.Administrator && !user.Moderator) if (!user.Administrator && !user.Moderator)
@ -261,7 +260,10 @@ namespace HISP.Game.Chat
try try
{ {
string swfName = args[0]; string swfName = args[0];
string swfUser = args[1]; string swfUser = user.Username;
if (args.Length <= 2)
swfUser = args[1];
byte[] packetBytes = PacketBuilder.CreateSwfModulePacket(swfName, PacketBuilder.PACKET_SWF_MODULE_FORCE); byte[] packetBytes = PacketBuilder.CreateSwfModulePacket(swfName, PacketBuilder.PACKET_SWF_MODULE_FORCE);
if (swfUser.ToUpper() == "ALL") if (swfUser.ToUpper() == "ALL")
{ {
@ -273,7 +275,7 @@ namespace HISP.Game.Chat
} }
else else
{ {
User player = findNamePartial(args[1]); User player = findNamePartial(swfUser);
player.LoggedinClient.SendPacket(packetBytes); player.LoggedinClient.SendPacket(packetBytes);
} }
} }
@ -318,7 +320,6 @@ namespace HISP.Game.Chat
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(versionPacket); user.LoggedinClient.SendPacket(versionPacket);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
@ -476,15 +477,11 @@ namespace HISP.Game.Chat
public static bool Jump(string message, string[] args, User user) public static bool Jump(string message, string[] args, User user)
{ {
if (args.Length <= 0) if (args.Length <= 2)
return false; return false;
if (!user.Administrator) if (!user.Administrator)
return false; return false;
if(args.Length < 2)
{
return false;
}
try try
{ {
@ -952,10 +949,8 @@ namespace HISP.Game.Chat
else else
{ {
formattedmessage += Messages.MuteHelp; formattedmessage += Messages.MuteHelp;
goto leave;
} }
leave:;
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);

View file

@ -18,12 +18,14 @@ namespace HISP.Game.Chat
public char CmdLetter; public char CmdLetter;
public string CmdName; public string CmdName;
public string CmdUsage;
public Func<string,string[],User, bool> CmdCallback; public Func<string,string[],User, bool> CmdCallback;
public CommandRegister(char cmdLetter, string cmdName, Func<string, string[], User, bool> cmdCallback) public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func<string, string[], User, bool> cmdCallback)
{ {
CmdLetter = cmdLetter; CmdLetter = cmdLetter;
CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture); CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture);
CmdCallback = cmdCallback; CmdCallback = cmdCallback;
CmdUsage = cmdUsage;
registeredComamnds.Add(this); registeredComamnds.Add(this);
} }