Retro to match Bonta solution
Minor gui updates
This commit is contained in:
@@ -3,6 +3,8 @@ from enum import Enum, unique
|
|||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from EntranceShuffle import door_addresses
|
||||||
from _vendor.collections_extended import bag
|
from _vendor.collections_extended import bag
|
||||||
from Utils import int16_as_bytes
|
from Utils import int16_as_bytes
|
||||||
from Tables import normal_offset_table, spiral_offset_table
|
from Tables import normal_offset_table, spiral_offset_table
|
||||||
@@ -1244,10 +1246,9 @@ class ShopType(Enum):
|
|||||||
UpgradeShop = 2
|
UpgradeShop = 2
|
||||||
|
|
||||||
class Shop(object):
|
class Shop(object):
|
||||||
def __init__(self, region, room_id, default_door_id, type, shopkeeper_config, replaceable):
|
def __init__(self, region, room_id, type, shopkeeper_config, replaceable):
|
||||||
self.region = region
|
self.region = region
|
||||||
self.room_id = room_id
|
self.room_id = room_id
|
||||||
self.default_door_id = default_door_id
|
|
||||||
self.type = type
|
self.type = type
|
||||||
self.inventory = [None, None, None]
|
self.inventory = [None, None, None]
|
||||||
self.shopkeeper_config = shopkeeper_config
|
self.shopkeeper_config = shopkeeper_config
|
||||||
@@ -1265,10 +1266,8 @@ class Shop(object):
|
|||||||
# [id][roomID-low][roomID-high][doorID][zero][shop_config][shopkeeper_config][sram_index]
|
# [id][roomID-low][roomID-high][doorID][zero][shop_config][shopkeeper_config][sram_index]
|
||||||
entrances = self.region.entrances
|
entrances = self.region.entrances
|
||||||
config = self.item_count
|
config = self.item_count
|
||||||
if len(entrances) == 1 and entrances[0].addresses:
|
if len(entrances) == 1 and entrances[0].name in door_addresses:
|
||||||
door_id = entrances[0].addresses+1
|
door_id = door_addresses[entrances[0].name][0]+1
|
||||||
elif self.default_door_id is not None:
|
|
||||||
door_id = self.default_door_id
|
|
||||||
else:
|
else:
|
||||||
door_id = 0
|
door_id = 0
|
||||||
config |= 0x40 # ignore door id
|
config |= 0x40 # ignore door id
|
||||||
|
|||||||
37
Gui.py
37
Gui.py
@@ -90,6 +90,34 @@ def guiMain(args=None):
|
|||||||
|
|
||||||
fileDialogFrame = Frame(rightHalfFrame)
|
fileDialogFrame = Frame(rightHalfFrame)
|
||||||
|
|
||||||
|
heartbeepFrame = Frame(fileDialogFrame)
|
||||||
|
heartbeepVar = StringVar()
|
||||||
|
heartbeepVar.set('normal')
|
||||||
|
heartbeepOptionMenu = OptionMenu(heartbeepFrame, heartbeepVar, 'double', 'normal', 'half', 'quarter', 'off')
|
||||||
|
heartbeepOptionMenu.pack(side=RIGHT)
|
||||||
|
heartbeepLabel = Label(heartbeepFrame, text='Heartbeep sound rate')
|
||||||
|
heartbeepLabel.pack(side=LEFT, padx=(0,52))
|
||||||
|
|
||||||
|
heartcolorFrame = Frame(fileDialogFrame)
|
||||||
|
heartcolorVar = StringVar()
|
||||||
|
heartcolorVar.set('red')
|
||||||
|
heartcolorOptionMenu = OptionMenu(heartcolorFrame, heartcolorVar, 'red', 'blue', 'green', 'yellow', 'random')
|
||||||
|
heartcolorOptionMenu.pack(side=RIGHT)
|
||||||
|
heartcolorLabel = Label(heartcolorFrame, text='Heart color')
|
||||||
|
heartcolorLabel.pack(side=LEFT, padx=(0,127))
|
||||||
|
|
||||||
|
fastMenuFrame = Frame(fileDialogFrame)
|
||||||
|
fastMenuVar = StringVar()
|
||||||
|
fastMenuVar.set('normal')
|
||||||
|
fastMenuOptionMenu = OptionMenu(fastMenuFrame, fastMenuVar, 'normal', 'instant', 'double', 'triple', 'quadruple', 'half')
|
||||||
|
fastMenuOptionMenu.pack(side=RIGHT)
|
||||||
|
fastMenuLabel = Label(fastMenuFrame, text='Menu speed')
|
||||||
|
fastMenuLabel.pack(side=LEFT, padx=(0,100))
|
||||||
|
|
||||||
|
heartbeepFrame.pack(expand=True, anchor=E)
|
||||||
|
heartcolorFrame.pack(expand=True, anchor=E)
|
||||||
|
fastMenuFrame.pack(expand=True, anchor=E)
|
||||||
|
|
||||||
romDialogFrame = Frame(fileDialogFrame)
|
romDialogFrame = Frame(fileDialogFrame)
|
||||||
baseRomLabel = Label(romDialogFrame, text='Base Rom')
|
baseRomLabel = Label(romDialogFrame, text='Base Rom')
|
||||||
romVar = StringVar()
|
romVar = StringVar()
|
||||||
@@ -144,7 +172,7 @@ def guiMain(args=None):
|
|||||||
modeVar.set('open')
|
modeVar.set('open')
|
||||||
modeOptionMenu = OptionMenu(modeFrame, modeVar, 'standard', 'open', 'inverted')
|
modeOptionMenu = OptionMenu(modeFrame, modeVar, 'standard', 'open', 'inverted')
|
||||||
modeOptionMenu.pack(side=RIGHT)
|
modeOptionMenu.pack(side=RIGHT)
|
||||||
modeLabel = Label(modeFrame, text='Game Mode')
|
modeLabel = Label(modeFrame, text='Game mode')
|
||||||
modeLabel.pack(side=LEFT)
|
modeLabel.pack(side=LEFT)
|
||||||
|
|
||||||
logicFrame = Frame(drowDownFrame)
|
logicFrame = Frame(drowDownFrame)
|
||||||
@@ -208,7 +236,7 @@ def guiMain(args=None):
|
|||||||
difficultyVar.set('normal')
|
difficultyVar.set('normal')
|
||||||
difficultyOptionMenu = OptionMenu(difficultyFrame, difficultyVar, 'normal', 'hard', 'expert')
|
difficultyOptionMenu = OptionMenu(difficultyFrame, difficultyVar, 'normal', 'hard', 'expert')
|
||||||
difficultyOptionMenu.pack(side=RIGHT)
|
difficultyOptionMenu.pack(side=RIGHT)
|
||||||
difficultyLabel = Label(difficultyFrame, text='Game difficulty')
|
difficultyLabel = Label(difficultyFrame, text='Difficulty: item pool')
|
||||||
difficultyLabel.pack(side=LEFT)
|
difficultyLabel.pack(side=LEFT)
|
||||||
|
|
||||||
timerFrame = Frame(drowDownFrame)
|
timerFrame = Frame(drowDownFrame)
|
||||||
@@ -1137,10 +1165,15 @@ def guiMain(args=None):
|
|||||||
if args.seed:
|
if args.seed:
|
||||||
seedVar.set(str(args.seed))
|
seedVar.set(str(args.seed))
|
||||||
modeVar.set(args.mode)
|
modeVar.set(args.mode)
|
||||||
|
swordsVar.set(args.swords)
|
||||||
difficultyVar.set(args.difficulty)
|
difficultyVar.set(args.difficulty)
|
||||||
|
itemFuncVar.set(args.item_functionality)
|
||||||
timerVar.set(args.timer)
|
timerVar.set(args.timer)
|
||||||
progressiveVar.set(args.progressive)
|
progressiveVar.set(args.progressive)
|
||||||
|
accessibilityVar.set(args.accessibility)
|
||||||
goalVar.set(args.goal)
|
goalVar.set(args.goal)
|
||||||
|
crystalsGTVar.set(args.crystals_gt)
|
||||||
|
crystalsGanonVar.set(args.crystals_ganon)
|
||||||
algorithmVar.set(args.algorithm)
|
algorithmVar.set(args.algorithm)
|
||||||
shuffleVar.set(args.shuffle)
|
shuffleVar.set(args.shuffle)
|
||||||
doorShuffleVar.set(args.door_shuffle)
|
doorShuffleVar.set(args.door_shuffle)
|
||||||
|
|||||||
@@ -302,16 +302,16 @@ def create_inverted_regions(world, player):
|
|||||||
create_cave_region(player, 'The Sky', 'A Dark Sky', None, ['DDM Landing','NEDW Landing', 'WDW Landing', 'SDW Landing', 'EDW Landing', 'DD Landing', 'DLHL Landing'])
|
create_cave_region(player, 'The Sky', 'A Dark Sky', None, ['DDM Landing','NEDW Landing', 'WDW Landing', 'SDW Landing', 'EDW Landing', 'DD Landing', 'DLHL Landing'])
|
||||||
]
|
]
|
||||||
|
|
||||||
for region_name, (room_id, default_door_id, shopkeeper, replaceable) in shop_table.items():
|
for region_name, (room_id, shopkeeper, replaceable) in shop_table.items():
|
||||||
region = world.get_region(region_name, player)
|
region = world.get_region(region_name, player)
|
||||||
shop = Shop(region, room_id, default_door_id, ShopType.Shop, shopkeeper, replaceable)
|
shop = Shop(region, room_id, ShopType.Shop, shopkeeper, replaceable)
|
||||||
region.shop = shop
|
region.shop = shop
|
||||||
world.shops.append(shop)
|
world.shops.append(shop)
|
||||||
for index, (item, price) in enumerate(default_shop_contents[region_name]):
|
for index, (item, price) in enumerate(default_shop_contents[region_name]):
|
||||||
shop.add_inventory(index, item, price)
|
shop.add_inventory(index, item, price)
|
||||||
|
|
||||||
region = world.get_region('Capacity Upgrade', player)
|
region = world.get_region('Capacity Upgrade', player)
|
||||||
shop = Shop(region, 0x0115, 0x5D, ShopType.UpgradeShop, 0x04, True)
|
shop = Shop(region, 0x0115, ShopType.UpgradeShop, 0x04, True)
|
||||||
region.shop = shop
|
region.shop = shop
|
||||||
world.shops.append(shop)
|
world.shops.append(shop)
|
||||||
shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7)
|
shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7)
|
||||||
@@ -373,18 +373,18 @@ def mark_dark_world_regions(world):
|
|||||||
seen.add(exit.connected_region)
|
seen.add(exit.connected_region)
|
||||||
queue.append(exit.connected_region)
|
queue.append(exit.connected_region)
|
||||||
|
|
||||||
# (room_id, default_door_id, shopkeeper, replaceable)
|
# (room_id, shopkeeper, replaceable)
|
||||||
shop_table = {
|
shop_table = {
|
||||||
'Cave Shop (Dark Death Mountain)': (0x0112, 0x6E, 0xC1, True),
|
'Cave Shop (Dark Death Mountain)': (0x0112, 0xC1, True),
|
||||||
'Red Shield Shop': (0x0110, 0x75, 0xC1, True),
|
'Red Shield Shop': (0x0110, 0xC1, True),
|
||||||
'Dark Lake Hylia Shop': (0x010F, 0x74, 0xC1, True),
|
'Dark Lake Hylia Shop': (0x010F, 0xC1, True),
|
||||||
'Dark World Lumberjack Shop': (0x010F, 0x57, 0xC1, True),
|
'Dark World Lumberjack Shop': (0x010F, 0xC1, True),
|
||||||
'Village of Outcasts Shop': (0x010F, 0x60, 0xC1, True),
|
'Village of Outcasts Shop': (0x010F, 0xC1, True),
|
||||||
'Dark World Potion Shop': (0x010F, 0x6F, 0xC1, True),
|
'Dark World Potion Shop': (0x010F, 0xC1, True),
|
||||||
'Light World Death Mountain Shop': (0x00FF, None, 0xA0, True),
|
'Light World Death Mountain Shop': (0x00FF, 0xA0, True),
|
||||||
'Kakariko Shop': (0x011F, 0x46, 0xA0, True),
|
'Kakariko Shop': (0x011F, 0xA0, True),
|
||||||
'Cave Shop (Lake Hylia)': (0x0112, 0x58, 0xA0, True),
|
'Cave Shop (Lake Hylia)': (0x0112, 0xA0, True),
|
||||||
'Potion Shop': (0x0109, 0x4C, 0xFF, False),
|
'Potion Shop': (0x0109, 0xFF, False),
|
||||||
# Bomb Shop not currently modeled as a shop, due to special nature of items
|
# Bomb Shop not currently modeled as a shop, due to special nature of items
|
||||||
}
|
}
|
||||||
# region, [item]
|
# region, [item]
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ def set_up_take_anys(world, player):
|
|||||||
entrance = world.get_region(reg, player).entrances[0]
|
entrance = world.get_region(reg, player).entrances[0]
|
||||||
connect_entrance(world, entrance, old_man_take_any, player)
|
connect_entrance(world, entrance, old_man_take_any, player)
|
||||||
entrance.target = 0x58
|
entrance.target = 0x58
|
||||||
old_man_take_any.shop = Shop(old_man_take_any, 0x0112, None, ShopType.TakeAny, 0xE2, True)
|
old_man_take_any.shop = Shop(old_man_take_any, 0x0112, ShopType.TakeAny, 0xE2, True)
|
||||||
world.shops.append(old_man_take_any.shop)
|
world.shops.append(old_man_take_any.shop)
|
||||||
old_man_take_any.shop.active = True
|
old_man_take_any.shop.active = True
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ def set_up_take_anys(world, player):
|
|||||||
entrance = world.get_region(reg, player).entrances[0]
|
entrance = world.get_region(reg, player).entrances[0]
|
||||||
connect_entrance(world, entrance, take_any, player)
|
connect_entrance(world, entrance, take_any, player)
|
||||||
entrance.target = target
|
entrance.target = target
|
||||||
take_any.shop = Shop(take_any, room_id, None, ShopType.TakeAny, 0xE3, True)
|
take_any.shop = Shop(take_any, room_id, ShopType.TakeAny, 0xE3, True)
|
||||||
world.shops.append(take_any.shop)
|
world.shops.append(take_any.shop)
|
||||||
take_any.shop.active = True
|
take_any.shop.active = True
|
||||||
take_any.shop.add_inventory(0, 'Blue Potion', 0, 0)
|
take_any.shop.add_inventory(0, 'Blue Potion', 0, 0)
|
||||||
|
|||||||
2
Main.py
2
Main.py
@@ -290,7 +290,7 @@ def copy_dynamic_regions_and_locations(world, ret):
|
|||||||
# Note: ideally exits should be copied here, but the current use case (Take anys) do not require this
|
# Note: ideally exits should be copied here, but the current use case (Take anys) do not require this
|
||||||
|
|
||||||
if region.shop:
|
if region.shop:
|
||||||
new_reg.shop = Shop(new_reg, region.shop.room_id, region.shop.default_door_id, region.shop.type, region.shop.shopkeeper_config, region.shop.replaceable)
|
new_reg.shop = Shop(new_reg, region.shop.room_id, region.shop.type, region.shop.shopkeeper_config, region.shop.replaceable)
|
||||||
ret.shops.append(new_reg.shop)
|
ret.shops.append(new_reg.shop)
|
||||||
|
|
||||||
for location in world.dynamic_locations:
|
for location in world.dynamic_locations:
|
||||||
|
|||||||
28
Regions.py
28
Regions.py
@@ -705,16 +705,16 @@ def create_regions(world, player):
|
|||||||
create_dungeon_region(player, 'GT Agahnim 2', 'Ganon\'s Tower', ['Agahnim 2'], ['GT Agahnim 2 SW'])
|
create_dungeon_region(player, 'GT Agahnim 2', 'Ganon\'s Tower', ['Agahnim 2'], ['GT Agahnim 2 SW'])
|
||||||
]
|
]
|
||||||
|
|
||||||
for region_name, (room_id, default_door_id, shopkeeper, replaceable) in shop_table.items():
|
for region_name, (room_id, shopkeeper, replaceable) in shop_table.items():
|
||||||
region = world.get_region(region_name, player)
|
region = world.get_region(region_name, player)
|
||||||
shop = Shop(region, room_id, default_door_id, ShopType.Shop, shopkeeper, replaceable)
|
shop = Shop(region, room_id, ShopType.Shop, shopkeeper, replaceable)
|
||||||
region.shop = shop
|
region.shop = shop
|
||||||
world.shops.append(shop)
|
world.shops.append(shop)
|
||||||
for index, (item, price) in enumerate(default_shop_contents[region_name]):
|
for index, (item, price) in enumerate(default_shop_contents[region_name]):
|
||||||
shop.add_inventory(index, item, price)
|
shop.add_inventory(index, item, price)
|
||||||
|
|
||||||
region = world.get_region('Capacity Upgrade', player)
|
region = world.get_region('Capacity Upgrade', player)
|
||||||
shop = Shop(region, 0x0115, 0x5D, ShopType.UpgradeShop, 0x04, True)
|
shop = Shop(region, 0x0115, ShopType.UpgradeShop, 0x04, True)
|
||||||
region.shop = shop
|
region.shop = shop
|
||||||
world.shops.append(shop)
|
world.shops.append(shop)
|
||||||
shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7)
|
shop.add_inventory(0, 'Bomb Upgrade (+5)', 100, 7)
|
||||||
@@ -780,18 +780,18 @@ def mark_light_world_regions(world):
|
|||||||
seen.add(exit.connected_region)
|
seen.add(exit.connected_region)
|
||||||
queue.append(exit.connected_region)
|
queue.append(exit.connected_region)
|
||||||
|
|
||||||
# (room_id, default_door_id, shopkeeper, replaceable)
|
# (room_id, shopkeeper, replaceable)
|
||||||
shop_table = {
|
shop_table = {
|
||||||
'Cave Shop (Dark Death Mountain)': (0x0112, 0x6E, 0xC1, True),
|
'Cave Shop (Dark Death Mountain)': (0x0112, 0xC1, True),
|
||||||
'Red Shield Shop': (0x0110, 0x75, 0xC1, True),
|
'Red Shield Shop': (0x0110, 0xC1, True),
|
||||||
'Dark Lake Hylia Shop': (0x010F, 0x74, 0xC1, True),
|
'Dark Lake Hylia Shop': (0x010F, 0xC1, True),
|
||||||
'Dark World Lumberjack Shop': (0x010F, 0x57, 0xC1, True),
|
'Dark World Lumberjack Shop': (0x010F, 0xC1, True),
|
||||||
'Village of Outcasts Shop': (0x010F, 0x60, 0xC1, True),
|
'Village of Outcasts Shop': (0x010F, 0xC1, True),
|
||||||
'Dark World Potion Shop': (0x010F, 0x6F, 0xC1, True),
|
'Dark World Potion Shop': (0x010F, 0xC1, True),
|
||||||
'Light World Death Mountain Shop': (0x00FF, None, 0xA0, True),
|
'Light World Death Mountain Shop': (0x00FF, 0xA0, True),
|
||||||
'Kakariko Shop': (0x011F, 0x46, 0xA0, True),
|
'Kakariko Shop': (0x011F, 0xA0, True),
|
||||||
'Cave Shop (Lake Hylia)': (0x0112, 0x58, 0xA0, True),
|
'Cave Shop (Lake Hylia)': (0x0112, 0xA0, True),
|
||||||
'Potion Shop': (0x0109, 0x4C, 0xFF, False),
|
'Potion Shop': (0x0109, 0xFF, False),
|
||||||
# Bomb Shop not currently modeled as a shop, due to special nature of items
|
# Bomb Shop not currently modeled as a shop, due to special nature of items
|
||||||
}
|
}
|
||||||
# region, [item]
|
# region, [item]
|
||||||
|
|||||||
Reference in New Issue
Block a user