73
edits
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
local CombatAreas = require('Module:CombatAreas') | local CombatAreas = require('Module:CombatAreas') | ||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local Township = require('Module:Township') | |||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local SkillData = GameData.skillData | local SkillData = GameData.skillData | ||
-- This excludes certain checks pertinent to all skills, like equipment | |||
local SKILL_CHECK_MAP = { | local SKILL_CHECK_MAP = { | ||
['Attack'] = {}, | ['Attack'] = {}, | ||
Line 24: | Line 26: | ||
['Prayer'] = {'prayers'}, | ['Prayer'] = {'prayers'}, | ||
['Slayer'] = {'areas'}, | ['Slayer'] = {'areas'}, | ||
['Farming'] = {'gatheringitems'}, | ['Farming'] = {'gatheringitems', 'farmingplots'}, | ||
['Township'] = {}, | ['Township'] = {'townshipunlocks'}, | ||
['Woodcutting'] = {'gatheringitems'}, | ['Woodcutting'] = {'gatheringitems'}, | ||
['Fishing'] = {'gatheringitems'}, | ['Fishing'] = {'gatheringitems'}, | ||
Line 37: | Line 39: | ||
['Runecrafting'] = {'artisanitems'}, | ['Runecrafting'] = {'artisanitems'}, | ||
['Herblore'] = {'artisanitems'}, | ['Herblore'] = {'artisanitems'}, | ||
['Agility'] = {}, | ['Agility'] = {'agilityslots'}, | ||
['Summoning'] = {'artisanitems'}, | ['Summoning'] = {'artisanitems'}, | ||
['Astrology'] = {'constellations'}, | ['Astrology'] = {'constellations'}, | ||
Line 43: | Line 45: | ||
} | } | ||
local TYPE_SORT_ORDER = { | local TYPE_SORT_ORDER = { | ||
[' | ['special'] = 1, | ||
['spell'] = | ['biome'] = 2, | ||
['prayer'] = | ['building'] = 3, | ||
['gathering'] = | ['plot'] = 4, | ||
['artisan'] = | ['obstacleslot'] = 5, | ||
['item'] = | ['spell'] = 6, | ||
['combatArea'] = | ['prayer'] = 7, | ||
['slayerArea'] = | ['gathering'] = 8, | ||
['dungeon'] = | ['artisan'] = 9, | ||
['item'] = 10, | |||
['combatArea'] = 11, | |||
['slayerArea'] = 12, | |||
['dungeon'] = 13, | |||
['shop'] = 14, | |||
['trader'] = 15, | |||
['obstacle'] = 16 | |||
} | } | ||
local VERBS_PER_SUBTYPE = { | local VERBS_PER_SUBTYPE = { | ||
Line 93: | Line 102: | ||
['npc'] = 'Pickpocket', | ['npc'] = 'Pickpocket', | ||
['constellation'] = 'Study', | ['constellation'] = 'Study', | ||
['shop'] = 'Purchase' | ['shop'] = 'Purchase', | ||
['plot'] = 'New', | |||
['biome'] = 'Access', | |||
['basicBuilding'] = 'Build', | |||
['trader'] = 'Trade for', | |||
['obstacle'] = 'Build', | |||
['obstacleslot'] = 'Build', | |||
['pillar'] = 'Build' | |||
} | } | ||
local SUBTYPE_OVERRIDES = { | local SUBTYPE_OVERRIDES = { | ||
Line 800: | Line 816: | ||
['level'] = 40, | ['level'] = 40, | ||
['entities'] = {'Yew Longbow', 'Yew Shortbow'} | ['entities'] = {'Yew Longbow', 'Yew Shortbow'} | ||
}, | |||
{ | |||
['verb'] = 'Purchase', | |||
['name'] = 'Skill Hats', | |||
['level'] = 10, | |||
['entities'] = {'Blacksmiths Hat', 'Burning Mans Hat', 'Crafters Hat', 'Fishermans Hat', 'Fletchers Hat', 'Miners Hat', 'Performance Enhancing Hat', 'Potion Makers Hat', 'Runecrafters Hat', 'Star Gazing Hat', 'Woodcutters Hat'} | |||
}, | |||
{ | |||
['verb'] = 'Purchase', | |||
['name'] = 'Skill Bodies', | |||
['level'] = 20, | |||
['entities'] = {'Blacksmiths Body', 'Burning Mans Body', 'Crafters Body', 'Fishermans Body', 'Fletchers Body', 'Miners Body', 'Performance Enhancing Body', 'Potion Makers Body', 'Runecrafters Body', 'Star Gazing Body', 'Woodcutters Body'} | |||
}, | |||
{ | |||
['verb'] = 'Purchase', | |||
['name'] = 'Skill Leggings', | |||
['level'] = 40, | |||
['entities'] = {'Blacksmiths Leggings', 'Burning Mans Leggings', 'Crafters Leggings', 'Fishermans Leggings', 'Fletchers Leggings', 'Miners Leggings', 'Performance Enhancing Leggings', 'Potion Makers Leggings', 'Runecrafters Leggings', 'Star Gazing Leggings', 'Woodcutters Leggings'} | |||
}, | |||
{ | |||
['verb'] = 'Purchase', | |||
['name'] = 'Skill Boots', | |||
['level'] = 60, | |||
['entities'] = {'Blacksmiths Boots', 'Burning Mans Boots', 'Crafters Boots', 'Fishermans Boots', 'Fletchers Boots', 'Miners Boots', 'Performance Enhancing Boots', 'Potion Makers Boots', 'Runecrafters Boots', 'Star Gazing Boots', 'Woodcutters Boots'} | |||
} | } | ||
} | } | ||
Line 907: | Line 947: | ||
end) | end) | ||
-- TODO: Squeeze this into _addEntities | -- TODO: Squeeze this into _addEntities? | ||
for i, item in ipairs(itemList) do | for i, item in ipairs(itemList) do | ||
local processed = {} | local processed = {} | ||
Line 967: | Line 1,007: | ||
if purchase.category ~= 'melvorD:Skillcapes' and purchase.category ~= 'melvorTotH:SuperiorSkillcapes' then | if purchase.category ~= 'melvorD:Skillcapes' and purchase.category ~= 'melvorTotH:SuperiorSkillcapes' then | ||
local processed = {} | local processed = {} | ||
processed.entity = purchase | |||
processed.entityName = Shop._getPurchaseName(purchase) | processed.entityName = Shop._getPurchaseName(purchase) | ||
processed.entityType = 'shop' | processed.entityType = 'shop' | ||
processed.subType = purchase | processed.subType = Shop._getPurchaseType(purchase) | ||
for a, req in ipairs(purchase.purchaseRequirements) do | for a, req in ipairs(purchase.purchaseRequirements) do | ||
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | ||
Line 977: | Line 1,018: | ||
processed.otherReqs = p._getOtherSkillReqs(purchase.purchaseRequirements, skillName) | processed.otherReqs = p._getOtherSkillReqs(purchase.purchaseRequirements, skillName) | ||
table.insert(entityList, processed) | table.insert(entityList, processed) | ||
end | |||
end | |||
return entityList | |||
end | |||
function p._addTraderItemsWithSkillRequirements(entityList, skillName) | |||
-- Iterate over each tradable resource, then each item you can get with it | |||
for i, tsResource in ipairs(Township.Township.itemConversions.fromTownship) do | |||
for j, tsPurchase in ipairs(tsResource.items) do | |||
-- Does this purchase require the current skill? | |||
local hasCurrentSkill = false | |||
local currentSkillLevel = 0 | |||
for k, req in ipairs(tsPurchase.unlockRequirements) do | |||
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | |||
hasCurrentSkill = true | |||
currentSkillLevel = req.level | |||
end | |||
end | |||
if hasCurrentSkill then | |||
local item = Items.getItemByID(tsPurchase.itemID) | |||
local processed = {} | |||
processed.entity = item | |||
processed.entityName = item.name | |||
processed.entityType = 'trader' | |||
processed.subType = 'trader' | |||
processed.skillLevel = currentSkillLevel | |||
processed.otherReqs = p._getOtherSkillReqs(tsPurchase.unlockRequirements, skillName) | |||
table.insert(entityList, processed) | |||
end | |||
end | |||
end | |||
return entityList | |||
end | |||
function p._addAgilityObstaclesWithSkillRequirements(entityList, skillName) | |||
for i, obstacle in ipairs(SkillData.Agility.obstacles) do | |||
for j, req in ipairs(obstacle.skillRequirements) do | |||
-- Does this obstacle require the current skill? | |||
local hasCurrentSkill = false | |||
local currentSkillLevel = 0 | |||
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | |||
hasCurrentSkill = true | |||
currentSkillLevel = req.level | |||
end | |||
if hasCurrentSkill then | |||
local processed = {} | |||
processed.entity = obstacle | |||
processed.entityName = obstacle.name | |||
processed.entityType = 'obstacle' | |||
-- Category is zero-indexed | |||
processed.subType = 'Obstacle ' .. tostring(obstacle.category + 1) | |||
processed.skillLevel = currentSkillLevel | |||
processed.otherReqs = p._getOtherSkillReqs(obstacle.skillRequirements, skillName) | |||
table.insert(entityList, processed) | |||
end | |||
end | end | ||
end | end | ||
Line 1,027: | Line 1,128: | ||
function p._addConstellations(entityList, skillName) | function p._addConstellations(entityList, skillName) | ||
entityList = p._addEntities({entityList, SkillData.Astrology.recipes, type='constellation', subType='constellation'}) | entityList = p._addEntities({entityList, SkillData.Astrology.recipes, type='constellation', subType='constellation'}) | ||
return entityList | |||
end | |||
function p._addFarmingPlots(entityList, skillName) | |||
for i, plot in ipairs(SkillData.Farming.plots) do | |||
local plotName = 'Unknown Plot' | |||
if plot.categoryID == 'melvorD:Allotment' then | |||
plotName = 'Allotment Plot' | |||
elseif plot.categoryID == 'melvorD:Herb' then | |||
plotName = 'Herb Plot' | |||
elseif plot.categoryID == 'melvorD:Tree' then | |||
plotName = 'Tree Plot' | |||
end | |||
local processed = {} | |||
processed.entityName = plotName | |||
processed.entityType = 'plot' | |||
processed.subType = plot.categoryID | |||
processed.skillLevel = plot.level | |||
processed.otherReqs = {} | |||
table.insert(entityList, processed) | |||
end | |||
return entityList | |||
end | |||
function p._addTownshipUnlocks(entityList, skillName) | |||
-- This one is weird, because some of the data uses tiers and not levels | |||
-- Add all of the biomes | |||
for i, biome in ipairs(Township.Township.biomes) do | |||
local tierReqs = Township._getTierRequirements(biome.tier) | |||
local processed = {} | |||
processed.entityName = biome.name | |||
processed.entityType = 'biome' | |||
processed.subType = 'biome' | |||
processed.skillLevel = tierReqs.level | |||
processed.otherReqs = {['population'] = tierReqs.population} | |||
table.insert(entityList, processed) | |||
end | |||
-- Add all of the buildings | |||
for i, building in ipairs(Township.Township.buildings) do | |||
local tierReqs = Township._getTierRequirements(building.tier) | |||
local processed = {} | |||
processed.entityName = building.name == 'Statues' and 'Statue of Worship' or building.name | |||
processed.entityType = 'building' | |||
processed.subType = building.upgradesFrom ~= nil and 'upgradedBuilding' or 'basicBuilding' | |||
processed.upgradesFrom = Township._getBuildingDowngrade(building) | |||
processed.skillLevel = tierReqs.level | |||
processed.otherReqs = {['population'] = tierReqs.population} | |||
table.insert(entityList, processed) | |||
end | |||
-- Add the fact that health starts decreasing at level 15 | |||
local specialHealth = { | |||
['entityType'] = 'special', | |||
['subType'] = 'special', | |||
['skillLevel'] = 15, | |||
['overrideText'] = 'Township health has a 25% chance to decrease by 1% per update' | |||
} | |||
table.insert(entityList, specialHealth) | |||
return entityList | |||
end | |||
function p._addAgilityObstacleSlotsAndPillars(entityList, skillName) | |||
for i, level in ipairs(SkillData.Agility.obstacleUnlockLevels) do | |||
local processed = {} | |||
processed.entityName = 'Obstacle ' .. i | |||
processed.entityType = 'obstacleslot' | |||
processed.subType = 'obstacleslot' | |||
processed.skillLevel = level | |||
processed.otherReqs = {} | |||
table.insert(entityList, processed) | |||
end | |||
-- Manually add pillars | |||
table.insert(entityList, {['entityName'] = 'Passive Pillars', ['entityType'] = 'obstacleslot', ['subType'] = 'pillar', ['skillLevel'] = 99, ['otherReqs'] = {}}) | |||
table.insert(entityList, {['entityName'] = 'Elite Passive Pillars', ['entityType'] = 'obstacleslot', ['subType'] = 'pillar', ['skillLevel'] = 120, ['otherReqs'] = {}}) | |||
return entityList | return entityList | ||
end | end | ||
Line 1,111: | Line 1,292: | ||
['thieving'] = p._addThievingTargets, | ['thieving'] = p._addThievingTargets, | ||
['constellations'] = p._addConstellations, | ['constellations'] = p._addConstellations, | ||
['shop'] = p._addShopPurchasesWithSkillRequirements | ['shop'] = p._addShopPurchasesWithSkillRequirements, | ||
['farmingplots'] = p._addFarmingPlots, | |||
['townshipunlocks'] = p._addTownshipUnlocks, | |||
['agilityslots'] = p._addAgilityObstacleSlotsAndPillars | |||
} | } | ||
Line 1,126: | Line 1,310: | ||
for i, req in ipairs(entity.otherReqs) do | for i, req in ipairs(entity.otherReqs) do | ||
-- TODO: "Completion" requirement | -- TODO: "Completion" requirement | ||
-- TODO: Township buildings requirement | |||
if req.type == 'SkillLevel' then | if req.type == 'SkillLevel' then | ||
local skillInfo = Icons.Icon({Constants.getSkillName(req.skillID), type='skill', notext='true'}) .. ' ' .. req.level | local skillInfo = Icons.Icon({Constants.getSkillName(req.skillID), type='skill', notext='true'}) .. ' ' .. req.level | ||
Line 1,163: | Line 1,348: | ||
function p._prepareSingleEntity(entity, skillName) | function p._prepareSingleEntity(entity, skillName) | ||
-- | -- Special children that need extra attention | ||
if entity.overrideText then | |||
return entity.overrideText | |||
end | |||
if skillName == 'Farming' and entity.seed then | if skillName == 'Farming' and entity.seed then | ||
return 'Plant ' .. Icons.Icon({entity.seed.name, type='item'}) .. ' to grow ' .. Icons.Icon({entity.entityName, type='item'}) | return 'Plant ' .. Icons.Icon({entity.seed.name, type='item'}) .. ' to grow ' .. Icons.Icon({entity.entityName, type='item'}) | ||
end | |||
if skillName == 'Township' and entity.upgradesFrom then | |||
return 'Upgrade ' .. Icons.Icon({entity.upgradesFrom.name, type='building'}) .. ' to ' .. Icons.Icon({entity.entityName, type='building'}) | |||
end | |||
-- What are you doing with the thing you unlock? ("verbs") | -- What are you doing with the thing you unlock? ("verbs") | ||
Line 1,178: | Line 1,369: | ||
-- Icon overrides | -- Icon overrides | ||
local iconType = entity.entityType | local iconType = entity.entityType | ||
local | local iconLink = entity.entityName | ||
local iconText = entity.entityName | |||
local iconImg = entity.entityName | |||
local noLink = '' | |||
if entity.entityType == 'slayerArea' then | if entity.entityType == 'slayerArea' then | ||
iconType = 'combatArea' | iconType = 'combatArea' | ||
Line 1,193: | Line 1,387: | ||
iconType = entity.subType | iconType = entity.subType | ||
end | end | ||
iconLink = entity.item.name | |||
end | end | ||
if entity.entityType == 'artisan' then | if entity.entityType == 'artisan' or entity.entityType == 'trader' then | ||
iconType = 'item' | iconType = 'item' | ||
end | |||
if entity.entityType == 'shop' then | |||
iconType = entity.entity.contains.petID and 'pet' or 'item' | |||
end | |||
if entity.entityType == 'plot' then | |||
iconType = 'skill' | |||
iconLink = 'Farming' | |||
iconImg = 'Farming' | |||
noLink = 'true' | |||
end | |||
if entity.entityType == 'obstacle' then | |||
iconType = 'agility' | |||
iconLink = 'Obstacles' | |||
end | |||
if entity.entityType == 'obstacleslot' then | |||
iconType = 'agility' | |||
iconLink = 'Passive_Pillars' | |||
end | end | ||
-- Any other requirements? | -- Any other requirements or post-scripts? | ||
local extraReqs = p._prepareOtherReqs(entity) | local extraReqs = p._prepareOtherReqs(entity) | ||
local extraPost = '' | |||
if entity.entityType == 'obstacle' then | |||
extraPost = ' in ' .. entity.subType | |||
end | |||
return verb .. Icons.Icon({ | return verb .. Icons.Icon({iconLink, iconText, img=iconImg, type=iconType, nolink=noLink}) .. extraPost .. extraReqs | ||
end | end | ||
Line 1,228: | Line 1,443: | ||
entityList = p._addItemsWithSkillRequirement(entityList, skillName) | entityList = p._addItemsWithSkillRequirement(entityList, skillName) | ||
entityList = p._addShopPurchasesWithSkillRequirements(entityList, skillName) | entityList = p._addShopPurchasesWithSkillRequirements(entityList, skillName) | ||
entityList = p._addTraderItemsWithSkillRequirements(entityList, skillName) | |||
entityList = p._addAgilityObstaclesWithSkillRequirements(entityList, skillName) | |||
-- Now loop through the stuff relevant to this skill | |||
for i, dataSource in ipairs(SKILL_CHECK_MAP[skillName]) do | for i, dataSource in ipairs(SKILL_CHECK_MAP[skillName]) do | ||
entityList = SOURCE_FUNCS[dataSource](entityList, skillName) | entityList = SOURCE_FUNCS[dataSource](entityList, skillName) | ||
Line 1,274: | Line 1,493: | ||
-- Skip this one if it's in a gear set we've already listed | -- Skip this one if it's in a gear set we've already listed | ||
local entityGearSet = nil | local entityGearSet = nil | ||
if entity.entityType == 'item' then | if entity.entityType == 'item' or entity.entityType == 'shop' then | ||
for i, gearSet in ipairs(GEAR_SETS) do | for i, gearSet in ipairs(GEAR_SETS) do | ||
if Shared.contains(gearSet.entities, entity.entityName) then | if Shared.contains(gearSet.entities, entity.entityName) then |
edits