1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Object classes from AP core, to represent an entire MultiWorld and this individual World that's part of it
# Object classes from Manual -- extending AP core -- representing items and locations that are used in generation
# Raw JSON data from the Manual apworld, respectively:
# data/game.json, data/items.json, data/locations.json, data/regions.json
#
# These helper methods allow you to determine if an option has been set, or what its value is, for any player in the multiworld
# calling logging.info("message") anywhere below in this file will output the message to both console and log file
########################################################################################
## Order of method calls when the world generates:
## 1. create_regions - Creates regions and locations
## 2. create_items - Creates the item pool
## 3. set_rules - Creates rules for accessing regions and locations
## 4. generate_basic - Runs any post item pool options, like place item/category
## 5. pre_fill - Creates the victory location
##
## The create_item method is used by plando and start_inventory settings to create an item from an item name.
## The fill_slot_data method will be used to send data to the Manual client for later use, like deathlink.
########################################################################################
# Use this function to change the valid filler items to be created to replace item links or starting items.
# Default value is the `filler_item_name` from game.json
return False
# Called before regions and locations are created. Not clear why you'd want this, but it's here. Victory location is included, but Victory event is not placed yet.
pass
# Called after regions and locations are created, in case you want to see or modify that information. Victory location is included.
# Use this hook to remove locations from the world
: = # List of location names
# Add your code here to calculate which locations to remove
# This hook allows you to access the item names & counts before the items are created. Use this to increase/decrease the amount of a specific item in the pool
# Valid item_config key/values:
# {"Item Name": 5} <- This will create qty 5 items using all the default settings
# {"Item Name": {"useful": 7}} <- This will create qty 7 items and force them to be classified as useful
# {"Item Name": {"progression": 2, "useful": 1}} <- This will create 3 items, with 2 classified as progression and 1 as useful
# {"Item Name": {0b0110: 5}} <- If you know the special flag for the item classes, you can also define non-standard options. This setup
# will create 5 items that are the "useful trap" class
# {"Item Name": {ItemClassification.useful: 5}} <- You can also use the classification directly
return
# The item pool before starting items are processed, in case you want to see the raw item pool at that stage
return
# The item pool after starting items are processed but before filler is added, in case you want to see the raw item pool at that stage
# Use this hook to remove items from the item pool
: = # List of item names
# Add your code here to calculate which items to remove.
#
# Because multiple copies of an item can exist, you need to add an item name
# to the list multiple times if you want to remove multiple copies of it.
=
return
# Some other useful hook options:
## Place an item at a specific location
# location = next(l for l in multiworld.get_unfilled_locations(player=player) if l.name == "Location Name")
# item_to_place = next(i for i in item_pool if i.name == "Item Name")
# location.place_locked_item(item_to_place)
# item_pool.remove(item_to_place)
# The complete item pool prior to being set for generation is provided here, in case you want to make changes to it
return
# Called before rules for accessing regions and locations are created. Not clear why you'd want this, but it's here.
pass
# Called after rules for accessing regions and locations are created, in case you want to see or modify that information.
# Use this hook to modify the access rules for a given location
# Calculated rules take a CollectionState object and return a boolean
# True if the player can access the location
# CollectionState is defined in BaseClasses
return True
## Common functions:
# location = world.get_location(location_name, player)
# location.access_rule = Example_Rule
## Combine rules:
# old_rule = location.access_rule
# location.access_rule = lambda state: old_rule(state) and Example_Rule(state)
# OR
# location.access_rule = lambda state: old_rule(state) or Example_Rule(state)
# The item name to create is provided before the item is created, in case you want to make changes to it
return
# The item that was created is provided after creation, in case you want to modify the item
return
# This method is run towards the end of pre-generation, before the place_item options have been handled and before AP generation occurs
pass
# This method is run at the very end of pre-generation, once the place_item options have been handled and before AP generation occurs
pass
# This method is run every time an item is added to the state, can be used to modify the value of an item.
# IMPORTANT! Any changes made in this hook must be cancelled/undone in after_remove_item
# the following let you add to the Potato Item Value count
# if item.name == "Cooked Potato":
# state.prog_items[item.player][format_state_prog_items_key(ProgItemsCat.VALUE, "Potato")] += 1
pass
# This method is run every time an item is removed from the state, can be used to modify the value of an item.
# IMPORTANT! Any changes made in this hook must be first done in after_collect_item
# the following let you undo the addition to the Potato Item Value count
# if item.name == "Cooked Potato":
# state.prog_items[item.player][format_state_prog_items_key(ProgItemsCat.VALUE, "Potato")] -= 1
pass
# This is called before slot data is set and provides an empty dict ({}), in case you want to modify it before Manual does
return
# This is called after slot data is set and provides the slot data at the time, in case you want to check and modify it after Manual is done with it
return
# This is called right at the end, in case you want to write stuff to the spoiler log
pass
# This is called when you want to add information to the hint text
### Example way to use this hook:
# if player not in hint_data:
# hint_data.update({player: {}})
# for location in multiworld.get_locations(player):
# if not location.address:
# continue
#
# use this section to calculate the hint string
#
# hint_data[player][location.address] = hint_string
pass
pass