Fix crashing when PO w full inventory

This commit is contained in:
Bluzume 2021-11-05 02:56:08 -04:00
parent 62f6cd0bfb
commit fa0cdf4b7a
3 changed files with 4 additions and 4 deletions

View file

@ -41,9 +41,9 @@ namespace HISP.Game.Inventory
}
}
}
public void AddHorse(HorseInstance horse, bool addToDb=true)
public void AddHorse(HorseInstance horse, bool addToDb=true, bool ignoreFull=false)
{
if (HorseList.Length + 1 > baseUser.MaxHorses)
if (HorseList.Length + 1 > baseUser.MaxHorses && !ignoreFull)
throw new InventoryFullException();
horse.Owner = baseUser.Id;

View file

@ -2702,7 +2702,7 @@ namespace HISP.Game
private static string buildPawneer(User user)
{
string message = "";
if (user.Inventory.HasItemId(Item.PawneerOrder))
if (user.Inventory.HasItemId(Item.PawneerOrder) && (user.HorseInventory.HorseList.Length < user.MaxHorses))
message += Messages.PawneerOrderMeta;
message += Messages.PawneerUntackedHorsesICanBuy;
foreach(HorseInstance horse in user.HorseInventory.HorseList.OrderBy(o => o.Name).ToList())

View file

@ -3331,7 +3331,7 @@ namespace HISP.Server
horseInstance.Name = "Pawneer Order";
sender.LoggedinUser.Inventory.Remove(sender.LoggedinUser.Inventory.GetItemByItemId(Item.PawneerOrder).ItemInstances[0]);
sender.LoggedinUser.HorseInventory.AddHorse(horseInstance);
sender.LoggedinUser.HorseInventory.AddHorse(horseInstance, true, true);
sender.LoggedinUser.MetaPriority = true;
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPawneerOrderFound(horseInstance));