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

Unhelpful failure message when you are missing full item cost for monster killing #6243

Open
DayV-git opened this issue Nov 30, 2024 · 0 comments

Comments

@DayV-git
Copy link
Contributor

🐛 Bug Report

When you want to kill something, have some of the item cost bt not the full quantity, there is no message for failure reason. Example for Venenatis:
image

Issue: in following code, nothing is added to messages if user.bank.has(consumablesCost.itemCost) (has every item and every quantity) is false but user.owns(group.itemCost) (has required item but not quantity) is true

if (consumablesCost.itemCost && !user.bank.has(consumablesCost.itemCost)) {
const items = Array.isArray(monster.itemCost) ? monster.itemCost : [monster.itemCost];
const messages: string[] = [];
for (const group of items) {
if (group.optional) continue;
if (user.owns(group.itemCost)) {
continue;
}
if (group.alternativeConsumables?.some(alt => user.owns(alt.itemCost))) {
continue;
}
messages.push(
`This monster requires: ${group.itemCost.items().map(i => i[0].name)}${
group.alternativeConsumables
? `, OR ${group.alternativeConsumables?.map(alt => alt.itemCost.items().map(i => i[0].name)).join(', ')}`
: '.'
}`
);
}
return [false, `You don't have the items needed to kill this monster. ${messages.join(' ')}`];
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant