SHARE
TWEET

BM_EquipCore

blackmorning Nov 24th, 2015 (edited) 221 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Blackmorning Engine Plugins - Equip Core
  3. // BM_EquipCore.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.BM_EquipCore = true;
  8.  
  9. var BM = BM || {};
  10. //=============================================================================
  11.  /*:
  12.  * @plugindesc VK Visual Equipment Scene (v1.16)
  13.  * Equipment body & icons setup
  14.  * @author Blackmorning
  15.  *
  16.  * @param ---General---
  17.  * @default
  18.  *
  19.  * @param WindowAlign
  20.  * @desc Location of the command window.
  21.  * left     right
  22.  * @default right
  23.  *
  24.  * @param CommandColumns
  25.  * @desc Number of columns in the command window.
  26.  * default for basic 3, yanfly 1
  27.  * @default 3
  28.  *
  29.  * @param CommandRows
  30.  * @desc Number of rows visible in the command window.
  31.  * default for basic 1, yanfly 4
  32.  * @default 1
  33.  *
  34.  * @param CommandFull
  35.  * @desc Command window goes all the way across (best with 1 row)
  36.  * false     true
  37.  * @default false
  38.  *
  39.  * @param HideEquipItemList
  40.  * @desc Hide or show item list until selecting.
  41.  * Show - false     Hide - true
  42.  * @default true
  43.  *
  44.  * @param HelpEquip
  45.  * @desc The text for the command Equip.
  46.  * @default Manually equip items
  47.  *
  48.  * @param HelpOptimize
  49.  * @desc The text for the command Optimize.
  50.  * @default Automatically equip the best items
  51.  *
  52.  * @param HelpRemove
  53.  * @desc The text for the command Remove.
  54.  * @default Unequip all items
  55.  *
  56.  * @param ---Slot Window---
  57.  * @default
  58.  *
  59.  * @param EquipmentType
  60.  * @desc Use icons or slot names.
  61.  * icons     names
  62.  * @default names
  63.  *
  64.  * @param EquipmentIcons
  65.  * @desc The icons for each equipment slot.
  66.  * Separate the icon ID's by a space.
  67.  * @default 97 128 130 135 145
  68.  *
  69.  * @param ---Status Window---
  70.  * @default
  71.  *
  72.  * @param EquipParameters
  73.  * @desc Parameters shown when comparing equipment.
  74.  * Separate parameters by a space. * see help *
  75.  * @default mhp atk def mat mdf agi luk hit cri
  76.  *
  77.  * @param ShowDifference
  78.  * @desc shows the change in parameters
  79.  * Show - true     Hide - false
  80.  * @default true
  81.  *
  82.  * @param ParametersFontSize
  83.  * @desc Font size of parameters.
  84.  * @default 20
  85.  *
  86.  * @param BodyInStatus
  87.  * @desc Let the body image show behind parameters.
  88.  * Show - true     Hide - false
  89.  * @default false
  90.  *
  91.  * @param ComparePlusIcon
  92.  * @desc Choose icon to show positive stat changes.
  93.  * default - leave blank to show none.
  94.  * @default
  95.  *
  96.  * @param CompareMinusIcon
  97.  * @desc Choose icon to show negative stat changes.
  98.  * default - leave blank to show none.
  99.  * @default
  100.  *
  101.  * @param ---Body Window---
  102.  * @default
  103.  *
  104.  * @param BodyWindowWidth
  105.  * @desc Width of the Equip Body window.
  106.  * default 400
  107.  * @default 400
  108.  *
  109.  * @param BodyImage
  110.  * @desc Default image of the body. (found in Img\Pictures)
  111.  * @default equip_m
  112.  *
  113.  * @param BodyPadding
  114.  * @desc Adjusts the padding of the body window so image can go right to window frame.
  115.  * @default 10
  116.  *
  117.  * @param PaperDollMode
  118.  * @desc if true, changes mode to dress up body image
  119.  * true         false
  120.  * @default  false
  121.  *
  122.  * @param EquipmentFramed
  123.  * @desc The icons are framed.
  124.  * Show - true     Hide - false
  125.  * @default true
  126.  *
  127.  * @param ScaleEquipIcons
  128.  * @desc Scaling/multiplier of size of item icons on body.
  129.  * (based on default icon size)
  130.  * @default 1
  131.  *
  132.  * @param IconXLocation
  133.  * @desc Gives the default x-location of each icon.
  134.  * Separate the x by a space.  
  135.  * @default 60 160 108 108 40 40
  136.  *
  137.  * @param IconYLocation
  138.  * @desc Gives the default y-location of each icon.
  139.  * Separate the y by a space.
  140.  * @default 330 330 60 220 100 220
  141.  *
  142.  * @param ---Parameters Vocab---
  143.  * @default
  144.  *
  145.  * @param QuasiParams
  146.  * @desc show names or abr in list (for Quasi Custom Params)
  147.  * name         abr
  148.  * @default name
  149.  *
  150.  * @param MhpVocab
  151.  * @desc Vocab for maxHp
  152.  * default - leave blank to use the database's entry.
  153.  * @default Hit Points
  154.  *
  155.  * @param MmpVocab
  156.  * @desc Vocab for maxMp
  157.  * default - leave blank to use the database's entry.
  158.  * @default
  159.  *
  160.  * @param AtkVocab
  161.  * @desc Vocab for atk
  162.  * default - leave blank to use the database's entry.
  163.  * @default
  164.  *
  165.  * @param DefVocab
  166.  * @desc Vocab for def
  167.  * default - leave blank to use the database's entry.
  168.  * @default
  169.  *
  170.  * @param MatVocab
  171.  * @desc Vocab for mat
  172.  * default - leave blank to use the database's entry.
  173.  * @default
  174.  *
  175.  * @param MdfVocab
  176.  * @desc Vocab for mdf
  177.  * default - leave blank to use the database's entry.
  178.  * @default
  179.  *
  180.  * @param AgiVocab
  181.  * @desc Vocab for agi
  182.  * default - leave blank to use the database's entry.
  183.  * @default
  184.  *
  185.  * @param LukVocab
  186.  * @desc Vocab for luk
  187.  * default - leave blank to use the database's entry.
  188.  * @default
  189.  *
  190.  * @param HitVocab
  191.  * @desc Vocab for hit
  192.  * default - leave blank to use the database's entry.
  193.  * @default
  194.  *
  195.  * @param EvaVocab
  196.  * @desc Vocab for eva
  197.  * default - leave blank to use the database's entry.
  198.  * @default
  199.  *
  200.  * @param CriVocab
  201.  * @desc Vocab for cri
  202.  * default Critical
  203.  * @default Critical  
  204.  *
  205.  * @param CevVocab
  206.  * @desc Vocab for cev
  207.  * default Crit Evasion
  208.  * @default Crit Evasion
  209.  *
  210.  * @param MevVocab
  211.  * @desc Vocab for mev
  212.  * default Magic Evasion
  213.  * @default Magic Evasion
  214.  *
  215.  * @param MrfVocab
  216.  * @desc Vocab for mrf
  217.  * default M. Reflect
  218.  * @default M. Reflect
  219.  *
  220.  * @param CntVocab
  221.  * @desc Vocab for cnt
  222.  * default Counterattack
  223.  * @default Counterattack
  224.  *
  225.  * @param HrgVocab
  226.  * @desc Vocab for hrg
  227.  * default HP Regen
  228.  * @default HP Regen
  229.  *
  230.  * @param MrgVocab
  231.  * @desc Vocab for mrg
  232.  * default MP Regen
  233.  * @default MP Regen
  234.  *
  235.  * @param TrgVocab
  236.  * @desc Vocab for trg
  237.  * default TP Regen
  238.  * @default TP Regen
  239.  *
  240.  * @param TgrVocab
  241.  * @desc Vocab for trg
  242.  * default Target Rate
  243.  * @default Target Rate
  244.  *
  245.  * @param GrdVocab
  246.  * @desc Vocab for grd
  247.  * default Guard Effect
  248.  * @default Guard Effect
  249.  *
  250.  * @param RecVocab
  251.  * @desc Vocab for rec
  252.  * default Recovery
  253.  * @default Recovery
  254.  *
  255.  * @param PhaVocab
  256.  * @desc Vocab for pha
  257.  * default Pharmacology
  258.  * @default Pharmacology
  259.  *
  260.  * @param McrVocab
  261.  * @desc Vocab for mcr
  262.  * default MP Cost
  263.  * @default MP Cost
  264.  *
  265.  * @param TcrVocab
  266.  * @desc Vocab for tcr
  267.  * default TP Cost
  268.  * @default TP Cost
  269.  *
  270.  * @param PdrVocab
  271.  * @desc Vocab for pdr
  272.  * default Phys Dmg %
  273.  * @default Phys Dmg %
  274.  *
  275.  * @param MdrVocab
  276.  * @desc Vocab for mdr
  277.  * default Magic Dmg %
  278.  * @default Magic Dmg %
  279.  *
  280.  * @param FdrVocab
  281.  * @desc Vocab for fdr
  282.  * default Floor Dmg %
  283.  * @default Floor Dmg %
  284.  *
  285.  * @param ExrVocab
  286.  * @desc Vocab for exr
  287.  * default Exp Gain
  288.  * @default Exp Gain
  289.  *
  290.  * @help
  291.  * ============================================================================
  292.  * Introduction
  293.  * ============================================================================
  294.  * Title: BM VK Equipment Scene
  295.  * Author: Blackmorning
  296.  * Version: 1.16
  297.  * Website: http://bmscripts.weebly.com/vk-equip.html
  298.  * Visual Equip Scene such as in "Valkyrie Stories" made for RPG Maker VX by
  299.  * Hanzo Kimura
  300.  * - Icons can be assigned to equipment slots
  301.  * - Visual placement of equipment onto an image
  302.  * - Image can be assigned to actors/classes in the Database Notebox
  303.  *   (actors take priority)
  304.  * - Window padding can be adjusted to eliminate cutoff of images.
  305.  *   Text is still placed properly.
  306.  * - Image can be assigned to weapon/armor in the Database Notebox
  307.  * - Equipment icon positions can be assigned/changed to match new images
  308.  * - Decide what parameters to show/compare (using symbols in table below)
  309.  * - Decide what parameters are called
  310.  *
  311.  * -- Compatiblity --
  312.  *
  313.  * - YEP Equip & Item Core Users (Put YEP above this script)
  314.  * - YEP Equipment requirements (Put YEP above this script)
  315.  * ---  Pressing Left/Right will toggle the stat comparison window with the info
  316.  *      window (if using YEP item core) and
  317.  *      requirements window (if using YEP equipment requirements).
  318.  *      Pressing Tab on the keyboard will also switch them as well as clicking
  319.  *      on those windows.
  320.  * - Quasi ParamPlus (Put above this script)
  321.  * ---  use the same abbreviations that are used in Quasi in the EquipParameters section
  322.  *      to make them appear (uses name/abr as chosen)
  323.  *
  324.  * Table of built-in parameters:
  325.  * ============================
  326.  * | Symbol |      Name       |
  327.  * ============================
  328.  * | mhp    | Max HP          |
  329.  * | mmp    | Max MP          |
  330.  * | atk    | Attack          |
  331.  * | def    | Defense         |
  332.  * | mat    | M.Attack        |
  333.  * | mdf    | M.Defense       |
  334.  * | agi    | Agility         |
  335.  * | luk    | Luck            |
  336.  * =======================================
  337.  * | hit    | Hit Rate        | percent  |
  338.  * | eva    | Evasion         | percent  |
  339.  * | cri    | Critical Rate   | percent  |
  340.  * | cev    | Crit Evasion    | percent  |
  341.  * | mev    | Magic Evasion   | percent  |
  342.  * | mrf    | M. Reflection   | percent  |
  343.  * | cnt    | Counterattack   | percent  |
  344.  * | hrg    | HP Regen Rate   | percent  |
  345.  * | mrg    | MP Regen Rate   | percent  |
  346.  * | trg    | TP Regen Rate   | percent  |
  347.  * =======================================
  348.  * | tgr    | Target Rate     | percent  |
  349.  * | grd    | Guard Effect    | percent  |
  350.  * | rec    | Recovery Effect | percent  |
  351.  * | pha    | Pharmacology    | percent  |
  352.  * | mcr    | MP Cost Rate    | percent  |
  353.  * | tcr    | TP Cost Rate    | percent  |
  354.  * | pdr    | Phys Damage %   | percent  |
  355.  * | mdr    | Magic Damage %  | percent  |
  356.  * | fdr    | Floor Damage %  | percent  |
  357.  * | exr    | Exp Gain Rate   | percent  |
  358.  * =======================================
  359.  *
  360.  * ============================================================================
  361.  * Notetags
  362.  * ============================================================================
  363.  *
  364.  * You can use the following notetags to change a actor/class's equipment setup.
  365.  *-------------------------
  366.  * Actor/Class Notetags:
  367.  *-------------------------
  368.  * <ebodyimage: x>
  369.  * - x must be the corresponding filename from the Img\Pictures folder.
  370.  *
  371.  * For those who purchased the "Cover Art Characters Pack" and copied the data
  372.  * into their projects, <Portrait: Package1_1> would be a good example use.
  373.  *
  374.  * <ebodyscale: x> - Specifies the desired scaling of the body image.
  375.  * x = 1 provides the default scaling behavior; x = 0.5 halve the size, while
  376.  * x = 2 doubles it.  Note that the image is confined to within the body image
  377.  * window.
  378.  *
  379.  * If not provided, the scaling factor will default to 1 and use the original
  380.  * image size.
  381.  *
  382.  * <ebodyoffset: -x, -y>
  383.  * <ebodyoffset: +x, +y>
  384.  * - Specifies an offset from the default positioning to use for the body image.  
  385.  *   Positive x moves the image further right, negative x moves left.
  386.  *   Positive y moves the image further down, negative y moves up.
  387.  *   Note: the image may be clipped as a result of such adjustments.
  388.  *   The equip window's border will automatically overwrite such parts of the
  389.  *   image.
  390.  *
  391.  * <eicon-id: x, y> with id as the equipment slot, x, y are the position.
  392.  * This changes the actor's slot positions to wherever is listed.
  393.  * An actor's custom equip slots will take priority over a class's
  394.  * custom equip slots, which will take priority over the default equip slots.
  395.  *-------------------------
  396.  * Weapon/Armor Notetags:
  397.  *-------------------------
  398.  *   <eiconimage: string>
  399.  * - Uses a picture from Img\Pictures\ of your RPG Maker MV Project's
  400.  * directory with the filename of "string" (without the extension) as the image
  401.  * picture.  Will adjust to size of box.
  402.  *
  403.  * ============================================================================
  404.  * Changelog
  405.  * ============================================================================
  406.  * Version 1.16: 2016-June-03
  407.  * - adjusted visual options
  408.  * - changed coding
  409.  * Version 1.15: 2016-May-13
  410.  * - adjusted font issues
  411.  * Version 1.14: 2016-May-12
  412.  * - adjusted equip status window to include the difference
  413.  * Version 1.13: 2016-May-11
  414.  * - added paper doll mode, can now choose to dress the body image.
  415.  * Version 1.12: 2016-May-11
  416.  * - compatible with QuasiParamPlus
  417.  * Version 1.11: 2016-May-10
  418.  * - compatible with YEP equipment requirements
  419.  * Version 1.10: 2016-Apr-11
  420.  * - compatible with yanfly equip core
  421.  * - put below Yanfly Equip
  422.  * Version 1.01: 2016-Mar-14
  423.  * - fixed images when changing classes
  424.  * Version 1.00: 2015-Nov-24
  425.  * - Finished plugin!
  426.  */
  427. //=============================================================================
  428.  
  429. //=============================================================================
  430. // Parameter Variables
  431. //=============================================================================
  432. BM.Parameters = PluginManager.parameters('BM_EquipCore');
  433. BM.Equip = BM.Equip || {};
  434. BM.Icon = BM.Icon || {};
  435. BM.Vocab = BM.Vocab || {};
  436.  
  437. BM.Equip.EWindowAlign = String(BM.Parameters['WindowAlign'] || 'right');
  438. BM.Equip.ECommandColumns = Number(BM.Parameters['CommandColumns'] || 1);
  439. BM.Equip.ECommandRows = Number(BM.Parameters['CommandRows'] || 1);
  440. BM.Equip.ECommandFull = BM.Parameters['CommandFull'] == "true" ? true : false;
  441. BM.Equip.EStatusWidth = Number(BM.Parameters['BodyWindowWidth'] || 400);
  442. BM.Equip.EParamFontSize = Number(BM.Parameters['ParametersFontSize']);
  443.  
  444. BM.Icon.Plus = Number(BM.Parameters['ComparePlusIcon']);
  445. BM.Icon.Minus = Number(BM.Parameters['CompareMinusIcon']);
  446.  
  447. BM.Data = String(BM.Parameters['EquipParameters']);
  448. BM.Data = BM.Data.split(' ');
  449. BM.Equip.EParameters = [];
  450. for (BM.i = 0; BM.i < BM.Data.length; ++BM.i) {
  451.   BM.Equip.EParameters.push(BM.Data[BM.i]);
  452. };
  453.  
  454. BM.Equip.EHideList = BM.Parameters['HideEquipItemList'] == "true" ? true : false;
  455. BM.Equip.EHelpEquip = String(BM.Parameters['HelpEquip']);
  456. BM.Equip.EHelpOptimize = String(BM.Parameters['HelpOptimize']);
  457. BM.Equip.EHelpRemove = String(BM.Parameters['HelpRemove']);
  458. BM.Equip.EBodyPadding = Number(BM.Parameters['BodyPadding'] || 18);
  459. BM.Equip.EBodyStatus = BM.Parameters['BodyInStatus'] == "true" ? true : false;
  460.  
  461. BM.Equip.EBodyDefault = String(BM.Parameters['BodyImage']);
  462. BM.Equip.EBodyIconScales = Number(BM.Parameters['ScaleEquipIcons'] || 1);
  463. BM.Equip.ENameIcon = String(BM.Parameters['EquipmentType'] || 'names');
  464. BM.Equip.EIconFramed = BM.Parameters['EquipmentFramed'] == "true" ? true : false;
  465. BM.Equip.EShowDifference = BM.Parameters['ShowDifference'] == "true" ? true : false;
  466. BM.Equip.PaperDollMode = BM.Parameters['PaperDollMode'] == "true" ? true : false;
  467. BM.Equip.EQuasiParams = String(BM.Parameters['QuasiParams'] || 'name');
  468.  
  469. BM.Data = String(BM.Parameters['EquipmentIcons']);
  470. BM.Data = BM.Data.split(' ');
  471. BM.Icon.EquipIcons = [];
  472. for (BM.i = 0; BM.i < BM.Data.length; ++BM.i) {
  473.   BM.Icon.EquipIcons.push(parseInt(BM.Data[BM.i]));
  474. };
  475.  
  476. BM.Data = String(BM.Parameters['IconXLocation']);
  477. BM.Data = BM.Data.split(' ');
  478. BM.Equip.EIconXLocations = [];
  479. for (BM.i = 0; BM.i < BM.Data.length; ++BM.i) {
  480.   BM.Equip.EIconXLocations.push(parseInt(BM.Data[BM.i]));
  481. };
  482. BM.Data = String(BM.Parameters['IconYLocation']);
  483. BM.Data = BM.Data.split(' ');
  484. BM.Equip.EIconYLocations = [];
  485. for (BM.i = 0; BM.i < BM.Data.length; ++BM.i) {
  486.   BM.Equip.EIconYLocations.push(parseInt(BM.Data[BM.i]));
  487. };
  488.  
  489. BM.Vocab.ParamNames = [];
  490. BM.Vocab.ParamNames['mhp'] = String(BM.Parameters['MhpVocab']);
  491. BM.Vocab.ParamNames['mmp'] = String(BM.Parameters['MmpVocab']);
  492. BM.Vocab.ParamNames['atk'] = String(BM.Parameters['AtkVocab']);
  493. BM.Vocab.ParamNames['def'] = String(BM.Parameters['DefVocab']);
  494. BM.Vocab.ParamNames['mat'] = String(BM.Parameters['MatVocab']);
  495. BM.Vocab.ParamNames['mdf'] = String(BM.Parameters['MdfVocab']);
  496. BM.Vocab.ParamNames['agi'] = String(BM.Parameters['AgiVocab']);
  497. BM.Vocab.ParamNames['luk'] = String(BM.Parameters['LukVocab']);
  498. BM.Vocab.ParamNames['hit'] = String(BM.Parameters['HitVocab']);
  499. BM.Vocab.ParamNames['eva'] = String(BM.Parameters['EvaVocab']);
  500. BM.Vocab.ParamNames['cri'] = String(BM.Parameters['CriVocab']);
  501. BM.Vocab.ParamNames['cev'] = String(BM.Parameters['CevVocab']);
  502. BM.Vocab.ParamNames['mev'] = String(BM.Parameters['MevVocab']);
  503. BM.Vocab.ParamNames['mrf'] = String(BM.Parameters['MrfVocab']);
  504. BM.Vocab.ParamNames['cnt'] = String(BM.Parameters['CntVocab']);
  505. BM.Vocab.ParamNames['hrg'] = String(BM.Parameters['HrgVocab']);
  506. BM.Vocab.ParamNames['mrg'] = String(BM.Parameters['MrgVocab']);
  507. BM.Vocab.ParamNames['trg'] = String(BM.Parameters['TrgVocab']);
  508. BM.Vocab.ParamNames['tgr'] = String(BM.Parameters['TgrVocab']);
  509. BM.Vocab.ParamNames['grd'] = String(BM.Parameters['GrdVocab']);
  510. BM.Vocab.ParamNames['rec'] = String(BM.Parameters['RecVocab']);
  511. BM.Vocab.ParamNames['pha'] = String(BM.Parameters['PhaVocab']);
  512. BM.Vocab.ParamNames['mcr'] = String(BM.Parameters['McrVocab']);
  513. BM.Vocab.ParamNames['tcr'] = String(BM.Parameters['TcrVocab']);
  514. BM.Vocab.ParamNames['pdr'] = String(BM.Parameters['PdrVocab']);
  515. BM.Vocab.ParamNames['mdr'] = String(BM.Parameters['MdrVocab']);
  516. BM.Vocab.ParamNames['fdr'] = String(BM.Parameters['FdrVocab']);
  517. BM.Vocab.ParamNames['exr'] = String(BM.Parameters['ExrVocab']);
  518. //-----------------------------------------------------------------------------
  519. TextManager.paramName = function(paramName) {
  520.     var name = BM.Vocab.ParamNames[paramName]
  521.     if(!name || name == '') {
  522.         switch(paramName){
  523.             case 'mhp':
  524.             return $dataSystem.terms.params[0] || '';
  525.             case 'mmp':
  526.             return $dataSystem.terms.params[1] || '';
  527.             case 'atk':
  528.             return $dataSystem.terms.params[2] || '';
  529.             case 'def':
  530.             return $dataSystem.terms.params[3] || '';
  531.             case 'mat':
  532.             return $dataSystem.terms.params[4] || '';
  533.             case 'mdf':
  534.             return $dataSystem.terms.params[5] || '';
  535.             case 'agi':
  536.             return $dataSystem.terms.params[6] || '';
  537.             case 'luk':
  538.             return $dataSystem.terms.params[7] || '';
  539.             case 'hit':
  540.             return $dataSystem.terms.params[8] || '';
  541.             case 'eva':
  542.             return $dataSystem.terms.params[9] || '';
  543.         }
  544.     }
  545.     if (!name || name == "undefined" && Imported.Quasi_ParamsPlus){
  546.         for (var i = 0; i < QuasiParams._custom.length; i++) {
  547.             if (paramName == QuasiParams._customAbr(i)){
  548.                 if (BM.Equip.EQuasiParams == 'abr'){
  549.                     name = capitalize_Words(paramName)
  550.                 } else {
  551.                     name = QuasiParams._customName(i);
  552.                 }
  553.                 break;
  554.             }
  555.         }
  556.     }
  557.     if (!name || name == "undefined"){
  558.         name = capitalize_Words(paramName)
  559.     }
  560.     return name
  561. };
  562.  
  563. function capitalize_Words(str)
  564. {
  565.  return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
  566. }
  567.  
  568. //-----------------------------------------------------------------------------
  569. BM.Equip.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  570. DataManager.isDatabaseLoaded = function() {
  571.     if (!BM.Equip.DataManager_isDatabaseLoaded.call(this)) return false;
  572.     this.processActorNotetagsEquipBM($dataActors);
  573.     this.processClassNotetagsEquipBM($dataClasses);
  574.     this.processWeaponNotetagsEquipBM($dataWeapons);
  575.     this.processArmorNotetagsEquipBM($dataArmors);
  576.     return true;
  577. };
  578. DataManager.processActorNotetagsEquipBM = function(group) {
  579.     BM.Equip.EBodyAImages = [];
  580.     BM.Equip.EBodyAImageOffsets = [];
  581.     BM.Equip.EBodyAImageScales = [];
  582.     BM.Equip.EBodyAIconX = [];
  583.     BM.Equip.EBodyAIconY = [];
  584.     BM.Equip.EBodyAImage = [];
  585.     var offsetMatcher = /<(?:EBODYOFFSET):[ ]*([\+\-\s*]\d+)\s*,\s*([\+\-\s*]\d+)>/i;
  586.     var iconoffsetMatcher = /<(?:EICON-)(\d+):[ ]*(\d+)\s*,\s*(\d+)>/i;
  587.     for (var n = 1; n < group.length; n++) {
  588.         BM.Equip.EBodyAImageScales[n] = 1;     
  589.         BM.Equip.EBodyAImageOffsets[n] = [0, 0];
  590.         BM.Equip.EBodyAIconX[n] = [];
  591.         BM.Equip.EBodyAIconY[n] = [];
  592.         BM.Equip.EBodyAImage[n] = false
  593.         var obj = group[n];
  594.         var notedata = obj.note.split(/\r?\n/);
  595.         for (var i = 0; i < notedata.length; i++) {        
  596.             var line = notedata[i];
  597.             if (line.match(/<(?:EBODYIMAGE):[ ]([\w\s]+)>/i)) {
  598.                 var eBody = RegExp.$1;
  599.                 BM.Equip.EBodyAImage[n] = true;
  600.                 if (eBody == '')eBody = undefined; 
  601.                 else //;                   
  602.                 BM.Equip.EBodyAImages[n] = eBody;
  603.             } else if (line.match(/<(?:EBODYSCALE):[ ](\d+.?\d+)>/i)) {
  604.                 var eBodyScale = parseFloat(RegExp.$1);
  605.                 if (eBodyScale < 0) eBodyScale = 0;            
  606.                 BM.Equip.EBodyAImageScales[n] = eBodyScale;
  607.             } else if (line.match(offsetMatcher)) {
  608.                 BM.Equip.EBodyAImageOffsets[n] = [parseInt(RegExp.$1), parseInt(RegExp.$2)];
  609.             } else if (line.match(iconoffsetMatcher)) {
  610.                 BM.Equip.EBodyAIconX[n][parseInt(RegExp.$1)] = parseInt(RegExp.$2);
  611.                 BM.Equip.EBodyAIconY[n][parseInt(RegExp.$1)] = parseInt(RegExp.$3);
  612.             }
  613.         }  
  614.     }
  615. };
  616. DataManager.processClassNotetagsEquipBM = function(group) {
  617.     BM.Equip.EBodyCImages = [];
  618.     BM.Equip.EBodyCImageOffsets = [];
  619.     BM.Equip.EBodyCImageScales = [];
  620.     BM.Equip.EBodyCIconX = [];
  621.     BM.Equip.EBodyCIconY = [];
  622.     var offsetMatcher = /<(?:EBODYOFFSET):[ ]*([\+\-\s*]\d+)\s*,\s*([\+\-\s*]\d+)>/i;
  623.     var iconoffsetMatcher = /<(?:EICON-)(\d+):[ ]*([\+\-\s*]\d+)\s*,\s*([\+\-\s*]\d+)>/i;
  624.     for (var n = 1; n < group.length; n++) {
  625.         var obj = group[n];
  626.         BM.Equip.EBodyCImageScales[n] = 1;     
  627.         BM.Equip.EBodyCImageOffsets[n] = [0, 0];
  628.         BM.Equip.EBodyCIconX[n] = [];
  629.         BM.Equip.EBodyCIconY[n] = [];
  630.         var notedata = obj.note.split(/\r?\n/);
  631.         for (var i = 0; i < notedata.length; i++) {        
  632.             var line = notedata[i];
  633.             if (line.match(/<(?:EBODYIMAGE):[ ]([\w\s]+)>/i)) {
  634.                 var eBody = RegExp.$1;
  635.                 if (eBody == '') eBody = undefined;            
  636.                 BM.Equip.EBodyCImages[n] = eBody;
  637.             } else if (line.match(/<(?:EBODYSCALE):[ ](\d+.?\d+)>/i)) {
  638.                 var eBodyScale = parseFloat(RegExp.$1);
  639.                 if (eBodyScale < 0) eBodyScale = 0;            
  640.                 BM.Equip.EBodyCImageScales[n] = eBodyScale;
  641.             } else if (line.match(offsetMatcher)) {
  642.                 BM.Equip.EBodyCImageOffsets[n] = [parseInt(RegExp.$1), parseInt(RegExp.$2)];
  643.             } else if (line.match(iconoffsetMatcher)) {
  644.                 BM.Equip.EBodyCIconX[n][parseInt(RegExp.$1)] = parseInt(RegExp.$2);
  645.                 BM.Equip.EBodyCIconY[n][parseInt(RegExp.$1)] = parseInt(RegExp.$3);
  646.             }
  647.         }  
  648.     }
  649. };
  650. DataManager.processWeaponNotetagsEquipBM = function(group) {
  651.     BM.Equip.EBodyIconWImages = [];
  652.     BM.Equip.EIconWImage = [];
  653.     for (var n = 1; n < group.length; n++) {
  654.         BM.Equip.EIconWImage[n] = false
  655.         var obj = group[n];
  656.         obj.eBodyIconImages = [];
  657.         var notedata = obj.note.split(/\r?\n/);
  658.         for (var i = 0; i < notedata.length; i++) {        
  659.             var line = notedata[i];
  660.             if (line.match(/<(?:EICONIMAGE):[ ]([\w\s]+)>/i)) {
  661.                 var eBody = RegExp.$1;
  662.                 BM.Equip.EIconWImage[n] = true;
  663.                 if (eBody == '')eBody = undefined; 
  664.                 else //;                   
  665.                 BM.Equip.EBodyIconWImages[n] = eBody;
  666.                 obj.eBodyIconImages = eBody;
  667.             }
  668.         }      
  669.         ImageManager.loadPicture(BM.Equip.EBodyIconWImages[n]);
  670.     }
  671. };
  672. DataManager.processArmorNotetagsEquipBM = function(group) {
  673.     BM.Equip.EBodyIconAImages = [];
  674.     BM.Equip.EIconAImage = [];
  675.     for (var n = 1; n < group.length; n++) {
  676.         BM.Equip.EIconAImage[n] = false
  677.         var obj = group[n];
  678.         var notedata = obj.note.split(/\r?\n/);
  679.         for (var i = 0; i < notedata.length; i++) {        
  680.             var line = notedata[i];
  681.             if (line.match(/<(?:EICONIMAGE):[ ]([\w\s]+)>/i)) {
  682.                 var eBody = RegExp.$1;
  683.                 BM.Equip.EIconAImage[n] = true;
  684.                 if (eBody == '')eBody = undefined; 
  685.                 else;                  
  686.                 BM.Equip.EBodyIconAImages[n] = eBody;
  687.                 obj.eBodyIconImages = eBody;
  688.                
  689.             }
  690.         }  
  691.         ImageManager.loadPicture(BM.Equip.EBodyIconAImages[n]);
  692.     }
  693. };
  694. //
  695. //Game Actor
  696. //
  697. BM.Equip.Game_Actor_initMembers = Game_Actor.prototype.initMembers;
  698. Game_Actor.prototype.initMembers = function() {
  699.     BM.Equip.Game_Actor_initMembers.call(this);
  700.     this._ebodyName = '';
  701.     this._ebodyScale = '';
  702.     this._ebodyOffset = '';
  703. };
  704. BM.Equip.Game_Actor_initImages = Game_Actor.prototype.initImages;
  705. Game_Actor.prototype.initImages = function() {
  706.     BM.Equip.Game_Actor_initImages.call(this);
  707.     Game_Actor.prototype.defineEBodyImage.call(this);
  708. };
  709. Game_Actor.prototype.defineEBodyImage = function (){
  710.     if (BM.Equip.EBodyAImage[this._actorId]) {
  711.         this._ebodyName = BM.Equip.EBodyAImages[this._actorId];
  712.         this._ebodyScale = BM.Equip.EBodyAImageScales[this._actorId];
  713.         this._ebodyOffset = BM.Equip.EBodyAImageOffsets[this._actorId];
  714.     } else if (BM.Equip.EBodyCImages[this._classId]) {
  715.         this._ebodyName = BM.Equip.EBodyCImages[this._classId];
  716.         this._ebodyScale = BM.Equip.EBodyCImageScales[this._classId];
  717.         this._ebodyOffset = BM.Equip.EBodyCImageOffsets[this._classId];
  718.     } else {
  719.         this._ebodyName = BM.Equip.EBodyDefault;
  720.         this._ebodyScale = 1;
  721.         this._ebodyOffset = [0, 0];
  722.     }
  723.     ImageManager.loadPicture(this._ebodyName);
  724. };
  725. Game_Actor.prototype.setEBodyImage = function(eBodyName) {
  726.     this._ebodyName = eBodyName;
  727.     this._ebodyScale = 1;
  728.     this._ebodyOffset = [0, 0];
  729.     ImageManager.loadPicture(this._ebodyName);
  730. };
  731. Game_Actor.prototype.setEBodyScale = function(eBodyScale) {
  732.     this._ebodyScale = eBodyScale;
  733. };
  734. Game_Actor.prototype.setEBodyOffset = function(eBodyOffset_x,eBodyOffset_y) {
  735.     this._ebodyOffset = [eBodyOffset_x,eBodyOffset_y];
  736. };
  737. BM.Equip.Game_Actor_changeClass = Game_Actor.prototype.changeClass;
  738. Game_Actor.prototype.changeClass = function(classId, keepExp) {
  739.     BM.Equip.Game_Actor_changeClass.call(this, classId, keepExp);
  740.     Game_Actor.prototype.defineEBodyImage.call(this);
  741.     this.refresh();
  742. };
  743. //-----------------------------------------------------------------------------
  744. // Window_Base
  745. //-----------------------------------------------------------------------------
  746. Window_Base.prototype.drawDarkRect = function(dx, dy, dw, dh) {
  747.     var color = this.gaugeBackColor();    
  748.     this.changePaintOpacity(false);    
  749.     this.contents.fillRect(dx + 1, dy + 1, dw - 2, dh - 2, color);    
  750.     this.changePaintOpacity(true);
  751. };
  752. Window_Base.prototype.drawFramedBox = function(dx, dy, dw, dh) {
  753.     var color1 = this.gaugeBackColor();  
  754.     var color2 = this.normalColor();
  755.     this.contents.fillRect(dx, dy, dw, dh, color2);    
  756.     this.contents.clearRect(dx + 1, dy + 1, dw - 2, dh - 2)
  757. };
  758. Window_Base.prototype.textLineHeight = function() {
  759.     return (this.contents.fontSize + this.textPadding()*2)
  760. };
  761. Window_Base.prototype.drawActorEBody = function(actor, x, y) {
  762.     var name = actor._ebodyName
  763.     var scale = actor._ebodyScale;
  764.     var offsets = actor._ebodyOffset;
  765.     var bitmap = ImageManager.loadPicture(name);
  766.     var sw = bitmap.width;
  767.     var sh = bitmap.height;
  768.     this.contents.blt(bitmap, 0, 0, sw, sh,  // Image, top-left (x,y) from source image, source width + height to use
  769.     x + offsets[0], y + offsets[1], // destination (x, y) to use.  Of note - anything past contentsWidth() + contentsHeight() is auto-clipped!
  770.     Math.floor(sw * scale), Math.floor(sh * scale)); // destination width, height - can be used to scale!  
  771. };
  772. Window_Base.prototype.drawEIcon = function(item, x, y, width, height) {
  773.     if (item) {
  774.         var scale = 1
  775.         var scale = BM.Equip.EBodyIconScales
  776.         if (item.etypeId == 1) var name = BM.Equip.EBodyIconWImages;
  777.         else var name = BM.Equip.EBodyIconAImages;
  778.         if (name[item.id]){
  779.             this.drawEIconImage(name[item.id], x, y, width*scale, height*scale);
  780.         }else if (BM.Equip.PaperDollMode == false){
  781.             this.drawIcon(item.iconIndex, x, y, width*scale, height*scale);
  782.         }          
  783.     }
  784. };
  785. Window_Base.prototype.drawEIconImage = function(name, x, y,width, height) {
  786.     var bitmap = ImageManager.loadPicture(name);
  787.     var pw = bitmap.width;
  788.     var ph = bitmap.height;
  789.     var sx = 0;
  790.     var sy = 0;  
  791.     if (BM.Equip.PaperDollMode){
  792.         this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
  793.     }else{
  794.         this.contents.blt(bitmap, sx, sy, pw, ph, x, y, width, height);
  795.     }
  796. };
  797. Window_Base.prototype.drawIcon = function(iconIndex, x, y, width, height) {
  798.     width = width || Window_Base._iconWidth;
  799.     height = height || Window_Base._iconHeight;
  800.     var bitmap = ImageManager.loadSystem('IconSet');
  801.     var pw = Window_Base._iconWidth;
  802.     var ph = Window_Base._iconHeight;
  803.     var sx = iconIndex % 16 * pw;
  804.     var sy = Math.floor(iconIndex / 16) * ph;  
  805.     this.contents.blt(bitmap, sx, sy, pw, ph, x, y, width, height);
  806. };
  807. Window_Base.prototype.checkParamPercent = function(paramName) {
  808.     percent = true;
  809.     switch(paramName){
  810.     case 'mhp':
  811.     case 'mmp':
  812.     case 'atk':
  813.     case 'def':
  814.     case 'mat':
  815.     case 'mdf':
  816.     case 'agi':
  817.     case 'luk':
  818.     percent = false;
  819.     break;
  820.     }
  821.     if (Imported.Quasi_ParamsPlus){
  822.         for (var i = 0; i < QuasiParams._custom.length; i++) {
  823.             if (paramName == QuasiParams._customAbr(i)){   
  824.                 percent = false;
  825.                 break;
  826.             }
  827.         }
  828.     }
  829.     return percent
  830. }
  831. //-----------------------------------------------------------------------------
  832. // Window_EquipBody
  833. //
  834. // The window for selecting an equipment slot on the equipment screen.
  835. function Window_EquipBody() {
  836.     this.initialize.apply(this, arguments);
  837. }
  838. Window_EquipBody.prototype = Object.create(Window_Selectable.prototype);
  839. Window_EquipBody.prototype.constructor = Window_EquipBody;
  840. Window_EquipBody.prototype.initialize = function(x, y) {
  841.     var height = Graphics.boxHeight - y;
  842.     var width = this.windowWidth();
  843.     Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  844.     this._actor = null;
  845.     this._slotId = -1
  846.     this.refresh();
  847. };
  848. Window_EquipBody.prototype.fittingHeight = function(numLines) {
  849.     return numLines * this.lineHeight() + BM.Equip.Window_EquipBody_standardPadding() * 2;
  850. };
  851. Window_EquipBody.prototype.windowWidth = function() {
  852.     return BM.Equip.EStatusWidth;
  853. };
  854. Window_EquipBody.prototype.setActor = function(actor) {
  855.     if (this._actor !== actor) {
  856.         this._actor = actor;
  857.         this.refresh();
  858.     }
  859. };
  860. Window_EquipBody.prototype.maxItems = function() {
  861.     return this._actor ? this._actor.equipSlots().length : 0;
  862. };
  863. Window_EquipBody.prototype.item = function() {
  864.     return this._actor ? this._actor.equips()[this.index()] : null;
  865. };
  866. Window_EquipBody.prototype.drawAllItems = function() {
  867.     if (this._actor) {
  868.         this.drawActorEBody(this._actor, 0, 0);
  869.         this.drawActorName(this._actor, this.textPadding() + this.bmPadding(), this.bmPadding());
  870.     }  
  871.     Window_Selectable.prototype.drawAllItems.call(this)
  872. };
  873. Window_EquipBody.prototype.drawItem = function(index) {
  874.     if (this._actor) {
  875.         var rect = this.itemRect(index);
  876.         this.changeTextColor(this.systemColor());
  877.         this.changePaintOpacity(this.isEnabled(index));
  878.         if (BM.Equip.EIconFramed && (BM.Equip.PaperDollMode == false)){
  879.             this.drawFramedBox(rect.x - 4,rect.y + this.contents.fontSize - 4, rect.width + 8, rect.height + 8);
  880.         }
  881.         this.makeFontSmaller();
  882.         if (BM.Equip.PaperDollMode == false){
  883.             this.drawText(this.slotName(index), rect.x - 4, rect.y - 4, rect.width + 8, this.lineHeight(),'center');
  884.         }
  885.         this.makeFontBigger();     
  886.         this.drawEIcon(this._actor.equips()[index], rect.x, rect.y + this.contents.fontSize, Window_Base._iconWidth, Window_Base._iconHeight);
  887.         this.changePaintOpacity(true);
  888.     }
  889. };
  890. Window_EquipBody.prototype.itemRect = function(index) {
  891.     var scale = BM.Equip.EBodyIconScales
  892.     var xa = BM.Equip.EIconXLocations;
  893.     var ya = BM.Equip.EIconYLocations;
  894.     if (BM.Equip.EBodyAImage[this._actor._actorId]) {
  895.         if (BM.Equip.EBodyAIconX[this._actor._actorId][index]) {
  896.             var xa = BM.Equip.EBodyAIconX[this._actor._actorId];
  897.             var ya = BM.Equip.EBodyAIconY[this._actor._actorId];
  898.         };
  899.     } else {
  900.         if (BM.Equip.EBodyCIconX[this._actor._actorId][index]) {
  901.             var xa = BM.Equip.EBodyCIconX[this._actor._actorId];
  902.             var ya = BM.Equip.EBodyCIconY[this._actor._actorId];
  903.         };
  904.     }  
  905.     var rect = new Rectangle();
  906.     rect.width = Window_Base._iconWidth * scale;
  907.     rect.height = Window_Base._iconHeight * scale;
  908.     rect.x = xa[index]
  909.     rect.y = ya[index]
  910.     return rect;
  911. };
  912. Window_EquipBody.prototype.slotName = function(index) {
  913.     var slots = this._actor.equipSlots();
  914.     return this._actor ? $dataSystem.equipTypes[slots[index]] : '';
  915. };
  916. Window_EquipBody.prototype.isEnabled = function(index) {
  917.     return this._actor ? this._actor.isEquipChangeOk(index) : false;
  918. };
  919. Window_EquipBody.prototype.isCurrentItemEnabled = function() {
  920.     return this.isEnabled(this.index());
  921. };
  922. Window_EquipBody.prototype.setSlotId = function(slotId) {
  923.     if (this._slotId !== slotId) {
  924.         this._slotId = slotId;
  925.         this.refresh();
  926.         this.updateCursor();
  927.     }
  928. };
  929. Window_EquipBody.prototype.update = function() {
  930.     Window_Selectable.prototype.update.call(this);
  931.     this.updateCursor();
  932. }  
  933. Window_EquipBody.prototype.updateCursor = function() {
  934.     if (BM.Equip.PaperDollMode == false){
  935.     if (this._cursorAll) {
  936.         var allRowsHeight = this.maxRows() * this.itemHeight();
  937.         this.setCursorRect(0, 0, this.contents.width, allRowsHeight);
  938.         this.setTopRow(0);
  939.     } else if (this.isCursorVisible()) {
  940.         var rect = this.itemRect(this._slotId);
  941.         this.setCursorRect(rect.x - 2, rect.y - 2 + this.contents.fontSize, rect.width + 4, rect.height + 4);
  942.     } else {
  943.         this.setCursorRect(0, 0, 0, 0);
  944.     }
  945.     }
  946. };
  947. BM.Equip.Window_EquipBody_standardPadding = Window_EquipBody.prototype.standardPadding;
  948. Window_EquipBody.prototype.standardPadding = function() {
  949.     return BM.Equip.EBodyPadding;
  950. };
  951. Window_EquipBody.prototype.bmPadding = function() {
  952.     return BM.Equip.Window_EquipBody_standardPadding() - this.padding
  953. };
  954. //-----------------------------------------------------------------------------
  955. // Window_EquipCommand
  956. //
  957. BM.Equip.Window_EquipCommand_updateHelp = Window_EquipCommand.prototype.updateHelp;
  958. Window_EquipCommand.prototype.updateHelp = function() {
  959.     BM.Equip.Window_EquipCommand_updateHelp.call(this);
  960.     var array = [BM.Equip.EHelpEquip, BM.Equip.EHelpOptimize, BM.Equip.EHelpRemove]
  961.     if (this._helpWindow) {
  962.         this._helpWindow.setText(array[this.index()]);
  963.     }
  964. };
  965. Window_EquipCommand.prototype.windowWidth = function() {
  966.     if (BM.Equip.ECommandFull){
  967.         return Graphics.width
  968.     } else {
  969.         return Graphics.width - BM.Equip.EStatusWidth;
  970.     }    
  971. };
  972. Window_EquipCommand.prototype.maxCols = function() {
  973.     return BM.Equip.ECommandColumns;
  974. };
  975. Window_EquipCommand.prototype.numVisibleRows = function() {
  976.     return BM.Equip.ECommandRows;
  977. };
  978. //-----------------------------------------------------------------------------
  979. // Window_EquipStatus-parameters
  980. //-----------------------------------------------------------------------------
  981. BM.Equip.Window_EquipStatus_initialize = Window_EquipStatus.prototype.initialize;
  982. Window_EquipStatus.prototype.initialize = function(x, y) {
  983.     this._item = null;
  984.     this._newItem = null;
  985.     var width = this.windowWidth();
  986.     var height = this.windowHeight();
  987.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  988.     this._actor = null;
  989.     this.refresh();
  990. };
  991. Window_EquipStatus.prototype.windowWidth = function() {
  992.     return BM.Equip.EStatusWidth;
  993. };
  994. Window_EquipStatus.prototype.windowHeight = function() {
  995.     if (BM.Equip.ECommandFull){
  996.         return (Graphics.boxHeight - this.fittingHeight(2) - this.fittingHeight(BM.Equip.ECommandRows))
  997.     } else{
  998.         return (Graphics.boxHeight - this.fittingHeight(2));
  999.     }
  1000. };
  1001. Window_EquipStatus.prototype.fittingHeight = function(numLines) {
  1002.     return numLines * this.lineHeight() + BM.Equip.Window_EquipStatus_standardPadding() * 2;
  1003. };
  1004. Window_EquipStatus.prototype.refresh = function() {
  1005.     this.contents.clear();
  1006.     if (this._actor) {
  1007.         if (BM.Equip.EBodyStatus && BM.Equip.PaperDollMode == false) this.drawActorEBody(this._actor, 0, 0);       
  1008.         this.drawActorName(this._actor, this.textPadding() + this.bmPadding(), this.bmPadding());  
  1009.         this.drawCurrentWeapon(this.bmPadding(),this.lineHeight()+this.bmPadding())
  1010.         this.drawNewWeapon(Window_Base._iconWidth+this.bmPadding(),this.lineHeight()*5/2+this.bmPadding())
  1011.         this.contents.fontSize = BM.Equip.EParamFontSize
  1012.         var param = BM.Equip.EParameters
  1013.         var y = this.lineHeight() * 4 + this.bmPadding()
  1014.         var h = this.contents.height - y - this.bmPadding()
  1015.         var tf = h / this.textLineHeight();
  1016.         var pf = Math.floor(Math.min(tf,param.length));
  1017.         var dh = pf * this.textLineHeight();
  1018.         var dy = Math.floor((h - dh)/2 + this.bmPadding()/2);
  1019.         y = y + dy
  1020.         for (var i = 0; i < pf; i++) {
  1021.             this.drawItem(this.bmPadding(), y, param[i]);
  1022.             this.contents.fontSize = BM.Equip.EParamFontSize
  1023.             y += this.textLineHeight()
  1024.         }
  1025.         this.resetFontSettings();
  1026.     }
  1027. };
  1028. BM.Equip.Window_EquipStatus_setActor = Window_EquipStatus.prototype.setActor;
  1029. Window_EquipStatus.prototype.setActor = function(actor) {
  1030.     if (this._actor === actor) return;
  1031.     this._actor = actor;
  1032.     this.createWidths();
  1033.     BM.Equip.Window_EquipStatus_setActor.call(actor)
  1034. };
  1035. Window_EquipStatus.prototype.bmPadding = function() {
  1036.     return BM.Equip.Window_EquipStatus_standardPadding() - this.padding
  1037. };
  1038. Window_EquipStatus.prototype.drawCurrentWeapon = function(x, y) {
  1039.     var dx = x + Window_Base._iconWidth
  1040.     var dy = y + this.lineHeight()/2;
  1041.     this.drawDarkRect(dx, dy, this.contents.width-dx-this.bmPadding()-Window_Base._iconWidth, this.lineHeight());
  1042.     var lastFontSize = this.contents.fontSize;
  1043.     this.makeFontSmaller()
  1044.     this.drawText("Current", x, y-10, this.contents.width-x-this.bmPadding()-Window_Base._iconWidth);
  1045.     this.contents.fontSize = lastFontSize
  1046.     this.drawItemName(this._item, dx, dy, this.contents.width-dx-this.bmPadding()-6-Window_Base._iconWidth);
  1047. };
  1048. Window_EquipStatus.prototype.createWidths = function() {
  1049.     this._paramNameWidth = 0;
  1050.     this._paramValueWidth = 0;
  1051.     this._arrowWidth = this.textWidth('\u2192' + ' ');
  1052.     var buffer = this.textWidth(' ');
  1053.     for (var i = 0; i < 8; ++i) {
  1054.       var value1 = this.textWidth(TextManager.param(i));
  1055.       var value2 = this.textWidth(this._actor.paramMax(i));
  1056.       this._paramNameWidth = Math.max(value1, this._paramNameWidth);
  1057.       this._paramValueWidth = Math.max(value2, this._paramValueWidth);
  1058.     }
  1059.     this._bonusValueWidth = this._paramValueWidth;
  1060.     this._bonusValueWidth += this.textWidth('(+)') + buffer;
  1061.     this._paramNameWidth += buffer;
  1062.     if (this._paramNameWidth + this._paramValueWidth * 2 + this._arrowWidth +
  1063.       this._bonusValueWidth > this.contents.width) this._bonusValueWidth = 0;
  1064. };
  1065. Window_EquipStatus.prototype.drawNewWeapon = function(x, y) {
  1066.     var dx = x + Window_Base._iconWidth
  1067.     var dy = y + this.lineHeight()/2;
  1068.     this.drawDarkRect(dx, dy, this.contents.width-dx-this.bmPadding(), this.lineHeight());
  1069.     var lastFontSize = this.contents.fontSize;
  1070.     this.makeFontSmaller()
  1071.     this.drawText("To New", x, y-10, this.contents.width-x-this.bmPadding());
  1072.     this.contents.fontSize = lastFontSize
  1073.     if (this._tempActor) {     
  1074.         this.drawItemName(this._newItem, dx, dy, this.contents.width-dx-this.bmPadding()-6);
  1075.     }
  1076. };
  1077. Window_EquipStatus.prototype.drawItem = function(x, y, paramName) {
  1078.     this.drawDarkRect(x, y, this.contents.width-x-this.bmPadding(), this.textLineHeight());
  1079.     this.drawRightArrow(y);
  1080.     var percent = true
  1081.     if (paramName){
  1082.         this.drawParamName(y, paramName);
  1083.         var percent = this.checkParamPercent(paramName)
  1084.         if (this._actor) {
  1085.             this.drawCurrentParam(y, paramName, percent);
  1086.         }      
  1087.         if (this._tempActor) {
  1088.             this.drawNewParam(y, paramName, percent);
  1089.             if (BM.Equip.EShowDifference) this.drawParamDifference(y, paramName, percent);
  1090.         }
  1091.     }
  1092. };
  1093. Window_EquipStatus.prototype.drawRightArrow = function(y) {
  1094.     var x = this.contents.width - this.textPadding();
  1095.     x -= this._paramValueWidth * 2 + this._arrowWidth;
  1096.     var dw = this.textWidth('\u2192' + ' ');
  1097.     this.changeTextColor(this.systemColor());
  1098.     this.drawText('\u2192', x, y, dw, 'right');
  1099. };
  1100. Window_EquipStatus.prototype.drawParamName = function(y, paramName) {
  1101.     var x = this.textPadding();
  1102.     this.changeTextColor(this.systemColor());
  1103.     var name = TextManager.paramName(paramName);
  1104.     this.drawText(name, x, y, this._paramNameWidth);
  1105. };
  1106. Window_EquipStatus.prototype.drawCurrentParam = function(y, paramName, percent) {
  1107.     var x = this.contents.width - this.textPadding();
  1108.     x -= this._paramValueWidth * 3 + this._arrowWidth;
  1109.     this.resetTextColor();
  1110.     if (eval("this._actor." + paramName, this) != undefined) {
  1111.     var value = eval("this._actor." + paramName, this);
  1112.     if (percent == true) {         
  1113.         value = Math.round(value * 100) + "%";
  1114.     }
  1115.     this.drawText(value, x, y, this._paramValueWidth, 'right');
  1116.     }
  1117. };
  1118. Window_EquipStatus.prototype.drawNewParam = function(y, paramName, percent) {
  1119.     var x = this.contents.width - this.textPadding()*2;
  1120.     x -= this._paramValueWidth;
  1121.     if (eval("this._tempActor." + paramName, this) != undefined) {
  1122.     var oldValue = eval("this._actor." + paramName, this);
  1123.     var newValue = eval("this._tempActor." + paramName, this);
  1124.     var diffvalue = newValue - oldValue;
  1125.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1126.     if (percent == true) {
  1127.         newValue = Math.round(newValue * 100) + "%";
  1128.     }
  1129.     if (diffvalue > 0 && BM.Icon.Plus && BM.Icon.Plus != 0){
  1130.         this.drawIcon(BM.Icon.Plus, x, y)
  1131.     }
  1132.     if (diffvalue < 0 && BM.Icon.Minus && BM.Icon.Minus != 0){
  1133.         this.drawIcon(BM.Icon.Minus, x, y)
  1134.     }
  1135.     this.drawText(newValue, 0, y, this.contents.width-this.textPadding(), 'right');
  1136.  
  1137.     }
  1138. };
  1139. Window_EquipStatus.prototype.drawParamDifference = function(y, paramName, percent) {
  1140.     this.contents.fontSize = BM.Equip.EParamFontSize/1.5
  1141.     var x = this.contents.width - this.textPadding();
  1142.     x -= this._paramValueWidth * 2 + this._arrowWidth/2;
  1143.     if (eval("this._tempActor." + paramName, this) != undefined) {
  1144.     var oldValue = eval("this._actor." + paramName, this);
  1145.     var newValue = eval("this._tempActor." + paramName, this);
  1146.     var diffvalue = newValue - oldValue;
  1147.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1148.     var text = diffvalue;
  1149.     if (percent == true) {
  1150.         text = Math.round(text * 100) + "%";
  1151.     }
  1152.     if (diffvalue > 0) {
  1153.       text = ' (+' + text + ')';
  1154.     } else if (diffvalue === 0){
  1155.       text = ''
  1156.     } else {
  1157.       text = ' (' + text + ')';
  1158.     }
  1159.     this.drawText(text, x, y - this.contents.fontSize/1.5, this._bonusValueWidth, 'left');
  1160.     }
  1161. };
  1162. Window_EquipStatus.prototype.setItem = function(slotId) {
  1163.     if (this._item !== slotId) {
  1164.         this._item = slotId;
  1165.         this.refresh();
  1166.     }
  1167. };
  1168. Window_EquipStatus.prototype.setNewItem = function(item) {
  1169.     if (this._newItem === item) return;
  1170.     this._newItem = item;
  1171.     this.refresh();
  1172. };
  1173. BM.Equip.Window_EquipStatus_standardPadding = Window_EquipStatus.prototype.standardPadding;
  1174. Window_EquipStatus.prototype.standardPadding = function() {
  1175.     return BM.Equip.EBodyStatus ? BM.Equip.EBodyPadding : BM.Equip.Window_EquipStatus_standardPadding();
  1176. };
  1177. //-----------------------------------------------------------------------------
  1178. // Window_EquipSlot
  1179. //-----------------------------------------------------------------------------
  1180. BM.Equip.Window_EquipSlot_initialize = Window_EquipSlot.prototype.initialize;
  1181. Window_EquipSlot.prototype.initialize = function(x, y, width, height) {
  1182.     var height = Math.floor(Math.min(height,this.windowHeight()));
  1183.     BM.Equip.Window_EquipSlot_initialize.call(this, x, y, width, height);
  1184. };
  1185. Window_EquipSlot.prototype.windowHeight = function() {
  1186.     if (BM.Equip.EHideList) {
  1187.         return (Graphics.boxHeight - this.fittingHeight(2) - this.fittingHeight(1));
  1188.     } else {
  1189.         return this.fittingHeight(this.numVisibleRows());
  1190.     }      
  1191. };
  1192. Window_EquipSlot.prototype.setBodyWindow = function(bodyWindow) {
  1193.     this._bodyWindow = bodyWindow;
  1194.     this.callUpdateHelp();
  1195. };
  1196. Window_EquipSlot.prototype.numVisibleRows = function() {
  1197.     return (this._actor ? this._actor.equipSlots().length : $dataSystem.equipTypes.length) - 1;
  1198. };
  1199. BM.Equip.Window_EquipSlot_drawItem = Window_EquipSlot.prototype.drawItem;
  1200. Window_EquipSlot.prototype.drawItem = function(index) {
  1201.     if (BM.Equip.ENameIcon == 'names'){
  1202.         BM.Equip.Window_EquipSlot_drawItem.call(this, index);
  1203.     } else {
  1204.         if (this._actor) {
  1205.             var rect = this.itemRectForText(index);
  1206.             this.changeTextColor(this.systemColor());
  1207.             this.changePaintOpacity(this.isEnabled(index));
  1208.             this.drawEquipSlotIcon(index, rect.x, rect.y)
  1209.             var dx = rect.x + Window_Base._iconWidth + 10
  1210.             this.drawItemName(this._actor.equips()[index], dx, rect.y, this.contents.width - dx);
  1211.             this.changePaintOpacity(true);         
  1212.         }
  1213.     }
  1214. };
  1215. Window_EquipSlot.prototype.drawEquipSlotIcon = function(index, x, y){
  1216.     var eIcon = BM.Icon.EquipIcons;
  1217.     var equippedIcon = this._actor.equips()[index];
  1218.     this.drawIcon(eIcon[index], x, y);
  1219. }
  1220. BM.Equip.Window_EquipSlot_drawItemName = Window_EquipSlot.prototype.drawItemName;
  1221. Window_EquipSlot.prototype.drawItemName = function(item, x, y, width) {
  1222.     width = width || this.contents.width;
  1223.     BM.Equip.Window_EquipSlot_drawItemName.call(this, item, x, y, width - x - this.textPadding());    
  1224. };
  1225. BM.Equip.Window_EquipSlot_updateHelp = Window_EquipSlot.prototype.updateHelp;
  1226. Window_EquipSlot.prototype.updateHelp = function() {
  1227.     BM.Equip.Window_EquipSlot_updateHelp.call(this);
  1228.     if (SceneManager._scene instanceof Scene_Equip && this._bodyWindow) {
  1229.         this._bodyWindow.setSlotId(this.index());
  1230.     }
  1231.     if (SceneManager._scene instanceof Scene_Equip && this._compareWindow) {
  1232.         if (this._compareWindow) this._compareWindow.setItem(this.item());
  1233.     }
  1234.     if (SceneManager._scene instanceof Scene_Equip && this._statusWindow) {
  1235.         if (this._statusWindow) this._statusWindow.setItem(this.item());
  1236.     }
  1237. };
  1238.  
  1239. //-----------------------------------------------------------------------------
  1240. // Window_EquipItem
  1241. //-----------------------------------------------------------------------------
  1242. Window_EquipItem.prototype.maxCols = function() {
  1243.     return 1;
  1244. };
  1245. BM.Equip.Window_EquipItem_updateHelp = Window_EquipItem.prototype.updateHelp;
  1246. Window_EquipItem.prototype.updateHelp = function() {
  1247.     BM.Equip.Window_EquipItem_updateHelp.call(this);
  1248.     if (SceneManager._scene instanceof Scene_Equip && this._compareWindow) {
  1249.         if (this._compareWindow) this._compareWindow.setNewItem(this.item());
  1250.     }
  1251.     if (SceneManager._scene instanceof Scene_Equip && this._statusWindow) {
  1252.         if (this._statusWindow) this._statusWindow.setNewItem(this.item());
  1253.     }
  1254. };
  1255.  
  1256. //-----------------------------------------------------------------------------
  1257. // Scene_Equip
  1258. //-----------------------------------------------------------------------------
  1259. BM.Equip.Scene_Equip_create = Scene_Equip.prototype.create;
  1260. Scene_Equip.prototype.create = function() {
  1261.     BM.Equip.Scene_Equip_create.call(this);
  1262.     this.relocateWindows();
  1263. }
  1264. Scene_Equip.prototype.relocateWindows = function() {
  1265.     this._statusWindow.y = this._bodyWindow.y
  1266.     if (BM.Equip.EWindowAlign != 'right') {
  1267.         this._commandWindow.x = 0;
  1268.         this._itemWindow.x = 0;
  1269.         this._slotWindow.x = 0;
  1270.         this._bodyWindow.x = this._slotWindow.width;
  1271.         this._statusWindow.x = this._slotWindow.width;     
  1272.     };
  1273.     if (BM.Equip.EWindowAlign == 'right') {
  1274.         this._commandWindow.x = this._bodyWindow.width;
  1275.         this._itemWindow.x = this._bodyWindow.width;
  1276.         this._slotWindow.x = this._bodyWindow.width;
  1277.         this._bodyWindow.x = 0;
  1278.         this._statusWindow.x = 0;      
  1279.     };
  1280.     if (BM.Equip.EHideList) {
  1281.         this._itemWindow.hide();
  1282.     };
  1283.     if (Imported.YEP_EquipCore == true){
  1284.         this._compareWindow.x = this._bodyWindow.x
  1285.         this._compareWindow.hide();
  1286.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1287.             this._infoWindow.x = this._bodyWindow.x
  1288.         }
  1289.         if (Imported.YEP_X_EquipRequirements && Yanfly.Param.EqReqWindow){
  1290.             this._requirementWindow.x = this._bodyWindow.x
  1291.         }
  1292.     }
  1293. }
  1294. BM.Equip.Scene_Equip_createStatusWindow = Scene_Equip.prototype.createStatusWindow;
  1295. Scene_Equip.prototype.createStatusWindow = function() {
  1296.     BM.Equip.Scene_Equip_createStatusWindow.call(this);
  1297.     this._statusWindow.hide();
  1298. };
  1299. Scene_Equip.prototype.createBodyWindow = function() {
  1300.     if (BM.Equip.ECommandFull){
  1301.         this._bodyWindow = new Window_EquipBody(0, this._slotWindow.y);
  1302.     } else {
  1303.         this._bodyWindow = new Window_EquipBody(0, this._helpWindow.height);
  1304.     }
  1305.     this._slotWindow.setBodyWindow(this._bodyWindow);
  1306.     this.addWindow(this._bodyWindow);  
  1307. };
  1308. Scene_Equip.prototype.createSlotWindow = function() {
  1309.     var wx = BM.Equip.EStatusWidth;
  1310.     var ww = Graphics.boxWidth - BM.Equip.EStatusWidth;
  1311.     var wy = this._commandWindow.y + this._commandWindow.height;
  1312.     var wh = Graphics.boxHeight - wy
  1313.     this._slotWindow = new Window_EquipSlot(wx, wy, ww, wh);
  1314.     this._slotWindow.setHelpWindow(this._helpWindow);
  1315.     this._slotWindow.setStatusWindow(this._statusWindow);
  1316.     this._slotWindow.setHandler('ok',       this.onSlotOk.bind(this));
  1317.     this._slotWindow.setHandler('cancel',   this.onSlotCancel.bind(this));
  1318.     this.addWindow(this._slotWindow);
  1319. };
  1320. Scene_Equip.prototype.createItemWindow = function() {
  1321.     var wx = BM.Equip.EStatusWidth;
  1322.     var ww = Graphics.boxWidth - BM.Equip.EStatusWidth;
  1323.     var wy = this._slotWindow.y + this._slotWindow.height;    
  1324.     var wh = Graphics.boxHeight - wy;
  1325.     if (BM.Equip.EHideList) {
  1326.         var wy = this._commandWindow.y + this._commandWindow.height;
  1327.         var wh = Graphics.boxHeight - wy;      
  1328.     }
  1329.     this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
  1330.     this._itemWindow.setHelpWindow(this._helpWindow);
  1331.     this._itemWindow.setStatusWindow(this._statusWindow);
  1332.     this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
  1333.     this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
  1334.     this._slotWindow.setItemWindow(this._itemWindow);
  1335.     this.addWindow(this._itemWindow);
  1336.     this.createBodyWindow();
  1337. };
  1338. BM.Equip.Scene_Equip_refreshActor = Scene_Equip.prototype.refreshActor;
  1339. Scene_Equip.prototype.refreshActor = function() {
  1340.     var actor = this.actor();
  1341.     BM.Equip.Scene_Equip_refreshActor.call(this);  
  1342.     this._bodyWindow.setActor(actor);
  1343. };
  1344. BM.Equip.Scene_Equip_commandEquip = Scene_Equip.prototype.commandEquip;
  1345. Scene_Equip.prototype.commandEquip = function() {
  1346.     BM.Equip.Scene_Equip_commandEquip.call(this);
  1347.     this._bodyWindow.activate();
  1348.     this._bodyWindow.select(0);
  1349. };
  1350. BM.Equip.Scene_Equip_onSlotOk = Scene_Equip.prototype.onSlotOk;
  1351. Scene_Equip.prototype.onSlotOk = function() {
  1352.     BM.Equip.Scene_Equip_onSlotOk.call(this);
  1353.     if (BM.Equip.EHideList) {
  1354.         this._itemWindow.show();
  1355.         this._slotWindow.hide();
  1356.     }
  1357.     this._statusWindow.show();
  1358.     if (Imported.YEP_EquipCore == true){
  1359.         this._compareWindow.show();
  1360.         this._statusWindow.hide();
  1361.     }
  1362.     this._bodyWindow.hide();
  1363. };
  1364. BM.Equip.Scene_Equip_onSlotCancel = Scene_Equip.prototype.onSlotCancel;
  1365. Scene_Equip.prototype.onSlotCancel = function() {
  1366.     BM.Equip.Scene_Equip_onSlotCancel.call(this);
  1367.     this._bodyWindow.deselect();
  1368.     this._bodyWindow.deactivate();
  1369. };
  1370. BM.Equip.Scene_Equip_onItemOk = Scene_Equip.prototype.onItemOk;
  1371. Scene_Equip.prototype.onItemOk = function() {
  1372.     BM.Equip.Scene_Equip_onItemOk.call(this);
  1373.     if (BM.Equip.EHideList) {
  1374.         this._itemWindow.hide();
  1375.         this._slotWindow.show();
  1376.     }
  1377.     if (Imported.YEP_EquipCore == true){
  1378.         this._compareWindow.hide();
  1379.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1380.             this._infoWindow.hide();
  1381.         }
  1382.         if (Imported.YEP_X_EquipRequirements && Yanfly.Param.EqReqWindow){
  1383.             this._requirementWindow.hide();
  1384.         }
  1385.     }
  1386.     this._statusWindow.hide();
  1387.     this._bodyWindow.show();
  1388.     this._bodyWindow.refresh();
  1389. };
  1390. BM.Equip.Scene_Equip_onItemCancel = Scene_Equip.prototype.onItemCancel;
  1391. Scene_Equip.prototype.onItemCancel = function() {
  1392.     BM.Equip.Scene_Equip_onItemCancel.call(this);
  1393.     if (BM.Equip.EHideList) {
  1394.         this._itemWindow.hide();
  1395.         this._slotWindow.show();
  1396.     } else {
  1397.         this._itemWindow.show();
  1398.     }
  1399.     if (Imported.YEP_EquipCore == true){
  1400.         this._compareWindow.hide();
  1401.         if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1402.             this._infoWindow.hide();
  1403.         }
  1404.         if (Imported.YEP_X_EquipRequirements && Yanfly.Param.EqReqWindow){
  1405.             this._requirementWindow.hide();
  1406.         }
  1407.     }
  1408.     this._statusWindow.hide();
  1409.     this._bodyWindow.show();
  1410. };
  1411. BM.Equip.Scene_Equip_commandOptimize = Scene_Equip.prototype.commandOptimize;
  1412. Scene_Equip.prototype.commandOptimize = function() {
  1413.     BM.Equip.Scene_Equip_commandOptimize.call(this);
  1414.     this._bodyWindow.refresh();
  1415. };
  1416. BM.Equip.Scene_Equip_commandClear = Scene_Equip.prototype.commandClear;
  1417. Scene_Equip.prototype.commandClear = function() {
  1418.     BM.Equip.Scene_Equip_commandClear.call(this);
  1419.     this._bodyWindow.refresh();
  1420. };
  1421.  
  1422. //
  1423. // fix it for Yanfly equip
  1424. //
  1425. //=============================================================================
  1426. if (Imported.YEP_EquipCore == true){
  1427. //=============================================================================
  1428. Window_EquipItem.prototype.setSlotId = function(slotId) {
  1429.     if (this._slotId !== slotId) {
  1430.         this._slotId = slotId;
  1431.         this.refresh();
  1432.         this.resetScroll();
  1433.     }
  1434. };
  1435. //=============================================================================
  1436. Window_EquipSlot.prototype.drawItem = function(index) {
  1437.     if (BM.Equip.ENameIcon == 'names'){
  1438.         if (!this._actor) return;
  1439.         var rect = this.itemRectForText(index);
  1440.         this.changeTextColor(this.systemColor());
  1441.         this.changePaintOpacity(this.isEnabled(index));
  1442.         var ww1 = this._nameWidth;
  1443.         this.drawText(this.slotName(index), rect.x, rect.y, ww1);
  1444.         var ww2 = this.contents.width - ww1;
  1445.         var item = this._actor.equips()[index];
  1446.         if (item) {
  1447.             this.drawItemName(item, rect.x + ww1, rect.y);
  1448.         } else {
  1449.             this.drawEmptySlot(rect.x + ww1, rect.y, ww2);
  1450.         }
  1451.         this.changePaintOpacity(true);
  1452.     } else {
  1453.         if (this._actor) {
  1454.             var rect = this.itemRectForText(index);
  1455.             this.changeTextColor(this.systemColor());
  1456.             this.changePaintOpacity(this.isEnabled(index));
  1457.             var ww1 = Window_Base._iconWidth + 10;
  1458.             this.drawEquipSlotIcon(index, rect.x, rect.y)
  1459.             var ww2 = this.contents.width - ww1;
  1460.             var item = this._actor.equips()[index];
  1461.             if (item) {
  1462.                 this.drawItemName(item, rect.x + ww1, rect.y);
  1463.             } else {
  1464.                 this.drawEmptySlot(rect.x + ww1, rect.y, ww2);
  1465.             }
  1466.             this.changePaintOpacity(true);         
  1467.         }
  1468.     }
  1469. };
  1470. //=============================================================================
  1471. Scene_Equip.prototype.createCompareWindow = function() {
  1472.     this._lowerRightWindows = [];
  1473.     var wx = this._bodyWindow.x;
  1474.     var wy = this._bodyWindow.y;
  1475.     var ww = Graphics.boxWidth - wx;
  1476.     var wh = Graphics.boxHeight - wy;
  1477.     this._compareWindow = new Window_EquipStatus(wx, wy);
  1478.     this._slotWindow.setStatusWindow(this._compareWindow);
  1479.     this._itemWindow.setStatusWindow(this._compareWindow);
  1480.     this.addWindow(this._compareWindow);
  1481.     this._lowerRightWindows.push(this._compareWindow);
  1482.     if (Imported.YEP_ItemCore && eval(Yanfly.Param.ItemSceneItem)) {
  1483.       this.createItemInfoWindow();
  1484.     }
  1485.     if (Imported.YEP_X_EquipRequirements && Yanfly.Param.EqReqWindow){
  1486.       this.createRequirementWindow();
  1487.     }  
  1488. };
  1489. Scene_Equip.prototype.createItemInfoWindow = function() {
  1490.     var wx = this._bodyWindow.x;
  1491.     var wy = this._bodyWindow.y;
  1492.     var ww = this._bodyWindow.width;
  1493.     var wh = this._bodyWindow.height;
  1494.     this._infoWindow = new Window_ItemInfo(wx, wy, ww, wh);
  1495.     this._slotWindow.setInfoWindow(this._infoWindow);
  1496.     this._itemWindow.setInfoWindow(this._infoWindow);
  1497.     this.addWindow(this._infoWindow);
  1498.     this._lowerRightWindows.push(this._infoWindow);
  1499. };
  1500. Scene_Equip.prototype.createRequirementWindow = function() {
  1501.     var wx = this._bodyWindow.x;
  1502.     var wy = this._bodyWindow.y;
  1503.     var ww = this._bodyWindow.width;
  1504.     var wh = this._bodyWindow.height;
  1505.     this._requirementWindow = new Window_EquipRequirement(wx, wy, ww, wh);
  1506.     this._slotWindow.setRequirementWindow(this._requirementWindow);
  1507.     this._itemWindow.setRequirementWindow(this._requirementWindow);
  1508.     this.addWindow(this._requirementWindow);
  1509.     this._lowerRightWindows.push(this._requirementWindow);
  1510. };
  1511. Scene_Equip.prototype.updateLowerRightWindowTriggers = function() {
  1512.     if (!this._itemWindow.active)  {
  1513.         return;
  1514.     }
  1515.     if (!this._lowerRightVisibility) return;
  1516.     if (Input.isRepeated('right')) {
  1517.       this.shiftLowerRightWindows();
  1518.     } else if (Input.isRepeated('left')) {
  1519.       this.unshiftLowerRightWindows();
  1520.     } else if (Input.isRepeated('tab')) {
  1521.       this.shiftLowerRightWindows();
  1522.     } else if (this.isLowerWindowTouched()) {
  1523.       this.shiftLowerRightWindows();
  1524.     }
  1525. };
  1526. }
  1527. //=============================================================================
  1528. Window_StatCompare.prototype.refresh = function() {
  1529.     this.contents.clear();
  1530.     if (this._actor) {
  1531.         if (BM.Equip.EBodyStatus && BM.Equip.PaperDollMode == false) this.drawActorEBody(this._actor, 0, 0);       
  1532.         this.contents.fontSize = BM.Equip.EParamFontSize
  1533.         var param = BM.Equip.EParameters
  1534.         var y = this.lineHeight() * 0 + this.bmPadding()
  1535.         var h = this.contents.height - y - this.bmPadding()
  1536.         var tf = h / this.textLineHeight();
  1537.         var pf = Math.floor(Math.min(tf,param.length));
  1538.         var dh = pf * this.textLineHeight();
  1539.         var dy = Math.floor((h - dh)/2 + this.bmPadding()/2);
  1540.         y = y + dy
  1541.         for (var i = 0; i < pf; i++) {
  1542.             this.drawItem(this.bmPadding(), y, param[i]);
  1543.             this.contents.fontSize = BM.Equip.EParamFontSize
  1544.             y += this.textLineHeight()
  1545.         }
  1546.         this.resetFontSettings();
  1547.     }
  1548. };
  1549. Window_StatCompare.prototype.drawItem = function(x, y, paramName) {
  1550.     this.drawDarkRect(x, y, this.contents.width-x-this.bmPadding(), this.textLineHeight());
  1551.     this.drawRightArrow(y);
  1552.     var percent = true
  1553.     if (paramName){
  1554.         this.drawParamName(y, paramName);
  1555.         var percent = this.checkParamPercent(paramName)
  1556.         if (this._actor) {
  1557.             this.drawCurrentParam(y, paramName, percent);
  1558.         }      
  1559.         if (this._tempActor) {
  1560.             this.drawNewParam(y, paramName, percent);
  1561.             if (BM.Equip.EShowDifference) this.drawParamDifference(y, paramName, percent);
  1562.         }
  1563.     }
  1564. };
  1565. Window_StatCompare.prototype.drawRightArrow = function(y) {
  1566.     var x = this.contents.width - this.textPadding();
  1567.     x -= this._paramValueWidth * 2 + this._arrowWidth;
  1568.     var dw = this.textWidth('\u2192' + ' ');
  1569.     this.changeTextColor(this.systemColor());
  1570.     this.drawText('\u2192', x, y, dw, 'right');
  1571. };
  1572. Window_StatCompare.prototype.drawParamName = function(y, paramName) {
  1573.     var x = this.textPadding();
  1574.     this.changeTextColor(this.systemColor());
  1575.     var name = TextManager.paramName(paramName);
  1576.     this.drawText(name, x, y, this._paramNameWidth);
  1577. };
  1578. Window_StatCompare.prototype.drawCurrentParam = function(y, paramName, percent) {
  1579.     var x = this.contents.width - this.textPadding();
  1580.     x -= this._paramValueWidth * 3 + this._arrowWidth;
  1581.     this.resetTextColor();
  1582.     if (eval("this._actor." + paramName, this) != undefined) {
  1583.     var value = eval("this._actor." + paramName, this);
  1584.     if (percent == true) {         
  1585.         value = Math.round(value * 100) + "%";
  1586.     }
  1587.     this.drawText(value, x, y, this._paramValueWidth, 'right');
  1588.     }
  1589. };
  1590. Window_StatCompare.prototype.drawNewParam = function(y, paramName, percent) {
  1591.     var x = this.contents.width - this.textPadding()*2;
  1592.     x -= this._paramValueWidth;
  1593.     if (eval("this._tempActor." + paramName, this) != undefined) {
  1594.     var oldValue = eval("this._actor." + paramName, this);
  1595.     var newValue = eval("this._tempActor." + paramName, this);
  1596.     var diffvalue = newValue - oldValue;
  1597.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1598.     if (percent == true) {
  1599.         newValue = Math.round(newValue * 100) + "%";
  1600.     }
  1601.     if (diffvalue > 0 && BM.Icon.Plus && BM.Icon.Plus != 0){
  1602.         this.drawIcon(BM.Icon.Plus, x, y)
  1603.     }
  1604.     if (diffvalue < 0 && BM.Icon.Minus && BM.Icon.Minus != 0){
  1605.         this.drawIcon(BM.Icon.Minus, x, y)
  1606.     }
  1607.     this.drawText(newValue, 0, y, this.contents.width-this.textPadding(), 'right');
  1608.  
  1609.     }
  1610. };
  1611. Window_StatCompare.prototype.drawParamDifference = function(y, paramName, percent) {
  1612.     this.contents.fontSize = BM.Equip.EParamFontSize/1.5
  1613.     var x = this.contents.width - this.textPadding();
  1614.     x -= this._paramValueWidth * 2 + this._arrowWidth/2;
  1615.     if (eval("this._tempActor." + paramName, this) != undefined) {
  1616.     var oldValue = eval("this._actor." + paramName, this);
  1617.     var newValue = eval("this._tempActor." + paramName, this);
  1618.     var diffvalue = newValue - oldValue;
  1619.     this.changeTextColor(this.paramchangeTextColor(diffvalue));
  1620.     var text = diffvalue;
  1621.     if (percent == true) {
  1622.         text = Math.round(text * 100) + "%";
  1623.     }
  1624.     text = (diffvalue > 0 ? '+' : '') + text
  1625.     text = (diffvalue != 0 ? '(' + text + ')' : '')
  1626.     this.drawText(text, x, y - this.contents.fontSize/1.5, this._bonusValueWidth, 'left');
  1627.     }
  1628. };
  1629. Window_StatCompare.prototype.bmPadding = function() {
  1630.     return BM.Equip.Window_EquipStatus_standardPadding() - this.padding
  1631. };
  1632. Window_StatCompare.prototype.standardPadding = function() {
  1633.     return BM.Equip.EBodyStatus ? BM.Equip.EBodyPadding : BM.Equip.Window_EquipStatus_standardPadding();
  1634. };
RAW Paste Data
Want to get better at JavaScript?
Learn to code JavaScript in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top