Save-Point

Full Version: KItemTypeMaterial MV
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!