forked from Nelderson/NASTY_RPGMakerMV_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNasty_Replace_Window_with_Picture.js
421 lines (405 loc) · 15.5 KB
/
Nasty_Replace_Window_with_Picture.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
//=============================================================================
// Nasty Replace Window with Picture
// Version: 1.0.4
//=============================================================================
var Imported = Imported || {};
Imported.Nasty_Replace_Window_with_Picture = true;
var Nasty = Nasty || {};
//=============================================================================
/*:
* @plugindesc Use pictures instead of the windowskin image!
*<Nasty_Replace_Window_with_Picture>
* @author Nelderson
*
* @param Debug Mode?
* @desc Print width and height of every window loaded to the console(F8).
* @default false
*
* @param Window 1 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 1 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 2 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 2 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 3 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 3 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 4 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 4 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 5 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 5 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 6 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 6 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 7 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 7 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 8 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 8 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 9 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 9 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 10 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 10 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 11 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 11 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 12 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 12 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 13 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 13 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 14 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 14 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 15 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 15 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 16 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 16 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 17 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 17 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 18 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 18 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 19 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 19 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 20 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 20 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 21 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 21 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 22 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 22 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 23 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 23 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 24 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 24 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 25 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 25 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 26 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 26 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 27 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 27 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 28 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 28 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 29 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 29 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @param Window 30 Object Name
* @desc Use this to say which window object you want to switch:
* Use the Debug if you need to find names to work with.
*
* @param Window 30 Picture Name
* @desc Name of the picture in the img/pictures folder:
*
*
* @help
* ============================================================================
* Introduction and Instructions
* ============================================================================
*
* Want to make super special windows in your game? Sometimes the windowskin
* isnt enough, that's where Nasty Replace Window with Picture plugin comes in!
*
* All you need to do is define the window object name and the picture name
* located in your img/pictures folder
*
* If you don't know the window object name, fret not! You can use the
* nifty debug tool. This will give you a list of all window objects that
* are currently loading, and will also tell you the width and height!
*
* You can also change windows on the fly with the Plugin Command:
* ChangeWindowPic Window_Object PictureName
*
* Ex:
* ChangeWindowPic Window_Status Pic3
*
* This would change the Status Window background to pic3 in the
* img/pictures folder!
*
*
*
* HAVE FUN!
*/
//=============================================================================
//=============================================================================
// Parameter Variables
//=============================================================================
Nasty.Replace_Window_with_Pic = Nasty.Replace_Window_with_Pic || {};
(function($){
Nasty.Parameters = $plugins.filter(function(p)
{ return p.description.contains('<Nasty_Replace_Window_with_Picture>');
})[0].parameters;
Nasty.Param = Nasty.Param || {};
Nasty.Param.PicWindow_Obj = {};
Nasty.Param.PicWindow_Debug_Mode = String(Nasty.Parameters['Debug Mode?']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 1 Object Name'])] =
String(Nasty.Parameters['Window 1 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 2 Object Name'])] =
String(Nasty.Parameters['Window 2 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 3 Object Name'])] =
String(Nasty.Parameters['Window 3 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 4 Object Name'])] =
String(Nasty.Parameters['Window 4 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 5 Object Name'])] =
String(Nasty.Parameters['Window 5 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 6 Object Name'])] =
String(Nasty.Parameters['Window 6 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 7 Object Name'])] =
String(Nasty.Parameters['Window 7 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 8 Object Name'])] =
String(Nasty.Parameters['Window 8 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 9 Object Name'])] =
String(Nasty.Parameters['Window 9 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 10 Object Name'])] =
String(Nasty.Parameters['Window 10 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 11 Object Name'])] =
String(Nasty.Parameters['Window 11 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 12 Object Name'])] =
String(Nasty.Parameters['Window 12 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 13 Object Name'])] =
String(Nasty.Parameters['Window 13 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 14 Object Name'])] =
String(Nasty.Parameters['Window 14 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 15 Object Name'])] =
String(Nasty.Parameters['Window 15 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 16 Object Name'])] =
String(Nasty.Parameters['Window 16 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 17 Object Name'])] =
String(Nasty.Parameters['Window 17 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 18 Object Name'])] =
String(Nasty.Parameters['Window 18 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 19 Object Name'])] =
String(Nasty.Parameters['Window 19 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 20 Object Name'])] =
String(Nasty.Parameters['Window 20 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 21 Object Name'])] =
String(Nasty.Parameters['Window 21 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 22 Object Name'])] =
String(Nasty.Parameters['Window 22 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 23 Object Name'])] =
String(Nasty.Parameters['Window 23 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 24 Object Name'])] =
String(Nasty.Parameters['Window 24 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 25 Object Name'])] =
String(Nasty.Parameters['Window 25 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 26 Object Name'])] =
String(Nasty.Parameters['Window 26 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 27 Object Name'])] =
String(Nasty.Parameters['Window 27 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 28 Object Name'])] =
String(Nasty.Parameters['Window 28 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 29 Object Name'])] =
String(Nasty.Parameters['Window 29 Picture Name']);
Nasty.Param.PicWindow_Obj[String(Nasty.Parameters['Window 30 Object Name'])] =
String(Nasty.Parameters['Window 30 Picture Name']);
// Window_Base prototype and aliasing
var Nasty_winpic_sprite = {};
var NASTY_PicWindow_Window_Base_Redo = Window_Base.prototype.initialize;
Window_Base.prototype.initialize = function(x, y, width, height){
//Aliases must have *this* as the first argument
NASTY_PicWindow_Window_Base_Redo.call(this, x, y, width, height);
//Check for Window defined in user section? And then replace with pic
var Nasty_list_of_winpic_keys = Object.keys(Nasty.Param.PicWindow_Obj);
if (Nasty_list_of_winpic_keys.contains(this.constructor.name)){
if (Nasty.Param.PicWindow_Obj[this.constructor.name]){
Nasty_winpic_sprite = new Sprite_Base();
Nasty_winpic_sprite.bitmap =
ImageManager.loadPicture(Nasty.Param.PicWindow_Obj[this.constructor.name]);
this.addChildToBack(Nasty_winpic_sprite);
}
else{
console.log("Please Define which Picture to use in the Plugin Manager :)");
}
//Make original Wiindow opaque if defined in user section
this.opacity = 0;
}
if (Nasty.Param.PicWindow_Debug_Mode === 'true'){
console.log(this.constructor.name+" Width: "+this.width+" Height: "+ this.height);
}
};
var NASTY_PicWindo_setBckrd_type_Redo = Window_Base.prototype.setBackgroundType;
Window_Base.prototype.setBackgroundType = function(type) {
if (Nasty_winpic_sprite){
if (type === 0) {
Nasty_winpic_sprite.opacity = 255;
} else {
Nasty_winpic_sprite.opacity = 0;
}
NASTY_PicWindo_setBckrd_type_Redo.call(this, type);
}
};
//=============================================================================
// Game_Interpreter - New Plugin Commands
//=============================================================================
Nasty_picWindow_change_Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Nasty_picWindow_change_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'ChangeWindowPic') {
Nasty.Param.PicWindow_Obj[args[0]] = args[1];
}
};
})(Nasty.Replace_Window_with_Pic);