Line 2: |
Line 2: |
| | | |
| local Ship = require('Module:Ship') | | local Ship = require('Module:Ship') |
| + | local ShipBattleCardKai = require('Module:ShipBattleCardKai') |
| local ShipCardKai = require('Module:ShipCardKai') | | local ShipCardKai = require('Module:ShipCardKai') |
| local Equipment = require('Module:Equipment') | | local Equipment = require('Module:Equipment') |
| | | |
| local Formatting = require('Module:Formatting') | | local Formatting = require('Module:Formatting') |
− | local format = require('Module:StringInterpolation').format | + | local format = require('Module:Core').format |
| | | |
| local Functions = require('Module:NanaminFunctions') | | local Functions = require('Module:NanaminFunctions') |
Line 52: |
Line 53: |
| math.randomseed(os.time()) | | math.randomseed(os.time()) |
| math.random(); math.random(); math.random() | | math.random(); math.random(); math.random() |
− | self._id = self._args["route"]:gsub("[^%w]", "") .. self._args["hq"] .. tostring(math.random(1000000,9999999)) | + | self._id = self._args["route"]:gsub("[^%w]", "") .. (self._args["hq"] or "0") .. tostring(math.random(1000000,9999999)) |
| end | | end |
| | | |
Line 107: |
Line 108: |
| ship_card = ship and ship:name() or "Invalid Ship Name" | | ship_card = ship and ship:name() or "Invalid Ship Name" |
| elseif ship and ship:name() then | | elseif ship and ship:name() then |
− | ship_card = ShipCardKai:card{ship = ship, size = self._size, link = ship:link(), caption = ship:name()} | + | ship_card = ShipCardKai:get{ship = ship, size = self._size, link = ship:link(), caption = ship:name()} |
| else | | else |
| ship_card = Formatting:format_image{self._blank, size = self._size} | | ship_card = Formatting:format_image{self._blank, size = self._size} |
Line 127: |
Line 128: |
| self:process_equipment(equip, select(2, ship:slot(slot))) | | self:process_equipment(equip, select(2, ship:slot(slot))) |
| if self._args["text_only"] then | | if self._args["text_only"] then |
− | equip_link = equip:name() | + | equip_link = Functions.shorten_name("", equip:name()) |
| else | | else |
| equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px", link = "" } | | equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px", link = "" } |
− | equip_link = Formatting:format_link(equip:link()) | + | equip_link = Formatting:format_link(Functions.shorten_name(equip:link())) |
| end | | end |
| end | | end |
Line 148: |
Line 149: |
| function NanaminFleetKai:build_table() | | function NanaminFleetKai:build_table() |
| local i = 1 | | local i = 1 |
− | while i < #self._items do | + | while i <= #self._items do |
| if type(self._items[i]) == "string" then | | if type(self._items[i]) == "string" then |
| self:add_header(self._items[i]) | | self:add_header(self._items[i]) |
Line 196: |
Line 197: |
| function NanaminFleetKai:add_extras() | | function NanaminFleetKai:add_extras() |
| local elos = string.format("%.2f", self._elos - (self._hq_lvl * 0.61)) | | local elos = string.format("%.2f", self._elos - (self._hq_lvl * 0.61)) |
| + | if not self._args["hq"] then elos = elos .. " #ERROR:MissingHQ" end |
| local content = "Effective Line of Sight: " .. elos .. " // Fighter Power: " .. tostring(self._fighter_power) | | local content = "Effective Line of Sight: " .. elos .. " // Fighter Power: " .. tostring(self._fighter_power) |
| self:insert_extra(content) | | self:insert_extra(content) |
Line 211: |
Line 213: |
| for i = 1, #drops do | | for i = 1, #drops do |
| local ship = Ship(drops[i], "") | | local ship = Ship(drops[i], "") |
− | local card = ShipCardKai:battle_card{ship = ship, link = ship:link(), caption = ship:name()} | + | local card = ShipBattleCardKai:get{ship = ship, link = ship:link(), caption = ship:name()} |
| if self._args["text_only"] then | | if self._args["text_only"] then |
| card = ship:name() | | card = ship:name() |