Remove " " space from the names

This commit is contained in:
AtelierWindows 2021-01-28 20:56:27 +13:00
parent bef3032886
commit 8e451633dc
59 changed files with 391 additions and 391 deletions

View file

@ -0,0 +1,84 @@
using HISP.Player;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HISP.Game.Services
{
class Inn
{
private static List<Inn> listInns = new List<Inn>();
public static Inn[] Inns
{
get
{
return listInns.ToArray();
}
}
public int Id;
public Item.ItemInformation[] RestsOffered;
public Item.ItemInformation[] MealsOffered;
public int BuyPercentage;
public int CalculateBuyCost(Item.ItemInformation item)
{
return (int)Math.Floor((float)item.SellPrice * (100.0 / (float)BuyPercentage));
}
public Item.ItemInformation GetStockedItem(int itemId)
{
// Check if inn stock..
foreach(Item.ItemInformation offering in RestsOffered)
{
if (offering.Id == itemId)
return offering;
}
foreach (Item.ItemInformation offering in MealsOffered)
{
if (offering.Id == itemId)
return offering;
}
throw new KeyNotFoundException("Item is not stocked by this inn.");
}
public Inn(int id, int[] restsOffered, int[] mealsOffered, int buyPercentage)
{
Id = id;
List<Item.ItemInformation> itemInfos = new List<Item.ItemInformation>();
foreach(int itemId in restsOffered)
{
itemInfos.Add(Item.GetItemById(itemId));
}
RestsOffered = itemInfos.ToArray();
itemInfos.Clear();
foreach (int itemId in mealsOffered)
{
itemInfos.Add(Item.GetItemById(itemId));
}
MealsOffered = itemInfos.ToArray();
itemInfos.Clear();
itemInfos = null;
BuyPercentage = buyPercentage;
listInns.Add(this);
}
public static Inn GetInnById(int id)
{
foreach (Inn inn in Inns)
if (inn.Id == id)
return inn;
throw new KeyNotFoundException("Inn " + id + " doesnt exist.");
}
}
}

View file

@ -0,0 +1,61 @@
using HISP.Game.Inventory;
using HISP.Server;
using System;
using System.Collections.Generic;
namespace HISP.Game.Services
{
class Shop
{
public int Id;
public string[] BuysItemTypes;
public int BuyPricePercentage;
public int SellPricePercentage;
public ShopInventory Inventory;
public Shop(int[] infiniteStocks)
{
Id = ShopList.Count+1;
this.Inventory = new ShopInventory(this);
foreach(int stock in infiniteStocks)
{
if (Item.ItemIdExist(stock))
this.Inventory.AddInfinity(Item.GetItemById(stock));
else
Logger.WarnPrint("Item ID: " + stock + " Does not exist.");
}
Shop.ShopList.Add(this);
}
public int CalculateBuyCost(Item.ItemInformation item)
{
return (int)Math.Round((float)item.SellPrice * (100.0 / (float)BuyPricePercentage));
}
public int CalculateSellCost(Item.ItemInformation item)
{
return (int)Math.Round((float)item.SellPrice * (100.0 / (float)SellPricePercentage));
}
public bool CanSell(Item.ItemInformation item)
{
foreach(string ItemType in BuysItemTypes)
{
if(ItemType == item.Type)
{
return true;
}
}
return false;
}
// Static Functions
public static List<Shop> ShopList = new List<Shop>();
public static Shop GetShopById(int id)
{
return ShopList[id-1];
}
}
}

View file

@ -0,0 +1,53 @@
using System.Collections.Generic;
namespace HISP.Game.Services
{
class Transport
{
public struct TransportLocation
{
public int Id;
public int Cost;
public int GotoX;
public int GotoY;
public string Type;
public string LocationTitle;
}
public struct TransportPoint
{
public int X;
public int Y;
public int[] Locations;
}
public static List<TransportPoint> TransportPoints = new List<TransportPoint>();
public static List<TransportLocation> TransportLocations = new List<TransportLocation>();
public static TransportPoint GetTransportPoint(int x, int y)
{
foreach(TransportPoint transportPoint in TransportPoints)
{
if (transportPoint.X == x && transportPoint.Y == y)
{
return transportPoint;
}
}
throw new KeyNotFoundException("Cannot find transport point at x:" + x + "y:" + y);
}
public static TransportLocation GetTransportLocation(int id)
{
foreach (TransportLocation transportLocation in TransportLocations)
{
if (transportLocation.Id == id)
{
return transportLocation;
}
}
throw new KeyNotFoundException("Cannot find transport location at Id:" + id);
}
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HISP.Game.Services
{
class Vet
{
public static List<Vet> Vets = new List<Vet>();
public Vet(int id, double price)
{
Id = id;
PriceMultiplier = price;
Vets.Add(this);
}
public int Id;
public double PriceMultiplier;
public int CalculatePrice(int health)
{
double price = (1000.0 - (double)health) * PriceMultiplier;
return Convert.ToInt32(Math.Round(price));
}
public static Vet GetVetById(int id)
{
foreach(Vet vet in Vets)
{
if (id == vet.Id)
return vet;
}
throw new KeyNotFoundException("Vet with id: " + id + " Not found.");
}
}
}