# ZenBlackjack Changelog

## 1.7.3 - Game pacing and line delay options (2026-10-20)

### Controlled gameplay pacing

- Added `game_pacing` to send gameplay messages through `putnow` with a configurable delay between lines. When enabled, it overrides `game_queue`.
- Added `game_line_delay_ms` to control that delay in milliseconds. The default is `777`; this setting applies only when `game_pacing` is enabled.
- This mode is intended for bots with server-side flood exemptions or equivalent access. It provides a readable game pace without relying on Eggdrop’s normal output queues.
- Setting `game_queue` to `now` sends gameplay lines immediately without this pacing. To use immediate output with controlled spacing, enable `game_pacing` instead.

### Command replies and gameplay queues

- `queue` controls command replies, while `game_queue` controls gameplay output when `game_pacing` is disabled.
- Bots with the necessary flood exemptions can use `queue now` for immediate command replies and `game_pacing 1` for paced gameplay. These settings work independently.
- When pacing is enabled, `game_queue` can retain its existing setting. Otherwise, use `serv`, `quick` or `help` to select Eggdrop’s gameplay output queue.

### Recommended settings

- For ordinary connections, leave `game_pacing` at `0`, use `queue quick` and `game_queue serv`, and keep `stats_full_is_default` at `0` to limit lengthy command output.
- For flood-exempt connections, use `queue now`, enable `game_pacing`, and adjust `game_line_delay_ms` to the desired interval. Leave `game_queue` at its normal setting; pacing overrides it.

## 1.7.2 - Waiting bets, private feedback and shoe-scoped HOLD (2026-10-18)

### Waiting bet changes

- Repeat `-bj <amount>` or another entry alias during the waiting period to
  change an existing wager. Only the difference moves between spendable chips
  and escrow; player order, the starter and the original deal timer stay intact.
- An entry command without an amount reports the existing bet. Invalid,
  unaffordable and post-deal changes leave it unchanged. Leaving or canceling
  before dealing returns the full adjusted stake.
- Failed adjustment saves restore the previous live bet, bankroll and escrow,
  while retaining the normal storage pause and restart-recovery behavior.

### Private command feedback

- Private controls use the same handlers as public commands. Errors and command
  confirmations return by NOTICE; actual game starts, dealing, player actions,
  results and cancellations remain public table events.
- Reply destinations survive delayed WHOIS verification and are restored after
  each command, including errors. Independent callers cannot inherit another
  command's private reply destination. Stale waiting-period account checks do
  not change bets or start a replacement round.
- Private shoe status is available to players, and admins can use private
  `bjnow` along with the existing controls. Public authorization rules remain
  in force. Private `give` remains restricted to house grants.
- Channel forms include `command #channel args`, `#channel command args` and
  `command args #channel`. An omitted private channel is accepted only when one
  shared table fits; start/stop controls prefer a waiting/active table.
  Otherwise the requester is asked to specify the channel.
- Identity diagnostics continue to work in shared channels with gameplay
  disabled, including private saved-record lookups.

### HOLD lifecycle

- `-hold on` now applies to the current shoe and switches off after its next
  successfully saved shuffle. This includes manual, scheduled and safety
  shuffles.
- `-hold on --static` retains the indefinite behavior. Existing saved
  indefinite holds are treated as static when upgrading.
- `--gid N` and `--games N` retain their fixed boundaries and survive safety
  shuffles. Canceling a shuffle schedule does not cancel HOLD.
- `-shoe` distinguishes current-shoe, static, game-ID and remaining-round
  modes. A failed random read or shoe-replacement save preserves the old shoe,
  HOLD, pending schedule and next shoe ID.

### Player feedback and display

- Unaffordable entry wagers suggest `-bailout` only when the player is actually
  eligible under the configured threshold, restore amount, cooldown and active
  game restrictions. Granting, eligibility status and hints share one check.
- Dealer `busts.` becomes `busted!`. Sentence punctuation is outside the color
  span in player bust and player/dealer blackjack announcements. Custom bust
  phrases, card styles and the three-hyphen draw separator are retained.

### Loading and cleanup

- An attempted version upgrade during an active round is deferred with a log
  message, keeping the old engine running. Finish or cancel rounds and rehash
  again. A reload after a storage failure likewise leaves the paused engine in
  place for repair and restart recovery.
- Removed flat-file importing, obsolete test-stat resets and old live-round
  conversion paths. SQLite loading, schema migrations, history reconciliation,
  backups and cold-start escrow refunds remain.
