Skip to content

Commit 84ddcea

Browse files
authored
Merge pull request #84 from axxroytovu/Hint_extend_information
Extend hint information
2 parents 958874e + 9570d02 commit 84ddcea

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

schemas/Manual.locations.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
"type": "boolean",
9393
"default": false
9494
},
95+
"hint_entrance": {
96+
"description": "(Optional) Adds additional text to this location's hints to convey useful information. Typically used for entrance randomization.",
97+
"type": "string"
98+
},
9599
"id": {
96100
"description": "(Optional) Skips the item ID forward to the given value.\nThis can be used to provide buffer space for future items.",
97101
"type": "integer"

src/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
before_create_item, after_create_item, \
3232
before_set_rules, after_set_rules, \
3333
before_generate_basic, after_generate_basic, \
34-
before_fill_slot_data, after_fill_slot_data, before_write_spoiler
34+
before_fill_slot_data, after_fill_slot_data, before_write_spoiler, \
35+
before_extend_hint_information, after_extend_hint_information
3536
from .hooks.Data import hook_interpret_slot_data
3637

3738
class ManualWorld(World):
@@ -332,6 +333,19 @@ def generate_output(self, output_directory: str):
332333
def write_spoiler(self, spoiler_handle):
333334
before_write_spoiler(self, self.multiworld, spoiler_handle)
334335

336+
def extend_hint_information(self, hint_data: dict[int, dict[int, str]]) -> None:
337+
before_extend_hint_information(hint_data, self, self.multiworld, self.player)
338+
339+
for location in self.multiworld.get_locations(self.player):
340+
if not location.address:
341+
continue
342+
if "hint_entrance" in self.location_name_to_location[location.name]:
343+
if self.player not in hint_data:
344+
hint_data.update({self.player: {}})
345+
hint_data[self.player][location.address] = self.location_name_to_location[location.name]["hint_entrance"]
346+
347+
after_extend_hint_information(hint_data, self, self.multiworld, self.player)
348+
335349
###
336350
# Non-standard AP world methods
337351
###

src/data/locations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
{
2626
"name": "Beat the Game - Shuma-Gorath",
2727
"category": ["Unlocked Teams", "Right Side"],
28-
"requires": "|Shuma-Gorath|"
28+
"requires": "|Shuma-Gorath|",
29+
"hint_entrance": "Unlock Shuma-Gorath"
2930
},
3031
{
3132
"name": "Beat the Game - Nemesis T-Type",

src/hooks/World.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,22 @@ def after_fill_slot_data(slot_data: dict, world: World, multiworld: MultiWorld,
138138
# This is called right at the end, in case you want to write stuff to the spoiler log
139139
def before_write_spoiler(world: World, multiworld: MultiWorld, spoiler_handle) -> None:
140140
pass
141+
142+
# This is called when you want to add information to the hint text
143+
def before_extend_hint_information(hint_data: dict[int, dict[int, str]], world: World, multiworld: MultiWorld, player: int) -> None:
144+
145+
### Example way to use this hook:
146+
# if player not in hint_data:
147+
# hint_data.update({player: {}})
148+
# for location in multiworld.get_locations(player):
149+
# if not location.address:
150+
# continue
151+
#
152+
# use this section to calculate the hint string
153+
#
154+
# hint_data[player][location.address] = hint_string
155+
156+
pass
157+
158+
def after_extend_hint_information(hint_data: dict[int, dict[int, str]], world: World, multiworld: MultiWorld, player: int) -> None:
159+
pass

0 commit comments

Comments
 (0)