mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 21:25:52 +12:00
Fix bug where building in your ranch builds in all ranches
This commit is contained in:
parent
8c43129303
commit
06b810cef3
6 changed files with 81 additions and 25 deletions
42
Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs
Normal file
42
Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs
Normal 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.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue