4,951
edits
Falterfire (talk | contribs) (Un-hiding the Wandering Bard on the Slayer Monsters table) |
Falterfire (talk | contribs) (Added a p.getFullMonsterTable function) |
||
Line 932: | Line 932: | ||
return '' | return '' | ||
else | else | ||
return p._getMonsterTable(monsterIDs) | |||
end | |||
end | |||
function p.getFullMonsterTable(frame) | |||
local monsterIDs = {} | |||
for i = 0, Shared.tableCount(MonsterData.Monsters) - 1, 1 do | |||
table.insert(monsterIDs, i) | |||
end | |||
return p._getMonsterTable(monsterIDs) | |||
end | |||
function p._getMonsterTable(monsterIDs) | |||
--Making a single function for getting a table of monsters given a list of IDs. | |||
local tableTxt = '{| class="wikitable sortable stickyHeader"' | |||
-- First header row | |||
tableTxt = tableTxt .. '\r\n|- class="headerRow-0"\r\n! colspan="5" | !! colspan="4" |Offensive Stats !! colspan="3" |Evasion Rating !! colspan="4" |' | |||
-- Second header row | |||
tableTxt = tableTxt .. '\r\n|- class="headerRow-1"\r\n!Monster !!Name !!ID !!Combat Level ' | |||
tableTxt = tableTxt .. '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Hitpoints', type='skill'}) | |||
tableTxt = tableTxt .. '!!Attack Type !!Attack Speed (s) !!Max Hit !!Accuracy ' | |||
tableTxt = tableTxt .. '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Defence', type='skill', notext=true}) | |||
tableTxt = tableTxt .. '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Ranged', type='skill', notext=true}) | |||
tableTxt = tableTxt .. '!!style="padding:0 1em 0 0"|' .. Icons.Icon({'Magic', type='skill', notext=true}) | |||
tableTxt = tableTxt .. '!!Drop Chance !!Coins !!Bones !!Locations' | |||
-- Generate row per monster | |||
for i, monsterID in Shared.skpairs(monsterIDs) do | |||
local monster = p.getMonsterByID(monsterID) | |||
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 lootChance = monster.lootChance ~= nil and monster.lootChance or 100 | |||
local gpRange = {0, 0} | |||
if monster.dropCoins ~= nil and monster.dropCoins[2] > 1 then | |||
gpRange = {monster.dropCoins[1], monster.dropCoins[2] - 1} | |||
end | |||
local gpTxt = nil | |||
if gpRange[1] == gpRange[2] then | |||
gpTxt = Icons.GP(gpRange[1]) | |||
else | |||
gpTxt = Icons.GP(gpRange[1], gpRange[2]) | |||
end | |||
local boneTxt = 'None' | |||
if monster.bones ~= nil then | |||
local bones = Items.getItemByID(monster.bones) | |||
boneTxt = Icons.Icon({bones.name, type='item', notext=true}) | |||
end | end | ||
tableTxt = tableTxt .. "\r\n|}" | tableTxt = tableTxt .. '\r\n|-\r\n|style="text-align: left;" |' .. Icons.Icon({monster.name, type='monster', size=50, notext=true}) | ||
tableTxt = tableTxt .. '\r\n|style="text-align:left" |[[' .. monster.name .. ']]' | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" |' .. monsterID | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. cmbLevel .. '" |' .. Shared.formatnum(cmbLevel) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. monster.hitpoints .. '" |' .. Shared.formatnum(p._getMonsterHP(monster)) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right;white-space:nowrap" |' .. p._getMonsterStyleIcon({monster, nolink='true'}) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. atkSpeed .. '" |' .. Shared.round(atkSpeed, 1, 1) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. maxHit .. '" |' .. Shared.formatnum(maxHit) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. accR .. '" |' .. Shared.formatnum(accR) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. evaR[1] .. '" |' .. Shared.formatnum(evaR[1]) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. evaR[2] .. '" |' .. Shared.formatnum(evaR[2]) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. evaR[3] .. '" |' .. Shared.formatnum(evaR[3]) | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. lootChance .. '" |' .. lootChance .. '%' | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right" data-sort-value="' .. (gpRange[1] + gpRange[2]) / 2 .. '" |' .. gpTxt | |||
tableTxt = tableTxt .. '\r\n|style="text-align:center" |' .. boneTxt | |||
tableTxt = tableTxt .. '\r\n|style="text-align:right;white-space:nowrap" |' .. p._getMonsterAreas(monster, true) | |||
end | end | ||
tableTxt = tableTxt .. "\r\n|}" | |||
return tableTxt | |||
end | end | ||
return p | return p |