FrankProjects/UltimateWarfare

View on GitHub
templates/game/macros/map.html.twig

Summary

Maintainability
Test Coverage
{% macro tileSector(tileData, settings) %}
    <td class="tile" width="125" height="125" background="{{ asset('images/world/sector/' ~ tileData.image) }}">
        {% if tileData.regionCount > 0 %}
            {% if settings.searchPlayerName and settings.searchFound %}
                <a href="{{ path('Game/World/Search/Player', {'sectorId': tileData.id, 'playerName': settings.playerName}) }}">
                    <img src="{{ asset('images/player.gif') }}" alt="Sector {{ tileData.id }}" width="125" height="125" border="0" />
                </a>
            {% elseif settings.searchFree %}
                <div class="worldmaptext">{{ tileData.regionCount }} free regions</div>
                <a href="{{ path('Game/World/Search/Free', {'sectorId': tileData.id}) }}">
                    <img src="{{ asset('images/you.png') }}" alt="Sector {{ tileData.id }}" width="125" height="125" border="0" />
                </a>
            {% else %}
                <a href="{{ path('Game/World/Sector', {'sectorId': tileData.id}) }}">
                    <img src="{{ asset('images/you.png') }}" alt="Sector {{ tileData.id }}" width="125" height="125" border="0" />
                </a>
            {% endif %}
        {% else %}
            <a href="{{ path('Game/World/Sector', {'sectorId': tileData.id}) }}">
                <img src="{{ asset('images/world/sector/' ~ tileData.image) }}" alt="Sector {{ tileData.id }}" width="125" height="125" border="0" />
            </a>
        {% endif %}
    </td>
{% endmacro %}

{% macro tileRegion(tileData, settings, player) %}
    <td class="tile" width="125" height="125" background="{{ asset('images/map/' ~ tileData.type ~ '.jpg') }}">
        <span style="color:white">{{ tileData.x }}, {{ tileData.y }}</span><br />
        {% if tileData.state == 1 %}
            <a href="{{ path('Game/World/Region', {'regionId': tileData.id}) }}">
                <img src="{{ asset('images/world_nuclear.png') }}" alt="Nuclear blast" border="0" />
            </a>
        {% elseif tileData.player == null %}
            <a class="A" href="{{ path('Game/World/Region/Buy', {'regionId': tileData.id}) }}">Buy</a>
        {% elseif tileData.player.id is defined and tileData.player.id == player.id %}
            <a href="{{ path('Game/World/Region', {'regionId': tileData.id}) }}">
                <span style="color:gold"><b>Building<br />{{ player.name }}</b></span>
            </a>
        {% else %}
            <a class="A" href="{{ path('Game/World/Region', {'regionId': tileData.id}) }}">
                <b>Attack<br />{{ tileData.player.name }}</b>
            </a>
        {% endif %}
    </td>
{% endmacro %}