mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 12:19:15 +12:00
Add !WARP
This commit is contained in:
parent
0222475f09
commit
b4c4a6c137
6 changed files with 90 additions and 3 deletions
|
@ -102,6 +102,9 @@ namespace HISP.Game.Chat
|
|||
|
||||
else if (message.StartsWith("!MUTE"))
|
||||
return Command.Mute(message, args, user);
|
||||
else if (message.StartsWith("!WARP"))
|
||||
return Command.Warp(message, args, user);
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,6 @@ namespace HISP.Game.Chat
|
|||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Goto(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 0)
|
||||
|
@ -320,6 +319,73 @@ namespace HISP.Game.Chat
|
|||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
public static bool Warp(string message, string[] args, User user)
|
||||
{
|
||||
|
||||
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
||||
|
||||
if (user.CurrentlyRidingHorse == null)
|
||||
goto onlyRiddenUnicorn;
|
||||
|
||||
if (user.CurrentlyRidingHorse.Breed.Type == "unicorn")
|
||||
goto doCommand;
|
||||
|
||||
goto onlyRiddenUnicorn;
|
||||
|
||||
onlyRiddenUnicorn:;
|
||||
formattedmessage = Messages.OnlyUnicornCanWarp;
|
||||
goto sendText;
|
||||
|
||||
|
||||
cantUnderstandCommand:;
|
||||
formattedmessage += Messages.FailedToUnderstandLocation;
|
||||
goto sendText;
|
||||
|
||||
|
||||
doCommand:;
|
||||
if (args.Length <= 0)
|
||||
{
|
||||
goto cantUnderstandCommand;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (GameClient client in GameServer.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
{
|
||||
if(client.LoggedinUser.Username.ToLower().Contains(args[0].ToLower()))
|
||||
{
|
||||
user.Teleport(client.LoggedinUser.X, client.LoggedinUser.Y);
|
||||
formattedmessage += Messages.SuccessfullyWarpedToPlayer;
|
||||
goto playSwf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(World.Waypoint waypoint in World.Waypoints)
|
||||
{
|
||||
if(waypoint.Name.ToLower().Contains(args[0].ToLower()))
|
||||
{
|
||||
user.Teleport(waypoint.PosX, waypoint.PosY);
|
||||
formattedmessage += Messages.SuccessfullyWarpedToLocation;
|
||||
goto playSwf;
|
||||
}
|
||||
}
|
||||
|
||||
goto cantUnderstandCommand;
|
||||
}
|
||||
|
||||
playSwf:;
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModulePacket("warpcutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
user.LoggedinClient.SendPacket(swfPacket);
|
||||
|
||||
|
||||
sendText:;
|
||||
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)
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace HISP.Game.Horse
|
|||
Color = breed.Colors[GameServer.RandomNumberGenerator.Next(0, breed.Colors.Length)];
|
||||
|
||||
BasicStats = new HorseInfo.BasicStats(this, 1000, 0, 1000, 1000, 500, 1000, 1000, 0);
|
||||
int inteligence = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Inteligence, breed.BaseStats.Inteligence * 2)) - breed.BaseStats.Inteligence;
|
||||
int personality = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Personality, breed.BaseStats.Personality * 2)) - breed.BaseStats.Personality;
|
||||
int inteligence = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Inteligence, (breed.BaseStats.Inteligence * 2)-1) - breed.BaseStats.Inteligence);
|
||||
int personality = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Personality, (breed.BaseStats.Personality * 2)-1) - breed.BaseStats.Personality);
|
||||
int height = GameServer.RandomNumberGenerator.Next(breed.BaseStats.MinHeight, breed.BaseStats.MaxHeight);
|
||||
AdvancedStats = new HorseInfo.AdvancedStats(this, 0, 0, 0, 0, inteligence, 0, personality, height);
|
||||
|
||||
|
|
|
@ -12,6 +12,11 @@ namespace HISP.Game
|
|||
|
||||
// Mod isle
|
||||
public static string ModIsleMessage;
|
||||
// Warp Command
|
||||
public static string SuccessfullyWarpedToLocation;
|
||||
public static string SuccessfullyWarpedToPlayer;
|
||||
public static string OnlyUnicornCanWarp;
|
||||
public static string FailedToUnderstandLocation;
|
||||
|
||||
// Click
|
||||
public static string PlayerHereFormat;
|
||||
|
@ -321,6 +326,7 @@ namespace HISP.Game
|
|||
|
||||
public static string AdminCommandFormat;
|
||||
public static string PlayerCommandFormat;
|
||||
|
||||
public static string MuteHelp;
|
||||
|
||||
public static string GlobalChatFormatForModerators;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue