feat: Scouting feature (Wonder Pick-style social pack opening) #50

Merged
cal merged 6 commits from feature/scouting into next-release 2026-03-05 03:17:09 +00:00
Owner

Summary

  • Scouting feature: When a player opens a pack, a scout opportunity is posted to #pack-openings with face-down card buttons. Other players can blind-pick one card using daily scout tokens (2/day), receiving a copy. The opener keeps all cards.
  • Multi-scout design: Any card can be scouted by multiple players; each player can scout one card per pack. Buttons stay active for the full 30-minute window.
  • Discord relative timestamps: Scout window shows a live countdown via <t:UNIX:R> instead of a static "30 minutes" message.
  • Consolidated utilities: SCOUT_TOKENS_PER_DAY, get_scout_tokens_used(), and midnight_timestamp() centralized to eliminate duplication across 3 files.
  • 66-test suite: Comprehensive coverage for helpers, ScoutView callbacks, cog commands, and edge cases.

New files

  • discord_ui/scout_view.py — ScoutView + ScoutButton UI
  • helpers/scouting.py — embed builders, scout opportunity creation, shared constants
  • cogs/economy_new/scouting.py/scout-tokens command and cleanup task
  • tests/scouting/ — full test suite (conftest, helpers, view, cog)

Modified files

  • helpers/main.py — Hook into open_st_pr_packs() after display_cards()
  • helpers/utils.py — Added midnight_timestamp()
  • paperdynasty.py — Register scouting cog
  • discord_ui/__init__.py — Avoid circular import with ScoutView

Requires new API endpoints in paper-dynasty-database (scout_opportunities, scout_claims). Tracks #44.

Test plan

  • Open a standard/premium pack → scout embed with countdown appears in #pack-openings
  • Click a card button as a different user → card copy created, embed updates with scouter info
  • Click as the opener → ephemeral rejection
  • Use both daily tokens, try a third → ephemeral "out of tokens"
  • /scout-tokens → shows correct remaining count
  • Wait for timeout → buttons disable, embed shows "Scout Window Closed"
  • python -m pytest tests/scouting/ → 66 tests pass

🤖 Generated with Claude Code

## Summary - **Scouting feature**: When a player opens a pack, a scout opportunity is posted to #pack-openings with face-down card buttons. Other players can blind-pick one card using daily scout tokens (2/day), receiving a copy. The opener keeps all cards. - **Multi-scout design**: Any card can be scouted by multiple players; each player can scout one card per pack. Buttons stay active for the full 30-minute window. - **Discord relative timestamps**: Scout window shows a live countdown via `<t:UNIX:R>` instead of a static "30 minutes" message. - **Consolidated utilities**: `SCOUT_TOKENS_PER_DAY`, `get_scout_tokens_used()`, and `midnight_timestamp()` centralized to eliminate duplication across 3 files. - **66-test suite**: Comprehensive coverage for helpers, ScoutView callbacks, cog commands, and edge cases. ### New files - `discord_ui/scout_view.py` — ScoutView + ScoutButton UI - `helpers/scouting.py` — embed builders, scout opportunity creation, shared constants - `cogs/economy_new/scouting.py` — `/scout-tokens` command and cleanup task - `tests/scouting/` — full test suite (conftest, helpers, view, cog) ### Modified files - `helpers/main.py` — Hook into `open_st_pr_packs()` after `display_cards()` - `helpers/utils.py` — Added `midnight_timestamp()` - `paperdynasty.py` — Register scouting cog - `discord_ui/__init__.py` — Avoid circular import with ScoutView Requires new API endpoints in paper-dynasty-database (`scout_opportunities`, `scout_claims`). Tracks #44. ## Test plan - [ ] Open a standard/premium pack → scout embed with countdown appears in #pack-openings - [ ] Click a card button as a different user → card copy created, embed updates with scouter info - [ ] Click as the opener → ephemeral rejection - [ ] Use both daily tokens, try a third → ephemeral "out of tokens" - [ ] `/scout-tokens` → shows correct remaining count - [ ] Wait for timeout → buttons disable, embed shows "Scout Window Closed" - [ ] `python -m pytest tests/scouting/` → 66 tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cal added 2 commits 2026-03-05 01:30:34 +00:00
When a player opens a pack, a scout opportunity is posted to #pack-openings
with face-down card buttons. Other players can blind-pick one card using
daily scout tokens (2/day), receiving a copy. The opener keeps all cards.

New files:
- discord_ui/scout_view.py: ScoutView with dynamic buttons and claim logic
- helpers/scouting.py: create_scout_opportunity() and embed builder
- cogs/economy_new/scouting.py: /scout-tokens command and cleanup task

Modified:
- helpers/main.py: Hook into open_st_pr_packs() after display_cards()
- paperdynasty.py: Register scouting cog

Requires new API endpoints in paper-dynasty-database (scout_opportunities).
Tracks #44.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Consolidate SCOUT_TOKENS_PER_DAY and get_scout_tokens_used() into
  helpers/scouting.py (was duplicated across 3 files)
- Add midnight_timestamp() utility to helpers/utils.py
- Remove _build_scouted_ids() wrapper, use self.claims directly
- Fix build_scout_embed return type annotation
- Use Discord <t:UNIX:R> relative timestamps for scout window countdown
- Add 66-test suite covering helpers, ScoutView, and cog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-05 01:32:54 +00:00
cal added 1 commit 2026-03-05 01:39:49 +00:00
- Fix int_timestamp() no-arg path returning seconds instead of
  milliseconds, which would silently break the daily scout token cap
  against the real API
- Acknowledge double-click interactions with ephemeral message instead
  of silently returning (Discord requires all interactions to be acked)
- Reorder scout flow: create card copy before consuming token so a
  failure doesn't cost the player a token for nothing
- Move build_scouted_card_list import to top of scout_view.py
- Remove unused asyncio import from helpers/scouting.py
- Fix footer text inconsistency ("One scout per player" everywhere)
- Update tests for new operation order and double-click behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cal force-pushed feature/scouting from c39d8d173b to d569e91905 2026-03-05 03:04:57 +00:00 Compare
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-05 03:09:11 +00:00
cal added 1 commit 2026-03-05 03:12:24 +00:00
cal added 1 commit 2026-03-05 03:15:41 +00:00
cal added 1 commit 2026-03-05 03:16:40 +00:00
cal merged commit 0aafc3fa46 into next-release 2026-03-05 03:17:09 +00:00
cal deleted branch feature/scouting 2026-03-05 03:17:09 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#50
No description provided.