SHARE
TWEET

BM_EquipCore

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