Skip to content

CanPurchaseItem

Usage

  • Return a non-null value or bool to override default behavior

Example Autogenerated

csharp
private void CanPurchaseItem( BasePlayer buyer, Item num3, Action`2 onItemPurchased, VendingMachine instance, ItemContainer targetContainer )
{
    Puts( "CanPurchaseItem works!" );
}

Location

  • VendingMachine::DoTransaction(BasePlayer buyer, int sellOrderId, int numberOfTransactions, ItemContainer targetContainer, System.Action2&lt;BasePlayer,Item&gt; onCurrencyRemoved, System.Action2<BasePlayer,Item> onItemPurchased, MarketTerminal droneMarketTerminal)
csharp
//---
			Debug.LogError("Vending machine error, contact developers!");
		}
		else
		{
			num6 += item2.amount;
			object returnvar2 = Interface.CallHook("CanPurchaseItem", buyer, item2, onItemPurchased, this, targetContainer);
			if (returnvar2 != null)
			{
				return returnvar2 is bool && (bool)returnvar2;
			}
			this.RecordSaleAnalytics(item2, sellOrderId);
//---

Released under the MIT License.