Source: Window_ShopCommand.js

Window_ShopCommand.js

//-----------------------------------------------------------------------------
// Window_ShopCommand
//
// The window for selecting buy/sell on the shop screen.
/**
 * The window for selecting buy/sell on the shop screen.
 *
 * @class
 * @extends Window_HorzCommand
 */
function Window_ShopCommand() {
    this.initialize(...arguments);
}

Window_ShopCommand.prototype = Object.create(Window_HorzCommand.prototype);
Window_ShopCommand.prototype.constructor = Window_ShopCommand;

Window_ShopCommand.prototype.initialize = function(rect) {
    Window_HorzCommand.prototype.initialize.call(this, rect);
};

/**
 * Set if the shop is purchase only, so it knows to not enable the sell command
 *
 * @param {boolean} purchaseOnly - True if the shop allows selling to it
 */
Window_ShopCommand.prototype.setPurchaseOnly = function(purchaseOnly) {
    this._purchaseOnly = purchaseOnly;
    this.refresh();
};

/**
 * Get the max number of columns in the window
 *
 * @return {number} Number of columns in the window
 */
Window_ShopCommand.prototype.maxCols = function() {
    return 3;
};

/**
 * Make the commands in the command list
 */
Window_ShopCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.buy, "buy");
    this.addCommand(TextManager.sell, "sell", !this._purchaseOnly);
    this.addCommand(TextManager.cancel, "cancel");
};