17,101
edits
(Update for v1.1) |
(Fix description related issues & avoid issues with 'random' monsters) |
||
Line 147: | Line 147: | ||
function p.getEquipmentStat(monster, statName) | function p.getEquipmentStat(monster, statName) | ||
if monster.equipmentStats == nil then | |||
return 0 | |||
else | |||
return monster.equipmentStats[statName] or 0 | |||
end | |||
end | end | ||
Line 559: | Line 563: | ||
for i, passiveID in ipairs(monster.passives) do | for i, passiveID in ipairs(monster.passives) do | ||
local passive = p.getPassiveByID(passiveID) | local passive = p.getPassiveByID(passiveID) | ||
result = result .. '\r\n* ' .. passive.name .. '\r\n** ' .. passive.customDescription | result = result .. '\r\n* ' .. passive.name .. '\r\n** ' .. Constants.getDescription(passive.customDescription, passive.modifiers) | ||
end | end | ||
end | end | ||
Line 1,254: | Line 1,258: | ||
table.insert(tableParts, '\r\n|- class="headerRow-0"\r\n! colspan="5" | !! colspan="4" |Offensive Stats !! colspan="3" |Evasion Rating !! colspan="4" |') | table.insert(tableParts, '\r\n|- class="headerRow-0"\r\n! colspan="5" | !! colspan="4" |Offensive Stats !! colspan="3" |Evasion Rating !! colspan="4" |') | ||
-- Second header row | -- Second header row | ||
table.insert(tableParts, '\r\n|- class="headerRow-1"\r\n!Monster !!Name | table.insert(tableParts, '\r\n|- class="headerRow-1"\r\n!Monster !!Name !!Combat Level ') | ||
table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Hitpoints', type='skill'})) | table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Hitpoints', type='skill'})) | ||
table.insert(tableParts, '!!Attack Speed (s) !!colspan="2"|Max Hit !!Accuracy ') | table.insert(tableParts, '!!Attack Speed (s) !!colspan="2"|Max Hit !!Accuracy ') | ||
Line 1,264: | Line 1,268: | ||
-- Generate row per monster | -- Generate row per monster | ||
for i, monster in ipairs(monsters) do | for i, monster in ipairs(monsters) do | ||
local cmbLevel = p._getMonsterCombatLevel(monster) | -- Avoid processing monsters without equipment stats. These aren't actual | ||
-- monsters, but instead are placeholders such as 'melvorF:RandomITM' | |||
-- and 'melvorTotH:RandomSpiderLair' to denote a random selection from | |||
-- a pool of monsters | |||
if monster.equipmentStats ~= nil then | |||
local cmbLevel = p._getMonsterCombatLevel(monster) | |||
local atkSpeed = p._getMonsterAttackSpeed(monster) | |||
local maxHit = p._getMonsterMaxHit(monster) | |||
local accR = p._getMonsterAR(monster) | |||
local evaR = {p._getMonsterER(monster, "Melee"), p._getMonsterER(monster, "Ranged"), p._getMonsterER(monster, "Magic")} | |||
local gpTxt = nil | |||
if monster.gpDrops.min >= monster.gpDrops.max then | |||
gpTxt = Shared.formatnum(monster.gpDrops.min) | |||
else | |||
gpTxt = Shared.formatnum(monster.gpDrops.min) .. ' - ' .. Shared.formatnum(monster.gpDrops.max) | |||
end | |||
local bones = p._getMonsterBones(monster) | |||
local boneTxt = (bones ~= nil and Icons.Icon({bones.item.name, type='item', notext=true})) or 'None' | |||
table.insert(tableParts, '\r\n|-\r\n|style="text-align: center;" |' .. Icons.Icon({monster.name, type='monster', size=50, notext=true})) | |||
table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({monster.name, type='monster', noicon=true})) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. Shared.formatnum(cmbLevel)) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. Shared.formatnum(p._getMonsterHP(monster))) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. Shared.round(atkSpeed, 1, 1)) | |||
table.insert(tableParts, '\r\n|style="text-align:center;border-right:hidden" |' .. p._getMonsterStyleIcon({monster, notext=true})) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. maxHit .. '" |' .. Shared.formatnum(maxHit)) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. Shared.formatnum(accR)) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. Shared.formatnum(evaR[1])) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. Shared.formatnum(evaR[2])) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. Shared.formatnum(evaR[3])) | |||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. (monster.gpDrops.min + monster.gpDrops.max) / 2 .. '" |' .. gpTxt) | |||
table.insert(tableParts, '\r\n|style="text-align:center" |' .. boneTxt) | |||
table.insert(tableParts, '\r\n|style="text-align:right;width:190px" |' .. p._getMonsterAreas(monster, hideDungeons)) | |||
end | end | ||
end | end | ||
Line 1,444: | Line 1,453: | ||
table.insert(resultPart, '\r\n|data-sort-value="' .. chance .. '"| ' .. Shared.round(chance, 2, 0) .. '%') | table.insert(resultPart, '\r\n|data-sort-value="' .. chance .. '"| ' .. Shared.round(chance, 2, 0) .. '%') | ||
if firstRow then | if firstRow then | ||
table.insert(resultPart, '\r\n' .. rowSuffix .. '| ' .. spAtt. | table.insert(resultPart, '\r\n' .. rowSuffix .. '| ' .. spAtt.description) | ||
firstRow = false | firstRow = false | ||
end | end |