Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var malPICNT = DataManager.processItemCoreNotetags;
- DataManager.processItemCoreNotetags = function(group) {
- malPICNT.call(this, group);
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- if(obj.note.contains('<keyItem>')) {
- obj.keyItem = true;
- } else {
- obj.keyItem = false;
- };
- };
- };
- //OVERWRITE Window_ShopBuy.prototype.isEnabled
- Window_ShopBuy.prototype.isEnabled = function(item) {
- if (DataManager.isIndependent(item)) {
- var typeMax = $gameParty.getIndependentItemTypeMax(item);
- var typeCur = $gameParty.getIndependentItemTypeCur(item);
- var typeCurKey = $gameParty.getIndependentItemTypeCurKey(item);
- typeCur -= typeCurKey;
- if (typeCur >= typeMax && item.keyItem == false) return false;
- }
- return (item && this.price(item) <= this._money &&
- !$gameParty.hasMaxItems(item));
- };
- Game_Party.prototype.getIndependentItemTypeCurKey = function(item) {
- if (!item) return 0;
- if (DataManager.isItem(item)) {
- var count = 0;
- var items = this.items();
- for (var i = 0; i < items.length; i++) {
- if (items[i].keyItem) count++;
- };
- return count;
- };
- if (DataManager.isWeapon(item)) {
- var count = 0;
- var items = this.weapons();
- for (var i = 0; i < items.length; i++) {
- if (items[i].keyItem) count++;
- };
- return count;
- };
- if (DataManager.isArmor(item)) {
- var count = 0;
- var items = this.armors();
- for (var i = 0; i < items.length; i++) {
- if (items[i].keyItem) count++;
- };
- return count;
- };
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement