Module:Skills/Summoning: Difference between revisions

no edit summary
No edit summary
No edit summary
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 96: Line 97:
end
end
function getShardCosts(familiar)
local shardCosts = {}
for _, shardItem in ipairs(familiar.itemCosts) do
for _, shardCost in ipairs(shardItem.cost.currencies) do
if shardCosts[shardCost.currency] then
shardCosts[shardCost.currency] = shardCosts[shardCost.currency] + shardCost.cost
else
shardCosts[shardCost.currency] = shardCost.cost
end
end
end
    return shardCosts
end
function isCombatFamiliar(fam)
function isCombatFamiliar(fam)
local item = Items.getItemByID(fam.productID)
local item = Items.getItemByID(fam.productID)
Line 101: Line 116:
return maxHit ~= nil
return maxHit ~= nil
end
end
 
local Familiars = GameData.getEntities(SkillData.Summoning.recipes,
local Familiars = GameData.getEntities(SkillData.Summoning.recipes,
function(recipe)
function(recipe)
Line 135: Line 150:
:attr('data-sort-value', baseXP)
:attr('data-sort-value', baseXP)
local shardCell = row:tag('td')
local shardCell = row:tag('td')
row:tag('td'):wikitext('0 GP')
local shardCostCell = row:tag('td')
if category == 'Combat' then
if category == 'Combat' then
Line 145: Line 160:


-- Shards required
-- Shards required
for j, cost in ipairs(Fam.itemCosts) do
for _, cost in ipairs(Fam.itemCosts) do
local shard = Items.getItemByID(cost.id)
local shard = Items.getItemByID(cost.id)
if shard ~= nil then
if shard ~= nil then
Line 154: Line 169:
end
end
end
end
local costTbl = {}
for costType, cost in pairs(getShardCosts(Fam)) do
table.insert(costTbl, Icons._Currency(costType, cost))
end
shardCostCell:wikitext(table.concat(costTbl, '<br>'))
:css('text-align', 'right')
end
end
end
end
2,875

edits