mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-19 19:29:15 +12:00
dont allow to go over max hroses
This commit is contained in:
parent
2947e7f1c7
commit
6d3abac89a
6 changed files with 27 additions and 5 deletions
|
@ -17,8 +17,18 @@ namespace HISP.Game.Inventory
|
|||
}
|
||||
}
|
||||
|
||||
public int MaxHorses
|
||||
{
|
||||
get
|
||||
{
|
||||
return 7; // will change when ranches are implemented.
|
||||
}
|
||||
}
|
||||
public void AddHorse(HorseInstance horse, bool addToDb=true)
|
||||
{
|
||||
if (HorseList.Length + 1 > MaxHorses)
|
||||
throw new InventoryFullException();
|
||||
|
||||
horse.Owner = baseUser.Id;
|
||||
if(addToDb)
|
||||
Database.AddHorse(horse);
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace HISP.Game
|
|||
public static string HorseCaptureTimer;
|
||||
public static string YouCapturedTheHorse;
|
||||
public static string HorseEvadedCapture;
|
||||
|
||||
public static string TooManyHorses;
|
||||
public static string HorsesMenuHeader;
|
||||
public static string UpdateHorseCategory;
|
||||
public static string HorseEntryFormat;
|
||||
|
|
|
@ -879,7 +879,7 @@ namespace HISP.Game
|
|||
public static string BuildHorseInventory(User user)
|
||||
{
|
||||
// TODO: calculate max number based on ranch barns owned.
|
||||
string message = Messages.FormatHorseHeader(7, user.HorseInventory.HorseList.Length);
|
||||
string message = Messages.FormatHorseHeader(user.HorseInventory.MaxHorses, user.HorseInventory.HorseList.Length);
|
||||
|
||||
int i = 1;
|
||||
foreach(HorseInfo.Category category in HorseInfo.HorseCategories)
|
||||
|
|
|
@ -604,6 +604,7 @@ namespace HISP.Server
|
|||
Messages.HorseEvadedCapture = gameData.messages.meta.horse.horse_escaped;
|
||||
|
||||
Messages.HorsesMenuHeader = gameData.messages.meta.horse.horses_menu;
|
||||
Messages.TooManyHorses = gameData.messages.meta.horse.too_many_horses;
|
||||
Messages.UpdateHorseCategory = gameData.messages.meta.horse.update_category;
|
||||
Messages.HorseEntryFormat = gameData.messages.meta.horse.horse_format;
|
||||
Messages.ViewBaiscStats = gameData.messages.meta.horse.view_basic_stats;
|
||||
|
|
|
@ -123,7 +123,17 @@ namespace HISP.Server
|
|||
if (WildHorse.DoesHorseExist(sender.LoggedinUser.CapturingHorseId))
|
||||
{
|
||||
WildHorse capturing = WildHorse.GetHorseById(sender.LoggedinUser.CapturingHorseId);
|
||||
capturing.Capture(sender.LoggedinUser);
|
||||
|
||||
try{
|
||||
capturing.Capture(sender.LoggedinUser);
|
||||
}
|
||||
catch(InventoryFullException)
|
||||
{
|
||||
byte[] chatMsg = PacketBuilder.CreateChat(Messages.TooManyHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(chatMsg);
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.InfoPrint(sender.LoggedinUser.Username + " Captured a: " + capturing.Instance.Breed.Name + " new location: " + capturing.X + ", " + capturing.Y);
|
||||
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue