不清楚你会不会用
Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
if (this.needsNumber()) {
if(item.consumable===true){
this.drawText(":", x, y, width - this.textWidth("00"), "right");
this.drawText($gameParty.numItems(item), x, y, width, "right");
}
}
};
Game_Party.prototype.hasItem = function(item) {
if (this.numItems(item) > 0) {
return true;
} else if (this.isAnyMemberEquipped(item)) {
return true;
} else {
return false;
}
};
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
const container = this.itemContainer(item);
console.log(item)
if (container) {
const lastNumber = this.numItems(item);
const newNumber = lastNumber + amount;
container[item.id] = newNumber.clamp(0, this.maxItems(item));
if (container[item.id] === 0 && item.consumable===true) {
delete container[item.id];
}
if (includeEquip && newNumber < 0) {
this.discardMembersEquip(item, 0);
}
$gameMap.requestRefresh();
}
}
Game_Party.prototype.maxItems = function(item) {
if(item.consumable===true){
return 99;
}
return 1;//武器和装备最大的上限
};
Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
if (this.needsNumber()) {
if(item.consumable===true){
this.drawText(":", x, y, width - this.textWidth("00"), "right");
this.drawText($gameParty.numItems(item), x, y, width, "right");
}
}
};
Game_Party.prototype.hasItem = function(item) {
if (this.numItems(item) > 0) {
return true;
} else if (this.isAnyMemberEquipped(item)) {
return true;
} else {
return false;
}
};
Game_Party.prototype.gainItem = function(item, amount, includeEquip) {
const container = this.itemContainer(item);
console.log(item)
if (container) {
const lastNumber = this.numItems(item);
const newNumber = lastNumber + amount;
container[item.id] = newNumber.clamp(0, this.maxItems(item));
if (container[item.id] === 0 && item.consumable===true) {
delete container[item.id];
}
if (includeEquip && newNumber < 0) {
this.discardMembersEquip(item, 0);
}
$gameMap.requestRefresh();
}
}
Game_Party.prototype.maxItems = function(item) {
if(item.consumable===true){
return 99;
}
return 1;//武器和装备最大的上限
};
|