Original thread (https://forums.rpgmakerweb.com/index.php?posts/1492593/) was closed by @caethyril or somebody, and two Reports on it were rejected, telling me to open a new thread, so here goes:
I was able to insert a tweak to display the icon for each dropped loot item, but the posted plugin code does seem to have an obscure bug. Although I initially blamed the wrong thing in the Database, I did more testing and changed my tune.
Apparently, when the item's class/category (Items/Weapons/Armors) is different but item.id value is the same, the counts are added together for display.
For example, using the default Database, if your Enemy is set to drop 1 Potion (Items #0001) and 1 Sword (Weapons #0001) and 1 Shield (Armors #0001), all at 1/1 chance, and your "Obtain Item" message is "%1 ×%2 found!" then what gets displayed by the plugin after defeating one (1) such Enemy is this:
(icon176)Potion ×3 found!
(icon97)Sword ×3 found!
(icon128)Shield ×3 found!
When you look in the inventory, there are only 1 of each of those loot drops. The item.id is apparently 1 for all 3 of them, so this code
thinks they should add together. (I've made further changes to use const, .includes and other recent Javascript thingies in another version of the plugin, but the same thing occurs.)
As I asked in my second Report, which apologized for blaming something else in the Database in the first one, is there something more unique than item.id that can be used here? While this only occurs if the same ID value is used for different categories, it's worth fixing to avoid players asking about the "missing" loot items.
I was able to insert a tweak to display the icon for each dropped loot item, but the posted plugin code does seem to have an obscure bug. Although I initially blamed the wrong thing in the Database, I did more testing and changed my tune.
Apparently, when the item's class/category (Items/Weapons/Armors) is different but item.id value is the same, the counts are added together for display.
For example, using the default Database, if your Enemy is set to drop 1 Potion (Items #0001) and 1 Sword (Weapons #0001) and 1 Shield (Armors #0001), all at 1/1 chance, and your "Obtain Item" message is "%1 ×%2 found!" then what gets displayed by the plugin after defeating one (1) such Enemy is this:
(icon176)Potion ×3 found!
(icon97)Sword ×3 found!
(icon128)Shield ×3 found!
When you look in the inventory, there are only 1 of each of those loot drops. The item.id is apparently 1 for all 3 of them, so this code
JavaScript:
} else { // Patch core-script
BattleManager.displayDropItems = function() {
var drops = [], count = [];
for (var item of this._rewards.items) {
if (drops.indexOf(item) < 0) drops.push(item);
count[item.id] = (count[item.id] || 0) + 1;
}
if (drops.length > 0) {
$gameMessage.newPage();
for (var item of drops) {
$gameMessage.add(TextManager.obtainItem.format(`\\I[${item.iconIndex}]${item.name}`, count[item.id]));
}
}
};
}
As I asked in my second Report, which apologized for blaming something else in the Database in the first one, is there something more unique than item.id that can be used here? While this only occurs if the same ID value is used for different categories, it's worth fixing to avoid players asking about the "missing" loot items.