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;
}
};