- The implementation remains one complete script. Release history lives here
  instead of the long script-header changelog.
- Schema 3 is unchanged. Back up the database, finish or cancel all rounds,
  enable maintenance, replace the script and rehash. Existing SQLite
  installations need no import or forced shuffle. Flat-file installations must
  first migrate using 1.7.1.

## 1.7.1 - Dealer peek, split safety and expanded achievements

### Dealer blackjack

- The dealer now checks for a natural blackjack immediately after the deal,
  before any player is offered a turn. A dealer natural reveals the hole card
  and settles the round immediately, preventing additional split or double
  wagers against a blackjack that was already dealt.
- Player naturals push against a dealer natural. Other hands lose only their
  original wagers. When the dealer has no natural, the hole card remains
  hidden during player turns. The dealer continues to stand on all 17s.

### Split safety and refunds

- Corrected the pre-deal shoe reserve to account for every player's permitted
  split hands, including resplits up to `max_split_hands`. The calculation
  accounts for the low cards shared by the whole table.
- A shoe with too few cards is safety-shuffled before dealing, preserving
  HOLD. A fresh shoe that cannot safely support the table is refused and
  waiting wagers are returned.
- Added a check that both replacement cards exist before taking another split
  wager. If an active round cannot complete the split, it is canceled and
  all outstanding wagers are refunded.
- The live refund ledger now includes the extra split wager before any card
  draw or history operation can fail. Unexpected split-draw failures cancel
  cleanly without leaving extra chips stranded in escrow or orphaned child
  histories. Database failures retain the paused-storage and restart-recovery
  behavior.

### Achievements

- Separated split sweeps into three achievements: **Split Decision** for
  winning both hands, **Triple Threat** for winning all three, and
  **Four of a Kind** for winning all four.
- Each split sweep awards only the achievement matching that round's final
  hand count. Players retain separately earned achievements from other
  qualifying rounds; larger sweeps do not automatically grant smaller ones.
- Added **Déjà Vu** for two consecutive natural blackjacks and
  **Split Turnaround** for losing the first split hand but finishing the
  complete split round with a positive combined net.
- Existing qualifying recorded history is recognized silently. Reconciled
  split-sweep receipts prevent an older, broader Split Decision award from
  suppressing the first actual two-hand award. Simulated hands do not earn
  live achievement announcements.

### Personal-best streaks and highlights

- Best-streak highlights are explicitly marked as a player's personal best.
  A known best can be displayed without inventing a date when its date has
  not been recovered.
- When `-highlights` selects a shorter streak, it also includes the personal
  best within the existing three-line limit.
- `-highlight` continues to select one random entry from the highest-priority
  available group, including other recorded streaks. It does not become a
  most-recent-only command.
- Reconcile understated best-streak statistics when saved highlights prove a
  longer streak. Corrections create a database backup, only raise the proven
  best, and preserve the other statistics and financial records.

### Identity administration

- Extended `-identity [nick|id]` to find a live nickname across channels shared
  with the bot. Replies show the matching player ID, services account and
  verification source, current host, source channel and saved nickname alias.
- Numeric IDs and `p`-prefixed IDs display saved services accounts, nicknames,
  learned hosts and manual hostmasks. Saved-ID lookups also work for offline
  players.
- Added private lookups through `/msg <bot> identity [nick|id]`. Optional
  channel forms are supported, and public lookups can be used in bot channels
  where `+blackjack` is disabled. Replies are private notices.
- Existing global +B or +n access and maintenance controls still apply.
  Delayed live checks revalidate the caller and target before replying.
  Nickname aliases remain lookup information, never proof of identity.
  Diagnostics do not create players or change stored identity links.
- Avoid the unsafe `accounttracking` capability probe on affected Eggdrop
  1.10.2 servers while preserving native `getaccount` lookup and verified
  server WHOIS fallback.

### Additional shoe and display refinements

- Added `-shuffle --next` to schedule one shuffle immediately before the
  selected channel's next deal, including when scheduling during a round.
  It preserves HOLD, replaces the previous shuffle schedule, survives rehash
  and restart, and can be removed with `-shuffle --cancel`.
- Individual drawn-card announcements use the selected plain, reverse or
  explicit card style. Explicit cards retain their configured background;
  `---` separates the drawn card from the resulting full hand.

### Secure shuffle refinement

- Fisher–Yates uses operating-system randomness from `/dev/urandom` with
  rejection sampling for unbiased index selection. It does not fall back to
  Tcl `rand()` if secure randomness fails.
- New-shoe failures leave the current shoe and pending schedules intact.
  Undealt rounds are canceled through durable escrow refunds; a refund is
  announced only after its save succeeds. Later requests retry automatically.
- A nonfatal load-time source check, rate-limited failure/recovery logging and
  secure-source status in `-shoe` make failures visible without replacing an
  existing shoe or interrupting its usable rounds.

### Updating

- Existing schema 3 databases require no schema migration or history
  re-import. Keep the configured database path, finish or cancel active rounds,
  replace the script and rehash.

## 1.7.0 - Splits, player history and career profiles

### Splitting hands

- Added `-split` for two cards of equal value, including mixed 10/J/Q/K
  pairs. Splitting matches the current hand's wager and requires enough chips
  to cover the additional bet.
- Added resplitting up to four hands by default. `max_split_hands` can be
  configured from two to four. Each hand is played in order before moving
  to the next player, with its own cards, wager, actions and turn timer.
- Double after split is allowed. Split aces receive exactly one additional
  card each, automatically stand and cannot be split again.
- Added `split_21_bonus`: immediate two-card split 21 pays 3:2 when it wins
  if enabled (the supplied default), or ordinary 1:1 if disabled. A split 21
  is never counted as a natural blackjack and still loses to dealer blackjack.
- Added numbered hand displays, individual results and a combined split
  total. Turn prompts show only the actions currently available, including
  `-split` and `-double` when the hand and bankroll permit them.
- Each completed split hand counts toward hand/result statistics. Win
  streaks use the combined round net: a positive round adds one win, while
  a loss or net-zero round resets the streak. Added split-action and
  split-round counters.
- Split settlement updates the tracked bankroll high using the combined
  result, preventing a winning branch from temporarily inflating the high
  before its losing siblings are accounted for.
- Added split support to the admin simulator and existing cancellation,
  refund, nickname-change and identity paths.

### Profiles, statistics and accounting

- Added `-info [nick]` for first/last recorded game dates, completed hands
  and incoming-gift preference. Unrecovered dates are identified explicitly;
  the start of new recording is not presented as a player's first-ever game.
- Revised `-stats [nick]` into a shorter career view showing wins,
  blackjacks, doubles, best win streak and biggest win.
- Added `-stats [nick] --full` for hand totals, wins/losses/pushes, win,
  blackjack, bust and double rates, current streak, dealer-bust wins,
  splits, timeouts and forfeits. Win rate excludes pushes.
- Added `--brief` and `stats_full_is_default` to select the preferred stats
  detail level. The supplied default is the shorter view.
- Added `-ledger [nick]` for bankroll, tracked high, chips won/lost, game
  net, gifts sent/received, house grants, bailouts and biggest loss.

### Persistent history and sessions

- Added durable hand records with player identity, nickname, channel,
  game/shoe IDs, timestamps, wager, player/dealer cards, outcome, net result,
  natural-blackjack, double and simulation flags.
- Added split ancestry and numbered child-hand records. Replaced parent
  hands are retained as split records rather than counted as completed hands.
- Added `-session [nick]` to summarize the current or most recent session,
  including results, blackjacks, game net and session start time. A gap of
  one hour starts a new session by default (`session_gap`).
- Added `-recent [nick] [hands]` for a summary of the latest completed
  recorded hands. The default is 20 (`recent_hands`); an explicit positive
  count is accepted before or after the nickname.
- Canceled and interrupted hands remain distinguishable from settled results
  and are excluded from completed-hand summaries. Split child hands count
  individually in recent/session totals.
- Dates use `history_timezone`, set to `America/New_York` in the supplied
  script. Existing recovered history remains available alongside new records.

### Highlights and achievements

- Added dated highlights for five-or-more-card 21s, winning doubles,
  record wins, win streaks, consecutive blackjacks, first natural blackjack
  and winning every hand of a split.
- Added `-highlight [nick]` for one randomly selected highlight from the
  highest-priority available group, and `-highlights [nick]` for up to three
  different kinds of highlight.
- Added `-achievements [nick]` with cosmetic badges for natural blackjacks,
  hand-count milestones, doubles, winning doubles, win streaks, five/six-card
  21s and split sweeps. Badges do not award chips or change gameplay rules.
- Newly earned badges and selected personal bests are announced with the
  ordinary result. Persistent award receipts prevent repeat announcements
  after rehash or restart; existing accomplishments are recognized silently.
