Potion Shop Changes

(reduced)
This commit is contained in:
pepperpow
2020-11-23 19:00:11 -06:00
parent 4370447adc
commit fe218fffa6
10 changed files with 60 additions and 15 deletions

14
Rom.py
View File

@@ -1,7 +1,7 @@
from __future__ import annotations
JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'e3714804e3fae1c6ac6100b94d1aee62'
RANDOMIZERBASEHASH = '383b6f24e7c154de0f215e09f3cc937e'
import io
import json
@@ -122,6 +122,9 @@ class LocalRom(object):
if not os.path.exists(local_path('data', 'basepatch.bmbp')):
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'))
@@ -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.')
@@ -1513,10 +1517,10 @@ def write_custom_shops(rom, world, 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'],
ItemFactory(item['replacement'], player).code if item['replacement'] else 0xFF] + int16_as_bytes(
item['replacement_price'])
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']) + [0]
items_data.extend(item_data)
rom.write_bytes(0x184800, shop_data)