/// <summary> /// Initializes a new instance of the <see cref="SpecialShopListing" /> class. /// </summary> /// <param name="shop"><see cref="SpecialShop" /> for which the listing is.</param> /// <param name="index">Position of the listing in the <c>shop</c>'s data.</param> public SpecialShopListing(SpecialShop shop, int index) { SpecialShop = shop; const int RewardCount = 2; List <ShopListingItem> rewards = new List <ShopListingItem>(); for (int i = 0; i < RewardCount; ++i) { Item item = shop.As <Item>("Item{Receive}", index, i); if (item.Key == 0) { continue; } int count = shop.AsInt32("Count{Receive}", index, i); if (count == 0) { continue; } bool hq = shop.AsBoolean("HQ{Receive}", index, i); rewards.Add(new ShopListingItem(this, item, count, hq, 0)); } _Rewards = rewards.ToArray(); Quest = shop.As <Quest>("Quest{Item}", index); const int CostCount = 2; List <ShopListingItem> costs = new List <ShopListingItem>(); for (int i = 0; i < CostCount; ++i) { Item item = shop.As <Item>("Item{Cost}", index, i); if (item.Key == 0) { continue; } int count = shop.AsInt32("Count{Cost}", index, i); if (count == 0) { continue; } bool hq = shop.AsBoolean("HQ{Cost}", index, i); short collectabilityRating = shop.AsInt16("CollectabilityRating{Cost}", index, i); costs.Add(new ShopListingItem(this, item, count, hq, collectabilityRating)); } _Costs = costs.ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="SpecialShopListing" /> class. /// </summary> /// <param name="shop"><see cref="SpecialShop" /> for which the listing is.</param> /// <param name="index">Position of the listing in the <c>shop</c>'s data.</param> public SpecialShopListing(SpecialShop shop, int index) { SpecialShop = shop; const int RewardCount = 2; var rewards = new List<ShopListingItem>(); for (var i = 0; i < RewardCount; ++i) { var item = shop.As<Item>("Item{Receive}", index, i); if (item.Key == 0) continue; var count = shop.AsInt32("Count{Receive}", index, i); if (count == 0) continue; var hq = shop.AsBoolean("HQ{Receive}", index, i); rewards.Add(new ShopListingItem(this, item, count, hq, 0)); } _Rewards = rewards.ToArray(); Quest = shop.As<Quest>("Quest{Item}", index); const int CostCount = 3; var costs = new List<ShopListingItem>(); for (var i = 0; i < CostCount; ++i) { var item = shop.As<Item>("Item{Cost}", index, i); if (item.Key == 0) continue; var count = shop.AsInt32("Count{Cost}", index, i); if (count == 0) continue; var hq = shop.AsBoolean("HQ{Cost}", index, i); var collectabilityRating = shop.AsInt16("CollectabilityRating{Cost}", index, i); costs.Add(new ShopListingItem(this, item, count, hq, collectabilityRating)); } _Costs = costs.ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="SpecialShopListing" /> class. /// </summary> /// <param name="shop"><see cref="SpecialShop" /> for which the listing is.</param> /// <param name="index">Position of the listing in the <c>shop</c>'s data.</param> public SpecialShopListing(SpecialShop shop, int index) { SpecialShop = shop; const int RewardCount = 2; var rewards = new List <ShopListingItem>(); for (var i = 0; i < RewardCount; ++i) { var item = shop.As <Item>("Item{Receive}", index, i); if (item.Key == 0) { continue; } var count = shop.AsInt32("Count{Receive}", index, i); if (count == 0) { continue; } var hq = shop.AsBoolean("HQ{Receive}", index, i); rewards.Add(new ShopListingItem(this, item, count, hq, 0)); } _Rewards = rewards.ToArray(); Quest = shop.As <Quest>("Quest{Item}", index); int UseCurrencyType = shop.As <byte>("UseCurrencyType"); const int CostCount = 3; var costs = new List <ShopListingItem>(); for (var i = 0; i < CostCount; ++i) { var item = shop.As <Item>("Item{Cost}", index, i); if (item.Key == 0) { continue; } var count = shop.AsInt32("Count{Cost}", index, i); if (count == 0) { continue; } var hq = shop.AsBoolean("HQ{Cost}", index, i); if (item.Key < 8) { switch (UseCurrencyType) { case 16: item = shop.Sheet.Collection.GetSheet <Item>() [_Currencies[item.Key]]; break; case 8: item = shop.Sheet.Collection.GetSheet <Item>() [1]; break; case 4: if (_Tomestones == null) { BuildTomestones(); } item = shop.Sheet.Collection.GetSheet <Item>() [_Tomestones[item.Key]]; break; } hq = false; } var collectabilityRating = shop.AsInt16("CollectabilityRating{Cost}", index, i); costs.Add(new ShopListingItem(this, item, count, hq, collectabilityRating)); } _Costs = costs.ToArray(); }