Advertisement
rito_kun

ModMenu

Nov 26th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // ModMenu.js
  3. //=============================================================================
  4.  
  5. var Imported = Imported || {};
  6. Imported.ModMenu = true;
  7.  
  8. /*:
  9.  * @plugindesc Modificable menu screen layout
  10.  * @author Bodka
  11.    
  12.  * @help v 1.4 Added some command, bugfix
  13.    
  14.  * @param  --Menu status--
  15.    
  16.  * @param Menu Status x
  17.  * @desc Set orizontal position of the Menu Status.
  18.  * @default 0
  19.    
  20.  * @param Menu Status y
  21.  * @desc Set vertical position of the Menu Status.
  22.  * @default 0
  23.  
  24.  * @param Menu Status x Text
  25.  * @desc Possible value Left, Center, Right, After command, Disabled. If Disabled take Menu Command x value(number). Default Disabled
  26.  * @default Disabled
  27.  
  28.  * @param Menu Status y Text
  29.  * @desc Possible value Top, Center, Bottom, Disabled. If Disabled take Menu Command y value(number). Default Disabled
  30.  * @default Disabled
  31.  
  32.  * @param Menu Status Width
  33.  * @desc Set Menu status width. If 0 take default settings.
  34.  * @default 0
  35.    
  36.  * @param Menu Status Height
  37.  * @desc Set Menu status height. If 0 take default settings.
  38.  * @default 0
  39.    
  40.  * @param Menu Status ActorBox Height
  41.  * @desc Set height of actor box in the menu status. If 0 take default settings.
  42.  * @default 0
  43.    
  44.  * @param --Menu Command--  
  45.    
  46.  * @param Menu Command Width
  47.  * @desc Set Menu command width. Default 240
  48.  * @default 240
  49.    
  50.  * @param Menu Command Height
  51.  * @desc Set menu command height. Default 0
  52.  * @default 0
  53.    
  54.  * @param Menu Command y
  55.  * @desc Set menu command window vertical position. Default 0
  56.  * @default 0
  57.    
  58.  * @param Menu Command x
  59.  * @desc Set menu command window orizontal position. Default 0
  60.  * @default 0
  61.  
  62.  * @param Menu Command x Text
  63.  * @desc Possible value Left, Center, Right, Disabled. If Disabled take Menu Command x value(number). Default Disabled
  64.  * @default Disabled
  65.  
  66.  * @param Menu Command y Text
  67.  * @desc Possible value Top, Center, Bottom, Disabled. If Disabled take Menu Command y value(number). Default Disabled
  68.  * @default Disabled
  69.    
  70.  * @param Menu Command Row Displayed
  71.  * @desc Set menu command window row displayed. Menu command heigth must be 0. Default 8.
  72.  * @default 8
  73.    
  74.  * @param --Gold window--
  75.    
  76.  * @param Gold Window x
  77.  * @desc Set Gold window orizontal position. Default 0
  78.  * @default 0
  79.  
  80.  * @param Gold Window y
  81.  * @desc Set Gold window vertical position. Default 0
  82.  * @default 0
  83.  
  84.  * @param Gold Window x Text
  85.  * @desc Possible value Left, Center, Right, Disabled. If Disabled take Menu Command x value(number). Default Disabled
  86.  * @default Disabled
  87.  
  88.  * @param Gold Window y Text
  89.  * @desc Possible value Top, Center, Bottom, Disabled. If Disabled take Menu Command y value(number). Default Disabled
  90.  * @default Disabled
  91.  
  92.  * @param Gold Window width
  93.  * @desc Set width of the gold window. If 0 default settings. Default 0
  94.  * @default 0
  95.  
  96.  * @param --Location window--
  97.  
  98.  * @param Location Window x
  99.  * @desc Set Gold window orizontal position. Default 0
  100.  * @default 0
  101.  
  102.  * @param Location Window y
  103.  * @desc Set Gold window vertical position. Default 0
  104.  * @default 0
  105.  
  106.  * @param Location Window x Text
  107.  * @desc Possible value Left, Center, Right, Disabled. If Disabled take Menu Command x value(number). Default Disabled
  108.  * @default Left
  109.  
  110.  * @param Location Window y Text
  111.  * @desc Possible value Top, Center, Bottom, Before Gold, Disabled. If Disabled take Menu Command y value(number). Default Disabled
  112.  * @default Before Gold
  113.  
  114.  * @param Location Window Width
  115.  * @desc Set Location window width. If 0 take default settings. Default 0.
  116.  * @default 0
  117.  
  118.  * @param Location Window Height
  119.  * @desc Set Location Window height. If 0 take default settings. Default 0
  120.  * @default 0
  121.  
  122.  * @param --Show window--
  123.  
  124.  * @param Show Status Window
  125.  * @desc Show or hide status window in the menu.True for enable. Case sensitive. Default True
  126.  * @default True
  127.    
  128.  * @param Show Gold Window
  129.  * @desc Show or hide the gold window in the menu status(Case sensitive). True or False. Default True.
  130.  * @default True
  131.    
  132.  * @param Show Location Window
  133.  * @desc Show or hide the location window in the menu status(Case sensitive). True or False. Default True.
  134.  * @default False
  135.  
  136.  * @param --Show actor face--
  137.  
  138.  * @param Show Actor Face Menu
  139.  * @desc Show or hide the actor face in the Menu status. True or False. Default True.
  140.  * @default True
  141.  
  142.  * @param Show Actor Face Status Info
  143.  * @desc Show or hide the actor face in the status tab. True or False. Default True.
  144.  * @default True
  145.  
  146.  * @param --Show Command in menu--  
  147.    
  148.  * @param Show Item in menu
  149.  * @desc Show Item Command in the menu command.True of False, Case sensitive. Default True
  150.  * @default True
  151.    
  152.  * @param Show Skill in menu
  153.  * @desc Show Skill Command in the menu command.True of False, Case sensitive. Default True
  154.  * @default True
  155.    
  156.  * @param Show Equip in menu
  157.  * @desc Show Equip Command in the menu command.True of False, Case sensitive. Default True
  158.  * @default True
  159.    
  160.  * @param Show Status in menu
  161.  * @desc Show Status Command in the menu command.True of False, Case sensitive. Default True
  162.  * @default True
  163.    
  164.  * @param Show Formation in menu
  165.  * @desc Show Formation Command in the menu command.True of False, Case sensitive. Default True
  166.  * @default True
  167.    
  168.  * @param Show Options in menu
  169.  * @desc Show Options Command in the menu command.True of False, Case sensitive. Default True
  170.  * @default True
  171.    
  172.  * @param Show Save in menu
  173.  * @desc Show Save Command in the menu command.True of False, Case sensitive. Default True
  174.  * @default True
  175.    
  176.  * @param Show Game End in menu
  177.  * @desc Show Game End Command in the menu command.True of False, Case sensitive. Default True
  178.  * @default True
  179.  
  180.  */
  181.  
  182. var parameters = PluginManager.parameters('ModMenu');
  183. var xStatus = Number(parameters['Menu Status x']);
  184. var yStatus = Number(parameters['Menu Status y']);
  185. var wStatus = Number(parameters['Menu Status Width']);
  186. var hStatus = Number(parameters['Menu Status Height']);
  187. var actorBoxH = Number(parameters['Menu Status ActorBox Height']);
  188. var widthCommand = Number(parameters['Menu Command Width']);
  189. var heightCommand = Number(parameters['Menu Command Height']);
  190. var yCommandText = String(parameters['Menu Command y Text']);
  191. var xCommandText = String(parameters['Menu Command x Text']);
  192. var yCommand = Number(parameters['Menu Command y']);
  193. var xCommand = Number(parameters['Menu Command x']);
  194. var rowCommand = Number(parameters['Menu Command Row Displayed']);
  195. var xGold = Number(parameters['Gold Window x']);
  196. var yGold = Number(parameters['Gold Window y']);
  197. var widthGold = Number(parameters['Gold Window width']);
  198. var showGoldWindow = String(parameters['Show Gold Window']);
  199. var showItem = String(parameters['Show Item in menu']);
  200. var showSkill = String(parameters['Show Skill in menu']);
  201. var showEquip = String(parameters['Show Equip in menu']);
  202. var showStatus = String(parameters['Show Status in menu']);
  203. var showFormation = String(parameters['Show Formation in menu']);
  204. var showOptions = String(parameters['Show Options in menu']);
  205. var showSave = String(parameters['Show Save in menu']);
  206. var showGameEnd = String(parameters['Show Game End in menu']);
  207. var showStatusWindow = String(parameters['Show Status Window']);
  208. var showLocationWindow = String(parameters['Show Location Window']);
  209. var yGoldText = String(parameters['Gold Window y Text']);
  210. var xGoldText = String(parameters['Gold Window x Text']);
  211. var yStatusText = String(parameters['Menu Status y Text']);
  212. var xStatusText = String(parameters['Menu Status x Text']);
  213. var locationWidth = Number(parameters['Location Window Width']);
  214. var locationHeight = Number(parameters['Location Window Height']);
  215. var xLocation = Number(parameters['Location Window x']);
  216. var yLocation = String(parameters['Location Window y']);
  217. var xLocationText = String(parameters['Location Window x Text']);
  218. var yLocationText = String(parameters['Location Window y Text']);
  219. var bgActorX = Number(parameters['Actor Background x']);
  220. var bgActorY = Number(parameters['Actor Background y']);
  221. var bgActorYscale = Number(parameters['Actor Background y Scale']);
  222. var showActorFace = String(parameters['Show Actor Face Menu']);
  223. var showActorFaceInfo = String(parameters['Show Actor Face Status Info']);
  224. var Scene_Menu_create = Scene_Menu.prototype.create;
  225.  
  226. //============================================================
  227. // Scene_Menu
  228. //============================================================
  229.    
  230. Scene_Menu.prototype.create = function() {
  231.     Scene_Menu_create.call(this);
  232. };
  233.  
  234. Scene_Menu.prototype.createGoldWindow = function() {
  235.     this._goldWindow = new Window_Gold(0, 0);
  236.     if (widthGold != 0){this._goldWindow.width = widthGold;}
  237.     if(xGoldText != 'Disabled'){
  238.         if (xGoldText == 'Left'){this._goldWindow.x = 0}
  239.         else if (xGoldText == 'Center'){this._goldWindow.x = (Graphics.boxWidth / 2) - (this._goldWindow.width / 2)}
  240.         else if (xGoldText == 'Right'){this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width}
  241.     }
  242.     else{this._goldWindow.x = xGold}
  243.     if(yGoldText != 'Disabled'){
  244.         if (yGoldText == 'Bottom'){this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height}
  245.         else if (yGoldText == 'Center'){this._goldWindow.y = (Graphics.boxHeight / 2) - (this._goldWindow.y / 2)}
  246.         else if (yGoldText == 'Top'){this._goldWindow.y = 0}
  247.     }
  248.     else{this._goldWindow.y = yGold}   
  249.     this.addWindow(this._goldWindow);
  250. };
  251.    
  252. Scene_Menu.prototype.createStatusWindow = function() {
  253.     this._statusWindow = new Window_MenuStatus(this._commandWindow.width, 0);
  254.     if (wStatus != 0){this._statusWindow.width = wStatus};
  255.     if (hStatus != 0){this._statusWindow.height = hStatus};
  256.     if (yStatusText != 'Disabled'){
  257.         if (yStatusText == 'Top'){this._statusWindow.y = 0}
  258.         else if (yStatusText == 'Center'){this._statusWindow.y = (Graphics.boxHeight / 2) - (this._statusWindow.height / 2)}
  259.         else if (yStatusText == 'Bottom'){this._statusWindow.y = Graphics.boxHeight - this._statusWindow.height}
  260.     }
  261.     else if (yStatus != 0){this._statusWindow.y = yStatus}
  262.     if (xStatusText != 'Disabled'){
  263.         if (xStatusText == 'Left'){this._statusWindow.x = 0}
  264.         else if (xStatusText == 'Center'){this._statusWindow.x = (Graphics.boxWidth / 2) - (this._statusWindow.width / 2)}
  265.         else if (xStatusText == 'Right'){this._statusWindow.x = Graphics.boxWidth - this._statusWindow.width}
  266.         else if (xStatusText == 'After command'){this._statusWindow.x = this._commandWindow.width}
  267.     }
  268.     else if (xStatus != 0){this._statusWindow.x = xStatus}
  269.     this.addWindow(this._statusWindow);
  270. };    
  271.    
  272. Scene_Menu.prototype.create = function() {
  273.     Scene_MenuBase.prototype.create.call(this);
  274.     this.createCommandWindow();
  275.     if (showGoldWindow == 'True'){this.createGoldWindow()};
  276.     if (showStatusWindow == 'True'){this.createStatusWindow()};
  277.     if (showLocationWindow == 'True'){this.createLocationWindow()};
  278. }    
  279.    
  280. if (heightCommand != 0 ) {
  281.     Window_MenuCommand.prototype.windowHeight = function() {
  282.         return heightCommand;
  283. }}
  284. else{
  285.     Window_MenuCommand.prototype.numVisibleRows = function() {
  286.         return rowCommand;
  287. }};
  288.      
  289. Scene_Menu.prototype.start = function() {
  290.     Scene_MenuBase.prototype.start.call(this);
  291.     if (showStatusWindow == 'True'){this._statusWindow.refresh()};
  292. };
  293.      
  294. Scene_Menu.prototype.createCommandWindow = function() {
  295.     this._commandWindow = new Window_MenuCommand(0, 0);
  296.     this._commandWindow.setHandler('item',      this.commandItem.bind(this));
  297.     this._commandWindow.setHandler('skill',     this.commandPersonal.bind(this));
  298.     this._commandWindow.setHandler('equip',     this.commandPersonal.bind(this));
  299.     this._commandWindow.setHandler('status',    this.commandPersonal.bind(this));
  300.     this._commandWindow.setHandler('formation', this.commandFormation.bind(this));
  301.     this._commandWindow.setHandler('options',   this.commandOptions.bind(this));
  302.     this._commandWindow.setHandler('save',      this.commandSave.bind(this));
  303.     this._commandWindow.setHandler('gameEnd',   this.commandGameEnd.bind(this));
  304.     this._commandWindow.setHandler('cancel',    this.popScene.bind(this));
  305.     if (widthCommand != 0){this._commandWindow.width = widthCommand}
  306.     if (xCommandText != 'Disabled'){
  307.         if (xCommandText == 'Right'){this._commandWindow.x = Graphics.boxWidth - this._commandWindow.width}
  308.         else if (xCommandText == 'Center'){this._commandWindow.x = (Graphics.boxWidth / 2) - (this._commandWindow.width / 2)}
  309.         else if (xCommandText == 'Left'){this._commandWindow.x = 0}}
  310.     else{this._commandWindow.x = xCommand}
  311.     if (yCommandText != 'Disabled'){
  312.         if (yCommandText == 'Bottom'){this._commandWindow.y = Graphics.boxHeight - this._commandWindow.height}
  313.         else if(yCommandText == 'Center'){this._commandWindow.y = (Graphics.boxHeight / 2) - (this._commandWindow.height / 2)}
  314.         else if(yCommandText == 'Top'){this._commandWindow.y = 0}}
  315.     else{this._commandWindow.y = yCommand};    
  316.     this.addWindow(this._commandWindow);
  317. };
  318.  
  319. Scene_Menu.prototype.createLocationWindow = function() {
  320.     this._locationWindow = new Window_Location();
  321.     if (locationWidth != 0){this._locationWindow.width = locationWidth}
  322.     if (locationHeight != 0){this._locationWindow.height = locationHeight}
  323.     if(xLocationText != 'Disabled'){
  324.         if (xLocationText == 'Left'){this._locationWindow.x = 0}
  325.         else if (xLocationText == 'Center'){this._locationWindow.x = (Graphics.boxWidth / 2) - (this._locationWindow.width / 2)}
  326.         else if (xLocationText == 'Right'){this._locationWindow.x = Graphics.boxWidth - this._locationWindow.width}
  327.     }
  328.     else{this._locationWindow.x = xLocation}
  329.     if(yLocationText != 'Disabled'){
  330.         if (yLocationText == 'Bottom'){this._locationWindow.y = Graphics.boxHeight - this._locationWindow.height}
  331.         else if ((yLocationText == 'Before Gold') && (showGoldWindow == 'True')){this._locationWindow.y = Graphics.boxHeight - this._locationWindow.height - this._goldWindow.height}
  332.         else if (yLocationText == 'Center'){this._locationWindow.y = (Graphics.boxHeight / 2) - (this._locationWindow.y / 2)}
  333.         else if (yLocationText == 'Top'){this._locationWindow.y = 0}
  334.     }
  335.     else{this._locationWindow.y = yLocation}
  336.     this._locationWindow.margin =
  337.     this.addWindow(this._locationWindow);
  338. };  // Create location window
  339.    
  340. //=====================================================================
  341. // Window_MenuCommand
  342. //=====================================================================
  343.  
  344. Window_MenuCommand.prototype.makeCommandList = function() {
  345.     this.addMainCommands();
  346.     this.addFormationCommand();
  347.     this.addOriginalCommands();
  348.     if(showOptions == 'True'){this.addOptionsCommand()};
  349.     if(showSave == 'True'){this.addSaveCommand()};
  350.     if(showGameEnd == 'True'){this.addGameEndCommand()};
  351. };
  352.  
  353. Window_MenuCommand.prototype.addMainCommands = function() {
  354.     var enabled = this.areMainCommandsEnabled();
  355.     if (this.needsCommand('item') && (showItem == 'True')) {
  356.     this.addCommand(TextManager.item, 'item', enabled);
  357.     }
  358.     if (this.needsCommand('skill') && (showSkill == 'True')) {
  359.         this.addCommand(TextManager.skill, 'skill', enabled);
  360.     }
  361.     if (this.needsCommand('equip') && (showEquip == 'True')) {
  362.         this.addCommand(TextManager.equip, 'equip', enabled);
  363.     }
  364.     if (this.needsCommand('status') && (showStatus == 'True')) {
  365.         this.addCommand(TextManager.status, 'status', enabled);
  366.     }
  367. };
  368.  
  369. Window_MenuCommand.prototype.addFormationCommand = function() {
  370.     if (this.needsCommand('formation') && (showFormation == 'True')) {
  371.         var enabled = this.isFormationEnabled();
  372.         this.addCommand(TextManager.formation, 'formation', enabled);
  373.     }
  374. };
  375.  
  376. //=====================================================================
  377. // Window_Location
  378. //=====================================================================
  379.  
  380. function Window_Location() {
  381.     this.initialize.apply(this, arguments);
  382. }
  383.  
  384. Window_Location.prototype = Object.create(Window_Base.prototype);
  385. Window_Location.prototype.constructor = Window_Location;
  386.  
  387. Window_Location.prototype.initialize = function() {
  388.     var wight = this.windowWidth();
  389.     var height = this.windowHeight();
  390.     var x = 0;
  391.     var y = 0;
  392.     Window_Base.prototype.initialize.call(this, x, y, wight, height);
  393.     this.refresh();
  394. };
  395.  
  396. Window_Location.prototype.windowWidth = function() {
  397.     return 360;
  398. };
  399.  
  400. Window_Location.prototype.windowHeight = function() {
  401.     return this.fittingHeight(1);
  402. };
  403.  
  404. Window_Location.prototype.open = function() {
  405.     this.refresh();
  406.     Window_Base.prototype.open.call(this);
  407. };
  408.  
  409. Window_Location.prototype.refresh = function() {
  410.     this.contents.clear();
  411.         var width = this.contentsWidth();
  412.         this.drawText($gameMap.displayName(), 0, 0, 180, 'center');
  413. };
  414.  
  415. //=====================================================================
  416. // Window_MenuStatus
  417. //=====================================================================
  418. Window_MenuStatus.prototype.itemHeight = function() {
  419.     var clientHeight = this.height - this.padding * 2;
  420.     if (actorBoxH == 0){return Math.floor(clientHeight / this.numVisibleRows())}
  421.     else {return actorBoxH}
  422. };
  423.  
  424. Window_MenuStatus.prototype.drawItem = function(index) {
  425.     this.drawItemBackground(index);
  426.     if(showActorFace == 'True'){this.drawItemImage(index);}
  427.     this.drawItemStatus(index);
  428. };
  429.  
  430. //=====================================================================
  431. // Window_Status
  432. //=====================================================================
  433.  
  434. Window_Status.prototype.drawBlock2 = function(y) {
  435.     if (showActorFaceInfo == 'True'){this.drawActorFace(this._actor, 12, y);}
  436.     this.drawBasicInfo(204, y);
  437.     this.drawExpInfo(456, y);
  438. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement