Module:Items/SourceTables: Difference between revisions

Update for v1.0.2
(getMonsterBones -> _getMonsterBones)
(Update for v1.0.2)
Line 24: Line 24:
}
}
}
}
local SkillEnum = {}
for i, skill in pairs(SkillData.Skills) do
SkillEnum[skill.name] = Constants.getSkillID(skill.name)
end


function p._getCreationTable(item)
function p._getCreationTable(item)
Line 37: Line 42:
local tables = {}
local tables = {}
--First figure out what skill is used to make this...
--First figure out what skill is used to make this...
if item.smithingLevel ~= nil then
if type(item.masteryID) == 'table' then
skill = 'Smithing'
local skillID, masteryID = item.masteryID[1], item.masteryID[2]
lvl = item.smithingLevel
skill = Constants.getSkillName(skillID)
xp = item.smithingXP
if skillID == SkillEnum.Fishing then
req = item.smithReq
-- Fishing
qty = item.smithingQty
lvl = item.fishingLevel
time = 2
xp = item.fishingXP
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
qty = 1
end
time = item.minFishingInterval / 1000
if item.craftingLevel ~= nil then
maxTime = item.maxFishingInterval / 1000
skill = 'Crafting'
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime))
lvl = item.craftingLevel
elseif skillID == SkillEnum.Cooking then
xp = item.craftingXP
-- Cooking
req = item.craftReq
for i, reqSet in pairs(item.recipeRequirements) do
qty = item.craftQty
lvl = item.cookingLevel
time = 3
xp = item.cookingXP
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, nil, nil, item.craftGPCost))
req = reqSet
end
qty = item.cookingQty
if item.runecraftingLevel ~= nil then
time = item.cookingInterval / 1000
skill = 'Runecrafting'
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
lvl = item.runecraftingLevel
end
xp = item.runecraftingXP
elseif skillID == SkillEnum.Mining then
req = item.runecraftReq
-- Mining
qty = item.runecraftQty
local rock = SkillData.Mining.Rocks[masteryID + 1]
time = 2
if rock ~= nil then
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
lvl = rock.levelRequired
end
xp = rock.baseExperience
if item.fletchingLevel ~= nil then
qty = rock.baseQuantity
skill = 'Fletching'
time = 3
lvl = item.fletchingLevel
if item.name == 'Dragonite Ore' then
xp = item.fletchingXP
specialReq = Icons.Icon({"Mastery", notext='true'})..' 271 total [[Mining]] [[Mastery]]'
req = item.fletchReq
end
qty = item.fletchQty
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, nil, specialReq))
time = 2
end
if item.name == 'Arrow Shafts' then
elseif skillID == SkillEnum.Smithing then
--Arrow Shafts get special (weird) treatment
-- Smithing
req = '1 of any [[Log]]'
local recipe = SkillData.Smithing.Recipes[masteryID + 1]
qty = '15 - 135'
if recipe ~= nil then
end
lvl = recipe.level
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
xp = recipe.baseXP
end
req = recipe.itemCosts
if item.cookingLevel ~= nil and item.recipeRequirements ~= nil then
qty = recipe.baseQuantity
for i, reqSet in pairs(item.recipeRequirements) do
time = 2
skill = 'Cooking'
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
lvl = item.cookingLevel
end
xp = item.cookingXP
elseif skillID == SkillEnum.Fletching then
req = reqSet
-- Fletching
qty = item.cookingQty
lvl = item.fletchingLevel
time = item.cookingInterval / 1000
xp = item.fletchingXP
if item.name == 'Arrow Shafts' then
--Arrow Shafts get special (weird) treatment
req = '1 of any [[Log]]'
qty = '15 - 135'
else
req = item.fletchReq
qty = item.fletchQty
end
time = 2
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
elseif skillID == SkillEnum.Crafting then
-- Crafting
lvl = item.craftingLevel
xp = item.craftingXP
req = item.craftReq
qty = item.craftQty
time = 3
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
elseif skillID == SkillEnum.Runecrafting then
-- Runecrafting
lvl = item.runecraftingLevel
xp = item.runecraftingXP
req = item.runecraftReq
qty = item.runecraftQty
time = 2
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
elseif skillID == SkillEnum.Herblore then
-- Herblore
local potion = SkillData.Herblore.Potions[masteryID + 1]
if potion ~= nil then
lvl = potion.level
xp = potion.baseXP
req = potion.itemCosts
qty = 1
time = 2
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
end
elseif skillID == SkillEnum.Summoning then
-- Summoning
lvl = item.summoningLevel
--Summoning uses a formula to calculate XP for creation instead of referring to the item's XP data directly
xp = (5 + 2 * math.floor(item.summoningLevel / 5))
local ShardCostArray = {}
for j, cost in Shared.skpairs(item.summoningReq[1]) do
if cost.id >= 0 then
local item = Items.getItemByID(cost.id)
if item.type == 'Shard' then
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 = math.max(item.sellsFor, 20)
table.insert(nonShardArray, Icons.Icon({item.name, type='item', notext=true, qty=math.max(1, math.floor(recipeGPCost / sellPrice))}))
end
elseif cost.id == -4 then
table.insert(nonShardArray, Icons.GP(recipeGPCost))
elseif cost.id == -5 then
table.insert(nonShardArray, Icons.SC(recipeGPCost))
end
end
table.insert(OtherCostArray, table.concat(nonShardArray, ', '))
end
req = req..table.concat(OtherCostArray, "<br/>'''OR''' ")
qty = item.summoningQty
time = 5
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
end
end
end
end
if item.herbloreReq ~= nil then
skill = 'Herblore'
req = item.herbloreReq
--Currently using 'masteryID' as shorthand to find details, could be a better method
local potionID = item.masteryID[2]
local potionData = SkillData.Herblore.ItemData[potionID + 1]
lvl = potionData.level
xp = potionData.herbloreXP
time = 2
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
end
if item.masteryID ~= nil and item.masteryID[1] == 4 then
skill = 'Mining'
lvl = SkillData.Mining.Rocks[item.masteryID[2] + 1].levelRequired
time = 3
xp = item.miningXP
--Rune Essence has double quantity, but that's a hard-coded thing in the game so it's hard-coded here
if item.name == 'Rune Essence' then qty = 2 else qty = 1 end


if item.name == 'Dragonite Ore' then
-- Woodcutting
specialReq = Icons.Icon({"Mastery", notext='true'})..' 271 total [[Mining]] [[Mastery]]'
if item.type == "Logs" then
-- Determine which tree (if any) the log is from
for i, tree in ipairs(SkillData.Woodcutting.Trees) do
if tree.logID == item.id then
skill = 'Woodcutting'
lvl = tree.levelRequired
time = tree.baseInterval / 1000
xp = tree.baseExperience
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
break
end
end
end
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, nil, specialReq))
end
if item.type == "Logs" then
--Well this feels like cheating, but for as long as logs are the first items by ID it works
local treeData = SkillData.Woodcutting.Trees[item.id + 1]
skill = 'Woodcutting'
lvl = treeData.level
time = treeData.interval / 1000
xp = treeData.xp
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
end
if item.fishingLevel ~= nil then
skill = 'Fishing'
lvl = item.fishingLevel
xp = item.fishingXP
time = item.minFishingInterval/1000
maxTime = item.maxFishingInterval/1000
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime))
end
end
--had to add cooking to the list of valid categories here to account for cherries/apples
--had to add cooking to the list of valid categories here to account for cherries/apples
if item.category == 'Cooking' or item.type == "Harvest" or item.type == "Herb" or item.type == "Logs" or Shared.contains(item.name, '(Perfect)') then
if item.category == 'Cooking' or item.type == "Harvest" or item.type == "Herb" or item.type == "Logs" or Shared.contains(item.name, '(Perfect)') then
Line 164: Line 219:
end
end
end
end
if item.summoningLevel ~= nil then
 
