Module:Mazunki/Monsters: Difference between revisions
From Melvor Idle
m (not enough memory) |
m (it funks?) |
||
Line 13: | Line 13: | ||
local result = '{|\r\n' | local result = '{|\r\n' | ||
local rows = {} | local rows = {} | ||
local monsterID = 0 | local monsterID = 0 | ||
Line 22: | Line 19: | ||
local rowTxt = '|-\r\n' | local rowTxt = '|-\r\n' | ||
result = | result = result..'!!ID' | ||
rowTxt = rowTxt..'|'..monsterID | rowTxt = rowTxt..'|'..monsterID | ||
Line 69: | Line 66: | ||
result = result..'!!BonePrayerValue' | result = result..'!!BonePrayerValue' | ||
local bones = Items.getItemByID(monster.bones) | local bones = Items.getItemByID(monster.bones) | ||
if bones.prayerPoints then | if bones ~= nil and bones.prayerPoints then | ||
rowTxt = rowTxt..'|'..bones.name | rowTxt = rowTxt..'|'..bones.name | ||
rowTxt = rowTxt..'|'..bones.prayerPoints | rowTxt = rowTxt..'|'..bones.prayerPoints |
Revision as of 00:41, 31 January 2022
Documentation for this module may be created at Module:Mazunki/Monsters/doc
--local Shared = require('Module:Shared')
local MonsterData = mw.loadData('Module:Monsters/data')
local Monsters = require('Module:Monsters')
local Items = require('Module:Items')
local Constants = require('Module:Constants')
-- local SourceTables = require('Module:Monsters/SourceTables')
-- local UseTables = require('Module:Monsters/UseTables')
local p = {}
function p.getRawTable(frame)
local result = '{|\r\n'
local rows = {}
local monsterID = 0
local monster = Monsters.getMonsterByID(monsterID)
while monster ~= nil and monsterID < 2000 do -- as of writing this, there are [0..163] monsters
local rowTxt = '|-\r\n'
result = result..'!!ID'
rowTxt = rowTxt..'|'..monsterID
result = result..'!!Name'
rowTxt = rowTxt..'|'..monster.name
result = result..'!!CombatLevel'
local combatLevel = Monsters._getMonsterCombatLevel(monster) -- used for slayer
rowTxt = rowTxt..'|'..combatLevel
result = result..'!!HP'
local hitpoints = Monsters._getMonsterHP(monster) -- used for slayer
rowTxt = rowTxt..'|'..hitpoints
result = result..'!!Interval'
rowTxt = rowTxt..'|'..Monsters._getMonsterAttackSpeed(monster)
result = result..'!!NormalAttackMaxHit'
rowTxt = rowTxt..'|'..Monsters._getMonsterMaxHit(monster)
result = result..'!!NormalAttackType'
rowTxt = rowTxt..'|'..monster.attackType
result = result..'!!HasSpecial'
rowTxt = rowTxt..'|'..tostring(not #(monster.specialAttack or {}))
result = result..'!!Accuracy'
rowTxt = rowTxt..'|'..Monsters._getMonsterAR(monster)
result = result..'!!MeleeEvasion'
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Melee')
result = result..'!!RangedEvasion'
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Ranged')
result = result..'!!MagicEvasion'
rowTxt = rowTxt..'|'..Monsters._getMonsterER(monster, 'Magic')
result = result..'!!GoldDropMin'
rowTxt = rowTxt..'|'..monster.dropCoins[1]
result = result..'!!GoldDropMax'
rowTxt = rowTxt..'|'..monster.dropCoins[2]
result = result..'!!BoneType'
result = result..'!!BonePrayerValue'
local bones = Items.getItemByID(monster.bones)
if bones ~= nil and bones.prayerPoints then
rowTxt = rowTxt..'|'..bones.name
rowTxt = rowTxt..'|'..bones.prayerPoints
else
rowTxt = rowTxt..'|'..tostring(false)
rowTxt = rowTxt..'|'..tostring(0)
end
result = result..'!!Location'
rowTxt = rowTxt..'|'..Monsters._getMonsterAreas(monster, false) --args[2] is excludeDungeons
result = result..'!!SlayerTier'
result = result..'!!SlayerTierName'
result = result..'!!SlayerTierCost'
result = result..'!!SlayerTierPlayerLevel'
result = result..'!!SlayerTierQtyMin'
result = result..'!!SlayerTierQtyMax'
result = result..'!!SlayerCoinReward'
local slayer = nil
if monster.canSlayer then
slayer = Constants.getSlayerTierByLevel(combatLevel)
slayer.reward = math.floor(hitpoints/10)
else
rowTxt = rowTxt
end
-- 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..'!!ItemsWeight'
-- result = result..'!!ItemsDenominators'
-- result = result..'!!ItemsTotalWeight'
-- result = result..'!!ItemsQtyMin'
-- result = result..'!!ItemsQtyMax'
-- local itemIds = {}
-- local itemWeights = {}
-- local itemDenominators = {}
-- local itemQtyMins = {}
-- local itemQtyMaxs = {}
-- local totalWeight = 0
-- for _, droppable in pairs(monster.lootTable) do
-- totalWeight = totalWeight + droppable[2]
-- end
-- for _, droppable in pairs(monster.lootTable) do
-- table.insert(itemIds, droppable[1])
-- table.insert(itemWeights, droppable[2]*monster.lootChance)
-- table.insert(itemDenominators, totalWeight*100)
-- table.insert(itemQtyMins, 1)
-- table.insert(itemQtyMaxs, droppable[3])
-- end
-- rowTxt = rowTxt..'|'..table.concat(itemIds, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemWeights, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemDenominators, ",")
-- rowTxt = rowTxt..'|'..totalWeight
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMins, ",")
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMaxs, ",")
table.insert(rows, rowTxt)
monsterID = monsterID + 1
monster = Monsters.getMonsterByID(monsterID)
end
result = result..'\r\n'..table.concat(rows, '\r\n')..'\r\n|}'
return result
end
function p.getDRValueForMonsterIdForHP(frame)
local monsterid = frame.args[1]
local hp = frame.args[2]
local autoeatlvl = frame.args[3] or 3
return 100
end
return p