Skip to content

Conversation

@axxroytovu
Copy link
Contributor

Nobody actually uses the current before_create_item hook, because it only lets you edit the item's name.

This version adds the ability to change how many of an item are created, which is a significantly more stable way to manage dynamic item counts than the current process of removing them in before_create_items_filler

The old functionality is still maintained

@FuzzyGamesOn
Copy link
Collaborator

The before_create_item hook is intended for cases where a user might want to intercept a create item request for one item but instead create another item based on some logic. e.g., if their options could cause one item to be entirely swapped out for another. Also lets them intercept create items that are triggered from other places than create_items, like a YAML start_inventory.

I do like the idea of adding a simple hooks way to modify count, though. Have felt like create_items needed an earlier hook that lets the user customize some parts of the item record before we start processing it, and I agree that the current way of modifying the item pool is a bit convoluted compared to pre-editing the item in the loop.

Could we instead do this functionality as a new hook? Name can be whatever as long as it starts with before_create_items_ for consistency with the other hooks in create_items. Would also consider if there are any non-name properties that we'd want to allow the user to edit in addition to count.

@axxroytovu
Copy link
Contributor Author

axxroytovu commented Jan 25, 2025

Completely overhauled this PR.

Now the new before_create_items_all hook allows you to access a new dictionary that contains information about how the item should be generated. That dictionary can have the following formats:

{"Item Name 1": 5, # <- This will create qty 5 items using all the default settings
"Item Name 2": {"useful": 7}, # <- This will create qty 7 items and force them to be classified as useful
"Item Name 3": {"progression": 2, "useful": 1}, # <- This will create 3 items, with 2 classified as progression and 1 as useful
"Item Name 4": {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

@silasary silasary merged commit 4ab2e56 into ManualForArchipelago:main Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants