{% extends 'Game/index.html.twig' %} {% macro stat_val(value, suffix) %} {%- set abbr = value >= 1000 -%} {% if abbr %}{{ (value / 1000)|round(1, 'floor') }}k{% else %}{{ value }}{% endif %}{% if suffix %}{{ suffix }}{% endif %} {% endmacro %} {% block title %} - Profile{% endblock %} {% block metas %} {%- set _ogImage = 'https://' ~ app.request.host ~ asset('/images/mine-1600x627.png') -%} {% endblock %} {% block body %}

{{ app.user.username }}

{% if app.user.email %}

{{ app.user.email }}

{% endif %}

Registered commander

{{ _self.stat_val(stats.total) }} Games played
{{ _self.stat_val(stats.wins) }} Victories
{{ _self.stat_val(stats.losses) }} Defeats
{{ _self.stat_val(stats.draws) }} Draws
{{ _self.stat_val(stats.winRate, '%') }} Win rate
{{ _self.stat_val(stats.avgScore) }} Avg score
{{ _self.stat_val(stats.minesHit) }} Mines hit
{{ _self.stat_val(stats.bonusPoints) }} Bonus points
{{ _self.stat_val(stats.avgBonus) }} Avg bonus
{{ _self.stat_val(stats.bestChain) }} Best chain
{{ _self.stat_val(stats.blindHits) }} Blind hits
{{ _self.stat_val(stats.edgeMines) }} Edge mines
{% if stats.total > 0 %}
{% endif %}
{% if recent|length > 0 %}

Recent battles

{% for game in recent %} {% set is_red = game.red and game.red.id == app.user.id %} {% set my_points = is_red ? game.redPoints : game.bluePoints %} {% set opp_points = is_red ? game.bluePoints : game.redPoints %} {% set opp = is_red ? game.blue : game.red %} {% set opp_anon = is_red ? game.blueAnon : game.redAnon %} {% set result = 'draw' %} {% set is_finished = false %} {% set is_anonymous = not opp and opp_anon %} {% if game.resign == (is_red ? 'red' : 'blue') %} {% set result = 'loss' %} {% set is_finished = true %} {% elseif game.resign == (is_red ? 'blue' : 'red') %} {% set result = 'win' %} {% set is_finished = true %} {% elseif my_points is not null and opp_points is not null %} {% if my_points > opp_points %} {% set result = 'win' %} {% set is_finished = (my_points > 25 or opp_points > 25) %} {% elseif my_points < opp_points %} {% set result = 'loss' %} {% set is_finished = (my_points > 25 or opp_points > 25) %} {% else %} {% set is_finished = (my_points > 25 or opp_points > 25) %} {% endif %} {% endif %}
{% if is_finished %} {{ result == 'win' ? 'Win' : (result == 'loss' ? 'Loss' : 'Draw') }} {% elseif is_anonymous %} Abandoned {% else %} Ongoing {% endif %} {{ my_points ?? '—' }} : {{ opp_points ?? '—' }} vs {% if opp %} {{ opp.username }} {% elseif opp_anon %} {{ opp_anon.userName }} {% else %} Guest {% endif %} {{ game.updated ? game.updated|date('Y-m-d') : '' }}
{% endfor %}
{% if recent|length > 5 %} {% endif %}
{% else %}

No games recorded yet. Start playing!

{% endif %}
{% endblock %} {% block javascripts %} {{ parent() }} {{ vite_entry_script_tags('profile', { dependency: 'react' }) }} {% endblock %}