//PURCHASE HELPERS void CommitPurchase(Item item, int quantity, float price) { Item newItem = CreateNewItemForInventory(item, quantity); if (InventoryManager.GetInstance().GetInventorySpaceChecker().CheckItem(newItem)) { AdjustShopStock(item, quantity); inv.AddItem(newItem); playerWallet.Withdraw(price); shopDialogue.SetCurrentMessage(LoadShop.MessageType.SUCCESS); } else { shopDialogue.SetCurrentMessage(LoadShop.MessageType.INV_FULL); //Debug.LogWarning("Item has been added to your inventory even though the inventory is full. You did not pay."); } }
public void ShopSlotRightClicked(Item item) { if (item == null) { return; } ShopDialogue shopDialogue = InventoryManager.GetInstance().GetShopDialogue(); CheckInventorySpace invCheck = InventoryManager.GetInstance().GetInventorySpaceChecker(); float price = PriceChecker.AppraiseItem(item, "Purchase") * item.quantity; if (playerWallet.GetCurrentBalance() >= price && invCheck.CheckItem(item)) { InventoryManager.GetInstance().GetShopInventory().Remove(item); InventoryManager.GetInstance().GetInventory().AddItem(item); playerWallet.Withdraw(price); shopDialogue.SetCurrentMessage(LoadShop.MessageType.SUCCESS); } else { shopDialogue.SetCurrentMessage(LoadShop.MessageType.INVAL_QNTY); //SHOULD BE "GENERIC_NO" } }