Module:Attacks/Tables: Difference between revisions

no edit summary
(getCombatTriangleTable: Fix)
No edit summary
(4 intermediate revisions by one other user not shown)
Line 7: Line 7:
local Items = require('Module:Items')
local Items = require('Module:Items')
local Attacks = require('Module:Attacks')
local Attacks = require('Module:Attacks')
local Num = require('Module:Number')


function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
function p._getSpecialAttackTable(effectDefn, categories, sourceHeaderLabel, includeSource)
-- TODO needs fixing for V1.3
-- Is going to be incredibly broken following combat effects & modifiers overhaul
return ''
--[==[
local spAttTable = {}
local spAttTable = {}
local attacks = Attacks.getAttacks(function(attack)
local attacks = Attacks.getAttacks(function(attack)
Line 50: Line 56:
     if includeCat['Item'] then
     if includeCat['Item'] then
         for i, item in ipairs(GameData.rawData.items) do
         for i, item in ipairs(GameData.rawData.items) do
             if item.specialAttacks ~= nil and not Shared.tableIsEmpty(item.specialAttacks) then
             if item.specialAttacks ~= nil and not item.golbinRaidExclusive and not Shared.tableIsEmpty(item.specialAttacks) then
                 local overrideChance = (item.overrideSpecialChances ~= nil and not Shared.tableIsEmpty(item.overrideSpecialChances))
                 local overrideChance = (item.overrideSpecialChances ~= nil and not Shared.tableIsEmpty(item.overrideSpecialChances))
                 for j, spAttID in ipairs(item.specialAttacks) do
                 for j, spAttID in ipairs(item.specialAttacks) do
Line 70: Line 76:
         for i, spellCat in ipairs(spellCats) do
         for i, spellCat in ipairs(spellCats) do
             for j, spell in ipairs(GameData.rawData[spellCat]) do
             for j, spell in ipairs(GameData.rawData[spellCat]) do
                if spell.specialAttack ~= nil and includedAttacks[spell.specialAttack] then
            local spAttID = spell.specialAttack or spell.specialAttackID
                     local spAtt = GameData.getEntityByID('attacks', spell.specialAttack)
                if spAttID ~= nil and includedAttacks[spAttID] then
                     local spAtt = GameData.getEntityByID('attacks', spAttID)
                     if spAtt ~= nil then
                     if spAtt ~= nil then
                         table.insert(spAttTable, {id = spAtt.id, source = 'Spell', sourceSort = spell.name, sourceText = Icons.Icon({ spell.name, type = 'spell' }), chance = spAtt.defaultChance, descType = 'player' })
                         table.insert(spAttTable, {id = spAtt.id, source = 'Spell', sourceSort = spell.name, sourceText = Icons.Icon({ spell.name, type = 'spell' }), chance = spAtt.defaultChance, descType = 'player' })
Line 194: Line 201:
if firstRow.chance then
if firstRow.chance then
rowSuffix = (rowCounts[spIdx][spAttRow.descType][spAttRow.chance] > 1 and 'rowspan="' .. rowCounts[spIdx][spAttRow.descType][spAttRow.chance] .. '" ') or ''
rowSuffix = (rowCounts[spIdx][spAttRow.descType][spAttRow.chance] > 1 and 'rowspan="' .. rowCounts[spIdx][spAttRow.descType][spAttRow.chance] .. '" ') or ''
table.insert(resultPart, '\r\n|' .. rowSuffix .. 'data-sort-value="' .. spAttRow.chance .. '" style="text-align:right;"| ' .. Shared.round(spAttRow.chance, 2, 0) .. '%')
table.insert(resultPart, '\r\n|' .. rowSuffix .. 'data-sort-value="' .. spAttRow.chance .. '" style="text-align:right;"| ' .. Num.round(spAttRow.chance, 2, 0) .. '%')
end
end
if firstRow.descType then
if firstRow.descType then
Line 204: Line 211:
spAttDesc = spAttDesc..'<br/>('
spAttDesc = spAttDesc..'<br/>('
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)
local spAttDuration = spAttInterval * (spAtt.attackCount - 1)
spAttDesc = spAttDesc..Shared.round(spAttInterval / 1000, 2, 2)..'s delay between attacks.'
spAttDesc = spAttDesc..Num.round(spAttInterval / 1000, 2, 2)..'s delay between attacks.'
if spAtt.attackCount ~= nil and spAtt.attackCount > 2 then
if spAtt.attackCount ~= nil and spAtt.attackCount > 2 then
spAttDesc = spAttDesc..' '..Shared.round(spAttDuration / 1000, 2, 2)..'s total duration'
spAttDesc = spAttDesc..' '..Num.round(spAttDuration / 1000, 2, 2)..'s total duration'
end
end
spAttDesc = spAttDesc..')'
spAttDesc = spAttDesc..')'
Line 216: Line 223:


return table.concat(resultPart)
return table.concat(resultPart)
--]==]
end
end


Line 241: Line 249:
table.sort(validEffectNames, function(a, b) return a < b end)
table.sort(validEffectNames, function(a, b) return a < b end)


return 'ERROR: Invalid effect name "' .. effectName .. '", must be one of: ' .. table.concat(validEffectNames, ', ') .. '[[Category:Pages with script errors]]'
return Shared.printError('Invalid effect name "' .. effectName .. '", must be one of: ' .. table.concat(validEffectNames, ', '))
end
end
end
end
Line 250: Line 258:
-- Generates a table showing the damage/DR multipliers for each combat triangle
-- Generates a table showing the damage/DR multipliers for each combat triangle
function p.getCombatTriangleTable()
function p.getCombatTriangleTable()
local triangleAttributes = {
-- TODO needs fixing for V1.3
return ''
--[==[local triangleAttributes = {
{
{
["name"] = 'damageModifier',
["name"] = 'damageModifier',
Line 320: Line 330:
table.insert(resultPart, '\r\n|}')
table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
return table.concat(resultPart)
--]==]
end
end


return p
return p
2,869

edits