/// <summary> /// Adds item to tab. /// </summary> /// <param name="tabTitle"></param> /// <param name="item"></param> /// <param name="price">Uses db value if lower than 0.</param> /// <param name="stock">Amount of times item can be bough, unlimited if lower than 0.</param> public void Add(string tabTitle, Item item, int price, int stock) { var tab = this.GetOrCreateTab(tabTitle); // Use data price if none was set if (price == -1) price = item.Data.Price; // Set stock to given amount or unlimited item.Stock = (stock <= 0 ? -1 : stock); // Set the price we need switch (tab.PaymentMethod) { case PaymentMethod.Gold: item.SetGoldPrice(price); break; case PaymentMethod.Stars: item.OptionInfo.StarPrice = price; break; case PaymentMethod.Ducats: item.OptionInfo.DucatPrice = price; break; case PaymentMethod.Points: item.OptionInfo.PointPrice = price; break; } tab.Add(item); }