Shop
Shop is the client-side in-match shop API. The global is nil in a Reflex server.
The command methods BuyItem(), BuyAndDropItem(), and SellItem() return nil. Check inventory and the query methods to confirm an operation instead of relying on a return value.
How an operation is processed
Section titled “How an operation is processed”A client call creates a shop-operation request. The server checks current match rules—buy availability, money, limits, side, slot, and sale eligibility—before changing economy, inventory, or spawning a drop. nil therefore only means the call was submitted, not that a purchase succeeded.
CanSellItem(), HasBoughtItem(), and IsBuyLimitReachedForItem() read current shop state for the local agent. They reserve nothing and cannot guarantee conditions will remain unchanged until the next request is processed.
Where the result appears
Section titled “Where the result appears”- When the server accepts
BuyItem(), the inventory and the item’s purchase state change. SellItem()removes an eligible item and changes the related shop state.BuyAndDropItem()requests a purchase that creates an item in the world, but the call does not return the createdDrop.
These methods do not show a separate confirmation on behalf of the module. Check the inventory, HasBoughtItem(), CanSellItem(), and Drops lists; show your own feedback through NotificationController or ChatManager when needed.
Buy and sell example
Section titled “Buy and sell example”local itemName = "FragGrenade"
if not Shop:IsBuyLimitReachedForItem(itemName) then Shop:BuyItem(itemName)end
if Shop:CanSellItem(itemName) then Shop:SellItem(itemName)endA successful purchase adds the item to Agents:GetLocalAgent().Inventory. After buying, HasBoughtItem() becomes true, while CanSellItem() reports whether it can be refunded right now.
BuyItem
Section titled “BuyItem”Shop:BuyItem(itemName: string)Buys an item by its internal name. The operation depends on the round stage, buy zone, available money, item availability, and purchase limit.
SellItem
Section titled “SellItem”Shop:SellItem(itemName: string)Sells a previously purchased item when CanSellItem(itemName) returns true.
BuyAndDropItem
Section titled “BuyAndDropItem”Shop:BuyAndDropItem(itemName: string)Requests a purchase that should place the item in the world.
State queries
Section titled “State queries”CanSellItem
Section titled “CanSellItem”Shop:CanSellItem(itemName: string): boolReturns true when the local player can sell the item right now.
HasBoughtItem
Section titled “HasBoughtItem”Shop:HasBoughtItem(itemName: string): boolReturns true when the item is recorded as purchased by the local player in the current round.
IsBuyLimitReachedForItem
Section titled “IsBuyLimitReachedForItem”Shop:IsBuyLimitReachedForItem(itemName: string): boolReturns true when the purchase limit for the item has been reached.