Replace localtriforcehunt with teamtriforcehunt

This commit is contained in:
pepperpow
2021-01-29 19:07:19 -06:00
parent 82fc2aba20
commit 5c074c2c4f
3 changed files with 48 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ import shutil
from random import randrange
import Shops
from Utils import get_item_name_from_id, get_location_name_from_address, ReceivedItem
from Utils import get_item_name_from_id, get_location_name_from_address, ReceivedItem, int16_as_bytes
exit_func = atexit.register(input, "Press enter to close.")
@@ -67,6 +67,8 @@ class Context():
self.forfeit_mode = ''
self.remaining_mode = ''
self.hint_points = 0
self.treasure_count = 0
self.requires_treasure_count = None
# End WebUI Stuff
self.exit_event = asyncio.Event()
@@ -990,6 +992,20 @@ async def process_server_cmd(ctx: Context, cmd, args):
elif cmd == 'HintPointUpdate':
ctx.hint_points = args[0]
elif cmd == 'TreasureCount':
try:
print(ctx.requires_treasure_count, 'OKAY')
if ctx.requires_treasure_count is None:
ctx.requires_treasure_count = (await snes_read(ctx, 0x180165, size=1))[0] >= 0x80
print(ctx.requires_treasure_count, ctx.treasure_count, args[0])
if ctx.requires_treasure_count and ctx.treasure_count < args[0]:
ctx.treasure_count = args[0]
print(int16_as_bytes(ctx.treasure_count))
snes_buffered_write(ctx, WRAM_START + 0xF418, bytes(int16_as_bytes(ctx.treasure_count)))
await snes_flush_writes(ctx)
except Exception as e:
print(e)
else:
logger.debug(f"unknown command {args}")