Custom droplist chance recalc (probaly bug)
Posted: Fri Mar 08, 2013 3:47 pm
When you add a custom droplist in custom_droplist table (ofc) because you want to change some rates (so you are adding existing items but diferent chances), in L2DropCategory.java, addDropData() function recalculate the values besides add drops, as it should be.
But if the drop exists (is the case), _categoryChance and _categoryBalancedChance is re-calculated but for some reason (probably a bug) in _categoryBalancedChance is using only RATE_DROP_ITEMS config when should use RATE_DROP_ITEMS_BY_RAID if it's the case.
Below if is not a replace (new item), is using RATE_DROP_ITEMS_BY_RAID if needed.
Here the function: (I added 3 comments in this way /*** comment ***/ for a better understanding of the problem)
I'm pretty sure this is a bug.
I can't make posts in the properly section: viewforum.php?f=77
Regards.
But if the drop exists (is the case), _categoryChance and _categoryBalancedChance is re-calculated but for some reason (probably a bug) in _categoryBalancedChance is using only RATE_DROP_ITEMS config when should use RATE_DROP_ITEMS_BY_RAID if it's the case.
Below if is not a replace (new item), is using RATE_DROP_ITEMS_BY_RAID if needed.
Here the function: (I added 3 comments in this way /*** comment ***/ for a better understanding of the problem)
Code: Select all
public void addDropData(L2DropData drop, boolean raid) { boolean found = false; if (drop.isQuestDrop()) { //if (_questDrops == null) // _questDrops = new FastList<L2DropData>(0); //_questDrops.add(drop); } else { if (Config.CUSTOM_DROPLIST_TABLE) { // If the drop exists is replaced for (L2DropData d : _drops) { if (d.getItemId() == drop.getItemId()) { d.setMinDrop(drop.getMinDrop()); d.setMaxDrop(drop.getMaxDrop()); if (d.getChance() != drop.getChance()) { // Re-calculate Chance _categoryChance -= d.getChance(); /*** Here the bug, is using only RATE_DROP_ITEMS ***/ _categoryBalancedChance -= Math.min((d.getChance() * Config.RATE_DROP_ITEMS), L2DropData.MAX_CHANCE); d.setChance(drop.getChance()); _categoryChance += d.getChance(); /*** Here the bug, is using only RATE_DROP_ITEMS ***/ _categoryBalancedChance += Math.min((d.getChance() * Config.RATE_DROP_ITEMS), L2DropData.MAX_CHANCE); } found = true; break; } } } if (!found) { _drops.add(drop); _categoryChance += drop.getChance(); // for drop selection inside a category: max 100 % chance for getting an item, scaling all values to that. /*** Here is using RATE_DROP_ITEMS_BY_RAID correctly ***/ _categoryBalancedChance += Math.min((drop.getChance()*(raid?Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS)),L2DropData.MAX_CHANCE); } } }
I can't make posts in the properly section: viewforum.php?f=77
Regards.