17,101
edits
m (Add custom separator for ItemSources) |
(Update for v1.3) |
||
Line 3: | Line 3: | ||
local Constants = require('Module:Constants') | local Constants = require('Module:Constants') | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Common = require('Module:Common') | |||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local SkillData = GameData.skillData | local SkillData = GameData.skillData | ||
local Modifiers = require('Module:Modifiers') | |||
local Magic = require('Module:Magic') | local Magic = require('Module:Magic') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
Line 131: | Line 133: | ||
end | end | ||
-- Other costs | -- Other costs | ||
table.insert(otherCostArray, Common.getCostString({ ["items"] = {}, ["currencies"] = recipe.currencyCosts})) | |||
for j, nonShardID in ipairs(recipe.nonShardItemCosts) do | for j, nonShardID in ipairs(recipe.nonShardItemCosts) do | ||
local nonShard = Items.getItemByID(nonShardID) | local nonShard = Items.getItemByID(nonShardID) | ||
Line 165: | Line 162: | ||
end | end | ||
end | end | ||
table.insert(reqSubPart, Common.getCostString({ ["items"] = {}, ["currencies"] = recipe.currencyCosts})) | |||
table.insert(reqPart, table.concat(reqSubPart, ', ')) | table.insert(reqPart, table.concat(reqSubPart, ', ')) | ||
table.insert(qtyPart, Shared.formatnum(qty * altCost.quantityMultiplier)) | table.insert(qtyPart, Shared.formatnum(qty * altCost.quantityMultiplier)) | ||
Line 180: | Line 173: | ||
-- Finally, normal recipes with a single set of item costs | -- Finally, normal recipes with a single set of item costs | ||
elseif type(recipe.itemCosts) == 'table' and not Shared.tableIsEmpty(recipe.itemCosts) then | elseif type(recipe.itemCosts) == 'table' and not Shared.tableIsEmpty(recipe.itemCosts) then | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, recipe.itemCosts, qty, time, maxTime, specialReq, recipe. | table.insert(tables, p.buildCreationTable(skill, lvl, xp, recipe.itemCosts, qty, time, maxTime, specialReq, recipe.currencyCosts)) | ||
end | end | ||
end | end | ||
Line 237: | Line 230: | ||
end | end | ||
function p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq, | function p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq, currencyCost) | ||
if qty == nil then qty = 1 end | if qty == nil then qty = 1 end | ||
local resultPart = {} | local resultPart = {} | ||
Line 258: | Line 251: | ||
end | end | ||
end | end | ||
if currencyCost ~= nil then | |||
table.insert(resultPart, Common.getCostString({ ["items"] = {}, ["currencies"] = currencyCost })) | |||
if | |||
table.insert(resultPart, | |||
end | end | ||
else | else | ||
Line 627: | Line 616: | ||
if Shared.contains(SkillData.Fishing.junkItemIDs, item.id) then | if Shared.contains(SkillData.Fishing.junkItemIDs, item.id) then | ||
table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Junk|Junk]]') | table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Junk|Junk]]') | ||
elseif item.id == SkillData.Fishing.lostChestItem then | elseif item.id == SkillData.Fishing.lostChestItem then | ||
table.insert(lineArray, Icons._SkillReq(SkillData.Fishing.name, 100)) | table.insert(lineArray, Icons._SkillReq(SkillData.Fishing.name, 100)) | ||
end | |||
-- Specials | |||
for i, specialItem in ipairs(SkillData.Fishing.specialItems) do | |||
if GameData.getEntityByProperty(specialItem.drops, 'itemID', item.id) ~= nil then | |||
table.insert(lineArray, Icons.Icon({'Fishing', type='skill', notext=true}) .. ' [[Fishing#Special|Special]]') | |||
end | |||
end | end | ||
Line 973: | Line 965: | ||
local fishTotWeight, fishItem = 0, nil | local fishTotWeight, fishItem = 0, nil | ||
for i, specialItem in ipairs(SkillData.Fishing.specialItems) do | for i, specialItem in ipairs(SkillData.Fishing.specialItems) do | ||
if | for f, drop in ipairs(specialItem.drops) do | ||
if drop.itemID == item.id then | |||
fishItem = drop | |||
end | |||
fishTotWeight = fishTotWeight + drop.weight | |||
end | end | ||
end | end | ||
if fishItem ~= nil then | if fishItem ~= nil then | ||
Line 1,082: | Line 1,076: | ||
local upgrade = GameData.getEntityByProperty('itemUpgrades', 'upgradedItemID', item.id) | local upgrade = GameData.getEntityByProperty('itemUpgrades', 'upgradedItemID', item.id) | ||
if upgrade ~= nil then | if upgrade ~= nil then | ||
local upgradeCost = | local upgradeCost = Common.getCostString({ | ||
["items"] = upgrade.itemCosts, | |||
["currencies"] = upgrade.currencyCosts | |||
}) | |||
table.insert(resultPart, '{| class="wikitable"\r\n|-\r\n!colspan="2"|[[Upgrading Items|Item Upgrade]]') | table.insert(resultPart, '{| class="wikitable"\r\n|-\r\n!colspan="2"|[[Upgrading Items|Item Upgrade]]') | ||
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials\r\n|') | table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials\r\n|') | ||
table.insert(resultPart, | table.insert(resultPart, upgradeCost) | ||
table.insert(resultPart, '\r\n|}') | table.insert(resultPart, '\r\n|}') | ||
end | end | ||
Line 1,261: | Line 1,247: | ||
for i, item in ipairs(itemArray) do | for i, item in ipairs(itemArray) do | ||
local passiveDesc = item.customDescription or | local passiveDesc = item.customDescription or Modifiers.getModifiersText(item.modifiers, false, false, 10) | ||
table.insert(resultPart, '|-\r\n') | table.insert(resultPart, '|-\r\n') | ||
table.insert(resultPart, '! '..Icons.Icon({item.name, type='item', notext='true'})..'\r\n! '..Icons.Icon({item.name, type='item', noicon=true})..'\r\n') | table.insert(resultPart, '! '..Icons.Icon({item.name, type='item', notext='true'})..'\r\n! '..Icons.Icon({item.name, type='item', noicon=true})..'\r\n') |