Function isItemAvailableForPurchase

  • Returns whether an amenity content record can still be purchased.

    Parameters

    • item: {
          sale: {
              soldAt?: string;
              soldToPlayerId?: string;
              status: "available" | "sold";
          };
      }
      • sale: {
            soldAt?: string;
            soldToPlayerId?: string;
            status: "available" | "sold";
        }
        • OptionalsoldAt?: string
        • OptionalsoldToPlayerId?: string
        • status: "available" | "sold"

    Returns boolean

    Server-side, the purchase RPC calls this after re-reading the item inside the WATCH/MULTI block to make the check atomic. Client-side, the tooltip and sprite renderers call it to decide between the Buy button and the disabled SOLD pill.

    if (!isItemAvailableForPurchase(item)) {
    // render the sold view
    }