blackmorning

BM_EquipCore

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