How mg-tokyo/qpm-gr works
QPM is a browser userscript mod for Magic Garden and related sites, including the browser-based Discord activity. Players load it alongside the game and use its panel for shop, pet, garden, protection, journal, and camera features. The graph highlights the documented restock-to-purchase workflow, shared game-state and catalog layers, and selected major capabilities. README statements support product behavior; source excerpts and the index support only the cited internal links, so unsampled feature wiring is not inferred.
Main entry points: src QPM panel · restockAlerts Restock alerts · main.ts QPM userscript · purchasePipeline.ts Purchase flow
Components 23
Runtime and game data
- QPM userscript
src/main.ts - Mod initialization
src/main/init.ts - Page context
src/core/pageContext.ts - Game state
src/core/gameState/index.ts - Game catalogs
src/catalogs/gameCatalogs.ts - QPM panel
src
Shop restocks
- Stock tracking
src/store/shopStockParsers.ts - Restock alerts
src/ui/shop/restockAlerts - Purchase flow
src/ui/shop/restockAlerts/purchasePipeline.ts
Player tools
- Pet teams and optimizer
src/features/pets - Activity log
src/features/activity/activityLogNativeEnhancer - Harvest protection
src/features/locker
Gameplay features
- Garden tools
src/features/garden - Journal checker
src/features/journal - Bad-luck protection
src/catalogs/pityThresholds.ts - 3D camera
src/features/camera3d - Garden Battleship
src/features/battleship
Shared services
- Diagnostics
src/diagnostics - Persistent storage
src/utils/storage.ts - Timer manager
src/utils/scheduling/timerManager.ts - Sprite service
src/sprite-v2/index.ts
Other components
- Player
- Magic Garden
Connections 22
- Player → Magic Garden: plays
- Player → QPM userscript: installs and loads
- QPM userscript → Mod initialization: starts
src/main.ts - QPM userscript → Sprite service: initializes
src/main.ts - Player → QPM panel: opens
- QPM panel → Restock alerts: offers
src/ui/shop/restockAlerts/purchasePipeline.ts - Stock tracking → Restock alerts: predicts restocks for
- Restock alerts → Purchase flow: starts buy-all
src/ui/shop/restockAlerts/purchasePipeline.ts - Purchase flow → Game state: checks readiness and balance
src/ui/shop/restockAlerts/purchasePipeline.ts - Purchase flow → Game catalogs: gets bag limit
src/ui/shop/restockAlerts/purchasePipeline.ts - QPM panel → Pet teams and optimizer: offers
- QPM panel → Activity log: offers
- QPM panel → Harvest protection: offers
- QPM panel → Garden tools: offers
src/features/economy/storageValue.ts - QPM panel → Journal checker: offers
- QPM panel → Bad-luck protection: offers
- QPM panel → 3D camera: offers
- QPM panel → Garden Battleship: offers
- Player → Diagnostics: opens for troubleshooting
- Mod initialization → Page context: uses
src/core/pageContext.ts - Game state → Game catalogs
- Restock alerts → Persistent storage