mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 21:25:42 +12:00
Fix crashing when PO w full inventory
This commit is contained in:
parent
62f6cd0bfb
commit
fa0cdf4b7a
3 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue