public ItemDB(ILogger logger, DataConfig dataConfig) { this.logger = logger; this.dataConfig = dataConfig; var ahPrices = ReadAHPrices(); var items = JsonConvert.DeserializeObject <List <Item> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "items.json"))); items.ForEach(i => { Items.Add(i.Entry, i); i.AHPrice = ahPrices.ContainsKey(i.Entry) ? ahPrices[i.Entry] : i.SellPrice; }); var foods = JsonConvert.DeserializeObject <List <ItemId> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "foods.json"))); foods.ForEach(x => FoodIds.Add(x.Id)); var waters = JsonConvert.DeserializeObject <List <ItemId> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "waters.json"))); waters.ForEach(x => WaterIds.Add(x.Id)); var containers = File.ReadAllLines(Path.Join(dataConfig.Dbc, "containers.txt")); Array.ForEach(containers, (id) => { ContainerIds.Add(int.Parse(id)); }); }
public ItemDB(ILogger logger, DataConfig dataConfig) { var items = JsonConvert.DeserializeObject <List <Item> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "items.json"))); items.ForEach(i => { Items.Add(i.Entry, i); }); var foods = JsonConvert.DeserializeObject <List <EntityId> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "foods.json"))); foods.ForEach(x => FoodIds.Add(x.Id)); var waters = JsonConvert.DeserializeObject <List <EntityId> >(File.ReadAllText(Path.Join(dataConfig.Dbc, "waters.json"))); waters.ForEach(x => WaterIds.Add(x.Id)); }