Line 43: |
Line 43: |
| local Banners = | | local Banners = |
| '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>" | | '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>" |
− | local dispNo = U.split(ship.no, "-")[1] or "???" | + | local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id |
− | local sortNo = ship.sortno
| |
− | local sortNoText = sortNo and (sortNo > 1000 and formatTooltip(dispNo, string.format("%d ", sortNo)) or sortNo) or dispNo
| |
| local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>" | | local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>" |
| -- Formatting Japanese | | -- Formatting Japanese |
Line 90: |
Line 88: |
| local JaName = "" | | local JaName = "" |
| if | | if |
− | ship.no == "147" or ship.no == "311" or ship.no == "312" or ship.no == "313" or ship.no == "313a" or | + | ship.name[3] == "Verniy" or ship.name[3] == "Gangut" or ship.name[3] == "Oktyabrskaya Revolyutsiya" or ship.name[3] == "Tashkent" or ship.name[3] == "Tashkent Kai" or ship.name[3] == "Gangut Dva" |
− | ship.no == "316"
| |
| then -- Russian ship markup | | then -- Russian ship markup |
| JaName = | | JaName = |
Line 440: |
Line 437: |
| end | | end |
| | | |
− | local function loadShipData(no) | + | local function loadShipData(key) |
− | local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[no] or no, "name") or {}).id]) | + | local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id]) |
| local data = {} | | local data = {} |
− | -- Two index formats from Module:Data/Ship: base_sortno..('a' if sortno>1000) OR sortno..'-'..mstid | + | data.id = ship:id() or '???' |
− | -- here forced to former format instead of: data.no = no,
| + | data.no = ship:true_id() |
− | -- since `no` now might be {{pagename}}(ship name directly), without dependency on Module:Data/Ship.
| |
− | data.no = (ship:true_id() or 0) > 1000 and ship:id()..'a' or ship:id() or no
| |
− | data.sortno = ship:true_id() | |
| data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""} | | data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""} |
| local class = ship:class() | | local class = ship:class() |
Line 467: |
Line 461: |
| data.equip = {} | | data.equip = {} |
| for _, v in ipairs(ship._equipment) do | | for _, v in ipairs(ship._equipment) do |
− | table.insert(data.equip, (v.equipment == nil and '?' or v.equipment or '') .. (v.stars and string.format(' ★+%d', v.stars) or '')) | + | table.insert(data.equip, v.equipment == nil and '?' or v.equipment or '') |
| table.insert(data.aircraft, v.size or "") | | table.insert(data.aircraft, v.size or "") |
| end | | end |