skill = 'Summoning'
-- Alt. Magic, excludes Gems and Bars
lvl = item.summoningLevel
-- Bars are handled by getItemSuperheatTable()
--Summoning uses a formula to calculate XP for creation instead of referring to the item's XP data directly
-- Gems are handled by _getItemLootSourceTable()
xp = (5 + 2 * math.floor(item.summoningLevel / 5))
-- TODO Should be able to iterate AltMagic.spells, checking the produces property
local ShardCostArray = {}
for j, cost in Shared.skpairs(item.summoningReq[1]) do
if cost.id >= 0 then
local item = Items.getItemByID(cost.id)
if item.type == 'Shard' then
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 = math.max(item.sellsFor, 20)
table.insert(nonShardArray, Icons.Icon({item.name, type='item', notext=true, qty=math.max(1, math.floor(recipeGPCost / sellPrice))}))
end
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
table.insert(OtherCostArray, table.concat(nonShardArray, ', '))
end
req = req..table.concat(OtherCostArray, "<br/>'''OR''' ")
qty = item.summoningQty
time = 5
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
end
--A couple special exceptions for Alt Magic
--Not Gems or Bars though since those have their own separate thing
if item.name == 'Rune Essence' then
if item.name == 'Rune Essence' then
table.insert(tables, p.buildAltMagicTable('Just Learning'))
table.insert(tables, p.buildAltMagicTable('Just Learning'))
Line 230: Line 246:
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Requirements')
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Requirements')
table.insert(resultPart, '\r\n|'..Icons._SkillReq('Magic', spell.level))
table.insert(resultPart, '\r\n|'..Icons._SkillReq('Magic', spell.level))
-- 1 means select any item. 0 would mean Superheat, but that's handled elsewhere
 
-- -1 means no item is needed, so hide this section
-- The produces property of Alt magic spells is as follows:
if spell.selectItem == 1 then
-- -3 = A random gem, using the same weights as Mining
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials')
-- -2 = A bar of the type being created (Superheat)
table.insert(resultPart, '\r\n|1 of any item')
-- -1 = GP (Alchemy)
--  0 = Undefined
-- >0 = Item ID of the item being produced
-- The amount produced is determined by the productionRatio property
 
-- The consumes property of Alt Magic spells is as follows:
-- 0 = Any item
-- 1 = Junk item
-- 2 = Superheat/ores with Coal
-- 3 = Superheat/ores without Coal
-- 4 = Nothing
-- 5 = Coal ore
-- Superheat (2, 3) is handled by _getItemSuperheatTable()
--
if spell.consumes ~= nil then
local consumeText = {
'1 of any item',
'1 of any [[Fishing#Junk|Junk]] item',
'1 x required ores for the chosen bar',
'1 x required ores (except ' .. Icons.Icon({'Coal Ore', type='item'}) .. ') for the chosen bar',
nil,
Icons.Icon({'Coal Ore', type='item', qty=1})
}
local consumeStr = consumeText[spell.consumes + 1]
if consumeStr ~= nil then
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Materials')
table.insert(resultPart, '\r\n| ' .. consumeStr)
end
end
end
--Add runes
--Add runes
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Runes\r\n|')
local formatRuneList = function(runes)
for i, req in pairs(spell.runesRequired) do
local runeList = {}
local rune = Items.getItemByID(req.id)
for i, req in ipairs(runes) do
if i > 1 then table.insert(resultPart, ', ') end
local rune = Items.getItemByID(req.id)
table.insert(resultPart, Icons.Icon({rune.name, type='item', notext=true, qty=req.qty}))
if rune ~= nil then
end
table.insert(runeList, Icons.Icon({rune.name, type='item', notext=true, qty=req.qty}))
if spell.runesRequiredAlt ~= nil and Shared.tableCount(spell.runesRequired) ~= Shared.tableCount(spell.runesRequiredAlt) then
end
table.insert(resultPart, "<br/>'''OR'''<br/>")
end
for i, req in pairs(spell.runesRequiredAlt) do
return table.concat(runeList, ', ')
local rune = Items.getItemByID(req.id)
if i > 1 then table.insert(resultPart, ', ') end
table.insert(resultPart, Icons.Icon({rune.name, type='item', notext=true, qty=req.qty}))
end
end
end
 
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Runes\r\n| ' .. Magic._getSpellRunes(spell))


