MV Skip item quantity window when buying/selling on a shop

Tl;dr: In the shop scene, when the player clicks on an item to buy, there is a following window where they're asked how many of that item they'll be buying. I wanted a fix that could be able to skip this window and make it so as when the player clicks on an item in the shop, they buy/sell one of it.


Hello!
I'm working on a game that has an inventory system somewhat similar to Dragon Quest, where each character has a limit to how many items they can carry (including equipment) and the party has a bag with unlimited storage, I had a programmer friend help out to try and make this work, and he did it using a workaround with YEP_Itemcore's unique items, that made it so whenever the player tries to buy something in a shop, they can only buy one of each, making the "buy amount" window a bit redundant.
I wanted to ask for more of a fix than a whole plugin, which would skip this amount window and consider 1 item per click of the player, either if they're buying or selling.
Hi! It's fairly straightforward to just disable the number window and have buy/sell do the action directly on one item, I've included that here:

JavaScript:
Scene_Shop.prototype.onBuyOk = function() {
    this._item = this._buyWindow.item();
    this.doBuy(1);
    SoundManager.playShop();
    this._goldWindow.refresh();
    this._statusWindow.refresh();
    this.activateBuyWindow();
};

Scene_Shop.prototype.onSellOk = function() {
    this._item = this._sellWindow.item();
    this.doSell(1);
    SoundManager.playShop();
    this._goldWindow.refresh();
    this._statusWindow.refresh();
    this.activateSellWindow();
};

This will override the normal shop behavior.
If you have a utilities plugin you can just paste this directly in, as long as something else in your plugins isnt overriding it.
Or if its easier for you I can upload this as its own plugin file if you want it to be organized separately.

Also I would just double check that your friend didnt make any changes to either of these functions for their plugin. I assume they probably just changed
Code:
Window_ShopBuy.prototype.isEnabled
though.

Hope this helps!
Worked like a charm! Thank you very much!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/skip-item-quantity-window-when-buying-selling-on-a-shop.152629/