Line 22: |
Line 22: |
| dive_night_r2 = {image = 'Abyssal_Night_Dive_Bomber_582_Equipment.png', top = 1, left = 127, width = 35, height = 30}, | | dive_night_r2 = {image = 'Abyssal_Night_Dive_Bomber_582_Equipment.png', top = 1, left = 127, width = 35, height = 30}, |
| flagship = {image = 'Battle Card Flagship Icon.png', top = 2, right = 2, width = 18}, | | flagship = {image = 'Battle Card Flagship Icon.png', top = 2, right = 2, width = 18}, |
| + | fortress_ace_r1 = {image = 'Abyssal Sky Fortress Ace (Reconnaissance Model) 595 Equipment.png', top = 15, left = 104, width = 32, height = 24}, |
| + | fortress_ace_r2 = {image = 'Abyssal Sky Fortress Ace (Reconnaissance Model) 595 Equipment.png', top = 3, left = 125, width = 32, height = 24}, |
| + | fortress_heavy_ace_r1 = {image = 'Abyssal Sky Fortress Ace (Heavy Bomber Model) 598 Equipment.png', top = 15, left = 104, width = 32, height = 24}, |
| + | fortress_heavy_ace_r2 = {image = 'Abyssal Sky Fortress Ace (Heavy Bomber Model) 598 Equipment.png', top = 3, left = 125, width = 32, height = 24}, |
| + | fortress_heavy_r = {image = 'Abyssal Sky Fortress (Heavy Bomber Model) 597 Equipment.png', top = 10, left = 120, width = 32, height = 24}, |
| + | fortress_heavy_r1 = {image = 'Abyssal Sky Fortress (Heavy Bomber Model) 597 Equipment.png', top = 15, left = 104, width = 32, height = 24}, |
| + | fortress_heavy_r2 = {image = 'Abyssal Sky Fortress (Heavy Bomber Model) 597 Equipment.png', top = 3, left = 125, width = 32, height = 24}, |
| + | fortress_r = {image = 'Abyssal Sky Fortress (Reconnaissance Model) 594 Equipment.png', top = 10, left = 120, width = 32, height = 24}, |
| + | fortress_r1 = {image = 'Abyssal Sky Fortress (Reconnaissance Model) 594 Equipment.png', top = 15, left = 104, width = 32, height = 24}, |
| + | fortress_r2 = {image = 'Abyssal Sky Fortress (Reconnaissance Model) 594 Equipment.png', top = 3, left = 125, width = 32, height = 24}, |
| hell = {image = 'Hell plane 2.png', top = 5, left = 50, width = 30}, | | hell = {image = 'Hell plane 2.png', top = 5, left = 50, width = 30}, |
| hell_cat_kai_r = {image = 'Abyssal_Cat_Fighter_Kai_556_Equipment.png', top = 8, left = 126, width = 35, height = 30}, | | hell_cat_kai_r = {image = 'Abyssal_Cat_Fighter_Kai_556_Equipment.png', top = 8, left = 126, width = 35, height = 30}, |
Line 49: |
Line 59: |
| revenge_night_r2 = {image = 'Abyssal_Night_Revenge_Torpedo_Bomber_583_Equipment.png', top = 2, left = 128, width = 30}, | | revenge_night_r2 = {image = 'Abyssal_Night_Revenge_Torpedo_Bomber_583_Equipment.png', top = 2, left = 128, width = 30}, |
| revenge_r2 = {image = 'Hell plane 3.png', top = 3, left = 130, width = 30, height = 33}, | | revenge_r2 = {image = 'Hell plane 3.png', top = 3, left = 130, width = 30, height = 33}, |
− | ring = {image = 'Battle Card Marriage Ring.png', top = 19, left = 138, width = 20, height = 21}, | + | ring = {image = 'Battle Card Marriage Ring.png', top = 19, left = 140, width = 20, height = 21}, |
| ring_glow = {image = 'Battle Card Marriage Ring Glow.png', top = 10, left = 126, width = 36, opacity = 0.7}, | | ring_glow = {image = 'Battle Card Marriage Ring Glow.png', top = 10, left = 126, width = 36, opacity = 0.7}, |
| smudge_heavy = {image = 'Battle Card Smudge Heavy.png', top = 0, left = 0, width = 160, height = 40}, | | smudge_heavy = {image = 'Battle Card Smudge Heavy.png', top = 0, left = 0, width = 160, height = 40}, |
Line 57: |
Line 67: |
| status_heavy_damage = {image = 'Battle Card Status Heavy Damage.png', top = 0, left = 0, width = 160, height = 40}, | | status_heavy_damage = {image = 'Battle Card Status Heavy Damage.png', top = 0, left = 0, width = 160, height = 40}, |
| status_heavy_damage_installation = {image = 'Battle Card Status Heavy Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, | | status_heavy_damage_installation = {image = 'Battle Card Status Heavy Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, |
| + | status_heavy_fatigue = {image = 'Battle Card Status Heavy Fatigue.png', top = 0, right = 0, width = 60, height = 40}, |
| + | status_heavy_fatigue_face = {image = 'Battle Card Status Heavy Fatigue Face.png', top = 12, left = 152, height = 17},--position not datamined |
| status_light_damage = {image = 'Battle Card Status Light Damage.png', top = 0, left = 0, width = 160, height = 40}, | | status_light_damage = {image = 'Battle Card Status Light Damage.png', top = 0, left = 0, width = 160, height = 40}, |
| status_light_damage_installation = {image = 'Battle Card Status Light Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, | | status_light_damage_installation = {image = 'Battle Card Status Light Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, |
| status_medium_damage = {image = 'Battle Card Status Medium Damage.png', top = 0, left = 0, width = 160, height = 40}, | | status_medium_damage = {image = 'Battle Card Status Medium Damage.png', top = 0, left = 0, width = 160, height = 40}, |
| status_medium_damage_installation = {image = 'Battle Card Status Medium Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, | | status_medium_damage_installation = {image = 'Battle Card Status Medium Damage Installation.png', top = 0, left = 0, width = 160, height = 40}, |
| + | status_medium_fatigue = {image = 'Battle Card Status Medium Fatigue.png', top = 0, right = 0, width = 60, height = 40}, |
| + | status_medium_fatigue_face = {image = 'Battle Card Status Medium Fatigue Face.png', top = 12, left = 152, height = 17},--position not datamined |
| status_repair = {image = 'Battle Card Status Repair.png', top = 0, left = 0, width = 160, height = 40}, | | status_repair = {image = 'Battle Card Status Repair.png', top = 0, left = 0, width = 160, height = 40}, |
| status_retreat = {image = 'Battle Card Status Retreat.png', top = 0, left = 0, width = 160, height = 40}, | | status_retreat = {image = 'Battle Card Status Retreat.png', top = 0, left = 0, width = 160, height = 40}, |
| + | status_sea_colored_ribbon = {image = 'Battle Card Sea-colored Ribbon.png', top = 0, left = 142, height = 40},--position not datamined. Asset cropped to fit properly. |
| status_sunk = {image = 'Battle Card Status Sunk.png', top = 0, left = 0, width = 160, height = 40}, | | status_sunk = {image = 'Battle Card Status Sunk.png', top = 0, left = 0, width = 160, height = 40}, |
| status_sunk_installation = {image = 'Battle Card Status Sunk Installation.png', top = 0, left = 0, width = 160, height = 40}, | | status_sunk_installation = {image = 'Battle Card Status Sunk Installation.png', top = 0, left = 0, width = 160, height = 40}, |
− | takoyaki = {image = 'Hell plane 2.png', top = 5, left = 50, width = 30} | + | status_white_tasuki = {image = 'Battle Card White Tasuki.png', top = 0, left = 142, height = 40},--position not datamined. Asset cropped to fit properly. |
| + | takoyaki = {image = 'Hell plane 2.png', top = 5, left = 50, width = 30}, |
| } | | } |
| } | | } |
| | | |
| function ShipBattleCardKai:get_source(ship, args) | | function ShipBattleCardKai:get_source(ship, args) |
− | return args.damaged and ship:battle_card_damaged(true) or ship:battle_card(true) | + | return args.damaged and args.damaged ~= 'false' and ship:battle_card_damaged(true) or ship:battle_card(true) |
| end | | end |
| | | |
− | local function scaleLayer(hd, layer) | + | local function scaleLayer(scaleWidth, scaleHeight, layer) |
− | local top, left, right, width, height = layer.top, layer.left, layer.right, layer.width, layer.height or layer.width | + | local top, left, right, width, height = layer.top, layer.left, layer.right, (layer.width or layer.height), (layer.height or layer.width) |
| layer.style = layer.style or {} | | layer.style = layer.style or {} |
| if top then | | if top then |
− | layer.style.top = top * (hd and 1.5 or 1) .. 'px' | + | layer.style.top = _.round(scaleHeight * top) .. 'px' |
| end | | end |
| if left then | | if left then |
− | layer.style.left = left * (hd and 1.5 or 1) .. 'px' | + | layer.style.left = _.round(scaleWidth * left) .. 'px' |
| end | | end |
| if right then | | if right then |
− | layer.style.right = right * (hd and 1.5 or 1) .. 'px' | + | layer.style.right = _.round(scaleWidth * right) .. 'px' |
| end | | end |
− | if width then | + | if width and height then |
− | layer.size = width * (hd and 1.5 or 1) .. 'x' .. height * (hd and 1.5 or 1) .. 'px' | + | layer.size = _.round(scaleWidth * width) .. 'x' .. _.round(scaleHeight * height) .. 'px' |
| end | | end |
| if layer.opacity then | | if layer.opacity then |
Line 94: |
Line 110: |
| end | | end |
| | | |
− | function ShipBattleCardKai:get_layer(hd, name) | + | function ShipBattleCardKai:get_layer(scaleWidth, scaleHeight, name) |
− | return scaleLayer(hd, self._battle_card_layers[name]) | + | return scaleLayer(scaleWidth, scaleHeight, self._battle_card_layers[name]) |
| + | end |
| + | |
| + | local function parseSize(s) |
| + | local width, height = string.match(s, "(%d+)x(%d+)") |
| + | if width and height then |
| + | return tonumber(width), tonumber(height) |
| + | end |
| end | | end |
| | | |
Line 107: |
Line 130: |
| if not args.size then | | if not args.size then |
| args.size = args.hd and self._battle_card_size_hd or self._battle_card_size | | args.size = args.hd and self._battle_card_size_hd or self._battle_card_size |
| + | end |
| + | if args.marginLeft then |
| + | self._image_wrapper_style['margin-left'] = args.marginLeft |
| + | end |
| + | if args.marginTop then |
| + | self._image_wrapper_style['margin-top'] = args.marginTop |
| + | end |
| + | local width, height = parseSize(args.size) |
| + | local scaleWidth = 1 |
| + | local scaleHeight = 1 |
| + | if width and height then |
| + | scaleWidth = width / 160 |
| + | scaleHeight = height / 40 |
| end | | end |
| args.link = link | | args.link = link |
Line 115: |
Line 151: |
| if ship_layers then | | if ship_layers then |
| for i, name in ipairs(ship_layers) do | | for i, name in ipairs(ship_layers) do |
− | self:_add_layer(stack, self:get_layer(args.hd, name), ship, args, link) | + | self:_add_layer(stack, self:get_layer(scaleWidth, scaleHeight, name), ship, args, link) |
| end | | end |
| end | | end |
| if args.flagship then | | if args.flagship then |
− | self:_add_layer(stack, self:get_layer(args.hd, 'flagship'), ship, args, link) | + | self:_add_layer(stack, self:get_layer(scaleWidth, scaleHeight, 'flagship'), ship, args, link) |
| end | | end |
| if args.layers then | | if args.layers then |
| for i, name in ipairs(_.split(args.layers)) do | | for i, name in ipairs(_.split(args.layers)) do |
− | local layer = self:get_layer(args.hd, name) | + | local layer = self:get_layer(scaleWidth, scaleHeight, name) |
| if layer then | | if layer then |
| self:_add_layer(stack, layer, ship, args, link) | | self:_add_layer(stack, layer, ship, args, link) |