Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
_getItemSources: Support Cartography & Archaeology sources
(Okay I might (MIGHT!) have added archaeology dig site sources)
(_getItemSources: Support Cartography & Archaeology sources)
Line 1: Line 1:
local p = {}
local p = {}


local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
Line 43: Line 42:
['Summoning'] = { }
['Summoning'] = { }
}
}
}
}


-- Gathering skills
-- Gathering skills
Line 437: Line 436:
['Summoning'] = { }
['Summoning'] = { }
}
}
}
}


-- Gathering skills
-- Gathering skills
Line 499: Line 498:
if found then
if found then
break
break
end
end
-- Archaeology sources
-- Digsites
for i, digsite in ipairs(SkillData.Archaeology.digSites) do
local found = false
for artefactType, artefactItems in pairs(digsite.artefacts) do
for j, itemDef in ipairs(artefactItems) do
if itemDef.itemID == item.id then
table.insert(lineArray, Icons._SkillReq(SkillData.Archaeology.name, digsite.level))
found = true
break
end
end
if found then
break
end
end
if found then
break
end
end
-- Museum rewards
for i, museumReward in ipairs(SkillData.Archaeology.museumRewards) do
if type(museumReward.items) == 'table' and Shared.contains(museumReward.items, item.id) then
table.insert(lineArray, Icons.Icon('Museum'))
break
end
end
-- Cartography
-- Paper
for i, recipe in ipairs(SkillData.Cartography.paperRecipes) do
if recipe.productId == item.id then
table.insert(lineArray, Icons.Icon({SkillData.Cartography.name, type='skill'}))
break
end
end
-- POI discovery rewards
for i, worldMap in ipairs(SkillData.Cartography.worldMaps) do
local found = false
for j, poi in ipairs(worldMap.pointsOfInterest) do
if type(poi.discoveryRewards) == 'table' and type(poi.discoveryRewards.items) == 'table' then
for k, itemDef in ipairs(poi.discoveryRewards.items) do
if itemDef.id == item.id then
-- Find level for POI hex
local level = 1
local poiHex = nil
local skillID = SkillData.Cartography.skillID
for m, hex in ipairs(worldMap.hexes) do
if hex.coordinates.q == poi.coords.q and hex.coordinates.r == poi.coords.r then
for n, req in ipairs(hex.requirements) do
if req.type == 'SkillLevel' and req.skillID == skillID then
level = req.level
break
end
end
break
end
end
table.insert(lineArray, Icons._SkillReq(SkillData.Cartography.name, level))
found = true
break
end
end
if found then
break
end
end
end
if found then
break
end
end
-- Travel events
for i, event in ipairs(SkillData.Cartography.travelEvents) do
local found = false
if type(event.rewards) == 'table' and type(event.rewards.items) == 'table' then
for j, itemDef in ipairs(event.rewards.items) do
if itemDef.id == item.id and itemDef.quantity > 0 then
table.insert(lineArray, Icons.Icon({SkillData.Cartography.name, type='skill'}))
found = true
break
end
end
if found then
break
end
end
end
end
end
Line 559: Line 647:
end
end


--Finally there are some weird exceptions:
-- General rare drops for non-combat skills
--Rhaelyx pieces
-- Includes items like Circlet/Jewel of Rhaelyx, Mysterious stones, Signet ring half (a),
if Shared.contains({'Circlet of Rhaelyx', 'Jewel of Rhaelyx', 'Mysterious Stone'}, item.name) then
-- relics (for Ancient Relics mode)
local rhaSkills = {
local skillIconList, subText = {}, ''
Circlet = {'Woodcutting', 'Fishing', 'Mining', 'Thieving', 'Farming', 'Agility', 'Astrology'},
for i, skillDataAll in ipairs(GameData.rawData.skillData) do
Jewel = {'Firemaking', 'Cooking', 'Smithing', 'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Summoning'}
local skillData = skillDataAll.data
}
if type(skillData.rareDrops) == 'table' then
local rhaSkList, subText = nil, ''
for j, rareDrop in ipairs(skillData.rareDrops) do
if item.name == 'Circlet of Rhaelyx' then
local isAltItem = (rareDrop.altItemID ~= nil and rareDrop.altItemID == item.id)
rhaSkList = {rhaSkills.Circlet}
if isAltItem or rareDrop.itemID == item.id then
elseif item.name == 'Jewel of Rhaelyx' then
if Shared.tableIsEmpty(skillIconList) then
rhaSkList = {rhaSkills.Jewel}
-- Initialize subText
elseif item.name == 'Mysterious Stone' then
if isAltItem then
rhaSkList = {rhaSkills.Jewel, rhaSkills.Circlet}
local wornItem = Items.getItemByID(rareDrop.itemID)
subText = '<br/>after finding ' .. Icons.Icon({'Crown of Rhaelyx', type='item'})
subText = ' while wearing ' .. Icons.Icon({wornItem.name, type='item'})
elseif rareDrop.altItemID ~= nil then
-- There exists an alt item, but we are not searching for it
local altItem = Items.getItemByID(rareDrop.altItemID)
subText = ' if not worn (Instead of ' .. Icons.Icon({altItem.name, type='item'}) .. ')'
elseif rareDrop.itemID == 'melvorD:Mysterious_Stone' then
local foundItem = Items.getItemByID('melvorD:Crown_of_Rhaelyx')
subText = '<br/>after finding ' .. Icons.Icon({foundItem.name, type='item'})
end
if type(rareDrop.gamemodes) == 'table' then
local gamemodeText = {}
for k, gamemodeID in ipairs(rareDrop.gamemodes) do
local gamemode = GameData.getEntityByID('gamemodes', gamemodeID)
if gamemode ~= nil then
table.insert(gamemodeText, gamemode.name)
end
end
if not Shared.tableIsEmpty(gamemodeText) then
subText = subText .. '(' .. table.concat(gamemodeText, ', ') .. ' only)'
end
end
end
table.insert(skillIconList, Icons.Icon({skillData.name, type='skill', notext=true}))
end
end
end
end
end
if not Shared.tableIsEmpty(skillIconList) then
table.insert(lineArray, 'Any action in: ' .. table.concat(skillIconList, ', ') .. subText)
skillIconList, subText = {}, ''
end


local rhaStrPart = {}
-- Supplementary stuff on top of general rare drops
for i, skillList in ipairs(rhaSkList) do
if item.id == 'melvorD:Gold_Topaz_Ring' then
for j, skillName in ipairs(skillList) do
table.insert(lineArray, 'Killing any monster if not worn (Instead of '..Icons.Icon({"Signet Ring Half (b)", type="item"})..')')
table.insert(rhaStrPart, Icons.Icon({skillName, type='skill', notext=true}))
elseif item.id == 'melvorD:Signet_Ring_Half_B' then
end
table.insert(lineArray, 'Killing any monster while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'}))
end
elseif item.id == 'melvorTotH:Deadly_Toxins_Potion' then
table.insert(lineArray, 'Any action in: ' .. table.concat(rhaStrPart, ', ') .. subText)
--Adding a special override for Deadly Toxins potions
table.insert(lineArray, 'Brewing [[Lethal Toxins Potion]]s while wearing '..Icons.Icon({'Toxic Maker Gloves', type='item'}))
end
end


Line 612: Line 730:
if Shared.contains(Items.EventItems, item.name) then
if Shared.contains(Items.EventItems, item.name) then
table.insert(lineArray, '[[Events]]')
table.insert(lineArray, '[[Events]]')
end
--Gold Topaz Ring drops from any action (when not wearing a Gold Topaz Ring)
--Also handling Signet Ring things here
if item.id == 'melvorD:Gold_Topaz_Ring' then
table.insert(lineArray, 'Any non-combat action if not worn (Instead of '..Icons.Icon({"Signet Ring Half (a)", type="item"})..')')
table.insert(lineArray, 'Killing any monster if not worn (Instead of '..Icons.Icon({"Signet Ring Half (b)", type="item"})..')')
elseif item.id == 'melvorD:Signet_Ring_Half_A' then
table.insert(lineArray, 'Any non-combat action while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'}))
elseif item.id == 'melvorD:Signet_Ring_Half_B' then
table.insert(lineArray, 'Killing any monster while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'}))
elseif item.id == 'melvorTotH:Deadly_Toxins_Potion' then
--Adding a special override for Deadly Toxins potions
table.insert(lineArray, 'Brewing [[Lethal Toxins Potion]]s while wearing '..Icons.Icon({'Toxic Maker Gloves', type='item'}))
end
end


Line 956: Line 1,060:
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
table.insert(superheatTable, '\r\n|}')
table.insert(superheatTable, '\r\n|}')
return table.concat(superheatTable)
return table.concat(superheatTable)
Line 1,146: Line 1,250:
function p.test()
function p.test()
local checkItems = {
local checkItems = {
'Gold Bar',
"Circlet of Rhaelyx",
'Raw Shrimp',
"Jewel of Rhaelyx",
'Coal Ore',
"Signet Ring Half (a)",
'Rune Platebody',
"Signet Ring Half (b)",
'Arrow Shafts',
"Gold Topaz Ring",
'Yew Longbow',
"Astrology Lesser Relic",
'Water Rune',
"Mysterious Stone",
'Steam Rune',
"Gold Bar",
'Controlled Heat Potion II',
"Raw Shrimp",
'Wolf',
"Coal Ore",
'Cyclops',
"Rune Platebody",
'Leprechaun',
"Arrow Shafts",
'Redwood Logs',
"Yew Longbow",
'Carrot Cake',
"Water Rune",
'Carrot Cake (Perfect)',
"Steam Rune",
'Mantalyme Herb',
"Controlled Heat Potion II",
'Carrot',
"Wolf",
'Topaz',
"Cyclops",
'Rune Essence',
"Leprechaun",
'Sanguine Blade',
"Redwood Logs",
'Ring of Power',
"Carrot Cake",
'Infernal Claw',
"Carrot Cake (Perfect)",
'Chapeau Noir',
"Mantalyme Herb",
'Stardust',
"Carrot",
'Rope',
"Topaz",
'Ancient Ring of Mastery',
"Rune Essence",
'Mysterious Stone',
"Sanguine Blade",
'Mastery Token (Cooking)',
"Ring of Power",
'Gem Gloves',
"Infernal Claw",
"Chapeau Noir",
"Stardust",
"Rope",
"Ancient Ring of Mastery",
"Mastery Token (Cooking)",
"Gem Gloves",
"Thief's Moneysack",
"Thief's Moneysack",
"Golden Stardust",
"Golden Stardust",
"Golden Star",
"Golden Star",
"Slayer Deterer"
"Slayer Deterer",
"Paper",
"Lemon",
"Aranite Brush"
}
}
local checkFuncs = {
local checkFuncs = {