Skip to content

Commit

Permalink
Merge pull request #84 from axxroytovu/Hint_extend_information
Browse files Browse the repository at this point in the history
Extend hint information
  • Loading branch information
FuzzyGamesOn authored Sep 27, 2024
2 parents 958874e + 9570d02 commit 84ddcea
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
4 changes: 4 additions & 0 deletions schemas/Manual.locations.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
"type": "boolean",
"default": false
},
"hint_entrance": {
"description": "(Optional) Adds additional text to this location's hints to convey useful information. Typically used for entrance randomization.",
"type": "string"
},
"id": {
"description": "(Optional) Skips the item ID forward to the given value.\nThis can be used to provide buffer space for future items.",
"type": "integer"
Expand Down
16 changes: 15 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
before_create_item, after_create_item, \
before_set_rules, after_set_rules, \
before_generate_basic, after_generate_basic, \
before_fill_slot_data, after_fill_slot_data, before_write_spoiler
before_fill_slot_data, after_fill_slot_data, before_write_spoiler, \
before_extend_hint_information, after_extend_hint_information
from .hooks.Data import hook_interpret_slot_data

class ManualWorld(World):
Expand Down Expand Up @@ -332,6 +333,19 @@ def generate_output(self, output_directory: str):
def write_spoiler(self, spoiler_handle):
before_write_spoiler(self, self.multiworld, spoiler_handle)

def extend_hint_information(self, hint_data: dict[int, dict[int, str]]) -> None:
before_extend_hint_information(hint_data, self, self.multiworld, self.player)

for location in self.multiworld.get_locations(self.player):
if not location.address:
continue
if "hint_entrance" in self.location_name_to_location[location.name]:
if self.player not in hint_data:
hint_data.update({self.player: {}})
hint_data[self.player][location.address] = self.location_name_to_location[location.name]["hint_entrance"]

after_extend_hint_information(hint_data, self, self.multiworld, self.player)

###
# Non-standard AP world methods
###
Expand Down
3 changes: 2 additions & 1 deletion src/data/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
{
"name": "Beat the Game - Shuma-Gorath",
"category": ["Unlocked Teams", "Right Side"],
"requires": "|Shuma-Gorath|"
"requires": "|Shuma-Gorath|",
"hint_entrance": "Unlock Shuma-Gorath"
},
{
"name": "Beat the Game - Nemesis T-Type",
Expand Down
19 changes: 19 additions & 0 deletions src/hooks/World.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,22 @@ def after_fill_slot_data(slot_data: dict, world: World, multiworld: MultiWorld,
# This is called right at the end, in case you want to write stuff to the spoiler log
def before_write_spoiler(world: World, multiworld: MultiWorld, spoiler_handle) -> None:
pass

# This is called when you want to add information to the hint text
def before_extend_hint_information(hint_data: dict[int, dict[int, str]], world: World, multiworld: MultiWorld, player: int) -> None:

### 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

def after_extend_hint_information(hint_data: dict[int, dict[int, str]], world: World, multiworld: MultiWorld, player: int) -> None:
pass

0 comments on commit 84ddcea

Please sign in to comment.