- Simulated hands are marked in history and do not produce live highlight
  or achievement celebrations.

### Private table views and surrender

- Added `-hand` (alias `-cards`) to privately repeat the caller's cards,
  total, wager, dealer's visible cards, available actions and turn status.
  Waiting-game and active-turn countdowns are shown when available.
- Added `-table` for a private table summary available to players and
  spectators, including wagers, totals, turn order and split-hand status.
  The dealer's hole card and total stay hidden during player turns.
- Read-only hand/table views do not reset or extend game timers.
- Changed live `-leave`/`-quit` into confirmed surrender: the first command
  displays the cost; repeat either within 30 seconds to forfeit half the
  wager, rounded up, and refund the remainder (`leave_confirm_seconds`).
- Leaving before dealing still refunds the full wager. Finished hands
  cannot be surrendered; they settle normally. For split rounds, surrender
  applies only to unfinished hands, preserving finished branches for settlement.
- Added `-bailout --status` for a private eligibility/cooldown check without
  granting chips or changing state. Added `bailout_threshold`, initialized
  from the default bet but configurable separately.

### Output and card display

- Added separate configurable queues for command replies (`queue`) and
  gameplay (`game_queue`), supporting `serv`, `help`, `quick` and `now`.
  Supplied defaults are `quick` for replies and `serv` for gameplay.
- Added `plain`, `reverse` and `explicit` card styles. The supplied default
  is explicit white card faces with black brackets and red/black suits;
  foreground, background and bracket colors remain configurable.
- Reverse formatting extends through the closing bracket. Its appearance
  still depends on the client's handling of reverse and color controls.
- Explicit formatting preserves the background through the closing bracket
  and resets afterward. Long explicit-card messages wrap between complete
  card tiles; long badge/celebration output also respects the UTF-8 budget.
- Expanded `-help` and `-commands` for the new gameplay and history commands.

### Storage, upgrade and recovery

- Extended SQLite to schema 3, adding profile dates, hand history, highlights
  and split-hand fields. Schema upgrades run automatically and create
  database backups before the history and split migrations.
- History, award receipts, financial results and recovery markers are saved
  with the existing transaction-based persistence. Existing player IDs,
  balances, counters, gift preferences, shoes and maintenance state are retained.
- Restart recovery marks unfinished recorded hands as interrupted and refunds
  outstanding escrow. Already committed surrender losses remain settled;
  combined split streak effects are applied at most once.
- Added turn tokens and hand-context checks so an old timer or a command
  delayed by WHOIS verification cannot act on a later split hand or changed turn.
- Finish or cancel old-version rounds before upgrading. The script refuses
  an upgrade from another version while a round is active. No history
  re-import is required when updating an existing 1.7.0 database for splits
  or achievement announcements.

## 1.6.2 - Persistent maintenance mode

- Added global maintenance mode for blackjack-enabled channels. Blocked
  commands receive an explicit offline-for-maintenance reply.
- Added admin controls through `-bjmaintenance on|off|status`, partyline
  `.bjmaintenance on|off|status` and `/msg <bot> bjmaintenance on|off|status`.
  Omitting the argument shows status. Existing global +B or +n access is required.
- Saved maintenance state in SQLite so it survives rehash and restart.
- Maintenance cannot be enabled while rounds or outstanding wagers remain.
  Finish the rounds or cancel them with `-bjstop` first. Enabling maintenance
  clears pending account checks to prevent delayed commands from replaying.
- Keep `+blackjack` enabled in channels where players should receive the
  offline reply. Turning maintenance off restores normal command access.
- Included the 1.6.2-r1 test-channel exception: a configurable `testchan`
  can remain playable during maintenance when it has `+blackjack`.
  It uses ordinary bankrolls and statistics; set `testchan` to `""` to disable it.
- Included the 1.6.2-r2 exception keeping `-version` and `-bjversion`
  available during maintenance, even with no test channel configured.
- Preserved existing bankrolls, identity links, statistics and shoe settings.

## 1.6.1 - Channel selection for shoe controls

- Added an optional channel to public `-shoe`, `-hold` and `-shuffle`.
  Without a channel, each command continues to use the current channel.
- Examples: `-shoe #zen`, `-hold #zen on`, `-hold #zen --games 3`,
  `-shuffle #zen --gid 1100` and `-shuffle #zen --cancel`.
- The channel can also appear last: `-hold on #zen` or `-shuffle --cancel #zen`.
- The bot must be on the target channel with blackjack enabled. Hold and
  shuffle still require existing blackjack admin access; shoe status remains
  available to ordinary players and is returned by notice.
- Updated usage/help text. Existing private command forms remain available.
- No database migration is required; update only the script and rehash.

## 1.6.0 - SQLite persistence

### Storage and migration

- Replaced the flat-file database with SQLite, using Tcl's `sqlite3` binding.
  No separate database server or SQLite command-line program is required.
- The default database is now `scripts/blackjack.sqlite3` (`dbfile`).
  `chipfile` remains the legacy import source.
- Added a one-time import when the SQLite database has not been initialized.
  The original `.dat` file is retained, and a `.pre-sqlite.bak` copy is made
  if that backup does not already exist. Later loads use SQLite only.
- Preserved player IDs, services accounts, nickname aliases, learned hosts,
  manual hostmasks, bankrolls, statistics and gift preferences.
- Preserved shoe card order, remaining cards, holds, scheduled shuffles,
  ID counters and outstanding wager escrow.
- Player, identity, statistic, shoe and escrow data are stored in separate
  tables. Shoe cards retain their exact positions.

### Transactions and recovery

- Each save commits balances, statistics, identities, shoes, counters and
  wager escrow together in one transaction, with FULL synchronous writes.
- SQL values use bound parameters, including nicknames and hostmasks.
- Rehashing preserves live wagers. A process restart refunds interrupted
  wagers exactly once, retaining the existing recovery behavior.
- A failed save rolls back the transaction, pauses gameplay and cancels
  round timers. After repairing the cause, restart Eggdrop for recovery;
  rehashing is refused after a storage failure.
- Added schema, integrity and foreign-key checks when opening the database.
- A saved generation counter detects another writer using the same database.
  Direct editing of the live database remains unsupported.

### Backups and compatibility

- Added `::blackjack::backup_database <destination>` for consistent backups
  while the bot is running. It refuses to overwrite an existing backup or
  the live database. This is a Tcl procedure, not a new public IRC command.
- The old `.dat` stops receiving updates after migration. It remains a
  rollback source before new activity; later rollback requires reconciling
  or exporting current SQLite data.
- Gameplay rules, payouts, identity matching and existing IRC commands are
  unchanged. The deployed 420-second account-cache setting is retained.
- Tested offline with Tcl 8.6 and SQLite 3.34.1: full import comparisons,
  restart refunds, transaction rollback, backups and all 19 existing
  identity/game regression tests passed.
- Live verification confirmed account links and balances, a completed hand,
  balance/shoe/hold/game-ID persistence across rehash, successful backup,
  and an `ok` database integrity check.

## 1.5.2 - Services accounts and identity controls

### Account recognition

- Preserved Eggdrop's native services-account lookup (`getaccount`). Reliable
  native tracking remains the preferred source of identity information.
- Added a verified server WHOIS fallback for AuthServ and other networks that
  supply account names through numeric 330 when native tracking is unavailable
  or incomplete.
- WHOIS replies are checked against the player's nickname and current
  ident/host before an account is accepted. Commands wait for verification;
  failed or timed-out checks do not create a player record.
- Verified accounts are learned automatically when an existing player is
  recognized through their host, or when a new player record is created.
- Account checks are cached for a configurable interval
  (`account_cache_seconds`, 30 seconds by default). Further checks occur when
  needed by a command; idle players are not periodically polled.
- Account, nick and host changes, joins/leaves, and bot reconnections clear
  cached information. Rehashing clears pending checks without replaying old
  commands or wagers.

### Identity administration

- Added `-identity [nick]` to show the live account and its source, current
  host, matching player ID, and saved nickname alias. Live checks require the
  target to be in the channel where the command is used.
- Added `-listaccounts <id>`, `-addaccount <id> <account>` and
  `-delaccount <id> <account>` to inspect and manage persistent account links.
- These commands require blackjack admin access: global +B or +n. Account
  changes require the player to be out of all games and are saved immediately.
- An account already linked to another ID cannot be silently reassigned.

### Matching and host cleanup

- Services accounts take priority over manual blackjack hostmasks and learned
  exact hosts. Nicknames remain lookup aliases, not proof of identity.
- A different authenticated account cannot claim an account-linked record
  merely by matching its host.
- Normalized duplicate host aliases are consolidated. `-delhost` removes
  equivalent manual and learned entries, including leading-tilde variants.
