Developers are lazy, and love to generalize. So that makes perfect sense
It's simpler (and way shorter) to make a scraper-function that does not depend on the color of the item. Simpler solutions are easier to maintain over time, so as a developer you want to do the simplest thing you can get away with. You never go for the advanced solution with tons of edge cases unless you have to.
They probably just do some kind of formula like:
Code:
item_base_mod = {common: 0.05, uncommon: 0.15, rare: 0.3, epic: 0.5, legendary: 1.0}[item.type];
item_level_mod = item.level * 0.05;
loot_worth = item_base_mod * item_level_mod * rand(1, 100);
my_loot = generate_loot(loot_worth);
Just guessing the weights and functions here of course, but some kind of setup were a REALLY lucky scraping of a common item might end up with the same loot_worth as a really really bad scraping of a legendary item.
Give the worth to a loot generator function, and tada.. out comes some loot that depend on some worth, and not the input item directly. It's simple, and it's easy to maintain and adjust.
Then the generate_loot function has weights for all the loot with how common they are and their "cost" in worth.. red pieces are more common than blue pieces, and green, etc..