2,869
edits
(Update for v1.1) |
No edit summary |
||
(8 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 | ||
local spAttID = spell.specialAttack or spell.specialAttackID | |||
local spAtt = GameData.getEntityByID('attacks', | 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 113: | Line 120: | ||
table.insert(spAttTable, { id = familiar.id, source = 'Familiar', sourceSort = familiar.name, sourceText = Icons.Icon({ familiar.name, type = 'item' }), chance = famChance or 0, descType = 'player' }) | table.insert(spAttTable, { id = familiar.id, source = 'Familiar', sourceSort = familiar.name, sourceText = Icons.Icon({ familiar.name, type = 'item' }), chance = famChance or 0, descType = 'player' }) | ||
-- Slap a dummy entry into the attacks table for this familiar | -- Slap a dummy entry into the attacks table for this familiar | ||
attacks[famIdx] = { id = familiar.id, name = familiar.name .. ' (Familiar)', description | attacks[famIdx] = { id = familiar.id, name = familiar.name .. ' (Familiar)', description = famDesc } | ||
famIdx = famIdx + 1 | famIdx = famIdx + 1 | ||
end | end | ||
Line 168: | Line 175: | ||
for i, spAttRow in ipairs(spAttTable) do | for i, spAttRow in ipairs(spAttTable) do | ||
local spIdx = spAttRow.id | local spIdx = spAttRow.id | ||
local spAtt = attacks | local spAtt = GameData.getEntityByID(attacks, spIdx) | ||
-- Determine if it's the first row for any of our groupings | -- Determine if it's the first row for any of our groupings | ||
local resetKeys = {} | local resetKeys = {} | ||
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;"| ' .. | 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 | ||
rowSuffix = (rowCounts[spIdx][spAttRow.descType]['rows'] > 1 and '|rowspan="' .. rowCounts[spIdx][spAttRow.descType]['rows'] .. '"') or '' | rowSuffix = (rowCounts[spIdx][spAttRow.descType]['rows'] > 1 and '|rowspan="' .. rowCounts[spIdx][spAttRow.descType]['rows'] .. '"') or '' | ||
local spAttDesc = spAtt | local spAttDesc = spAtt.description | ||
--Adding the time between hits and total duration as a note at the end of the special attack description | --Adding the time between hits and total duration as a note at the end of the special attack description | ||
local spAttInterval = spAtt.attackInterval ~= nil and spAtt.attackInterval or -1 | local spAttInterval = spAtt.attackInterval ~= nil and spAtt.attackInterval or -1 | ||
Line 204: | Line 211: | ||
spAttDesc = spAttDesc..'<br/>(' | spAttDesc = spAttDesc..'<br/>(' | ||
local spAttDuration = spAttInterval * (spAtt.attackCount - 1) | local spAttDuration = spAttInterval * (spAtt.attackCount - 1) | ||
spAttDesc = spAttDesc.. | 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..' '.. | 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 ' | 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 271: | Line 281: | ||
} | } | ||
local gameMode = { | local gameMode = { | ||
{ 'Standard', 'Standard' }, | { 'Standard Mode', 'Standard' }, | ||
{ 'Hardcore', Icons.Icon({ 'Hardcore' }) } | { 'Hardcore Mode', Icons.Icon({ 'Hardcore' }) } | ||
} | } | ||
local attrCount = Shared.tableCount(triangleAttributes) | local attrCount = Shared.tableCount(triangleAttributes) | ||
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 |
edits