5,003
edits
(Fix getAllModifiers()) |
(Add Mastery Pool Bonuses to Modifier Tables) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Common = require('Module:Common') | local Common = require('Module:Common') | ||
local Num = require('Module:Number') | |||
local Icons = require('Module:Icons') | |||
local GameData = require('Module:GameData') | |||
local SkillData = GameData.skillData | |||
local Modifiers = require('Module:Modifiers') | local Modifiers = require('Module:Modifiers') | ||
local SkillTree = require('Module:SkillTree') | |||
local Items = require('Module:Items') | |||
local Shop = require('Module:Shop') | |||
local Pets = require('Module:Pets') | local Pets = require('Module:Pets') | ||
local Skills = require('Module:Skills') | local Skills = require('Module:Skills') | ||
local Agility = require('Module:Skills/Agility') | local Agility = require('Module:Skills/Agility') | ||
local Cartography = require('Module:Skills/Cartography') | |||
local Prayer = require('Module:Prayer') | local Prayer = require('Module:Prayer') | ||
local | local Summoning = require('Module:Skills/Summoning') | ||
local Township = require('Module:Township') | |||
local | |||
--First up, functions to get all the things in a category that have a given modifier: | --First up, functions to get all the things in a category that have a given modifier: | ||
Line 32: | Line 37: | ||
end) | end) | ||
return itemList | return itemList | ||
end | |||
function p.getSkillTreeNodesWithModifier(modifierCriteria) | |||
local nodesWithModifier = SkillTree.getSkillTreeNodes( | |||
function(node) | |||
if node.modifiers ~= nil then | |||
local mods = Modifiers.getMatchingModifiers(node.modifiers, modifierCriteria) | |||
if not Shared.tableIsEmpty(mods.matched) then | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
) | |||
return nodesWithModifier | |||
end | end | ||
Line 152: | Line 172: | ||
return bonusList | return bonusList | ||
end | |||
function p.getAncientRelicsWithModifiers(modifierCriteria) | |||
local matchedRelics = {} | |||
for i, relic in ipairs(GameData.rawData.ancientRelics) do | |||
if relic.modifiers ~= nil then | |||
local mods = Modifiers.getMatchingModifiers(relic.modifiers, modifierCriteria) | |||
if not Shared.tableIsEmpty(mods.matched) then | |||
table.insert(matchedRelics, relic) | |||
end | |||
end | |||
end | |||
return matchedRelics | |||
end | |||
function p.getBuildingsWithModifiers(modifierCriteria) | |||
local buildingList = Township.getBuildings( | |||
function(building) | |||
if building.modifiers == nil or Shared.tableIsEmpty(building.modifiers) then | |||
return false | |||
end | |||
local mods = Modifiers.getMatchingModifiers(building.modifiers, modifierCriteria) | |||
return not Shared.tableIsEmpty(mods.matched) | |||
end) | |||
return buildingList | |||
end | |||
function p.getSeasonsWithModifiers(modifierCriteria) | |||
local seasonList = Township.getSeasons( | |||
function(season) | |||
if season.modifiers == nil or Shared.tableIsEmpty(season.modifiers) then | |||
return false | |||
end | |||
local mods = Modifiers.getMatchingModifiers(season.modifiers, modifierCriteria) | |||
return not Shared.tableIsEmpty(mods.matched) | |||
end) | |||
return seasonList | |||
end | |||
function p.getSummoningSynergiesWithModifiers(modifierCriteria) | |||
local synergyList = Summoning.getSynergies( | |||
function(synergy) | |||
if synergy.modifiers == nil or Shared.tableIsEmpty(synergy.modifiers) then | |||
return false | |||
end | |||
local mods = Modifiers.getMatchingModifiers(synergy.modifiers, modifierCriteria) | |||
return not Shared.tableIsEmpty(mods.matched) | |||
end) | |||
return synergyList | |||
end | |||
function p.getMasteryPoolModifiers(modifierCriteria) | |||
local masteryPoolList = {} | |||
for skillName, skillData in pairs(SkillData) do | |||
if skillData.masteryPoolBonuses ~= nil then | |||
for i, masteryPool in ipairs(skillData.masteryPoolBonuses) do | |||
local mods = Modifiers.getMatchingModifiers(masteryPool.modifiers, modifierCriteria) | |||
if not Shared.tableIsEmpty(mods.matched) then | |||
table.insert(masteryPoolList, { [skillName] = masteryPool }) | |||
end | |||
end | |||
end | |||
end | |||
return masteryPoolList | |||
end | end | ||
Line 274: | Line 365: | ||
table.insert(tableArray, row) | table.insert(tableArray, row) | ||
end | |||
local nodeList = p.getSkillTreeNodesWithModifier(modifierCriteria) | |||
for _, node in ipairs(nodeList) do | |||
local row = {} | |||
row.name = node.skillName .. " - " .. node.name | |||
local firstIcon = Icons.Icon({"", img='Skill Tree', nolink=true}) | |||
local secondIcon = Icons.Icon({node.skillName..'%23#Skill_Tree', node.name, type='skill', img=node.skillName}) | |||
row.icon = firstIcon .. " " .. secondIcon | |||
row.expIcon = Icons.getDLCColumnIcon(node.id) | |||
row.expSort = Icons.getExpansionID(node.id) | |||
row.type = '[[Skill Tree#Nodes|Skill Tree Node]]' | |||
row.typeText = 'Skill Tree Node' | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(node.modifiers) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | end | ||
local obstList = p.getObstaclesWithModifier(modifierCriteria) | local obstList = p.getObstaclesWithModifier(modifierCriteria) | ||
Line 441: | Line 558: | ||
table.insert(tableArray, row) | table.insert(tableArray, row) | ||
end | |||
local ancientRelicList = p.getAncientRelicsWithModifiers(modifierCriteria) | |||
for i, relic in ipairs(ancientRelicList) do | |||
local row = {} | |||
local relicName = relic.name | |||
local sectionName = 'Melvor Realm' | |||
if string.find(relic.id, 'Abyssal') ~= nil then | |||
relicName = 'Abyssal ' .. relicName | |||
sectionName = 'Abyssal Realm' | |||
end | |||
row.name = relicName | |||
row.icon = Icons.Icon({'Ancient Relics', relicName, section=sectionName}) | |||
row.expIcon = Icons.getDLCColumnIcon(relic.id) | |||
row.expSort = Icons.getExpansionID(relic.id) | |||
row.type = Icons.Icon({'Ancient Relics', 'Ancient Relic', noicon=true}) | |||
row.typeText = 'Ancient Relic' | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(relic.modifiers) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
local buildingList = p.getBuildingsWithModifiers(modifierCriteria) | |||
for i, building in ipairs(buildingList) do | |||
local row = {} | |||
row.name = building.name | |||
row.icon = Icons.Icon({building.name, type='building'}) | |||
row.expIcon = Icons.getDLCColumnIcon(building.id) | |||
row.expSort = Icons.getExpansionID(building.id) | |||
row.type = Icons.Icon({'Township', 'Building', section='Buildings', type='skill', noicon=true}) | |||
row.typeText = 'Building' | |||
local modList = {} | |||
-- Multiply mod value by max upgrades to get the total modifier value | |||
for modID, value in pairs(building.modifiers) do | |||
if type(value) == 'table' then | |||
modList[modID] = value[1].value * building.maxUpgrades | |||
else | |||
modList[modID] = value * building.maxUpgrades | |||
end | |||
end | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(modList) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
local seasonList = p.getSeasonsWithModifiers(modifierCriteria) | |||
for i, season in ipairs(seasonList) do | |||
local row = {} | |||
row.name = season.name | |||
row.icon = Icons.Icon({season.name, type='township'}) | |||
row.expIcon = Icons.getDLCColumnIcon(season.id) | |||
row.expSort = Icons.getExpansionID(season.id) | |||
row.type = Icons.Icon({'Township', 'Season', section='Seasons', type='skill', noicon=true}) | |||
row.typeText = 'Season' | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(season.modifiers) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
local summoningSynergyList = p.getSummoningSynergiesWithModifiers(modifierCriteria) | |||
for i, synergy in ipairs(summoningSynergyList) do | |||
local row = {} | |||
local famProduct1 = Summoning.getFamiliarRecipeByID(synergy.summonIDs[1]) | |||
local familiar1 = nil | |||
local famProduct2 = Summoning.getFamiliarRecipeByID(synergy.summonIDs[2]) | |||
local familiar2 = nil | |||
if famProduct1 ~= nil then | |||
familiar1 = Items.getItemByID(famProduct1.productID) | |||
end | |||
if famProduct2 ~= nil then | |||
familiar2 = Items.getItemByID(famProduct2.productID) | |||
end | |||
if familiar1 == nil or familiar2 == nil then | |||
return | |||
end | |||
row.name = familiar1.name .. familiar2.name .. ' Synergy' | |||
row.icon = Icons.Icon({familiar1.name, type='item'}) .. ' ' .. Icons.Icon({'SynergyIcon', notext=true, nolink=true}) .. ' ' .. Icons.Icon({familiar2.name, type='item'}) .. ' Synergy' | |||
row.expIcon = Icons.getDLCColumnIcon(familiar2.id) | |||
row.expSort = Icons.getExpansionID(familiar2.id) | |||
row.type = Icons.Icon({'Summoning', 'Summoning Synergy', section='Synergies', type='skill', noicon=true}) | |||
row.typeText = 'Synergy' | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(synergy.modifiers) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
local masteryPools = p.getMasteryPoolModifiers(modifierCriteria) | |||
for i, masteryPoolData in ipairs(masteryPools) do | |||
for skillName, masteryPool in pairs(masteryPoolData) do | |||
local row = {} | |||
local isAbyssal = masteryPool.realm == 'melvorItA:Abyssal' and 'Abyssal ' or '' | |||
row.name = isAbyssal .. masteryPool.percent .. '% Mastery Pool Bonus' | |||
row.icon = Icons.Icon({skillName, row.name, section='Mastery Pool Checkpoints', type='skill'}) | |||
row.expIcon = Icons.getDLCColumnIcon(masteryPool.realm) | |||
row.expSort = Icons.getExpansionID(masteryPool.realm) | |||
row.type = Icons.Icon({skillName, 'Mastery Pool Bonus', section='Mastery Pool Checkpoints', type='skill', noicon=true}) | |||
row.typeText = 'Mastery Pool Bonus' | |||
local objMods = nil | |||
row.modifierText, row.otherModifiers, objMods = getModText(masteryPool.modifiers) | |||
row.val = Modifiers.getModifierValue(objMods.matched) | |||
if not hasOtherModifiers and not Shared.tableIsEmpty(objMods.unmatched) then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
end | end | ||