Add the most important command and feature in the entire game,

This commit is contained in:
SilicaAndPina 2021-03-31 01:26:55 +13:00
parent b8242010ad
commit 5cac72f67a
4 changed files with 117 additions and 16 deletions

View file

@ -305,19 +305,21 @@ namespace HISP.Game.Chat
formattedmessage += Messages.FailedToUnderstandLocation;
goto sendText;
doCommand:;
if (args.Length <= 0)
{
goto cantUnderstandCommand;
}
else
{
string areaName = string.Join(" ", args).ToLower();
foreach (GameClient client in GameServer.ConnectedClients)
{
if (client.LoggedIn)
{
if(client.LoggedinUser.Username.ToLower().Contains(args[0].ToLower()))
if(client.LoggedinUser.Username.ToLower().Contains(areaName))
{
user.Teleport(client.LoggedinUser.X, client.LoggedinUser.Y);
formattedmessage += Messages.SuccessfullyWarpedToPlayer;
@ -328,7 +330,7 @@ namespace HISP.Game.Chat
foreach(World.Waypoint waypoint in World.Waypoints)
{
if(waypoint.Name.ToLower().Contains(args[0].ToLower()))
if(waypoint.Name.ToLower().Contains(areaName))
{
user.Teleport(waypoint.PosX, waypoint.PosY);
formattedmessage += Messages.SuccessfullyWarpedToLocation;
@ -350,6 +352,18 @@ namespace HISP.Game.Chat
return true;
}
public static bool Dance(string message, string[] args, User user)
{
string moves = string.Join(" ", args).ToLower();
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
new Dance(user, moves);
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
public static bool Mute(string message, string[] args, User user)
{
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));