Module:Mazunki/Monsters: Difference between revisions

m
changed some item columns
m (whoops)
m (changed some item columns)
Line 45: Line 45:
'SlayerTier', 'SlayerTierName', 'SlayerTierCost',
'SlayerTier', 'SlayerTierName', 'SlayerTierCost',
'SlayerTierPlayerLevel', 'SlayerTierQtyMin', 'SlayerTierQtyMax', 'SlayerCoinReward',
'SlayerTierPlayerLevel', 'SlayerTierQtyMin', 'SlayerTierQtyMax', 'SlayerCoinReward',
'ItemsID', 'ItemsWeight', 'ItemsDenominators', 'ItemsTotalWeight', 'ItemsQtyMin', 'ItemsQtyMax'
'ItemsID', 'ItemsWeight', 'ItemsDenominator', 'ItemsNormalised', 'ItemsQtyMin', 'ItemsQtyMax'
}
}
result = result.."!"..table.concat(headers, "!!")
result = result.."!"..table.concat(headers, "!!")
Line 151: Line 151:
local itemIds = {}
local itemIds = {}
local itemWeights = {}
local itemWeights = {}
local itemDenominators = {}
local itemNormalised = {}
local itemQtyMins = {}
local itemQtyMins = {}
local itemQtyMaxs = {}
local itemQtyMaxs = {}
Line 158: Line 158:
totalWeight = totalWeight + droppable[2]
totalWeight = totalWeight + droppable[2]
end
end
local itemDenominator = totalWeight * 100


for _, droppable in pairs(monster.lootTable) do
for _, droppable in pairs(monster.lootTable) do
table.insert(itemIds, droppable[1])
table.insert(itemIds, droppable[1])
table.insert(itemWeights, droppable[2]*monster.lootChance)
local numerator = droppable[2]*monster.lootChance
table.insert(itemDenominators, totalWeight*100)
table.insert(itemWeights, numerator)
table.insert(itemNormalised, denominator/numerator)
table.insert(itemQtyMins, 1)
table.insert(itemQtyMins, 1)
table.insert(itemQtyMaxs, droppable[3])
table.insert(itemQtyMaxs, droppable[3])
Line 168: Line 170:
table.insert(rowTxt, table.concat(itemIds, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemIds, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemWeights, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemWeights, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemDenominators, arraySeparatorInSheets))
table.insert(rowTxt, itemDenominator)
table.insert(rowTxt, totalWeight)
table.insert(rowTxt, table.concat(itemNormalised, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemQtyMins, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemQtyMins, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemQtyMaxs, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemQtyMaxs, arraySeparatorInSheets))
892

edits