Module:Mazunki/Monsters: Difference between revisions

m
whoos csv
m (upper2)
m (whoos csv)
 
(14 intermediate revisions by the same user not shown)
Line 5: Line 5:
local Items = require('Module:Items')
local Items = require('Module:Items')
local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
local Areas = require("Module:CombatAreas")
-- local SourceTables = require('Module:Monsters/SourceTables')
-- local SourceTables = require('Module:Monsters/SourceTables')
-- local UseTables = require('Module:Monsters/UseTables')
-- local UseTables = require('Module:Monsters/UseTables')
Line 39: Line 40:
'FragmentsAmount',
'FragmentsAmount',
'Location',
'Location',
'LocationNormal',
'LocationSlayer',
'LocationDungeon',
'SlayerTier', 'SlayerTierName', 'SlayerTierCost',
'SlayerTier', 'SlayerTierName', 'SlayerTierCost',
'SlayerTierPlayerLevel', 'SlayerTierQtyMin', 'SlayerTierQtyMax', 'SlayerCoinReward',
'SlayerTierPlayerLevel', 'SlayerTierQtyMin', 'SlayerTierQtyMax', 'SlayerCoinReward',
'ItemsID', 'ItemsWeight', 'ItemsDenominators', 'ItemsTotalWeight', 'ItemsQtyMin', 'ItemsQtyMax'
'ItemsID', 'ItemsName', 'ItemsWeight', 'ItemsDenominator', 'ItemsNormalised', 'ItemsQtyMin', 'ItemsQtyMax'
}
}
result = result.."!"..table.concat(headers, "!!")
result = result.."!"..table.concat(headers, "!!")
Line 61: Line 65:
table.insert(rowTxt, Monsters._getMonsterAttackSpeed(monster))
table.insert(rowTxt, Monsters._getMonsterAttackSpeed(monster))
table.insert(rowTxt, Monsters._getMonsterMaxHit(monster))
table.insert(rowTxt, Monsters._getMonsterMaxHit(monster))
table.insert(rowTxt, monster.attackType:gsub("^%l", string.upper))
table.insert(rowTxt, (monster.attackType:gsub("^%l", string.upper)))
local hasSpecialAttack = false
local hasSpecialAttack = false
local spAtks = {}
local spAtks = {}
Line 71: Line 75:
end
end
table.insert(rowTxt, tostring(hasSpecialAttack))
table.insert(rowTxt, tostring(hasSpecialAttack))
table.insert(rowTxt, table.concat(spAtks, ";"))
table.insert(rowTxt, table.concat(spAtks, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(spAtksChance, ";"))
table.insert(rowTxt, table.concat(spAtksChance, arraySeparatorInSheets))
table.insert(rowTxt, Monsters._getMonsterAR(monster))
table.insert(rowTxt, Monsters._getMonsterAR(monster))
Line 105: Line 109:
end
end


table.insert(rowTxt, Monsters._getMonsterAreas(monster, false)) --args[2] is excludeDungeons
local locationsTable = Areas.getMonsterAreas(monsterID)
local isNormalLocation = false
local isSlayerLocation = false
local isDungeonLocation = false
local locations = {}
for i, location in pairs(locationsTable) do
if location.type == "slayer" then
isSlayerLocation = true
elseif location.type == "dungeon" then
isDungeonLocation = true
elseif location.type == "combat" then
isNormalLocation = true
end
table.insert(locations, tostring(location.name))
end
table.insert(rowTxt, table.concat(locations, arraySeparatorInSheets))
table.insert(rowTxt, tostring(isNormalLocation))
table.insert(rowTxt, tostring(isSlayerLocation))
table.insert(rowTxt, tostring(isDungeonLocation))


local slayer = nil
local slayer = nil
Line 113: Line 135:
else
else
slayer = {
slayer = {
["display"] = "None",
["id"] = notext,
["reward"] = 0
["display"] = notext,
["cost"] = notext,
["slayerLevel"] = notext,
["minQuantity"] = notext,
["maxQuantity"] = notext,
["reward"] = notext
}
}
rowTxt = rowTxt
end
end
table.insert(rowTxt, slayer.id)
table.insert(rowTxt, tostring(slayer.id))
table.insert(rowTxt, slayer.display)
table.insert(rowTxt, tostring(slayer.display))
table.insert(rowTxt, slayer.cost)
table.insert(rowTxt, tostring(slayer.cost))
table.insert(rowTxt, slayer.slayerLevel)
table.insert(rowTxt, tostring(slayer.slayerLevel))
table.insert(rowTxt, slayer.minQuantity)
table.insert(rowTxt, tostring(slayer.minQuantity))
table.insert(rowTxt, slayer.maxQuantity)
table.insert(rowTxt, tostring(slayer.maxQuantity))
table.insert(rowTxt, slayer.reward)
table.insert(rowTxt, tostring(slayer.reward))


local itemIds = {}
local itemIds = {}
local itemNames = {}
local itemWeights = {}
local itemWeights = {}
local itemDenominators = {}
local itemNormalised = {}
local itemQtyMins = {}
local itemQtyMins = {}
local itemQtyMaxs = {}
local itemQtyMaxs = {}
Line 136: Line 163:
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)
table.insert(itemNames, Items.getItemByID(droppable[1]).name)
table.insert(itemDenominators, totalWeight*100)
local numerator = droppable[2]
table.insert(itemWeights, numerator)
table.insert(itemNormalised, itemDenominator/(numerator*monster.lootChance))
table.insert(itemQtyMins, 1)
table.insert(itemQtyMins, 1)
table.insert(itemQtyMaxs, droppable[3])
table.insert(itemQtyMaxs, droppable[3])
end
end
table.insert(rowTxt, table.concat(itemIds, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemIds, arraySeparatorInSheets))
table.insert(rowTxt, table.concat(itemNames, 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/monster.lootChance)
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