Advertisement
Double_X

DoubleX RMMV Skill Progress Compatibility v100a

Dec 6th, 2019 (edited)
692
0
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.  *      Mentioned Patreon Supporters:
  33.  *      https://www.patreon.com/posts/71738797
  34.  *----------------------------------------------------------------------------
  35.  *    # Author
  36.  *      DoubleX
  37.  *----------------------------------------------------------------------------
  38.  *    # Changelog
  39.  *      v1.00a(GMT 1100 6-Dec-2019):
  40.  *      1. 1st version of this plugin finished
  41.  *============================================================================*/
  42. /*:
  43.  * @plugindesc Fixes DoubleX RMMV Skill Progress compatibility issues
  44.  * @author DoubleX
  45.  *
  46.  * @help
  47.  *============================================================================
  48.  *    ## Addressed Plugins
  49.  *----------------------------------------------------------------------------
  50.  *    # DoubleX RMMV Skill Hotkeys
  51.  *      1. Progress command window and hotkey command window are needlessly
  52.  *         separate
  53.  *         - Reference tag: DoubleX_RMMV.Skill_Hotkeys.onItemOk
  54.  *         - Combined the view progress command from its window into the hotkey
  55.  *           counterpart to be more effective and efficient
  56.  *    # Yanfly Engine Plugins - Skill Learn System
  57.  *      1. All skills that shouldn't be learnable are falsely learnable
  58.  *         - Reference tag: YEP_SkillLearnSystem_Window_SkillLearnEnabled
  59.  *         - Added Window_SkillLearn.prototype.isCurrentItemEnabled using the
  60.  *           original Window_SkillList counterpart logic to stop
  61.  *           DoubleX RMMV Skill Progress from breaking isCurrentItemEnabled in
  62.  *           Window_SkillLearn
  63.  *============================================================================
  64.  */
  65.  
  66. "use strict";
  67. var DoubleX_RMMV = DoubleX_RMMV || {};
  68. DoubleX_RMMV["Skill Progress Compatibility"] = "v1.00a";
  69.  
  70. /*============================================================================
  71.  *    ## Plugin Implementations
  72.  *       You need not edit this part as it's about how this plugin works
  73.  *----------------------------------------------------------------------------
  74.  *    # Plugin Support Info:
  75.  *      1. Prerequisites
  76.  *         - Basic knowledge of how DoubleX RMMV Skill Progress and each
  77.  *           addressed plugin works
  78.  *         - Some Javascript coding proficiency to fully comprehend this
  79.  *           plugin
  80.  *----------------------------------------------------------------------------*/
  81.  
  82. if (DoubleX_RMMV["Skill Progress"]) {
  83.  
  84. DoubleX_RMMV.Skill_Progress_Compatibility = {};
  85.  
  86. /*----------------------------------------------------------------------------*/
  87.  
  88. if (DoubleX_RMMV.Skill_Hotkeys) {
  89.  
  90. /*----------------------------------------------------------------------------
  91.  *    # Edit class: Window_SkillHotkeyCmd
  92.  *      - Integrates the bind command into the skill progress command window
  93.  *----------------------------------------------------------------------------*/
  94.  
  95. (function(SPC, SP) {
  96.  
  97.     "use strict";
  98.  
  99.     var _WSHC = SPC.Window_SkillHotkeyCmd = { orig: {}, new: {} };
  100.     var $ = Window_SkillHotkeyCmd.prototype;
  101.  
  102.     _WSHC.orig._makeCmdList = $._makeCmdList;
  103.     _WSHC.new._makeCmdList = $._makeCmdList = function(skillId) {
  104.     // v1.00a - v1.00a; Extended
  105.         _WSHC.orig._makeCmdList.apply(this, arguments);
  106.         // Added to integrate the view skill progress command from its window
  107.         var skillProgress = SceneManager._scene._skillProgress;
  108.         if (!skillProgress) return;
  109.         var cmdView = SP.params.cmdView.call(skillProgress.cmdWin);
  110.         this.addCommand(cmdView, "viewSkillProgress",
  111.                 skillId && this._actor.isSkillProgress(skillId));
  112.         //
  113.     }; // $._makeCmdList
  114.  
  115. })(DoubleX_RMMV.Skill_Progress_Compatibility, DoubleX_RMMV.Skill_Progress);
  116.  
  117. /*----------------------------------------------------------------------------
  118.  *    # Edit class: Scene_Skill
  119.  *      - Integrates skillHotkeys._cmdWindow into _skillProgress.cmdWin
  120.  *----------------------------------------------------------------------------*/
  121.  
  122. (function(SPC, SP, SH) {
  123.  
  124.     "use strict";
  125.  
  126.     var _SS = SPC.Scene_Skill = { orig: {}, SP: {}, SH: {} };
  127.     var _SP = SP.Scene_Skill.new, _SH = SH.Scene_Skill.new;
  128.     var _WS = SP.Window_SkillList.orig, $ = Scene_Skill.prototype;
  129.  
  130.     _SS.orig.onItemOk = $.onItemOk;
  131.     _SP.onItemOk = $.onItemOk = function() { // v1.00a - v1.00a; Extended
  132.         // Edited to integrate the view progress and bind hotkey commands
  133.         if (_SH._isSetupCmdWindow.call(this)) {
  134.             return _SH._setupCmdWindow.call(this);
  135.         }
  136.         var enabled = _WS.isEnabled.call(this._itemWindow, this.item());
  137.         var progress = _SP._isSkillProgress.call(this);
  138.         if (enabled && progress) return this._skillProgress.cmdWin.setup();
  139.         if (!enabled && progress) return _SP._showSkillProgress.call(this);
  140.         if (enabled && !progress) _SS.orig.onItemOk.apply(this, arguments);
  141.         //
  142.     }; // $.onItemOk
  143.  
  144.     _SS.SP._showSkillProgress = _SP._showSkillProgress;
  145.     _SP._showSkillProgress = function() { // v1.00a - v1.00a; Extended
  146.         // Added to cancel the hotkey command window which is an idempotent call
  147.         _SH._onCmdWindowCancel.call(this);
  148.         //
  149.         // The ordering must be this or stat cond next win won't close properly
  150.         _SS.SP._showSkillProgress.apply(this, arguments);
  151.         //
  152.     }; // _SP._showSkillProgress
  153.  
  154.     _SS.SH._hotkeyCmdWindow = _SH._hotkeyCmdWindow;
  155.     _SH._hotkeyCmdWindow = function() { // v1.00a - v1.00a; Extended
  156.         var win = _SS.SH._hotkeyCmdWindow.apply(this, arguments);
  157.         // Added to set the bind hotkey handler
  158.         win.setHandler("viewSkillProgress", _SP._showSkillProgress.bind(this));
  159.         // DoubleX_RMMV.Skill_Hotkeys.onItemOk
  160.         return win;
  161.     }; // _SH._hotkeyCmdWindow
  162.  
  163. })(DoubleX_RMMV.Skill_Progress_Compatibility, DoubleX_RMMV.Skill_Progress,
  164.         DoubleX_RMMV.Skill_Hotkeys);
  165.  
  166. } // if (DoubleX_RMMV.Skill_Hotkeys)
  167.  
  168. /*----------------------------------------------------------------------------*/
  169.  
  170. var Imported = Imported || {};
  171. if (Imported.YEP_SkillLearnSystem) {
  172.  
  173. /*----------------------------------------------------------------------------
  174.  *    # Edit class: Window_SkillLearn
  175.  *      - Stops Skill Progress from breaking skill learnabilities
  176.  *----------------------------------------------------------------------------*/
  177.  
  178. (function(SP) {
  179.  
  180.     "use strict";
  181.  
  182.     var _WSL = SP.Window_SkillList.orig, $ = Window_SkillLearn.prototype;
  183.  
  184.     /**
  185.      * Nullipotent
  186.      * @interface @since v1.00a @version v1.00a
  187.      * @returns {Boolean} The check result
  188.      */
  189.     $.isCurrentItemEnabled = $.isCurrentItemEnabled || function() {
  190.         // Yanfly can add the vanilla one to fix compatibility with all plugins
  191.         return _WSL.isCurrentItemEnabled.call(this);
  192.         // YEP_SkillLearnSystem_Window_SkillLearnEnabled
  193.     }; // $.isCurrentItemEnabled
  194.  
  195. })(DoubleX_RMMV.Skill_Progress);
  196.  
  197. } // if (Imported.YEP_SkillLearnSystem)
  198.  
  199. /*----------------------------------------------------------------------------*/
  200.  
  201. } else {
  202.     alert("Place Skill Progress Compatibility below Skill Progress.");
  203. }
  204.  
  205. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement