This PR fixes an issue where the total chance for an entry in item_enchantment_template is above 100.
The original GetItemEnchantMod() has two issues.
If the totalchance is below 100 - sometimes a second roll will happen.
If the totalchance is above 100 - there is a risk that some suffixes will never be rolled.
This PR fixes it by summing the totalchance and using that sum for the roll.
Also added a log output for entries that are silently skipped during loading.
Proof
None
Issues
None
How2Test
Before:
.debug loottable enchant 4566 1000000
46 items dropped after 1000000 attempts for item Sturdy Quarterstaff.
After:
.debug loottable enchant 4566 1000000
70 items dropped after 1000000 attempts for item Sturdy Quarterstaff.
🍰 Pullrequest
This PR fixes an issue where the total chance for an entry in item_enchantment_template is above 100.
The original GetItemEnchantMod() has two issues. If the totalchance is below 100 - sometimes a second roll will happen. If the totalchance is above 100 - there is a risk that some suffixes will never be rolled.
This PR fixes it by summing the totalchance and using that sum for the roll.
Also added a log output for entries that are silently skipped during loading.
Proof
Issues
How2Test
Before: .debug loottable enchant 4566 1000000 46 items dropped after 1000000 attempts for item Sturdy Quarterstaff.
After: .debug loottable enchant 4566 1000000 70 items dropped after 1000000 attempts for item Sturdy Quarterstaff.
Todo / Checklist