572
edits
(Created page with "--Module that constructs tables for all things that can affect Player Modifiers --This includes Agility, Equipment, Pets, Prayers, and Constellations right now local p = {} local Constants = require('Module:Constants') local Shared = require('Module:Shared') local Pets = require('Module:Pets') local Items = require('Module:Items') local Skills = require('Module:Skills') local Agility = require('Module:Skills/Agility') local Prayer = require('Module:Prayer') local Shop...") |
No edit summary |
||
Line 13: | Line 13: | ||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local GameData = require('Module:GameData') | |||
local Township = require('Module:GauTest/Township') | |||
--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 196: | Line 198: | ||
return upgradeList | return upgradeList | ||
end | end | ||
function p.getTownshipBuildingsWithModifier(modifiers, skill, getOpposites) | |||
if type(modifiers) == 'string' then | |||
modifiers = {modifiers} | |||
end | |||
local buildingList = GameData.getEntities(GameData.skillData.Township.buildings, | |||
function(building) | |||
for i, mod in ipairs(modifiers) do | |||
if p.getModifierValue(building.modifiers, mod, skill, getOpposites) ~= 0 then | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
) | |||
return buildingList | |||
end | |||
-- TODO | |||
-- Need to split up the worship | |||
function p.getTownshipWorshipsWithModifier(modifiers, skill, getOpposites) | |||
if type(modifiers) == 'string' then | |||
modifiers = {modifiers} | |||
end | |||
local buildingList = GameData.getEntities(GameData.skillData.Township.buildings, | |||
function(building) | |||
for i, mod in ipairs(modifiers) do | |||
if p.getModifierValue(building.modifiers, mod, skill, getOpposites) ~= 0 then | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
) | |||
return buildingList | |||
end | |||
function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods, maxOtherMods) | function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods, maxOtherMods) | ||
Line 418: | Line 457: | ||
local modList = Skills._buildAstrologyModifierArray(cons, nil, true, true, true, true) | local modList = Skills._buildAstrologyModifierArray(cons, nil, true, true, true, true) | ||
row.modifierText, row.otherModifiers = getModText(modList) | row.modifierText, row.otherModifiers = getModText(modList) | ||
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then | |||
hasOtherModifiers = true | |||
end | |||
table.insert(tableArray, row) | |||
end | |||
local buildingList = p.getTownshipBuildingsWithModifier(modifiers, skill, getOpposites) | |||
for i, building in ipairs(buildingList) do | |||
local row = {} | |||
row.name = building.name | |||
row.icon = Icons.Icon({building.name, type='building'}) | |||
row.type = 'Building' | |||
local totalVal = 0 | |||
for i, mod in pairs(modifiers) do | |||
totalVal = totalVal + p.getModifierValue(building.modifiers, mod, skill, getOpposites) | |||
end | |||
row.val = totalVal | |||
row.modifierText, row.otherModifiers = getModText(building.modifiers) | |||
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then | if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then | ||
Line 481: | Line 542: | ||
return p._getModifierTable(modifier, skill, columnName, getOpposites, displayOtherMods, maxOtherMods) | return p._getModifierTable(modifier, skill, columnName, getOpposites, displayOtherMods, maxOtherMods) | ||
end | end | ||
-- Automatically generates the list of modifiers for the target entity | |||
function p.getTownshipModifierTable(frame) | |||
local name = frame.args ~= nil and frame.args[1] or frame[1] | |||
local type = frame.args ~= nil and frame.args.type or frame.type | |||
local modifier = Township.GetModifiers(name, type) | |||
if frame.args ~= nil then | |||
frame[1] = modifier | |||
else | |||
frame.args[1] = modifier | |||
end | |||
return p.getModifierTable(frame) | |||
end | |||
return p | return p |
edits