- Ambiguous host ownership is detected rather than used to guess a player ID.
- `-chips`, `-stats` and `-getpid` no longer create new player records merely
  to answer a lookup.

### IDs and compatibility

- Existing v6 databases retain player IDs, bankrolls, statistics, gift
  preferences, shoes, holds and scheduled shuffles.
- Host matching remains available for unauthenticated players and networks
  without a supported account provider.

## 1.5.1 - Timed holds and scheduled shuffles

This update replaces the old --gid stale-command check with actual scheduling.

### Holds

- `-hold on` holds indefinitely; `-hold off` releases any hold early.
- `-hold --gid 50` holds through game #50. Normal automatic shuffling becomes
  available again before this channel's next deal above that ID.
- `-hold --games 5` holds for the next five rounds dealt in this channel.
  A round already underway does not count toward a newly set five-round hold.
- Canceled or refused rounds before dealing do not consume the count. Rounds
  that were dealt count even if later canceled. Rehashing does not count.
- Setting a new hold replaces the previous duration. `-hold on` clears any
  previous expiry and makes the hold indefinite.
- Expiry releases HOLD; it does not force a shuffle unless normal rules need one.

### Emergency shuffles

- A held shoe no longer blocks play when too few cards remain. The bot explains
  why it must shuffle, retains queued wagers, and proceeds with a fresh shoe:

    HOLD is enabled: X cards remain; at least Y are required to safely deal
    to Z player(s). Shuffling a fresh shoe; HOLD remains enabled.

- Emergency shuffles preserve HOLD and its game-ID target or remaining count.
  They do not reset or extend the duration.
- If even a fresh shoe cannot safely support the player count, the round is
  still refused and wagers are refunded; a hold count is not consumed.

### Scheduled shuffles

- `-shuffle` shuffles immediately, between rounds only.
- `-shuffle --gid 50` schedules a one-time shuffle after game #50, before
  this channel's next deal above that ID. Scheduling is allowed during play.
- `-shuffle --cancel` removes the schedule without affecting HOLD.
- Setting another target replaces the previous schedule. Already-past targets
  are rejected; the currently active round can be used as a target.
- A scheduled shuffle explicitly overrides HOLD for that shuffle, but preserves
  the hold setting and duration afterward.
- Manual and emergency shuffles do not cancel a future scheduled shuffle.
- Game IDs remain global across channels. If another channel receives the
  target ID, the action occurs before this channel's next deal above it.

### Status, persistence and configuration

- `-shoe` and `-hold` show the hold type, target ID or future rounds remaining,
  plus any scheduled shuffle. During the final counted round, zero future
  rounds remain; HOLD stays enabled until that round ends.
- All hold and schedule settings survive rehashes and restarts. Existing
  1.5.0 shoes keep their cards and hold state when upgraded.
- Updated help and private admin routes support the new command forms.
- Preserved the changelog URL in `-version` and its compatibility alias.

## 1.5.0 - Persistent shoes and game IDs

### The shoe

- Cards now carry over between rounds instead of using a freshly shuffled
  single deck for every game.
- Each channel has its own independent shoe.
- The default shoe contains six standard decks shuffled together: 312 cards.
  Identical cards can appear in the same hand because each card has six copies.
- Deck count is configurable from 1 to 8.
- Automatic reshuffling defaults to 75% of the shoe dealt. The shuffle happens
  before the next round, never halfway through a hand.
- The bot may shuffle earlier if too few cards remain to safely finish a round.
  The safety reserve accounts for the number of players and possible draws.

### Game and shoe IDs

- Each dealt round receives a game ID; each fresh shoe receives a shoe ID.
- Both IDs appear in the dealing header. Results include the game ID.
- ID counters persist across restarts and are shared across channels, so IDs
  may skip within one channel when another channel is also playing.

### New commands

- `-shoe` shows the shoe ID, deck count, cards remaining, hold status, and
  current or last game ID. Anyone can use it; the reply is a notice.
- `-hold on` prevents automatic reshuffling of the current shoe.
- `-hold off` restores automatic reshuffling.
- `-hold` shows the current status.
- `-shuffle` creates a fresh shoe between rounds. It is refused while a game
  is waiting to start or already in progress.
- Hold and shuffle controls require blackjack admin access: global +B or +n.
- A manual shuffle preserves the hold setting. Use `-hold off` to release it.
- If a held shoe cannot safely support the next round, the round is canceled
  before dealing and all waiting wagers are returned. No silent reshuffle.

