Guest User

STV_SimpleBeastBook

a guest
Nov 6th, 2016
289
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // STV_SimpleBeastBook.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc v1.0 - STV_SimpleBeastBook
  7.  * || This will add a Simple Beast Register to your Game.
  8.  * @author SkottyTV
  9.  *
  10.  * @param --- Functions ---
  11.  *
  12.  * @param Fill Behavior
  13.  * @desc How the Book will get filled.
  14.  * 1 = Encounter / 2 = Kill / 3 = None (only commands)
  15.  * @default 2
  16.  *
  17.  * @param Max Cat Cols
  18.  * @desc The Maximum Categorys visible at once.
  19.  * @default 4
  20.  *
  21.  * @param Show ID
  22.  * @desc Show ID in front of a Beast.
  23.  * (Show = TRUE / Hide = FALSE)
  24.  * @default TRUE
  25.  *
  26.  * @param ----- Text -----
  27.  *
  28.  * @param Unknown Text
  29.  * @desc The default Text for unknown data.
  30.  * @default ?????
  31.  *
  32.  * @param Description Text
  33.  * @desc The default Text for "Description:"
  34.  * @default Description:
  35.  *
  36.  *
  37.  * @help
  38.  *
  39.  * ////////////////////////////////////////////////////////////////////////////
  40.  * ----------------------------- Terms of Usage: ------------------------------
  41.  * ////////////////////////////////////////////////////////////////////////////
  42.  
  43.  * Feel free to use this Plugin in 1. Non-Commercial Games, 2. Commercial Games
  44.  * However it would be nice to give proper Credits to "SkottyTV"
  45.  * Also a free copy of your Game would be a nice move :)
  46.  *
  47.  * Have Fun And Enjoy! :)
  48.  *
  49.  *
  50.  *
  51.  * ////////////////////////////////////////////////////////////////////////////
  52.  * --------------------------------- Updates:----------------------------------
  53.  * ////////////////////////////////////////////////////////////////////////////
  54.  *
  55.  * Update v1.0
  56.  * - Basic Functionality
  57.  *
  58.  * ////////////////////////////////////////////////////////////////////////////
  59.  * -------------------------------- Commands: ---------------------------------
  60.  * ////////////////////////////////////////////////////////////////////////////
  61.  *
  62.  * Plugin Command:
  63.  *   SimpleBeastBook open           # Open the beast book screen.
  64.  *   SimpleBeastBook discover 3     # Discover enemy #3 in the beast book.
  65.  *
  66.  * Enemy Note:
  67.  *   <desc1:The mighty Clown>   # Description text in the Beast Book, line 1
  68.  *   <STVSBB Cat: Normal>       # Creates the Category "Normal" and determine
  69.  *                                this Beast to it.
  70.  *   <STVSBB Pic: Normal>       # Name of the default Picture for the Beast.
  71.  *                                Picture has to be under "img/enemies".
  72.  *                                Without this line the default picture is used.
  73.  *   <STVSBB Desc>              # Start of the Beast Description.
  74.  *   This is a Bat.             # Simple Text Description.
  75.  *   It has \i[5]Wings.         # Description Line with Icon.
  76.  *   It sucks \c[2]Blood.       # Description Line with colored Text.
  77.  *   </STVSBB Desc>             # End of the Beast Description.
  78.  *
  79.  */
  80.  
  81.  
  82. // ----------------------------------------------------------------------------------------------------------------------------
  83. // STV_BeastBook Parameters
  84. // ----------------------------------------------------------------------------------------------------------------------------
  85.     var stv_SimpleBeastBook_parameters = PluginManager.parameters('STV_SimpleBeastBook');
  86.    
  87.     //--- Functions ---
  88.     var stv_SimpleBeastBook_fillBehavior = Number(stv_SimpleBeastBook_parameters['Fill Behavior'] || 2);
  89.     var stv_SimpleBeastBook_maxCols = Number(stv_SimpleBeastBook_parameters['Max Cat Cols'] || 4);
  90.     var stv_SimpleBeastBook_showId = String(stv_SimpleBeastBook_parameters['Show ID'] || "TRUE");
  91.    
  92.     //----- Text -----
  93.     var stv_SimpleBeastBook_unknown = String(stv_SimpleBeastBook_parameters['Unknown Text'] || "?????");
  94.     var stv_SimpleBeastBook_descText = String(stv_SimpleBeastBook_parameters['Description Text'] || "Description:");
  95.  
  96. // ----------------------------------------------------------------------------------------------------------------------------
  97. // Scene SimpleBeastBook create
  98. // ----------------------------------------------------------------------------------------------------------------------------  
  99.     Scene_SimpleBeastBook = function() {
  100.         this.initialize.apply(this, arguments);
  101.     };
  102.  
  103.     Scene_SimpleBeastBook.prototype = Object.create(Scene_MenuBase.prototype);
  104.     Scene_SimpleBeastBook.prototype.constructor = Scene_SimpleBeastBook;
  105.  
  106.     Scene_SimpleBeastBook.prototype.initialize = function() {
  107.         Scene_MenuBase.prototype.initialize.call(this);
  108.         this._switch = false;
  109.     };                                                          
  110.    
  111.     Scene_SimpleBeastBook.prototype.create = function() {
  112.         Scene_MenuBase.prototype.create.call(this);
  113.        
  114.         this.createWindowPositions();
  115.         this.createCatWindow();
  116.         this.createBeastsWindow();
  117.         this.createSpriteWindow();
  118.         this.createInfoWindow();
  119.     };
  120.    
  121. // ----------------------------------------------------------------------------------------------------------------------------
  122. // Create Window Positions
  123. // ----------------------------------------------------------------------------------------------------------------------------
  124.     Scene_SimpleBeastBook.prototype.createWindowPositions = function() {
  125.         var maxWidth = Graphics.boxWidth,
  126.             maxHeight = Graphics.boxHeight;
  127.        
  128.         var cX = 0,
  129.             cY = 0,
  130.             cW = maxWidth,
  131.             cH = 72;
  132.         this._catWindow = new Window_SimpleBeastBook_Category(cX, cY, cW, cH);
  133.        
  134.         var bX = cX,
  135.             bY = cH,
  136.             bW = (maxWidth/3),
  137.             bH = maxHeight - cH;
  138.         this._beastsWindow = new Window_SimpleBeastBook_Beasts(bX, bY, bW, bH);
  139.        
  140.         var sX = bW,
  141.             sY = bY,
  142.             sW = maxWidth - bW,
  143.             sH = bH;
  144.         this._spriteWindow = new Window_SimpleBeastBook_Sprite(sX, sY, sW, sH);
  145.        
  146.         var iX = sX,
  147.             iY = sY,
  148.             iW = sW,
  149.             iH = sH;
  150.         this._infoWindow = new Window_SimpleBeastBook_Info(iX, iY, iW, iH);
  151.     };
  152.  
  153. // ----------------------------------------------------------------------------------------------------------------------------
  154. // Create Category Window
  155. // ----------------------------------------------------------------------------------------------------------------------------
  156.     Scene_SimpleBeastBook.prototype.createCatWindow = function() {
  157.         this._catWindow.setHandler('ok', this.onCatSelect.bind(this));
  158.         this._catWindow.setHandler('cancel', this.onCatCancel.bind(this));
  159.         this._catWindow.setBeastsWindow(this._beastsWindow);
  160.         this.addWindow(this._catWindow);
  161.     };
  162.    
  163. // ----------------------------------------------------------------------------------------------------------------------------
  164. // Create Beasts Window
  165. // ----------------------------------------------------------------------------------------------------------------------------
  166.     Scene_SimpleBeastBook.prototype.createBeastsWindow = function() {
  167.         this._beastsWindow.setHandler('ok', this.onBeastSelect.bind(this));
  168.         this._beastsWindow.setHandler('cancel', this.onBeastCancel.bind(this));
  169.         this._beastsWindow.setInfoWindows(this._spriteWindow, this._infoWindow);
  170.         this.addWindow(this._beastsWindow);
  171.         this._beastsWindow.hide();
  172.     };
  173.  
  174. // ----------------------------------------------------------------------------------------------------------------------------
  175. // Create Info Window
  176. // ----------------------------------------------------------------------------------------------------------------------------
  177.     Scene_SimpleBeastBook.prototype.createSpriteWindow = function() {
  178.         this.addWindow(this._spriteWindow);
  179.         this._spriteWindow.opacity = 0;
  180.         this._spriteWindow.hide();
  181.     };
  182.    
  183. // ----------------------------------------------------------------------------------------------------------------------------
  184. // Create Info Window
  185. // ----------------------------------------------------------------------------------------------------------------------------
  186.     Scene_SimpleBeastBook.prototype.createInfoWindow = function() {
  187.         this.addWindow(this._infoWindow);
  188.         this._infoWindow.hide();
  189.     };
  190.    
  191. // ----------------------------------------------------------------------------------------------------------------------------
  192. // On Cat Select
  193. // ----------------------------------------------------------------------------------------------------------------------------
  194.     Scene_SimpleBeastBook.prototype.onCatSelect = function() {
  195.         this._catWindow.deactivate();
  196.         this._beastsWindow.show();
  197.         this._spriteWindow.show();
  198.         this._beastsWindow.activate();
  199.     };
  200.    
  201. // ----------------------------------------------------------------------------------------------------------------------------
  202. // On Cat Cancel
  203. // ----------------------------------------------------------------------------------------------------------------------------
  204.     Scene_SimpleBeastBook.prototype.onCatCancel = function() {
  205.         this.popScene();
  206.     };
  207.    
  208. // ----------------------------------------------------------------------------------------------------------------------------
  209. // On Beast Select
  210. // ----------------------------------------------------------------------------------------------------------------------------
  211.     Scene_SimpleBeastBook.prototype.onBeastSelect = function() {
  212.         if (!this._switch) {
  213.             this._infoWindow.show();
  214.         } else {
  215.             this._infoWindow.hide();
  216.         }
  217.         this._switch = !this._switch;
  218.         this._beastsWindow.activate();
  219.     };
  220.    
  221. // ----------------------------------------------------------------------------------------------------------------------------
  222. // On Beast Cancel
  223. // ----------------------------------------------------------------------------------------------------------------------------
  224.     Scene_SimpleBeastBook.prototype.onBeastCancel = function() {
  225.         if (this._switch) {
  226.             this._infoWindow.hide();
  227.             this._beastsWindow.activate();
  228.             this._switch = !this._switch;
  229.         } else {
  230.             this._beastsWindow.select(0);
  231.             this._beastsWindow.deactivate();
  232.             this._beastsWindow.hide();
  233.             this._spriteWindow.hide();
  234.             this._infoWindow.hide();
  235.             this._catWindow.activate();  
  236.         }
  237.     };
  238.    
  239. // ----------------------------------------------------------------------------------------------------------------------------
  240. // Fill Cat Window
  241. // ----------------------------------------------------------------------------------------------------------------------------
  242.     function Window_SimpleBeastBook_Category() {
  243.         this.initialize.apply(this, arguments);
  244.     }
  245.  
  246.     Window_SimpleBeastBook_Category.prototype = Object.create(Window_HorzCommand.prototype);
  247.     Window_SimpleBeastBook_Category.prototype.constructor = Window_SimpleBeastBook_Category;
  248.  
  249.     Window_SimpleBeastBook_Category.prototype.initialize = function(x, y, width, height) {
  250.         Window_HorzCommand.prototype.initialize.call(this, x, y, width, height);
  251.     };
  252.  
  253.     Window_SimpleBeastBook_Category.prototype.maxCols = function() {
  254.         if ($simpleBeastBook.beasts[0].length >= stv_SimpleBeastBook_maxCols) {
  255.             return stv_SimpleBeastBook_maxCols;
  256.         } else {
  257.             return $simpleBeastBook.beasts[0].length;
  258.         }
  259.     };
  260.    
  261.     Window_SimpleBeastBook_Category.prototype.windowWidth = function() {
  262.         return Graphics.boxWidth;
  263.     };
  264.    
  265.     Window_SimpleBeastBook_Category.prototype.windowHeight = function() {
  266.         return 72;
  267.     };
  268.    
  269.     Window_SimpleBeastBook_Category.prototype.setBeastsWindow = function(window1) {
  270.         this._beastsWindow = window1;
  271.         this.updateStatus();
  272.     };
  273.    
  274.     Window_SimpleBeastBook_Category.prototype.update = function() {
  275.         Window_Selectable.prototype.update.call(this);
  276.         this.updateStatus();
  277.     };
  278.    
  279.     Window_SimpleBeastBook_Category.prototype.updateStatus = function() {
  280.         var cat = this._list[this.index()].name;
  281.         if (this._beastsWindow) this._beastsWindow.setCat(cat);
  282.     };
  283.    
  284.     Window_SimpleBeastBook_Category.prototype.makeCommandList = function() {
  285.         var cats = $simpleBeastBook.beasts[0];
  286.         for (var i = 0; i < cats.length; ++i) {
  287.             this.addCommand(cats[i], 'ok');
  288.         }
  289.     };
  290.  
  291. // ----------------------------------------------------------------------------------------------------------------------------
  292. // Fill Beasts Window
  293. // ----------------------------------------------------------------------------------------------------------------------------
  294.     function Window_SimpleBeastBook_Beasts() {
  295.         this.initialize.apply(this, arguments);
  296.     }
  297.  
  298.     Window_SimpleBeastBook_Beasts.prototype = Object.create(Window_Selectable.prototype);
  299.     Window_SimpleBeastBook_Beasts.prototype.constructor = Window_SimpleBeastBook_Beasts;
  300.  
  301.     Window_SimpleBeastBook_Beasts.lastTopRow = 0;
  302.     Window_SimpleBeastBook_Beasts.lastIndex  = 0;
  303.  
  304.     Window_SimpleBeastBook_Beasts.prototype.initialize = function(x, y, width, height) {
  305.         Window_Selectable.prototype.initialize.call(this, x, y, width, height);
  306.        
  307.         this.refresh();
  308.         this.setTopRow(Window_SimpleBeastBook_Beasts.lastTopRow);
  309.         this.select(Window_SimpleBeastBook_Beasts.lastIndex);
  310.     };
  311.    
  312.     Window_SimpleBeastBook_Beasts.prototype.maxCols = function() {
  313.         return 1;
  314.     };
  315.  
  316.     Window_SimpleBeastBook_Beasts.prototype.maxItems = function() {
  317.         return this._list ? this._list.length : 0;
  318.     };
  319.    
  320.     Window_SimpleBeastBook_Beasts.prototype.setCat = function(cat) {
  321.         this._cat = cat;
  322.         this.refresh();
  323.     };
  324.    
  325.     Window_SimpleBeastBook_Beasts.prototype.setInfoWindows = function(window1, window2) {
  326.         this._spriteWindow = window1;
  327.         this._infoWindow = window2;
  328.         this.updateStatus();
  329.     };
  330.    
  331.     Window_SimpleBeastBook_Beasts.prototype.update = function() {
  332.         Window_Selectable.prototype.update.call(this);
  333.         this.updateStatus();
  334.     };
  335.    
  336.     Window_SimpleBeastBook_Beasts.prototype.updateStatus = function() {
  337.         var beast = this._list[this.index()];
  338.         if (this._spriteWindow) this._spriteWindow.setBeast(beast);
  339.         if (this._infoWindow) this._infoWindow.setBeast(beast);
  340.     };
  341.  
  342.     Window_SimpleBeastBook_Beasts.prototype.refresh = function() {
  343.         this._list = [];
  344.         for (var i = 1; i < $simpleBeastBook.beasts[1].length; i++) {
  345.             var beast = $simpleBeastBook.beasts[1][i];
  346.             if (beast.cat == this._cat) this._list.push(beast);
  347.         }
  348.         this.createContents();
  349.         this.drawAllItems();
  350.     };
  351.  
  352.     Window_SimpleBeastBook_Beasts.prototype.drawItem = function(index) {
  353.         var beast = this._list[index],
  354.             rect = this.itemRectForText(index),
  355.             id = "",
  356.             name = beast.name;
  357.            
  358.         if (stv_SimpleBeastBook_showId == "TRUE") id = '%1'.format((beast.id).padZero(3)) + " - ";
  359.            
  360.         if (!beast.discovered) {
  361.             this.changeTextColor(this.textColor(7));
  362.             name = stv_SimpleBeastBook_unknown;
  363.         }
  364.        
  365.         this.drawText(id + name, rect.x, rect.y, rect.width);
  366.         this.changeTextColor(this.normalColor());
  367.     };
  368.    
  369.     Window_SimpleBeastBook_Beasts.prototype.processOk = function() {
  370.         var beast = this._list[this._index];
  371.         console.log(beast);
  372.         if (!beast.discovered) {
  373.             this.playBuzzerSound();
  374.         } else {
  375.             Window_Selectable.prototype.processOk.call(this);
  376.         }
  377.     };
  378.    
  379. // ----------------------------------------------------------------------------------------------------------------------------
  380. // Fill Sprite Window
  381. // ----------------------------------------------------------------------------------------------------------------------------
  382.     function Window_SimpleBeastBook_Sprite() {
  383.         this.initialize.apply(this, arguments);
  384.     }
  385.  
  386.     Window_SimpleBeastBook_Sprite.prototype = Object.create(Window_Base.prototype);
  387.     Window_SimpleBeastBook_Sprite.prototype.constructor = Window_SimpleBeastBook_Sprite;
  388.  
  389.     Window_SimpleBeastBook_Sprite.prototype.initialize = function(x, y, width, height) {
  390.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  391.         this.setBeastSprite();
  392.     };
  393.    
  394.     Window_SimpleBeastBook_Sprite.prototype.setBeast = function(beast) {
  395.         this._beast = beast;
  396.         this.refresh();
  397.     };
  398.    
  399.     Window_SimpleBeastBook_Sprite.prototype.setBeastSprite = function() {
  400.         this._beastSprite = new Sprite();
  401.         this._beastSprite.anchor.x = 0.5;
  402.         this._beastSprite.anchor.y = 0.5;
  403.         this._beastSprite.x = this.width/2;
  404.         this._beastSprite.y = this.height/2;
  405.         this._beastSprite.scale.x = 1.0;
  406.         this._beastSprite.scale.y = 1.0;
  407.         this.addChildToBack(this._beastSprite);
  408.     };
  409.    
  410.     Window_SimpleBeastBook_Sprite.prototype.deleteBitmap = function() {
  411.         this._beastSprite.bitmap = null;
  412.     };
  413.    
  414.     Window_SimpleBeastBook_Sprite.prototype.drawBeastStatic = function() {
  415.         this._beastSprite.bitmap = ImageManager.loadEnemy(this._beast.pic, 0);
  416.     };
  417.    
  418.     Window_SimpleBeastBook_Sprite.prototype.drawDiscovered = function() {
  419.         this.drawBeastStatic();
  420.     };
  421.    
  422.     Window_SimpleBeastBook_Sprite.prototype.refresh = function() {
  423.         this.contents.clear();
  424.         this.deleteBitmap();
  425.         if (this._beast.discovered) this.drawDiscovered();
  426.     };
  427.    
  428. // ----------------------------------------------------------------------------------------------------------------------------
  429. // Fill Info Window
  430. // ----------------------------------------------------------------------------------------------------------------------------
  431.     function Window_SimpleBeastBook_Info() {
  432.         this.initialize.apply(this, arguments);
  433.     }
  434.  
  435.     Window_SimpleBeastBook_Info.prototype = Object.create(Window_Base.prototype);
  436.     Window_SimpleBeastBook_Info.prototype.constructor = Window_SimpleBeastBook_Info;
  437.  
  438.     Window_SimpleBeastBook_Info.prototype.initialize = function(x, y, width, height) {
  439.         Window_Base.prototype.initialize.call(this, x, y, width, height);
  440.     };
  441.    
  442.     Window_SimpleBeastBook_Info.prototype.setBeast = function(beast) {
  443.         this._beast = beast;
  444.         this.refresh();
  445.     };
  446.    
  447.     Window_SimpleBeastBook_Info.prototype.drawDiscovered = function() {
  448.         this.drawTextEx(stv_SimpleBeastBook_descText, 0, 0);
  449.         this.drawTextEx(this._beast.desc, 0, this.lineHeight());
  450.     };
  451.    
  452.     Window_SimpleBeastBook_Info.prototype.refresh = function() {
  453.         this.contents.clear();
  454.         if (this._beast.discovered) this.drawDiscovered();
  455.     };
  456.  
  457. // ----------------------------------------------------------------------------------------------------------------------------
  458. // Alias methods
  459. // ----------------------------------------------------------------------------------------------------------------------------
  460.     STV_SimpleBeastBook_PluginCommand = Game_Interpreter.prototype.pluginCommand;
  461.     STV_SimpleBeastBook_Create = DataManager.createGameObjects;
  462.     STV_SimpleBeastBook_Save = DataManager.makeSaveContents;
  463.     STV_SimpleBeastBook_Load = DataManager.extractSaveContents;
  464.     STV_SimpleBeastBook_BattleBack = Spriteset_Battle.prototype.createBattleback;
  465.     STV_SimpleBeastBook_DropItems = Game_Enemy.prototype.makeDropItems;
  466.  
  467. // ----------------------------------------------------------------------------------------------------------------------------
  468. // DataManager
  469. // ----------------------------------------------------------------------------------------------------------------------------
  470.     var $simpleBeastBook = null;
  471.  
  472.     DataManager.makeSaveContents = function() {
  473.         contents = STV_SimpleBeastBook_Save.call(this);
  474.         contents.simplebeastbook = $simpleBeastBook;
  475.         return contents;
  476.     };
  477.    
  478.     DataManager.extractSaveContents = function(contents) {
  479.         STV_SimpleBeastBook_Load.call(this, contents);
  480.         $simpleBeastBook = contents.simplebeastbook;
  481.     };
  482.    
  483.     DataManager.createGameObjects = function() {
  484.         STV_SimpleBeastBook_Create.call(this);
  485.         $simpleBeastBook = new SimpleBeast_Book();
  486.     };
  487.    
  488. // ----------------------------------------------------------------------------------------------------------------------------
  489. // Get EnemyTroop Info
  490. // ----------------------------------------------------------------------------------------------------------------------------
  491.     Game_Troop.prototype.updateInterpreter = function() {
  492.         this._interpreter.update();
  493.  
  494.             for (var i = 0; i < $gameTroop.members().length; i++) {
  495.             var stv_beastID = $gameTroop.members()[i]._enemyId;
  496.             var stv_beastIsAlive = $gameTroop.members()[i].isAlive();
  497.            
  498.             switch (stv_SimpleBeastBook_fillBehavior) {
  499.                 case 1:
  500.                     $simpleBeastBook.discoverBeast(stv_beastID);
  501.                 break;
  502.                 case 2:
  503.                     if (!stv_beastIsAlive){
  504.                         $simpleBeastBook.discoverBeast(stv_beastID);
  505.                     }
  506.                 break;
  507.                 case 3:
  508.                 break;
  509.             }
  510.         }
  511.     };
  512.  
  513. // ----------------------------------------------------------------------------------------------------------------------------
  514. // SimpleBeast_Book
  515. // ----------------------------------------------------------------------------------------------------------------------------
  516.  
  517.     function SimpleBeast_Book() {
  518.         this.initialize.apply(this, arguments);
  519.     }
  520.    
  521.     SimpleBeast_Book.prototype.initialize = function() {
  522.         this.setup();
  523.         console.log(this.beasts);
  524.     };
  525.    
  526.     // Setup Book
  527.     SimpleBeast_Book.prototype.setup = function() {
  528.         this.beasts = [];
  529.         this.clear();
  530.     };
  531.    
  532.     // Clear Book
  533.     SimpleBeast_Book.prototype.clear= function() {
  534.         this.createCats();
  535.         this.createBeasts();
  536.     };
  537.    
  538.     // Create Cats
  539.     SimpleBeast_Book.prototype.createCats = function() {
  540.         this.beasts[0] = [];
  541.         for (var i = 1; i < $dataEnemies.length; ++i) {
  542.             var note = $dataEnemies[i].note,
  543.                 cat;
  544.  
  545.             if (note.match(/<(?:STVSBB CAT):[ ](.*)>/i)) {
  546.                 cat = String(RegExp.$1);
  547.                 if (this.beasts[0].indexOf(cat) == -1) this.beasts[0].push(cat);
  548.             }
  549.         }
  550.     };
  551.    
  552.     // Create Beasts
  553.     SimpleBeast_Book.prototype.createBeasts = function() {
  554.         this.beasts[1] = [];
  555.         for (var i = 1; i < $dataEnemies.length; ++i) {
  556.             var note = $dataEnemies[i].note,
  557.                 cat = "",
  558.                 desc = "",
  559.                 pic = $dataEnemies[i].battlerName;
  560.            
  561.             if (note.match(/<STVSBB Desc>((.|\n)*?)<\/STVSBB Desc>/g)) desc = String(RegExp.$1);
  562.             if (note.match(/<(?:STVSBB PIC):[ ](.*)>/i)) pic = String(RegExp.$1);
  563.             if (note.match(/<(?:STVSBB CAT):[ ](.*)>/i)) {
  564.                 cat = String(RegExp.$1);
  565.                 var object = {"id":$dataEnemies[i].id, "cat":cat, "name":$dataEnemies[i].name, "desc":desc, "pic":pic, "discovered":false};
  566.                 this.beasts[1][i] = object;
  567.             }
  568.         }
  569.     };
  570.    
  571.     // Discover Beast
  572.     SimpleBeast_Book.prototype.discoverBeast = function(id) {
  573.         if (this.beasts[1][id]) this.beasts[1][id].discovered = true;
  574.     };
  575.    
  576.     // Discover All
  577.     SimpleBeast_Book.prototype.discoverAll = function() {
  578.         for (var i = 1; i < this.beasts[1].length; ++i) {
  579.             this.discoverBeast(i);
  580.         }
  581.     };
  582.  
  583. // ----------------------------------------------------------------------------------------------------------------------------
  584. // Plugin Commands
  585. // ----------------------------------------------------------------------------------------------------------------------------
  586.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  587.         STV_SimpleBeastBook_PluginCommand.call(this, command, args);
  588.        
  589.         if (command === 'SimpleBeastBook') {
  590.             switch (args[0]) {
  591.                 case 'open':
  592.                     SceneManager.push(Scene_SimpleBeastBook);
  593.                 break;
  594.                 case 'discover':
  595.                     $simpleBeastBook.discoverBeast(args[1]);
  596.                 break;
  597.             }
  598.         }
  599.     };
RAW Paste Data