Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings for more control over special deal prices #2037

Open
wants to merge 1 commit into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 60 additions & 23 deletions SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -2391,8 +2391,8 @@ class SettingInfos:
'random': 'Random # of Items Per Shop',
},
disable = {
'off': {'settings': ['shopsanity_prices']},
'0': {'settings': ['shopsanity_prices']},
'off': {'settings': ['special_deal_price_distribution', 'special_deal_price_min', 'special_deal_price_max']},
'0': {'settings': ['special_deal_price_distribution', 'special_deal_price_min', 'special_deal_price_max']},
},
gui_tooltip = '''\
Randomizes Shop contents.
Expand Down Expand Up @@ -2433,40 +2433,77 @@ class SettingInfos:
},
)

shopsanity_prices = Combobox(
gui_text = 'Shopsanity Prices',
default = 'random',
special_deal_price_distribution = Combobox(
gui_text = 'Special Deal Prices',
default = 'betavariate',
choices = {
'random': "Random",
'random_starting': "Starting Wallet",
'random_adult': "Adult's Wallet",
'random_giant': "Giant's Wallet",
'random_tycoon': "Tycoon's Wallet",
'affordable': "Affordable",
'vanilla': 'Vanilla',
'betavariate': 'Weighted',
'uniform': 'Uniform',
},
disable = {
'vanilla': {'settings': ['special_deal_price_min', 'special_deal_price_max']},
},
gui_tooltip = '''\
Controls the randomization of prices for shopsanity items.
For more control, utilize the plandomizer.
Controls how the prices for Special Deal items in shops are
selected. For more control, utilize the plandomizer.

'Random': The default randomization. Shop prices for
shopsanity items will range between 0 to 300 rupees,
with a bias towards values slightly below the middle of the
range, in multiples of 5.
'Vanilla': 'Each item will be sold for the price of the item
that appears in its slot in the vanilla game.

'X Wallet': Shop prices for shopsanity items will range
between 0 and the specified wallet's maximum capacity,
in multiples of 5.
'Weighted': Shop prices will be biased towards slightly below
the middle of the selected range, with very low or very high
prices only appearing rarely.

'Affordable': Shop prices for shopsanity items will be
fixed to 10 rupees.
'Uniform': Each price value in the selected range is equally
likely.
''',
disabled_default = 'random',
shared = True,
gui_params = {
"hide_when_disabled": True,
},
)

special_deal_price_min = Scale(
gui_text = 'Minimum Special Deal Price',
default = 0,
minimum = 0,
maximum = 995,
step = 5,
shared = True,
gui_tooltip = '''\
Select the minimum price in rupees for Special Deal
items in shops. Prices will be selected randomly in
multiples of 5 according to the "Special Deal Price
Distribution" setting. Set this setting and "Maximum
Special Deal Price" to the same value to give all
Special Deals a fixed price.
''',
gui_params = {
"hide_when_disabled": True,
},
)

special_deal_price_max = Scale(
gui_text = 'Maximum Special Deal Price',
default = 300,
minimum = 0,
maximum = 995,
step = 5,
shared = True,
gui_tooltip = '''\
Select the maximum price in rupees for Special Deal
items in shops. Prices will be selected randomly in
multiples of 5 according to the "Special Deal Price
Distribution" setting. Set this setting and "Minimum
Special Deal Price" to the same value to give all
Special Deals a fixed price.
''',
gui_params = {
"hide_when_disabled": True,
},
)

tokensanity = Combobox(
gui_text = 'Tokensanity',
default = 'off',
Expand Down
24 changes: 12 additions & 12 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,18 +685,18 @@ def random_shop_prices(self) -> None:
for location in region.locations:
if location.type == 'Shop':
if location.name[-1:] in shop_item_indexes[:shop_item_count]:
if self.settings.shopsanity_prices == 'random':
self.shop_prices[location.name] = int(random.betavariate(1.5, 2) * 60) * 5
elif self.settings.shopsanity_prices == 'random_starting':
self.shop_prices[location.name] = random.randrange(0, 100, 5)
elif self.settings.shopsanity_prices == 'random_adult':
self.shop_prices[location.name] = random.randrange(0, 201, 5)
elif self.settings.shopsanity_prices == 'random_giant':
self.shop_prices[location.name] = random.randrange(0, 501, 5)
elif self.settings.shopsanity_prices == 'random_tycoon':
self.shop_prices[location.name] = random.randrange(0, 1000, 5)
elif self.settings.shopsanity_prices == 'affordable':
self.shop_prices[location.name] = 10
if self.settings.special_deal_price_distribution == 'vanilla':
self.shop_prices[location.name] = ItemInfo.items[location.vanilla_item].price
elif self.settings.special_deal_price_max < self.settings.special_deal_price_min:
raise ValueError('Maximum special deal price is lower than minimum, perhaps you meant to swap them?')
elif self.settings.special_deal_price_max == self.settings.special_deal_price_min:
self.shop_prices[location.name] = self.settings.special_deal_price_min
elif self.settings.special_deal_price_distribution == 'betavariate':
self.shop_prices[location.name] = self.settings.special_deal_price_min + int(random.betavariate(1.5, 2) * (self.settings.special_deal_price_max - self.settings.special_deal_price_min) / 5) * 5
elif self.settings.special_deal_price_distribution == 'uniform':
self.shop_prices[location.name] = random.randrange(self.settings.special_deal_price_min, self.settings.special_deal_price_max + 1, 5)
else:
raise NotImplementedError(f'Unimplemented special deal distribution: {self.settings.special_deal_price_distribution}')

def set_scrub_prices(self) -> None:
# Get Deku Scrub Locations
Expand Down
40 changes: 30 additions & 10 deletions data/presets_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -233,7 +235,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -412,7 +416,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "low",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -587,7 +593,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -773,7 +781,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -949,7 +959,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "4",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "low",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -1125,7 +1137,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "any",
"shopsanity": "0",
"shopsanity_prices": "random_tycoon",
"special_deal_price_distribution": "uniform",
"special_deal_price_min": 995,
"special_deal_price_max": 995,
"tokensanity": "all",
"shuffle_scrubs": "random",
"shuffle_child_trade": [
Expand Down Expand Up @@ -1474,7 +1488,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -1639,7 +1655,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "off",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "off",
"shuffle_child_trade": [],
Expand Down Expand Up @@ -1817,7 +1835,9 @@
"one_item_per_dungeon": false,
"shuffle_song_items": "song",
"shopsanity": "4",
"shopsanity_prices": "random",
"special_deal_price_distribution": "betavariate",
"special_deal_price_min": 0,
"special_deal_price_max": 300,
"tokensanity": "off",
"shuffle_scrubs": "low",
"shuffle_child_trade": [],
Expand Down
4 changes: 3 additions & 1 deletion data/settings_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@
"settings": [
"shuffle_song_items",
"shopsanity",
"shopsanity_prices",
"special_deal_price_distribution",
"special_deal_price_min",
"special_deal_price_max",
"tokensanity",
"shuffle_scrubs",
"shuffle_child_trade",
Expand Down