Skip to content

Commit

Permalink
add 13.9.0 files
Browse files Browse the repository at this point in the history
  • Loading branch information
padtrack committed Oct 3, 2024
1 parent 1367931 commit 040e860
Show file tree
Hide file tree
Showing 147 changed files with 10,773 additions and 9 deletions.
2 changes: 1 addition & 1 deletion generated/abilities.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/achievements.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/buildings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"4288117680": "RayTower", "4289166256": "RayTower", "4292311984": "RayTower", "4293360560": "RayTower", "4286020528": "RayTower", "4288641968": "AirBase", "4290739120": "AirBase", "4289690544": "AirBase", "4291787696": "AirBase", "4293884848": "AirBase", "4292836272": "AirBase", "4277435312": "Complex", "4292803504": "CoastalArtillery", "4269046704": "Complex", "4279532464": "Complex", "4290214832": "RayTower", "4282350512": "AirBase", "4270095280": "Complex", "4287232944": "Military", "4288281520": "Military", "4285135792": "Military", "4291263408": "RayTower", "4281990064": "Military", "4287593392": "AirBase", "4080303024": "Complex", "4082400176": "Complex", "4081351600": "Complex", "4286544816": "AirBase", "4271831984": "CoastalArtillery", "4292869040": "AntiAircraft", "4293917616": "AntiAircraft", "4190993328": "Fake", "4267539376": "Fake", "4290018224": "Complex", "4287921072": "Complex", "4286872496": "Complex", "4293163952": "Complex", "4291066800": "Complex", "4285823920": "Complex", "4284775344": "Complex", "4273241008": "Complex", "4272192432": "Complex", "4293491632": "SpaceStation", "4283923376": "RayTower", "4284447664": "AirBase", "4288969648": "Complex", "4292705200": "Fake", "4292279216": "SensorTower", "4287069104": "RayTower", "4283399088": "AirBase", "4284971952": "RayTower", "4284087216": "Military", "4283038640": "Military", "4278844336": "Military", "4287560624": "CoastalArtillery", "4271143856": "Complex", "4280941488": "Military", "4276386736": "Complex", "4278483888": "Complex", "4280581040": "Complex", "4281629616": "Complex", "4282678192": "Complex", "4283726768": "Complex", "4274289584": "Complex", "4275338160": "Complex", "4270783408": "CoastalArtillery", "4289330096": "Military", "4286184368": "Military", "4062837680": "Military", "4293327792": "SensorTower", "4291230640": "SensorTower", "4290182064": "SensorTower", "4285496240": "AirBase", "4288609200": "CoastalArtillery", "3247274928": "Fake", "4293852080": "CoastalArtillery", "4289657776": "CoastalArtillery", "4293721008": "Generator", "4279892912": "Military", "4267998128": "Complex"}
{"4288117680": "RayTower", "4289166256": "RayTower", "4292311984": "RayTower", "4293360560": "RayTower", "4286020528": "RayTower", "4288641968": "AirBase", "4290739120": "AirBase", "4289690544": "AirBase", "4291787696": "AirBase", "4293884848": "AirBase", "4292836272": "AirBase", "4277435312": "Complex", "4292803504": "CoastalArtillery", "4269046704": "Complex", "4279532464": "Complex", "4290214832": "RayTower", "4282350512": "AirBase", "4270095280": "Complex", "4287232944": "Military", "4288281520": "Military", "4285135792": "Military", "4291263408": "RayTower", "4281990064": "Military", "4287593392": "AirBase", "4080303024": "Complex", "4082400176": "Complex", "4081351600": "Complex", "4286544816": "AirBase", "4271831984": "CoastalArtillery", "4292869040": "AntiAircraft", "4293917616": "AntiAircraft", "4190993328": "Fake", "4267539376": "Fake", "4290018224": "Complex", "4287921072": "Complex", "4286872496": "Complex", "4293163952": "Complex", "4291066800": "Complex", "4285823920": "Complex", "4284775344": "Complex", "4273241008": "Complex", "4272192432": "Complex", "4293491632": "SpaceStation", "4283923376": "RayTower", "4284447664": "AirBase", "4288969648": "Complex", "4292705200": "Fake", "4287069104": "RayTower", "4283399088": "AirBase", "4284971952": "RayTower", "4284087216": "Military", "4283038640": "Military", "4278844336": "Military", "4287560624": "CoastalArtillery", "4271143856": "Complex", "4280941488": "Military", "4276386736": "Complex", "4278483888": "Complex", "4280581040": "Complex", "4281629616": "Complex", "4282678192": "Complex", "4283726768": "Complex", "4274289584": "Complex", "4275338160": "Complex", "4270783408": "CoastalArtillery", "4289330096": "Military", "4286184368": "Military", "4062837680": "Military", "4293327792": "SensorTower", "4291230640": "SensorTower", "4292279216": "SensorTower", "4290182064": "SensorTower", "4285496240": "AirBase", "4288609200": "CoastalArtillery", "3247274928": "Fake", "4293852080": "CoastalArtillery", "4289657776": "CoastalArtillery", "4293721008": "Generator", "4279892912": "Military", "4267998128": "Complex"}
2 changes: 1 addition & 1 deletion generated/exteriors.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/modernizations.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/planes.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/projectiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/ships.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion generated/units.json

Large diffs are not rendered by default.

