File size: 4,837 Bytes
99b0de1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//=============================================================================
// RPGツクールMZ - LL_MessageWindowAdjust.js v1.1.0
//-----------------------------------------------------------------------------
// ルルの教会 (Lulu's Church)
// https://nine-yusha.com/
//
// URL below for license details.
// https://nine-yusha.com/plugin/
//=============================================================================

/*:

 * @target MZ

 * @plugindesc メッセージウィンドウの幅を調整します。

 * @author ルルの教会

 * @url https://nine-yusha.com/plugin-messagewindowadjust/

 *

 * @help LL_MessageWindowAdjust.js

 *

 * メッセージ表示時に顔グラフィックが無しの時でも、

 * 顔グラフィック有りの時とメッセージ幅を統一します。

 *

 * プラグインコマンドはありません。

 *

 * 利用規約:

 *   ・著作権表記は必要ございません。

 *   ・利用するにあたり報告の必要は特にございません。

 *   ・商用・非商用問いません。

 *   ・R18作品にも使用制限はありません。

 *   ・ゲームに合わせて自由に改変していただいて問題ございません。

 *   ・プラグイン素材としての再配布(改変後含む)は禁止させていただきます。

 *

 * 作者: ルルの教会

 * 作成日: 2021/9/2

 *

 * @param adjustWindowChoiceList

 * @text 選択肢の位置同期

 * @desc 選択肢の位置をメッセージ幅と合わせるかの設定です。

 * @default true

 * @type boolean

 *

 * @param adjustOnBattle

 * @text 戦闘中も有効化

 * @desc オンにすると戦闘中もメッセージ幅を調整します。

 * @default false

 * @type boolean

 *

 * @param adjustWindowType

 * @text 有効化するウィンドウ背景

 * @desc どの背景の時にメッセージ幅を調整するか選択します。

 * @type select

 * @default all

 * @option 全て

 * @value all

 * @option 「ウィンドウ」のみ

 * @value windowOnly

 * @option 「暗くする」のみ

 * @value darkenOnly

 * @option 「透明」のみ

 * @value clearOnly

 *

 * @param adjustOnFace

 * @text メッセージ幅調整値 (顔有)

 * @desc 顔グラフィック有り時のメッセージ幅を縮少する値です。

 * 初期値: 0

 * @default 0

 * @type number

 * @min 0

 * @max 2000

 *

 * @param adjustNoFace

 * @text メッセージ幅調整値 (顔無)

 * @desc 顔グラフィック無し時のメッセージ幅を縮少する値です。

 * 初期値: 80

 * @default 80

 * @type number

 * @min 0

 * @max 2000

 */

(() => {
	"use strict";
	const pluginName = "LL_MessageWindowAdjust";

	const parameters = PluginManager.parameters(pluginName);
	const adjustWindowChoiceList = eval(parameters["adjustWindowChoiceList"] || "true");
	const adjustOnBattle = eval(parameters["adjustOnBattle"] || "false");
	const adjustWindowType = String(parameters["adjustWindowType"] || "all");
	const adjustOnFace = Number(parameters["adjustOnFace"] || 0);
	const adjustNoFace = Number(parameters["adjustNoFace"] || 80);

	const _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement;
	Window_Message.prototype.updatePlacement = function() {
		_Window_Message_updatePlacement.apply(this, arguments);
		// 位置と幅を調整
		let adjustValue = 0;
		if (!$gameParty.inBattle() || adjustOnBattle) {
			if (adjustWindowType === "all"
			    || ($gameMessage.background() === 0 && adjustWindowType === "windowOnly")
				|| ($gameMessage.background() === 1 && adjustWindowType === "darkenOnly")
				|| ($gameMessage.background() === 2 && adjustWindowType === "clearOnly")) {
				adjustValue = $gameMessage.faceName() === "" ? adjustNoFace : adjustOnFace;
			}
		}
		this.x = adjustValue;
		this.width = Graphics.boxWidth - (adjustValue * 2);
	};

	const _Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement;
	Window_ChoiceList.prototype.updatePlacement = function() {
		_Window_ChoiceList_updatePlacement.apply(this, arguments);
		// 位置と幅を調整
		let adjustValue = 0;
		if ((!$gameParty.inBattle() || adjustOnBattle)&& adjustWindowChoiceList) {
			if (adjustWindowType === "all"
			    || ($gameMessage.background() === 0 && adjustWindowType === "windowOnly")
				|| ($gameMessage.background() === 1 && adjustWindowType === "darkenOnly")
				|| ($gameMessage.background() === 2 && adjustWindowType === "clearOnly")) {
				adjustValue = $gameMessage.faceName() === "" ? adjustNoFace : adjustOnFace;
			}
		}
		const positionType = $gameMessage.choicePositionType();
		if (positionType === 2) {
			this.x -= adjustValue;
		} else if (positionType === 0) {
			this.x += adjustValue;
		}
	};
})();