MultiServer: Remove `forced_auto_forfeit` (#1363)
This commit is contained in:
		
							parent
							
								
									0cc83698f9
								
							
						
					
					
						commit
						fe2b431821
					
				|  | @ -135,7 +135,6 @@ class Context: | ||||||
|     item_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]] |     item_name_groups: typing.Dict[str, typing.Dict[str, typing.Set[str]]] | ||||||
|     location_names: typing.Dict[int, str] = Utils.KeyedDefaultDict(lambda code: f'Unknown location (ID:{code})') |     location_names: typing.Dict[int, str] = Utils.KeyedDefaultDict(lambda code: f'Unknown location (ID:{code})') | ||||||
|     all_item_and_group_names: typing.Dict[str, typing.Set[str]] |     all_item_and_group_names: typing.Dict[str, typing.Set[str]] | ||||||
|     forced_auto_forfeits: typing.Dict[str, bool] |  | ||||||
|     non_hintable_names: typing.Dict[str, typing.Set[str]] |     non_hintable_names: typing.Dict[str, typing.Set[str]] | ||||||
| 
 | 
 | ||||||
|     def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int, |     def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int, | ||||||
|  | @ -205,7 +204,6 @@ class Context: | ||||||
|         self.gamespackage = {} |         self.gamespackage = {} | ||||||
|         self.item_name_groups = {} |         self.item_name_groups = {} | ||||||
|         self.all_item_and_group_names = {} |         self.all_item_and_group_names = {} | ||||||
|         self.forced_auto_forfeits = collections.defaultdict(lambda: False) |  | ||||||
|         self.non_hintable_names = collections.defaultdict(frozenset) |         self.non_hintable_names = collections.defaultdict(frozenset) | ||||||
| 
 | 
 | ||||||
|         self._load_game_data() |         self._load_game_data() | ||||||
|  | @ -218,7 +216,6 @@ class Context: | ||||||
|         self.item_name_groups = {world_name: world.item_name_groups for world_name, world in |         self.item_name_groups = {world_name: world.item_name_groups for world_name, world in | ||||||
|                                  worlds.AutoWorldRegister.world_types.items()} |                                  worlds.AutoWorldRegister.world_types.items()} | ||||||
|         for world_name, world in worlds.AutoWorldRegister.world_types.items(): |         for world_name, world in worlds.AutoWorldRegister.world_types.items(): | ||||||
|             self.forced_auto_forfeits[world_name] = world.forced_auto_forfeit |  | ||||||
|             self.non_hintable_names[world_name] = world.hint_blacklist |             self.non_hintable_names[world_name] = world.hint_blacklist | ||||||
| 
 | 
 | ||||||
|     def _init_game_data(self): |     def _init_game_data(self): | ||||||
|  | @ -662,8 +659,6 @@ class Context: | ||||||
|             collect_player(self, client.team, client.slot) |             collect_player(self, client.team, client.slot) | ||||||
|         if "auto" in self.release_mode: |         if "auto" in self.release_mode: | ||||||
|             release_player(self, client.team, client.slot) |             release_player(self, client.team, client.slot) | ||||||
|         elif self.forced_auto_forfeits[self.games[client.slot]]: |  | ||||||
|             release_player(self, client.team, client.slot) |  | ||||||
|         self.save()  # save goal completion flag |         self.save()  # save goal completion flag | ||||||
| 
 | 
 | ||||||
|     def on_new_hint(self, team: int, slot: int): |     def on_new_hint(self, team: int, slot: int): | ||||||
|  |  | ||||||
|  | @ -12,12 +12,12 @@ import threading | ||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
| import websockets | import websockets | ||||||
| from pony.orm import db_session, commit, select | from pony.orm import commit, db_session, select | ||||||
| 
 | 
 | ||||||
| import Utils | import Utils | ||||||
| from MultiServer import Context, server, auto_shutdown, ServerCommandProcessor, ClientMessageProcessor | from MultiServer import ClientMessageProcessor, Context, ServerCommandProcessor, auto_shutdown, server | ||||||
| from Utils import get_public_ipv4, get_public_ipv6, restricted_loads, cache_argsless | from Utils import cache_argsless, get_public_ipv4, get_public_ipv6, restricted_loads | ||||||
| from .models import Room, Command, db | from .models import Command, Room, db | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class CustomClientMessageProcessor(ClientMessageProcessor): | class CustomClientMessageProcessor(ClientMessageProcessor): | ||||||
|  | @ -66,7 +66,6 @@ class WebHostContext(Context): | ||||||
|     def _load_game_data(self): |     def _load_game_data(self): | ||||||
|         for key, value in self.static_server_data.items(): |         for key, value in self.static_server_data.items(): | ||||||
|             setattr(self, key, value) |             setattr(self, key, value) | ||||||
|         self.forced_auto_forfeits = collections.defaultdict(lambda: False, self.forced_auto_forfeits) |  | ||||||
|         self.non_hintable_names = collections.defaultdict(frozenset, self.non_hintable_names) |         self.non_hintable_names = collections.defaultdict(frozenset, self.non_hintable_names) | ||||||
| 
 | 
 | ||||||
