Skip to content

.bgevents settings per account#14

Closed
Annamaria-CC wants to merge 1 commit into
azerothcore:mainfrom
Annamaria-CC:settings-peraccount
Closed

.bgevents settings per account#14
Annamaria-CC wants to merge 1 commit into
azerothcore:mainfrom
Annamaria-CC:settings-peraccount

Conversation

@Annamaria-CC

@Annamaria-CC Annamaria-CC commented Jul 9, 2026

Copy link
Copy Markdown
Member

This has been fully made by AI

I tested it, and it seems to work just fine.

I cannot stand in for the code itself.

This is just a proof of concept

Summary by CodeRabbit

  • New Features

    • Auto-queue opt-in/out now applies to your account instead of a single character.
    • Added support for remembering this preference across sessions.
  • Bug Fixes

    • Clarified that turning auto-queue off only affects future queue passes and does not remove an existing queue.
  • Documentation

    • Updated setup and usage notes to match the new account-wide behavior.
    • Added guidance on the required database migration before using the feature.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The bgevents opt-out mechanism is migrated from per-character storage via core PlayerSettings to an account-wide custom database table (mod_bg_auto_queue_account_settings). BgAutoQueue.h/.cpp implement in-memory account tracking and database persistence; command messages and documentation are updated accordingly.

Changes

Account-wide opt-out migration

Layer / File(s) Summary
Opt-out table schema
data/sql/db-characters/base/mod_bg_auto_queue_account_settings.sql
New table with account_id primary key and opted_out flag defaulting to 0.
Header contract for account-level opt-out
src/BgAutoQueue.h
Removes BgAutoQueueSetting enum, adds LoadAccountSettings() declaration and _optedOutAccounts unordered_set member, updates comments.
Load and persist account opt-out state
src/BgAutoQueue.cpp
Adds DatabaseEnv.h include, calls LoadAccountSettings() on config load, replaces PlayerSetting-based opt-out logic with account-id set lookups and REPLACE/DELETE persistence, implements LoadAccountSettings().
Command message wording update
src/cs_bg_auto_queue.cpp
Updates .bgevents response/status messages from "your character" to "your account".
Documentation and config comments
README.md, conf/mod-bg-auto-queue.conf.dist, docs/how-it-works.md
Updates docs and config notes to describe account-wide opt-out storage, SQL migration requirement, and command behavior clarifications.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Player
  participant CommandHandler as cs_bg_auto_queue
  participant BgAutoQueue
  participant Database as mod_bg_auto_queue_account_settings

  Player->>CommandHandler: .bgevents off
  CommandHandler->>BgAutoQueue: SetOptOut(accountId, true)
  BgAutoQueue->>Database: REPLACE INTO opted_out=1
  BgAutoQueue-->>CommandHandler: updated _optedOutAccounts
  CommandHandler-->>Player: "opted out for your account"

  Note over BgAutoQueue,Database: On config reload
  BgAutoQueue->>Database: LoadAccountSettings query opted_out=1
  Database-->>BgAutoQueue: account_id rows
  BgAutoQueue->>BgAutoQueue: repopulate _optedOutAccounts
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: .bgevents settings now apply per account.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Annamaria-CC Annamaria-CC changed the title Changes to settings per account .bgevents settings per account. Jul 9, 2026
@Annamaria-CC Annamaria-CC changed the title .bgevents settings per account. .bgevents settings per account Jul 9, 2026
@@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS `mod_bg_auto_queue_account_settings` (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mmmh the whole idea behind using playersettings was that we would avoid a new table

@FrancescoBorzi

Copy link
Copy Markdown
Contributor

thanks for this PR 🙏 however I'm not sure we wanted to go this way (see comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants