Anonymous

Module:Items: Difference between revisions

From Melvor Idle
_getOtherItemBoxText: Correct special attack chances when an item level chance override exists
(_getOtherItemBoxText: Add link for Consumable slot)
(_getOtherItemBoxText: Correct special attack chances when an item level chance override exists)
Line 242: Line 242:
             local spAtt = GameData.getEntityByID('attacks', spAttID)
             local spAtt = GameData.getEntityByID('attacks', spAttID)
             if spAtt ~= nil then
             if spAtt ~= nil then
            local spAttChance = spAtt.defaultChance
            if type(item.overrideSpecialChances) == 'table' and item.overrideSpecialChances[i] ~= nil then
            spAttChance = item.overrideSpecialChances[i]
            end
             local spAttDesc = string.gsub(spAtt.description, '<Attack> ', '')
             local spAttDesc = string.gsub(spAtt.description, '<Attack> ', '')
    table.insert(resultPart, '\r\n* ' .. spAtt.defaultChance .. '% chance for ' .. spAtt.name .. ':')
    table.insert(resultPart, '\r\n* ' .. spAttChance .. '% chance for ' .. spAtt.name .. ':')
    table.insert(resultPart, '\r\n** ' .. spAttDesc)
    table.insert(resultPart, '\r\n** ' .. spAttDesc)
             end
             end