mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Merge remote-tracking branch 'pepper/multishop-all' into multishop
# Conflicts: # EntranceRandomizer.py # Rom.py # WebHostLib/static/static/playerSettings.json # data/basepatch.bmbp
This commit is contained in:
18
Rom.py
18
Rom.py
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
JAP10HASH = '03a63945398191337e896e5771f77173'
|
||||
RANDOMIZERBASEHASH = '5a607e36a82bbd14180536c8ec3ae49b'
|
||||
RANDOMIZERBASEHASH = '0954a778832b76ba4f96b10eb527ee83'
|
||||
|
||||
import io
|
||||
import json
|
||||
@@ -123,6 +123,9 @@ class LocalRom(object):
|
||||
Patch.create_patch_file(local_path('basepatch.sfc'))
|
||||
return
|
||||
|
||||
if not os.path.isfile(local_path('data', 'basepatch.bmbp')):
|
||||
raise RuntimeError('Base patch unverified. Unable to continue.')
|
||||
|
||||
if os.path.isfile(local_path('data', 'basepatch.bmbp')):
|
||||
_, target, buffer = Patch.create_rom_bytes(local_path('data', 'basepatch.bmbp'))
|
||||
if self.verify(buffer):
|
||||
@@ -130,6 +133,7 @@ class LocalRom(object):
|
||||
with open(local_path('basepatch.sfc'), 'wb') as stream:
|
||||
stream.write(buffer)
|
||||
return
|
||||
raise RuntimeError('Base patch unverified. Unable to continue.')
|
||||
|
||||
raise RuntimeError('Could not find Base Patch. Unable to continue.')
|
||||
|
||||
@@ -677,6 +681,7 @@ def patch_rom(world, rom, player, team, enemized):
|
||||
distinguished_prog_bow_loc.item.code = 0x65
|
||||
|
||||
# patch items
|
||||
|
||||
for location in world.get_locations():
|
||||
if location.player != player:
|
||||
continue
|
||||
@@ -686,6 +691,9 @@ def patch_rom(world, rom, player, team, enemized):
|
||||
if location.address is None:
|
||||
continue
|
||||
|
||||
if 'Shop Slot' in location.name and location.parent_region.shop is not None:
|
||||
continue
|
||||
|
||||
if not location.crystal:
|
||||
if location.item is not None:
|
||||
# Keys in their native dungeon should use the orignal item code for keys
|
||||
@@ -724,6 +732,7 @@ def patch_rom(world, rom, player, team, enemized):
|
||||
for music_address in music_addresses:
|
||||
rom.write_byte(music_address, music)
|
||||
|
||||
|
||||
if world.mapshuffle[player]:
|
||||
rom.write_byte(0x155C9, local_random.choice([0x11, 0x16])) # Randomize GT music too with map shuffle
|
||||
|
||||
@@ -1564,14 +1573,13 @@ def write_custom_shops(rom, world, player):
|
||||
else:
|
||||
sram_offset += shop.item_count
|
||||
shop_data.extend(bytes)
|
||||
# [id][item][price-low][price-high][max][repl_id][repl_price-low][repl_price-high]
|
||||
# [id][item][price-low][price-high][max][repl_id][repl_price-low][repl_price-high][player]
|
||||
for item in shop.inventory:
|
||||
if item is None:
|
||||
break
|
||||
item_data = [shop_id, ItemFactory(item['item'], player).code] + int16_as_bytes(item['price']) + [
|
||||
item['max'],
|
||||
item_data = [shop_id, ItemFactory(item['item'], player).code] + int16_as_bytes(item['price']) + [ item['max'],\
|
||||
ItemFactory(item['replacement'], player).code if item['replacement'] else 0xFF] + int16_as_bytes(
|
||||
item['replacement_price'])
|
||||
item['replacement_price']) + [item['player']]
|
||||
items_data.extend(item_data)
|
||||
|
||||
rom.write_bytes(0x184800, shop_data)
|
||||
|
Reference in New Issue
Block a user