Anonymous

Module:SkillUnlocks: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 29: Line 29:
['Fishing'] = {'gathering'},
['Fishing'] = {'gathering'},
['Firemaking'] = {},
['Firemaking'] = {},
['Cooking'] = {},
['Cooking'] = {'artisan'},
['Mining'] = {'gathering'},
['Mining'] = {'gathering'},
['Smithing'] = {},
['Smithing'] = {'artisan'},
['Thieving'] = {},
['Thieving'] = {'artisan'},
['Fletching'] = {},
['Fletching'] = {'artisan'},
['Crafting'] = {},
['Crafting'] = {'artisan'},
['Runecrafting'] = {},
['Runecrafting'] = {'artisan'},
['Herblore'] = {},
['Herblore'] = {'artisan'},
['Agility'] = {},
['Agility'] = {},
['Summoning'] = {},
['Summoning'] = {'artisan'},
['Astrology'] = {},
['Astrology'] = {},
['Alt. Magic'] = {'altmagic'},
['Alt. Magic'] = {'altmagic'},
Line 46: Line 46:
['prayer'] = 2,
['prayer'] = 2,
['gathering'] = 3,
['gathering'] = 3,
['item'] = 4,  
['artisan'] = 4,
['combatArea'] = 5,
['item'] = 5,  
['slayerArea'] = 6,
['combatArea'] = 6,
['dungeon'] = 7
['slayerArea'] = 7,
['dungeon'] = 8
}
}
local VERBS_PER_SUBTYPE = {
local VERBS_PER_SUBTYPE = {
Line 80: Line 81:
['Essence'] = 'Mine',
['Essence'] = 'Mine',
['Ore'] = 'Mine',
['Ore'] = 'Mine',
['Gem'] = 'Mine'
['Gem'] = 'Mine',
['artisan'] = 'Create',
['melvorD:Fire'] = 'Cook',
['melvorD:Furnace'] = 'Bake',
['melvorD:Pot'] = 'Boil',
['melvorD:Bars'] = 'Smelt',
['melvorF:SkillPotions'] = 'Brew',
['melvorF:CombatPotions'] = 'Brew'
}
}
local SUBTYPE_OVERRIDES = {
local SUBTYPE_OVERRIDES = {
Line 97: Line 105:
['Spectral Ice Sword'] = 'Weapon',
['Spectral Ice Sword'] = 'Weapon',
['Torrential Blast Crossbow'] = 'Ranged Weapon'
['Torrential Blast Crossbow'] = 'Ranged Weapon'
}
local SUBTYPE_SORT_OVERRIDES = {
['melvorF:StandardRunes'] = '1'
}
}
local GEAR_SETS = {
local GEAR_SETS = {
Line 797: Line 808:
local otherReqs = {}
local otherReqs = {}
for i, req in ipairs(reqList) do
for i, req in ipairs(reqList) do
if req.type ~= 'SkillLevel' or req.skillID ~= Constants.getSkillID(skillName) then
if req.type ~= 'SkillLevel' or (req.skillID ~= Constants.getSkillID(skillName) and req.level ~= 1) then
table.insert(otherReqs, req)
table.insert(otherReqs, req)
end
end
Line 1,004: Line 1,015:
processed.skillLevel = entity.level
processed.skillLevel = entity.level
processed.otherReqs = p._getGatherableReqs(entity.node, skillName)
processed.otherReqs = p._getGatherableReqs(entity.node, skillName)
table.insert(entityList, processed)
end
return entityList
end
function p._addRecipesWithSkillRequirement(entityList, skillName)
-- Figure out what to look up based on the skill
local sourceData = SkillData[skillName].recipes
local processedData = {}
local sameRecipeAndProduct = false
if skillName == 'Herblore' then
sameRecipeAndProduct = true
end
for i, recipe in ipairs(sourceData) do
local product = recipe
if not sameRecipeAndProduct then
product = Items.getItemByID(recipe.productID)
end
local processedItem = {
['name'] = product.name,
['level'] = recipe.level,
['recipe'] = recipe,
['item'] = product
}
table.insert(processedData, processedItem)
end
for i, entity in ipairs(processedData) do
local processed = {}
processed.entity = entity
processed.item = entity.item
processed.entityName = entity.name
processed.entityType = 'artisan'
processed.subType = entity.recipe.categoryID
processed.skillLevel = entity.level
--processed.otherReqs = p._getGatherableReqs(entity.node, skillName)
table.insert(entityList, processed)
table.insert(entityList, processed)
end
end
Line 1,015: Line 1,064:
['altmagic'] = p._addAltMagicWithSkillRequirement,
['altmagic'] = p._addAltMagicWithSkillRequirement,
['prayers'] = p._addPrayersWithSkillRequirement,
['prayers'] = p._addPrayersWithSkillRequirement,
['gathering'] = p._addGatherablesWithSkillRequirement
['gathering'] = p._addGatherablesWithSkillRequirement,
['artisan'] = p._addRecipesWithSkillRequirement
}
}


Line 1,071: Line 1,121:
if VERBS_PER_SUBTYPE[entity.subType] then
if VERBS_PER_SUBTYPE[entity.subType] then
verb = VERBS_PER_SUBTYPE[entity.subType] .. ' '
verb = VERBS_PER_SUBTYPE[entity.subType] .. ' '
elseif VERBS_PER_SUBTYPE[entity.entityType] then
verb = VERBS_PER_SUBTYPE[entity.entityType] .. ' '
end
end
Line 1,091: Line 1,143:
end
end
iconName = entity.item.name
iconName = entity.item.name
end
if entity.entityType == 'artisan' then
iconType = 'item'
end
end
Line 1,132: Line 1,187:
-- Sort the big list of everything
-- Sort the big list of everything
table.sort(entityList, function(a, b)  
table.sort(entityList, function(a, b)
local aSubTypeSort = a.subType
if SUBTYPE_SORT_OVERRIDES[a.subType] then
aSubTypeSort = SUBTYPE_SORT_OVERRIDES[a.subType]
end
local bSubTypeSort = b.subType
if SUBTYPE_SORT_OVERRIDES[b.subType] then
bSubTypeSort = SUBTYPE_SORT_OVERRIDES[b.subType]
end
-- Sort by level first
-- Sort by level first
if a.skillLevel ~= b.skillLevel then
if a.skillLevel ~= b.skillLevel then
Line 1,140: Line 1,203:
return TYPE_SORT_ORDER[a.entityType] < TYPE_SORT_ORDER[b.entityType]
return TYPE_SORT_ORDER[a.entityType] < TYPE_SORT_ORDER[b.entityType]
    -- Then by subtype
    -- Then by subtype
elseif a.subType ~= b.subType then
elseif aSubTypeSort ~= bSubTypeSort then
     return a.subType < b.subType
     return aSubTypeSort < bSubTypeSort
-- And finally by name
-- And finally by name
else
else
73

edits