no message

This commit is contained in:
SilicaAndPina 2021-02-05 22:50:35 +13:00
parent 6795f3143a
commit 7216ade563
3 changed files with 1983 additions and 93 deletions

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,6 @@ namespace HISP.Game.Services
public class Shop public class Shop
{ {
public int Id; public int Id;
public string[] BuysItemTypes; public string[] BuysItemTypes;
public int BuyPricePercentage; public int BuyPricePercentage;
public int SellPricePercentage; public int SellPricePercentage;
@ -17,7 +16,6 @@ namespace HISP.Game.Services
public Shop(int[] infiniteStocks) public Shop(int[] infiniteStocks)
{ {
Id = ShopList.Count+1;
this.Inventory = new ShopInventory(this); this.Inventory = new ShopInventory(this);
@ -55,7 +53,12 @@ namespace HISP.Game.Services
public static List<Shop> ShopList = new List<Shop>(); public static List<Shop> ShopList = new List<Shop>();
public static Shop GetShopById(int id) public static Shop GetShopById(int id)
{ {
return ShopList[id-1]; foreach(Shop shop in ShopList)
{
if (shop.Id == id)
return shop;
}
throw new KeyNotFoundException("no shop with id: " + id + " found.");
} }
} }

View file

@ -385,6 +385,7 @@ namespace HISP.Server
{ {
Shop shop = new Shop(gameData.shop_list[i].stocks_itemids.ToObject<int[]>()); Shop shop = new Shop(gameData.shop_list[i].stocks_itemids.ToObject<int[]>());
shop.Id = gameData.shop_list[i].id;
shop.BuyPricePercentage = gameData.shop_list[i].buy_percent; shop.BuyPricePercentage = gameData.shop_list[i].buy_percent;
shop.SellPricePercentage = gameData.shop_list[i].sell_percent; shop.SellPricePercentage = gameData.shop_list[i].sell_percent;
shop.BuysItemTypes = gameData.shop_list[i].buys_item_types.ToObject<string[]>(); shop.BuysItemTypes = gameData.shop_list[i].buys_item_types.ToObject<string[]>();