17,007
edits
No edit summary |
(Apply CSS classes to prevent image columns from collapsing on devices with small widths) |
||
(8 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Shop = require('Module:Shop') | |||
local Num = require('Module:Number') | local Num = require('Module:Number') | ||
Line 22: | Line 23: | ||
local html = mw.html.create('table') | local html = mw.html.create('table') | ||
:addClass('wikitable sortable stickyHeader') | :addClass('wikitable sortable stickyHeader col-1-img col-5-img') | ||
html:tag('tr'):addClass('headerRow-0') | html:tag('tr'):addClass('headerRow-0') | ||
Line 54: | Line 55: | ||
:css('text-align', 'center') | :css('text-align', 'center') | ||
row:tag('td'):wikitext(Icons.getDLCColumnIcon(Fam.id)) | row:tag('td'):wikitext(Icons.getDLCColumnIcon(Fam.id)) | ||
:attr('data-sort-value', Icons.getExpansionID(Fam.id)) | :attr('data-sort-value', Icons.getExpansionID(Fam.id)) | ||
Line 72: | Line 72: | ||
local args = frame.args ~= nil and frame.args or frame | local args = frame.args ~= nil and frame.args or frame | ||
local realmName = args.realm | local realmName = args.realm | ||
local category = args.category | |||
local realm = Skills.getRealmFromName(realmName) | local realm = Skills.getRealmFromName(realmName) | ||
if realm == nil then | if realm == nil then | ||
Line 77: | Line 78: | ||
end | end | ||
local skillID = 'Summoning' | local skillID = 'Summoning' | ||
local html = mw.html.create('table') | |||
:addClass('wikitable sortable stickyHeader col-1-img col-3-img') | |||
local header = html:tag('tr'):addClass('headerRow-0') | |||
header:tag('th'):wikitext('Name') | |||
:attr('colspan', 2) | |||
header:tag('th'):wikitext('DLC') | |||
header:tag('th'):wikitext(Icons._SkillRealmIcon(skillID, realm.id) .. '<br>Level') | |||
header:tag('th'):wikitext('Tier') | |||
header:tag('th'):wikitext('Creation<br>XP') | |||
header:tag('th'):wikitext('Shards') | |||
header:tag('th'):wikitext('Cost of shards') | |||
if category == 'Combat' then | |||
header:tag('th'):wikitext(Icons.Icon({'Melee', notext=true, nolink=true}) .. '<br>Max Hit') | |||
end | |||
local function getShardCosts(familiar) | |||
local shardCosts = {} | |||
for _, shard in ipairs(familiar.itemCosts) do | |||
local shopItem = Shop.getPurchaseByID(shard.id) | |||
for _, shardCost in ipairs(shopItem.cost.currencies) do | |||
local addCost = shardCost.cost * shard.quantity | |||
if shardCosts[shardCost.currency] ~= nil then | |||
shardCosts[shardCost.currency] = shardCosts[shardCost.currency] + addCost | |||
else | |||
shardCosts[shardCost.currency] = addCost | |||
end | |||
end | |||
end | |||
return shardCosts | |||
end | |||
local | local function isCombatFamiliar(fam) | ||
local item = Items.getItemByID(fam.productID) | |||
local maxHit = Items._getItemStat(item, 'summoningMaxhit') | |||
return maxHit ~= nil | |||
end | |||
local Familiars = GameData.getEntities(SkillData.Summoning.recipes, | local Familiars = GameData.getEntities(SkillData.Summoning.recipes, | ||
function(recipe) | function(recipe) | ||
return Skills.getRecipeRealm(recipe) == realm.id and | |||
((category == 'Combat' and isCombatFamiliar(recipe)) or | |||
(category ~= 'Combat' and not isCombatFamiliar(recipe))) | |||
end | end | ||
) | ) | ||
Line 98: | Line 134: | ||
local item = Items.getItemByID(Fam.productID) | local item = Items.getItemByID(Fam.productID) | ||
if item ~= nil then | if item ~= nil then | ||
local | local effectDesc = Modifiers.getModifiersText(item.modifiers, false, false, 10) | ||
local row = html:tag('tr') | |||
row:tag('td'):wikitext(Icons.Icon({item.name, type='item', notext=true})) | |||
:attr('data-sort-value', item.name) | |||
row:tag('td'):wikitext('[[' .. item.name .. ']]') | |||
row:tag('td'):wikitext(Icons.getDLCColumnIcon(Fam.id)) | |||
:attr('data-sort-value', Icons.getExpansionID(Fam.id)) | |||
row:tag('td'):wikitext(level) | |||
:css('text-align', 'center') | |||
row:tag('td'):wikitext(Fam.tier) | |||
:css('text-align', 'center') | |||
row:tag('td'):wikitext(Num.formatnum(baseXP)) | |||
:css('text-align', 'right') | |||
:attr('data-sort-value', baseXP) | |||
local shardCell = row:tag('td') | |||
local shardCostCell = row:tag('td') | |||
if category == 'Combat' then | |||
local maxHit = Items._getItemStat(item, 'summoningMaxhit') * 10 | |||
row:tag('td'):wikitext(Num.formatnum(maxHit)) | |||
:css('text-align', 'right') | |||
:attr('data-sort-value', maxHit) | |||
end | end | ||
-- Shards required | |||
for _, cost in ipairs(Fam.itemCosts) do | |||
-- Shards | |||
for | |||
local shard = Items.getItemByID(cost.id) | local shard = Items.getItemByID(cost.id) | ||
if shard ~= nil then | if shard ~= nil then | ||
local sub = mw.html.create('sub') | |||
:wikitext(cost.quantity .. 'x'):addClass('item-qty'):done() | |||
shardCell:node(sub) | |||
shardCell:wikitext(Icons.Icon({shard.name, type='item', notext=true})) | |||
end | end | ||
end | end | ||
local costTbl = {} | |||
for costType, cost in pairs(getShardCosts(Fam)) do | |||
local | table.insert(costTbl, Icons._Currency(costType, cost)) | ||
end | end | ||
shardCostCell:wikitext(table.concat(costTbl, '<br>')) | |||
:css('text-align', 'right') | |||
end | end | ||
end | end | ||
return tostring(html) | |||
end | end | ||
Line 158: | Line 185: | ||
local skillID = 'Summoning' | local skillID = 'Summoning' | ||
local result = '' | local result = '' | ||
result = result..'{| class="wikitable sortable stickyHeader"' | result = result..'{| class="wikitable sortable stickyHeader col-1-img col-3-img"' | ||
result = result..'\r\n|- class="headerRow-0"' | result = result..'\r\n|- class="headerRow-0"' | ||
result = result..'\r\n!colspan="2"|Familiar 1!!colspan="2"|Familiar 2!!Effect!!Requirements' | result = result..'\r\n!colspan="2"|Familiar 1!!colspan="2"|Familiar 2!!Effect!!Requirements' | ||
Line 310: | Line 337: | ||
local html = mw.html.create('table') | local html = mw.html.create('table') | ||
:addClass('wikitable sortable stickyHeader') | :addClass('wikitable sortable stickyHeader col-1-img col-3-img') | ||
html:tag('tr'):addClass('headerRow-0') | html:tag('tr'):addClass('headerRow-0') |