4,951
edits
Falterfire (talk | contribs) (Added XP column for Agility Obstacles.) |
Falterfire (talk | contribs) (Tweaked how UseTables figure out shop purchase uses) |
||
Line 12: | Line 12: | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Agility = require('Module:Skills/Agility') | local Agility = require('Module:Skills/Agility') | ||
local Shop = require('Module:Shop') | |||
Line 172: | Line 173: | ||
end | end | ||
--Firemaking | --Firemaking | ||
if item. | if SkillData.Firemaking[item.id + 1] ~= nil or Shared.contains(itemUseArray.Firemaking, item.name) then | ||
table.insert(useArray, chr..Icons.Icon({'Firemaking', type='skill'})) | table.insert(useArray, chr..Icons.Icon({'Firemaking', type='skill'})) | ||
end | end | ||
Line 218: | Line 219: | ||
--Other odds and ends: | --Other odds and ends: | ||
--Mastery Tokens are tied to 'Mastery' | --Mastery Tokens are tied to 'Mastery' | ||
if item.type == 'Token' then | if item.type == 'Token' then | ||
Line 243: | Line 245: | ||
if item.name == 'Charge Stone of Rhaelyx' then | if item.name == 'Charge Stone of Rhaelyx' then | ||
table.insert(useArray, chr..'Powering '..Icons.Icon({'Crown of Rhaelyx', type='item'})) | table.insert(useArray, chr..'Powering '..Icons.Icon({'Crown of Rhaelyx', type='item'})) | ||
end | |||
--Some items are needed to make shop purchases | |||
local shopArray = Shop.getItemCostArray(item.id) | |||
if Shared.tableCount(shopArray) > 0 then | |||
table.insert(useArray, chr..Icons.Icon({'Shop'})) | |||
end | end | ||
Line 283: | Line 291: | ||
end | end | ||
table.insert(useArray, {item = item2, qty = 1, mats = mat, skill = 'Upgrade', req = rowReq, xp = xp, gp = item2.trimmedGPCost}) | table.insert(useArray, {item = item2, qty = 1, mats = mat, skill = 'Upgrade', req = rowReq, xp = xp, gp = item2.trimmedGPCost}) | ||
break | break | ||
end | end | ||
Line 398: | Line 390: | ||
local qty = 1 | local qty = 1 | ||
table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Cooking', req = rowReq, xp = xp}) | table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Cooking', req = rowReq, xp = xp}) | ||
end | |||
--Handle shop purchases using Module:Shop | |||
local shopUses = Shop.getItemCostArray(item.id) | |||
for i, purchase in Shared.skpairs(shopUses) do | |||
local rowReq = Shop.getRequirementString(purchase.unlockRequirements) | |||
local iconType = (purchase.contains.items ~= nil and Shared.tableCount(purchase.contains.items) > 0) and 'item' or 'upgrade' | |||
table.insert(useArray, {item = {name = purchase.name}, qty = 1, mats = purchase.cost.items, skill = 'Shop', req = rowReq, xp = 'N/A', gp = purchase.cost.gp, type = iconType}) | |||
end | end | ||
Line 427: | Line 427: | ||
for i, row in pairs(useArray) do | for i, row in pairs(useArray) do | ||
local qty = row.qty ~= nil and row.qty or 1 | local qty = row.qty ~= nil and row.qty or 1 | ||
local iconType = row.type ~= nil and row.type or 'item' | |||
result = result..'\r\n|-\r\n|data-sort-value="'..row.item.name..'"|' | result = result..'\r\n|-\r\n|data-sort-value="'..row.item.name..'"|' | ||
result = result..Icons.Icon({row.item.name, type= | result = result..Icons.Icon({row.item.name, type=iconType, notext=true, size=50})..'||' | ||
if qty > 1 then result = result.."'''"..qty.."x''' " end | if qty > 1 then result = result.."'''"..qty.."x''' " end | ||
result = result..'[['..row.item.name..']]' | result = result..'[['..row.item.name..']]' | ||
Line 434: | Line 435: | ||
result = result..'||data-sort-value="Upgrade"|[[Upgrading Items|Upgrade]]' | result = result..'||data-sort-value="Upgrade"|[[Upgrading Items|Upgrade]]' | ||
elseif row.skill == 'Shop' then | elseif row.skill == 'Shop' then | ||
result = result..'||data-sort-value="Shop"| | result = result..'||data-sort-value="Shop"|'..Icons.Icon({'Shop'}) | ||
else | else | ||
result = result..'||data-sort-value="'..row.skill..'"|'..Icons.Icon({row.skill, type='skill'}) | result = result..'||data-sort-value="'..row.skill..'"|'..Icons.Icon({row.skill, type='skill'}) |