12,787
edits
(getItemUpgradeTable: Include stat change column for potions, now that modifiers are included) |
mNo edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local Common = require('Module:Common') | |||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
Line 10: | Line 11: | ||
local styleOverrides = { | local styleOverrides = { | ||
Melee = {'Slayer Helmet (Basic)', 'Slayer Platebody (Basic)', 'Paladin Gloves', 'Desert Wrappings', 'Almighty Lute', 'Candy Cane', ' | Melee = {'Slayer Helmet (Basic)', 'Slayer Platebody (Basic)', 'Paladin Gloves', 'Desert Wrappings', 'Almighty Lute', 'Candy Cane', "Bob's Rake", "Knight's Defender", "Ward of Flame Platebody"}, | ||
Ranged = {'Slayer Cowl (Basic)', 'Slayer Leather Body (Basic)', 'Ice Arrows'}, | Ranged = {'Slayer Cowl (Basic)', 'Slayer Leather Body (Basic)', 'Ice Arrows'}, | ||
Magic = {'Slayer Wizard Hat (Basic)', 'Slayer Wizard Robes (Basic)', 'Enchanted Shield', 'Elementalist Gloves', 'Frostspark Boots', 'Freezing Touch Body', 'Lightning Boots'}, | Magic = {'Slayer Wizard Hat (Basic)', 'Slayer Wizard Robes (Basic)', 'Enchanted Shield', 'Elementalist Gloves', 'Frostspark Boots', 'Freezing Touch Body', 'Lightning Boots'}, | ||
Line 218: | Line 219: | ||
for i, spAttID in ipairs(item.specialAttacks) do | for i, spAttID in ipairs(item.specialAttacks) do | ||
local spAtt = GameData.getEntityByID('attacks', spAttID) | local spAtt = GameData.getEntityByID('attacks', spAttID) | ||
table.insert(txtLines, | local attChance = spAtt.defaultChance | ||
if item.overrideSpecialChances ~= nil then | |||
attChance = item.overrideSpecialChances[i] | |||
end | |||
table.insert(txtLines, attChance .. '% chance for ' .. spAtt.name .. ':') | |||
table.insert(txtLines, spAtt.description) | table.insert(txtLines, spAtt.description) | ||
end | end | ||
Line 258: | Line 263: | ||
for i, spAttID in ipairs(item.specialAttacks) do | for i, spAttID in ipairs(item.specialAttacks) do | ||
local spAtt = GameData.getEntityByID('attacks', spAttID) | local spAtt = GameData.getEntityByID('attacks', spAttID) | ||
table.insert(txtLines, | local attChance = spAtt.defaultChance | ||
if item.overrideSpecialChances ~= nil then | |||
attChance = item.overrideSpecialChances[i] | |||
end | |||
table.insert(txtLines, attChance .. '% chance for ' .. spAtt.name .. ':') | |||
table.insert(txtLines, spAtt.description) | table.insert(txtLines, spAtt.description) | ||
end | end | ||
Line 383: | Line 392: | ||
local modDetail = {} | local modDetail = {} | ||
for i, modName in pairs(modsDL) do | for i, modName in pairs(modsDL) do | ||
local mName, mText | local mName, mText, mIsNeg, mModifyValue = Constants.getModifierDetails(modName) | ||
modDetail[modName] = { mult = ( | modDetail[modName] = { mult = (mIsNeg == false and 1 or -1) } | ||
end | end | ||
Line 467: | Line 476: | ||
table.insert(resultPart, '||' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true})) | table.insert(resultPart, '||' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true})) | ||
table.insert(resultPart, '|| ' .. Common.getCostString({ items = upgrade.itemCosts, gp = upgrade.gpCost, sc = upgrade.scCost}, 'None')) | |||
local statChangeString = '' | |||
if useStatChange then | |||
-- Generate stat change column | |||
local statChangeString = '' | |||
if not Shared.tableIsEmpty(upgrade.rootItemIDs) then | |||
if | -- Some items (e.g. FEZ) may have multiple root items. Simply use the first one | ||
statChangeString = Items.getStatChangeString(item, | local rootItem = Items.getItemByID(upgrade.rootItemIDs[1]) | ||
if rootItem ~= nil then | |||
statChangeString = Items.getStatChangeString(item, rootItem) | |||
end | end | ||
end | end | ||
table.insert(resultPart, '|| '..statChangeString) | |||
table.insert(resultPart, '||'..statChangeString) | |||
end | end | ||
end | end |