An optional game-ID check protects against acting on the wrong round:

    -shuffle --gid 42
    -hold on --gid 42
    -hold off --gid 42

The command is refused if the channel's current/last game ID is not 42.
This is a safety check, not a seed or a way to replay an earlier game.

Private admin commands are also supported:

    /msg zen shuffle #zen
    /msg zen hold #zen on
    /msg zen hold #zen off
    /msg zen shoe #zen

### Persistence and recovery

- Shoe order, remaining cards, hold settings and ID counters are saved.
- Rehashing retains live rounds and their committed wagers.
- A full restart cancels unfinished rounds and refunds outstanding wagers.
  Cards already drawn remain removed from the shoe.
- Database saves write a temporary file before replacing the existing file,
  protecting the previous save if writing fails.
- Balances, identities, statistics and gift preferences are retained.
- Natural-blackjack payouts use exact integer arithmetic for the 3:2 profit,
  with fractional chips rounded down.

### Configuration

    variable shoe_decks 6
    variable shoe_cut_percent 75

A deck-count change takes effect when the next fresh shoe is shuffled.
The cut percentage controls when automatic reshuffling becomes due; the
safety reserve can require an earlier shuffle. Hold overrides automatic
shuffling, but does not override the safety check.

Back up the chip database before upgrading. The database now uses v6 records
for shoes, counters and outstanding wagers alongside the player records.

## 1.4.2k - Help and transfer limits

- Added `-help` with brief command explanations, sent by notice.
- Added `-commands` for the compact command list and `-version` for the version.
- Retained `-bjcommands`, `-bjcmds` and `-bjversion` as compatibility aliases.
- Help advertises the shorter command names. Admins receive additional help.
- Added configurable per-transaction limits:
  - `max_mint`: 1,000,000 chips for `-mint` and `-give --house`.
  - `max_gift`: 100,000 chips for player-to-player gifts.
- Transfers above the limit are rejected without moving chips.
- Bankrolls and legitimate game payouts remain uncapped.

## 1.4.2j - Gift preferences

- Added `-gifts off` to block incoming player gifts.
- Added `-gifts on` to accept them again; enabled is the default.
- `-gifts` reports the current setting by notice.
- Preferences are saved per player and survive reloads.
- Blocked gifts leave both balances and transfer totals unchanged.
- House grants and bailouts remain available when player gifts are disabled.

## 1.4.2i - Offline simulated bailout fix

- Fixed `-simul <nick> bailout` for players absent from the channel.
- The simulation uses the existing player ID instead of resolving an empty
  live host and accidentally creating a new player record.
- Normal bailout eligibility and cooldown checks still apply.

## 1.4.2h - Expanded statistics

- Expanded `-stats` into two lines: gameplay results and bankroll information.
- Renamed "Net" to "Game net" to distinguish gambling results from transfers.
- Added gifts sent/received, house-granted chips and bailout counts alongside
  the current bankroll and highest bankroll.
- Bailouts show counts; historical bailout chip totals were not recorded.

## 1.4.2g - House grants and admin command syntax

- Added `-mint <nick> <chips>` as a dedicated command for issuing house chips.
  It shares the grant handler with `-give --house <nick> <chips>`.
- Replaced the earlier `house|nick` grant syntax with `--house`, and changed
  bailout cooldown overrides to `-bailout --override <nick>`.
- Added matching private admin forms, with the command and channel accepted
  in either order. A private bailout cooldown override can omit the channel
  when the target already has a saved identity.
- House grants continue to update bankroll tracking and house-grant totals
  without counting as gambling wins or game net. Ordinary gifts transfer
  chips from the sender rather than creating them.

## 1.4.2f - Semantic output colors

- Added configurable colors for positive results, losses, warnings, admin
  actions, economy values and neutral outcomes.
- Refined the initial full-line color treatment to highlight relevant amounts
  and result phrases while leaving ordinary gameplay text in its default
  color. Warning and admin messages retain their category colors.
- Applied the formatting to wagers, drawn-card announcements, settlements,
  bankrolls, gifts, bailouts, statistics and turn warnings. Card suit colors
  remain separate from message colors.

## 1.4.2d - Turn warnings and instant admin games

- Added `turn_warning_time` to warn the current player before the turn expires.
  The warning and timeout are canceled together; a hit that continues the turn
  starts a fresh pair of timers.
- Added admin-only `-bjnow <bet>` to start a solo game immediately, skipping
  the joining period and passing the accepted wager to the normal deal path.
- Added a separate private admin command list to `-bjcommands`, keeping the
  ordinary player command list available to everyone.

## 1.4.2 - Unified entry commands and result feedback

- Made `-blackjack` and `-bj` the normal commands for both starting a game and
  joining one during its waiting period. `-bet` and `-join` remain compatibility
  aliases and can also start a game when no table is waiting.
- Standardized waiting-game entry announcements across those aliases.
- Added varied bust messages. Double-down busts receive one additional random
  reaction, with the expensive-wager reaction limited to doubled bets above
  5,000 chips.
- Added the remaining bankroll to each player's settlement line, including
  wins, losses, pushes and blackjacks.
- Moved the compact command list to NOTICE and added `-bjcmds` as an alias.

## 1.4 - Stronger identity matching and host administration

- Removed nickname-only matching as proof of player identity. Live resolution
  uses a known services account, an administrator-assigned hostmask or a learned
  exact host; saved nicknames remain available for record lookups.
- Normalized learned host matching to treat a leading ident `~` consistently.
  Conflicting nicknames and learned hosts no longer silently take ownership
  from another player record.
- Added saved manual hostmasks and admin commands `-getpid`, `-addhost`,
  `-delhost` and `-listhosts`. Host administration checks existing ownership
  and known conflicts before accepting an assignment.
- Updated gifts, statistics, chip lookups and admin targeting to use the
  stronger identity and saved-record lookup paths.
- Added an admin bailout cooldown override. It clears the cooldown rather
  than granting chips or bypassing the remaining eligibility checks.

## 1.3 - Unified simulation and waiting-wager accounting

- Replaced the separate private `f*` force commands (fblackjack, fhit, fstand, etc) with `simul`, invoking the
  ordinary player handlers for entry, hit, stand, double, leave and bailout.
  Added public admin `-simul` alongside the private form. Simulation remains
  subject to the normal action rules and does not include house grants.
- Added private `bjstart` and `bjstop` controls, accepting the command before
  or after the channel.
- Moved accepted opening wagers out of spendable chips as soon as a player
  enters a waiting game. Starting, joining and doubling use the available
  bankroll rather than allowing already-committed chips to be spent again.
- Added refund handling for leaving a waiting game and for admin cancellation.
  Dealing no longer deducts opening wagers a second time.
- Standardized thousands separators in entry, settlement and forfeit output.

## 1.2 - Start-or-join entry

- Made `-blackjack` and `-bj` join an existing waiting game using the supplied
  or default wager. They continue to start a new game when no game is waiting.
- Entry commands remain unavailable as player actions after dealing begins.

## 1.1 - Early-start controls and command aliases

- Added admin-only `-bjstart` to deal an existing waiting game before its
  joining timer expires.
- Added `-bet` as an alias for joining and `-bjversion` to display the script
  version. Updated command help and turn prompts to use consistent names.
- Added `fbet` to the private admin entry controls, with matching logging and
  usage feedback. These force commands were later replaced by `simul`.
- Added the ZenBlackjack name and explicit attribution to horgh's original
  script.

## 1.0 - Identity-aware bankrolls and player economy

- Established the numbered ZenBlackjack baseline, consolidating the earlier
  unversioned development copies.
- Supported multiplayer tables per enabled channel, a joining period, timed
  player turns, hit, stand and double down. Doubling matches the opening wager,
  draws one card and ends the turn; timeouts automatically stand.
- Used a shuffled 52-card deck for each round, adjustable ace values, dealer
  stand on all 17s, 3:2 natural-blackjack wins and pushes for equal totals.
- Saved player IDs, bankrolls, services accounts, nicknames, learned hosts and
  statistics in a flat-file database. Nick changes could follow a player
  through an active round.
- Added player statistics for results, blackjacks, busts, win streaks, chips
  won/lost and bankroll highs. Separate bankroll tracking kept direct manual
  balance edits from becoming recorded career highs.
- Included player gifts, privileged house grants and cooldown-limited
  bailouts. Transfers and grants affected bankroll accounting separately
  from gambling results; bailouts restored a qualifying balance to the
  configured amount rather than adding that amount.
- Included `-chips`, `-stats`, `-bjcommands`, admin game cancellation and private
  controls for acting on a player's behalf. This was intended for testing with bots and should be used ethically! Blackjack administration used
  global `+B` or owner access, and gameplay required channel `+blackjack`.
