Skip to content

Commit 70952fd

Browse files
committed
Merge 'Settings for more control over special deal prices' (#2037)
# Conflicts: # data/presets_default.json
2 parents 50881fc + ec7f873 commit 70952fd

6 files changed

Lines changed: 111 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Dev
22

3+
* New settings for more control over special deal prices.
4+
35
# 8.3
46

57
## New Settings and Options

SettingsList.py

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,8 @@ class SettingInfos:
19921992
'random': 'Random # of Items Per Shop',
19931993
},
19941994
disable = {
1995-
'off': {'settings': ['shopsanity_prices']},
1996-
'0': {'settings': ['shopsanity_prices']},
1995+
'off': {'settings': ['special_deal_price_distribution', 'special_deal_price_min', 'special_deal_price_max']},
1996+
'0': {'settings': ['special_deal_price_distribution', 'special_deal_price_min', 'special_deal_price_max']},
19971997
},
19981998
gui_tooltip = '''\
19991999
Randomizes Shop contents.
@@ -2034,40 +2034,77 @@ class SettingInfos:
20342034
},
20352035
)
20362036

2037-
shopsanity_prices = Combobox(
2038-
gui_text = 'Shopsanity Prices',
2039-
default = 'random',
2037+
special_deal_price_distribution = Combobox(
2038+
gui_text = 'Special Deal Prices',
2039+
default = 'betavariate',
20402040
choices = {
2041-
'random': "Random",
2042-
'random_starting': "Starting Wallet",
2043-
'random_adult': "Adult's Wallet",
2044-
'random_giant': "Giant's Wallet",
2045-
'random_tycoon': "Tycoon's Wallet",
2046-
'affordable': "Affordable",
2041+
'vanilla': 'Vanilla',
2042+
'betavariate': 'Weighted',
2043+
'uniform': 'Uniform',
2044+
},
2045+
disable = {
2046+
'vanilla': {'settings': ['special_deal_price_min', 'special_deal_price_max']},
20472047
},
20482048
gui_tooltip = '''\
2049-
Controls the randomization of prices for shopsanity items.
2050-
For more control, utilize the plandomizer.
2049+
Controls how the prices for Special Deal items in shops are
2050+
selected. For more control, utilize the plandomizer.
20512051
2052-
'Random': The default randomization. Shop prices for
2053-
shopsanity items will range between 0 to 300 rupees,
2054-
with a bias towards values slightly below the middle of the
2055-
range, in multiples of 5.
2052+
'Vanilla': Each item will be sold for the price of the item
2053+
that appears in its slot in the vanilla game.
20562054
2057-
'X Wallet': Shop prices for shopsanity items will range
2058-
between 0 and the specified wallet's maximum capacity,
2059-
in multiples of 5.
2055+
'Weighted': Shop prices will be biased towards slightly below
2056+
the middle of the selected range, with very low or very high
2057+
prices only appearing rarely.
20602058
2061-
'Affordable': Shop prices for shopsanity items will be
2062-
fixed to 10 rupees.
2059+
'Uniform': Each price value in the selected range is equally
2060+
likely.
20632061
''',
2064-
disabled_default = 'random',
20652062
shared = True,
20662063
gui_params = {
20672064
"hide_when_disabled": True,
20682065
},
20692066
)
20702067

2068+
special_deal_price_min = Scale(
2069+
gui_text = 'Minimum Special Deal Price',
2070+
default = 0,
2071+
minimum = 0,
2072+
maximum = 995,
2073+
step = 5,
2074+
shared = True,
2075+
gui_tooltip = '''\
2076+
Select the minimum price in rupees for Special Deal
2077+
items in shops. Prices will be selected randomly in
2078+
multiples of 5 according to the "Special Deal Price
2079+
Distribution" setting. Set this setting and "Maximum
2080+
Special Deal Price" to the same value to give all
2081+
Special Deals a fixed price.
2082+
''',
2083+
gui_params = {
2084+
"hide_when_disabled": True,
2085+
},
2086+
)
2087+
2088+
special_deal_price_max = Scale(
2089+
gui_text = 'Maximum Special Deal Price',
2090+
default = 300,
2091+
minimum = 0,
2092+
maximum = 995,
2093+
step = 5,
2094+
shared = True,
2095+
gui_tooltip = '''\
2096+
Select the maximum price in rupees for Special Deal
2097+
items in shops. Prices will be selected randomly in
2098+
multiples of 5 according to the "Special Deal Price
2099+
Distribution" setting. Set this setting and "Minimum
2100+
Special Deal Price" to the same value to give all
2101+
Special Deals a fixed price.
2102+
''',
2103+
gui_params = {
2104+
"hide_when_disabled": True,
2105+
},
2106+
)
2107+
20712108
tokensanity = Combobox(
20722109
gui_text = 'Tokensanity',
20732110
default = 'off',

World.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -694,18 +694,18 @@ def random_shop_prices(self) -> None:
694694
for location in region.locations:
695695
if location.type == 'Shop':
696696
if location.name[-1:] in shop_item_indexes[:shop_item_count]:
697-
if self.settings.shopsanity_prices == 'random':
698-
self.shop_prices[location.name] = int(random.betavariate(1.5, 2) * 60) * 5
699-
elif self.settings.shopsanity_prices == 'random_starting':
700-
self.shop_prices[location.name] = random.randrange(0, 100, 5)
701-
elif self.settings.shopsanity_prices == 'random_adult':
702-
self.shop_prices[location.name] = random.randrange(0, 201, 5)
703-
elif self.settings.shopsanity_prices == 'random_giant':
704-
self.shop_prices[location.name] = random.randrange(0, 501, 5)
705-
elif self.settings.shopsanity_prices == 'random_tycoon':
706-
self.shop_prices[location.name] = random.randrange(0, 1000, 5)
707-
elif self.settings.shopsanity_prices == 'affordable':
708-
self.shop_prices[location.name] = 10
697+
if self.settings.special_deal_price_distribution == 'vanilla':
698+
self.shop_prices[location.name] = ItemInfo.items[location.vanilla_item].price
699+
elif self.settings.special_deal_price_max < self.settings.special_deal_price_min:
700+
raise ValueError('Maximum special deal price is lower than minimum, perhaps you meant to swap them?')
701+
elif self.settings.special_deal_price_max == self.settings.special_deal_price_min:
702+
self.shop_prices[location.name] = self.settings.special_deal_price_min
703+
elif self.settings.special_deal_price_distribution == 'betavariate':
704+
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
705+
elif self.settings.special_deal_price_distribution == 'uniform':
706+
self.shop_prices[location.name] = random.randrange(self.settings.special_deal_price_min, self.settings.special_deal_price_max + 1, 5)
707+
else:
708+
raise NotImplementedError(f'Unimplemented special deal distribution: {self.settings.special_deal_price_distribution}')
709709

710710
def set_scrub_prices(self) -> None:
711711
# Get Deku Scrub Locations

data/presets_default.json

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
"free_bombchu_drops": false,
6565
"shuffle_song_items": "song",
6666
"shopsanity": "off",
67-
"shopsanity_prices": "random",
67+
"special_deal_price_distribution": "betavariate",
68+
"special_deal_price_min": 0,
69+
"special_deal_price_max": 300,
6870
"tokensanity": "off",
6971
"shuffle_scrubs": "off",
7072
"shuffle_child_trade": [],
@@ -263,7 +265,9 @@
263265
"free_bombchu_drops": false,
264266
"shuffle_song_items": "song",
265267
"shopsanity": "off",
266-
"shopsanity_prices": "random",
268+
"special_deal_price_distribution": "betavariate",
269+
"special_deal_price_min": 0,
270+
"special_deal_price_max": 300,
267271
"tokensanity": "off",
268272
"shuffle_scrubs": "off",
269273
"shuffle_child_trade": [],
@@ -467,7 +471,9 @@
467471
"free_bombchu_drops": false,
468472
"shuffle_song_items": "song",
469473
"shopsanity": "4",
470-
"shopsanity_prices": "random",
474+
"special_deal_price_distribution": "betavariate",
475+
"special_deal_price_min": 0,
476+
"special_deal_price_max": 300,
471477
"tokensanity": "dungeons",
472478
"shuffle_scrubs": "low",
473479
"shuffle_child_trade": [],
@@ -680,7 +686,9 @@
680686
"free_bombchu_drops": false,
681687
"shuffle_song_items": "song",
682688
"shopsanity": "off",
683-
"shopsanity_prices": "random",
689+
"special_deal_price_distribution": "betavariate",
690+
"special_deal_price_min": 0,
691+
"special_deal_price_max": 300,
684692
"tokensanity": "off",
685693
"shuffle_scrubs": "off",
686694
"shuffle_child_trade": [],
@@ -899,7 +907,9 @@
899907
"free_bombchu_drops": false,
900908
"shuffle_song_items": "song",
901909
"shopsanity": "off",
902-
"shopsanity_prices": "random",
910+
"special_deal_price_distribution": "betavariate",
911+
"special_deal_price_min": 0,
912+
"special_deal_price_max": 300,
903913
"tokensanity": "off",
904914
"shuffle_scrubs": "off",
905915
"shuffle_child_trade": [],
@@ -1108,7 +1118,9 @@
11081118
"free_bombchu_drops": false,
11091119
"shuffle_song_items": "song",
11101120
"shopsanity": "4",
1111-
"shopsanity_prices": "random",
1121+
"special_deal_price_distribution": "betavariate",
1122+
"special_deal_price_min": 0,
1123+
"special_deal_price_max": 300,
11121124
"tokensanity": "dungeons",
11131125
"shuffle_scrubs": "low",
11141126
"shuffle_child_trade": [],
@@ -1323,7 +1335,9 @@
13231335
"free_bombchu_drops": true,
13241336
"shuffle_song_items": "any",
13251337
"shopsanity": "0",
1326-
"shopsanity_prices": "random_tycoon",
1338+
"special_deal_price_distribution": "uniform",
1339+
"special_deal_price_min": 995,
1340+
"special_deal_price_max": 995,
13271341
"tokensanity": "all",
13281342
"shuffle_scrubs": "random",
13291343
"shuffle_child_trade": [
@@ -1706,7 +1720,9 @@
17061720
"free_bombchu_drops": false,
17071721
"shuffle_song_items": "song",
17081722
"shopsanity": "off",
1709-
"shopsanity_prices": "random",
1723+
"special_deal_price_distribution": "betavariate",
1724+
"special_deal_price_min": 0,
1725+
"special_deal_price_max": 300,
17101726
"tokensanity": "off",
17111727
"shuffle_scrubs": "off",
17121728
"shuffle_child_trade": [],
@@ -1906,7 +1922,9 @@
19061922
"free_bombchu_drops": false,
19071923
"shuffle_song_items": "song",
19081924
"shopsanity": "off",
1909-
"shopsanity_prices": "random",
1925+
"special_deal_price_distribution": "betavariate",
1926+
"special_deal_price_min": 0,
1927+
"special_deal_price_max": 300,
19101928
"tokensanity": "off",
19111929
"shuffle_scrubs": "low",
19121930
"shuffle_child_trade": [],
@@ -2137,7 +2155,9 @@
21372155
"free_bombchu_drops": false,
21382156
"shuffle_song_items": "song",
21392157
"shopsanity": "4",
2140-
"shopsanity_prices": "random",
2158+
"special_deal_price_distribution": "betavariate",
2159+
"special_deal_price_min": 0,
2160+
"special_deal_price_max": 300,
21412161
"tokensanity": "off",
21422162
"shuffle_scrubs": "low",
21432163
"shuffle_child_trade": [],
@@ -2347,7 +2367,9 @@
23472367
"free_bombchu_drops": true,
23482368
"shuffle_song_items": "any",
23492369
"shopsanity": "4",
2350-
"shopsanity_prices": "random",
2370+
"special_deal_price_distribution": "betavariate",
2371+
"special_deal_price_min": 0,
2372+
"special_deal_price_max": 300,
23512373
"tokensanity": "off",
23522374
"shuffle_scrubs": "low",
23532375
"shuffle_child_trade": [],

data/settings_mapping.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@
191191
"settings": [
192192
"shuffle_song_items",
193193
"shopsanity",
194-
"shopsanity_prices",
194+
"special_deal_price_distribution",
195+
"special_deal_price_min",
196+
"special_deal_price_max",
195197
"tokensanity",
196198
"shuffle_scrubs",
197199
"shuffle_child_trade",

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '8.3.1'
1+
__version__ = '8.3.2'
22

33
# This is a supplemental version number for branches based off of main dev.
44
supplementary_version = 0

0 commit comments

Comments
 (0)