Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spoiler: Display all precollected items in the Spoiler Log #2928

Merged

Conversation

PoryGone
Copy link
Collaborator

@PoryGone PoryGone commented Mar 11, 2024

What is this fixing or adding?

Previously, items added to a player via push_precollected in a World implementation would not appear anywhere in the Spoiler Log, unless they were playthrough-relevant. This adds a section (when relevant) which displays all precollected items for the MultiWorld, whether added through World code or a player's start_inventory.

I discovered this shortcoming amidst development of a forthcoming game implementation, wherein under some circumstances, items which are important to gameplay, but irrelevant to logic, can get added to the player's start_inventory. I think it will be important for the players to be able to see that information in the spoiler log.

This should behave similarly to the Locations: section, in that it will list the player name for the item if there are multiple slots, but only the item name if only one slot is present. If multiple of the same item are added (by either mechanism), then each instance will be listed separately.

How was this tested?

Several generations with a couple of supported worlds and a specially-modified SA2B world which adds a few filler items via push_precollected, as well as YAMLs with items in the start_inventory. Multi-slot and Single-slot generations were done, as well as generations without the above, to verify that if no precollected items exist, the section is not created.

World for testing (rename as .apworld, GitHub wouldn't let me upload with that extension):
sa2b.zip

YAMLs for testing:
precollected_yamls.zip

If this makes graphical changes, please attach screenshots.

Sample spoiler output:

...

Precollected Items:

Five Rings (PoryGone_SA2B1)
Ten Rings (PoryGone_SA2B1)
Twenty Rings (PoryGone_SA2B1)
Shield (PoryGone_SA2B)
Shield (PoryGone_SA2B)
Shield (PoryGone_SA2B)
Shield (PoryGone_SA2B)
Shield (PoryGone_SA2B)
Five Rings (PoryGone_SA2B)
Ten Rings (PoryGone_SA2B)
Twenty Rings (PoryGone_SA2B)
Five Rings (Pory's)
Ten Rings (Pory's)
Twenty Rings (Pory's)

Locations:

Lakeside Limbo - Flag (Pory_DKC31): Bonus Coin (Pory_DKC31)
Lakeside Limbo - Bonus 1 (Pory_DKC31): DK Coin (Pory_DKC3)
...

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Mar 11, 2024
@PoryGone PoryGone added the is: enhancement Issues requesting new features or pull requests implementing new features. label Mar 11, 2024
BaseClasses.py Outdated
for item in chain.from_iterable(self.multiworld.precollected_items.values())]
if precollected_items:
outfile.write('\n\nPrecollected Items:\n\n')
outfile.write('\n'.join([item for item in precollected_items]))
Copy link
Collaborator

@alwaysintreble alwaysintreble Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i'd prefer wrapping this in a counter and showing the count with the item rather than just repeating the item count times, but i'm willing to defer if others disagree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this context, I prefer listing them individually, stylistically matching the Locations section to which it is more akin, rather than matching the options output above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was thinking something like

Five Rings: 1 (PoryGone_SA2B1)
Shield: 5 (PoryGone_SA2B)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think it's probably slightly preferable to just list them each individually and match stylistically, I can also see some weird edge cases around item names with numbers in them if you try to add a quantity

Copy link
Collaborator

@alwaysintreble alwaysintreble Mar 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those would still be separated by the colon.

Rupees (500): 2 (Player3)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can item names contain colons (and do any currently)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just checked and quite a lot do. whether that makes the information difficult to parse is a different question. most notable ones would be stardew and raft which have items like Resource Pack: 2000 Money or Resource Pack: 5 Plastic

BaseClasses.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@BadMagic100 BadMagic100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and log format looks good to me, did not test.

BaseClasses.py Outdated
else item.name
for item in chain.from_iterable(self.multiworld.precollected_items.values())]
if precollected_items:
outfile.write("\n\nPrecollected Items:\n\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether this should just say "starting inventory," I'm not sure if there is value in distinguishing by this labeling between "the content of the start_inventory option" and "your actual starting inventory as it appears in precollected_items." But I'm not very strongly opinionated either way so I will leave this for others to give their thoughts

@PoryGone
Copy link
Collaborator Author

I've prompted the #ap-world-dev chat for opinions on the couple of optional comments above a few times without any takers, so I'm just going to leave them as-is, pending a core maintainer having a different opinion, and move this into waiting-on-core-review, as it has been approved.

@PoryGone PoryGone added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Apr 11, 2024
@Berserker66
Copy link
Member

probably best to keep it similar to the starting inventory yaml option, to not confused the reader with additional terms

@PoryGone
Copy link
Collaborator Author

probably best to keep it similar to the starting inventory yaml option, to not confused the reader with additional terms

Changed to "Starting Items", open to further thoughts.

@Berserker66 Berserker66 merged commit 87b9f4a into ArchipelagoMW:main Apr 14, 2024
15 checks passed
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
qwint pushed a commit to qwint/Archipelago that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants