fixes for solo tracker
This commit is contained in:
parent
94b25112cd
commit
11e1125044
2
Main.py
2
Main.py
|
@ -35,6 +35,8 @@ def get_seed(seed=None):
|
|||
|
||||
|
||||
seeds: Dict[tuple, str] = dict()
|
||||
|
||||
|
||||
def get_same_seed(world: World, seed_def: tuple) -> str:
|
||||
if seed_def in seeds:
|
||||
return seeds[seed_def]
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<tbody>
|
||||
{%- for player, checks in players.items() -%}
|
||||
<tr>
|
||||
<td><a href="{{ room.tracker|suuid }}/{{ team + 1 }}/{{ player }}">{{ loop.index }}</a></td>
|
||||
<td><a href="{{ room.tracker|suuid }}/{{ team }}/{{ player }}">{{ loop.index }}</a></td>
|
||||
<td>{{ player_names[(team, loop.index)]|e }}</td>
|
||||
{%- for area in ordered_areas -%}
|
||||
{%- set checks_done = checks[area] -%}
|
||||
|
|
|
@ -166,7 +166,7 @@ tracking_names = ["Progressive Sword", "Progressive Bow", "Book of Mudora", "Ham
|
|||
"Red Boomerang", "Bug Catching Net", "Cape", "Shovel", "Lamp",
|
||||
"Mushroom", "Magic Powder",
|
||||
"Cane of Somaria", "Cane of Byrna", "Fire Rod", "Ice Rod", "Bombos", "Ether", "Quake",
|
||||
"Bottle", "Triforce"] # TODO make sure this list has what we need and sort it better
|
||||
"Bottle", "Triforce"]
|
||||
|
||||
default_locations = {
|
||||
'Light World': {1572864, 1572865, 60034, 1572867, 1572868, 60037, 1572869, 1572866, 60040, 59788, 60046, 60175,
|
||||
|
@ -325,11 +325,11 @@ def get_static_room_data(room: Room):
|
|||
return result
|
||||
|
||||
|
||||
@app.route('/tracker/<suuid:tracker>/<int:team>/<int:player>')
|
||||
@app.route('/tracker/<suuid:tracker>/<int:tracked_team>/<int:tracked_player>')
|
||||
@cache.memoize(timeout=15)
|
||||
def getPlayerTracker(tracker: UUID, team: int, player: int):
|
||||
def getPlayerTracker(tracker: UUID, tracked_team: int, tracked_player: int):
|
||||
# Team and player must be positive and greater than zero
|
||||
if team < 1 or player < 1:
|
||||
if tracked_team < 0 or tracked_player < 1:
|
||||
abort(404)
|
||||
|
||||
room = Room.get(tracker=tracker)
|
||||
|
@ -338,14 +338,14 @@ def getPlayerTracker(tracker: UUID, team: int, player: int):
|
|||
|
||||
# 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)
|
||||
player_name = names[team - 1][player - 1]
|
||||
seed_checks_in_area = seed_checks_in_area[player]
|
||||
player_location_to_area = player_location_to_area[player]
|
||||
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]
|
||||
inventory = collections.Counter()
|
||||
checks_done = {loc_name: 0 for loc_name in default_locations}
|
||||
|
||||
# Add starting items to inventory
|
||||
starting_items = room.seed.multidata.get("precollected_items", None)[player - 1]
|
||||
starting_items = room.seed.multidata.get("precollected_items", None)[tracked_player - 1]
|
||||
if starting_items:
|
||||
for item_id in starting_items:
|
||||
attribute_item_solo(inventory, item_id)
|
||||
|
@ -354,26 +354,24 @@ def getPlayerTracker(tracker: UUID, team: int, player: int):
|
|||
for (ms_team, ms_player), locations_checked in room.multisave.get("location_checks", {}):
|
||||
# logging.info(f"{ms_team}, {ms_player}, {locations_checked}")
|
||||
# Skip teams and players not matching the request
|
||||
if ms_team != (team - 1):
|
||||
continue
|
||||
|
||||
# If the player does not have the item, do nothing
|
||||
for location in locations_checked:
|
||||
if (location, ms_player) not in locations or location not in player_location_to_area:
|
||||
continue
|
||||
if ms_team == tracked_team:
|
||||
# If the player does not have the item, do nothing
|
||||
for location in locations_checked:
|
||||
if (location, ms_player) not in locations:
|
||||
continue
|
||||
|
||||
item, recipient = locations[location, ms_player]
|
||||
if recipient == player:
|
||||
attribute_item_solo(inventory, item)
|
||||
if ms_player != player:
|
||||
continue
|
||||
checks_done[player_location_to_area[location]] += 1
|
||||
checks_done["Total"] += 1
|
||||
item, recipient = locations[location, ms_player]
|
||||
if recipient == tracked_player: # a check done for the tracked player
|
||||
attribute_item_solo(inventory, item)
|
||||
if ms_player == tracked_player: # a check done by the tracked player
|
||||
checks_done[location_to_area[location]] += 1
|
||||
checks_done["Total"] += 1
|
||||
|
||||
# Note the presence of the triforce item
|
||||
for (ms_team, ms_player), game_state in room.multisave.get("client_game_state", []):
|
||||
# Skip teams and players not matching the request
|
||||
if ms_team != (team - 1) or ms_player != player:
|
||||
if ms_team != tracked_team or ms_player != tracked_player:
|
||||
continue
|
||||
|
||||
if game_state:
|
||||
|
|
Loading…
Reference in New Issue