Double_X

DoubleX RMMV Skill Progress Compatibility v100a

Dec 6th, 2019
324
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*============================================================================
  2.  *    ## Plugin Info
  3.  *----------------------------------------------------------------------------
  4.  *    # Plugin Name
  5.  *      DoubleX RMMV Skill Progress Compatibility
  6.  *----------------------------------------------------------------------------
  7.  *    # Terms Of Use
  8.  *      1. Commercial use's always allowed and crediting me's always optional.
  9.  *      2. You shall keep this plugin's Plugin Info part's contents intact.
  10.  *      3. You shalln't claim that this plugin's written by anyone other than
  11.  *         DoubleX or my aliases. I always reserve the right to deny you from
  12.  *         using any of my plugins anymore if you've violated this.
  13.  *      4. If you repost this plugin directly(rather than just linking back),
  14.  *         you shall inform me of these direct repostings. I always reserve
  15.  *         the right to request you to edit those direct repostings.
  16.  *      5. CC BY 4.0, except those conflicting with any of the above, applies
  17.  *         to this plugin, unless you've my permissions not needing follow so.
  18.  *      6. I always reserve the right to deny you from using this plugin
  19.  *         anymore if you've violated any of the above.
  20.  *----------------------------------------------------------------------------
  21.  *    # Prerequisites
  22.  *      Plugins:
  23.  *      1. DoubleX RMMV Skill Progress
  24.  *      Abilities:
  25.  *      1. Nothing special
  26.  *----------------------------------------------------------------------------
  27.  *    # Links
  28.  *      DoubleX RMMV Skill Progress:
  29.  *      1. https://pastebin.com/6XdtFJYD
  30.  *      This plugin:
  31.  *      1. https://pastebin.com/PhPhgJry
  32.  *----------------------------------------------------------------------------
  33.  *    # Author
  34.  *      DoubleX
  35.  *----------------------------------------------------------------------------
  36.  *    # Changelog
  37.  *      v1.00a(GMT 1100 6-Dec-2019):
  38.  *      1. 1st version of this plugin finished
  39.  *============================================================================*/
  40. /*:
  41.  * @plugindesc Fixes DoubleX RMMV Skill Progress compatibility issues
  42.  * @author DoubleX
  43.  *
  44.  * @help
  45.  *============================================================================
  46.  *    ## Addressed Plugins
  47.  *----------------------------------------------------------------------------
  48.  *    # DoubleX RMMV Skill Hotkeys
  49.  *      1. Progress command window and hotkey command window are needlessly
  50.  *         separate
  51.  *         - Reference tag: DoubleX_RMMV.Skill_Hotkeys.onItemOk
  52.  *         - Combined the view progress command from its window into the hotkey
  53.  *           counterpart to be more effective and efficient
  54.  *    # Yanfly Engine Plugins - Skill Learn System
  55.  *      1. All skills that shouldn't be learnable are falsely learnable
  56.  *         - Reference tag: YEP_SkillLearnSystem_Window_SkillLearnEnabled
  57.  *         - Added Window_SkillLearn.prototype.isCurrentItemEnabled using the
  58.  *           original Window_SkillList counterpart logic to stop
  59.  *           DoubleX RMMV Skill Progress from breaking isCurrentItemEnabled in
  60.  *           Window_SkillLearn
  61.  *============================================================================
  62.  */
  63.  
  64. "use strict";
  65. var DoubleX_RMMV = DoubleX_RMMV || {};
  66. DoubleX_RMMV["Skill Progress Compatibility"] = "v1.00a";
  67.  
  68. /*============================================================================
  69.  *    ## Plugin Implementations
  70.  *       You need not edit this part as it's about how this plugin works
  71.  *----------------------------------------------------------------------------
  72.  *    # Plugin Support Info:
  73.  *      1. Prerequisites
  74.  *         - Basic knowledge of how DoubleX RMMV Skill Progress and each
  75.  *           addressed plugin works
  76.  *         - Some Javascript coding proficiency to fully comprehend this
  77.  *           plugin
  78.  *----------------------------------------------------------------------------*/
  79.  
  80. if (DoubleX_RMMV["Skill Progress"]) {
  81.  
  82. DoubleX_RMMV.Skill_Progress_Compatibility = {};
  83.  
  84. /*----------------------------------------------------------------------------*/
  85.  
  86. if (DoubleX_RMMV.Skill_Hotkeys) {
  87.  
  88. /*----------------------------------------------------------------------------
  89.  *    # Edit class: Window_SkillHotkeyCmd
  90.  *      - Integrates the bind command into the skill progress command window
  91.  *----------------------------------------------------------------------------*/
  92.  
  93. (function(SPC, SP) {
  94.  
  95.     "use strict";
  96.  
  97.     var _WSHC = SPC.Window_SkillHotkeyCmd = { orig: {}, new: {} };
  98.     var $ = Window_SkillHotkeyCmd.prototype;
  99.  
  100.     _WSHC.orig._makeCmdList = $._makeCmdList;
  101.     _WSHC.new._makeCmdList = $._makeCmdList = function(skillId) {
  102.     // v1.00a - v1.00a; Extended
  103.         _WSHC.orig._makeCmdList.apply(this, arguments);
  104.         // Added to integrate the view skill progress command from its window
  105.         var skillProgress = SceneManager._scene._skillProgress;
  106.         if (!skillProgress) return;
  107.         var cmdView = SP.params.cmdView.call(skillProgress.cmdWin);
  108.         this.addCommand(cmdView, "viewSkillProgress",
  109.                 skillId && this._actor.isSkillProgress(skillId));
  110.         //
  111.     }; // $._makeCmdList
  112.  
  113. })(DoubleX_RMMV.Skill_Progress_Compatibility, DoubleX_RMMV.Skill_Progress);
  114.  
  115. /*----------------------------------------------------------------------------
  116.  *    # Edit class: Scene_Skill
  117.  *      - Integrates skillHotkeys._cmdWindow into _skillProgress.cmdWin
  118.  *----------------------------------------------------------------------------*/
  119.  
  120. (function(SPC, SP, SH) {
  121.  
  122.     "use strict";
  123.  
  124.     var _SS = SPC.Scene_Skill = { orig: {}, SP: {}, SH: {} };
  125.     var _SP = SP.Scene_Skill.new, _SH = SH.Scene_Skill.new;
  126.     var _WS = SP.Window_SkillList.orig, $ = Scene_Skill.prototype;
  127.  
  128.     _SS.orig.onItemOk = $.onItemOk;
  129.     _SP.onItemOk = $.onItemOk = function() { // v1.00a - v1.00a; Extended
  130.         // Edited to integrate the view progress and bind hotkey commands
  131.         if (_SH._isSetupCmdWindow.call(this)) {
  132.             return _SH._setupCmdWindow.call(this);
  133.         }
  134.         var enabled = _WS.isEnabled.call(this._itemWindow, this.item());
  135.         var progress = _SP._isSkillProgress.call(this);
  136.         if (enabled && progress) return this._skillProgress.cmdWin.setup();
  137.         if (!enabled && progress) return _SP._showSkillProgress.call(this);
  138.         if (enabled && !progress) _SS.orig.onItemOk.apply(this, arguments);
  139.         //
  140.     }; // $.onItemOk
  141.  
  142.     _SS.SP._showSkillProgress = _SP._showSkillProgress;
  143.     _SP._showSkillProgress = function() { // v1.00a - v1.00a; Extended
  144.         // Added to cancel the hotkey command window which is an idempotent call
  145.         _SH._onCmdWindowCancel.call(this);
  146.         //
  147.         // The ordering must be this or stat cond next win won't close properly
  148.         _SS.SP._showSkillProgress.apply(this, arguments);
  149.         //
  150.     }; // _SP._showSkillProgress
  151.  
  152.     _SS.SH._hotkeyCmdWindow = _SH._hotkeyCmdWindow;
  153.     _SH._hotkeyCmdWindow = function() { // v1.00a - v1.00a; Extended
  154.         var win = _SS.SH._hotkeyCmdWindow.apply(this, arguments);
  155.         // Added to set the bind hotkey handler
  156.         win.setHandler("viewSkillProgress", _SP._showSkillProgress.bind(this));
  157.         // DoubleX_RMMV.Skill_Hotkeys.onItemOk
  158.         return win;
  159.     }; // _SH._hotkeyCmdWindow
  160.  
  161. })(DoubleX_RMMV.Skill_Progress_Compatibility, DoubleX_RMMV.Skill_Progress,
  162.         DoubleX_RMMV.Skill_Hotkeys);
  163.  
  164. } // if (DoubleX_RMMV.Skill_Hotkeys)
  165.  
  166. /*----------------------------------------------------------------------------*/
  167.  
  168. var Imported = Imported || {};
  169. if (Imported.YEP_SkillLearnSystem) {
  170.  
  171. /*----------------------------------------------------------------------------
  172.  *    # Edit class: Window_SkillLearn
  173.  *      - Stops Skill Progress from breaking skill learnabilities
  174.  *----------------------------------------------------------------------------*/
  175.  
  176. (function(SP) {
  177.  
  178.     "use strict";
  179.  
  180.     var _WSL = SP.Window_SkillList.orig, $ = Window_SkillLearn.prototype;
  181.  
  182.     /**
  183.      * Nullipotent
  184.      * @interface @since v1.00a @version v1.00a
  185.      * @returns {Boolean} The check result
  186.      */
  187.     $.isCurrentItemEnabled = $.isCurrentItemEnabled || function() {
  188.         // Yanfly can add the vanilla one to fix compatibility with all plugins
  189.         return _WSL.isCurrentItemEnabled.call(this);
  190.         // YEP_SkillLearnSystem_Window_SkillLearnEnabled
  191.     }; // $.isCurrentItemEnabled
  192.  
  193. })(DoubleX_RMMV.Skill_Progress);
  194.  
  195. } // if (Imported.YEP_SkillLearnSystem)
  196.  
  197. /*----------------------------------------------------------------------------*/
  198.  
  199. } else {
  200.     alert("Place Skill Progress Compatibility below Skill Progress.");
  201. }
  202.  
  203. /*============================================================================*/
RAW Paste Data