17,105
edits
Falterfire (talk | contribs) (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 | ||
-- | -- General rare drops for non-combat skills | ||
--Rhaelyx | -- Includes items like Circlet/Jewel of Rhaelyx, Mysterious stones, Signet ring half (a), | ||
-- relics (for Ancient Relics mode) | |||
local skillIconList, subText = {}, '' | |||
for i, skillDataAll in ipairs(GameData.rawData.skillData) do | |||
local skillData = skillDataAll.data | |||
if type(skillData.rareDrops) == 'table' then | |||
for j, rareDrop in ipairs(skillData.rareDrops) do | |||
local isAltItem = (rareDrop.altItemID ~= nil and rareDrop.altItemID == item.id) | |||
if isAltItem or rareDrop.itemID == item.id then | |||
if Shared.tableIsEmpty(skillIconList) then | |||
-- Initialize subText | |||
if isAltItem then | |||
local wornItem = Items.getItemByID(rareDrop.itemID) | |||
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 | |||
-- Supplementary stuff on top of general rare drops | |||
if item.id == 'melvorD:Gold_Topaz_Ring' then | |||
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_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 | |||
table.insert(lineArray, ' | --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 | end | ||
Line 956: | Line 1,060: | ||
end | end | ||
--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 = { | ||
"Circlet of Rhaelyx", | |||
"Jewel of Rhaelyx", | |||
"Signet Ring Half (a)", | |||
"Signet Ring Half (b)", | |||
"Gold Topaz Ring", | |||
"Astrology Lesser Relic", | |||
"Mysterious Stone", | |||
"Gold Bar", | |||
"Raw Shrimp", | |||
"Coal Ore", | |||
"Rune Platebody", | |||
"Arrow Shafts", | |||
"Yew Longbow", | |||
"Water Rune", | |||
"Steam Rune", | |||
"Controlled Heat Potion II", | |||
"Wolf", | |||
"Cyclops", | |||
"Leprechaun", | |||
"Redwood Logs", | |||
"Carrot Cake", | |||
"Carrot Cake (Perfect)", | |||
"Mantalyme Herb", | |||
"Carrot", | |||
"Topaz", | |||
"Rune Essence", | |||
"Sanguine Blade", | |||
"Ring of Power", | |||
"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 = { |