mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 13:15:53 +12:00
Add Feature pt1
This commit is contained in:
parent
a184e4d735
commit
092534e331
131 changed files with 3113 additions and 1418 deletions
44
HorseIsleServer/LibHISP/Game/Services/Groomer.cs
Normal file
44
HorseIsleServer/LibHISP/Game/Services/Groomer.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Game.Services
|
||||
{
|
||||
public class Groomer
|
||||
{
|
||||
|
||||
private static List<Groomer> groomers = new List<Groomer>();
|
||||
public static Groomer[] Groomers
|
||||
{
|
||||
get
|
||||
{
|
||||
return groomers.ToArray();
|
||||
}
|
||||
}
|
||||
public Groomer(int id, double price, int max)
|
||||
{
|
||||
Id = id;
|
||||
PriceMultiplier = price;
|
||||
Max = max;
|
||||
groomers.Add(this);
|
||||
}
|
||||
|
||||
public int Id;
|
||||
public double PriceMultiplier;
|
||||
public int Max;
|
||||
public int CalculatePrice(int groom)
|
||||
{
|
||||
double price = ((double)Max - (double)groom) * PriceMultiplier;
|
||||
return Convert.ToInt32(Math.Round(price));
|
||||
}
|
||||
|
||||
public static Groomer GetGroomerById(int id)
|
||||
{
|
||||
foreach (Groomer groomer in Groomers)
|
||||
{
|
||||
if (id == groomer.Id)
|
||||
return groomer;
|
||||
}
|
||||
throw new KeyNotFoundException("Groomer with id: " + id + " Not found.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue