Add actual tracking of player small keys/big keys
This commit is contained in:
parent
ed77f93b6f
commit
a86238d741
|
@ -9,7 +9,7 @@
|
|||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
padding: 3px 3px 10px;
|
||||
width: 260px;
|
||||
width: 284px;
|
||||
background-color: #42b149;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
|
||||
#location-table{
|
||||
width: 260px;
|
||||
width: 284px;
|
||||
border-left: 2px solid #000000;
|
||||
border-right: 2px solid #000000;
|
||||
border-bottom: 2px solid #000000;
|
||||
|
@ -61,7 +61,7 @@
|
|||
}
|
||||
|
||||
#location-table td.counter{
|
||||
padding-right: 10px;
|
||||
padding-right: 8px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,14 +242,18 @@ for item in tracking_names:
|
|||
|
||||
small_key_ids = {}
|
||||
big_key_ids = {}
|
||||
ids_small_key = {}
|
||||
ids_big_key = {}
|
||||
|
||||
for item_name, data in Items.item_table.items():
|
||||
if "Key" in item_name:
|
||||
area = item_name.split("(")[1][:-1]
|
||||
if "Small" in item_name:
|
||||
small_key_ids[area] = data[2]
|
||||
ids_small_key[data[2]] = area
|
||||
else:
|
||||
big_key_ids[area] = data[2]
|
||||
ids_big_key[data[2]] = area
|
||||
|
||||
from MultiServer import get_item_name_from_id
|
||||
|
||||
|
@ -320,7 +324,16 @@ def get_static_room_data(room: Room):
|
|||
for playernumber in range(1, len(names[0]) + 1)}
|
||||
player_location_to_area = {playernumber: get_location_table(multidata["checks_in_area"][f'{playernumber}'])
|
||||
for playernumber in range(1, len(names[0]) + 1)}
|
||||
result = locations, names, use_door_tracker, player_checks_in_area, player_location_to_area
|
||||
|
||||
player_big_key_locations = {playernumber: set() for playernumber in range(1, len(names[0]) + 1)}
|
||||
player_small_key_locations = {playernumber: set() for playernumber in range(1, len(names[0]) + 1)}
|
||||
for _, (item_id, item_player) in multidata["locations"]:
|
||||
if item_id in ids_big_key:
|
||||
player_big_key_locations[item_player].add(ids_big_key[item_id])
|
||||
if item_id in ids_small_key:
|
||||
player_small_key_locations[item_player].add(ids_small_key[item_id])
|
||||
|
||||
result = locations, names, use_door_tracker, player_checks_in_area, player_location_to_area, player_big_key_locations, player_small_key_locations
|
||||
_multidata_cache[room.seed.id] = result
|
||||
return result
|
||||
|
||||
|
@ -337,7 +350,7 @@ def getPlayerTracker(tracker: UUID, tracked_team: int, tracked_player: int):
|
|||
abort(404)
|
||||
|
||||
# Collect seed information and pare it down to a single player
|
||||
locations, names, use_door_tracker, seed_checks_in_area, player_location_to_area = get_static_room_data(room)
|
||||
locations, names, use_door_tracker, seed_checks_in_area, player_location_to_area, player_big_key_locations, player_small_key_locations = get_static_room_data(room)
|
||||
player_name = names[tracked_team][tracked_player - 1]
|
||||
seed_checks_in_area = seed_checks_in_area[tracked_player]
|
||||
location_to_area = player_location_to_area[tracked_player]
|
||||
|
@ -462,8 +475,9 @@ def getPlayerTracker(tracker: UUID, tracked_team: int, tracked_player: int):
|
|||
sword_url=sword_url, sword_acquired=sword_acquired, gloves_url=gloves_url,
|
||||
gloves_acquired=gloves_acquired, bow_url=bow_url, bow_acquired=bow_acquired,
|
||||
small_key_ids=small_key_ids, big_key_ids=big_key_ids, sp_areas=sp_areas,
|
||||
key_locations=key_locations, big_key_locations=big_key_locations, mail_url=mail_url,
|
||||
shield_url=shield_url, shield_acquired=shield_acquired)
|
||||
key_locations=player_small_key_locations[tracked_player],
|
||||
big_key_locations=player_big_key_locations[tracked_player],
|
||||
mail_url=mail_url, shield_url=shield_url, shield_acquired=shield_acquired)
|
||||
|
||||
|
||||
@app.route('/tracker/<suuid:tracker>')
|
||||
|
@ -472,7 +486,7 @@ def getTracker(tracker: UUID):
|
|||
room = Room.get(tracker=tracker)
|
||||
if not room:
|
||||
abort(404)
|
||||
locations, names, use_door_tracker, seed_checks_in_area, player_location_to_area = get_static_room_data(room)
|
||||
locations, names, use_door_tracker, seed_checks_in_area, player_location_to_area, player_big_key_locations, player_small_key_locations = get_static_room_data(room)
|
||||
|
||||
inventory = {teamnumber: {playernumber: collections.Counter() for playernumber in range(1, len(team) + 1)}
|
||||
for teamnumber, team in enumerate(names)}
|
||||
|
|
Loading…
Reference in New Issue