--Now just need the output quantity, xp, and casting time (which is always 2)
--Now just need the output quantity, xp, and casting time (which is always 2)
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Base Quantity\r\n|'..spell.convertToQty)
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Base Quantity\r\n|'..spell.productionRatio)
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Base XP\r\n|'..spell.magicXP)
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Base XP\r\n|'..spell.baseExperience)
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Cast Time\r\n|2s')
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"|Cast Time\r\n|2s')
table.insert(resultPart, '\r\n|}')
table.insert(resultPart, '\r\n|}')
Line 360: Line 402:
end
end
end
end
-- Special exceptions for Fire/Infernal Cape and first two lore books
-- Special exceptions for lore books
if sourceOverrides['Dungeon'][item.id] ~= nil then
if sourceOverrides['Dungeon'][item.id] ~= nil then
table.insert(dungeonStrPart, Icons.Icon({sourceOverrides['Dungeon'][item.id], type='dungeon', notext=true}))
table.insert(dungeonStrPart, Icons.Icon({sourceOverrides['Dungeon'][item.id], type='dungeon', notext=true}))
Line 407: Line 449:
end
end
if item2.grownItemID == item.id then
if item2.grownItemID == item.id then
-- Farming
if string.len(growStr) > 0 then
if string.len(growStr) > 0 then
growStr = growStr..','..Icons.Icon({item2.name, type="item", notext="true"})
growStr = growStr..','..Icons.Icon({item2.name, type="item", notext="true"})
Line 415: Line 458:
end
end
if item2.perfectItem == item.id and item2.cookingLevel ~= nil then
if item2.perfectItem == item.id and item2.cookingLevel ~= nil then
-- Cooking (Perfect items)
table.insert(lineArray, Icons._SkillReq('Cooking', item2.cookingLevel))
table.insert(lineArray, Icons._SkillReq('Cooking', item2.cookingLevel))
end
end
Line 447: Line 491:
end
end


--SmithCheck:
-- Sources discoverable through mastery IDs
if item.smithingLevel ~= nil then
if type(item.masteryID) == 'table' then
table.insert(lineArray, Icons._SkillReq("Smithing", item.smithingLevel))
local skillID, masteryID = item.masteryID[1], item.masteryID[2]
local skill, levelReq = Constants.getSkillName(skillID), nil
if skillID == SkillEnum.Fishing then
-- Fishing (less Junk & Special items)
levelReq = item.fishingLevel
elseif skillID == SkillEnum.Cooking then
-- Cooking (less Perfect items)
levelReq = item.cookingLevel
elseif skillID == SkillEnum.Mining then
-- Mining
local rock = SkillData.Mining.Rocks[masteryID + 1]
if rock ~= nil then
levelReq = rock.levelRequired
end
elseif skillID == SkillEnum.Smithing then
-- Smithing
local recipe = SkillData.Smithing.Recipes[masteryID + 1]
if recipe ~= nil then
levelReq = recipe.level
end
elseif skillID == SkillEnum.Fletching then
-- Fletching
levelReq = item.fletchingLevel
elseif skillID == SkillEnum.Crafting then
-- Crafting
levelReq = item.craftingLevel
elseif skillID == SkillEnum.Runecrafting then
-- Runecrafting
levelReq = item.runecraftingLevel
elseif skillID == SkillEnum.Herblore then
-- Herblore
local potion = SkillData.Herblore.Potions[masteryID + 1]
if potion ~= nil then
levelReq = potion.level
end
elseif skillID == SkillEnum.Summoning then
-- Summoning
levelReq = item.summoningLevel
end
if levelReq ~= nil then
table.insert(lineArray, Icons._SkillReq(skill, levelReq))
end
end
end


