Core: remove "names" from multidata (#1928)
This commit is contained in:
parent
e920692ec3
commit
d8a8997684
1
Main.py
1
Main.py
|
@ -368,7 +368,6 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
|
|||
multidata = {
|
||||
"slot_data": slot_data,
|
||||
"slot_info": slot_info,
|
||||
"names": names, # TODO: remove after 0.3.9
|
||||
"connect_names": {name: (0, player) for player, name in world.player_name.items()},
|
||||
"locations": locations_data,
|
||||
"checks_in_area": checks_in_area,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import collections
|
||||
import datetime
|
||||
import typing
|
||||
from typing import Counter, Optional, Dict, Any, Tuple
|
||||
from typing import Counter, Optional, Dict, Any, Tuple, List
|
||||
from uuid import UUID
|
||||
|
||||
from flask import render_template
|
||||
|
@ -9,7 +9,7 @@ from jinja2 import pass_context, runtime
|
|||
from werkzeug.exceptions import abort
|
||||
|
||||
from MultiServer import Context, get_saving_second
|
||||
from NetUtils import SlotType
|
||||
from NetUtils import SlotType, NetworkSlot
|
||||
from Utils import restricted_loads
|
||||
from worlds import lookup_any_item_id_to_name, lookup_any_location_id_to_name, network_data_package
|
||||
from worlds.alttp import Items
|
||||
|
@ -264,16 +264,17 @@ def get_static_room_data(room: Room):
|
|||
multidata = Context.decompress(room.seed.multidata)
|
||||
# in > 100 players this can take a bit of time and is the main reason for the cache
|
||||
locations: Dict[int, Dict[int, Tuple[int, int, int]]] = multidata['locations']
|
||||
names: Dict[int, Dict[int, str]] = multidata["names"]
|
||||
games = {}
|
||||
names: List[List[str]] = multidata.get("names", [])
|
||||
games = multidata.get("games", {})
|
||||
groups = {}
|
||||
custom_locations = {}
|
||||
custom_items = {}
|
||||
if "slot_info" in multidata:
|
||||
games = {slot: slot_info.game for slot, slot_info in multidata["slot_info"].items()}
|
||||
groups = {slot: slot_info.group_members for slot, slot_info in multidata["slot_info"].items()
|
||||
slot_info_dict: Dict[int, NetworkSlot] = multidata["slot_info"]
|
||||
games = {slot: slot_info.game for slot, slot_info in slot_info_dict.items()}
|
||||
groups = {slot: slot_info.group_members for slot, slot_info in slot_info_dict.items()
|
||||
if slot_info.type == SlotType.group}
|
||||
|
||||
names = [[slot_info.name for slot, slot_info in sorted(slot_info_dict.items())]]
|
||||
for game in games.values():
|
||||
if game not in multidata["datapackage"]:
|
||||
continue
|
||||
|
@ -290,8 +291,7 @@ def get_static_room_data(room: Room):
|
|||
{id_: name for name, id_ in game_data["location_name_to_id"].items()})
|
||||
custom_items.update(
|
||||
{id_: name for name, id_ in game_data["item_name_to_id"].items()})
|
||||
elif "games" in multidata:
|
||||
games = multidata["games"]
|
||||
|
||||
seed_checks_in_area = checks_in_area.copy()
|
||||
|
||||
use_door_tracker = False
|
||||
|
@ -341,7 +341,7 @@ def _get_player_tracker(tracker: UUID, tracked_team: int, tracked_player: int, w
|
|||
precollected_items, games, slot_data, groups, saving_second, custom_locations, custom_items = \
|
||||
get_static_room_data(room)
|
||||
player_name = names[tracked_team][tracked_player - 1]
|
||||
location_to_area = player_location_to_area[tracked_player]
|
||||
location_to_area = player_location_to_area.get(tracked_player, {})
|
||||
inventory = collections.Counter()
|
||||
checks_done = {loc_name: 0 for loc_name in default_locations}
|
||||
|
||||
|
@ -373,7 +373,9 @@ def _get_player_tracker(tracker: UUID, tracked_team: int, tracked_player: int, w
|
|||
if recipient in slots_aimed_at_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
|
||||
area_name = location_to_area.get(location, None)
|
||||
if area_name:
|
||||
checks_done[area_name] += 1
|
||||
checks_done["Total"] += 1
|
||||
specific_tracker = game_specific_trackers.get(games[tracked_player], None)
|
||||
if specific_tracker and not want_generic:
|
||||
|
@ -1508,8 +1510,8 @@ def get_LttP_multiworld_tracker(tracker: UUID):
|
|||
checks_done[team][player][player_location_to_area[player][location]] += 1
|
||||
checks_done[team][player]["Total"] += 1
|
||||
percent_total_checks_done[team][player] = int(
|
||||
checks_done[team][player]["Total"] / seed_checks_in_area[player]["Total"] * 100) if \
|
||||
seed_checks_in_area[player]["Total"] else 100
|
||||
checks_done[team][player]["Total"] / len(player_locations) * 100) if \
|
||||
player_locations else 100
|
||||
|
||||
for (team, player), game_state in multisave.get("client_game_state", {}).items():
|
||||
if player in groups:
|
||||
|
|
Loading…
Reference in New Issue