mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +12:00
Add %GOTO and %NOCLIP
This commit is contained in:
parent
9881f8d2e2
commit
eb025b177a
4 changed files with 52 additions and 19 deletions
|
@ -60,6 +60,8 @@ namespace HISP.Game.Chat
|
||||||
return Command.Give(message, args, user);
|
return Command.Give(message, args, user);
|
||||||
if (message.StartsWith("%GOTO"))
|
if (message.StartsWith("%GOTO"))
|
||||||
return Command.Goto(message, args, user);
|
return Command.Goto(message, args, user);
|
||||||
|
if (message.StartsWith("%NOCLIP"))
|
||||||
|
return Command.NoClip(message, args, user);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (message[0] == '!')
|
if (message[0] == '!')
|
||||||
|
|
|
@ -100,22 +100,52 @@ namespace HISP.Game.Chat
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool NoClip(string message, string[] args, User user)
|
||||||
|
{
|
||||||
|
if (!user.Administrator)
|
||||||
|
return false;
|
||||||
|
user.NoClip = !user.NoClip;
|
||||||
|
|
||||||
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||||
|
user.LoggedinClient.SendPacket(chatPacket);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool Goto(string message, string[] args, User user)
|
public static bool Goto(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
return false;
|
return false;
|
||||||
if (!user.Administrator)
|
if (!user.Administrator)
|
||||||
return false;
|
return false;
|
||||||
|
if(args[0] == "PLAYER")
|
||||||
|
{
|
||||||
|
if(args.Length <= 1)
|
||||||
|
return false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
User teleportTo = GameServer.GetUserByName(args[1]);
|
||||||
|
user.Teleport(teleportTo.X, teleportTo.Y);
|
||||||
|
}
|
||||||
|
catch (KeyNotFoundException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(args[0].Contains(","))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string[] xy = args[0].Split(',');
|
||||||
|
int x = int.Parse(xy[0]);
|
||||||
|
int y = int.Parse(xy[1]);
|
||||||
|
user.Teleport(x, y);
|
||||||
|
}
|
||||||
|
catch(FormatException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
User teleportTo = GameServer.GetUserByName(args[0]);
|
|
||||||
user.Teleport(teleportTo.X, teleportTo.Y);
|
|
||||||
}
|
|
||||||
catch (KeyNotFoundException)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace HISP.Player
|
||||||
public bool MuteSocials = false;
|
public bool MuteSocials = false;
|
||||||
public bool MuteAll = false;
|
public bool MuteAll = false;
|
||||||
public bool MuteLogins = false;
|
public bool MuteLogins = false;
|
||||||
|
public bool NoClip = false;
|
||||||
public string Gender;
|
public string Gender;
|
||||||
public bool MetaPriority = false;
|
public bool MetaPriority = false;
|
||||||
|
|
||||||
|
|
|
@ -2080,7 +2080,7 @@ namespace HISP.Server
|
||||||
if (tile.ExitY != 0)
|
if (tile.ExitY != 0)
|
||||||
newY = tile.ExitY;
|
newY = tile.ExitY;
|
||||||
else
|
else
|
||||||
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y + 1))
|
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y + 1) || loggedInUser.NoClip)
|
||||||
newY += 1;
|
newY += 1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2103,7 +2103,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y + 1))
|
if (Map.CheckPassable(loggedInUser.X, loggedInUser.Y + 1) || loggedInUser.NoClip)
|
||||||
loggedInUser.Y += 1;
|
loggedInUser.Y += 1;
|
||||||
|
|
||||||
Direction = PacketBuilder.DIRECTION_DOWN;
|
Direction = PacketBuilder.DIRECTION_DOWN;
|
||||||
|
@ -2121,12 +2121,12 @@ namespace HISP.Server
|
||||||
if (movementDirection == PacketBuilder.MOVE_UP)
|
if (movementDirection == PacketBuilder.MOVE_UP)
|
||||||
{
|
{
|
||||||
direction = PacketBuilder.DIRECTION_UP;
|
direction = PacketBuilder.DIRECTION_UP;
|
||||||
if (Map.CheckPassable(newX, newY - 1))
|
if (Map.CheckPassable(newX, newY - 1) || loggedInUser.NoClip)
|
||||||
newY -= 1;
|
newY -= 1;
|
||||||
|
|
||||||
|
|
||||||
if (loggedInUser.Facing == (direction + (onHorse * 5))&& onHorse != 0) // Double move
|
if (loggedInUser.Facing == (direction + (onHorse * 5))&& onHorse != 0) // Double move
|
||||||
if (Map.CheckPassable(newX, newY - 1))
|
if (Map.CheckPassable(newX, newY - 1) || loggedInUser.NoClip)
|
||||||
{
|
{
|
||||||
newY -= 1;
|
newY -= 1;
|
||||||
moveTwo = true;
|
moveTwo = true;
|
||||||
|
@ -2135,12 +2135,12 @@ namespace HISP.Server
|
||||||
else if (movementDirection == PacketBuilder.MOVE_LEFT)
|
else if (movementDirection == PacketBuilder.MOVE_LEFT)
|
||||||
{
|
{
|
||||||
direction = PacketBuilder.DIRECTION_LEFT;
|
direction = PacketBuilder.DIRECTION_LEFT;
|
||||||
if (Map.CheckPassable(newX - 1, newY))
|
if (Map.CheckPassable(newX - 1, newY) || loggedInUser.NoClip)
|
||||||
newX -= 1;
|
newX -= 1;
|
||||||
|
|
||||||
|
|
||||||
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
||||||
if (Map.CheckPassable(newX - 1, newY))
|
if (Map.CheckPassable(newX - 1, newY) || loggedInUser.NoClip)
|
||||||
{
|
{
|
||||||
newX -= 1;
|
newX -= 1;
|
||||||
moveTwo = true;
|
moveTwo = true;
|
||||||
|
@ -2149,12 +2149,12 @@ namespace HISP.Server
|
||||||
else if (movementDirection == PacketBuilder.MOVE_RIGHT)
|
else if (movementDirection == PacketBuilder.MOVE_RIGHT)
|
||||||
{
|
{
|
||||||
direction = PacketBuilder.DIRECTION_RIGHT;
|
direction = PacketBuilder.DIRECTION_RIGHT;
|
||||||
if (Map.CheckPassable(newX + 1, newY))
|
if (Map.CheckPassable(newX + 1, newY) || loggedInUser.NoClip)
|
||||||
newX += 1;
|
newX += 1;
|
||||||
|
|
||||||
|
|
||||||
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
||||||
if (Map.CheckPassable(newX + 1, newY))
|
if (Map.CheckPassable(newX + 1, newY) || loggedInUser.NoClip)
|
||||||
{
|
{
|
||||||
newX += 1;
|
newX += 1;
|
||||||
moveTwo = true;
|
moveTwo = true;
|
||||||
|
@ -2163,12 +2163,12 @@ namespace HISP.Server
|
||||||
else if (movementDirection == PacketBuilder.MOVE_DOWN)
|
else if (movementDirection == PacketBuilder.MOVE_DOWN)
|
||||||
{
|
{
|
||||||
direction = PacketBuilder.DIRECTION_DOWN;
|
direction = PacketBuilder.DIRECTION_DOWN;
|
||||||
if (Map.CheckPassable(newX, newY + 1))
|
if (Map.CheckPassable(newX, newY + 1) || loggedInUser.NoClip)
|
||||||
newY += 1;
|
newY += 1;
|
||||||
|
|
||||||
|
|
||||||
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
if (loggedInUser.Facing == (direction + (onHorse * 5)) && onHorse != 0) // Double move
|
||||||
if (Map.CheckPassable(newX, newY + 1))
|
if (Map.CheckPassable(newX, newY + 1) || loggedInUser.NoClip)
|
||||||
{
|
{
|
||||||
newY += 1;
|
newY += 1;
|
||||||
moveTwo = true;
|
moveTwo = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue