Skip to content

Commit 652ec8e

Browse files
committed
Generation code
1 parent 25d127b commit 652ec8e

File tree

10 files changed

+815
-799
lines changed

10 files changed

+815
-799
lines changed

worlds/wsr/LocationList.py

Lines changed: 249 additions & 271 deletions
Large diffs are not rendered by default.

worlds/wsr/WSRClient.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
)
2525
from NetUtils import ClientStatus, NetworkItem, NetworkPlayer
2626

27-
from .items import wsr_items
27+
from .items import wsr_items, WSRItem
28+
from .LocationList import location_table
2829

2930
if TYPE_CHECKING:
3031
import kvui
@@ -86,7 +87,7 @@ class CommandRequest:
8687
def __init__(self, command: bytes, timeout: float = 10.0):
8788
self.command = command
8889
self.timeout = timeout
89-
self.future = asyncio.get_running_loop().create_future() # asyncio.Future()
90+
self.future = asyncio.Future()
9091
self.timestamp = time.time()
9192

9293
# =============================================================================#
@@ -467,9 +468,6 @@ async def server_auth(self, password_requested: bool = False) -> None:
467468
468469
@param password_requested: Whether the server requires a password. Defaults to `False`.
469470
"""
470-
471-
self.log("Authenticating with the Archipelago server...")
472-
473471
if password_requested and not self.password:
474472
await super().server_auth(password_requested)
475473

@@ -495,7 +493,7 @@ def on_package(self, cmd: str, args: dict[str, Any]) -> None:
495493
self.last_rcvd_index = args["index"]
496494

497495
for item in args["items"]:
498-
self.items_rcvd.append(item, self.last_rcvd_index)
496+
self.items_rcvd.append((item, self.last_rcvd_index))
499497
self.last_rcvd_index += 1
500498

501499
self.items_rcvd.sort(key=lambda v: v[1])
@@ -534,7 +532,26 @@ async def check_locations(self) -> None:
534532

535533
response = await self.wii_client.send_packet(bytes(), packet_type_id=CommandID.LOCATION)
536534

537-
logger.info(f"Location Data in bytes: {self.wii_client.most_recent_packet_data}")
535+
p_data = self.wii_client.most_recent_packet_data
536+
537+
if(int.from_bytes((p_data), byteorder="big") == 4294967295):
538+
return
539+
540+
locations_checked = []
541+
location = None
542+
543+
for i in range(0, len(p_data), 4):
544+
location = int.from_bytes(p_data[i:i+4], byteorder="big")
545+
for l in self.missing_locations:
546+
logger.info(l)
547+
if location in self.missing_locations:
548+
self.locations_checked.add(WSRItem.get_apid(location))
549+
locations_checked.append(location)
550+
551+
if locations_checked:
552+
logger.info(f"Sending new check: {p_data}")
553+
await self.send_msgs([{"cmd": "LocationsChecks", "locations": locations_checked}])
554+
538555

539556

540557

@@ -593,7 +610,6 @@ async def sync_loop(ctx: WSRContext) -> None:
593610
if ctx.is_hooked():
594611
await ctx.give_items()
595612
await ctx.check_locations()
596-
597613
if ctx.awaiting_rom:
598614
await ctx.server_auth()
599615

worlds/wsr/WiiSportsResort.apworld

228 Bytes
Binary file not shown.

worlds/wsr/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from BaseClasses import Item, ItemClassification, Tutorial, Location, MultiWorld
22
from .items import item_table, create_item, create_itempool
3-
from .regions import create_region
3+
from .regions import create_region, create_regions
44
from .locations import location_table, is_location_valid, get_locations_names, get_total_locations
55
from .options import WSROptions, StampGoal, ChampionGoal, ProStatusGoal, Traps, StartingItems, SportsUnlockState, \
66
IncludeHardStamps, IncludeLongStamps, ExcludedStamps
7-
from .types import CategoryIndex, SportIndex, WSRSport, WSRItemData
7+
from .types import CategoryIndex, SportIndex, WSRItemData, WSRItem
8+
from worlds.Files import APPlayerContainer, AutoPatchRegister
89
from worlds.AutoWorld import World, WebWorld, CollectionState
910
from worlds.generic.Rules import add_rule
1011
from typing import List, Dict, TextIO
@@ -46,7 +47,7 @@ class WSRWeb(WebWorld):
4647
"setup/en",
4748
["Kiwi", "Plyd", "Cyndifusic", "Dragonz"]
4849
)]
49-
theme = "ice"
50+
theme = "partyTime"
5051
rich_text_options_doc = True
5152

5253
class WSRWorld(World):
@@ -68,10 +69,10 @@ def generate_early(self):
6869
return super().generate_early()
6970

7071
def create_regions(self):
71-
#TODO: create regions
72-
pass
72+
create_regions(self)
7373

7474
def create_items(self):
75+
# must have logic to fill progressive checks first to see how many junk items to fill the world
7576
self.multiworld.itempool += create_itempool(self)
7677

7778
def set_rules(self):
@@ -96,7 +97,7 @@ def collect(self, state: "CollectionState", item: "Item") -> bool:
9697

9798
def remove(self, state: "CollectionState", item: "Item") -> bool:
9899
old_count: int = state.count(item.name, self.player)
99-
change = super().collect(state,item)
100+
change = super().remove(state,item)
100101
if change and old_count == 1:
101102
if "Stamp" in item.name:
102103
state.prog_items[self.player]["Stamps"] -= 1

worlds/wsr/data/Regions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
"Swordplay Speed Slice (Stamp) - Double Time": "True",
294294
"Swordplay Speed Slice (Stamp) - A Cut Above": "True",
295295
"Swordplay Speed Slice - Pro Status": "True",
296-
"Swordplay Speed Slice - Beat The Champion (Matt):": "True",
296+
"Swordplay Speed Slice - Beat The Champion (Matt)": "True",
297297
"Swordplay Speed Slice - First Win": "True"
298298

299299
}

0 commit comments

Comments
 (0)