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

WebHost: Refactor tracker.py, removal of dead code, and tweaks to layouts of some tracker pages. #2438

Merged
merged 2 commits into from
Nov 18, 2023

Conversation

ThePhar
Copy link
Member

@ThePhar ThePhar commented Nov 8, 2023

What is this fixing or adding?

This is a huge refactor of tracker.py in WebHost and depending files.

Tracker API Changes:

  • Removes all the root-level LTTP functions/variables and moves them to LTTP render functions.
  • Remove imports of item_id_to_name/location_id_to_name lookup tables.
    • These are also completely removed from worlds/__init__.py as they are no longer needed.
  • Creates a "preliminary" Tracker API helper object to build potential objects/lookups for each world that wants to implement their own tracker.
    • Long term goal is to finalize what functions are available, create documentation, and move world-specific render functions, templates, and resources to their cooresponding world once future of WebHost is decided. For now, this is a middle ground.
    • Imports network_data_package only to check if game exists in datapackage to prevent WebHost from loading the tracker if relevant world folder/apworld is removed on same machine WebHost is running from.
  • Item/Location lookup dicts/functions check the game to prepare for Core: Remove Universally Unique ID Requirements (Per-Game Data Packages) #1933 which will allow games to overlap ids so knowing the game is important.
  • Subsequent calls on TrackerData methods will return cached results for that request to prevent developers from computing more than necessary.

Multiworld/Player Template Changes:

  • All player-specific custom game trackers now temporarily include a link to the generic tracker for better UX.
  • All player-specific generic trackers now include a link to any custom game tracker, if one exists.
  • All player-specific generic trackers now include relevant hints.
    • Relevant player's name is bolded on this hints table.
  • All tracker tables can now be resized by the user.
  • Added a link to Multiworld Tracker from player-specific generic trackers.
  • Improved "Multistream" link when visible on Multiworld Tracker page.
  • Added "game" column to hints columns to show which game the item is contained in.
  • Tweaked Factorio multiworld tracker to match unicode symbols as ALTTP multiworld tracker.
  • Tweaked ALTTP multiworld tracker to display number of obtained Triforce Pieces.
  • Added hover text for icons on Factorio and ALTTP multiworld trackers.
  • Only show relevant players on game-specific multiworld trackers instead of all players.
    • Also hides game column, since it's inferred.
  • Slight style changes to navigation/search/info text.

CustomServer Changes:

  • Defined YouTube and Twitch as only supported platforms in !video command doccomment.

MISC Changes:

  • Code style improvements.
  • Rename of some files/functions.
  • Removed lookup_any_item_id_to_name and lookup_any_location_id_to_name functions.
  • Removed logging for "custom mode" worlds that use data_version: 0 as it doesn't current do anything in AP core anyway.

How was this tested?

Thoughoughly generated multiple rooms with a variety of games that both include and do not include custom trackers.

  • Verified all multiworld trackers and game trackers still worked correctly and updated when items were received, locations were checked, and hints were broadcasted.
  • Verified multistream link renders properly and links correctly.
  • Verified links to and from generic trackers work.

If this makes graphical changes, please attach screenshots.

image
image
image
image
image
image
image
image

@ThePhar ThePhar added is: enhancement Issues requesting new features or pull requests implementing new features. is: refactor/cleanup Improvements to code/output readability or organizization. affects: core Issues/PRs that touch core and may need additional validation. affects: webhost Issues/PRs that touch webhost and may need additional validation. labels Nov 8, 2023
@ThePhar
Copy link
Member Author

ThePhar commented Nov 8, 2023

Requested reviews from all relevant world owners (and @jonloveslegos / @lordlou as you both haven't accepted collaborator invite) since I touched your world's tracker code.

Also Farrak for the WebHost front-end changes.

@ThePhar
Copy link
Member Author

ThePhar commented Nov 8, 2023

Some form of these changes will be required to complete #1933.

Copy link
Collaborator

@Ziktofel Ziktofel left a comment

Choose a reason for hiding this comment

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

Looks good for SC2 as long as it works

Copy link
Member

@LegendaryLinux LegendaryLinux left a comment

Choose a reason for hiding this comment

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

I do have a minor UX flow issue.

The generic multiworld tracker has this UI:
image

Clinking on the slot for LttP gives you this:
image

And clicking on "Switch to Generic Tracker" gives you this:
image

Which returns to the multiworld tracker, which is labelled "Generic."

Not a huge issue, and I think people will figure out the flow easily enough, but I guarantee some will be confused.

Other than that, HTML / CSS / JS looks good to me.

line-height: 20px;
gap: 0.5rem;
Copy link
Member

Choose a reason for hiding this comment

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

RIP Internet Explorer users 🤣.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good.

@LegendaryLinux LegendaryLinux self-assigned this Nov 14, 2023
@lordlou
Copy link
Contributor

lordlou commented Nov 17, 2023

I didnt do the SM tracker. I think its @TauAkiou.

@ThePhar ThePhar merged commit 790f192 into ArchipelagoMW:main Nov 18, 2023
12 checks passed
@ThePhar ThePhar deleted the tracker_refactor branch November 18, 2023 18:29
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 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. affects: webhost Issues/PRs that touch webhost and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. is: refactor/cleanup Improvements to code/output readability or organizization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants