Fix bug where building in your ranch builds in all ranches

This commit is contained in:
SilicaAndPina 2021-02-12 14:47:29 +13:00
parent 8c43129303
commit 06b810cef3
6 changed files with 81 additions and 25 deletions

View file

@ -421,6 +421,15 @@ namespace HISP.Game
public static string PirateTreasureFormat;
public static string PotOfGoldFormat;
// Farrier
public static string FarrierCurrentShoesFormat;
public static string FarrierApplyIronShoesFormat;
public static string FarrierApplySteelShoesFormat;
public static string FarrierPutOnSteelShoesMessageFormat;
public static string FarrierPutOnIronShoesMessageFormat;
public static string FarrierPutOnSteelShoesAllMessageFormat;
// Groomer

View file

@ -724,7 +724,7 @@ namespace HISP.Game
return message;
}
public static string BuildHorseList(User user)
public static string BuildWildHorseList(User user)
{
string message = "";
WildHorse[] horses = WildHorse.GetHorsesAt(user.X, user.Y);
@ -940,7 +940,7 @@ namespace HISP.Game
return message;
}
public static string BuildHorseList()
public static string BuildHorseBreedListLibary()
{
string message = "";
foreach (HorseInfo.Breed breed in HorseInfo.Breeds.OrderBy(o => o.Name).ToList())
@ -1921,7 +1921,7 @@ namespace HISP.Game
{
string message = "";
message += buildLocationString(x, y);
message += BuildHorseList(user);
message += BuildWildHorseList(user);
message += buildNpc(user, x, y);

View file

@ -0,0 +1,42 @@
using System.Collections.Generic;
namespace HISP.Game.Services
{
public class Farrier
{
private static List<Farrier> farriers = new List<Farrier>();
public static Farrier[] Farriers
{
get
{
return farriers.ToArray();
}
}
public int Id;
public int SteelShoesAmount;
public int SteelCost;
public int IronShoesAmount;
public int IronCost;
public Farrier(int id, int steelShoesInc, int steelCost, int ironShoesInc, int ironCost)
{
this.Id = id;
this.SteelShoesAmount = steelShoesInc;
this.SteelCost = steelCost;
this.IronShoesAmount = ironShoesInc;
this.IronCost = ironCost;
farriers.Add(this);
}
public static Farrier GetFarrierById(int id)
{
foreach (Farrier farrier in Farriers)
if (farrier.Id == id)
return farrier;
throw new KeyNotFoundException("No farrier with id: " + id + " found.");
}
}
}