Removed remnants of team stuff, make hide_goal default
This commit is contained in:
parent
cd85279ded
commit
1d1abb7d22
|
@ -27,10 +27,11 @@ def main():
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
||||||
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
||||||
parser.add_argument('--triforcehud', default='normal', const='normal', nargs='?', choices=['normal', 'hide_goal', 'hide_total', 'hide_both'],
|
parser.add_argument('--triforcehud', default='hide_goal', const='hide_goal', nargs='?', choices=['normal', 'hide_goal', 'hide_required', 'hide_both'],
|
||||||
help='''\
|
help='''\
|
||||||
Hide the triforce hud in certain circumstances.
|
Hide the triforce hud in certain circumstances.
|
||||||
hide_goal will hide the hud until finding a triforce piece, hide_total will hide the total amount needed to win
|
hide_goal will hide the hud until finding a triforce piece, hide_required will hide the total amount needed to win
|
||||||
|
(Both can be revealed when speaking to Murahalda)
|
||||||
(default: %(default)s)
|
(default: %(default)s)
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['double', 'normal', 'half', 'quarter', 'off'],
|
parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['double', 'normal', 'half', 'quarter', 'off'],
|
||||||
|
|
|
@ -244,10 +244,11 @@ def parse_arguments(argv, no_defaults=False):
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
||||||
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
|
||||||
parser.add_argument('--triforcehud', default='normal', const='normal', nargs='?', choices=['normal', 'hide_goal', 'hide_total', 'hide_both'],
|
parser.add_argument('--triforcehud', default='hide_goal', const='hide_goal', nargs='?', choices=['normal', 'hide_goal', 'hide_required', 'hide_both'],
|
||||||
help='''\
|
help='''\
|
||||||
Hide the triforce hud in certain circumstances.
|
Hide the triforce hud in certain circumstances.
|
||||||
hide_goal will hide the hud until finding a triforce piece, hide_total will hide the total amount needed to win
|
hide_goal will hide the hud until finding a triforce piece, hide_required will hide the total amount needed to win
|
||||||
|
(Both can be revealed when speaking to Murahalda)
|
||||||
(default: %(default)s)
|
(default: %(default)s)
|
||||||
''')
|
''')
|
||||||
parser.add_argument('--mapshuffle', default=defval(False),
|
parser.add_argument('--mapshuffle', default=defval(False),
|
||||||
|
|
|
@ -19,7 +19,7 @@ import shutil
|
||||||
from random import randrange
|
from random import randrange
|
||||||
|
|
||||||
import Shops
|
import Shops
|
||||||
from Utils import get_item_name_from_id, get_location_name_from_address, ReceivedItem, int16_as_bytes
|
from Utils import get_item_name_from_id, get_location_name_from_address, ReceivedItem
|
||||||
|
|
||||||
exit_func = atexit.register(input, "Press enter to close.")
|
exit_func = atexit.register(input, "Press enter to close.")
|
||||||
|
|
||||||
|
@ -67,8 +67,6 @@ class Context():
|
||||||
self.forfeit_mode = ''
|
self.forfeit_mode = ''
|
||||||
self.remaining_mode = ''
|
self.remaining_mode = ''
|
||||||
self.hint_points = 0
|
self.hint_points = 0
|
||||||
self.treasure_count = 0
|
|
||||||
self.requires_treasure_count = None
|
|
||||||
# End WebUI Stuff
|
# End WebUI Stuff
|
||||||
|
|
||||||
self.exit_event = asyncio.Event()
|
self.exit_event = asyncio.Event()
|
||||||
|
@ -992,15 +990,6 @@ async def process_server_cmd(ctx: Context, cmd, args):
|
||||||
elif cmd == 'HintPointUpdate':
|
elif cmd == 'HintPointUpdate':
|
||||||
ctx.hint_points = args[0]
|
ctx.hint_points = args[0]
|
||||||
|
|
||||||
elif cmd == 'TreasureCount':
|
|
||||||
if ctx.requires_treasure_count is None:
|
|
||||||
ctx.requires_treasure_count = (await snes_read(ctx, 0x180165, size=1))[0] >= 0x80
|
|
||||||
if ctx.requires_treasure_count and ctx.treasure_count < args[0]:
|
|
||||||
logging.info('Team Triforce count is now {}'.format(args[0]))
|
|
||||||
ctx.treasure_count = args[0]
|
|
||||||
snes_buffered_write(ctx, WRAM_START + 0xF418, bytes(int16_as_bytes(ctx.treasure_count)))
|
|
||||||
await snes_flush_writes(ctx)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.debug(f"unknown command {args}")
|
logger.debug(f"unknown command {args}")
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,6 @@ class Context(Node):
|
||||||
self.hint_cost = hint_cost
|
self.hint_cost = hint_cost
|
||||||
self.location_check_points = location_check_points
|
self.location_check_points = location_check_points
|
||||||
self.hints_used = collections.defaultdict(int)
|
self.hints_used = collections.defaultdict(int)
|
||||||
self.treasure_count = collections.defaultdict(int)
|
|
||||||
self.hints: typing.Dict[typing.Tuple[int, int], typing.Set[Utils.Hint]] = collections.defaultdict(set)
|
self.hints: typing.Dict[typing.Tuple[int, int], typing.Set[Utils.Hint]] = collections.defaultdict(set)
|
||||||
self.forfeit_mode: str = forfeit_mode
|
self.forfeit_mode: str = forfeit_mode
|
||||||
self.remaining_mode: str = remaining_mode
|
self.remaining_mode: str = remaining_mode
|
||||||
|
@ -229,7 +228,6 @@ class Context(Node):
|
||||||
d = {
|
d = {
|
||||||
"rom_names": list(self.rom_names.items()),
|
"rom_names": list(self.rom_names.items()),
|
||||||
"received_items": tuple((k, v) for k, v in self.received_items.items()),
|
"received_items": tuple((k, v) for k, v in self.received_items.items()),
|
||||||
"treasure_count": tuple(v for k, v in self.treasure_count.items()),
|
|
||||||
"hints_used": tuple((key, value) for key, value in self.hints_used.items()),
|
"hints_used": tuple((key, value) for key, value in self.hints_used.items()),
|
||||||
"hints": tuple(
|
"hints": tuple(
|
||||||
(key, list(hint.re_check(self, key[0]) for hint in value)) for key, value in self.hints.items()),
|
(key, list(hint.re_check(self, key[0]) for hint in value)) for key, value in self.hints.items()),
|
||||||
|
@ -258,7 +256,6 @@ class Context(Node):
|
||||||
return
|
return
|
||||||
|
|
||||||
received_items = {tuple(k): [ReceivedItem(*i) for i in v] for k, v in savedata["received_items"]}
|
received_items = {tuple(k): [ReceivedItem(*i) for i in v] for k, v in savedata["received_items"]}
|
||||||
self.treasure_count = {k: v for k, v in enumerate(savedata["treasure_count"])}
|
|
||||||
|
|
||||||
self.received_items = received_items
|
self.received_items = received_items
|
||||||
self.hints_used.update({tuple(key): value for key, value in savedata["hints_used"]})
|
self.hints_used.update({tuple(key): value for key, value in savedata["hints_used"]})
|
||||||
|
@ -294,8 +291,6 @@ class Context(Node):
|
||||||
|
|
||||||
logging.info(f'Loaded save file with {sum([len(p) for p in received_items.values()])} received items '
|
logging.info(f'Loaded save file with {sum([len(p) for p in received_items.values()])} received items '
|
||||||
f'for {len(received_items)} players')
|
f'for {len(received_items)} players')
|
||||||
if len(self.treasure_count):
|
|
||||||
logging.info(f'Triforce pieces collected {self.treasure_count}')
|
|
||||||
|
|
||||||
def get_aliased_name(self, team: int, slot: int):
|
def get_aliased_name(self, team: int, slot: int):
|
||||||
if (team, slot) in self.name_aliases:
|
if (team, slot) in self.name_aliases:
|
||||||
|
@ -510,6 +505,7 @@ def register_location_checks(ctx: Context, team: int, slot: int, locations):
|
||||||
if recvd_item.location == location and recvd_item.player == slot:
|
if recvd_item.location == location and recvd_item.player == slot:
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
new_item = ReceivedItem(target_item, location, slot)
|
new_item = ReceivedItem(target_item, location, slot)
|
||||||
recvd_items.append(new_item)
|
recvd_items.append(new_item)
|
||||||
|
@ -525,9 +521,6 @@ def register_location_checks(ctx: Context, team: int, slot: int, locations):
|
||||||
if client.team == team and client.wants_item_notification:
|
if client.team == team and client.wants_item_notification:
|
||||||
asyncio.create_task(
|
asyncio.create_task(
|
||||||
ctx.send_msgs(client, [['ItemFound', (target_item, location, slot)]]))
|
ctx.send_msgs(client, [['ItemFound', (target_item, location, slot)]]))
|
||||||
if 'Triforce Piece' in get_item_name_from_id(target_item):
|
|
||||||
ctx.treasure_count[team] = ctx.treasure_count.get(team, 0) + 1
|
|
||||||
ctx.broadcast_team(team, [['TreasureCount', (ctx.treasure_count[team],)]])
|
|
||||||
ctx.location_checks[team, slot] |= known_locations
|
ctx.location_checks[team, slot] |= known_locations
|
||||||
send_new_items(ctx)
|
send_new_items(ctx)
|
||||||
|
|
||||||
|
@ -1053,8 +1046,6 @@ async def process_client_cmd(ctx: Context, client: Client, cmd, args):
|
||||||
if items:
|
if items:
|
||||||
reply.append(['ReceivedItems', (0, tuplize_received_items(items))])
|
reply.append(['ReceivedItems', (0, tuplize_received_items(items))])
|
||||||
client.send_index = len(items)
|
client.send_index = len(items)
|
||||||
if ctx.treasure_count.get(client.team):
|
|
||||||
ctx.broadcast_team(team, [['TreasureCount', (ctx.treasure_count[client.team],)]])
|
|
||||||
await ctx.send_msgs(client, reply)
|
await ctx.send_msgs(client, reply)
|
||||||
await on_client_joined(ctx, client)
|
await on_client_joined(ctx, client)
|
||||||
|
|
||||||
|
@ -1064,8 +1055,6 @@ async def process_client_cmd(ctx: Context, client: Client, cmd, args):
|
||||||
if items:
|
if items:
|
||||||
client.send_index = len(items)
|
client.send_index = len(items)
|
||||||
await ctx.send_msgs(client, [['ReceivedItems', (0, tuplize_received_items(items))]])
|
await ctx.send_msgs(client, [['ReceivedItems', (0, tuplize_received_items(items))]])
|
||||||
if ctx.treasure_count.get((team)):
|
|
||||||
ctx.broadcast_team(team, [['TreasureCount', (ctx.treasure_count[team],)]])
|
|
||||||
|
|
||||||
elif cmd == 'LocationChecks':
|
elif cmd == 'LocationChecks':
|
||||||
if type(args) is not list:
|
if type(args) is not list:
|
||||||
|
|
|
@ -650,7 +650,7 @@ def roll_settings(weights, plando_options: typing.Set[str] = frozenset(("bosses"
|
||||||
ret.sprite_pool += [key] * int(value)
|
ret.sprite_pool += [key] * int(value)
|
||||||
|
|
||||||
ret.disablemusic = get_choice('disablemusic', romweights, False)
|
ret.disablemusic = get_choice('disablemusic', romweights, False)
|
||||||
ret.triforcehud = get_choice('triforcehud', romweights, 'normal')
|
ret.triforcehud = get_choice('triforcehud', romweights, 'hide_goal')
|
||||||
ret.quickswap = get_choice('quickswap', romweights, True)
|
ret.quickswap = get_choice('quickswap', romweights, True)
|
||||||
ret.fastmenu = get_choice('menuspeed', romweights, "normal")
|
ret.fastmenu = get_choice('menuspeed', romweights, "normal")
|
||||||
ret.heartcolor = get_choice('heartcolor', romweights, "red")
|
ret.heartcolor = get_choice('heartcolor', romweights, "red")
|
||||||
|
|
10
Rom.py
10
Rom.py
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
JAP10HASH = '03a63945398191337e896e5771f77173'
|
JAP10HASH = '03a63945398191337e896e5771f77173'
|
||||||
RANDOMIZERBASEHASH = '93538d51eb018955a90181600e3384ba'
|
RANDOMIZERBASEHASH = '9cbbc0876dd5748125eda8b315347ad2'
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
@ -110,7 +110,6 @@ class LocalRom(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def verify(buffer, expected: str = RANDOMIZERBASEHASH) -> bool:
|
def verify(buffer, expected: str = RANDOMIZERBASEHASH) -> bool:
|
||||||
return True
|
|
||||||
buffermd5 = hashlib.md5()
|
buffermd5 = hashlib.md5()
|
||||||
buffermd5.update(buffer)
|
buffermd5.update(buffer)
|
||||||
return expected == buffermd5.hexdigest()
|
return expected == buffermd5.hexdigest()
|
||||||
|
@ -1106,10 +1105,6 @@ def patch_rom(world, rom, player, team, enemized):
|
||||||
# set up goals for treasure hunt
|
# set up goals for treasure hunt
|
||||||
rom.write_bytes(0x180163, [0x0E, 0x28] if world.treasure_hunt_icon[player] == 'Triforce Piece' else [0x0D, 0x28])
|
rom.write_bytes(0x180163, [0x0E, 0x28] if world.treasure_hunt_icon[player] == 'Triforce Piece' else [0x0D, 0x28])
|
||||||
rom.write_int16(0x180166, world.treasure_hunt_count[player])
|
rom.write_int16(0x180166, world.treasure_hunt_count[player])
|
||||||
if 'local' in world.goal[player]:
|
|
||||||
total_treasures = sum([world.treasure_hunt_count[x] for x in range(1, world.players + 1)])
|
|
||||||
rom.write_byte(0x180165, rom.read_byte(0x180165) | 0x80)
|
|
||||||
rom.write_int16(0x180166, total_treasures)
|
|
||||||
rom.write_byte(0x180194, 1) # Must turn in triforced pieces (instant win not enabled)
|
rom.write_byte(0x180194, 1) # Must turn in triforced pieces (instant win not enabled)
|
||||||
|
|
||||||
rom.write_bytes(0x180213, [0x00, 0x01]) # Not a Tournament Seed
|
rom.write_bytes(0x180213, [0x00, 0x01]) # Not a Tournament Seed
|
||||||
|
@ -1664,7 +1659,8 @@ def apply_rom_settings(rom, beep, color, quickswap, fastmenu, disable_music, tri
|
||||||
rom.write_byte(0x65561, {'red': 0x05, 'blue': 0x0D, 'green': 0x19, 'yellow': 0x09}[color])
|
rom.write_byte(0x65561, {'red': 0x05, 'blue': 0x0D, 'green': 0x19, 'yellow': 0x09}[color])
|
||||||
|
|
||||||
# set triforcehud
|
# set triforcehud
|
||||||
triforce_flag = (rom.read_byte(0x180165) & 0x80) | {'normal': 0x00, 'hide_goal': 0x01, 'hide_total': 0x02, 'hide_both': 0x03}[triforcehud]
|
triforce_flag = (rom.read_byte(0x180165) & 0x80) | {'normal': 0x00, 'hide_goal': 0x01, 'hide_required': 0x02, 'hide_both': 0x03}[triforcehud]
|
||||||
|
print(triforcehud, triforce_flag)
|
||||||
rom.write_byte(0x180165, triforce_flag)
|
rom.write_byte(0x180165, triforce_flag)
|
||||||
|
|
||||||
if z3pr:
|
if z3pr:
|
||||||
|
|
|
@ -1580,18 +1580,18 @@
|
||||||
"keyString": "rom.triforcehud.normal",
|
"keyString": "rom.triforcehud.normal",
|
||||||
"friendlyName": "Normal",
|
"friendlyName": "Normal",
|
||||||
"description": "Always displays HUD as usual.",
|
"description": "Always displays HUD as usual.",
|
||||||
"defaultValue": 50
|
"defaultValue": 0
|
||||||
},
|
},
|
||||||
"hide_goal": {
|
"hide_goal": {
|
||||||
"keyString": "rom.triforcehud.hide_goal",
|
"keyString": "rom.triforcehud.hide_goal",
|
||||||
"friendlyName": "Hide Goal",
|
"friendlyName": "Hide Goal",
|
||||||
"description": "Hide Triforce Hud elements until a single triforce piece is acquired.",
|
"description": "Hide Triforce Hud elements until a single triforce piece is acquired or spoken to Murahadala",
|
||||||
"defaultValue": 0
|
"defaultValue": 50
|
||||||
},
|
},
|
||||||
"hide_total": {
|
"hide_total": {
|
||||||
"keyString": "rom.triforcehud.hide_total",
|
"keyString": "rom.triforcehud.hide_required",
|
||||||
"friendlyName": "Hide Total",
|
"friendlyName": "Hide Required Total",
|
||||||
"description": "Hide total amount needed to win the game",
|
"description": "Hide total amount needed to win the game (unless spoken to Murahadala)",
|
||||||
"defaultValue": 0
|
"defaultValue": 0
|
||||||
},
|
},
|
||||||
"hide_both": {
|
"hide_both": {
|
||||||
|
|
Binary file not shown.
|
@ -388,6 +388,11 @@ rom:
|
||||||
quickswap: # Enable switching items by pressing the L+R shoulder buttons
|
quickswap: # Enable switching items by pressing the L+R shoulder buttons
|
||||||
on: 50
|
on: 50
|
||||||
off: 0
|
off: 0
|
||||||
|
triforcehud: # Disable visibility of the triforce hud unless collecting a piece or speaking to Murahalda
|
||||||
|
normal: 0 # original behavior (always visible)
|
||||||
|
hide_goal: 50 # hide counter until a piece is collected or speaking to Murahalda
|
||||||
|
hide_required: 0 # Always visible, but required amount is invisible until determined by Murahalda
|
||||||
|
hide_both: 0 # Hide both under above circumstances
|
||||||
menuspeed: # Controls how fast the item menu opens and closes
|
menuspeed: # Controls how fast the item menu opens and closes
|
||||||
normal: 50
|
normal: 50
|
||||||
instant: 0
|
instant: 0
|
||||||
|
|
Loading…
Reference in New Issue