Advertisement
Guest User

MOG_SceneItem.js

a guest
May 3rd, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // MOG_SceneItem.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc (v1.1) Modifica a cena de menu de items.
  7.  * @author Moghunter
  8.  *
  9.  * @param Item Width
  10.  * @desc Largura da janela de items.
  11.  * @default 370
  12.  *
  13.  * @param Item Height
  14.  * @desc Altura da janela de items.
  15.  * @default 400
  16.  *
  17.  * @param Item X-Axis
  18.  * @desc Definição X-Axis da janela de items.
  19.  * @default 0
  20.  *
  21.  * @param Item Y-Axis
  22.  * @desc Definição Y-Axis da janela de items.
  23.  * @default 96
  24.  *
  25.  * @param W Layout X-Axis
  26.  * @desc Definição X-Axis do layout janela de items.
  27.  * @default 0
  28.  *
  29.  * @param W Layout Y-Axis
  30.  * @desc Definição Y-Axis do layout janela de items.
  31.  * @default 0
  32.  *
  33.  * @param Help X-Axis
  34.  * @desc Definição X-Axis da janela de ajuda.
  35.  * @default 0
  36.  *
  37.  * @param Help Y-Axis
  38.  * @desc Definição Y-Axis da janela de ajuda.
  39.  * @default 516
  40.  *
  41.  * @param Com Item X-Axis
  42.  * @desc Definição X-Axis do comando Item.
  43.  * @default 280
  44.  *
  45.  * @param Com Item Y-Axis
  46.  * @desc Definição Y-Axis do comando Item.
  47.  * @default 50
  48.  *
  49.  * @param Com Weapon X-Axis
  50.  * @desc Definição X-Axis do comando Weapon.
  51.  * @default 420
  52.  *
  53.  * @param Com Weapon Y-Axis
  54.  * @desc Definição Y-Axis do comando Weapon.
  55.  * @default 50
  56.  *
  57.  * @param Com Armour X-Axis
  58.  * @desc Definição X-Axis do comando Armour.
  59.  * @default 560
  60.  *
  61.  * @param Com Armour Y-Axis
  62.  * @desc Definição Y-Axis do comando Armour.
  63.  * @default 50
  64.  *
  65.  * @param Com Key X-Axis
  66.  * @desc Definição X-Axis do comando Key.
  67.  * @default 700
  68.  *
  69.  * @param Com Key Y-Axis
  70.  * @desc Definição Y-Axis do comando Key.
  71.  * @default 50
  72.  *
  73.  * @param Actor Windows X-Axis
  74.  * @desc Definição X-Axis da janela do personagem.
  75.  * @default 600
  76.  *
  77.  * @param Actor Windows Y-Axis
  78.  * @desc Definição Y-Axis da janela do personagem .
  79.  * @default 200
  80.  *
  81.  * @param Actor Face X-Axis
  82.  * @desc Definição X-Axis da face do personagem.
  83.  * @default 90
  84.  *
  85.  * @param Actor Face Y-Axis
  86.  * @desc Definição Y-Axis da face do personagem .
  87.  * @default -65
  88.  *
  89.  * @param Actor States X-Axis
  90.  * @desc Definição X-Axis da condição do personagem.
  91.  * @default 23
  92.  *
  93.  * @param Actor States Y-Axis
  94.  * @desc Definição Y-Axis da condição do personagem .
  95.  * @default 15
  96.  *
  97.  * @param Actor Parameters X-Axis
  98.  * @desc Definição X-Axis dos parâmetros do personagem.
  99.  * @default 0
  100.  *
  101.  * @param Actor Parameters Y-Axis
  102.  * @desc Definição Y-Axis da parâmetros do personagem .
  103.  * @default 0
  104.  *
  105.  * @param Actor Parameters FontSize
  106.  * @desc Definição do tamanho da fonte dos parâmetros.
  107.  * @default 20
  108.  *
  109.  * @param Party Window X-Axis
  110.  * @desc Definição X-Axis da janela do grupo.
  111.  * @default 10
  112.  *
  113.  * @param Party Window Y-Axis
  114.  * @desc Definição Y-Axis da janela do grupo.
  115.  * @default 240
  116.  *
  117.  * @param Party Font Size
  118.  * @desc Definição do tamanho do texto.
  119.  * @default 20
  120.  *
  121.  * @param Party Name X-Axis
  122.  * @desc Definição X-Axis do nome.
  123.  * @default 20
  124.  *
  125.  * @param Party Name X-Axis
  126.  * @desc Definição Y-Axis do nome.
  127.  * @default 40
  128.  *
  129.  * @param Party HPNumber X-Axis
  130.  * @desc Definição X-Axis do número de HP.
  131.  * @default 20
  132.  *
  133.  * @param Party HPNumber Y-Axis
  134.  * @desc Definição Y-Axis do número de HP.
  135.  * @default 3
  136.  *
  137.  * @param Party MPNumber X-Axis
  138.  * @desc Definição X-Axis do número de MP.
  139.  * @default 118
  140.  *
  141.  * @param Party MPNumber Y-Axis
  142.  * @desc Definição Y-Axis do número de MP.
  143.  * @default 3
  144.  *
  145.  * @param Party HPMeter X-Axis
  146.  * @desc Definição X-Axis do medidor de HP.
  147.  * @default 16
  148.  *
  149.  * @param Party HPMeter Y-Axis
  150.  * @desc Definição Y-Axis do medidor de HP.
  151.  * @default 30
  152.  *
  153.  * @param Party MPMeter X-Axis
  154.  * @desc Definição X-Axis do medidor de MP.
  155.  * @default 113
  156.  *
  157.  * @param Party MPMeter Y-Axis
  158.  * @desc Definição Y-Axis do medidor de MP.
  159.  * @default 30
  160.  *
  161.  * @param Party Status X-Axis
  162.  * @desc Definição X-Axis das condições.
  163.  * @default 165
  164.  *
  165.  * @param Party Status Y-Axis
  166.  * @desc Definição Y-Axis das condições.
  167.  * @default 30
  168.  *
  169.  * @help  
  170.  * =============================================================================
  171.  * +++ MOG - Scene Item (v1.1) +++
  172.  * By Moghunter
  173.  * https://atelierrgss.wordpress.com/
  174.  * =============================================================================
  175.  * Modifica a cena de items.
  176.  *
  177.  * =============================================================================
  178.  * UTILIZAÇÃO
  179.  * =============================================================================
  180.  * As imagens do sistema deverão ser gravados na pasta.
  181.  *
  182.  * /img/menus/item/
  183.  *
  184.  * =============================================================================
  185.  * HISTÓRICO
  186.  * =============================================================================
  187.  * (v1.1) - Correção do crash ao usar itens de eventos comum.
  188.  *
  189.  */
  190.  
  191. //=============================================================================
  192. // ** PLUGIN PARAMETERS
  193. //=============================================================================
  194.   var Imported = Imported || {};
  195.   Imported.MOG_SceneMenu = true;
  196.   var Moghunter = Moghunter || {};
  197.  
  198.    Moghunter.parameters = PluginManager.parameters('MOG_SceneItem');
  199.  
  200.     Moghunter.scItem_ItemWindowWidth = Number(Moghunter.parameters['Item Width'] || 370);
  201.     Moghunter.scItem_ItemWindowHeight = Number(Moghunter.parameters['Item Height'] || 400);
  202.     Moghunter.scItem_ItemWindowX = Number(Moghunter.parameters['Item X-Axis'] || 0);
  203.     Moghunter.scItem_ItemWindowY = Number(Moghunter.parameters['Item Y-Axis'] || 96);
  204.     Moghunter.scItem_HelpWindowX = Number(Moghunter.parameters['Help X-Axis'] || 0);
  205.     Moghunter.scItem_HelpWindowY = Number(Moghunter.parameters['Help Y-Axis'] || 516);
  206.     Moghunter.scItem_WlayoutX = Number(Moghunter.parameters['W Layout X-Axis'] || 0);
  207.     Moghunter.scItem_WlayoutY = Number(Moghunter.parameters['W Layout Y-Axis'] || 0);  
  208.     Moghunter.scItem_Com1_X = Number(Moghunter.parameters['Com Item X-Axis'] || 280);
  209.     Moghunter.scItem_Com1_Y = Number(Moghunter.parameters['Com Item Y-Axis'] || 50);  
  210.     Moghunter.scItem_Com2_X = Number(Moghunter.parameters['Com Weapon X-Axis'] || 420);
  211.     Moghunter.scItem_Com2_Y = Number(Moghunter.parameters['Com Weapon Y-Axis'] || 50);             
  212.     Moghunter.scItem_Com3_X = Number(Moghunter.parameters['Com Armour X-Axis'] || 560);
  213.     Moghunter.scItem_Com3_Y = Number(Moghunter.parameters['Com Armour Y-Axis'] || 50);  
  214.     Moghunter.scItem_Com4_X = Number(Moghunter.parameters['Com Key X-Axis'] || 700);
  215.     Moghunter.scItem_Com4_Y = Number(Moghunter.parameters['Com Key Y-Axis'] || 50);
  216.                        
  217.     Moghunter.scItem_ActorWinX = Number(Moghunter.parameters['Actor Windows X-Axis'] || 600);
  218.     Moghunter.scItem_ActorWinY = Number(Moghunter.parameters['Actor Windows Y-Axis'] || 200);              
  219.     Moghunter.scItem_ActorFaceX = Number(Moghunter.parameters['Actor Face X-Axis'] || 90);
  220.     Moghunter.scItem_ActorFaceY = Number(Moghunter.parameters['Actor Face Y-Axis'] || -65);
  221.     Moghunter.scItem_ActorStatesX = Number(Moghunter.parameters['Actor States X-Axis'] || 23);
  222.     Moghunter.scItem_ActorStatesY = Number(Moghunter.parameters['Actor States Y-Axis'] || 15);
  223.     Moghunter.scItem_ActorParX = Number(Moghunter.parameters['Actor Parameters X-Axis'] || 0);
  224.     Moghunter.scItem_ActorParY = Number(Moghunter.parameters['Actor Parameters Y-Axis'] || 0);
  225.     Moghunter.scItem_ActorParFontSize = Number(Moghunter.parameters['Actor Parameters FontSize'] || 20);
  226.     Moghunter.scItem_PartyX = Number(Moghunter.parameters['Party Window X-Axis'] || 10);
  227.     Moghunter.scItem_PartyY = Number(Moghunter.parameters['Party Window Y-Axis'] || 240);
  228.     Moghunter.scItem_PartyFontSize = Number(Moghunter.parameters['Party Font Size'] || 20);
  229.     Moghunter.scItem_PartyNameX = Number(Moghunter.parameters['Party Name X-Axis'] || 20);
  230.     Moghunter.scItem_PartyNameY = Number(Moghunter.parameters['Party Name Y-Axis'] || 40); 
  231.     Moghunter.scItem_PartyHPNumberX = Number(Moghunter.parameters['Party HPNumber X-Axis'] || 20);
  232.     Moghunter.scItem_PartyHPNumberY = Number(Moghunter.parameters['Party HPNumber Y-Axis'] || 3);  
  233.     Moghunter.scItem_PartyMPNumberX = Number(Moghunter.parameters['Party MPNumber X-Axis'] || 118);
  234.     Moghunter.scItem_PartyMPNumberY = Number(Moghunter.parameters['Party MPNumber Y-Axis'] || 3);      
  235.     Moghunter.scItem_PartyHPMeterX = Number(Moghunter.parameters['Party HPMeter X-Axis'] || 16);
  236.     Moghunter.scItem_PartyHPMeterY = Number(Moghunter.parameters['Party HPMeter Y-Axis'] || 30);   
  237.     Moghunter.scItem_PartyMPMeterX = Number(Moghunter.parameters['Party MPMeter X-Axis'] || 113);
  238.     Moghunter.scItem_PartyMPMeterY = Number(Moghunter.parameters['Party MPMeter Y-Axis'] || 30);   
  239.     Moghunter.scItem_PartyStatusX = Number(Moghunter.parameters['Party Status X-Axis'] || 165);
  240.     Moghunter.scItem_PartyStatusY = Number(Moghunter.parameters['Party Stauts Y-Axis'] || 39); 
  241.    
  242. //=============================================================================
  243. // ** ImageManager
  244. //=============================================================================
  245.  
  246. //==============================
  247. // * Item
  248. //==============================
  249. ImageManager.loadMenusitem = function(filename) {
  250.     return this.loadBitmap('img/menus/item/', filename, 0, true);
  251. };
  252.  
  253. //==============================
  254. // * Actor
  255. //==============================
  256. ImageManager.loadMenusActor = function(filename) {
  257.     return this.loadBitmap('img/menus/actorwindow/', filename, 0, true);
  258. };
  259.  
  260. //=============================================================================
  261. // ** Scene Item
  262. //=============================================================================
  263.  
  264. //==============================
  265. // * creaate
  266. //==============================
  267. var _mog_scnItem_create = Scene_Item.prototype.create;
  268. Scene_Item.prototype.create = function() {
  269.     _mog_scnItem_create.call(this);
  270.     this.loadBitmaps();
  271.     this._helpWindow.opacity = 0;
  272.     this._helpWindow.x = Moghunter.scItem_HelpWindowX;
  273.     this._helpWindow.y = Moghunter.scItem_HelpWindowY;
  274.     this._categoryWindow.visible = false;
  275.     this._categoryWindow.active = false;
  276.     this._itemWindow.active = true;
  277.     this._itemWindow.select(0);
  278.     this._itemWindow.contentsOpacity = 0;
  279.     this._itemWindow.x = this._itemPosOrg[0] - 50;
  280.     this._actorStatusIndex = this._actorWindow._index;
  281.     this._actorStatus = $gameParty.members()[this._actorWindow._index];
  282.     this._wani = [-1,1,null];
  283. };
  284.  
  285. //==============================
  286. // * create Background
  287. //==============================
  288. var _mog_scItem_createBackground = Scene_Item.prototype.createBackground;
  289. Scene_Item.prototype.createBackground = function() {
  290.     _mog_scItem_createBackground.call(this);
  291.     this._field = new Sprite();
  292.     this.addChild(this._field);
  293. }
  294.  
  295. //==============================
  296. // * loadBitmaps
  297. //==============================
  298. Scene_Item.prototype.loadBitmaps = function() {
  299.     this._layImg = (ImageManager.loadMenusitem("Layout"));
  300.     this._layItemImg = (ImageManager.loadMenusitem("ItemLayout"));
  301.     this._comImg = [];
  302.     for (var i = 0; i < 4; i++) {
  303.         this._comImg[i] = ImageManager.loadMenusitem("Com_" + i);
  304.     };
  305. };
  306.  
  307. //==============================
  308. // * create Sprites
  309. //==============================
  310. Scene_Item.prototype.createSprites = function() {
  311.     this.createLayout();
  312.     this.createItemLayout();
  313.     //this.createButtons();
  314.     this.createPartyData();
  315. };
  316.  
  317. //==============================
  318. // * create Sprites
  319. //==============================
  320. Scene_Item.prototype.createLayout = function() {
  321.     this._layout = new Sprite(this._layImg);
  322.     this._field.addChild(this._layout);
  323. };
  324.  
  325. //==============================
  326. // * create Item Layout
  327. //==============================
  328. Scene_Item.prototype.createItemLayout = function() {
  329.     this._layoutItem = new Sprite(this._layItemImg);
  330.     this._layoutItem.opacity = 0;
  331.     this._field.addChild(this._layoutItem);
  332. };
  333.  
  334. //==============================
  335. // * create Buttons
  336. //==============================
  337. Scene_Item.prototype.createButtons = function() {
  338.     this._buttons = [];
  339.     this._buttonsAni = [];
  340.     for (var i = 0; i < 4; i++) {
  341.          this._buttonsAni[i] = 0;
  342.          this._buttons[i] = new Sprite(this._comImg[i]);
  343.          this._buttons[i].anchor.x = 0.5;
  344.          this._buttons[i].anchor.y = 0.5;
  345.         if (i === 0) {
  346.              this._buttons[i].x = Moghunter.scItem_Com1_X;
  347.              this._buttons[i].y = Moghunter.scItem_Com1_Y;
  348.          } else if (i === 1) {
  349.              this._buttons[i].x = Moghunter.scItem_Com2_X;
  350.              this._buttons[i].y = Moghunter.scItem_Com2_Y;
  351.          } else if (i === 2) {
  352.              this._buttons[i].x = Moghunter.scItem_Com3_X;
  353.              this._buttons[i].y = Moghunter.scItem_Com3_Y;
  354.          } else if (i === 3) {
  355.              this._buttons[i].x = Moghunter.scItem_Com4_X;
  356.              this._buttons[i].y = Moghunter.scItem_Com4_Y;
  357.          };
  358.          this._field.addChild(this._buttons[i]);
  359.     };
  360. };
  361.  
  362. //==============================
  363. // * update Buttons
  364. //==============================
  365. Scene_Item.prototype.updateButtons = function() {
  366.     for (var i = 0; i < this._buttons.length; i++) {
  367.          if (this._categoryWindow._index === i && !this._actorWindow.active) {
  368.              if (this._buttonsAni[i] === 0) {
  369.                  this._buttons[i].scale.x += 0.010;
  370.                  if (this._buttons[i].scale.x >= 1.30) {
  371.                      this._buttons[i].scale.x = 1.30;
  372.                      this._buttonsAni[i] = 1;
  373.                  };
  374.              } else  {
  375.                  this._buttons[i].scale.x -= 0.010;
  376.                  if (this._buttons[i].scale.x <= 1.00) {
  377.                      this._buttons[i].scale.x = 1.00;
  378.                      this._buttonsAni[i] = 0;
  379.                  };              
  380.              };
  381.              this._buttons[i].opacity += 20;         
  382.          } else {
  383.              this._buttonsAni[i] = 0
  384.              if (this._buttons[i].scale.x >= 1.00) {
  385.                  this._buttons[i].scale.x -= 0.010;
  386.                  if (this._buttons[i].scale.x <= 1.00) {
  387.                      this._buttons[i].scale.x = 1.00;
  388.                  };
  389.              };
  390.              if (this._buttons[i].opacity > 180) {
  391.                  this._buttons[i].opacity -= 15;
  392.              };  
  393.          };
  394.          
  395.          this._buttons[i].scale.y = this._buttons[i].scale.x;
  396.     };
  397. };
  398.  
  399.  
  400. //==============================
  401. // * update Item Layout
  402. //==============================
  403. Scene_Item.prototype.updateItemLayout = function() {
  404.     this._layoutItem.x = this._itemWindow.x + Moghunter.scItem_WlayoutX;
  405.     this._layoutItem.y = this._itemWindow.y + Moghunter.scItem_WlayoutY;
  406.     this._layoutItem.opacity = this._itemWindow.contentsOpacity;
  407.  
  408. };
  409.  
  410. //==============================
  411. // * create Item Window
  412. //==============================
  413. Scene_Item.prototype.createItemWindow = function() {
  414.     var ww = Moghunter.scItem_ItemWindowWidth;
  415.     var wh = Moghunter.scItem_ItemWindowHeight;
  416.     var wx = Moghunter.scItem_ItemWindowX + ((Graphics.boxWidth / 2) - (ww / 2));
  417.     var wy = Moghunter.scItem_ItemWindowY;
  418.     this._itemWindow = new Window_ItemListM(wx, wy, ww, wh);
  419.     this._itemWindow.setHelpWindow(this._helpWindow);
  420.     this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
  421.     this._itemWindow.setHandler('cancel', this.popScene.bind(this));
  422.     this.addWindow(this._itemWindow);
  423.     this._categoryWindow.setItemWindow(this._itemWindow);
  424.     this._itemPosOrg = [this._itemWindow.x,this._itemWindow.y];
  425.     this._itemWindow.contentsOpacity = 0;
  426. };
  427.  
  428. //==============================
  429. // * update Default Window
  430. //==============================
  431. Scene_Item.prototype.updateDefaultWindow = function() {
  432.     this._helpWindow.opacity = 0;
  433.     this._categoryWindow.opacity = 0;
  434.     this._categoryWindow.x =  -this._categoryWindow.width;
  435. };
  436.  
  437. //==============================
  438. // * update Commands
  439. //==============================
  440. Scene_Item.prototype.updateCommands = function() {
  441.     if (this._itemWindow.active && this._wani[0] === 0) {
  442.           if (Input.isTriggered('right')) {this._wani = [1,0,null]; SoundManager.playCursor()};
  443.           if (Input.isTriggered('left')) {this._wani = [-1,0,null]; SoundManager.playCursor()};
  444.     };
  445. };
  446.  
  447. //==============================
  448. // * addCatIndex
  449. //==============================
  450. Scene_Item.prototype.addCatIndex = function(value) {
  451.      this._categoryWindow._index += value;
  452.      if (this._categoryWindow._index > 3) {this._categoryWindow._index = 0};
  453.      if (this._categoryWindow._index < 0) {this._categoryWindow._index = 3};
  454.      if (this._wani[2] != null) {this._categoryWindow._index = this._wani[2]}
  455.      this._categoryWindow.update();
  456.      this._itemWindow.select(0);
  457.      this._itemWindow.updateHelp();
  458. };
  459.  
  460. //==============================
  461. // * addCatIndex
  462. //==============================
  463. Scene_Item.prototype.updateItemWindow = function() {
  464.     if (this._wani[0] != 0) {
  465.         if (this._wani[0] === 1){
  466.             this.waniSlideRight();
  467.         } else {
  468.             this.waniSlideLeft();
  469.         };
  470.     };
  471.     if (this._wani[0] === 0) {
  472.         if (this._itemWindow.active) {
  473.             this._itemWindow.contentsOpacity += 15;
  474.         } else {
  475.             if (this._itemWindow.contentsOpacity > 160) {
  476.                 this._itemWindow.contentsOpacity -= 15;
  477.             };
  478.         };
  479.     };
  480. };
  481.  
  482. //==============================
  483. // * wani Slide Right
  484. //==============================
  485. Scene_Item.prototype.waniSlideRight = function() {
  486.     if (this._wani[1] === 0 ) {
  487.         this._itemWindow.x += 5
  488.         this._itemWindow.contentsOpacity -= 25;
  489.         if (this._itemWindow.contentsOpacity <= 0) {
  490.             this._wani[1] = 1;
  491.             this._itemWindow.x = this._itemPosOrg[0] - 50;
  492.             this.addCatIndex(this._wani[0])
  493.         };
  494.     } else {
  495.         this._itemWindow.x += 5
  496.         this._itemWindow.contentsOpacity += 25;
  497.         if (this._itemWindow.x >= this._itemPosOrg[0]) {
  498.             this._itemWindow.x = this._itemPosOrg[0];
  499.             this._itemWindow.contentsOpacity = 255;
  500.             this._wani = [0,0,null];
  501.         };
  502.     };
  503. };
  504.  
  505. //==============================
  506. // * wani Slide Left
  507. //==============================
  508. Scene_Item.prototype.waniSlideLeft = function() {
  509.     if (this._wani[1] === 0 ) {
  510.         this._itemWindow.x -= 5
  511.         this._itemWindow.contentsOpacity -= 25;
  512.         if (this._itemWindow.contentsOpacity <= 0) {
  513.             this._wani[1] = 1;
  514.             this._itemWindow.x = this._itemPosOrg[0] + 50;
  515.             this.addCatIndex(this._wani[0])
  516.         };
  517.     } else {
  518.         this._itemWindow.x -= 5
  519.         this._itemWindow.contentsOpacity += 25;
  520.         if (this._itemWindow.x <= this._itemPosOrg[0]) {
  521.             this._itemWindow.x = this._itemPosOrg[0];
  522.             this._itemWindow.contentsOpacity = 255;
  523.             this._wani = [0,0,null];
  524.         };
  525.     };
  526. };
  527.  
  528. //==============================
  529. // * checkTouchOn Sprites
  530. //==============================
  531. Scene_Item.prototype.checkTouchOnSprites = function() {
  532.      if (this._itemWindow.active) {
  533.          for (var i = 0; i < this._buttons.length; i++) {
  534.               if (this.isOnSprite(this._buttons[i])) {this.setTouchType(i)};
  535.          };
  536.      } else if (this._actorWindow.active) {
  537.          var touch = false;
  538.          for (var i = 0; i < this._partyWindow.length; i++) {
  539.                if (this.isOnSprite2(this._partyWindow[i])) {this.setTouchParty(i);touch = true};
  540.          };
  541.          if (!this._actorWindow._cursorAll) {
  542.             for (var i = 0; i < this._partyArrow.length; i++) {
  543.                 if (this.isOnSprite( this._partyArrow[i])) {this.setTouchArrow(i);touch = true};
  544.             };
  545.          };
  546.          if (!touch) {
  547.              if (this.isOnSprite3(this._itemWindow)) {this.setTouchCancelPartyWindow();touch = true};
  548.          };
  549.          if (!touch) {
  550.              for (var i = 0; i < this._buttons.length; i++) {
  551.                   if (this.isOnSprite(this._buttons[i])) {this.setTouchType(i)
  552.                       this.setTouchCancelPartyWindow();
  553.                   };
  554.              };
  555.          };              
  556.      };
  557. };
  558.  
  559. //==============================
  560. // * setTouchCancelPartyWindow
  561. //==============================
  562. Scene_Item.prototype.setTouchCancelPartyWindow = function() {
  563.       this._itemWindow.active = true;
  564.       this._actorWindow.active = false;
  565.       this._actorWindow._cursorAll = false;
  566. };
  567.  
  568. //==============================
  569. // * Set Touch Party
  570. //==============================
  571. Scene_Item.prototype.setTouchParty = function(index) {
  572.       var pIndex = this._actorWindow._index
  573.       this._actorWindow._index = index;
  574.       this._actorWindow.processOk();
  575.       this._actorWindow._index = pIndex;
  576. };
  577.  
  578. //==============================
  579. // * Set Touch Arrow
  580. //==============================
  581. Scene_Item.prototype.setTouchArrow = function(index) {
  582.    if (index === 0) {
  583.         this.addIndexActorWindow(1);  
  584.    } else {
  585.        this.addIndexActorWindow(-1);
  586.    };
  587. };
  588.  
  589. //==============================
  590. // * Set Touch Type
  591. //==============================
  592. Scene_Item.prototype.setTouchType = function(index) {
  593.    this._wani = [1,0,index];
  594.     SoundManager.playCursor();
  595. };
  596.  
  597. //==============================
  598. // * add Index Actor Window
  599. //==============================
  600. Scene_Item.prototype.addIndexActorWindow = function(value) {
  601.     this._actorWindow._index += value;
  602.     if (this._actorWindow._index >= $gameParty.members().length) {this._actorWindow._index = 0};
  603.     if (this._actorWindow._index < 0) {this._actorWindow._index = $gameParty.members().length - 1};
  604.     SoundManager.playCursor();
  605. };
  606.  
  607. //==============================
  608. // * on Sprite
  609. //==============================
  610. Scene_Item.prototype.isOnSprite = function(sprite) {
  611.      var cw = sprite.bitmap.width / 2;
  612.      var ch = sprite.bitmap.height / 2;
  613.      if (sprite.visible === false) {return false};
  614.      if (sprite.opacity === 0) {return false};
  615.      if (TouchInput.x < sprite.x - cw) {return false};
  616.      if (TouchInput.x > sprite.x + cw) {return false};
  617.      if (TouchInput.y < sprite.y - ch) {return false};
  618.      if (TouchInput.y > sprite.y + ch) {return false};
  619.      return true;  
  620. };
  621.  
  622. //==============================
  623. // * on Sprite
  624. //==============================
  625. Scene_Item.prototype.isOnSprite2 = function(sprite) {
  626.      var cw = sprite.bitmap.width;
  627.      var ch = sprite.bitmap.height;
  628.      if (sprite.visible === false) {return false};
  629.      if (sprite.opacity === 0) {return false};
  630.      if (TouchInput.x < sprite.x ) {return false};
  631.      if (TouchInput.x > sprite.x + cw) {return false};
  632.      if (TouchInput.y < sprite.y ) {return false};
  633.      if (TouchInput.y > sprite.y + ch) {return false};
  634.      return true;  
  635. };
  636.  
  637. //==============================
  638. // * on Sprite
  639. //==============================
  640. Scene_Item.prototype.isOnSprite3 = function(sprite) {
  641.      var cw = sprite.width;
  642.      var ch = sprite.height;
  643.      if (sprite.visible === false) {return false};
  644.      if (sprite.contentsOpacity === 0) {return false};
  645.      if (TouchInput.x < sprite.x ) {return false};
  646.      if (TouchInput.x > sprite.x + cw) {return false};
  647.      if (TouchInput.y < sprite.y ) {return false};
  648.      if (TouchInput.y > sprite.y + ch) {return false};
  649.      return true;  
  650. };
  651.  
  652. //==============================
  653. // * update Touch Screen
  654. //==============================
  655. Scene_Item.prototype.updateTouchScreen = function() {
  656.     if (TouchInput.isTriggered()) {this.checkTouchOnSprites()};
  657. };
  658.  
  659.  
  660. //==============================
  661. // * update Actor Status
  662. //==============================
  663. Scene_Item.prototype.updateActorStatus = function() {
  664.     if (this._actorStatusIndex != this._actorWindow._index) {this.refreshStatusActor()};
  665.     this._actorWindow.visible = false;
  666.     this._actorWindow.x = -this._actorWindow.width;
  667.     if (this._actorDataWindow) {this.updateActorDataWindow()};
  668. };
  669.  
  670. //==============================
  671. // * update Actor Data Window
  672. //==============================
  673. Scene_Item.prototype.updateActorDataWindow = function() {
  674.     if (this._actorWindow.active) {
  675.         var nx = Moghunter.scItem_ActorWinX;
  676.         var ny = Moghunter.scItem_ActorWinY;
  677.          this._actorDataWindow.opacity += 15;
  678.     } else {
  679.         var nx = Moghunter.scItem_ActorWinX + 100;
  680.         var ny = Moghunter.scItem_ActorWinY;   
  681.         this._actorDataWindow.opacity -= 15;
  682.     };
  683.     this._actorDataWindow.x = this.commandMoveTo(this._actorDataWindow.x,nx,20);
  684.     this._actorDataWindow.y = this.commandMoveTo(this._actorDataWindow.y,ny,20);
  685.     this.updatePartyWindow();
  686. };
  687.  
  688. //==============================
  689. // * Command Move To
  690. //==============================
  691. Scene_Item.prototype.commandMoveTo = function(value,real_value,speed) {
  692.     if (value == real_value) {return value};
  693.     var dnspeed = 3 + (Math.abs(value - real_value) / speed);
  694.     if (value > real_value) {value -= dnspeed;
  695.         if (value < real_value) {value = real_value};}
  696.     else if (value < real_value) {value  += dnspeed;
  697.         if (value  > real_value) {value  = real_value};    
  698.     };
  699.     return Math.floor(value);
  700. }; 
  701.  
  702. //==============================
  703. // * refresh Status Actor
  704. //==============================
  705. Scene_Item.prototype.refreshStatusActor = function() {
  706.     this._actorStatusIndex = this._actorWindow._index;
  707.     this._actorStatus = $gameParty.members()[this._actorWindow._index];
  708.     if (this._actorStatus && !this._actorDataWindow) {this.createActorDataWindow()
  709.     } else {
  710.        if (this._actorStatus) {
  711.            this._actorDataWindow.setActor(this._actorStatus)
  712.            this._actorDataWindow.x = Moghunter.scItem_ActorWinX + 100;
  713.            this._actorDataWindow.y = Moghunter.scItem_ActorWinY;   
  714.            this._actorDataWindow.opacity = 0;          
  715.       };   
  716.     };
  717. };
  718.  
  719. //==============================
  720. // * create Actor Data Window
  721. //==============================
  722. Scene_Item.prototype.createActorDataWindow = function() {
  723.     this._actorDataWindow = new ActorDataWindow();
  724.     this._actorDataWindow.x = Moghunter.scItem_ActorWinX + 100;
  725.     this._actorDataWindow.y = Moghunter.scItem_ActorWinY;  
  726.     this._actorDataWindow.opacity = 0;
  727.     this._actorDataWindow.setActor(this._actorStatus);
  728.     this.addChild(this._actorDataWindow);
  729. };
  730.  
  731. //==============================
  732. // * create Party Data
  733. //==============================
  734. Scene_Item.prototype.createPartyData = function() {
  735.     this._partyWindow = [];
  736.     this._partyPos = [];
  737.     this._partyAni = [];
  738.     this._partyPos[0] = [Moghunter.scItem_PartyX,Moghunter.scItem_PartyY];
  739.     this._partyPos[1] = [Moghunter.scItem_PartyX - 290,Moghunter.scItem_PartyY];
  740.     this._partyPos[2] = [Moghunter.scItem_PartyX - 20,Moghunter.scItem_PartyY - 100];
  741.     this._partyPos[3] = [Moghunter.scItem_PartyX - 20,Moghunter.scItem_PartyY + 100];
  742.     for (var i = 0; i < $gameParty.members().length; i++) {
  743.         this._partyWindow[i] = new PartyWindowData($gameParty.members()[i]);
  744.         this._partyWindow[i].opacity = 0;
  745.         this._partyAni[i] = [0,0];
  746.         this.addChild(this._partyWindow[i]);
  747.     };
  748.     this.createPartyArrow();
  749.     this.createAllMembersScope();
  750. };
  751.  
  752. //==============================
  753. // * refresh Part Data
  754. //==============================
  755. Scene_Item.prototype.refreshPartyData = function() {
  756.     for (var i = 0; i < this._partyWindow.length; i++) {
  757.         this._partyWindow[i].refresh();
  758.     };
  759.     this._actorDataWindow.refresh();
  760. };
  761.  
  762. //==============================
  763. // * update Party Window
  764. //==============================
  765. Scene_Item.prototype.updatePartyWindow = function() {
  766.      for (var i = 0; i < this._partyWindow.length; i++) {
  767.          if (this._actorWindow.active) {
  768.              var c = this._actorWindow._index;
  769.              var n = this._actorWindow._index + 1;
  770.              var p = this._actorWindow._index - 1;
  771.              if (n >= $gameParty.members().length) {n = 0};
  772.              if (p < 0) {p = $gameParty.members().length - 1};
  773.              if (i === c) {
  774.                  var nx = this._partyPos[0][0];
  775.                  var ny = this._partyPos[0][1];
  776.                  this._partyWindow[i].opacity += 25;
  777.                  this.updateSlidePartyWin(i);  
  778.              } else {
  779.                  this._partyAni[i] = [0,0];
  780.                  if (p === i) {
  781.                      var nx = this._partyPos[2][0];
  782.                      var ny = this._partyPos[2][1];
  783.                  } else if (n === i) {
  784.                      var nx = this._partyPos[3][0];
  785.                      var ny = this._partyPos[3][1];                  
  786.                  } else {
  787.                      var nx = this._partyPos[1][0];
  788.                      var ny = this._partyPos[1][1];              
  789.                  };
  790.                  if (this._partyWindow[i].opacity > 160) {
  791.                      this._partyWindow[i].opacity -= 15;
  792.                      if (this._partyWindow[i].opacity < 160) {
  793.                          this._partyWindow[i].opacity = 160;
  794.                      };
  795.                  } else if (this._partyWindow[i].opacity < 160) {
  796.                      this._partyWindow[i].opacity += 15;
  797.                      if (this._partyWindow[i].opacity > 160) {
  798.                          this._partyWindow[i].opacity = 160;
  799.                      };                  
  800.                  };
  801.              };
  802.          } else {
  803.              var nx = this._partyPos[1][0];
  804.              var ny = this._partyPos[1][1];
  805.              this._partyAni[i] = [0,0];
  806.              this._partyWindow[i].opacity -= 25;
  807.          };
  808.          nx += this._partyAni[i][0];
  809.          this._partyWindow[i].x = this.commandMoveTo(this._partyWindow[i].x,nx,20);
  810.          this._partyWindow[i].y = this.commandMoveTo(this._partyWindow[i].y,ny,20);
  811.      };
  812.      this.updatePartyArrow();
  813.      this.updateAllMembersSprite();
  814. };
  815.  
  816. //==============================
  817. // * update Slide Party Win
  818. //==============================
  819. Scene_Item.prototype.updateSlidePartyWin = function(i) {
  820.     this._partyAni[i][1]++;
  821.     if (this._partyAni[i][1] < 30) {
  822.         this._partyAni[i][0] += 0.2;
  823.     } else if (this._partyAni[i][1] < 60) {
  824.         this._partyAni[i][0] -= 0.2;
  825.     } else {
  826.         this._partyAni[i] = [0,0];
  827.     };
  828. };
  829.  
  830. //==============================
  831. // * update Party Arrow
  832. //==============================
  833. Scene_Item.prototype.updatePartyArrow = function() {
  834.     for (var i = 0; i < this._partyArrow.length; i++) {
  835.          if (this._actorWindow.active) {
  836.              this.updateSlidePartyArrow();
  837.              var cw = this._partyWindow[0].width / 2;
  838.              var ch = this._partyWindow[0].height;
  839.              if (i === 0) {
  840.                  var nx = this._partyPos[2][0] + cw;
  841.                  var ny = this._partyPos[2][1] - this._partyArrow[i].height;   
  842.                   ny += this._partyArrowAni[0];              
  843.              } else {
  844.                  var nx = this._partyPos[3][0] + cw;
  845.                  var ny = this._partyPos[3][1] + ch + this._partyArrow[i].height;  
  846.                   ny += -this._partyArrowAni[0];
  847.              };
  848.              this._partyArrow[i].opacity += 15;
  849.          } else {
  850.              var nx = this._partyPos[1][0];
  851.              var ny = this._partyPos[1][1];
  852.              this._partyArrow[i].opacity -= 15;    
  853.          };
  854.          this._partyArrow[i].x = this.commandMoveTo(this._partyArrow[i].x,nx,20);
  855.          this._partyArrow[i].y = this.commandMoveTo(this._partyArrow[i].y,ny,20);            
  856.     };
  857. };
  858.  
  859. //==============================
  860. // * update Slide Party Arrow
  861. //==============================
  862. Scene_Item.prototype.updateSlidePartyArrow = function() {
  863.     this._partyArrowAni[1]++;
  864.     if (this._partyArrowAni[1] < 50) {
  865.         this._partyArrowAni[0] += 0.14;
  866.     } else if (this._partyArrowAni[1] < 100) {
  867.         this._partyArrowAni[0] -= 0.14;
  868.     } else {
  869.         this._partyArrowAni = [0,0];
  870.     };
  871. };
  872.  
  873. //==============================
  874. // * create Party Arrow
  875. //==============================
  876. Scene_Item.prototype.createPartyArrow = function() {
  877.     this._partyArrow = [];
  878.     this._partyArrowAni = [0,0];
  879.     for (var i = 0; i < 2; i++) {
  880.         this._partyArrow[i] = new Sprite(ImageManager.loadMenusActor("Arrow"));
  881.         this._partyArrow[i].anchor.x = 0.5;
  882.         this._partyArrow[i].anchor.y = 0.5;
  883.         if ($gameParty.members().length < 4) {this._partyArrow[i].visible = false};
  884.         if (i === 1) {this._partyArrow[i].scale.y = -1.00};
  885.         this._partyArrow[i].opacity = 0;
  886.         this.addChild(this._partyArrow[i]);
  887.     }; 
  888. };
  889.  
  890. //==============================
  891. // * create All Members Scope
  892. //==============================
  893. Scene_Item.prototype.createAllMembersScope = function() {
  894.      this._almSprite = new Sprite(ImageManager.loadMenusActor("AllMembers"));
  895.      this._almSprite.anchor.x = 0.5;
  896.      this._almSprite.anchor.y = 0.5;
  897.      this._almSprite.visible = false;
  898.      this.addChild(this._almSprite);
  899. };
  900.  
  901. //==============================
  902. // * updateAllMembers Sprite
  903. //==============================
  904. Scene_Item.prototype.updateAllMembersSprite = function() {
  905.      this._almSprite.x = this._partyPos[0][0] + (this._partyWindow[0].width / 2);
  906.      this._almSprite.y = this._partyPos[0][1] + (this._partyWindow[0].height / 2);
  907.      this._almSprite.visible = this._actorWindow._cursorAll;
  908. };
  909.  
  910. //==============================
  911. // * on Actor Cancel
  912. //==============================
  913. var _mog_scItem_onActorCancel = Scene_Item.prototype.onActorCancel;
  914. Scene_Item.prototype.onActorCancel = function() {
  915.     _mog_scItem_onActorCancel.call(this);
  916.     this._actorWindow._cursorAll = false;
  917. };
  918.  
  919. //==============================
  920. // * refresh Actor WD
  921. //==============================
  922. Scene_Item.prototype.refreshActorWD = function() {
  923.     if (this._partyWindow) {
  924.         for (var i = 0; i < this._partyWindow.length; i++) {
  925.             this._partyWindow[i].refresh();
  926.         };
  927.     };
  928.     if (this._actorDataWindow) {this._actorDataWindow.refresh()};
  929. }; 
  930.  
  931. //==============================
  932. // * process OK
  933. //==============================
  934. var _mog_scItem_wmact_useItem = Scene_Item.prototype.useItem;
  935. Scene_Item.prototype.useItem = function() {
  936.     _mog_scItem_wmact_useItem.call(this);
  937.     this.refreshActorWD();
  938. };
  939.  
  940. //==============================
  941. // * update
  942. //==============================
  943. var _mog_scnItem_update = Scene_Item.prototype.update;
  944. Scene_Item.prototype.update = function() {
  945.     _mog_scnItem_update.call(this);
  946.     this.updateDefaultWindow();
  947.     if (!this._layout) {
  948.         if (this._layImg.isReady()) {this.createSprites()};
  949.         return
  950.     };
  951.     this.updateItemWindow();
  952.     this.updateCommands();
  953.     if (this._layoutItem) {this.updateItemLayout()};
  954.     if (this._buttons) {this.updateButtons()};
  955.     this.updateTouchScreen();
  956.     if (this._actorWindow) {this.updateActorStatus()};
  957. };
  958.  
  959. //=============================================================================
  960. // * Party Window Data
  961. //=============================================================================
  962. function PartyWindowData() {
  963.     this.initialize.apply(this, arguments);
  964. };
  965.  
  966. PartyWindowData.prototype = Object.create(Sprite.prototype);
  967. PartyWindowData.prototype.constructor = PartyWindowData;
  968.  
  969. //==============================
  970. // * Initialize
  971. //==============================
  972. PartyWindowData.prototype.initialize = function(actor) {
  973.     Sprite.prototype.initialize.call(this);
  974.     this.loadBitmaps();
  975.     this._actor = actor;
  976. };
  977.  
  978. //==============================
  979. // * Refresh
  980. //==============================
  981. PartyWindowData.prototype.loadBitmaps = function() {
  982.     this._layImg = ImageManager.loadMenusActor("Layout2");
  983.     this._hpMeterImg = ImageManager.loadMenusActor("HPMeter");
  984.     this._mpMeterImg = ImageManager.loadMenusActor("MPMeter");
  985. };
  986.  
  987. //==============================
  988. // * create Sprites
  989. //==============================
  990. PartyWindowData.prototype.createSprites = function() {
  991.     this.bitmap = this._layImg;
  992.     this.createPar();
  993.     this.createHPMeter();
  994.     this.createMPMeter();
  995.     this.createStates();
  996.     this.refresh()
  997. };
  998.  
  999. //==============================
  1000. // * Refresh
  1001. //==============================
  1002. PartyWindowData.prototype.refresh = function() {
  1003.     this.refreshPar();
  1004.     this.refreshHPMeter();
  1005.     this.refreshMPMeter();
  1006.     this.refresh_states();
  1007. };
  1008.  
  1009. //==============================
  1010. // * createPar
  1011. //==============================
  1012. PartyWindowData.prototype.createPar = function() {
  1013.     this._par = new Sprite(new Bitmap(320,160));
  1014.     this._par.bitmap.fontSize = Moghunter.scItem_PartyFontSize;
  1015.     this.addChild(this._par);
  1016. };
  1017.  
  1018. //==============================
  1019. // * refresh Par
  1020. //==============================
  1021. PartyWindowData.prototype.refreshPar = function() {
  1022.      this._par.bitmap.clear();
  1023.      this._par.bitmap.drawText(this._actor.hp,Moghunter.scItem_PartyHPNumberX,Moghunter.scItem_PartyHPNumberY,80,32,"right");
  1024.      this._par.bitmap.drawText(this._actor.mp,Moghunter.scItem_PartyMPNumberX,Moghunter.scItem_PartyMPNumberY,80,32,"right");
  1025.      this._par.bitmap.drawText(this._actor.name(),Moghunter.scItem_PartyNameX,Moghunter.scItem_PartyNameY,120,32,"left");
  1026. };
  1027.  
  1028. //==============================
  1029. // * createHP Meter
  1030. //==============================
  1031. PartyWindowData.prototype.createHPMeter = function() {
  1032.     this._hpMeter = new Sprite(this._hpMeterImg);
  1033.     this._hpMeter.x = Moghunter.scItem_PartyHPMeterX;
  1034.     this._hpMeter.y = Moghunter.scItem_PartyHPMeterY;
  1035.     this.addChild(this._hpMeter);
  1036. };
  1037.  
  1038. //==============================
  1039. // * refreshHP Meter
  1040. //==============================
  1041. PartyWindowData.prototype.refreshHPMeter = function() {
  1042.     var cw = this._hpMeterImg.width;
  1043.     var ch = this._hpMeterImg.height;
  1044.     var wid = cw * this._actor.hp / this._actor.mhp;
  1045.     this._hpMeter.setFrame(0,0,wid,cw);
  1046. };
  1047.  
  1048. //==============================
  1049. // * createHP Meter
  1050. //==============================
  1051. PartyWindowData.prototype.createMPMeter = function() {
  1052.     this._mpMeter = new Sprite(this._mpMeterImg);
  1053.     this._mpMeter.x = Moghunter.scItem_PartyMPMeterX;
  1054.     this._mpMeter.y = Moghunter.scItem_PartyMPMeterY;
  1055.     this.addChild(this._mpMeter);
  1056. };
  1057.  
  1058. //==============================
  1059. // * refreshMP Meter
  1060. //==============================
  1061. PartyWindowData.prototype.refreshMPMeter = function() {
  1062.     var cw = this._mpMeterImg.width;
  1063.     var ch = this._mpMeterImg.height;
  1064.     var wid = cw * this._actor.mp / this._actor.mmp;
  1065.     this._mpMeter.setFrame(0,0,wid,cw);
  1066. };
  1067.  
  1068.  
  1069. //==============================
  1070. // * Create States
  1071. //==============================
  1072. PartyWindowData.prototype.createStates = function() {
  1073.     this._states_data = [0,0,0];
  1074.     this._state_icon = new Sprite(ImageManager.loadSystem("IconSet"));
  1075.     this._state_icon.x = Moghunter.scItem_PartyStatusX;
  1076.     this._state_icon.y = Moghunter.scItem_PartyStatusY;
  1077.     this._state_icon.visible = false;
  1078.     this.addChild(this._state_icon);
  1079.     this.refresh_states(); 
  1080. };
  1081.    
  1082. //==============================
  1083. // * Create States
  1084. //==============================
  1085. PartyWindowData.prototype.refresh_states = function() {
  1086.     this._states_data[0] = 0;
  1087.     this._states_data[2] = 0;
  1088.     this._state_icon.visible = false;
  1089.     if (this._actor.allIcons().length == 0) {this._states_data[1] = 0;return};
  1090.        if (this._actor.allIcons()[this._states_data[1]]) { 
  1091.         this._states_data[0] = this._actor.allIcons()[this._states_data[1]];
  1092.         this._state_icon.visible = true;
  1093.         var sx = this._states_data[0] % 16 * 32;
  1094.         var sy = Math.floor(this._states_data[0] / 16) * 32;
  1095.         this._state_icon.setFrame(sx, sy, 32, 32);
  1096.        };
  1097.     this._states_data[1] += 1;
  1098.     if (this._states_data[1] >= this._actor.allIcons().length) {
  1099.         this._states_data[1] = 0
  1100.     };
  1101. };
  1102.  
  1103. //==============================
  1104. // * Update States
  1105. //==============================
  1106. PartyWindowData.prototype.update_states = function() {
  1107.     this._states_data[2] += 1;
  1108.     if (this.need_refresh_states()) {this.refresh_states();};
  1109. }; 
  1110.    
  1111. //==============================
  1112. // * Need Refresh States
  1113. //==============================
  1114. PartyWindowData.prototype.need_refresh_states = function() {
  1115.     if (this._states_data[2] > 60) {return true};
  1116.     return false;
  1117. }; 
  1118.  
  1119.  
  1120. //==============================
  1121. // * Update
  1122. //==============================
  1123. PartyWindowData.prototype.update = function() {
  1124.     Sprite.prototype.update.call(this);
  1125.     if (!this._par && this._layImg.isReady()) {this.createSprites()};
  1126.     if (this._state_icon) {this.update_states()};
  1127. };
  1128.  
  1129. //=============================================================================
  1130. // * Actor Data Window
  1131. //=============================================================================
  1132. function ActorDataWindow() {
  1133.     this.initialize.apply(this, arguments);
  1134. };
  1135.  
  1136. ActorDataWindow.prototype = Object.create(Sprite.prototype);
  1137. ActorDataWindow.prototype.constructor = ActorDataWindow;
  1138.  
  1139. //==============================
  1140. // * Initialize
  1141. //==============================
  1142. ActorDataWindow.prototype.initialize = function() {
  1143.     Sprite.prototype.initialize.call(this);
  1144.     this._actor = null;
  1145. };
  1146.  
  1147. //==============================
  1148. // * setActor
  1149. //==============================
  1150. ActorDataWindow.prototype.setActor = function(actor) {
  1151.      this._actor = actor;
  1152.      if (!this._layout) {this.createSprites()};
  1153.      this.refresh();
  1154. };
  1155.  
  1156. //==============================
  1157. // * create Sprites
  1158. //==============================
  1159. ActorDataWindow.prototype.createSprites = function() {
  1160.      this.createLayout();
  1161.      this.createStates();
  1162.      this.createFaces();
  1163.      this.createParameters();
  1164. };
  1165.  
  1166. //==============================
  1167. // * Refresh
  1168. //==============================
  1169. ActorDataWindow.prototype.refresh = function() {
  1170.      this.refreshParameters();
  1171.      this.refresh_states();
  1172.      this.refreshFaces();
  1173. };
  1174.  
  1175. //==============================
  1176. // * create Layout
  1177. //==============================
  1178. ActorDataWindow.prototype.createLayout = function() {
  1179.      this._layout = new Sprite(ImageManager.loadMenusActor("Layout"));
  1180.      this.addChild(this._layout);
  1181. };
  1182.  
  1183. //==============================
  1184. // * create Parameters
  1185. //==============================
  1186. ActorDataWindow.prototype.createParameters = function() {
  1187.      this._par = new Sprite(new Bitmap(Graphics.boxWidth,Graphics.boxHeight));
  1188.      this._par.bitmap.fontSize = Moghunter.scItem_ActorParFontSize;
  1189.      this._par.x = Moghunter.scItem_ActorParX;
  1190.      this._par.y = Moghunter.scItem_ActorParY;
  1191.      this.addChild(this._par);
  1192. };
  1193.  
  1194. //==============================
  1195. // * refresh Parameters
  1196. //==============================
  1197. ActorDataWindow.prototype.refreshParameters = function() {
  1198.      this._par.bitmap.clear();
  1199.      this._par.bitmap.drawText(this._actor.hp,-60,66,160,32,"right");
  1200.      this._par.bitmap.drawText(this._actor.mhp,30,66,160,32,"right");
  1201.      this._par.bitmap.drawText(this._actor.mp,-60,99,160,32,"right");
  1202.      this._par.bitmap.drawText(this._actor.mmp,30,99,160,32,"right");    
  1203.      this._par.bitmap.drawText(this._actor.atk,-60,132,160,32,"right");
  1204.      this._par.bitmap.drawText(this._actor.def,30,132,160,32,"right");
  1205.      this._par.bitmap.drawText(this._actor.mat,-60,165,160,32,"right");
  1206.      this._par.bitmap.drawText(this._actor.mdf,30,165,160,32,"right");
  1207.      this._par.bitmap.drawText(this._actor.agi,-60,198,160,32,"right");
  1208.      this._par.bitmap.drawText(this._actor.luk,30,198,160,32,"right"); 
  1209.      this._par.bitmap.drawText(this._actor.name(),70,30,160,32,"left");  
  1210. };
  1211.  
  1212. //==============================
  1213. // * Create States
  1214. //==============================
  1215. ActorDataWindow.prototype.createStates = function() {
  1216.     this._states_data = [0,0,0];
  1217.     this._state_icon = new Sprite(ImageManager.loadSystem("IconSet"));
  1218.     this._state_icon.x = Moghunter.scItem_ActorStatesX;
  1219.     this._state_icon.y = Moghunter.scItem_ActorStatesY;
  1220.     this._state_icon.visible = false;
  1221.     this.addChild(this._state_icon);
  1222.     this.refresh_states(); 
  1223. };
  1224.    
  1225. //==============================
  1226. // * Create States
  1227. //==============================
  1228. ActorDataWindow.prototype.refresh_states = function() {
  1229.     this._states_data[0] = 0;
  1230.     this._states_data[2] = 0;
  1231.     this._state_icon.visible = false;
  1232.     if (this._actor.allIcons().length == 0) {this._states_data[1] = 0;return};
  1233.        if (this._actor.allIcons()[this._states_data[1]]) { 
  1234.         this._states_data[0] = this._actor.allIcons()[this._states_data[1]];
  1235.         this._state_icon.visible = true;
  1236.         var sx = this._states_data[0] % 16 * 32;
  1237.         var sy = Math.floor(this._states_data[0] / 16) * 32;
  1238.         this._state_icon.setFrame(sx, sy, 32, 32);
  1239.        };
  1240.     this._states_data[1] += 1;
  1241.     if (this._states_data[1] >= this._actor.allIcons().length) {
  1242.         this._states_data[1] = 0
  1243.     };
  1244. };
  1245.  
  1246. //==============================
  1247. // * Update States
  1248. //==============================
  1249. ActorDataWindow.prototype.update_states = function() {
  1250.     this._states_data[2] += 1;
  1251.     if (this.need_refresh_states()) {this.refresh_states();};
  1252. }; 
  1253.    
  1254. //==============================
  1255. // * Need Refresh States
  1256. //==============================
  1257. ActorDataWindow.prototype.need_refresh_states = function() {
  1258.     if (this._states_data[2] > 60) {return true};
  1259.     return false;
  1260. }; 
  1261.  
  1262. //==============================
  1263. // * create Faces
  1264. //==============================
  1265. ActorDataWindow.prototype.createFaces = function() {
  1266.      this._faces = new Sprite();
  1267.      this._faces.x = Moghunter.scItem_ActorFaceX;
  1268.      this._faces.y = Moghunter.scItem_ActorFaceY;
  1269.      this.addChild(this._faces);
  1270. };
  1271.  
  1272. //==============================
  1273. // * refresh Faces
  1274. //==============================
  1275. ActorDataWindow.prototype.refreshFaces = function() {
  1276.      this._faces.bitmap = ImageManager.loadMenusFaces1("Actor_" + this._actor._actorId)
  1277. };
  1278.  
  1279. //==============================
  1280. // * update
  1281. //==============================
  1282. ActorDataWindow.prototype.update = function() {
  1283.     Sprite.prototype.update.call(this);
  1284.     if (!this._actor) {return};
  1285.     this.update_states();
  1286. };
  1287.  
  1288. //=============================================================================
  1289. // ** Window ItemListM
  1290. //=============================================================================
  1291. function Window_ItemListM() {
  1292.     this.initialize.apply(this, arguments);
  1293. }
  1294. Window_ItemListM.prototype = Object.create(Window_Selectable.prototype);
  1295. Window_ItemListM.prototype.constructor = Window_ItemListM;
  1296.  
  1297. //==============================
  1298. // * initialize
  1299. //==============================
  1300. Window_ItemListM.prototype.initialize = function(x, y, width, height) {
  1301.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  1302.     this._category = 'none';
  1303.     this._data = [];
  1304.     this.contentsOpacity = 0;
  1305.     this.opacity = 0;
  1306. };
  1307.  
  1308. //==============================
  1309. // * setCategory
  1310. //==============================
  1311. Window_ItemListM.prototype.setCategory = function(category) {
  1312.     if (this._category !== category) {
  1313.         this._category = category;
  1314.         this.refresh();
  1315.         this.resetScroll();
  1316.     }
  1317. };
  1318.  
  1319. //==============================
  1320. // * maxCols
  1321. //==============================
  1322. Window_ItemListM.prototype.maxCols = function() {
  1323.     return 1;
  1324. };
  1325.  
  1326. //==============================
  1327. // * spacing
  1328. //==============================
  1329. Window_ItemListM.prototype.spacing = function() {
  1330.     return 48;
  1331. };
  1332.  
  1333. //==============================
  1334. // * maxItems
  1335. //==============================
  1336. Window_ItemListM.prototype.maxItems = function() {
  1337.     return this._data ? this._data.length : 1;
  1338. };
  1339.  
  1340. //==============================
  1341. // * item
  1342. //==============================
  1343. Window_ItemListM.prototype.item = function() {
  1344.     var index = this.index();
  1345.     return this._data && index >= 0 ? this._data[index] : null;
  1346. };
  1347.  
  1348. //==============================
  1349. // * isCurrentItemEnabled
  1350. //==============================
  1351. Window_ItemListM.prototype.isCurrentItemEnabled = function() {
  1352.     return this.isEnabled(this.item());
  1353. };
  1354.  
  1355. //==============================
  1356. // * Includes
  1357. //==============================
  1358. Window_ItemListM.prototype.includes = function(item) {
  1359.     switch (this._category) {
  1360.     case 'item':
  1361.         return DataManager.isItem(item) && item.itypeId === 1;
  1362.     case 'weapon':
  1363.         return DataManager.isWeapon(item);
  1364.     case 'armor':
  1365.         return DataManager.isArmor(item);
  1366.     case 'keyItem':
  1367.         return DataManager.isItem(item) && item.itypeId === 2;
  1368.     default:
  1369.         return false;
  1370.     }
  1371. };
  1372.  
  1373. //==============================
  1374. // * needsNumber
  1375. //==============================
  1376. Window_ItemListM.prototype.needsNumber = function() {
  1377.     return true;
  1378. };
  1379.  
  1380. //==============================
  1381. // * is Enabled
  1382. //==============================
  1383. Window_ItemListM.prototype.isEnabled = function(item) {
  1384.     return $gameParty.canUse(item);
  1385. };
  1386.  
  1387. //==============================
  1388. // * makeItemList
  1389. //==============================
  1390. Window_ItemListM.prototype.makeItemList = function() {
  1391.     this._data = $gameParty.allItems().filter(function(item) {
  1392.         return this.includes(item);
  1393.     }, this);
  1394.     if (this.includes(null)) {
  1395.         this._data.push(null);
  1396.     }
  1397. };
  1398.  
  1399. //==============================
  1400. // * selectLast
  1401. //==============================
  1402. Window_ItemListM.prototype.selectLast = function() {
  1403.     var index = this._data.indexOf($gameParty.lastItem());
  1404.     this.select(index >= 0 ? index : 0);
  1405. };
  1406.  
  1407. //==============================
  1408. // * drawItem
  1409. //==============================
  1410. Window_ItemListM.prototype.drawItem = function(index) {
  1411.     var item = this._data[index];
  1412.     if (item) {
  1413.         var numberWidth = this.numberWidth();
  1414.         var rect = this.itemRect(index);
  1415.         rect.width -= this.textPadding();
  1416.         this.changePaintOpacity(this.isEnabled(item));
  1417.         this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
  1418.         this.drawItemNumber(item, rect.x, rect.y, rect.width);
  1419.         this.changePaintOpacity(1);
  1420.     }
  1421. };
  1422.  
  1423. //==============================
  1424. // * numberWidth
  1425. //==============================
  1426. Window_ItemListM.prototype.numberWidth = function() {
  1427.     return this.textWidth('000');
  1428. };
  1429.  
  1430. //==============================
  1431. // * drawItemNumber
  1432. //==============================
  1433. Window_ItemListM.prototype.drawItemNumber = function(item, x, y, width) {
  1434.     if (this.needsNumber()) {
  1435.         this.drawText(':', x, y, width - this.textWidth('00'), 'right');
  1436.         this.drawText($gameParty.numItems(item), x, y, width, 'right');
  1437.     }
  1438. };
  1439.  
  1440. //==============================
  1441. // * updateHelp
  1442. //==============================
  1443. Window_ItemListM.prototype.updateHelp = function() {
  1444.     this.setHelpWindowItem(this.item());
  1445. };
  1446.  
  1447. //==============================
  1448. // * refresh
  1449. //==============================
  1450. Window_ItemListM.prototype.refresh = function() {
  1451.     this.makeItemList();
  1452.     this.createContents();
  1453.     this.drawAllItems();
  1454. };
  1455.  
  1456. //==============================
  1457. // * update
  1458. //==============================
  1459. var _mog_WindowItemM_update = Window_ItemListM.prototype.update;
  1460. Window_ItemListM.prototype.update = function() {
  1461.     if (this.contentsOpacity != 255) {return};
  1462.     _mog_WindowItemM_update.call(this);
  1463.     this.opacity = 0;
  1464. };
  1465.  
  1466. //==============================
  1467. // * process Cursor Move
  1468. //==============================
  1469. Window_MenuActor.prototype.processCursorMove = function() {
  1470.     if (this.isCursorMovable()) {
  1471.         var lastIndex = this.index();
  1472.         if (Input.isRepeated('down')) {
  1473.             this.cursorDown(Input.isTriggered('down'));
  1474.         };
  1475.         if (Input.isRepeated('up') ) {
  1476.             this.cursorUp(Input.isTriggered('up'));
  1477.         };
  1478.         if (Input.isRepeated('right')) {
  1479.             this.cursorDown(Input.isTriggered('right'));
  1480.         };
  1481.         if (Input.isRepeated('left')) {
  1482.             this.cursorUp(Input.isTriggered('left'));
  1483.         };     
  1484.         if (this.index() !== lastIndex) {
  1485.             SoundManager.playCursor();
  1486.         };
  1487.     };
  1488. };
  1489.  
  1490. //==============================
  1491. // * Update
  1492. //==============================
  1493. var _mog_scItem_wmact_update = Window_MenuActor.prototype.update;
  1494. Window_MenuActor.prototype.update = function() {
  1495.     _mog_scItem_wmact_update.call(this);
  1496.     if (!this._cursorAll) {this.updateScrollRoll()};
  1497. };
  1498.  
  1499. //==============================
  1500. // * update SCroll Roll
  1501. //==============================
  1502. Window_MenuActor.updateScrollRoll = function() {
  1503.     if (this.isOpenAndActive() && this.maxItems() > 0) {
  1504.         var srow = this.maxTopRow() === 0 ? 1 : this.maxCols();
  1505.         var threshold = 20;
  1506.         var idx = this._index;
  1507.         if (TouchInput.wheelY >= threshold) {
  1508.             this._index += srow;
  1509.             if (this._index > (this.maxItems() - 1)) {this._index = this.maxItems() - 1};
  1510.             this.select(this._index);
  1511.             if (idx != this._index) {SoundManager.playCursor()};
  1512.         };
  1513.         if (TouchInput.wheelY <= -threshold) {
  1514.             this._index -= srow;
  1515.             if (this._index < 0) {this._index = 0};
  1516.             this.select(this._index);
  1517.             if (idx != this._index) {SoundManager.playCursor()};
  1518.         };
  1519.     };
  1520. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement