FrankProjects/UltimateWarfare

View on GitHub
templates/game/headquarter.html.twig

Summary

Maintainability
Test Coverage
{% extends 'game.html.twig' %}

{% block title %}Ultimate Warfare - Headquarter{% endblock title %}

{% block content %}
<p class="text-center">
    Advanced stats: <a class="B" href="{{ path('Game/Headquarter/Income') }}">Income</a> - <a class="B" href="{{ path('Game/Headquarter/Army') }}">Army</a> - <a class="B" href="{{ path('Game/Headquarter/Infrastructure') }}">Infrastructure</a>
</p>

{% if (player.income.food - player.upkeep.food) < 0 and (player.resources.food + (player.income.food - player.upkeep.food)) < 0 %}
    {% set runout_food_seconds = 0 - (player.resources.food / (player.income.food - player.upkeep.food)) * 3600 %}
<table class="table text-center">
    <tr>
        <td>
            <br />
            {% if runout_food_seconds == 0 %}
                <b>You don't have enough food to feed your Population</b><br />
                You will lose 30% of your population every hour!<br /><br />

                <b>You don't have enough food to feed your army</b><br />
                You will lose 10% of your army every hour!
            {% else %}
                You don't have enough food to feed your Population in <b>{{ runout_food_seconds }} Seconds from now!</b><br />
                Once you hit 0 food, you will lose 30% of your population and 10% of your army every hour!
            {% endif %}
            <br />
            <br />
        </td>
    </tr>
</table>
<br />

{% endif %}

{% if (player.income.cash - player.upkeep.cash) < 0 and (player.resources.cash + (player.income.cash - player.upkeep.cash)) < 0 %}
    {% set runout_cash_seconds = 0 - (player.resources.cash / (player.income.cash - player.upkeep.cash)) * 3600 %}
<table class="table text-center">
    <tr>
        <td>
            <br />
            {% if runout_cash_seconds == 0 %}
                <b>You don't have enough cash to pay your army</b><br />
                You will lose 10% of your army every hour!
            {% else %}
                You don't have enough cash to pay your army in <b>{{ runout_cash_seconds }} Seconds from now!</b><br />
                Once you hit 0 cash, you will lose 10% of your army every hour!
            {% endif %}
            <br />
            <br />
        </td>
    </tr>
</table>
<br />

{% endif %}
    <table class="table text-center">
        <tr class="tabletop">
            <td><b>Headquarter</b></td>
        </tr>
        <tr>
            <td>
                <b>Adviser:</b>
                <br />
                Welcome  <strong>{{ player.name }}</strong>,
                <br />
                You are currently in your headquarters, this is where all the money in your empire is stored! <br />
                From this headquarters you can control your land, your countries and your world! <br />
                <br />
            </td>
        </tr>
    </table>

    <br />

    <table class="table text-center">
        <tr class="tabletop">
            <td colspan="3"><b>Status</b></td>
        </tr>

        <tr>
            <td width="150">Cash:</td>
            <td width="250">$ {{ player.resources.cash|number_format }}</td>
            <td width="300" rowspan="8">
                <b>Ingame Announcements:</b>
                <br />
                No news for now...
            </td>
        </tr>
        <tr>
            <td width="150">Wood:</td>
            <td width="250">{{ player.resources.wood|number_format }}</td>
        </tr>
        <tr>
            <td width="150">Steel:</td>
            <td width="250">{{ player.resources.steel|number_format }}</td>
        </tr>
        <tr>
            <td width="150">Food:</td>
            <td width="250">{{ player.resources.food|number_format }}</td>
        </tr>
        <tr>
            <td width="150">Population:</td>
            <td width="250">-</td>
        </tr>
        <tr>
            <td width="150">Regions:</td>
            <td width="250">{{ player.worldRegions|length }}</td>
        </tr>
        <tr>
            <td width="150">Networth:</td>
            <td width="250">{{ player.networth|number_format }}</td>
        </tr>
        <tr>
            <td width="150">Server time:</td>
            <td width="250">{{ "now"|date("Y-m-d H:i:s") }}</td>
        </tr>
    </table>
    <br />
    <br />

    <table class="table text-center">
        <tr class="tabletop">
            <td colspan="2"><b>Recent Reports (Last 10) </b></td>
        </tr>
        <tr>
            <td width="150"><b>Date</b></td>
            <td class="text-start" width="550"><b>Report</b></td>
        </tr>
        {% for report in reports %}
            <tr>
                <td>
                    {{ report.timestamp|date }}
                </td>
                <td class="text-start">
                    {{ report.report }}
                </td>
            </tr>

        {% else %}
            <tr><td colspan="2">No reports for you....</td></tr>
        {% endfor %}
    </table>
{% endblock %}