Add %% command."

This commit is contained in:
Li 2022-05-08 16:25:53 +12:00
parent 9c97cdccb4
commit f14355bae8
5 changed files with 36 additions and 13 deletions

View file

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
systemctl stop HISP systemctl stop HISP
systemctl disable HISP systemctl disable HISP
userdel horseisle

View file

@ -42,8 +42,9 @@ namespace HISP.Game.Chat
new CommandRegister('%', "MODHORSE", Command.ModHorse); new CommandRegister('%', "MODHORSE", Command.ModHorse);
new CommandRegister('%', "DELITEM", Command.DelItem); new CommandRegister('%', "DELITEM", Command.DelItem);
new CommandRegister('%', "SHUTDOWN", Command.Shutdown); new CommandRegister('%', "SHUTDOWN", Command.Shutdown);
new CommandRegister('%', "RELOAD", Command.Reload);
new CommandRegister('%', "CALL", Command.CallHorse); new CommandRegister('%', "CALL", Command.CallHorse);
new CommandRegister('%', "MESSAGE", Command.Message);
new CommandRegister('%', "%", Command.Message);
// Moderator commands // Moderator commands
new CommandRegister('%', "RULES", Command.Rules); new CommandRegister('%', "RULES", Command.Rules);
@ -64,14 +65,25 @@ namespace HISP.Game.Chat
new CommandRegister('!', "VERSION", Command.Version); new CommandRegister('!', "VERSION", Command.Version);
} }
public static bool Reload(string message, string[] args, User user) public static bool Message(string message, string[] args, User user)
{ {
if (!user.Administrator) if (!user.Administrator)
return false; return false;
string serverAnnoucement = String.Join(" ", args);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatLeftPacket = PacketBuilder.CreateChat(Messages.FormatServerAnnoucement(serverAnnoucement), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket); byte[] chatRightPacket = PacketBuilder.CreateChat(Messages.FormatServerAnnoucement(serverAnnoucement), PacketBuilder.CHAT_BOTTOM_LEFT);
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
{
client.SendPacket(chatLeftPacket);
client.SendPacket(chatRightPacket);
}
}
return true; return true;
} }
public static bool Shutdown(string message, string[] args, User user) public static bool Shutdown(string message, string[] args, User user)
@ -303,12 +315,12 @@ namespace HISP.Game.Chat
public static bool Version(string message, string[] args, User user) public static bool Version(string message, string[] args, User user)
{ {
// Get current version and send to client // Get current version and send to client
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(versionPacket); user.LoggedinClient.SendPacket(versionPacket);
// Send Command complete message to client.
byte[] versionCommandCompletePacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(versionCommandCompletePacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Ban(string message, string[] args, User user) public static bool Ban(string message, string[] args, User user)
@ -774,7 +786,7 @@ namespace HISP.Game.Chat
return false; return false;
if (args.Length >= 1) if (args.Length >= 1)
if (args[1].ToUpper() != "HORSE") if (args[0].ToUpper() != "HORSE")
return false; return false;
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message); string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message);

View file

@ -656,6 +656,8 @@ namespace HISP.Game
public static string AdminChatFormatForSender; public static string AdminChatFormatForSender;
public static string ModChatFormatForSender; public static string ModChatFormatForSender;
public static string ServerAnnoucementFormat;
public static string DmModBadge; public static string DmModBadge;
public static string DmAutoResponse; public static string DmAutoResponse;
@ -2946,7 +2948,7 @@ namespace HISP.Game
{ {
return ModChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message); return ModChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
} }
// NOTE: i dont have the correct format for this, im just guessing
public static string FormatAdminChatMessage(string username, string message) public static string FormatAdminChatMessage(string username, string message)
{ {
return AdminChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message); return AdminChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
@ -3013,6 +3015,12 @@ namespace HISP.Game
return WelcomeFormat.Replace("%USERNAME%", username); return WelcomeFormat.Replace("%USERNAME%", username);
} }
// NOTE: i dont have the correct format for this, im just guessing
public static string FormatServerAnnoucement(string message)
{
return ServerAnnoucementFormat.Replace("%MESSAGE%", message);
}
// Transport // Transport
public static string FormatWelcomeToAreaMessage(string placeName) public static string FormatWelcomeToAreaMessage(string placeName)
{ {

View file

@ -1887,6 +1887,8 @@ namespace HISP.Server
Messages.AdsChatFormatForSender = gameData.messages.chat.for_sender.ads_format; Messages.AdsChatFormatForSender = gameData.messages.chat.for_sender.ads_format;
Messages.AdminChatFormatForSender = gameData.messages.chat.for_sender.admin_format; Messages.AdminChatFormatForSender = gameData.messages.chat.for_sender.admin_format;
Messages.ServerAnnoucementFormat = gameData.messages.chat.server_annoucement;
Messages.DmModBadge = gameData.messages.chat.dm_moderator; Messages.DmModBadge = gameData.messages.chat.dm_moderator;
Messages.DmAutoResponse = gameData.messages.chat.dm_autoreply; Messages.DmAutoResponse = gameData.messages.chat.dm_autoreply;

View file

@ -72,7 +72,7 @@ namespace HISP.Server
} }
public static string GetBuildString() public static string GetBuildString()
{ {
return PRODUCT + " " + GetVersionString() + " " + GetBranch() + "@" + GetCommitHash(4) + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime(); return PRODUCT + " " + GetVersionString() + " " + GetBranch() + "@" + GetCommitHash(6) + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime();
} }
} }
} }