Anonymous

Module:Mazunki/Monsters: Difference between revisions

From Melvor Idle
m
not enough memory
m (saving just to save)
m (not enough memory)
Line 1: Line 1:


local Shared = require('Module:Shared')
--local Shared = require('Module:Shared')
local MonsterData = mw.loadData('Module:Monsters/data')
local MonsterData = mw.loadData('Module:Monsters/data')
local Monsters = require('Module:Monsters')
local Monsters = require('Module:Monsters')
local Items = require('Module:Items')
local Items = require('Module:Items')
local Icons = require('Module:Icons')
local Constants = require('Module:Constants')
-- 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 29: Line 29:


result = result..'!!CombatLevel'
result = result..'!!CombatLevel'
local combatlevel = Monsters._getMonsterCombatLevel(monster) -- used for slayer
local combatLevel = Monsters._getMonsterCombatLevel(monster) -- used for slayer
rowTxt = rowTxt..'|'..combatlevel
rowTxt = rowTxt..'|'..combatLevel


result = result..'!!HP'
result = result..'!!HP'
rowTxt = rowTxt..'|'..Monsters._getMonsterHP(monster)
local hitpoints = Monsters._getMonsterHP(monster) -- used for slayer
rowTxt = rowTxt..'|'..hitpoints


result = result..'!!Interval'
result = result..'!!Interval'
Line 51: Line 52:


result = result..'!!MeleeEvasion'
result = result..'!!MeleeEvasion'
rowTxt = rowTxt..'|'..Monsters.__getMonsterER(monster, 'Melee')
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Melee')


result = result..'!!RangedEvasion'
result = result..'!!RangedEvasion'
rowTxt = rowTxt..'|'..Monsters.__getMonsterER(monster, 'Ranged')
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Ranged')


result = result..'!!MagicEvasion'
result = result..'!!MagicEvasion'
rowTxt = rowTxt..'|'..Monsters.__getMonsterER(monster, 'Magic')
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Magic')


result = result..'!!GoldDropMin'
result = result..'!!GoldDropMin'
rowTxt = rowTxt..'|'..monster.dropCoins[0]
rowTxt = rowTxt..'|'..monster.dropCoins[1]


result = result..'!!GoldDropMax'
result = result..'!!GoldDropMax'
rowTxt = rowTxt..'|'..monster.dropCoins[1]
rowTxt = rowTxt..'|'..monster.dropCoins[2]


result = result..'!!BoneType'
result = result..'!!BoneType'
Line 87: Line 88:
result = result..'!!SlayerCoinReward'
result = result..'!!SlayerCoinReward'
local slayer = nil
local slayer = nil
if monstyer.canSlayer then
if monster.canSlayer then
slayer = Constants.getSlayerTierByLevel(combatlevel)
slayer = Constants.getSlayerTierByLevel(combatLevel)
slayer.reward = math.floor(hitpoints/10)
slayer.reward = math.floor(hitpoints/10)
else
else
Line 94: Line 95:
end
end
rowTxt = rowTxt..'|'..Constants.getSlayerTierNameByLevel(combatlevel)
-- rowTxt = rowTxt..'|'..slayer.id
-- rowTxt = rowTxt..'|'..slayer.display
-- rowTxt = rowTxt..'|'..slayer.cost
-- rowTxt = rowTxt..'|'..slayer.slayerLevel
-- rowTxt = rowTxt..'|'..slayer.minQuantity
-- rowTxt = rowTxt..'|'..slayer.maxQuantity
-- rowTxt = rowTxt..'|'..slayer.reward


result = result..'!!ItemsID'
-- result = result..'!!ItemsID'
result = result..'!!ItemsWeight'
-- result = result..'!!ItemsWeight'
result = result..'!!ItemsDenominators'
-- result = result..'!!ItemsDenominators'
result = result..'!!ItemsTotalWeight'
-- result = result..'!!ItemsTotalWeight'
result = result..'!!ItemsQtyMin'
-- result = result..'!!ItemsQtyMin'
result = result..'!!ItemsQtyMax'
-- result = result..'!!ItemsQtyMax'
local itemIds = {}
-- local itemIds = {}
local itemWeights = {}
-- local itemWeights = {}
local itemDenominators = {}
-- local itemDenominators = {}
local itemQtyMins = {}
-- local itemQtyMins = {}
local itemQtyMaxs = {}
-- local itemQtyMaxs = {}
local totalWeight = 0
-- local totalWeight = 0
for _, droppable in pairs(monster.lootTable) do
-- for _, droppable in pairs(monster.lootTable) do
totalWeight = totalWeight + droppable[2]
-- totalWeight = totalWeight + droppable[2]
end
-- end


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(itemWeights, droppable[2]*monster.lootChance)
table.insert(itemDenominators, totalWeight*100)
-- table.insert(itemDenominators, totalWeight*100)
table.insert(itemQtyMins, 1)
-- table.insert(itemQtyMins, 1)
table.insert(itemQtyMaxs, droppable[3])
-- table.insert(itemQtyMaxs, droppable[3])
end
-- end
rowTxt = rowTxt..'|'..table.concat(itemIds, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemIds, ",")
rowTxt = rowTxt..'|'..table.concat(itemWeights, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemWeights, ",")
rowTxt = rowTxt..'|'..table.concat(itemDenominators, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemDenominators, ",")
rowTxt = rowTxt..'|'..table.concat(totalWeight, ",")
-- rowTxt = rowTxt..'|'..totalWeight
rowTxt = rowTxt..'|'..table.concat(itemQtyMins, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMins, ",")
rowTxt = rowTxt..'|'..table.concat(itemQtyMaxs, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMaxs, ",")


table.insert(rows, rowTxt)
table.insert(rows, rowTxt)
monsterId = monsterId + 1
monsterID = monsterID + 1
monster = Monsters.getItemByID(monsterID)
monster = Monsters.getMonsterByID(monsterID)
end
end


892

edits