Network: implement 0.4 marked compatibility removals (#757)

* world remote items handling
* players list when connecting
This commit is contained in:
Fabian Dill
2022-12-11 02:59:17 +01:00
committed by GitHub
parent ce42fda85f
commit 2cdd03f786
20 changed files with 27 additions and 108 deletions

View File

@@ -160,18 +160,6 @@ class World(metaclass=AutoWorldRegister):
hint_blacklist: ClassVar[FrozenSet[str]] = frozenset() # any names that should not be hintable
# NOTE: remote_items and remote_start_inventory are now available in the network protocol for the client to set.
# These values will be removed.
# if a world is set to remote_items, then it just needs to send location checks to the server and the server
# sends back the items
# if a world is set to remote_items = False, then the server never sends an item where receiver == finder,
# the client finds its own items in its own world.
remote_items: bool = True
# If remote_start_inventory is true, the start_inventory/world.precollected_items is sent on connection,
# otherwise the world implementation is in charge of writing the items to their output data.
remote_start_inventory: bool = True
# 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

View File

@@ -81,13 +81,11 @@ for world_name, world in AutoWorldRegister.world_types.items():
lookup_any_location_id_to_name.update(world.location_id_to_name)
network_data_package: DataPackage = {
"version": sum(world.data_version for world in AutoWorldRegister.world_types.values()),
"games": games,
}
# Set entire datapackage to version 0 if any of them are set to 0
if any(not world.data_version for world in AutoWorldRegister.world_types.values()):
network_data_package["version"] = 0
import logging
logging.warning(f"Datapackage is in custom mode. Custom Worlds: "

View File

@@ -795,11 +795,11 @@ def patch_rom(world, rom, player, enemized):
itemid = 0x33
elif location.item.compass:
itemid = 0x25
if world.worlds[player].remote_items: # remote items does not currently work
itemid = list(location_table.keys()).index(location.name) + 1
assert itemid < 0x100
rom.write_byte(location.player_address, 0xFF)
elif location.item.player != player:
# if world.worlds[player].remote_items: # remote items does not currently work
# itemid = list(location_table.keys()).index(location.name) + 1
# assert itemid < 0x100
# rom.write_byte(location.player_address, 0xFF)
if location.item.player != player:
if location.player_address is not None:
rom.write_byte(location.player_address, min(location.item.player, ROM_PLAYER_LIMIT))
else:
@@ -1654,7 +1654,7 @@ def patch_rom(world, rom, player, enemized):
write_strings(rom, world, player)
# remote items flag, does not currently work
rom.write_byte(0x18637C, int(world.worlds[player].remote_items))
rom.write_byte(0x18637C, 0)
# set rom name
# 21 bytes

View File

@@ -121,8 +121,6 @@ class ALTTPWorld(World):
location_name_to_id = lookup_name_to_id
data_version = 8
remote_items: bool = False
remote_start_inventory: bool = False
required_client_version = (0, 3, 2)
web = ALTTPWeb()

View File

@@ -51,8 +51,6 @@ class DarkSouls3World(World):
game: str = "Dark Souls III"
option_definitions = dark_souls_options
topology_present: bool = True
remote_items: bool = False
remote_start_inventory: bool = False
web = DarkSouls3Web()
data_version = 4
base_id = 100000

View File

@@ -30,9 +30,7 @@ class FF1World(World):
option_definitions = ff1_options
game = "Final Fantasy"
topology_present = False
remote_items = True
data_version = 2
remote_start_inventory = True
ff1_items = FF1Items()
ff1_locations = FF1Locations()

View File

@@ -36,8 +36,6 @@ class Hylics2World(World):
option_definitions = Options.hylics2_options
topology_present: bool = True
remote_items: bool = True
remote_start_inventory: bool = True
data_version: 1

View File

@@ -102,8 +102,6 @@ class OOTWorld(World):
item_name_to_id = {item_name: oot_data_to_ap_id(data, False) for item_name, data in item_table.items() if
data[2] is not None}
location_name_to_id = location_name_to_id
remote_items: bool = False
remote_start_inventory: bool = False
web = OOTWeb()
data_version = 2

View File

@@ -49,8 +49,6 @@ class Overcooked2World(World):
required_client_version = (0, 3, 4)
option_definitions = overcooked_options
topology_present: bool = False
remote_items: bool = True
remote_start_inventory: bool = False
data_version = 2
item_name_to_id = item_name_to_id

View File

@@ -38,9 +38,10 @@ class PokemonRedBlueWorld(World):
# -MuffinJets#4559
game = "Pokemon Red and Blue"
option_definitions = pokemon_rb_options
remote_items = False
data_version = 3
required_client_version = (0, 3, 7)
topology_present = False

View File

@@ -93,9 +93,6 @@ class SMWorld(World):
location_name_to_id = {key: locations_start_id + value.Id for key, value in locationsDict.items() if value.Id != None}
web = SMWeb()
remote_items: bool = False
remote_start_inventory: bool = False
# changes to client DeathLink handling for 0.2.1
# changes to client Remote Item handling for 0.2.6
required_client_version = (0, 2, 6)

View File

@@ -76,9 +76,6 @@ class SMZ3World(World):
for key, value in TotalSMZ3World(Config(), "", 0, "").locationLookup.items()}
web = SMZ3Web()
remote_items: bool = False
remote_start_inventory: bool = False
locationNamesGT: Set[str] = {loc.Name for loc in GanonsTower(None, None).Locations}
# first added for 0.2.6
@@ -485,9 +482,9 @@ class SMZ3World(World):
return False
def create_item(self, name: str) -> Item:
return SMZ3Item(name,
return SMZ3Item(name,
ItemClassification.progression if SMZ3World.isProgression(TotalSMZ3Item.ItemType[name]) else ItemClassification.filler,
TotalSMZ3Item.ItemType[name], self.item_name_to_id[name],
TotalSMZ3Item.ItemType[name], self.item_name_to_id[name],
self.player,
TotalSMZ3Item.Item(TotalSMZ3Item.ItemType[name], self))

View File

@@ -153,7 +153,6 @@ class SoEWorld(World):
game: str = "Secret of Evermore"
option_definitions = soe_options
topology_present = False
remote_items = False
data_version = 4
web = SoEWebWorld()
required_client_version = (0, 3, 5)

View File

@@ -43,7 +43,6 @@ class TimespinnerWorld(World):
option_definitions = timespinner_options
game = "Timespinner"
topology_present = True
remote_items = False
data_version = 10
web = TimespinnerWebWorld()

View File

@@ -61,14 +61,6 @@ class ZillionWorld(World):
# retrieved by clients on every connection.
data_version: int = 1
# NOTE: remote_items and remote_start_inventory are now available in the network protocol for the client to set.
# These values will be removed.
# if a world is set to remote_items, then it just needs to send location checks to the server and the server
# sends back the items
# if a world is set to remote_items = False, then the server never sends an item where receiver == finder,
# the client finds its own items in its own world.
remote_items: bool = False
logger: logging.Logger
class LogStreamInterface: