WebHost: Tracker updates

- use long player names for hint table
- allow multistream link to be updated without page refresh
- add a notice that the tracker is self updating
This commit is contained in:
Fabian Dill 2020-07-29 21:35:31 +02:00
parent 89e1c05ef3
commit daf4ac8117
4 changed files with 34 additions and 30 deletions

View File

@ -25,6 +25,10 @@
margin-right: 1rem; margin-right: 1rem;
} }
#multi-stream-link{
margin-right: 1rem;
}
div.dataTables_wrapper.no-footer .dataTables_scrollBody{ div.dataTables_wrapper.no-footer .dataTables_scrollBody{
border: none; border: none;
} }

View File

@ -43,6 +43,7 @@ window.addEventListener('load', () => {
$(old_table.settings()[0].nScrollBody).scrollTop(topscroll); $(old_table.settings()[0].nScrollBody).scrollTop(topscroll);
$(old_table.settings()[0].nScrollBody).scrollLeft(leftscroll); $(old_table.settings()[0].nScrollBody).scrollLeft(leftscroll);
}); });
$("#multi-stream-link").replaceWith(target.find("#multi-stream-link"));
} else { } else {
console.log("Failed to connect to Server, in order to update Table Data."); console.log("Failed to connect to Server, in order to update Table Data.");
console.log(response); console.log(response);

View File

@ -10,11 +10,11 @@
<div id="tracker-wrapper" data-tracker="{{ room.tracker|suuid }}"> <div id="tracker-wrapper" data-tracker="{{ room.tracker|suuid }}">
<div id="tracker-header-bar"> <div id="tracker-header-bar">
<input placeholder="Search" id="search"/> <input placeholder="Search" id="search"/>
{%- if video -%}<span><a target="_blank" href="https://multistream.me/ <span{% if not video %} hidden{% endif %} id="multi-stream-link"><a target="_blank" href="https://multistream.me/
{%- for platform, link in video.values()|unique(False, 1)-%} {%- for platform, link in video.values()|unique(False, 1)-%}
{%- if platform == "Twitch" -%}t{%- else -%}yt{%- endif -%}:{{- link -}}/ {%- if platform == "Twitch" -%}t{%- else -%}yt{%- endif -%}:{{- link -}}/
{%- endfor -%}">Multistream</a></span> {%- endfor -%}">Multistream</a></span>
{%- endif -%} <span>This tracker will automatically update itself periodically.</span>
</div> </div>
<div id="tables-container"> <div id="tables-container">
{% for team, players in inventory.items() %} {% for team, players in inventory.items() %}
@ -144,7 +144,6 @@
</div> </div>
{% endfor %} {% endfor %}
{% for team, hints in hints.items() %} {% for team, hints in hints.items() %}
{% if hints %}
<div class="table-wrapper"> <div class="table-wrapper">
<table class="table non-unique-item-table"> <table class="table non-unique-item-table">
<thead> <thead>
@ -160,8 +159,8 @@
<tbody> <tbody>
{%- for hint in hints -%} {%- for hint in hints -%}
<tr> <tr>
<td>{{ player_names[team, hint.finding_player] }}</td> <td>{{ long_player_names[team, hint.finding_player] }}</td>
<td>{{ player_names[team, hint.receiving_player] }}</td> <td>{{ long_player_names[team, hint.receiving_player] }}</td>
<td>{{ hint.item|item_name }}</td> <td>{{ hint.item|item_name }}</td>
<td>{{ hint.location|location_name }}</td> <td>{{ hint.location|location_name }}</td>
<td>{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}</td> <td>{% if hint.entrance %}{{ hint.entrance }}{% else %}Vanilla{% endif %}</td>
@ -171,7 +170,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@ -297,9 +297,10 @@ def get_tracker(tracker: UUID):
for team, names in enumerate(names): for team, names in enumerate(names):
for player, name in enumerate(names, 1): for player, name in enumerate(names, 1):
player_names[(team, player)] = name player_names[(team, player)] = name
long_player_names = player_names.copy()
for (team, player), alias in room.multisave.get("name_aliases", []): for (team, player), alias in room.multisave.get("name_aliases", []):
player_names[(team, player)] = alias player_names[(team, player)] = alias
long_player_names[(team, player)] = f"{alias} ({long_player_names[(team, player)]})"
video = {} video = {}
for (team, player), data in room.multisave.get("video", []): for (team, player), data in room.multisave.get("video", []):
@ -312,4 +313,4 @@ def get_tracker(tracker: UUID):
checks_in_area=checks_in_area, activity_timers=activity_timers, checks_in_area=checks_in_area, activity_timers=activity_timers,
key_locations=key_locations, small_key_ids=small_key_ids, big_key_ids=big_key_ids, key_locations=key_locations, small_key_ids=small_key_ids, big_key_ids=big_key_ids,
video=video, big_key_locations=key_locations if use_door_tracker else big_key_locations, video=video, big_key_locations=key_locations if use_door_tracker else big_key_locations,
hints=hints) hints=hints, long_player_names = long_player_names)