4
edits
0x4a6f6e6573 (talk | contribs) (Adds crafting table for summoning) |
0x4a6f6e6573 (talk | contribs) (Fix for summoning material table's non-shard quantity and better formatting) |
||
Line 163: | Line 163: | ||
lvl = item.summoningLevel | lvl = item.summoningLevel | ||
xp = item.summoningXP | xp = item.summoningXP | ||
local ShardCostArray = {} | |||
for j, cost in Shared.skpairs(item.summoningReq[1]) do | |||
for | if cost.id >= 0 then | ||
if | local item = Items.getItemByID(cost.id) | ||
for | if item.type == 'Shard' then | ||
if | table.insert(ShardCostArray, Icons.Icon({item.name, type='item', notext=true, qty=cost.qty})) | ||
end | |||
end | |||
end | |||
req = table.concat(ShardCostArray, ', ') | |||
req = req..'<br/>\r\nand one of the following<br/>\r\n' | |||
local OtherCostArray = {} | |||
local recipeGPCost = SkillData.Summoning.Settings.recipeGPCost | |||
for j, altCost in Shared.skpairs(item.summoningReq) do | |||
local nonShardArray = {} | |||
for k, cost in Shared.skpairs(altCost) do | |||
if cost.id >= 0 then | |||
local item = Items.getItemByID(cost.id) | |||
if item.type ~= 'Shard' then | |||
local sellPrice = item.sellsFor | |||
if sellPrice < 20 then sellPrice = 20 end | |||
table.insert(nonShardArray, Icons.Icon({item.name, type='item', notext=true, qty=math.max(1, math.floor(recipeGPCost / sellPrice))})) | |||
end | |||
else | else | ||
if cost.id == -4 then | |||
table.insert(nonShardArray, Icons.GP(recipeGPCost)) | |||
elseif cost.id == -5 then | |||
table.insert(nonShardArray, Icons.SC(recipeGPCost)) | |||
end | |||
end | end | ||
end | end | ||
table.insert(OtherCostArray, table.concat(nonShardArray, ', ')) | |||
end | end | ||
req = req..table.concat(OtherCostArray, "<br/>'''OR''' ") | |||
qty = item.summoningQty | qty = item.summoningQty | ||
time = 3 | time = 3 |
edits