|     def listen_to_db_commands(self): |     def listen_to_db_commands(self): | ||||||
|  | @ -126,7 +125,6 @@ def get_random_port(): | ||||||
| def get_static_server_data() -> dict: | def get_static_server_data() -> dict: | ||||||
|     import worlds |     import worlds | ||||||
|     data = { |     data = { | ||||||
|         "forced_auto_forfeits": {}, |  | ||||||
|         "non_hintable_names": {}, |         "non_hintable_names": {}, | ||||||
|         "gamespackage": worlds.network_data_package["games"], |         "gamespackage": worlds.network_data_package["games"], | ||||||
|         "item_name_groups": {world_name: world.item_name_groups for world_name, world in |         "item_name_groups": {world_name: world.item_name_groups for world_name, world in | ||||||
|  | @ -134,7 +132,6 @@ def get_static_server_data() -> dict: | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     for world_name, world in worlds.AutoWorldRegister.world_types.items(): |     for world_name, world in worlds.AutoWorldRegister.world_types.items(): | ||||||
|         data["forced_auto_forfeits"][world_name] = world.forced_auto_forfeit |  | ||||||
|         data["non_hintable_names"][world_name] = world.hint_blacklist |         data["non_hintable_names"][world_name] = world.hint_blacklist | ||||||
| 
 | 
 | ||||||
|     return data |     return data | ||||||
|  |  | ||||||
|  | @ -160,10 +160,6 @@ class World(metaclass=AutoWorldRegister): | ||||||
| 
 | 
 | ||||||
|     hint_blacklist: ClassVar[FrozenSet[str]] = frozenset()  # any names that should not be hintable |     hint_blacklist: ClassVar[FrozenSet[str]] = frozenset()  # any names that should not be hintable | ||||||
| 
 | 
 | ||||||
|     # For games where after a victory it is impossible to go back in and get additional/remaining Locations checked. |  | ||||||
|     # this forces forfeit:  auto for those games. |  | ||||||
|     forced_auto_forfeit: bool = False |  | ||||||
| 
 |  | ||||||
|     # Hide World Type from various views. Does not remove functionality. |     # Hide World Type from various views. Does not remove functionality. | ||||||
|     hidden: ClassVar[bool] = False |     hidden: ClassVar[bool] = False | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,12 +1,12 @@ | ||||||
| import string | import string | ||||||
| from typing import Dict, List | from typing import Dict, List | ||||||
| from .Items import RiskOfRainItem, item_table, item_pool_weights |  | ||||||
| from .Locations import RiskOfRainLocation, item_pickups |  | ||||||
| from .Rules import set_rules |  | ||||||
| 
 | 
 | ||||||
| from BaseClasses import Region, RegionType, Entrance, Item, ItemClassification, MultiWorld, Tutorial | from BaseClasses import Entrance, Item, ItemClassification, MultiWorld, Region, RegionType, Tutorial | ||||||
| from .Options import ror2_options, ItemWeights | from worlds.AutoWorld import WebWorld, World | ||||||
| from worlds.AutoWorld import World, WebWorld | from .Items import RiskOfRainItem, item_pool_weights, item_table | ||||||
|  | from .Locations import RiskOfRainLocation, item_pickups | ||||||
|  | from .Options import ItemWeights, ror2_options | ||||||
|  | from .Rules import set_rules | ||||||
| 
 | 
 | ||||||
| client_version = 1 | client_version = 1 | ||||||
| 
 | 
 | ||||||
|  | @ -36,7 +36,6 @@ class RiskOfRainWorld(World): | ||||||
|     location_name_to_id = item_pickups |     location_name_to_id = item_pickups | ||||||
| 
 | 
 | ||||||
|     data_version = 4 |     data_version = 4 | ||||||
|     forced_auto_forfeit = True |  | ||||||
|     web = RiskOfWeb() |     web = RiskOfWeb() | ||||||
|     total_revivals: int |     total_revivals: int | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,12 +1,12 @@ | ||||||
| import string | import string | ||||||
| 
 | 
 | ||||||
| from BaseClasses import Item, MultiWorld, Region, Location, Entrance, Tutorial, ItemClassification, RegionType | from BaseClasses import Entrance, Item, ItemClassification, Location, MultiWorld, Region, RegionType, Tutorial | ||||||
| from .Items import item_table, item_pool, event_item_pairs | from .Items import event_item_pairs, item_pool, item_table | ||||||
| from .Locations import location_table | from .Locations import location_table | ||||||
|  | from .Options import spire_options | ||||||
| from .Regions import create_regions | from .Regions import create_regions | ||||||
| from .Rules import set_rules | from .Rules import set_rules | ||||||
| from ..AutoWorld import World, WebWorld | from ..AutoWorld import WebWorld, World | ||||||
| from .Options import spire_options |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class SpireWeb(WebWorld): | class SpireWeb(WebWorld): | ||||||
|  | @ -36,8 +36,6 @@ class SpireWorld(World): | ||||||
|     item_name_to_id = {name: data.code for name, data in item_table.items()} |     item_name_to_id = {name: data.code for name, data in item_table.items()} | ||||||
|     location_name_to_id = location_table |     location_name_to_id = location_table | ||||||
| 
 | 
 | ||||||
|     forced_auto_forfeit = True |  | ||||||
| 
 |  | ||||||
|     def _get_slot_data(self): |     def _get_slot_data(self): | ||||||
|         return { |         return { | ||||||
|             'seed': "".join(self.multiworld.slot_seeds[self.player].choice(string.ascii_letters) for i in range(16)), |             'seed': "".join(self.multiworld.slot_seeds[self.player].choice(string.ascii_letters) for i in range(16)), | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue