Save-Point
KItemTypeMaterial MV - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: KItemTypeMaterial MV (/thread-8663.html)



KItemTypeMaterial MV - kyonides - 01-30-2023

KItemTypeMaterial MV

by Kyonides Arkanthes


Introduction

Now you can add the new Material tab to your default Menu window. 

Code:
//==================================
// * KItemTypeMaterialMV.js
//==================================
/*:
* @plugindesc This plugin will let you add a Material tab to your menu.
* @author Kyonides Arkanthes
* @help Date: 2023-01-29
* # * Free as in Beer * #
*
* Just add the following note tag to any item:
* <material>
*/

TextManager.material = "Material";
TextManager.materialKeyWord = "material";

Window_ItemCategory.prototype.makeCommandList = function() {
  this.addCommand(TextManager.item,    'item');
  this.addCommand(TextManager.weapon,  'weapon');
  this.addCommand(TextManager.armor,  'armor');
  this.addCommand(TextManager.material, TextManager.materialKeyWord);
  this.addCommand(TextManager.keyItem, 'keyItem');
};

Window_ItemList.prototype.someItem = function(item) {
  return DataManager.isItem(item);
};

Window_ItemList.prototype.isMaterial = function(note) {
  let rgx = /<material>/i;
  return rgx.exec(note);
};

Window_ItemList.prototype.includes = function(item) {
  switch (this._category) {
  case 'item':
    return this.someItem(item) && item.itypeId === 1 && !this.isMaterial(item.note);
  case 'weapon':
    return DataManager.isWeapon(item);
  case 'armor':
    return DataManager.isArmor(item);
  case 'material':
    return DataManager.isItem(item) && this.isMaterial(item.note);
  case 'keyItem':
    return this.someItem(item) && item.itypeId === 2 && !this.isMaterial(item.note);
  default:
    return false;
  }
};


Terms & Conditions

Free as in Beer beer.
Include my nickname in your game credits.
Do not repost it!