Line 76: |
Line 76: |
| {{!}}-{{!}}Normal=${image} | | {{!}}-{{!}}Normal=${image} |
| {{!}}-{{!}}Damaged=${image_damaged} | | {{!}}-{{!}}Damaged=${image_damaged} |
| + | }}]], |
| + | |
| + | _gallery_normal = [[{{#tag:tabber| |
| + | {{!}}-{{!}}Normal=${image} |
| + | }}]], |
| + | |
| + | _gallery_damaged = [[{{#tag:tabber| |
| + | {{!}}-{{!}}Damaged=${image} |
| }}]], | | }}]], |
| | | |
Line 171: |
Line 179: |
| return class or "Unknown Class" | | return class or "Unknown Class" |
| end | | end |
| + | end |
| + | |
| + | function ship_cgs(ship_name, seasonal_forms, j) |
| + | j = j or 1 |
| + | local forms = { { name = ship_name, normal = true, damaged = true } } |
| + | if j > 1 then |
| + | forms[1].name_changed = true |
| + | end |
| + | local success, ship_data = Utils.requireModule(ship_name) |
| + | if not success then |
| + | return forms |
| + | end |
| + | local form_data = ship_data[""] |
| + | if seasonal_forms then |
| + | for suffix, data in pairs(ship_data) do |
| + | if data._seasonal == true and data._name and data._suffix then |
| + | table.insert(seasonal_forms, data._name .. "/" .. data._suffix) |
| + | end |
| + | end |
| + | end |
| + | local i = 1 |
| + | while form_data and form_data._remodel_to and i <= 15 and j <= 3 do |
| + | local ship_name_next, ship_suffix_next = Ship:process_ship_key(form_data._remodel_to) |
| + | if ship_name_next ~= ship_name then |
| + | return Utils.concat(forms, ship_cgs(ship_name_next, seasonal_forms, j + 1)) |
| + | else |
| + | local name = form_data._remodel_to |
| + | form_data = ship_data[ship_suffix_next] |
| + | local normal = not (form_data._cg_reference and true or false) |
| + | local damaged = not (form_data._cg_damaged_reference and true or false) |
| + | table.insert(forms, { name = name, normal = normal, damaged = damaged }) |
| + | end |
| + | i = i + 1 |
| + | end |
| + | return forms |
| end | | end |
| | | |
Line 181: |
Line 224: |
| local ship_name = args.explicit.ship or args.implicit.pagename or "" | | local ship_name = args.explicit.ship or args.implicit.pagename or "" |
| local seasonal_forms = {} | | local seasonal_forms = {} |
− | local forms = ship_remodel_forms(ship_name, seasonal_forms) | + | local forms = ship_cgs(ship_name, seasonal_forms) |
| local result = { "{{#tag:tabber|" } | | local result = { "{{#tag:tabber|" } |
| for _, form in ipairs(forms) do | | for _, form in ipairs(forms) do |
− | local name, suffix = Ship:process_ship_key(form) | + | mw.log(form.name) |
− | local image = ShipGraphicKai:Asset({ form, link = "nil", size = "300px" })
| + | if form.normal or form.damaged then |
− | local image_damaged = ShipGraphicKai:Asset({ form, link = "nil", damaged = true, size = "300px" })
| + | local name, suffix = Ship:process_ship_key(form.name) |
− | table.insert(result, suffix == "" and "{{!}}-{{!}}Base=" or ("{{!}}-{{!}}" .. suffix .. "="))
| + | suffix = suffix or "" |
− | table.insert(result, format{
| + | if form.name_changed then |
− | ShipPage._gallery_tabber,
| + | table.insert(result, "{{!}}-{{!}}" .. form.name .. "=") |
− | image = image,
| + | else |
− | image_damaged = image_damaged | + | table.insert(result, suffix == "" and "{{!}}-{{!}}Base=" or ("{{!}}-{{!}}" .. suffix .. "=")) |
− | }) | + | end |
| + | if form.normal and form.damaged then |
| + | local image = ShipGraphicKai:Asset({ form.name, link = "nil", size = "300px" }) |
| + | local image_damaged = ShipGraphicKai:Asset({ form.name, link = "nil", damaged = true, size = "300px" }) |
| + | table.insert(result, format{ |
| + | ShipPage._gallery_tabber, |
| + | image = image, |
| + | image_damaged = image_damaged |
| + | }) |
| + | elseif form.normal then |
| + | local image = ShipGraphicKai:Asset({ form.name, link = "nil", size = "300px" }) |
| + | table.insert(result, format{ |
| + | ShipPage._gallery_normal, |
| + | image = image, |
| + | }) |
| + | elseif form.damaged then |
| + | local image_damaged = ShipGraphicKai:Asset({ form.name, link = "nil", damaged = true, size = "300px" }) |
| + | table.insert(result, format{ |
| + | ShipPage._gallery_damaged, |
| + | image = image_damaged, |
| + | }) |
| + | end |
| + | end |
| end | | end |
| for _, form in ipairs(seasonal_forms) do | | for _, form in ipairs(seasonal_forms) do |
Line 208: |
Line 273: |
| return table.concat(result, "\n") | | return table.concat(result, "\n") |
| end | | end |
| + | |
| + | --[[ |
| + | function ShipPage.TestGalleryTabber(ship) |
| + | return ShipPage.GalleryTabber(nil, { |
| + | explicit = { ship = ship }, |
| + | implicit = {}, |
| + | }) |
| + | end |
| + | ]]-- |
| | | |
| function ShipPage.FooterSections(frame, args) | | function ShipPage.FooterSections(frame, args) |