-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWraparoundShopNum.js
91 lines (84 loc) · 2.98 KB
/
WraparoundShopNum.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//=============================================================================
// WraparoundShopNum.js
//=============================================================================
/*:
* @target MZ
* @plugindesc Wraparound number input in shop.
* @author Toru Higuruma
* @url https://github.com/neofuji/RPGMZ-Plugins
*
* @help WraparoundShopNum v1.0 (2020-08-20)
* Copyright (c) 2020 Toru Higuruma
* This plugin is provided under the MIT License.
*
* It does not provide plugin commands.
*/
/*:ja
* @target MZ
* @plugindesc ショップの個数入力で最大値と最小値をループさせます。
* @author Toru Higuruma
* @url https://github.com/neofuji/RPGMZ-Plugins
*
* @help WraparoundShopNum v1.0 (2020-08-20)
* Copyright (c) 2020 Toru Higuruma
* このプラグインは MIT License の下で提供されます。
*
* プラグインコマンドはありません。
*/
(() => {
const _Window_ShopNumber_processNumberChange =
Window_ShopNumber.prototype.processNumberChange;
Window_ShopNumber.prototype.processNumberChange = function() {
if (this.isOpenAndActive()) {
if (this._number === this._max) {
if (Input.isTriggered("right") || Input.isTriggered("up")) {
this.changeNumber(1 - this._max);
return;
}
}
if (this._number === 1) {
if (Input.isTriggered("left") || Input.isTriggered("down")) {
this.changeNumber(this._max - 1);
return;
}
}
}
_Window_ShopNumber_processNumberChange.apply(this, arguments);
};
const _Window_ShopNumber_onButtonUp =
Window_ShopNumber.prototype.onButtonUp;
Window_ShopNumber.prototype.onButtonUp = function() {
if (this._number === this._max) {
this.changeNumber(1 - this._max);
return;
}
_Window_ShopNumber_onButtonUp.apply(this, arguments);
};
const _Window_ShopNumber_onButtonUp2 =
Window_ShopNumber.prototype.onButtonUp2;
Window_ShopNumber.prototype.onButtonUp2 = function() {
if (this._number === this._max) {
this.changeNumber(1 - this._max);
return;
}
_Window_ShopNumber_onButtonUp2.apply(this, arguments);
};
const _Window_ShopNumber_onButtonDown =
Window_ShopNumber.prototype.onButtonDown;
Window_ShopNumber.prototype.onButtonDown = function() {
if (this._number === 1) {
this.changeNumber(this._max - 1);
return;
}
_Window_ShopNumber_onButtonDown.apply(this, arguments);
};
const _Window_ShopNumber_onButtonDown2 =
Window_ShopNumber.prototype.onButtonDown2;
Window_ShopNumber.prototype.onButtonDown2 = function() {
if (this._number === 1) {
this.changeNumber(this._max - 1);
return;
}
_Window_ShopNumber_onButtonDown2.apply(this, arguments);
};
})();