Skip to content

Commit

Permalink
Make Game_Party.gainItem durability work
Browse files Browse the repository at this point in the history
Items gained via events and shops didn't come with durability set.
  • Loading branch information
febpetroni authored Jan 18, 2023
1 parent 4f124b6 commit 80b32f1
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions RotomecaItemDurability.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,22 +498,8 @@ Game_Party.prototype.gainItem = function (item, amount, includeEquip)
{
if (!!item && !!item.note && item.note.includes('<durability:') && !(new Game_Item(item).haveDurability()) && item.durability_already_generated === undefined) {
for (let index = 0; index < amount; ++index) {
let game_item;

if (DataManager.isWeapon(item)) {
game_item = $createUniqueWeapon(item);
} else if (DataManager.isArmor(item)) {
game_item = $createUniqueArmor(item);
}
else
{
alias_rotomeca_Game_Party_prototype_gainItem.call(this, item, amount, includeEquip);
break;
}

item = new UniqueItemDurability(game_item, parseInt(item.note.split('<durability:')[1].split('>')[0].replaceAll(' ', ''))).object();

alias_rotomeca_Game_Party_prototype_gainItem.call(this, item, 1, includeEquip);
newItem = Rotomeca.RotomecaItemDurability.createItemWithDurability(DataManager.isWeapon(item) ? 1 : 0, item, Number.POSITIVE_INFINITY);
alias_rotomeca_Game_Party_prototype_gainItem.call(this, newItem.object(), 1, includeEquip);
}
}
else alias_rotomeca_Game_Party_prototype_gainItem.call(this, item, amount, includeEquip);
Expand Down Expand Up @@ -747,4 +733,4 @@ BrokenIndicator.prototype._refresh = function ()
}
else ++this._it;
}
}
}

0 comments on commit 80b32f1

Please sign in to comment.