2,875
edits
(_getMonsterAreas: Fix combat area icon types) |
No edit summary |
||
Line 9: | Line 9: | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
local Num = require('Module:Number') | |||
function p.getMonster(name) | function p.getMonster(name) | ||
Line 796: | Line 798: | ||
--Reformatting slightly - If there are any special attacks, specifically label the Normal Attack | --Reformatting slightly - If there are any special attacks, specifically label the Normal Attack | ||
local normalDmgText = ' 1 - '.. | local normalDmgText = ' 1 - '..Num.formatnum(p._getMonsterBaseMaxHit(monster))..' '..typeText..' Damage' | ||
if normalAttackChance > 0 and normalAttackChance < 100 then | if normalAttackChance > 0 and normalAttackChance < 100 then | ||
normalDmgText = normalAttackChance .. '% ' ..iconText..' Normal Attack\r\n** '..normalDmgText | normalDmgText = normalAttackChance .. '% ' ..iconText..' Normal Attack\r\n** '..normalDmgText | ||
Line 1,048: | Line 1,050: | ||
if row.maxQuantity > row.minQuantity then | if row.maxQuantity > row.minQuantity then | ||
result = result .. | result = result .. Num.formatnum(row.minQuantity) .. ' - ' | ||
end | end | ||
result = result .. | result = result .. Num.formatnum(row.maxQuantity) | ||
--Adding price columns | --Adding price columns | ||
Line 1,217: | Line 1,219: | ||
local function formatNumRange(minValue, maxValue) | local function formatNumRange(minValue, maxValue) | ||
if maxValue ~= nil and maxValue > minValue then | if maxValue ~= nil and maxValue > minValue then | ||
return | return Num.formatnum(minValue) .. ' - ' .. Num.formatnum(maxValue) | ||
else | else | ||
return | return Num.formatnum(minValue) | ||
end | end | ||
end | end | ||
Line 1,318: | Line 1,320: | ||
table.insert(tableBits, '||'..p._getMonsterCombatLevel(monster)) | table.insert(tableBits, '||'..p._getMonsterCombatLevel(monster)) | ||
if hasBarrier then | if hasBarrier then | ||
table.insert(tableBits, '||'.. | table.insert(tableBits, '||'..Num.formatnum(p._getMonsterBarrier(monster))) | ||
end | end | ||
table.insert(tableBits, '||'.. | table.insert(tableBits, '||'..Num.formatnum(p._getMonsterHP(monster))) | ||
local drReduction = p._getMonsterDrReduction(monster) | local drReduction = p._getMonsterDrReduction(monster) | ||
local maxHit = p._getMonsterMaxHit(monster) | local maxHit = p._getMonsterMaxHit(monster) | ||
if drReduction > 0 then | if drReduction > 0 then | ||
table.insert(tableBits, '||style="text-align:right" data-sort-value="'..maxHit..'"| -'..drReduction..'% DR') | table.insert(tableBits, '||style="text-align:right" data-sort-value="'..maxHit..'"| -'..drReduction..'% DR') | ||
table.insert(tableBits, '||style="text-align:right"|'.. | table.insert(tableBits, '||style="text-align:right"|'..Num.formatnum(maxHit)) | ||
else | else | ||
table.insert(tableBits, '||style="text-align:right" colspan="2" data-sort-value="'..maxHit..'"|'.. | table.insert(tableBits, '||style="text-align:right" colspan="2" data-sort-value="'..maxHit..'"|'..Num.formatnum(maxHit)) | ||
end | end | ||
table.insert(tableBits, '||'..p._getMonsterStyleIcon({monster, nolink=true})) | table.insert(tableBits, '||'..p._getMonsterStyleIcon({monster, nolink=true})) | ||
Line 1,427: | Line 1,429: | ||
end | end | ||
local getValText = function(val) | local getValText = function(val) | ||
if type(val) == 'table' and | if type(val) == 'table' and Num.tableCount(val) == 2 then | ||
if type(val[1]) == 'number' and type(val[2]) == 'number' then | if type(val[1]) == 'number' and type(val[2]) == 'number' then | ||
return | return Num.formatnum(val[1]) .. ' - ' .. Num.formatnum(val[2]) | ||
else | else | ||
return val[1] .. ' - ' .. val[2] | return val[1] .. ' - ' .. val[2] | ||
end | end | ||
elseif type(val) == 'number' then | elseif type(val) == 'number' then | ||
return | return Num.formatnum(val) | ||
else | else | ||
return val | return val | ||
Line 1,533: | Line 1,535: | ||
table.insert(monsterList, Icons.Icon({'Affliction', 'Afflicted Monster', img='Question', qty=monster.count})) | table.insert(monsterList, Icons.Icon({'Affliction', 'Afflicted Monster', img='Question', qty=monster.count})) | ||
elseif monster.id == 'melvorTotH:RandomSpiderLair' then | elseif monster.id == 'melvorTotH:RandomSpiderLair' then | ||
local monIconPart = { | local monIconPart = { Num.formatnum(monster.count) .. ' Spiders:' } | ||
for i, monsterID in ipairs(GameData.rawData.spiderLairMonsters) do | for i, monsterID in ipairs(GameData.rawData.spiderLairMonsters) do | ||
local monster = p.getMonsterByID(monsterID) | local monster = p.getMonsterByID(monsterID) | ||
Line 1,726: | Line 1,728: | ||
table.insert(tableParts, '\r\n|-\r\n|style="text-align: center;" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', size=50, notext=true})) | table.insert(tableParts, '\r\n|-\r\n|style="text-align: center;" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', size=50, notext=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. Num.formatnum(cmbLevel)) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. Num.formatnum(p._getMonsterHP(monster))) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. Num.round(atkSpeed, 1, 1)) | ||
if drReduce > 0 then | if drReduce > 0 then | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. maxHit .. '"| -' .. drReduce..'% DR') | 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;border-right:hidden" |' .. p._getMonsterStyleIcon({monster, notext=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:right" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" |' .. Num.formatnum(maxHit)) | ||
else | 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;border-right:hidden" colspan="2" data-sort-value="' .. maxHit .. '"|' .. p._getMonsterStyleIcon({monster, notext=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:right"|' .. | table.insert(tableParts, '\r\n|style="text-align:right"|' .. Num.formatnum(maxHit)) | ||
end | end | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. Num.formatnum(accR)) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. Num.formatnum(evaR[1])) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. Num.formatnum(evaR[2])) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. Num.formatnum(evaR[3])) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. dr .. '" |' .. dr..'%') | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. dr .. '" |' .. dr..'%') | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. currVal .. '" |' .. currText) | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. currVal .. '" |' .. currText) | ||
Line 1,768: | Line 1,770: | ||
local gpTxt = nil | local gpTxt = nil | ||
if monster.gpDrops.min >= monster.gpDrops.max then | if monster.gpDrops.min >= monster.gpDrops.max then | ||
gpTxt = | gpTxt = Num.formatnum(monster.gpDrops.min) | ||
else | else | ||
gpTxt = | gpTxt = Num.formatnum(monster.gpDrops.min) .. ' - ' .. Num.formatnum(monster.gpDrops.max) | ||
end | end | ||
Line 1,776: | Line 1,778: | ||
local lootTxt = '0' | local lootTxt = '0' | ||
if lootVal ~= 0 then | if lootVal ~= 0 then | ||
lootTxt = | lootTxt = Num.formatnum(Num.round(lootVal, 2, 2)) | ||
end | end | ||
Line 1,783: | Line 1,785: | ||
table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:right" |' .. monster.id) | table.insert(tableParts, '\r\n|style="text-align:right" |' .. monster.id) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. Num.formatnum(cmbLevel)) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. Num.formatnum(p._getMonsterHP(monster))) | ||
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:right" data-sort-value="' .. (monster.gpDrops.min + monster.gpDrops.max) / 2 .. '" |' .. gpTxt) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. lootVal .. '" |' .. lootTxt) | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. lootVal .. '" |' .. lootTxt) | ||
Line 1,816: | Line 1,818: | ||
local gpTxt = nil | local gpTxt = nil | ||
if monster.gpDrops.min >= monster.gpDrops.max then | if monster.gpDrops.min >= monster.gpDrops.max then | ||
gpTxt = | gpTxt = Num.formatnum(monster.gpDrops.min) | ||
else | else | ||
gpTxt = | gpTxt = Num.formatnum(monster.gpDrops.min) .. ' - ' .. Num.formatnum(monster.gpDrops.max) | ||
end | end | ||
Line 1,824: | Line 1,826: | ||
local lootTxt = '0' | local lootTxt = '0' | ||
if lootVal ~= 0 then | if lootVal ~= 0 then | ||
lootTxt = | lootTxt = Num.formatnum(Shared.round(lootVal, 2, 2)) | ||
end | end | ||
Line 1,838: | Line 1,840: | ||
table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | table.insert(tableParts, '\r\n|style="text-align:left" |' .. Icons.Icon({p.getMonsterName(monster), type='monster', noicon=true})) | ||
-- table.insert(tableParts, '\r\n|style="text-align:right" |' .. monster.id) | -- table.insert(tableParts, '\r\n|style="text-align:right" |' .. monster.id) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. Num.formatnum(cmbLevel)) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. p._getMonsterHP(monster) .. '" |' .. Num.formatnum(p._getMonsterHP(monster))) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. Num.formatnum(evaR[1])) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. Num.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:center;border-right:hidden" |' .. p._getMonsterStyleIcon({monster, notext=true})) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. maxHit .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. maxHit .. '" |' .. Num.formatnum(maxHit)) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. Num.formatnum(accR)) | ||
--table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. | --table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. Num.formatnum(evaR[2])) | ||
--table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. | --table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. Num.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:right" data-sort-value="' .. (monster.gpDrops.min + monster.gpDrops.max) / 2 .. '" |' .. gpTxt) | ||
table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. lootVal .. '" |' .. lootTxt) | table.insert(tableParts, '\r\n|style="text-align:right" data-sort-value="' .. lootVal .. '" |' .. lootTxt) |
edits