Line 330: |
Line 330: |
| local function format_bonus_text(desc) | | local function format_bonus_text(desc) |
| local with_formats = { | | local with_formats = { |
− | ["Radar"] = "[[File:Radar.png]]", | + | ["Radar"] = "[[File:Radar.png|link=Radar]]", |
| } | | } |
| local with = desc._with and with_formats[desc._with] and " " .. with_formats[desc._with] or "" | | local with = desc._with and with_formats[desc._with] and " " .. with_formats[desc._with] or "" |
− | if desc._ship then | + | local count = desc._count and " ×" .. desc._count or "" |
− | return string.format( | + | local text = desc._ship and |
− | "[[%s]]%s",
| + | string.format("[[%s]]%s", desc._ship, count) or |
− | desc._ship,
| + | desc._class and |
− | with
| + | string.format( |
− | ) | |
− | end
| |
− | if desc._class then
| |
− | return string.format( | |
| "[[:Category:%s Class|%s Class]]%s%s", | | "[[:Category:%s Class|%s Class]]%s%s", |
| desc._class, | | desc._class, |
| desc._class, | | desc._class, |
| desc._suffix and " " .. desc._suffix or "", | | desc._suffix and " " .. desc._suffix or "", |
− | with | + | count |
− | ) | + | ) or |
− | end
| + | "??" |
− | return "??"
| + | return text, with |
| end | | end |
| | | |
Line 384: |
Line 380: |
| }) | | }) |
| end | | end |
| + | local text, with, prevText |
| for _, desc in ipairs(self._equipment._bonuses or {}) do | | for _, desc in ipairs(self._equipment._bonuses or {}) do |
| + | text, with = format_bonus_text(desc) |
| table.insert(result, format{ | | table.insert(result, format{ |
| self._bonus_row, | | self._bonus_row, |
− | text = format_bonus_text(desc), | + | text = text ~= prevText and text .. with or with, |
| stats = Formatting:format_stat_bonuses({ | | stats = Formatting:format_stat_bonuses({ |
| firepower = format_bonus_stat(desc, "_firepower"), | | firepower = format_bonus_stat(desc, "_firepower"), |
Line 405: |
Line 403: |
| }) | | }) |
| }) | | }) |
| + | prevText = text |
| end | | end |
| self._vars.bonus_details = #result > 1 and ("\n" .. table.concat(result, "\n")) or "" | | self._vars.bonus_details = #result > 1 and ("\n" .. table.concat(result, "\n")) or "" |