Binary file added replays/139.wowsreplay
Binary file not shown.
Binary file modified resources/GameParams.data
Binary file not shown.
Binary file modified resources/global.mo
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PASB718_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PASB718_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/renderer/resources/ship_bars/PGSC710_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/renderer/resources/ship_bars/PGSC710_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/renderer/resources/ship_bars/PGSC710_h_bgdead.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PJSC710_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PJSC710_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSB707_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSB707_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSB719_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSB719_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSD705_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PWSD705_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PZSB707_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/renderer/resources/ship_bars/PZSB707_h_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
4 changes: 4 additions & 0 deletions src/renderer/versions/13_9_0/layers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .capture import LayerCapture
from .health import LayerHealthBase as LayerHealth
from .markers import LayerMarkersBase as LayerMarkers
from .ribbon import LayerRibbon
150 changes: 150 additions & 0 deletions src/renderer/versions/13_9_0/layers/capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
from typing import Optional
from PIL import Image, ImageDraw
from renderer.base import LayerBase
from renderer.render import Renderer
from renderer.const import COLORS_NORMAL, RELATION_NORMAL_STR
from renderer.utils import replace_color
from renderer.data import ReplayData
from functools import lru_cache


class LayerCapture(LayerBase):
"""A class for handling/drawing capture points.
Args:
LayerBase (_type_): _description_
"""

def __init__(
self, renderer: Renderer, replay_data: Optional[ReplayData] = None
):
"""Initiates this class.
Args:
renderer (Renderer): The renderer.
"""
self._renderer = renderer
self._replay_data = (
replay_data if replay_data else self._renderer.replay_data
)
self._owner = self._replay_data.player_info[self._replay_data.owner_id]
self._generated_caps: dict[
int, tuple[Image.Image, tuple[int, int], int]
] = {}

def draw(self, game_time: int, image: Image.Image):
"""Draws the capture area on the minimap image.
Args:
game_time (int): Game time. Used to sync. events.
image (Image.Image): Image where the capture are will be pasted on.
"""
events = self._replay_data.events
cps = events[game_time].evt_control.values()

for count, cp in enumerate(cps):
if not cp.is_visible:
continue

if count in self._generated_caps:
cap_image, cap_pos, cap_hash = self._generated_caps[count]
if hash(cp) == cap_hash:
image.alpha_composite(cap_image, cap_pos)
continue

x, y = self._renderer.get_scaled(cp.position)
radius = self._renderer.get_scaled_r(cp.radius)
w = h = round(radius * 2)
cp_area = self._get_capture_area(cp.relation, (w, h))

if cp.control_point_type == 5:
icon_name = "flag.png"
else:
icon_name = f"lettered_{count}.png"

relation_str = RELATION_NORMAL_STR[cp.relation]
icon = self._renderer.resman.load_image(
icon_name, path=f"cap_icons.{relation_str}"
)

if cp.has_invaders and cp.invader_team != -1:
if cp.invader_team == self._owner.team_id:
from_color = COLORS_NORMAL[cp.relation]
to_color = COLORS_NORMAL[0]
else:
from_color = COLORS_NORMAL[cp.relation]
to_color = COLORS_NORMAL[1]
progress = self._get_progress(
from_color, to_color, cp.progress
)
else:
normal = self._renderer.resman.load_image("cap_normal.png")
from_color = "#000000"
to_color = COLORS_NORMAL[cp.relation]
progress = replace_color(normal, from_color, to_color)

px = round(cp_area.width / 2 - progress.width / 2) + 1
py = round(cp_area.height / 2 - progress.height / 2) + 1

cp_area.alpha_composite(progress, (px, py))

ix = round(cp_area.width / 2 - icon.width / 2) + 1
iy = round(cp_area.height / 2 - icon.height / 2) + 1

cp_area.alpha_composite(icon, (ix, iy))

cx = round(x - cp_area.width / 2)
cy = round(y - cp_area.height / 2)

self._generated_caps[count] = (
cp_area.copy(),
(cx, cy),
hash(cp)
)

image.alpha_composite(cp_area, (cx, cy))

def _get_capture_area(self, relation: int, size: tuple) -> Image.Image:
"""Loads the proper capture area image from the resources.
Args:
relation (int): relation
size (tuple): size of the image.
Returns:
Image.Image: Image of the capture area, resized.
"""
relation_to_str = {-1: "neutral", 0: "ally", 1: "enemy"}
filename = f"cap_{relation_to_str[relation]}.png"
return self._renderer.resman.load_image(filename, size=size)

@lru_cache
def _get_progress(self, from_color: str, to_color: str, percent: float):
"""Gets the diamond progress `bar` from the resources and properly
color it depending from the colors and percentage provided.
Args:
from_color (str): From color.
to_color (str): To color.
percent (float): Percentage of the progress. 0.0 to 1.0
Returns:
Image.Image: Diamond progress `bar` image.
"""
pd = self._renderer.resman.load_image("cap_invaded.png")

bg_diamond = replace_color(pd, "#000000", from_color)
fg_diamond = replace_color(pd, "#000000", to_color)
mask = Image.new("RGBA", pd.size)
mask_draw = ImageDraw.Draw(mask, "RGBA")
mask_draw.pieslice(
(
(0, 0),
(pd.width - 1, pd.height - 1),
),
start=-90,
end=(-90 + 360 * percent),
fill="black",
)
bg_diamond.paste(fg_diamond, mask=mask)
return bg_diamond
Loading

0 comments on commit 040e860

Please sign in to comment.