14,469
edits
Falterfire (talk | contribs) (Added an Items column to the spell uses table when necessary) |
(_getItemUseTable: Amend links for Agility uses to link to specific obstacle/pillar) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 17: | Line 17: | ||
Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust'}, | Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust'}, | ||
Attack = {}, | Attack = {}, | ||
Cartography = {'melvorD:Crown_of_Rhaelyx'}, | |||
Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'}, | Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'}, | ||
Cooking = {'melvorD:Cooking_Gloves', 'melvorD:Crown_of_Rhaelyx'}, | Cooking = {'melvorD:Cooking_Gloves', 'melvorD:Crown_of_Rhaelyx'}, | ||
Line 37: | Line 38: | ||
Summoning = {'melvorD:Crown_of_Rhaelyx'}, | Summoning = {'melvorD:Crown_of_Rhaelyx'}, | ||
Thieving = {'melvorF:Chapeau_Noir', 'melvorF:Thieving_Gloves', 'melvorF:Gloves_of_Silence'}, | Thieving = {'melvorF:Chapeau_Noir', 'melvorF:Thieving_Gloves', 'melvorF:Gloves_of_Silence'}, | ||
Township = {}, | |||
Woodcutting = {}, | Woodcutting = {}, | ||
} | } | ||
Line 54: | Line 56: | ||
["AltMagic"] = Icons.Icon({'Alt. Magic', type='skill'}), | ["AltMagic"] = Icons.Icon({'Alt. Magic', type='skill'}), | ||
["ChargeStone"] = 'Powering ' .. Icons.Icon({'Crown of Rhaelyx', type='item'}), | ["ChargeStone"] = 'Powering ' .. Icons.Icon({'Crown of Rhaelyx', type='item'}), | ||
["Shop"] = Icons.Icon({'Shop'}) | ["Shop"] = Icons.Icon({'Shop'}), | ||
["TownshipTask"] = Icons.Icon({'Tasks', type='township'}) | |||
} | } | ||
Line 141: | Line 144: | ||
end | end | ||
-- | -- Is the item a cost in an upgrade? | ||
for i, upgrade in ipairs(GameData.rawData.itemUpgrades) do | for i, upgrade in ipairs(GameData.rawData.itemUpgrades) do | ||
for j, itemCost in ipairs(upgrade.itemCosts) do | |||
if itemCost.id == item.id then | |||
addUse('Upgrade') | |||
table.insert(categoryArray, '[[Category:Upgradeable Items]]') | |||
break | |||
end | end | ||
end | end | ||
Line 156: | Line 156: | ||
break | break | ||
end | end | ||
end | end | ||
Line 341: | Line 338: | ||
end | end | ||
-- Township Tasks | |||
for _, task in ipairs(SkillData.Township.tasks) do | |||
if task.goals.items[1] ~= nil then -- Skip tasks with no items | |||
if GameData.getEntityByID(task.goals.items, item.id) then | |||
addUse('TownshipTask') | |||
break | |||
end | |||
end | |||
end | |||
-- Generate result text | -- Generate result text | ||
local useArray = {} | local useArray = {} | ||
Line 364: | Line 371: | ||
end | end | ||
if item == nil then | if item == nil then | ||
return | return Shared.printError('No item named "' .. itemName .. '" exists in the data module') | ||
end | end | ||
Line 452: | Line 459: | ||
local product = Items.getItemByID(recipe.productId) | local product = Items.getItemByID(recipe.productId) | ||
local mat = {{id = recipe.seedCost.id, quantity = recipe.seedCost.quantity}} | local mat = {{id = recipe.seedCost.id, quantity = recipe.seedCost.quantity}} | ||
local rowReq = recipe.level | local rowReq = recipe.level | ||
local category = GameData.getEntityByID(SkillData.Farming.categories, recipe.categoryID) | local category = GameData.getEntityByID(SkillData.Farming.categories, recipe.categoryID) | ||
local qty = 5 * category.harvestMultiplier | local qty = 5 * category.harvestMultiplier | ||
local xp = recipe.baseExperience | |||
table.insert(useArray, {item = {id = product.id, name = product.name}, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp}) | table.insert(useArray, {item = {id = product.id, name = product.name}, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp}) | ||
end | end | ||
Line 484: | Line 491: | ||
end | end | ||
-- Non-shard items | -- Non-shard items | ||
for j, nonShardItemID in ipairs( | -- Familiar recipes may also have a currency cost without any non-shard | ||
-- items, so account for this with a dummy ID such that one iteration | |||
-- of the below loop always occurs | |||
local nonShardItemIDs = (Shared.tableIsEmpty(recipe.nonShardItemCosts) and {''} or recipe.nonShardItemCosts) | |||
for j, nonShardItemID in ipairs(nonShardItemIDs) do | |||
if useShards or nonShardItemID == item.id then | if useShards or nonShardItemID == item.id then | ||
-- Item is used in this particular synergy recipe | -- Item is used in this particular synergy recipe | ||
Line 491: | Line 502: | ||
end | end | ||
local nonShardItem = Items.getItemByID(nonShardItemID) | local nonShardItem = Items.getItemByID(nonShardItemID) | ||
local recipeCosts = Shared.clone(recipe.itemCosts) | local recipeCosts = Shared.clone(recipe.itemCosts) | ||
local recipeCosts = {} | local recipeCosts = {} | ||
Line 498: | Line 507: | ||
table.insert(recipeCosts, {id = itemCost.id, quantity = itemCost.quantity}) | table.insert(recipeCosts, {id = itemCost.id, quantity = itemCost.quantity}) | ||
end | end | ||
table.insert(recipeCosts, {id = nonShardItemID, | if nonShardItem ~= nil then | ||
-- Item ID can be nil for recipes such as Leprechaun or Cyclops | |||
local itemValue = math.max(nonShardItem.sellsFor, 20) | |||
local nonShardQty = math.max(1, math.floor(recipeGPCost / itemValue)) | |||
table.insert(recipeCosts, {id = nonShardItemID, quantity = nonShardQty}) | |||
end | |||
table.insert(useArray, {item = {id = recipeItem.id, name = recipeItem.name}, qty = recipe.baseQuantity, mats = recipeCosts, gp = recipe.gpCost, sc = recipe.scCost, skill = 'Summoning', req = recipe.level, xp = recipe.baseExperience}) | table.insert(useArray, {item = {id = recipeItem.id, name = recipeItem.name}, qty = recipe.baseQuantity, mats = recipeCosts, gp = recipe.gpCost, sc = recipe.scCost, skill = 'Summoning', req = recipe.level, xp = recipe.baseExperience}) | ||
end | end | ||
Line 550: | Line 564: | ||
local iconName = row.item.name | local iconName = row.item.name | ||
if row.skill == 'Agility' then | if row.skill == 'Agility' then | ||
iconType = 'agility' | |||
end | end | ||
local typeName = row.skill ~= nil and row.skill or '' | local typeName = row.skill ~= nil and row.skill or '' | ||
Line 575: | Line 589: | ||
local matQty = itemCost.quantity or itemCost[2] or 1 | local matQty = itemCost.quantity or itemCost[2] or 1 | ||
if matItem == nil then | if matItem == nil then | ||
table.insert(matRow, ' | table.insert(matRow, Shared.printError('Failed to find item with ID "' .. itemCost.id .. '"')) | ||
elseif type(matQty) == 'number' then | elseif type(matQty) == 'number' then | ||
table.insert(matRow, Icons.Icon({matItem.name, type='item', qty=matQty})) | table.insert(matRow, Icons.Icon({matItem.name, type='item', qty=matQty})) | ||
Line 648: | Line 662: | ||
local item = Items.getItem(itemName) | local item = Items.getItem(itemName) | ||
if item == nil then | if item == nil then | ||
return | return Shared.printError('No item named "' .. itemName .. '" exists in the data module') | ||
end | end | ||
Line 676: | Line 690: | ||
table.insert(resultPart, '!!Runes') | table.insert(resultPart, '!!Runes') | ||
if hasItems then | if hasItems then | ||
table.insert(resultPart, '!! | table.insert(resultPart, '!!Item Cost') | ||
end | end | ||
Line 707: | Line 721: | ||
local item = Items.getItem(itemName) | local item = Items.getItem(itemName) | ||
if item == nil then | if item == nil then | ||
return | return Shared.printError('No item named "' .. itemName .. '" exists in the data module') | ||
end | end | ||
Line 747: | Line 761: | ||
'Mastery Token (Cooking)', | 'Mastery Token (Cooking)', | ||
'Gem Gloves', | 'Gem Gloves', | ||
'Basic Bag' | 'Basic Bag', | ||
'Bird Nest' | |||
} | } | ||
local checkFuncs = { | local checkFuncs = { |