Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kingdom Hearts: Implement New Game #3201

Merged
merged 339 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
339 commits
Select commit Hold shift + click to select a range
8734f38
Added Final Ansem Goal
gaithern Jan 26, 2024
28db11c
Merge pull request #23 from gaithernOrg/dev
gaithern Jan 26, 2024
653e155
Update __init__.py
gaithern Jan 26, 2024
6991c03
Update Rules.py
gaithern Jan 26, 2024
15cb714
Merge pull request #24 from gaithernOrg/dev
gaithern Jan 26, 2024
ed63daa
New EotW logic
gaithern Feb 2, 2024
a13bac1
Update __init__.py
gaithern Feb 2, 2024
bb50db2
Update __init__.py
gaithern Feb 2, 2024
1c0be10
Update Items.py
gaithern Feb 2, 2024
67db61e
Merge pull request #25 from gaithernOrg/dev
gaithern Feb 4, 2024
e823827
Update Rules.py
gaithern Feb 5, 2024
734747e
Merge pull request #26 from gaithernOrg/dev
gaithern Feb 5, 2024
431dfa0
Rename Location to be more meaningful, logic fixes
gaithern Feb 17, 2024
d373f28
Removed Aerith locations
gaithern Feb 17, 2024
562f72a
Change to allow randomized keyblade stats
gaithern Feb 18, 2024
2bc4b03
Fixed incorrect option description. Fixed victory locations for alte…
gaithern Feb 28, 2024
02ee348
Commit
gaithern Mar 23, 2024
ffd50a2
Lots of changes
gaithern Mar 25, 2024
80bd2b8
Fixes
gaithern Mar 25, 2024
43224f9
Fixes
gaithern Mar 25, 2024
ce1cdeb
Update Rules.py
gaithern Mar 25, 2024
2553aad
Update Rules.py
gaithern Mar 25, 2024
0a04225
Update Rules.py
gaithern Mar 25, 2024
cd87fe9
Update Rules.py
gaithern Mar 25, 2024
3526163
Fixes
gaithern Mar 25, 2024
3f439cd
Update Rules.py
gaithern Mar 25, 2024
6e64b08
Update Rules.py
gaithern Mar 25, 2024
38256c6
Update Options.py
gaithern Mar 25, 2024
bc9b5b0
Old Book is not required
gaithern Mar 25, 2024
1d4a7ed
Added Jungle Slider
gaithern Mar 25, 2024
25780e4
Add Cid Check
gaithern Mar 26, 2024
3cc8097
Add Wonderland Book Check
gaithern Mar 26, 2024
6a7755e
Add OC Green Trinity
gaithern Mar 26, 2024
ad8b8e1
Add Inferno Band Event
gaithern Mar 26, 2024
8fdfde3
Add Kurt Zisa Zantetsuken and Unknown EXP Necklace checks
gaithern Mar 26, 2024
525a5d9
Update Locations.py
gaithern Mar 26, 2024
3d1e896
Fix Final Ansem Goal
gaithern Mar 26, 2024
5755de2
Update __init__.py
gaithern Mar 26, 2024
cbffa8b
Update __init__.py
gaithern Mar 26, 2024
87efbdb
Add options to exclude super bosses and 100 acre wood
gaithern Mar 26, 2024
429abf1
Fix puppies trp, remove cid check
gaithern Mar 26, 2024
c2b02ef
Fix 100 Acre Wood Option
gaithern Mar 27, 2024
e824224
Material to Empty Bottle
gaithern Mar 27, 2024
3023f0d
Fixed rules, location names, etc
gaithern Mar 27, 2024
1d9e14a
Fix super bosses
gaithern Mar 27, 2024
6b064e4
Add item + location groups, level sanity
gaithern Mar 30, 2024
4e0453f
Fix location and item group names
gaithern Mar 30, 2024
4094e34
Add Bad Starting Weapons Option
gaithern Mar 31, 2024
5b3b421
Logic Error for 100 Acre Wood
gaithern Mar 31, 2024
e5a9add
Update Rules.py
gaithern Apr 10, 2024
1704333
Update __init__.py
gaithern Apr 12, 2024
823a022
Merge branch 'ArchipelagoMW:main' into main
gaithern Apr 16, 2024
3bb69ca
Fixes related to randomized keyblade stats and super bosses
gaithern Apr 16, 2024
5bbd0b8
Merge branch 'ArchipelagoMW:main' into main
gaithern Apr 22, 2024
6c4a071
Credits and Fixes
gaithern Apr 22, 2024
5b5b3a9
Logic fixes, location name group changes
gaithern Apr 23, 2024
f21bf66
Update Options.py
gaithern Apr 23, 2024
5ff82af
Update worlds/kh1/__init__.py
gaithern Apr 23, 2024
25bd9bd
Update worlds/kh1/__init__.py
gaithern Apr 23, 2024
22b720c
Update worlds/kh1/docs/kh1_en.md
gaithern Apr 23, 2024
c192b9c
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Apr 23, 2024
8cf67bc
Update .gitignore
gaithern Apr 23, 2024
9ab363c
Update CODEOWNERS
gaithern Apr 23, 2024
9f1a45b
Update docs/CODEOWNERS
gaithern Apr 23, 2024
56c0489
Fixed Atlantica item group name
gaithern Apr 23, 2024
03ca8da
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Apr 23, 2024
e908fd4
Update CODEOWNERS
gaithern Apr 23, 2024
0577ff9
Update Client.py
gaithern Apr 24, 2024
9e76e01
Update Items.py
gaithern Apr 24, 2024
885c399
Update __init__.py
gaithern Apr 24, 2024
17d5135
Update Rules.py
gaithern Apr 24, 2024
e1f44a0
Update Rules.py
gaithern Apr 24, 2024
13ffb18
Update Rules.py
gaithern Apr 24, 2024
574715d
Update worlds/kh1/Rules.py
gaithern Apr 25, 2024
815c34a
Update worlds/kh1/Rules.py
gaithern Apr 25, 2024
10be74b
Update worlds/kh1/Rules.py
gaithern Apr 25, 2024
407b781
Fixed report group name
gaithern Apr 25, 2024
04b4812
Fixes for PR
gaithern Apr 25, 2024
6ea07a6
Merge branch 'main' into main
gaithern Apr 25, 2024
6c5e8fc
Update Options.py
gaithern Apr 26, 2024
5390622
Merge branch 'main' into main
gaithern Apr 28, 2024
b7aaaff
Push changes for making the Final Rest Door appear, few option fixes
gaithern May 3, 2024
61c451d
Update Rules.py
gaithern May 3, 2024
b6ad5f6
Website formatting, 0 min for reports, option description typo
gaithern May 6, 2024
7509e2a
Create KH1Client.py
gaithern May 6, 2024
f679f68
Update worlds/kh1/docs/kh1_en.md
gaithern May 6, 2024
449e2cf
Update Options.py
gaithern May 6, 2024
b0a29cc
Update Options.py
gaithern May 6, 2024
51a8e13
Update Rules.py
gaithern May 6, 2024
af44e70
Update Rules.py
gaithern May 6, 2024
fa9e7a2
Update Rules.py
gaithern May 6, 2024
07c6898
Add Donald and Goofy Death Link
gaithern May 7, 2024
137d79f
Add fight logic for optional bosses
gaithern May 8, 2024
b99226a
Update __init__.py
gaithern May 9, 2024
3ae2072
Merge branch 'main' into main
gaithern May 10, 2024
6ed2154
Update Options.py
gaithern May 13, 2024
6109412
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern May 13, 2024
8c9c3ee
Update worlds/kh1/Options.py
gaithern May 13, 2024
76645a4
Update Client.py
gaithern May 17, 2024
582fbe1
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern May 17, 2024
8fd9f15
Update kh1_en.md
gaithern May 17, 2024
8975a0c
Update __init__.py
gaithern May 18, 2024
45bc42f
Cleaning up for PR
gaithern May 19, 2024
129113f
Merge branch 'main' into main
gaithern May 20, 2024
66d1343
Update Client.py
gaithern May 23, 2024
3d5fefe
Added event locations for vanilla items
gaithern May 25, 2024
be4bc6f
Add proper location groups and auto hint synth shop items when entering
gaithern May 30, 2024
5db1f4e
so many changes
gaithern Jun 8, 2024
33237d7
Update Rules.py
gaithern Jun 8, 2024
41de706
fixed oathkeeper and crabclaw logic
gaithern Jun 9, 2024
7c1ffbf
Update Rules.py
gaithern Jun 9, 2024
e70dad1
Update Rules.py
gaithern Jun 9, 2024
62891b2
Update Rules.py
gaithern Jun 9, 2024
0f64cbf
Update Rules.py
gaithern Jun 9, 2024
1cac212
Merge branch 'main' into main
gaithern Jun 9, 2024
26ec0c1
Update en_Kingdom Hearts.md
gaithern Jun 9, 2024
8ab6a70
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Jun 9, 2024
afbfe01
Update en_Kingdom Hearts.md
gaithern Jun 9, 2024
ff2c7a6
fixing text
gaithern Jun 9, 2024
2a695e3
Update kh1_en.md
gaithern Jun 9, 2024
963724e
Addition of new key items
gaithern Jun 13, 2024
1f41bf6
Update Regions.py
gaithern Jun 13, 2024
622f187
Push for start item from pool test
gaithern Jun 29, 2024
788af91
Update worlds/kh1/Options.py
gaithern Jun 29, 2024
cf13536
Merge branch 'main' into main
gaithern Jun 29, 2024
68b3efe
Document update
gaithern Jun 29, 2024
2929f19
Update Rules.py
gaithern Jun 30, 2024
f74a639
Merge branch 'main' into main
gaithern Jun 30, 2024
50844b5
Added starting world range and final rest goal option
gaithern Jul 1, 2024
979132a
Update kh1_en.md
gaithern Jul 2, 2024
6d0352e
Merge branch 'main' into main
gaithern Jul 2, 2024
de67224
Update en_Kingdom Hearts.md
gaithern Jul 2, 2024
264caa5
Update __init__.py
gaithern Jul 2, 2024
a8c0fc1
Update __init__.py
gaithern Jul 2, 2024
5891fbe
Clean up options descriptions
gaithern Jul 3, 2024
01ded32
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
52d677d
Update worlds/kh1/Options.py
gaithern Jul 7, 2024
9b55c6b
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
34c24e0
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
fac386b
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
83def3f
Update worlds/kh1/Rules.py
gaithern Jul 7, 2024
ec738c4
Update worlds/kh1/Rules.py
gaithern Jul 7, 2024
3085321
Update worlds/kh1/Client.py
gaithern Jul 7, 2024
8481459
Fix grammar in document
gaithern Jul 7, 2024
3f4b569
Update __init__.py
gaithern Jul 7, 2024
a3cf066
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
9afaffe
Removed return type
gaithern Jul 7, 2024
7268c38
Update __init__.py
gaithern Jul 7, 2024
eabf376
Update __init__.py
gaithern Jul 7, 2024
fdecebd
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
2b690da
Update worlds/kh1/__init__.py
gaithern Jul 7, 2024
bdd0012
Update __init__.py
gaithern Jul 7, 2024
35993e6
Fix missing i replacement, rework set rules to use "self" instead of …
gaithern Jul 7, 2024
e22c9a7
Merge branch 'main' into main
gaithern Jul 8, 2024
c545f13
Merge branch 'main' into main
gaithern Jul 14, 2024
813c7c6
Merge branch 'main' into main
gaithern Jul 18, 2024
123fcb5
Merge branch 'ArchipelagoMW:main' into main
gaithern Jul 27, 2024
729775b
Update KH1Client.py
gaithern Jul 27, 2024
0abec09
Merge branch 'main' into main
gaithern Jul 27, 2024
be9a538
Reformat rules, fix bug with exp mult, add to readme
gaithern Jul 27, 2024
c621de9
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Jul 27, 2024
ab4e125
Clean up regions, fix client
gaithern Jul 28, 2024
01ca83c
Fix item send prompt
gaithern Jul 28, 2024
e23452f
Merge branch 'main' into main
gaithern Jul 28, 2024
9bfe3d0
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
f716c50
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
01c1fa3
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
eb079a5
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
3c355d4
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
2e23c37
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
09a7485
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
78c46fa
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
fb9aba5
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
2f326ba
Update worlds/kh1/docs/en_Kingdom Hearts.md
gaithern Jul 29, 2024
ee5946f
Update worlds/kh1/docs/kh1_en.md
gaithern Jul 29, 2024
8b550ee
Update worlds/kh1/docs/kh1_en.md
gaithern Jul 29, 2024
b3aeb1e
Update worlds/kh1/docs/kh1_en.md
gaithern Jul 29, 2024
b3e6778
Update worlds/kh1/docs/kh1_en.md
gaithern Jul 29, 2024
5961c6b
Update worlds/kh1/test/test_goal.py
gaithern Jul 29, 2024
d6ce121
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
b285fd1
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
fefd9e6
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
dca455f
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
1aed65b
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
922e647
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
c68136d
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
777b1ef
Update worlds/kh1/Items.py
gaithern Jul 29, 2024
9641e8c
Update worlds/kh1/Locations.py
gaithern Jul 29, 2024
49ff4ae
Update worlds/kh1/Regions.py
gaithern Jul 29, 2024
582903e
Update worlds/kh1/Locations.py
gaithern Jul 29, 2024
be67da5
Update worlds/kh1/Locations.py
gaithern Jul 29, 2024
d3f0a13
Update worlds/kh1/Items.py
gaithern Jul 29, 2024
a40a499
Update worlds/kh1/Regions.py
gaithern Jul 29, 2024
10096e7
Update worlds/kh1/Regions.py
gaithern Jul 29, 2024
e6b9665
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
b672aea
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
12f930d
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
f001f5f
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
6cf4d6e
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
2cabd8c
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
b3a2513
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
1f6c3c3
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
e6c5af4
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
86c48e6
Update worlds/kh1/Rules.py
gaithern Jul 29, 2024
f04eab9
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
e7c9475
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
c873d3a
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
7f303d0
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
8f12855
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
e778527
Update worlds/kh1/__init__.py
gaithern Jul 29, 2024
d53f9aa
Fix so many suggestions
gaithern Jul 29, 2024
fd8f437
removed junk in missable locations option
gaithern Jul 29, 2024
f64f5bf
Update __init__.py
gaithern Jul 29, 2024
243f4c8
Change credits order
gaithern Jul 29, 2024
7cb28b9
Update en_Kingdom Hearts.md
gaithern Jul 29, 2024
9ebd8f6
Standardize punctuation
gaithern Jul 29, 2024
759f6be
Merge branch 'main' into main
gaithern Jul 29, 2024
9430efb
Update en_Kingdom Hearts.md
gaithern Jul 29, 2024
c4245dd
Update en_Kingdom Hearts.md
gaithern Jul 29, 2024
582b078
Update Regions.py
gaithern Jul 29, 2024
3aa96a9
Removed "disclude" options in generation fillers
gaithern Jul 29, 2024
83ca225
Update Rules.py
gaithern Jul 29, 2024
029fccd
Merge branch 'main' into main
gaithern Jul 29, 2024
ca63e3c
Update __init__.py
gaithern Jul 29, 2024
101713f
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Jul 29, 2024
128ff15
Fix cemetery typo
gaithern Jul 29, 2024
251534c
Update worlds/kh1/Options.py
gaithern Jul 29, 2024
3e681f6
Add option groups and option presets
gaithern Jul 30, 2024
e056c77
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Jul 30, 2024
99c658d
Update worlds/kh1/__init__.py
gaithern Jul 30, 2024
4787f11
Update worlds/kh1/Options.py
gaithern Jul 30, 2024
40edd5d
Update worlds/kh1/Options.py
gaithern Jul 30, 2024
468059d
Update worlds/kh1/Options.py
gaithern Jul 30, 2024
8ad65b4
Update worlds/kh1/Presets.py
gaithern Jul 30, 2024
2b5ae6b
Merge branch 'main' into main
gaithern Aug 1, 2024
6b9256d
fixed HB rule and formatting on a line in Items.py
gaithern Aug 2, 2024
06eb1ad
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Aug 2, 2024
357f756
Fix logic bug with Geppetto's House postcard
gaithern Aug 3, 2024
e0a284b
Update Rules.py
gaithern Aug 3, 2024
c9bfbb2
Update Options.py
gaithern Aug 11, 2024
20b32eb
Merge branch 'main' into main
gaithern Aug 13, 2024
06c333e
Update __init__.py
gaithern Aug 13, 2024
05ad2af
Merge branch 'main' of https://github.com/gaithernOrg/KH1FM-AP
gaithern Aug 13, 2024
16699e6
Update __init__.py
gaithern Aug 13, 2024
6c1ea98
Huge under-the-hood update for PR
gaithern Aug 17, 2024
96c2fd9
Merge branch 'main' into main
gaithern Aug 17, 2024
385fe9c
More updates for PR
gaithern Aug 17, 2024
fbab617
Update worlds/kh1/__init__.py
gaithern Aug 18, 2024
4d5fc18
Update worlds/kh1/Rules.py
gaithern Aug 18, 2024
ea84da1
Update __init__.py
gaithern Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions KH1Client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if __name__ == '__main__':
import ModuleUpdate
ModuleUpdate.update()

