mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-12 07:59:48 +12:00
fix bugs with comands and player on map
This commit is contained in:
parent
16b3ddfc7f
commit
37d2f2b031
2 changed files with 26 additions and 13 deletions
|
@ -140,7 +140,7 @@ namespace HISP.Game.Chat
|
||||||
{
|
{
|
||||||
if(args.Length <= 0)
|
if(args.Length <= 0)
|
||||||
return false;
|
return false;
|
||||||
if(!user.Administrator || !user.Moderator)
|
if(!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
@ -164,7 +164,7 @@ namespace HISP.Game.Chat
|
||||||
{
|
{
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
return false;
|
return false;
|
||||||
if(!user.Administrator || !user.Moderator)
|
if (!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
try{
|
try{
|
||||||
string userName = args[0];
|
string userName = args[0];
|
||||||
|
@ -196,7 +196,7 @@ namespace HISP.Game.Chat
|
||||||
}
|
}
|
||||||
public static bool Escape(string message, string[] args, User user)
|
public static bool Escape(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (!user.Administrator || !user.Moderator)
|
if (!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ namespace HISP.Game.Chat
|
||||||
|
|
||||||
public static bool Stealth(string message, string[] args, User user)
|
public static bool Stealth(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (!user.Administrator || !user.Moderator)
|
if (!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
user.Stealth = !user.Stealth;
|
user.Stealth = !user.Stealth;
|
||||||
|
@ -230,7 +230,7 @@ namespace HISP.Game.Chat
|
||||||
|
|
||||||
public static bool Rules(string message, string[] args, User user)
|
public static bool Rules(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (!user.Administrator || !user.Moderator)
|
if (!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -255,7 +255,7 @@ namespace HISP.Game.Chat
|
||||||
|
|
||||||
public static bool Kick(string message, string[] args, User user)
|
public static bool Kick(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (!user.Administrator || !user.Moderator)
|
if (!(user.Administrator || user.Moderator))
|
||||||
return false;
|
return false;
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3680,14 +3680,20 @@ namespace HISP.Server
|
||||||
|
|
||||||
|
|
||||||
// Tell other clients you exist
|
// Tell other clients you exist
|
||||||
byte[] YourPlayerInfo = PacketBuilder.CreatePlayerInfoUpdateOrCreate(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.Facing, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Username);
|
|
||||||
|
byte[] yourPlayerInfo = PacketBuilder.CreatePlayerInfoUpdateOrCreate(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.Facing, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Username);
|
||||||
|
byte[] yourPlayerInfoOffscreen = PacketBuilder.CreatePlayerInfoUpdateOrCreate(1000 + 4, 1000 + 1, sender.LoggedinUser.Facing, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Username);
|
||||||
|
|
||||||
foreach (GameClient client in ConnectedClients)
|
foreach (GameClient client in ConnectedClients)
|
||||||
{
|
{
|
||||||
if (client.LoggedIn)
|
if (client.LoggedIn)
|
||||||
{
|
{
|
||||||
if (client.LoggedinUser.Id != sender.LoggedinUser.Id)
|
if (client.LoggedinUser.Id != sender.LoggedinUser.Id)
|
||||||
{
|
{
|
||||||
client.SendPacket(YourPlayerInfo);
|
if (IsOnScreen(sender.LoggedinUser.X, sender.LoggedinUser.Y, client.LoggedinUser.X, client.LoggedinUser.Y))
|
||||||
|
client.SendPacket(yourPlayerInfo);
|
||||||
|
else
|
||||||
|
client.SendPacket(yourPlayerInfoOffscreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7506,12 +7512,19 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static bool IsOnScreen(int screenX, int screenY, int playerX, int playerY)
|
||||||
|
{
|
||||||
|
int startX = screenX - 9;
|
||||||
|
int endX = screenX + 9;
|
||||||
|
int startY = screenY - 8;
|
||||||
|
int endY = screenY + 9;
|
||||||
|
if (startX <= playerX && endX >= playerX && startY <= playerY && endY >= playerY)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public static User[] GetOnScreenUsers(int x, int y, bool includeStealth = false, bool includeMuted = false)
|
public static User[] GetOnScreenUsers(int x, int y, bool includeStealth = false, bool includeMuted = false)
|
||||||
{
|
{
|
||||||
int startX = x - 9;
|
|
||||||
int endX = x + 9;
|
|
||||||
int startY = y - 8;
|
|
||||||
int endY = y + 9;
|
|
||||||
|
|
||||||
List<User> usersOnScreen = new List<User>();
|
List<User> usersOnScreen = new List<User>();
|
||||||
|
|
||||||
|
@ -7522,7 +7535,7 @@ namespace HISP.Server
|
||||||
continue;
|
continue;
|
||||||
if (!includeMuted && client.LoggedinUser.MuteNear)
|
if (!includeMuted && client.LoggedinUser.MuteNear)
|
||||||
continue;
|
continue;
|
||||||
if (startX <= client.LoggedinUser.X && endX >= client.LoggedinUser.X && startY <= client.LoggedinUser.Y && endY >= client.LoggedinUser.Y)
|
if (IsOnScreen(x,y,client.LoggedinUser.X, client.LoggedinUser.Y))
|
||||||
usersOnScreen.Add(client.LoggedinUser);
|
usersOnScreen.Add(client.LoggedinUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue