Merge branch 'shop-generate' of github.com:pepperpow/MultiWorld-Utilities into multishop-all
This commit is contained in:
commit
37493c85dc
|
@ -326,7 +326,9 @@ def parse_arguments(argv, no_defaults=False):
|
||||||
parser.add_argument('--beemizer', default=defval(0), type=lambda value: min(max(int(value), 0), 4))
|
parser.add_argument('--beemizer', default=defval(0), type=lambda value: min(max(int(value), 0), 4))
|
||||||
parser.add_argument('--shop_shuffle', default='', help='''\
|
parser.add_argument('--shop_shuffle', default='', help='''\
|
||||||
combine letters for options:
|
combine letters for options:
|
||||||
i: shuffle the inventories of the shops around
|
g: generate default inventories for light and dark world shops, and unique shops
|
||||||
|
f: generate default inventories for each shop individually
|
||||||
|
i: shuffle the default inventories of the shops around
|
||||||
p: randomize the prices of the items in shop inventories
|
p: randomize the prices of the items in shop inventories
|
||||||
u: shuffle capacity upgrades into the item pool
|
u: shuffle capacity upgrades into the item pool
|
||||||
''')
|
''')
|
||||||
|
|
1
Fill.py
1
Fill.py
|
@ -152,6 +152,7 @@ def distribute_items_restrictive(world, gftower_trash=False, fill_locations=None
|
||||||
fill_locations.remove(spot_to_fill)
|
fill_locations.remove(spot_to_fill)
|
||||||
|
|
||||||
world.random.shuffle(fill_locations)
|
world.random.shuffle(fill_locations)
|
||||||
|
|
||||||
prioitempool, fill_locations = fast_fill(world, prioitempool, fill_locations)
|
prioitempool, fill_locations = fast_fill(world, prioitempool, fill_locations)
|
||||||
|
|
||||||
restitempool, fill_locations = fast_fill(world, restitempool, fill_locations)
|
restitempool, fill_locations = fast_fill(world, restitempool, fill_locations)
|
||||||
|
|
|
@ -383,7 +383,8 @@ def shuffle_shops(world, items, player: int):
|
||||||
if 'p' in option:
|
if 'p' in option:
|
||||||
def price_adjust(price: int) -> int:
|
def price_adjust(price: int) -> int:
|
||||||
# it is important that a base price of 0 always returns 0 as new price!
|
# it is important that a base price of 0 always returns 0 as new price!
|
||||||
return int(price * (0.5 + world.random.random() * 1.5))
|
adjust = 2 if price < 100 else 5
|
||||||
|
return int((price / adjust) * (0.5 + world.random.random() * 1.5)) * adjust
|
||||||
|
|
||||||
def adjust_item(item):
|
def adjust_item(item):
|
||||||
if item:
|
if item:
|
||||||
|
@ -398,6 +399,7 @@ def shuffle_shops(world, items, player: int):
|
||||||
|
|
||||||
if 'i' in option:
|
if 'i' in option:
|
||||||
world.random.shuffle(total_inventory)
|
world.random.shuffle(total_inventory)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for shop in shops:
|
for shop in shops:
|
||||||
slots = shop.slots
|
slots = shop.slots
|
||||||
|
@ -468,7 +470,7 @@ def create_dynamic_shop_locations(world, player):
|
||||||
if item is None:
|
if item is None:
|
||||||
continue
|
continue
|
||||||
if item['create_location']:
|
if item['create_location']:
|
||||||
loc = Location(player, "{} Item {}".format(shop.region.name, i+1), parent=shop.region)
|
loc = Location(player, "{} Slot Item {}".format(shop.region.name, i+1), parent=shop.region)
|
||||||
shop.region.locations.append(loc)
|
shop.region.locations.append(loc)
|
||||||
world.dynamic_locations.append(loc)
|
world.dynamic_locations.append(loc)
|
||||||
|
|
||||||
|
|
27
Regions.py
27
Regions.py
|
@ -378,6 +378,24 @@ def create_shops(world, player: int):
|
||||||
world.random.shuffle(my_shop_slots)
|
world.random.shuffle(my_shop_slots)
|
||||||
|
|
||||||
from Items import ItemFactory
|
from Items import ItemFactory
|
||||||
|
if 'g' in option or 'f' in option:
|
||||||
|
new_basic_shop = world.random.sample(shop_generation_types['default'], k=3)
|
||||||
|
new_dark_shop = world.random.sample(shop_generation_types['default'], k=3)
|
||||||
|
for name, shop in my_shop_table.items():
|
||||||
|
typ, shop_id, keeper, custom, locked, items = shop
|
||||||
|
new_items = world.random.sample(shop_generation_types['default'], k=3)
|
||||||
|
if 'f' not in option:
|
||||||
|
if items == _basic_shop_defaults:
|
||||||
|
new_items = new_basic_shop
|
||||||
|
elif items == _dark_world_shop_defaults:
|
||||||
|
new_items = new_dark_shop
|
||||||
|
if name == 'Capacity Upgrade':
|
||||||
|
continue
|
||||||
|
if name == 'Potion Shop':
|
||||||
|
continue
|
||||||
|
keeper = world.random.choice([0xA0, 0xC1, 0xFF])
|
||||||
|
my_shop_table[name] = (typ, shop_id, keeper, custom, locked, new_items)
|
||||||
|
|
||||||
for region_name, (room_id, type, shopkeeper, custom, locked, inventory) in my_shop_table.items():
|
for region_name, (room_id, type, shopkeeper, custom, locked, inventory) in my_shop_table.items():
|
||||||
if world.mode[player] == 'inverted' and region_name == 'Dark Lake Hylia Shop':
|
if world.mode[player] == 'inverted' and region_name == 'Dark Lake Hylia Shop':
|
||||||
locked = True
|
locked = True
|
||||||
|
@ -402,6 +420,7 @@ def create_shops(world, player: int):
|
||||||
|
|
||||||
world.clear_location_cache()
|
world.clear_location_cache()
|
||||||
|
|
||||||
|
|
||||||
# (type, room_id, shopkeeper, custom, locked, [items])
|
# (type, room_id, shopkeeper, custom, locked, [items])
|
||||||
# item = (item, price, max=0, replacement=None, replacement_price=0)
|
# item = (item, price, max=0, replacement=None, replacement_price=0)
|
||||||
_basic_shop_defaults = [('Red Potion', 150), ('Small Heart', 10), ('Bombs (10)', 50)]
|
_basic_shop_defaults = [('Red Potion', 150), ('Small Heart', 10), ('Bombs (10)', 50)]
|
||||||
|
@ -420,6 +439,14 @@ shop_table = {
|
||||||
'Capacity Upgrade': (0x0115, ShopType.UpgradeShop, 0x04, True, True, [('Bomb Upgrade (+5)', 100, 7), ('Arrow Upgrade (+5)', 100, 7)])
|
'Capacity Upgrade': (0x0115, ShopType.UpgradeShop, 0x04, True, True, [('Bomb Upgrade (+5)', 100, 7), ('Arrow Upgrade (+5)', 100, 7)])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shop_generation_types = {
|
||||||
|
'default': _basic_shop_defaults + [('Bombs (3)', 20), ('Green Potion', 90), ('Blue Potion', 190), ('Bee', 10), ('Single Arrow', 5)] + [('Red Shield', 500), ('Blue Shield', 50)],
|
||||||
|
'potion': [('Red Potion', 150), ('Green Potion', 90), ('Blue Potion', 190)],
|
||||||
|
'discount_potion': [('Red Potion', 120), ('Green Potion', 60), ('Blue Potion', 160)],
|
||||||
|
'bottle': [('Bee', 10)],
|
||||||
|
'time': [('Red Clock', 100), ('Blue Clock', 200), ('Green Clock', 300)],
|
||||||
|
}
|
||||||
|
|
||||||
old_location_address_to_new_location_address = {
|
old_location_address_to_new_location_address = {
|
||||||
0x2eb18: 0x18001b, # Bottle Merchant
|
0x2eb18: 0x18001b, # Bottle Merchant
|
||||||
0x33d68: 0x18001a, # Purple Chest
|
0x33d68: 0x18001a, # Purple Chest
|
||||||
|
|
|
@ -1092,6 +1092,18 @@
|
||||||
"description": "Shop contents are left unchanged.",
|
"description": "Shop contents are left unchanged.",
|
||||||
"defaultValue": 50
|
"defaultValue": 50
|
||||||
},
|
},
|
||||||
|
"g": {
|
||||||
|
"keyString": "shop_shuffle.g",
|
||||||
|
"friendlyName": "Inventory Generate",
|
||||||
|
"description": "Generates new default base inventories of overworld and underworld shops.",
|
||||||
|
"defaultValue": 0
|
||||||
|
},
|
||||||
|
"f": {
|
||||||
|
"keyString": "shop_shuffle.f",
|
||||||
|
"friendlyName": "Full Inventory Generate",
|
||||||
|
"description": "Generates new base inventories of each individual shop.",
|
||||||
|
"defaultValue": 0
|
||||||
|
},
|
||||||
"i": {
|
"i": {
|
||||||
"keyString": "shop_shuffle.i",
|
"keyString": "shop_shuffle.i",
|
||||||
"friendlyName": "Inventory Shuffle",
|
"friendlyName": "Inventory Shuffle",
|
||||||
|
|
|
@ -222,10 +222,13 @@ potion_shop_shuffle: # influence of potion shop by shop shuffle
|
||||||
a: 0 # generate/shuffle in any items
|
a: 0 # generate/shuffle in any items
|
||||||
shop_shuffle:
|
shop_shuffle:
|
||||||
none: 50
|
none: 50
|
||||||
|
g: 0 # Generate new default inventories for overworld/underworld shops, and unique shops
|
||||||
|
f: 0 # Generate new default inventories for every shop independently
|
||||||
i: 0 # Shuffle default inventories of the shops around
|
i: 0 # Shuffle default inventories of the shops around
|
||||||
p: 0 # Randomize the prices of the items in shop inventories
|
p: 0 # Randomize the prices of the items in shop inventories
|
||||||
u: 0 # Shuffle capacity upgrades into the item pool (and allow them to traverse the multiworld)
|
u: 0 # Shuffle capacity upgrades into the item pool (and allow them to traverse the multiworld)
|
||||||
ip: 0 # Shuffle inventories and randomize prices
|
ip: 0 # Shuffle inventories and randomize prices
|
||||||
|
fpu: 0 # Generate new inventories, randomize prices and shuffle capacity upgrades into item pool
|
||||||
uip: 0 # Shuffle inventories, randomize prices and shuffle capacity upgrades into the item pool
|
uip: 0 # Shuffle inventories, randomize prices and shuffle capacity upgrades into the item pool
|
||||||
# You can add more combos
|
# You can add more combos
|
||||||
shuffle_prizes: # aka drops
|
shuffle_prizes: # aka drops
|
||||||
|
|
Loading…
Reference in New Issue