From 02d32f46a8b941ba3753701c68bd497b535c1197 Mon Sep 17 00:00:00 2001
From: Li
Date: Sun, 8 May 2022 16:55:40 +1200
Subject: [PATCH] add help text"
---
HorseIsleServer/LibHISP/Game/Chat/Command.cs | 69 +++++++++----------
.../LibHISP/Game/Chat/CommandRegister.cs | 4 +-
2 files changed, 35 insertions(+), 38 deletions(-)
diff --git a/HorseIsleServer/LibHISP/Game/Chat/Command.cs b/HorseIsleServer/LibHISP/Game/Chat/Command.cs
index 0073770..9591963 100644
--- a/HorseIsleServer/LibHISP/Game/Chat/Command.cs
+++ b/HorseIsleServer/LibHISP/Game/Chat/Command.cs
@@ -33,36 +33,35 @@ namespace HISP.Game.Chat
public static void RegisterCommands()
{
// Admin Commands
- new CommandRegister('%', "GIVE", Command.Give);
- new CommandRegister('%', "SWF", Command.Swf);
- new CommandRegister('%', "GOTO", Command.Goto);
- new CommandRegister('%', "JUMP", Command.Jump);
- new CommandRegister('%', "KICK", Command.Kick);
- new CommandRegister('%', "NOCLIP", Command.NoClip);
- new CommandRegister('%', "MODHORSE", Command.ModHorse);
- new CommandRegister('%', "DELITEM", Command.DelItem);
- new CommandRegister('%', "SHUTDOWN", Command.Shutdown);
- new CommandRegister('%', "CALL", Command.CallHorse);
- new CommandRegister('%', "MESSAGE", Command.Message);
- new CommandRegister('%', "%", Command.Message);
+ new CommandRegister('%', "GIVE", "OBJECT [username / ALL]\nMONEY [username]\nHORSE [username]\nQUEST [FORCE]\nAWARD [username]", Command.Give);
+ new CommandRegister('%', "SWF", " [username / ALL]", Command.Swf);
+ new CommandRegister('%', "GOTO", ",\nPLAYER \nAREA \nNPC ", Command.Goto);
+ new CommandRegister('%', "JUMP", " HERE", Command.Jump);
+ new CommandRegister('%', "KICK" , " [reason]", Command.Kick);
+ new CommandRegister('%', "NOCLIP", "", Command.NoClip);
+ new CommandRegister('%', "MODHORSE", " ", Command.ModHorse);
+ new CommandRegister('%', "DELITEM", "- [username]", Command.DelItem);
+ new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown);
+ new CommandRegister('%', "CALL", "HORSE", Command.CallHorse);
+ new CommandRegister('%', "MESSAGE", "", Command.Message);
// Moderator commands
- new CommandRegister('%', "RULES", Command.Rules);
- new CommandRegister('%', "PRISON", Command.Prison);
- new CommandRegister('%', "STEALTH", Command.Stealth);
- new CommandRegister('%', "BAN", Command.Ban);
- new CommandRegister('%', "UNBAN", Command.UnBan);
- new CommandRegister('%', "ESCAPE", Command.Escape);
+ new CommandRegister('%', "RULES", "", Command.Rules);
+ new CommandRegister('%', "PRISON", "", Command.Prison);
+ new CommandRegister('%', "STEALTH", "", Command.Stealth);
+ new CommandRegister('%', "BAN", " [reason]", Command.Ban);
+ new CommandRegister('%', "UNBAN", "", Command.UnBan);
+ new CommandRegister('%', "ESCAPE", "", Command.Escape);
// User commands
- new CommandRegister('!', "MUTE", Command.Mute);
- new CommandRegister('!', "UNMUTE", Command.UnMute);
- new CommandRegister('!', "HEAR", Command.UnMute);
- new CommandRegister('!', "AUTOREPLY", Command.AutoReply);
- new CommandRegister('!', "QUIZ", Command.Quiz);
- new CommandRegister('!', "WARP", Command.Warp);
- new CommandRegister('!', "DANCE", Command.Dance);
- new CommandRegister('!', "VERSION", Command.Version);
+ new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.Mute);
+ new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.UnMute);
+ new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS \nLOGINS ", Command.UnMute);
+ new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply);
+ new CommandRegister('!', "QUIZ", "", Command.Quiz);
+ new CommandRegister('!', "WARP", "", Command.Warp);
+ new CommandRegister('!', "DANCE", "", Command.Dance);
+ new CommandRegister('!', "VERSION", "", Command.Version);
}
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)
{
- if (args.Length <= 2)
+ if (args.Length <= 0)
return false;
if (!user.Administrator && !user.Moderator)
@@ -261,7 +260,10 @@ namespace HISP.Game.Chat
try
{
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);
if (swfUser.ToUpper() == "ALL")
{
@@ -273,7 +275,7 @@ namespace HISP.Game.Chat
}
else
{
- User player = findNamePartial(args[1]);
+ User player = findNamePartial(swfUser);
player.LoggedinClient.SendPacket(packetBytes);
}
}
@@ -318,7 +320,6 @@ namespace HISP.Game.Chat
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(versionPacket);
-
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
@@ -476,15 +477,11 @@ namespace HISP.Game.Chat
public static bool Jump(string message, string[] args, User user)
{
- if (args.Length <= 0)
+ if (args.Length <= 2)
return false;
if (!user.Administrator)
return false;
- if(args.Length < 2)
- {
- return false;
- }
try
{
@@ -952,10 +949,8 @@ namespace HISP.Game.Chat
else
{
formattedmessage += Messages.MuteHelp;
- goto leave;
}
- leave:;
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
diff --git a/HorseIsleServer/LibHISP/Game/Chat/CommandRegister.cs b/HorseIsleServer/LibHISP/Game/Chat/CommandRegister.cs
index bc5dabe..d92496f 100644
--- a/HorseIsleServer/LibHISP/Game/Chat/CommandRegister.cs
+++ b/HorseIsleServer/LibHISP/Game/Chat/CommandRegister.cs
@@ -18,12 +18,14 @@ namespace HISP.Game.Chat
public char CmdLetter;
public string CmdName;
+ public string CmdUsage;
public Func CmdCallback;
- public CommandRegister(char cmdLetter, string cmdName, Func cmdCallback)
+ public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func cmdCallback)
{
CmdLetter = cmdLetter;
CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture);
CmdCallback = cmdCallback;
+ CmdUsage = cmdUsage;
registeredComamnds.Add(this);
}