Line 1: |
Line 1: |
− | local format = require('Module:StringInterpolation').format
| |
− | local getArgs = require('Module:GetArgs')
| |
| local Formatting = require('Module:Formatting') | | local Formatting = require('Module:Formatting') |
− | local EnemyShipInfoKai = require('Module:EnemyShipInfoKai') | + | local ShipInfoKai = require('Module:ShipInfoKai') |
− | local ShipBattleCardKai = require('Module:ShipBattleCardKai')
| |
| | | |
− | local EnemyShipInfoMini = EnemyShipInfoKai{ | + | local EnemyShipInfoMini = ShipInfoKai{ |
| _template = [[{|class="typography-xl-optout ${table_class}" style="margin: auto; float: none; border: 1px solid darkgray; width: 160px;" | | _template = [[{|class="typography-xl-optout ${table_class}" style="margin: auto; float: none; border: 1px solid darkgray; width: 160px;" |
| |- | | |- |
Line 29: |
Line 26: |
| ! colspan="4" style="background-color: LightSkyBlue;" | '''Equipment''' | | ! colspan="4" style="background-color: LightSkyBlue;" | '''Equipment''' |
| |- style="background-color: whitesmoke;" | | |- style="background-color: whitesmoke;" |
− | | colspan="4" style="text-align: center;" | | + | | colspan="4" style="text-align: center;" | ${slot_details} |
| + | |- |
| + | | colspan="4" style="padding: 0px;" |<div style="background-color: lightskyblue; cursor: pointer; text-align: center; margin: 0px;" class="mw-customtoggle-extra">'''Extra'''</div> |
| + | <div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-extra" style="padding: 2px; font-size: 12px;"> |
| + | Some notes maybe |
| + | </div> |
| |}]], | | |}]], |
| } | | } |
Line 38: |
Line 40: |
| end | | end |
| | | |
− | local collapsible_template = [[<div style="display:inline-block;">
| + | function EnemyShipInfoMini:firepower() |
− | <div class="mw-customtoggle-${toggle_id}">
| + | self._vars.firepower = Formatting:format_stat(self._ship:firepower()) |
− | {|class="wikitable" style="cursor: pointer; margin: auto; border: 1px solid darkgray;"
| + | end |
− | | ${card_image}
| + | |
− | |}
| + | function EnemyShipInfoMini:armor() |
− | </div>
| + | self._vars.armor = Formatting:format_stat(self._ship:armor()) |
− | <div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-${toggle_id}">
| + | end |
− | ${table}
| + | |
− | </div>
| + | function EnemyShipInfoMini:torpedo() |
− | </div>]]
| + | self._vars.torpedo = Formatting:format_stat(self._ship:torpedo()) |
| + | end |
| + | |
| + | function EnemyShipInfoMini:aa() |
| + | self._vars.aa = Formatting:format_stat(self._ship:aa(), self._ship:aa()) |
| + | end |
| + | |
| + | function EnemyShipInfoMini:asw() |
| + | self._vars.asw = Formatting:format_stat(self._ship:asw(), self._ship:asw()) |
| + | end |
| + | |
| + | function EnemyShipInfoMini:slot_details() |
| + | local slots = {} |
| + | for i = 1, self._default_slot_num do |
| + | local num_of_slots, num_of_enabled_slots = self._ship:slots_length(), self._ship:slots() |
| + | local locked = num_of_enabled_slots and i > num_of_enabled_slots |
| + | local icon = "" |
| + | if num_of_slots and i > num_of_slots then |
| | | |
− | function EnemyShipInfoMini.EnemyInfoboxMini(frame, args)
| + | else |
− | local args = args or getArgs{frame = frame:getParent()}
| + | local equipment, link = self._ship:slot(i), nil |
− | if args.id then
| + | if equipment then |
− | args.link = "nil"
| + | icon = equipment:icon() |
− | return format{
| + | link = equipment:link() |
− | collapsible_template, | + | else |
− | toggle_id = args.id, | + | icon = locked and "" or false |
− | card_image = ShipBattleCardKai:Asset(args),
| + | end |
− | table = EnemyShipInfoMini:Infobox(args), | + | if icon ~= "" then |
− | } | + | icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = link, link = link} |
− | else
| + | end |
− | return EnemyShipInfoMini:Infobox(args) | + | end |
| + | table.insert(slots, icon) |
| end | | end |
| + | self._vars.slot_details = table.concat(slots) |
| end | | end |
| + | |
| + | -- EnemyShipInfoMini.test = EnemyShipInfoMini:Infobox({"Destroyer I-Class"}) |
| | | |
| return EnemyShipInfoMini | | return EnemyShipInfoMini |