Exemplo n.º 1
0
        public void AddItem(Item item, int amount, int price)
        {
            var existing = gameData.GetShopItem(npcInstanceId, item.Id);

            if (existing != null)
            {
                existing.Amount += amount;
            }
            else
            {
                var shopItem = gameData.CreateShopItem();
                shopItem.NpcInstanceId = npcInstanceId;
                shopItem.ItemId        = item.Id;
                shopItem.Amount        = amount;
                shopItem.Price         = price;
            }
        }