4,951
edits
Falterfire (talk | contribs) (Added a check for special attacks that include a normal max hit) |
Falterfire (talk | contribs) (Added DR reduction to various monster table Max Hit columns) |
||
Line 980: | Line 980: | ||
local tableTxt = '{| class="wikitable sortable"' | local tableTxt = '{| class="wikitable sortable"' | ||
tableTxt = tableTxt..'\r\n! Name !! Combat Level !! Hitpoints !! Max Hit !! [[Combat Triangle|Combat Style]]' | tableTxt = tableTxt..'\r\n! Name !! Combat Level !! Hitpoints !! colspan=2| Max Hit !! [[Combat Triangle|Combat Style]]' | ||
for i, monsterID in ipairs(area.monsterIDs) do | for i, monsterID in ipairs(area.monsterIDs) do | ||
local monster = p.getMonsterByID(monsterID) | local monster = p.getMonsterByID(monsterID) | ||
Line 986: | Line 986: | ||
tableTxt = tableTxt..'||'..p._getMonsterCombatLevel(monster) | tableTxt = tableTxt..'||'..p._getMonsterCombatLevel(monster) | ||
tableTxt = tableTxt..'||'..Shared.formatnum(p._getMonsterHP(monster)) | tableTxt = tableTxt..'||'..Shared.formatnum(p._getMonsterHP(monster)) | ||
tableTxt = tableTxt..'||'..Shared.formatnum( | local drReduction = p._getMonsterDrReduction(monster) | ||
local maxHit = p._getMonsterMaxHit(monster) | |||
if drReduction > 0 then | |||
tableTxt = tableTxt..'||style="text-align:right" data-sort-value="'..maxHit..'"| -'..drReduction..'% DR' | |||
tableTxt = tableTxt..'||style="text-align:right"|'..Shared.formatnum(maxHit) | |||
else | |||
tableTxt = tableTxt..'||style="text-align:right" colspan="2" data-sort-value="'..maxHit..'"|'..Shared.formatnum(maxHit) | |||
end | |||
tableTxt = tableTxt..'||'..p._getMonsterStyleIcon({monster, nolink=true}) | tableTxt = tableTxt..'||'..p._getMonsterStyleIcon({monster, nolink=true}) | ||
end | end | ||
Line 1,014: | Line 1,021: | ||
-- Declare function for building table rows to avoid repeating code | -- Declare function for building table rows to avoid repeating code | ||
local buildRow = function(entityID, monsterCount, specialType) | local buildRow = function(entityID, monsterCount, specialType) | ||
local monIcon, monLevel, monHP, monMaxHit, monStyle, monCount | local monIcon, monLevel, monHP, monMaxHit, monStyle, monCount, monDrReduce | ||
local monData = {} | local monData = {} | ||
if specialType ~= nil and Shared.contains({'Afflicted', 'Spider', 'SlayerArea'}, specialType) then | if specialType ~= nil and Shared.contains({'Afflicted', 'Spider', 'SlayerArea'}, specialType) then | ||
Line 1,021: | Line 1,028: | ||
local iconQ = Icons.Icon({'Into the Mist', notext=true, nolink=true, img='Question'}) | local iconQ = Icons.Icon({'Into the Mist', notext=true, nolink=true, img='Question'}) | ||
monIcon = Icons.Icon({'Into the Mist', 'Afflicted Monster', nolink=true, img='Question'}) | monIcon = Icons.Icon({'Into the Mist', 'Afflicted Monster', nolink=true, img='Question'}) | ||
monLevel, monHP, monMaxHit, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, monsterCount | monLevel, monHP, monMaxHit, monDrReduce, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount | ||
elseif specialType == 'Spider' then | elseif specialType == 'Spider' then | ||
local iconQ = Icons.Icon({'', notext=true, nolink=true, img='Question'}) | local iconQ = Icons.Icon({'', notext=true, nolink=true, img='Question'}) | ||
Line 1,032: | Line 1,039: | ||
end | end | ||
monIcon = table.concat(monIconPart, '<br/>') | monIcon = table.concat(monIconPart, '<br/>') | ||
monLevel, monHP, monMaxHit, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, monsterCount | monLevel, monHP, monMaxHit, monDrReduce, monStyle, monCount = iconQ, iconQ, iconQ, iconQ, iconQ, monsterCount | ||
elseif specialType == 'SlayerArea' then | elseif specialType == 'SlayerArea' then | ||
-- entityID corresponds to a slayer area | -- entityID corresponds to a slayer area | ||
Line 1,040: | Line 1,047: | ||
monHP = {p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterHP(monster) end)} | monHP = {p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterHP(monster) end)} | ||
local lowMaxHit, highMaxHit = p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterMaxHit(monster) end) | local lowMaxHit, highMaxHit = p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterMaxHit(monster) end) | ||
local lowDrReduce, highDrReduce = p.getLowHighStat(area.monsterIDs, function(monster) return p._getMonsterDrReduction(monster) end) | |||
monMaxHit = highMaxHit | monMaxHit = highMaxHit | ||
monDrReduce = highDrReduce | |||
monStyle = Icons.Icon({area.name, area.name, notext=true, nolink=true, img='Question'}) | monStyle = Icons.Icon({area.name, area.name, notext=true, nolink=true, img='Question'}) | ||
monCount = monsterCount | monCount = monsterCount | ||
Line 1,050: | Line 1,059: | ||
monLevel = p._getMonsterCombatLevel(monster) | monLevel = p._getMonsterCombatLevel(monster) | ||
monHP = p._getMonsterHP(monster) | monHP = p._getMonsterHP(monster) | ||
monDrReduce = p._getMonsterDrReduction(monster) | |||
monMaxHit = p._getMonsterMaxHit(monster) | monMaxHit = p._getMonsterMaxHit(monster) | ||
monStyle = p._getMonsterStyleIcon({monster}) | monStyle = p._getMonsterStyleIcon({monster}) | ||
Line 1,083: | Line 1,093: | ||
table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monLevel) .. '"| ' .. getValText(monLevel)) | table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monLevel) .. '"| ' .. getValText(monLevel)) | ||
table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monHP) .. '"| ' .. getValText(monHP)) | table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monHP) .. '"| ' .. getValText(monHP)) | ||
table.insert(resultPart, '\r\n|style="text-align:right | if type(monDrReduce) == 'number' and monDrReduce > 0 then | ||
table.insert(resultPart, '\r\n|style="text-align:right" data-sort-value="'..getValSort(monMaxHit)..'"| -'..monDrReduce..'% DR') | |||
table.insert(resultPart, '\r\n|style="text-align:right"|'..getValText(monMaxHit)) | |||
else | |||
table.insert(resultPart, '\r\n|style="text-align:right" colspan="2" data-sort-value="'..getValSort(monMaxHit)..'"|'..getValText(monMaxHit)) | |||
end | |||
table.insert(resultPart, '\r\n| ' .. monStyle) | table.insert(resultPart, '\r\n| ' .. monStyle) | ||
table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monCount) .. '"| ' .. getValText(monCount)) | table.insert(resultPart, '\r\n|style="text-align:right;" data-sort-value="' .. getValSort(monCount) .. '"| ' .. getValText(monCount)) | ||
Line 1,091: | Line 1,106: | ||
local returnPart = {} | local returnPart = {} | ||
table.insert(returnPart, '{| class="wikitable sortable"') | table.insert(returnPart, '{| class="wikitable sortable"') | ||
table.insert(returnPart, '\r\n! Name !! Combat Level !! Hitpoints !! Max Hit !! [[Combat Triangle|Combat Style]] !! Count') | table.insert(returnPart, '\r\n! Name !! Combat Level !! Hitpoints !! colspan="2" | Max Hit !! [[Combat Triangle|Combat Style]] !! Count') | ||
-- Special handing for Impending Darkness event | -- Special handing for Impending Darkness event | ||
-- TODO needs to be revised once there is a better understanding of how the event works | -- TODO needs to be revised once there is a better understanding of how the event works | ||
Line 1,342: | Line 1,357: | ||
table.insert(tableParts, '{| class="wikitable sortable stickyHeader"') | table.insert(tableParts, '{| class="wikitable sortable stickyHeader"') | ||
-- First header row | -- First header row | ||
table.insert(tableParts, '\r\n|- class="headerRow-0"\r\n! colspan="5" | !! colspan=" | table.insert(tableParts, '\r\n|- class="headerRow-0"\r\n! colspan="5" | !! colspan="5" |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 !!Combat Level ') | 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=" | table.insert(tableParts, '!!Attack Speed (s) !!colspan="3"|Max Hit !!Accuracy ') | ||
table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Defence', type='skill', notext=true})) | table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Defence', type='skill', notext=true})) | ||
table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Ranged', type='skill', notext=true})) | table.insert(tableParts, '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Ranged', type='skill', notext=true})) | ||
Line 1,362: | Line 1,377: | ||
local atkSpeed = p._getMonsterAttackSpeed(monster) | local atkSpeed = p._getMonsterAttackSpeed(monster) | ||
local maxHit = p._getMonsterMaxHit(monster) | local maxHit = p._getMonsterMaxHit(monster) | ||
local drReduce = p._getMonsterDrReduction(monster) | |||
local accR = p._getMonsterAR(monster) | local accR = p._getMonsterAR(monster) | ||
local evaR = {p._getMonsterER(monster, "Melee"), p._getMonsterER(monster, "Ranged"), p._getMonsterER(monster, "Magic")} | local evaR = {p._getMonsterER(monster, "Melee"), p._getMonsterER(monster, "Ranged"), p._getMonsterER(monster, "Magic")} | ||
Line 1,379: | Line 1,395: | ||
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="' .. 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:right" data-sort-value="' .. atkSpeed .. '" |' .. Shared.round(atkSpeed, 1, 1)) | ||
table.insert(tableParts, '\r\n|style="text-align: | if drReduce > 0 then | ||
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="' .. maxHit .. '"| -' .. drReduce..'% DR') | ||
table.insert(tableParts, '\r\n|style="text-align:right;border-right:hidden" |' .. p._getMonsterStyleIcon({monster, notext=true})) | |||
table.insert(tableParts, '\r\n|style="text-align:right" |' .. Shared.formatnum(maxHit)) | |||
else | |||
table.insert(tableParts, '\r\n|style="text-align:right;border-right:hidden" colspan="2" data-sort-value="' .. maxHit .. '"|' .. p._getMonsterStyleIcon({monster, notext=true})) | |||
table.insert(tableParts, '\r\n|style="text-align:right"|' .. Shared.formatnum(maxHit)) | |||
end | |||
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="' .. 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[1] .. '" |' .. Shared.formatnum(evaR[1])) |