mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +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
|
@ -137,7 +137,7 @@
|
||||||
"horse_timer":"You have 60 seconds to capture the horse. Good luck!",
|
"horse_timer":"You have 60 seconds to capture the horse. Good luck!",
|
||||||
"horse_escaped":"The Horse Evaded Capture.",
|
"horse_escaped":"The Horse Evaded Capture.",
|
||||||
"hore_caught":"You Captured the Horse!",
|
"hore_caught":"You Captured the Horse!",
|
||||||
|
"too_many_horses":"You cannot manage any more horses.",
|
||||||
"horses_menu":"^ATYour Horses^H<B>You can have up to %MAXHORSE% horses. Here are your %TOTALHORSE%:</B><BR>",
|
"horses_menu":"^ATYour Horses^H<B>You can have up to %MAXHORSE% horses. Here are your %TOTALHORSE%:</B><BR>",
|
||||||
"update_category":"Horse set as %CATEGORY%",
|
"update_category":"Horse set as %CATEGORY%",
|
||||||
"horse_format":"^I252^T7#%NUMB%: %NAME% (%BREED%) ^B3L%ID%^R1",
|
"horse_format":"^I252^T7#%NUMB%: %NAME% (%BREED%) ^B3L%ID%^R1",
|
||||||
|
@ -587,10 +587,11 @@
|
||||||
},
|
},
|
||||||
"horses":{
|
"horses":{
|
||||||
"categorys":[
|
"categorys":[
|
||||||
|
{"name":"LEASED","message":"^LLEASED - Horses only temporarily cared for, limited use:^R1"},
|
||||||
{"name":"KEEPER","message":"^LKEEPERS - Horses I would not sell for any price:^R1"},
|
{"name":"KEEPER","message":"^LKEEPERS - Horses I would not sell for any price:^R1"},
|
||||||
{"name":"TRAINING","message":"^LTRAINING - Horses I am actively training and competing with:^R1"},
|
{"name":"TRAINING","message":"^LTRAINING - Horses I am actively training and competing with:^R1"},
|
||||||
{"name":"TRADING","message":"^LTRADING - Horses I am trading or auctioning:^R1"},
|
{"name":"TRADING","message":"^LTRADING - Horses I am trading or auctioning:^R1"},
|
||||||
{"name":"RETIRED","message":"^LRETIRED - Horses that are still special to me but not used:^R1"},
|
{"name":"RETIRED","message":"^LRETIRED - Horses that are still special to me but not used:^R1"}
|
||||||
],
|
],
|
||||||
"breeds":[
|
"breeds":[
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
public void AddHorse(HorseInstance horse, bool addToDb=true)
|
||||||
{
|
{
|
||||||
|
if (HorseList.Length + 1 > MaxHorses)
|
||||||
|
throw new InventoryFullException();
|
||||||
|
|
||||||
horse.Owner = baseUser.Id;
|
horse.Owner = baseUser.Id;
|
||||||
if(addToDb)
|
if(addToDb)
|
||||||
Database.AddHorse(horse);
|
Database.AddHorse(horse);
|
||||||
|
|
|
@ -169,7 +169,7 @@ namespace HISP.Game
|
||||||
public static string HorseCaptureTimer;
|
public static string HorseCaptureTimer;
|
||||||
public static string YouCapturedTheHorse;
|
public static string YouCapturedTheHorse;
|
||||||
public static string HorseEvadedCapture;
|
public static string HorseEvadedCapture;
|
||||||
|
public static string TooManyHorses;
|
||||||
public static string HorsesMenuHeader;
|
public static string HorsesMenuHeader;
|
||||||
public static string UpdateHorseCategory;
|
public static string UpdateHorseCategory;
|
||||||
public static string HorseEntryFormat;
|
public static string HorseEntryFormat;
|
||||||
|
|
|
@ -879,7 +879,7 @@ namespace HISP.Game
|
||||||
public static string BuildHorseInventory(User user)
|
public static string BuildHorseInventory(User user)
|
||||||
{
|
{
|
||||||
// TODO: calculate max number based on ranch barns owned.
|
// 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;
|
int i = 1;
|
||||||
foreach(HorseInfo.Category category in HorseInfo.HorseCategories)
|
foreach(HorseInfo.Category category in HorseInfo.HorseCategories)
|
||||||
|
|
|
@ -604,6 +604,7 @@ namespace HISP.Server
|
||||||
Messages.HorseEvadedCapture = gameData.messages.meta.horse.horse_escaped;
|
Messages.HorseEvadedCapture = gameData.messages.meta.horse.horse_escaped;
|
||||||
|
|
||||||
Messages.HorsesMenuHeader = gameData.messages.meta.horse.horses_menu;
|
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.UpdateHorseCategory = gameData.messages.meta.horse.update_category;
|
||||||
Messages.HorseEntryFormat = gameData.messages.meta.horse.horse_format;
|
Messages.HorseEntryFormat = gameData.messages.meta.horse.horse_format;
|
||||||
Messages.ViewBaiscStats = gameData.messages.meta.horse.view_basic_stats;
|
Messages.ViewBaiscStats = gameData.messages.meta.horse.view_basic_stats;
|
||||||
|
|
|
@ -123,7 +123,17 @@ namespace HISP.Server
|
||||||
if (WildHorse.DoesHorseExist(sender.LoggedinUser.CapturingHorseId))
|
if (WildHorse.DoesHorseExist(sender.LoggedinUser.CapturingHorseId))
|
||||||
{
|
{
|
||||||
WildHorse capturing = WildHorse.GetHorseById(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);
|
Logger.InfoPrint(sender.LoggedinUser.Username + " Captured a: " + capturing.Instance.Breed.Name + " new location: " + capturing.X + ", " + capturing.Y);
|
||||||
|
|
||||||
sender.LoggedinUser.MetaPriority = true;
|
sender.LoggedinUser.MetaPriority = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue