Module:Mazunki/Monsters: Difference between revisions

m
table instead of string
m (it funks?)
m (table instead of string)
Line 13: Line 13:
local result = '{|\r\n'
local result = '{|\r\n'
local rows = {}
local rows = {}
local headers = {
'ID',
'Name',
'NormalAttackMaxHit',
'NormalAttackType',
'HasSpecial',
'Accuracy',
'MeleeEvasion',
'RangedEvasion',
'MagicEvasion',
'GoldDropMin',
'GoldDropMax',
'BoneType',
'BonePrayerValue',
'Location',
'SlayerTier', 'SlayerTierName', 'SlayerTierCost',
'SlayerTierPlayerLevel', 'SlayerTierQtyMin', 'SlayerTierQtyMax', 'SlayerCoinReward',
'ItemsID', 'ItemsWeight', 'ItemsDenominators', 'ItemsTotalWeight', 'ItemsQtyMin', 'ItemsQtyMax'
}


local monsterID = 0
local monsterID = 0
local monster = Monsters.getMonsterByID(monsterID)
local monster = Monsters.getMonsterByID(monsterID)
while monster ~= nil and monsterID < 2000 do -- as of writing this, there are [0..163] monsters
while monster ~= nil and monsterID < 2000 do -- as of writing this, there are [0..163] monsters
local rowTxt = '|-\r\n'
local rowTxt = {}
table.insert(rowTxt, '|-\r\n')
table.insert(rowTxt, monsterID)
table.insert(rowTxt, monster.name)
local combatLevel = Monsters._getMonsterCombatLevel(monster)
table.insert(rowTxt, combatLevel)


result = result..'!!ID'
local hitpoints = Monsters._getMonsterHP(monster)
rowTxt = rowTxt..'|'..monsterID
 
table.insert(rowTxt, hitpoints)
result = result..'!!Name'
table.insert(rowTxt, Monsters._getMonsterAttackSpeed(monster))
rowTxt = rowTxt..'|'..monster.name
table.insert(rowTxt, Monsters._getMonsterMaxHit(monster))
 
table.insert(rowTxt, monster.attackType)
result = result..'!!CombatLevel'
table.insert(rowTxt, tostring(not #(monster.specialAttack or {})))
local combatLevel = Monsters._getMonsterCombatLevel(monster) -- used for slayer
table.insert(rowTxt, Monsters._getMonsterAR(monster))
rowTxt = rowTxt..'|'..combatLevel
table.insert(rowTxt, Monsters._getMonsterER(monster, 'Melee'))
 
table.insert(rowTxt, Monsters._getMonsterER(monster, 'Ranged'))
result = result..'!!HP'
table.insert(rowTxt, Monsters._getMonsterER(monster, 'Magic'))
local hitpoints = Monsters._getMonsterHP(monster) -- used for slayer
table.insert(rowTxt, monster.dropCoins[1])
rowTxt = rowTxt..'|'..hitpoints
table.insert(rowTxt, monster.dropCoins[2])
 
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)  
local bones = Items.getItemByID(monster.bones)  
if bones ~= nil and bones.prayerPoints then
if bones ~= nil and bones.prayerPoints then
rowTxt = rowTxt..'|'..bones.name
table.insert(rowTxt, bones.name)
rowTxt = rowTxt..'|'..bones.prayerPoints
table.insert(rowTxt, bones.prayerPoints)
else
else
rowTxt = rowTxt..'|'..tostring(false)
table.insert(rowTxt, tostring(false))
rowTxt = rowTxt..'|'..tostring(0)
table.insert(rowTxt, tostring(0))
end
end


result = result..'!!Location'
table.insert(rowTxt, Monsters._getMonsterAreas(monster, false)) --args[2] is excludeDungeons
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
local slayer = nil
if monster.canSlayer then
if monster.canSlayer then
Line 92: Line 77:
end
end
-- rowTxt = rowTxt..'|'..slayer.id
table.insert(rowTxt, slayer.id)
-- rowTxt = rowTxt..'|'..slayer.display
table.insert(rowTxt, slayer.display)
-- rowTxt = rowTxt..'|'..slayer.cost
table.insert(rowTxt, slayer.cost)
-- rowTxt = rowTxt..'|'..slayer.slayerLevel
table.insert(rowTxt, slayer.slayerLevel)
-- rowTxt = rowTxt..'|'..slayer.minQuantity
table.insert(rowTxt, slayer.minQuantity)
-- rowTxt = rowTxt..'|'..slayer.maxQuantity
table.insert(rowTxt, slayer.maxQuantity)
-- rowTxt = rowTxt..'|'..slayer.reward
table.insert(rowTxt, slayer.reward)


-- result = result..'!!ItemsID'
local itemIds = {}
-- result = result..'!!ItemsWeight'
local itemWeights = {}
-- result = result..'!!ItemsDenominators'
local itemDenominators = {}
-- result = result..'!!ItemsTotalWeight'
local itemQtyMins = {}
-- result = result..'!!ItemsQtyMin'
local itemQtyMaxs = {}
-- result = result..'!!ItemsQtyMax'
local totalWeight = 0
-- local itemIds = {}
for _, droppable in pairs(monster.lootTable) do
-- local itemWeights = {}
totalWeight = totalWeight + droppable[2]
-- local itemDenominators = {}
end
-- 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
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, ",")
table.insert(rowTxt, table.concat(itemIds, ","))
-- rowTxt = rowTxt..'|'..table.concat(itemWeights, ",")
table.insert(rowTxt, table.concat(itemWeights, ","))
-- rowTxt = rowTxt..'|'..table.concat(itemDenominators, ",")
table.insert(rowTxt, table.concat(itemDenominators, ","))
-- rowTxt = rowTxt..'|'..totalWeight
table.insert(rowTxt, totalWeight)
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMins, ",")
table.insert(rowTxt, table.concat(itemQtyMins, ","))
-- rowTxt = rowTxt..'|'..table.concat(itemQtyMaxs, ",")
table.insert(rowTxt, table.concat(itemQtyMaxs, ","))


table.insert(rows, rowTxt)
table.insert(rows, table.concat(rowTxt, '|').."\r\n")
monsterID = monsterID + 1
monsterID = monsterID + 1
monster = Monsters.getMonsterByID(monsterID)
monster = Monsters.getMonsterByID(monsterID)
892

edits