Exemplo n.º 1
0
        public Shop(bool bm = false)
        {
            isBM = bm;
            int[] nItems;
            if (isBM)
            {
                nItems = DBFunctions.GetBMItemIDList();
            }
            else
            {
                nItems = DBFunctions.GetItemIDList(shoppable: true, includeBM: false);
            }
            List <int> items = new List <int>();
            List <int> stock = new List <int>();

            for (int i = 0; i < 5; i++)
            {
                int itemIndex = rdm.Next(nItems.Length);
                if (!items.Contains(nItems[itemIndex]))
                {
                    items.Add(nItems[itemIndex]);
                    if (!isBM)
                    {
                        stock.Add(rdm.Next(5, 16));
                    }
                    else
                    {
                        stock.Add(rdm.Next(1, 5));
                    }
                }
                else
                {
                    i--;
                }
            }

            this.items = items;
            this.stock = stock;

            openDate = Var.CurrentDate();
        }