--CraftCheck:
-- Woodcutting
if item.craftingLevel ~= nil then
for i, tree in ipairs(SkillData.Woodcutting.Trees) do
table.insert(lineArray, Icons._SkillReq("Crafting", item.craftingLevel))
if tree.logID == item.id then
end
table.insert(lineArray, Icons._SkillReq('Woodcutting', tree.levelRequired))
 
break
--FletchCheck:
end
if item.fletchingLevel ~= nil then
table.insert(lineArray, Icons._SkillReq("Fletching", item.fletchingLevel))
end
 
--RunecraftCheck:
if item.runecraftingLevel ~= nil then
table.insert(lineArray, Icons._SkillReq("Runecrafting", item.runecraftingLevel))
end
 
--CookCheck
if item.cookingLevel ~= nil and item.recipeRequirements ~= nil then
table.insert(lineArray, Icons._SkillReq('Cooking', item.cookingLevel))
end
end


--MineCheck:
-- Woodcutting (Nests)
if item.masteryID ~= nil and item.masteryID[1] == 4 then
if item.name == 'Bird Nest' then
table.insert(lineArray, Icons._SkillReq("Mining", SkillData.Mining.Rocks[item.masteryID[2] + 1].levelRequired))
table.insert(lineArray, Icons._SkillReq('Woodcutting', 1))
end
end


--FishCheck:
-- Fishing (Junk & Special items)
if (item.category == "Fishing" and (item.type == "Junk" or item.type == "Special")) then
if (item.category == "Fishing" and (item.type == "Junk" or item.type == "Special")) then
table.insert(lineArray, Icons.Icon({"Fishing", type='skill', notext=true})..' [[Fishing#'..item.type..'|'..item.type..']]')
table.insert(lineArray, Icons.Icon({"Fishing", type='skill', notext=true})..' [[Fishing#'..item.type..'|'..item.type..']]')
elseif item.fishingLevel ~= nil then
table.insert(lineArray, Icons._SkillReq("Fishing", item.fishingLevel))
end
--HerbCheck:
if item.masteryID ~= nil and item.masteryID[1] == 19 then
local potionData = SkillData.Herblore.ItemData[item.masteryID[2] + 1].level
table.insert(lineArray, Icons._SkillReq("Herblore", potionData))
end
--WoodcuttingCheck:
if item.type == 'Logs' then
local treeData = SkillData.Woodcutting.Trees[item.id + 1]
local lvl = treeData.level
table.insert(lineArray, Icons._SkillReq("Woodcutting", lvl))
end
--SummoningCheck:
if item.summoningLevel ~= nil then
table.insert(lineArray, Icons._SkillReq("Summoning", item.summoningLevel))
end
end


Line 831: Line 884:
function p._getItemSuperheatTable(item)
function p._getItemSuperheatTable(item)
--Manually build the Superheat Item table
--Manually build the Superheat Item table
local oreString = ''
-- Validate that the item can be superheated
local coalString = ''
local canSuperheat, smithRecipe = true, nil
for i, mat in pairs(item.smithReq) do
if type(item.masteryID) ~= 'table' then
canSuperheat = false
elseif item.masteryID[1] ~= SkillEnum.Smithing then
canSuperheat = false
else
smithRecipe = SkillData.Smithing.Recipes[item.masteryID[2] + 1]
if smithRecipe == nil or smithRecipe.category ~= 0 then
canSuperheat = false
end
end
if not canSuperheat then
return 'ERROR: The item "' .. item.name .. '" cannot be superheated[[Category:Pages with script errors]]'
end
 
local oreStringPart, coalString = {}, ''
for i, mat in ipairs(item.smithReq) do
local thisMat = Items.getItemByID(mat.id)
local thisMat = Items.getItemByID(mat.id)
if thisMat.name == 'Coal Ore' then
if thisMat.name == 'Coal Ore' then
coalString = ', '..Icons.Icon({thisMat.name, type='item', notext='true', qty=mat.qty})
coalString = Icons.Icon({thisMat.name, type='item', notext='true', qty=mat.qty})
else
else
if string.len(oreString) > 0 then oreString = oreString..', ' end
table.insert(oreStringPart, Icons.Icon({thisMat.name, type='item', notext='true', qty=mat.qty}))
oreString = oreString..Icons.Icon({thisMat.name, type='item', notext='true', qty=mat.qty})
end
end
end
end
Line 854: Line 921:
for i, sName in pairs(spellNames) do
for i, sName in pairs(spellNames) do
local spell = Magic.getSpell(sName, 'AltMagic')
local spell = Magic.getSpell(sName, 'AltMagic')
local rowPart = {}
table.insert(superheatTable, '\r\n|-\r\n|'..Icons.Icon({spell.name, type='spell', notext=true, size=50}))
table.insert(rowPart, '\r\n|-\r\n|'..Icons.Icon({spell.name, type='spell', notext=true, size=50}))
table.insert(superheatTable, '||'..Icons.Icon({spell.name, type='spell', noicon=true})..'||style="text-align:right;"|'..smithRecipe.level)
table.insert(rowPart, '||'..Icons.Icon({spell.name, type='spell', noicon=true})..'||style="text-align:right;"|'..item.smithingLevel)
table.insert(superheatTable, '||style="text-align:right;"|'..spell.level..'||style="text-align:right;"|'..spell.baseExperience)
table.insert(rowPart, '||style="text-align:right;"|'..spell.level..'||style="text-align:right;"|'..spell.magicXP..'||style="text-align:right;"|'..spell.convertToQty)
table.insert(superheatTable, '||style="text-align:right;"|'..spell.productionRatio)
table.insert(rowPart, '||'..oreString)
table.insert(superheatTable, '|| '..table.concat(oreStringPart, ', '))
if spell.ignoreCoal ~= nil and not spell.ignoreCoal then table.insert(rowPart, coalString) end
if spell.consumes == 2 then
table.insert(rowPart, '||style="text-align:center"|')
-- 2 = Superheat with coal, 3 = Superheat without coal
for i, req in pairs(spell.runesRequired) do
table.insert(superheatTable, (Shared.tableCount(oreStringPart) > 0 and ', ' or '') .. coalString)
local rune = Items.getItemByID(req.id)
if i > 1 then table.insert(rowPart, ', ') end
table.insert(rowPart, Icons.Icon({rune.name, type='item', notext=true, qty=req.qty}))
end
end
table.insert(rowPart, "<br/>'''OR'''<br/>")
table.insert(superheatTable, '||style="text-align:center"| ' .. Magic._getSpellRunes(spell))
for i, req in pairs(spell.runesRequiredAlt) do
local rune = Items.getItemByID(req.id)
if i > 1 then table.insert(rowPart, ', ') end
table.insert(rowPart, Icons.Icon({rune.name, type='item', notext=true, qty=req.qty}))
end
table.insert(superheatTable, table.concat(rowPart))
end
end
--Add the table end and add the table to the result string
--Add the table end and add the table to the result string
Line 909: Line 967:
end
end


if item.type == 'Bar' then
if type(item.masteryID) == 'table' and item.masteryID[1] == SkillEnum.Smithing then
table.insert(resultPart, '\r\n==='..Icons.Icon({'Alt Magic', type='skill'})..'===\r\n'..p._getItemSuperheatTable(item))
local recipe = SkillData.Smithing.Recipes[item.masteryID[2] + 1]
if recipe ~= nil and recipe.category == 0 then
table.insert(resultPart, '\r\n==='..Icons.Icon({'Alt Magic', type='skill'})..'===\r\n'..p._getItemSuperheatTable(item))
end
end
end