import Utils
Utils.init_logging("KH1Client", exception_logger="Client")

from worlds.kh1.Client import launch
launch()
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Currently, the following games are supported:
* Yu-Gi-Oh! Ultimate Masters: World Championship Tournament 2006
* A Hat in Time
* Old School Runescape
* Kingdom Hearts 1

For setup and instructions check out our [tutorials page](https://archipelago.gg/tutorial/).
Downloads can be found at [Releases](https://github.com/ArchipelagoMW/Archipelago/releases), including compiled
Expand Down
3 changes: 3 additions & 0 deletions docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
# Kirby's Dream Land 3
/worlds/kdl3/ @Silvris

# Kingdom Hearts
/worlds/kh1/ @gaithern

# Kingdom Hearts 2
/worlds/kh2/ @JaredWeakStrike

Expand Down
258 changes: 258 additions & 0 deletions worlds/kh1/Client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
from __future__ import annotations
import os
import json
import sys
import asyncio
import shutil
import logging
import re
import time
from calendar import timegm

import ModuleUpdate
ModuleUpdate.update()

import Utils
death_link = False
item_num = 1

logger = logging.getLogger("Client")

if __name__ == "__main__":
Utils.init_logging("KH1Client", exception_logger="Client")

from NetUtils import NetworkItem, ClientStatus
from CommonClient import gui_enabled, logger, get_base_parser, ClientCommandProcessor, \
CommonContext, server_loop


def check_stdin() -> None:
if Utils.is_windows and sys.stdin:
print("WARNING: Console input is not routed reliably on Windows, use the GUI instead.")

class KH1ClientCommandProcessor(ClientCommandProcessor):
def _cmd_deathlink(self):
"""Toggles Deathlink"""
global death_link
if death_link:
death_link = False
self.output(f"Death Link turned off")
else:
death_link = True
self.output(f"Death Link turned on")

class KH1Context(CommonContext):
command_processor: int = KH1ClientCommandProcessor
game = "Kingdom Hearts"
items_handling = 0b111 # full remote

def __init__(self, server_address, password):
super(KH1Context, self).__init__(server_address, password)
self.send_index: int = 0
self.syncing = False
self.awaiting_bridge = False
# self.game_communication_path: files go in this path to pass data between us and the actual game
if "localappdata" in os.environ:
self.game_communication_path = os.path.expandvars(r"%localappdata%/KH1FM")
else:
self.game_communication_path = os.path.expandvars(r"$HOME/KH1FM")
if not os.path.exists(self.game_communication_path):
os.makedirs(self.game_communication_path)
for root, dirs, files in os.walk(self.game_communication_path):
for file in files:
if file.find("obtain") <= -1:
os.remove(root+"/"+file)

async def server_auth(self, password_requested: bool = False):
if password_requested and not self.password:
await super(KH1Context, self).server_auth(password_requested)
await self.get_username()
await self.send_connect()

async def connection_closed(self):
await super(KH1Context, self).connection_closed()
for root, dirs, files in os.walk(self.game_communication_path):
for file in files:
if file.find("obtain") <= -1:
os.remove(root + "/" + file)
global item_num
item_num = 1

@property
def endpoints(self):
if self.server:
return [self.server]
else:
return []

async def shutdown(self):
await super(KH1Context, self).shutdown()
for root, dirs, files in os.walk(self.game_communication_path):
for file in files:
if file.find("obtain") <= -1:
os.remove(root+"/"+file)
global item_num
item_num = 1

def on_package(self, cmd: str, args: dict):
if cmd in {"Connected"}:
if not os.path.exists(self.game_communication_path):
os.makedirs(self.game_communication_path)
for ss in self.checked_locations:
filename = f"send{ss}"
with open(os.path.join(self.game_communication_path, filename), 'w') as f:
f.close()

#Handle Slot Data
for key in list(args['slot_data'].keys()):
with open(os.path.join(self.game_communication_path, key + ".cfg"), 'w') as f:
f.write(str(args['slot_data'][key]))
f.close()

###Support Legacy Games
if "Required Reports" in list(args['slot_data'].keys()) and "required_reports_eotw" not in list(args['slot_data'].keys()):
reports_required = args['slot_data']["Required Reports"]
with open(os.path.join(self.game_communication_path, "required_reports.cfg"), 'w') as f:
f.write(str(reports_required))
f.close()
###End Support Legacy Games

#End Handle Slot Data

if cmd in {"ReceivedItems"}:
start_index = args["index"]
if start_index != len(self.items_received):
global item_num
for item in args['items']:
found = False
item_filename = f"AP_{str(item_num)}.item"
for filename in os.listdir(self.game_communication_path):
if filename == item_filename:
found = True
if not found:
with open(os.path.join(self.game_communication_path, item_filename), 'w') as f:
f.write(str(NetworkItem(*item).item) + "\n" + str(NetworkItem(*item).location) + "\n" + str(NetworkItem(*item).player))
f.close()
item_num = item_num + 1

if cmd in {"RoomUpdate"}:
if "checked_locations" in args:
for ss in self.checked_locations:
filename = f"send{ss}"
with open(os.path.join(self.game_communication_path, filename), 'w') as f:
f.close()

if cmd in {"PrintJSON"} and "type" in args:
if args["type"] == "ItemSend":
item = args["item"]
networkItem = NetworkItem(*item)
recieverID = args["receiving"]
senderID = networkItem.player
locationID = networkItem.location
if recieverID != self.slot and senderID == self.slot:
itemName = self.item_names.lookup_in_slot(networkItem.item, recieverID)
itemCategory = networkItem.flags
recieverName = self.player_names[recieverID]
filename = "sent"
with open(os.path.join(self.game_communication_path, filename), 'w') as f:
f.write(
re.sub('[^A-Za-z0-9 ]+', '',str(itemName))[:15] + "\n"
+ re.sub('[^A-Za-z0-9 ]+', '',str(recieverName))[:6] + "\n"
+ str(itemCategory) + "\n"
+ str(locationID))
f.close()

def on_deathlink(self, data: dict[str, object]):
self.last_death_link = max(data["time"], self.last_death_link)
text = data.get("cause", "")
if text:
logger.info(f"DeathLink: {text}")
else:
logger.info(f"DeathLink: Received from {data['source']}")
with open(os.path.join(self.game_communication_path, 'dlreceive'), 'w') as f:
f.write(str(int(data["time"])))
f.close()

def run_gui(self):
"""Import kivy UI system and start running it as self.ui_task."""
from kvui import GameManager

class KH1Manager(GameManager):
logging_pairs = [
("Client", "Archipelago")
]
base_title = "Archipelago KH1 Client"

self.ui = KH1Manager(self)
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")


async def game_watcher(ctx: KH1Context):
from .Locations import lookup_id_to_name
while not ctx.exit_event.is_set():
global death_link
if death_link and "DeathLink" not in ctx.tags:
await ctx.update_death_link(death_link)
if not death_link and "DeathLink" in ctx.tags:
await ctx.update_death_link(death_link)
if ctx.syncing == True:
sync_msg = [{'cmd': 'Sync'}]
if ctx.locations_checked:
sync_msg.append({"cmd": "LocationChecks", "locations": list(ctx.locations_checked)})
await ctx.send_msgs(sync_msg)
ctx.syncing = False
sending = []
victory = False
for root, dirs, files in os.walk(ctx.game_communication_path):
for file in files:
if file.find("send") > -1:
st = file.split("send", -1)[1]
if st != "nil":
sending = sending+[(int(st))]
if file.find("victory") > -1:
victory = True
if file.find("dlsend") > -1 and "DeathLink" in ctx.tags:
st = file.split("dlsend", -1)[1]
if st != "nil":
if timegm(time.strptime(st, '%Y%m%d%H%M%S')) > ctx.last_death_link and int(time.time()) % int(timegm(time.strptime(st, '%Y%m%d%H%M%S'))) < 10:
await ctx.send_death(death_text = "Sora was defeated!")
if file.find("insynthshop") > -1:
await ctx.send_msgs([{
"cmd": "LocationScouts",
"locations": [2656401,2656402,2656403,2656404,2656405,2656406],
"create_as_hint": 2
}])
ctx.locations_checked = sending
message = [{"cmd": 'LocationChecks', "locations": sending}]
await ctx.send_msgs(message)
if not ctx.finished_game and victory:
await ctx.send_msgs([{"cmd": "StatusUpdate", "status": ClientStatus.CLIENT_GOAL}])
ctx.finished_game = True
await asyncio.sleep(0.1)


def launch():
async def main(args):
ctx = KH1Context(args.connect, args.password)
ctx.server_task = asyncio.create_task(server_loop(ctx), name="server loop")
if gui_enabled:
ctx.run_gui()
ctx.run_cli()
progression_watcher = asyncio.create_task(
game_watcher(ctx), name="KH1ProgressionWatcher")

await ctx.exit_event.wait()
ctx.server_address = None

await progression_watcher

await ctx.shutdown()

import colorama

parser = get_base_parser(description="KH1 Client, for text interfacing.")

args, rest = parser.parse_known_args()
colorama.init()
asyncio.run(main(args))
colorama.deinit()
Loading
Loading