You need
a table of all items and their stats
an algorithm to identify possible loot for the current player level
you can enhance this with
subsets of items for certain zones, monster types
giving certain npcs(monsters) a fixed table of possible loot specific to that npc
add a variable amount of gold separately to the looting algorithm
etc etc etc
I'd just use a "loot-array" consisting of index numbers which point to the big item-table for every monster type.
If the monster types raise in level like in diablo you need to take that into account and prepare the npc-specific loot-array accordingly.
a table of all items and their stats
an algorithm to identify possible loot for the current player level
you can enhance this with
subsets of items for certain zones, monster types
giving certain npcs(monsters) a fixed table of possible loot specific to that npc
add a variable amount of gold separately to the looting algorithm
etc etc etc
I'd just use a "loot-array" consisting of index numbers which point to the big item-table for every monster type.
If the monster types raise in level like in diablo you need to take that into account and prepare the npc-specific loot-array accordingly.