Skip to content

Commit

Permalink
Merge pull request #1 from febpetroni/patch-1
Browse files Browse the repository at this point in the history
Make Game_Party.gainItem durability work
  • Loading branch information
Rotomeca authored Mar 25, 2023
2 parents 4f124b6 + 80b32f1 commit 10ab4ca
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 10ab4ca

Please sign in to comment.