Skip to content

Feature/Add favorite-pack boot and selection flow - #95

Open
lucaredaelli wants to merge 1 commit into
Leanny:mainfrom
lucaredaelli:feature/Pack-Favorite-Helper-Clean
Open

Feature/Add favorite-pack boot and selection flow#95
lucaredaelli wants to merge 1 commit into
Leanny:mainfrom
lucaredaelli:feature/Pack-Favorite-Helper-Clean

Conversation

@lucaredaelli

Copy link
Copy Markdown
Collaborator

Pack Favorite Feature

Summary

Adds support for setting a "favorite pack" expansion via the ptcgpb-helper-android binary's --pack command. When enabled, the game boots directly into the correct expansion's pack screen, bypassing the manual expansion selection UI. This speeds up pack opening by eliminating navigation steps.

How it works

  1. Pack name to expansion ID mapping (PTCGPHelper.ahk): A lookup table maps bot pack names (e.g. Mewtwo, MegaAltaria) to expansion IDs (e.g. A1, B1).

  2. SetPackFavorite(packName) (PTCGPHelper.ahk): Called while the game is closed. Runs ptcgpb --pack <expansionId> via adb shell. Returns true on success.

  3. loadAccount(favoritePackName) (AccountManager.ahk): After closing the game and before restarting it, calls SetPackFavorite with the rolled openPack. Sets packFavoriteSet = 1 on success, 0 on failure or when openPack is empty.

  4. getPackCoordXInHome() (Crinity_UnofficialPatch.ahk): When packFavoriteSet is true, sets isSkipSelectExpansion = 1 and returns the favourite home coordinate. startPreProcess preserves isSkipSelectExpansion instead of resetting it.

  5. SelectPack() (1.ahk):

    • Cold boot (HG = "First"): The game boots directly into the Points screen. The "Waiting for Points" loop does not click in Home. After FindPackStats, a single extra click selects the correct pack within the expansion if it is not the centre one.
    • Home entry (HG != "First", e.g. extra pack): Switches to the favourites view in Home (click 265, 236 + FavouriteBooster needle), then clicks the pack at the correct Home X coordinate. Skips the favourites switch for packs already stable in the Home screen (mainScreenPackList).
    • Pack selection: When isSkipSelectExpansion = 1, skips moveSeriesScreen / expansionScreenDrag / additionalAction.
  6. EnterFavouritePackFromHome() (1.ahk): Used in Inject Wonderpick 96P+ after AddFriends. Switches to favourites view, clicks the pack once to enter the Points screen, then waits for Pack_PackPointButton without clicking again (clicking the pack in favourites enters Open Pack directly if clicked again).

  7. Stable Home packs: For packs listed in mainScreenPackList (e.g. ParadoxDrive, RulerOfTheSkies, EveryDayWonders), the bot uses the Home position (Left=60, Middle=140, Right=215) instead of GetPackFavoriteHomeX, since these packs have their own fixed slots in the Home screen.

Coordinate helpers (PTCGPHelper.ahk)

  • GetPackFavoriteHomeX(packName): Returns the X coordinate for a pack in the Home favourites view (Y=203). 3 packs use Left=60, Centre=140, Right=215. 2 packs use Left=90, Right=190. 1 pack uses Centre=140.
  • GetPackFavoritePointsX(packName): Returns the X coordinate for a pack in the Points screen (Y=320). Same layout as Home.

Files modified

  • Scripts/1.ahk:

    • Removed pre-loop loadAccount call; loadAccount now called inside the loop after openPack is rolled.
    • Removed pre-loop restartGameInstance for injection methods.
    • Added favEnteredFromHome flag to skip extra pack-selection click when entering from Home favourites.
    • Added EnterFavouritePackFromHome() function.
    • Modified SelectPack() to handle favourite pack flow for cold boot and Home entry.
    • Added stable Home pack position lookup.
  • Scripts/Include/AccountManager.ahk:

    • loadAccount now accepts favoritePackName parameter.
    • Calls SetPackFavorite and sets packFavoriteSet accordingly.
  • Scripts/Include/PTCGPHelper.ahk:

    • Added pack name to expansion ID mapping.
    • Added SetPackFavorite(), GetPackFavoriteHomeX(), GetPackFavoritePointsX().
  • Scripts/Include/Crinity_UnofficialPatch.ahk:

    • getPackCoordXInHome() returns early with isSkipSelectExpansion = 1 when packFavoriteSet is true.
    • startPreProcess preserves isSkipSelectExpansion when packFavoriteSet is true.
  • Scripts/Needles/FavouriteBooster.png: New needle for detecting the favourites view in Home.

Fallback

If SetPackFavorite fails (helper not installed, unknown pack name, empty openPack), packFavoriteSet stays 0 and the bot uses the normal UI navigation flow (moveSeriesScreen + expansionScreenDrag).

Implement favorite pack support using the ptcgpb helper so injected accounts can preselect an expansion before app launch. The bot now passes the rolled pack into `loadAccount`, sets `packFavoriteSet`, adds pack-to-expansion and coordinate helpers, and updates Home/Points navigation (including a new `FavouriteBooster` needle) to skip normal expansion switching when favorites are active while preserving fallback behavior.
@lucaredaelli
lucaredaelli force-pushed the feature/Pack-Favorite-Helper-Clean branch from 24aa9bd to 1bc30ac Compare August 15, 2026 20:19
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.

2 participants