Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Game_Party.gainItem durability work #1

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}