Fix Arena TOCTOU

This commit is contained in:
SilicaAndPina 2021-05-12 22:14:22 +12:00
parent ab05db6cbf
commit 51223172c4
4 changed files with 35 additions and 11 deletions

View file

@ -69,6 +69,8 @@ namespace HISP.Game.Chat
return Command.UnBan(message, args, user);
if (message.ToUpper().StartsWith("%ESCAPE"))
return Command.Escape(message, args, user);
if (message.ToUpper().StartsWith("%CALL HORSE"))
return Command.CallHorse(message, args, user);
return false;
}

View file

@ -4,6 +4,7 @@ using HISP.Game.Items;
using System;
using System.Collections.Generic;
using HISP.Game.Events;
using HISP.Game.Horse;
namespace HISP.Game.Chat
{
@ -354,6 +355,23 @@ namespace HISP.Game.Chat
return true;
}
public static bool CallHorse(string message, string[] args, User user)
{
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
WildHorse horse = WildHorse.WildHorses[GameServer.RandomNumberGenerator.Next(0, WildHorse.WildHorses.Length)];
horse.X = user.X;
horse.Y = user.Y;
GameServer.UpdateAreaForAll(user.X, user.Y);
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
public static bool Dance(string message, string[] args, User user)
{
string moves = string.Join(" ", args).ToLower();