{% macro list_rooms(rooms) -%}
    <ul>
        {% for room in rooms %}
            <li><a href="{{ url_for("host_room", room=room.id) }}">Room #{{ room.id|suuid }}</a></li>
        {% endfor %}
        {{ caller() }}
    </ul>
{%- endmacro %}
{% macro list_patches_room(room) %}
    {% if room.seed.slots %}
        <table id="slots-table">
            <thead>
                <tr>
                    <th>Id</th>
                    <th>Name</th>
                    <th>Game</th>
                    <th>Download Link</th>
                    <th>Tracker Page</th>
                </tr>
            </thead>
            <tbody>
            {% for patch in room.seed.slots|list|sort(attribute="player_id") %}
                <tr>
                    <td>{{ patch.player_id }}</td>
                    <td data-tooltip="Connect via Game Client"><a href="archipelago://{{ patch.player_name | e}}:None@{{ config['HOST_ADDRESS'] }}:{{ room.last_port }}?game={{ patch.game }}&room={{ room.id | suuid }}">{{ patch.player_name }}</a></td>
                    <td>{{ patch.game }}</td>
                    <td>
                        {% if patch.data %}
                            {% if patch.game == "VVVVVV" and room.seed.slots|length == 1 %}
                            <a href="{{ url_for("download_slot_file", room_id=room.id, player_id=patch.player_id) }}" download>
                                Download APV6 File...</a>
                            {% elif patch.game == "Super Mario 64" and room.seed.slots|length == 1 %}
                            <a href="{{ url_for("download_slot_file", room_id=room.id, player_id=patch.player_id) }}" download>
                                Download APSM64EX File...</a>
                            {% elif patch.game == "Factorio" %}
                            <a href="{{ url_for("download_slot_file", room_id=room.id, player_id=patch.player_id) }}" download>
                                Download Factorio Mod...</a>
                            {% elif patch.game | is_applayercontainer(patch.data, patch.player_id) %}
                            <a href="{{ url_for("download_patch", patch_id=patch.id, room_id=room.id) }}" download>
                                Download Patch File...</a>
                            {% else %}
                                No file to download for this game.
                            {% endif %}
                        {% else %}
                            No file to download for this game.
                        {% endif %}
                    </td>
                    <td><a href="{{ url_for("get_player_tracker", tracker=room.tracker, tracked_team=0, tracked_player=patch.player_id) }}">Tracker</a></td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% endif %}
{%- endmacro -%}
