Advertisement
Jragyn

[MV] J_Base

Sep 20th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* -------------------------------------------------------------------------- */
  2. // J_Base
  3. // V: 1.2
  4. //
  5. /*:@plugindesc The core plugin that basically handles setup, icons, text, etc. This should go above any other plugins of mine you use!
  6. @author J
  7.  
  8. @param MHP-icon
  9. @desc This is the icon ID for the MHP stat to be displayed.
  10. @default 247
  11. @param MMP-icon
  12. @desc This is the icon ID for the MMP stat to be displayed.
  13. @default 248
  14. @param ATK-icon
  15. @desc This is the icon ID for the ATK stat to be displayed.
  16. @default 250
  17. @param DEF-icon
  18. @desc This is the icon ID for the DEF stat to be displayed.
  19. @default 251
  20. @param MAT-icon
  21. @desc This is the icon ID for the MAT stat to be displayed.
  22. @default 252
  23. @param MDF-icon
  24. @desc This is the icon ID for the MDF stat to be displayed.
  25. @default 253
  26. @param AGI-icon
  27. @desc This is the icon ID for the AGI stat to be displayed.
  28. @default 254
  29. @param LUK-icon
  30. @desc This is the icon ID for the LUK stat to be displayed.
  31. @default 255
  32. @param EXP-icon
  33. @desc This is the icon ID for the EXP stat to be displayed.
  34. @default 125
  35. @param GOLD-icon
  36. @desc This is the icon ID for the GOLD stat to be displayed.
  37. @default 313
  38. @param DROP-icon
  39. @desc This is the icon ID for the 182 stat to be displayed.
  40. @default 182
  41. @param ---SPARAM---
  42. @param TGR-text
  43. @desc This is the text displayed for the TGR stat.
  44. @default Targeting
  45. @param TGR-icon
  46. @desc This is the icon ID for the TGR stat to be displayed.
  47. @default 14
  48. @param GRD-text
  49. @desc This is the text displayed for the GRD stat.
  50. @default Guard Rate
  51. @param GRD-icon
  52. @desc This is the icon ID for the GRD stat to be displayed.
  53. @default 12
  54. @param REC-text
  55. @desc This is the text displayed for the REC stat.
  56. @default Recovery Rate
  57. @param REC-icon
  58. @desc This is the icon ID for the REC stat to be displayed.
  59. @default 7
  60. @param PHA-text
  61. @desc This is the text displayed for the PHA stat.
  62. @default Item Amp
  63. @param PHA-icon
  64. @desc This is the icon ID for the PHA stat to be displayed.
  65. @default 176
  66. @param MCR-text
  67. @desc This is the text displayed for the MCR stat.
  68. @default MP Reduce
  69. @param MCR-icon
  70. @desc This is the icon ID for the MCR stat to be displayed.
  71. @default 79
  72. @param TCR-text
  73. @desc This is the text displayed for the TCR stat.
  74. @default TP Charge
  75. @param TCR-icon
  76. @desc This is the icon ID for the TCR stat to be displayed.
  77. @default 76
  78. @param PDR-text
  79. @desc This is the text displayed for the PDR stat.
  80. @default PhysDMG%
  81. @param PDR-icon
  82. @desc This is the icon ID for the PDR stat to be displayed.
  83. @default 51
  84. @param MDR-text
  85. @desc This is the text displayed for the MDR stat.
  86. @default MagiDMG%
  87. @param MDR-icon
  88. @desc This is the icon ID for the MDR stat to be displayed.
  89. @default 53
  90. @param FDR-text
  91. @desc This is the text displayed for the FDR stat.
  92. @default FloorDMG%
  93. @param FDR-icon
  94. @desc This is the icon ID for the FDR stat to be displayed.
  95. @default 54
  96. @param EXR-text
  97. @desc This is the text displayed for the EXR stat.
  98. @default EXPboost%
  99. @param EXR-icon
  100. @desc This is the icon ID for the EXR stat to be displayed.
  101. @default 249
  102. @param ---XPARAM---
  103. @param HIT-text
  104. @desc This is the text displayed for the HIT stat.
  105. @default Hit%
  106. @param HIT-icon
  107. @desc This is the icon ID for the HIT stat to be displayed.
  108. @default 102
  109. @param EVA-text
  110. @desc This is the text displayed for the EVA stat.
  111. @default Evade%
  112. @param EVA-icon
  113. @desc This is the icon ID for the EVA stat to be displayed.
  114. @default 6
  115. @param CRI-text
  116. @desc This is the text displayed for the CRI stat.
  117. @default Critical%
  118. @param CRI-icon
  119. @desc This is the icon ID for the CRI stat to be displayed.
  120. @default 78
  121. @param CEV-text
  122. @desc This is the text displayed for the CEV stat.
  123. @default Crit Evade
  124. @param CEV-icon
  125. @desc This is the icon ID for the CEV stat to be displayed.
  126. @default 74
  127. @param MEV-text
  128. @desc This is the text displayed for the MCR stat.
  129. @default M-Evade%
  130. @param MEV-icon
  131. @desc This is the icon ID for the MCR stat to be displayed.
  132. @default 9
  133. @param MRF-text
  134. @desc This is the text displayed for the MRF stat.
  135. @default M-Reflect%
  136. @param MRF-icon
  137. @desc This is the icon ID for the MRF stat to be displayed.
  138. @default 222
  139. @param CNT-text
  140. @desc This is the text displayed for the CNT stat.
  141. @default Counter%
  142. @param CNT-icon
  143. @desc This is the icon ID for the CNT stat to be displayed.
  144. @default 15
  145. @param HRG-text
  146. @desc This is the text displayed for the HRG stat.
  147. @default HP Regen%
  148. @param HRG-icon
  149. @desc This is the icon ID for the HRG stat to be displayed.
  150. @default 84
  151. @param MRG-text
  152. @desc This is the text displayed for the MRG stat.
  153. @default MP Regen%
  154. @param MRG-icon
  155. @desc This is the icon ID for the MRG stat to be displayed.
  156. @default 302
  157. @param TRG-text
  158. @desc This is the text displayed for the TRG stat.
  159. @default TP Regen
  160. @param TRG-icon
  161. @desc This is the icon ID for the TRG stat to be displayed.
  162. @default 70
  163. @param EL01-icon
  164. @desc This is the icon ID for element#1 (default: Physical-Slash).
  165. @default 123
  166. @param EL02-icon
  167. @desc This is the icon ID for element#2 (default: Physical-Pierce).
  168. @default 107
  169. @param EL03-icon
  170. @desc This is the icon ID for element#3 (default: Physical-Blunt).
  171. @default 110
  172. @param EL04-icon
  173. @desc This is the icon ID for element#4 (default: Fire).
  174. @default 64
  175. @param EL05-icon
  176. @desc This is the icon ID for element#5 (default: Water).
  177. @default 67
  178. @param EL06-icon
  179. @desc This is the icon ID for element#6 (default: Earth).
  180. @default 68
  181. @param EL07-icon
  182. @desc This is the icon ID for element#7 (default: Air).
  183. @default 69
  184. @param EL08-icon
  185. @desc This is the icon ID for element#8 (default: Holy).
  186. @default 70
  187. @param EL09-icon
  188. @desc This is the icon ID for element#9 (default: Darkness).
  189. @default 71
  190. @param EL10-icon
  191. @desc This is the icon ID for element#10 (default: Nonelemental).
  192. @default 118
  193.  
  194. @help This is a plugin that handles all of the assignment for icons used in my
  195.         "revamped" status screen and equip screen. It also adds icons into
  196.         basically any command menu for things like "inventory" and "save game".
  197.         Additionally, most note-reading handled throughout any plugins I write
  198.         is/will-be handled within this too, like my J_DropItem or J_XPGPvariance.
  199.  
  200. Changelog:
  201.   v1.2: Added in the function that uses text-to-icon function,
  202.             also added the note-reading to this plugin.
  203.  
  204.   v1.1: Added in text-to-icon function for use with all commands.
  205.   v1.0: Developed and soft-released.
  206. */
  207.  
  208. var Imported = Imported || {};
  209. Imported.J_Base = true;
  210.  
  211. var J = J || {};
  212.  
  213. J.Parameters = PluginManager.parameters('J_Base');
  214. J.Param = J.Param || {};
  215. J.Icon = J.Icon || {};
  216.  
  217. // New function for handling Icons throughout this plugin.
  218. function IconManager() {
  219.     throw new Error('This is a static class.');
  220. }
  221.  
  222. // Returns an iconID for use depending on the text in a command window.
  223. // this applies to any command window in the game.
  224. IconManager.textForIcon = function (text) {
  225.   switch (text) {
  226.     case TextManager.item: return 372;
  227.     case TextManager.skill: return 78;
  228.     case TextManager.equip: return 550;
  229.     case TextManager.optimize: return 90;
  230.     case TextManager.clear: return 91;
  231.     case TextManager.status: return 84;
  232.     case TextManager.formation: return 82;
  233.     case TextManager.options: return 83;
  234.     case TextManager.save: return 79;
  235.     case TextManager.gameEnd: return 91;
  236.     case TextManager.newGame: return 480;
  237.     case TextManager.continue_: return 342;
  238.     case TextManager.weapon: return 501;
  239.     case TextManager.armor: return 548;
  240.     case TextManager.keyItem: return 352;
  241.     case "Allocate": return 457;
  242.     case J.AddOns.Difficulty.getDifficultyName(0): return 497;
  243.     case J.AddOns.Difficulty.getDifficultyName(1): return 498;
  244.     case J.AddOns.Difficulty.getDifficultyName(2): return 501;
  245.     case "Load": return 342;
  246.     case "Delete": return 91;
  247.  
  248.     // for handling SRD_StatDistribution
  249.     case "Life Improver": return J.Icon.MHP_icon;
  250.     case "Yggdrasil Force": return J.Icon.HRG_icon;
  251.     case "Mind Expansion": return J.Icon.MMP_icon;
  252.     case "Meditation": return J.Icon.MRG_icon;
  253.     case "Power Blows": return J.Icon.ATK_icon;
  254.     case "Prowess": return J.Icon.TRG_icon;
  255.     case "Warrior's Eye": return J.Icon.TCR_icon;
  256.     case "Critical Edge": return J.Icon.CRI_icon;
  257.     case "Endurance Up": return J.Icon.DEF_icon;
  258.     case "Golem Heart": return J.Icon.PDR_icon;
  259.     case "Healing Amp": return J.Icon.REC_icon;
  260.     case "Force Focus": return J.Icon.MAT_icon;
  261.     case "Mage's Eye": return J.Icon.MCR_icon;
  262.     case "Magic Defense": return J.Icon.MDF_icon;
  263.     case "Planar Shield": return J.Icon.MDR_icon;
  264.     case "Good Fortune": return J.Icon.LUK_icon;
  265.     case "Sage's Wisdom": return J.Icon.EXP_icon;
  266.     case "Trap Guard": return J.Icon.FDR_icon;
  267.  
  268.     default: return 0;
  269.   }
  270. }
  271.  
  272. // Elemental-Icon handling:
  273. // Assigns icons based on the number from the default params.
  274. // Elemental names are not used, icons are instead.
  275. J.Icon.EL01_icon = Number(J.Parameters['EL01-icon']);
  276. J.Icon.EL02_icon = Number(J.Parameters['EL02-icon']);
  277. J.Icon.EL03_icon = Number(J.Parameters['EL03-icon']);
  278. J.Icon.EL04_icon = Number(J.Parameters['EL04-icon']);
  279. J.Icon.EL05_icon = Number(J.Parameters['EL05-icon']);
  280. J.Icon.EL06_icon = Number(J.Parameters['EL06-icon']);
  281. J.Icon.EL07_icon = Number(J.Parameters['EL07-icon']);
  282. J.Icon.EL08_icon = Number(J.Parameters['EL08-icon']);
  283. J.Icon.EL09_icon = Number(J.Parameters['EL09-icon']);
  284. J.Icon.EL10_icon = Number(J.Parameters['EL10-icon']);
  285.  
  286.  
  287. // B-Parameter handling:
  288. // Assigns icons based on the number from the default params.
  289. // B-Parameters by default are named in the database.
  290. J.Icon.MHP_icon = Number(J.Parameters['MHP-icon']);
  291. J.Icon.MMP_icon = Number(J.Parameters['MMP-icon']);
  292. J.Icon.ATK_icon = Number(J.Parameters['ATK-icon']);
  293. J.Icon.DEF_icon = Number(J.Parameters['DEF-icon']);
  294. J.Icon.MAT_icon = Number(J.Parameters['MAT-icon']);
  295. J.Icon.MDF_icon = Number(J.Parameters['MDF-icon']);
  296. J.Icon.AGI_icon = Number(J.Parameters['AGI-icon']);
  297. J.Icon.LUK_icon = Number(J.Parameters['LUK-icon']);
  298. J.Icon.EXP_icon = Number(J.Parameters['EXP-icon']);
  299. J.Icon.GOLD_icon = Number(J.Parameters['GOLD-icon']);
  300. J.Icon.DROP_icon = Number(J.Parameters['DROP-icon']);
  301.  
  302. // S-Parameter handling:
  303. // Assigns icons based on the number from the default params.
  304. // Assigns text names based on the default params since they are not defined in the database.
  305. J.Param.TGR_text = String(J.Parameters['TGR-text']); J.Icon.TGR_icon = Number(J.Parameters['TGR-icon']);
  306. J.Param.GRD_text = String(J.Parameters['GRD-text']); J.Icon.GRD_icon = Number(J.Parameters['GRD-icon']);
  307. J.Param.REC_text = String(J.Parameters['REC-text']); J.Icon.REC_icon = Number(J.Parameters['REC-icon']);
  308. J.Param.PHA_text = String(J.Parameters['PHA-text']); J.Icon.PHA_icon = Number(J.Parameters['PHA-icon']);
  309. J.Param.MCR_text = String(J.Parameters['MCR-text']); J.Icon.MCR_icon = Number(J.Parameters['MCR-icon']);
  310. J.Param.TCR_text = String(J.Parameters['TCR-text']); J.Icon.TCR_icon = Number(J.Parameters['TCR-icon']);
  311. J.Param.PDR_text = String(J.Parameters['PDR-text']); J.Icon.PDR_icon = Number(J.Parameters['PDR-icon']);
  312. J.Param.MDR_text = String(J.Parameters['MDR-text']); J.Icon.MDR_icon = Number(J.Parameters['MDR-icon']);
  313. J.Param.FDR_text = String(J.Parameters['FDR-text']); J.Icon.FDR_icon = Number(J.Parameters['FDR-icon']);
  314. J.Param.EXR_text = String(J.Parameters['EXR-text']); J.Icon.EXR_icon = Number(J.Parameters['EXR-icon']);
  315.  
  316. // X-Parameter handling:
  317. // Assigns icons based on the number from the default params.
  318. // Assigns text names based on the default params since they are not defined in the database.
  319. J.Param.HIT_text = String(J.Parameters['HIT-text']); J.Icon.HIT_icon = Number(J.Parameters['HIT-icon']);
  320. J.Param.EVA_text = String(J.Parameters['EVA-text']); J.Icon.EVA_icon = Number(J.Parameters['EVA-icon']);
  321. J.Param.CRI_text = String(J.Parameters['CRI-text']); J.Icon.CRI_icon = Number(J.Parameters['CRI-icon']);
  322. J.Param.CEV_text = String(J.Parameters['CEV-text']); J.Icon.CEV_icon = Number(J.Parameters['CEV-icon']);
  323. J.Param.MEV_text = String(J.Parameters['MEV-text']); J.Icon.MEV_icon = Number(J.Parameters['MEV-icon']);
  324. J.Param.MRF_text = String(J.Parameters['MRF-text']); J.Icon.MRF_icon = Number(J.Parameters['MRF-icon']);
  325. J.Param.CNT_text = String(J.Parameters['CNT-text']); J.Icon.CNT_icon = Number(J.Parameters['CNT-icon']);
  326. J.Param.HRG_text = String(J.Parameters['HRG-text']); J.Icon.HRG_icon = Number(J.Parameters['HRG-icon']);
  327. J.Param.MRG_text = String(J.Parameters['MRG-text']); J.Icon.MRG_icon = Number(J.Parameters['MRG-icon']);
  328. J.Param.TRG_text = String(J.Parameters['TRG-text']); J.Icon.TRG_icon = Number(J.Parameters['TRG-icon']);
  329.  
  330. TextManager.param.desc = function (paramId) {
  331.     switch (paramId) {// can be no longer than this line below, overflow is not handled.
  332.                      // "========================================================================================="
  333.         case 00: return "A numeric measurement of a person's life. Character will die upon depletion.";
  334.         case 03: return "A character's mental capacity. These are typically consumed in spellcasting and the like.";
  335.         case 06: return "Physical power. Improves physical skills/abilities and usually physical weapon attacks.";
  336.         case 09: return "Physical endurance. The tougher you are, the less damage taken from physical attacks.";
  337.         case 12: return "Mental prowess. Higher prowess yields more potent spells and some magical weapons.";
  338.         case 15: return "Magical resistance. Higher resistance reduces incoming spell and ability damage.";
  339.         case 18: return "Speed and agility. Take more actions, dodge more attacks, and act more ninja overall.";
  340.         case 21: return "Luck is used in a wide array of things, but typically provides more loot drops.";
  341.             //case 24: return "";
  342.             //case 27: return "";
  343.  
  344.         case 01: return "Targeting rate is normally zero, unless you are being extra sneaky or extra provacative.";
  345.         case 04: return "Higher guard rating will make defending exponentially more effective.";
  346.         case 07: return "Recovery rate is a percentage multiplier against all incoming healing.";
  347.         case 10: return "Item Amp is a percentage multiplier against the damage/healing effects of all items.";
  348.         case 13: return "Improving the MP Reduce stat will reduce the cost of spells costing MP by a percentage.";
  349.         case 16: return "TP Charge influences the rate at which you gain TP throughout battle.";
  350.         case 19: return "Compared to standard physical defense, this is a percentage reduction of physical damage.";
  351.         case 22: return "Compared to standard magical defense, this is a percentage reduction of magical damage.";
  352.         case 25: return "A percentage damage reduction from dangerous floors and environments.";
  353.         case 28: return "Heighting the rate at which you gain experience is the result of improving this stat.";
  354.  
  355.         case 02: return "The modified rating of accuracy, matched against the target's evasion to deliver a hit.";
  356.         case 05: return "The modified rating of evasion, matched against the target's accuracy to receive a hit.";
  357.         case 08: return "Critical Rate is the percentage chance that your attack will strike for critical damage.";
  358.         case 11: return "Similar to standard evasion, this reduces the chance of being struck by a critical hit.";
  359.         case 14: return "Provides a percentage chance that magical skills will be avoided entirely.";
  360.         case 17: return "Provides a chance to return a magical skill to the caster while taking no damage!";
  361.         case 20: return "Provides a chance to return a physical skill or attack to the caster!";
  362.         case 23: return "A percentage of life will be recovered gradually at this rate.";
  363.         case 26: return "A percentage of magic will be recovered gradually at this rate.";
  364.         case 29: return "A percentage of technica will be recovered gradually at this rate.";
  365.         default: return "";
  366.     }
  367. }
  368.  
  369. // Pulls text from the default params (user modified) for S-Parameters.
  370. // These by default do not have a name defined in the database.
  371. TextManager.sparam = function (sParamId) {
  372.     switch (sParamId) {
  373.         case 0: return J.Param.TGR_text;
  374.         case 1: return J.Param.GRD_text;
  375.         case 2: return J.Param.REC_text;
  376.         case 3: return J.Param.PHA_text;
  377.         case 4: return J.Param.MCR_text;
  378.         case 5: return J.Param.TCR_text;
  379.         case 6: return J.Param.PDR_text;
  380.         case 7: return J.Param.MDR_text;
  381.         case 8: return J.Param.FDR_text;
  382.         case 9: return J.Param.EXR_text;
  383.     }
  384. };
  385.  
  386. // Pulls text from the default params (user modified) for X-Parameters.
  387. // These by default do not have a name defined in the database.
  388. TextManager.xparam = function (xParamId) {
  389.     switch (xParamId) {
  390.         case 0: return J.Param.HIT_text;
  391.         case 1: return J.Param.EVA_text;
  392.         case 2: return J.Param.CRI_text;
  393.         case 3: return J.Param.CEV_text;
  394.         case 4: return J.Param.MEV_text;
  395.         case 5: return J.Param.MRF_text;
  396.         case 6: return J.Param.CNT_text;
  397.         case 7: return J.Param.HRG_text;
  398.         case 8: return J.Param.MRG_text;
  399.         case 9: return J.Param.TRG_text;
  400.     }
  401. };
  402.  
  403. // Assigns icons to elemental icons based on icon number provided in default params.
  404. IconManager.elemIcons = function (elemID) {
  405.     switch (elemID) {
  406.         case 00: return 16; // black circle; element ID starts at 1, not 0!
  407.         case 01: return J.Icon.EL01_icon;
  408.         case 02: return J.Icon.EL02_icon;
  409.         case 03: return J.Icon.EL03_icon;
  410.         case 04: return J.Icon.EL04_icon;
  411.         case 05: return J.Icon.EL05_icon;
  412.         case 06: return J.Icon.EL06_icon;
  413.         case 07: return J.Icon.EL07_icon;
  414.         case 08: return J.Icon.EL08_icon;
  415.         case 09: return J.Icon.EL09_icon;
  416.         case 10: return J.Icon.EL10_icon;
  417.     }
  418. }
  419.  
  420. // Assigns icons to B-parameter ID's based on icon number provided in default params.
  421. IconManager.bParams = function (bParamId) {
  422.     switch (bParamId) {
  423.         case 0: return J.Icon.MHP_icon;
  424.         case 1: return J.Icon.MMP_icon;
  425.         case 2: return J.Icon.ATK_icon;
  426.         case 3: return J.Icon.DEF_icon;
  427.         case 4: return J.Icon.MAT_icon;
  428.         case 5: return J.Icon.MDF_icon;
  429.         case 6: return J.Icon.AGI_icon;
  430.         case 7: return J.Icon.LUK_icon;
  431.         case 8: return J.Icon.EXP_icon;
  432.         case 9: return J.Icon.GOLD_icon;
  433.         case 10: return J.Icon.DROP_icon;
  434.     }
  435. }
  436.  
  437. // Assigns icons to S-parameter ID's based on icon number provided in default params.
  438. IconManager.sParams = function (sParamId) {
  439.     switch (sParamId) {
  440.         case 0: return J.Icon.TGR_icon;
  441.         case 1: return J.Icon.GRD_icon;
  442.         case 2: return J.Icon.REC_icon;
  443.         case 3: return J.Icon.PHA_icon;
  444.         case 4: return J.Icon.MCR_icon;
  445.         case 5: return J.Icon.TCR_icon;
  446.         case 6: return J.Icon.PDR_icon;
  447.         case 7: return J.Icon.MDR_icon;
  448.         case 8: return J.Icon.FDR_icon;
  449.         case 9: return J.Icon.EXR_icon;
  450.     }
  451. }
  452.  
  453. // Assigns icons to X-parameter ID's based on icon number provided in default params.
  454. IconManager.xParams = function (xParamId) {
  455.     switch (xParamId) {
  456.         case 0: return J.Icon.HIT_icon;
  457.         case 1: return J.Icon.EVA_icon;
  458.         case 2: return J.Icon.CRI_icon;
  459.         case 3: return J.Icon.CEV_icon;
  460.         case 4: return J.Icon.MEV_icon;
  461.         case 5: return J.Icon.MRF_icon;
  462.         case 6: return J.Icon.CNT_icon;
  463.         case 7: return J.Icon.HRG_icon;
  464.         case 8: return J.Icon.MRG_icon;
  465.         case 9: return J.Icon.TRG_icon;
  466.     }
  467. };
  468.  
  469. /* -------------------------------------------------------------------------- */
  470. //    MENU ICONS (OVERWRITES)
  471. // This method is a rewrite to add in the drawing of icons in the main
  472. // menu of the game. it pulls icons from J_Base aka IconManager and
  473. // assigns them to just about every command in the game.
  474. // Note: no icon is assigned by default.
  475. /* -------------------------------------------------------------------------- */
  476. Window_Command.prototype.drawItem = function(index) {
  477.     var rect = this.itemRectForText(index);
  478.     var align = this.itemTextAlign();
  479.     var iconIndex = IconManager.textForIcon(this.commandName(index));
  480.     this.resetTextColor();
  481.     this.changePaintOpacity(this.isCommandEnabled(index));
  482.     this.drawIcon(iconIndex, rect.x, rect.y); // NEW- adds in an icon.
  483.     this.drawText(this.commandName(index), rect.x + 36, rect.y, rect.width, align);
  484. };
  485.  
  486. Scene_Map.prototype.hideExtras = function() {
  487.   if ($gameMessage.isBusy() || $gameMap.isEventRunning()) return true;
  488.   return false;
  489. };
  490.  
  491. /* -------------------------------------------------------------------------- */
  492. //    NOTE READING
  493. // Rather than blitz through the notes multiple times, I opted to put much of the
  494. // note reading into this function, so other plugins like J_XPGPvariance will
  495. // need this to function. Since otherwise, this does basically nothing by
  496. // itself, it shouldn't be too harmful. (right?)
  497. /* -------------------------------------------------------------------------- */
  498. // hooks into the database loader method.
  499. // allows the loading of the database, and then the loading/assigning of all notes.
  500. // this makes it happen once per game-load.
  501. var _DataManager_jadd_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  502. DataManager.isDatabaseLoaded = function() {
  503.     var _jadd_loaded = false;
  504.     if (!_DataManager_jadd_isDatabaseLoaded.call(this))
  505.         return false;
  506.     if (!_jadd_loaded) {
  507.         this.jadd_readNotes($dataEnemies);
  508.         _jadd_loaded = true;
  509.     }
  510.     return true;
  511. };
  512.  
  513. DataManager.jadd_readNotes = function(data) {
  514.     var structure1 = /<(i|w|a):(\d+):(\d+)>/i; // for enemy extra drops
  515.     var structure2 = /<Level: (\d+)>/i; // for enemy level
  516.     var structure3 = /<GPmod: (\d+)>/i; // for gold variance
  517.     for (var i = 1; i < data.length; i++) {
  518.         var enemy = data[i]; // assigns the enemy variable by $dataEnemies[i]
  519.         var notedata = enemy.note.split(/[\r\n]+/); // separates notes by return/newLine
  520.         enemy.extraDrops = []; // creates new array to contain all drops
  521.         enemy.level = 0;
  522.         enemy.gpvar = 0;
  523.  
  524.         for (var n = 0; n < notedata.length; n++) {
  525.             var line = notedata[n];
  526.             if (line.match(structure1)) {
  527.                 var drop = { // mimics the DropItem object with identical properties
  528.                     kind: 1,        // default: i for item
  529.                     denominator: 0, // default: 0% drop chance
  530.                     dataId: 1,      // default: ID 1
  531.                 };
  532.                 switch (String(RegExp.$1).toLowerCase()) {
  533.                     case "i": drop.kind = 1; break;
  534.                     case "w": drop.kind = 2; break;
  535.                     case "a": drop.kind = 3; break;
  536.                     default: drop.kind = 1; break;
  537.                 };
  538.                 drop.dataId = Number(RegExp.$2); // ID of drop
  539.                 drop.denominator = Number(RegExp.$3); // rate of drop
  540.                 enemy.extraDrops.push(drop); // adds drop to the enemy's extraDrop array
  541.             }
  542.             else if (line.match(structure2)) {
  543.               enemy.level = Number(RegExp.$1); // assigns them a new level
  544.             }
  545.             else if (line.match(structure3)) { // assigns them gp drop variance amount
  546.               enemy.gpvar = Number(RegExp.$1);
  547.             }
  548.         }
  549.     }
  550. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement