Files
playerbot-v2/sql/playerbot_v2/0002_owner_squad_control.sql
T
josh b853b3ae06 PlayerbotV2 module with core-hooks patches and full SQL migrations
Shipped patches:
  playerbotv2_core_hooks.patch    — stock TrinityCore master
  playerbotv2_core_hooks.thordekk.patch — ThordekkCore

SQL applied at module init by PlayerbotMigrationMgr:
  sql/playerbot_v2/0000_playerbot_shared_bootstrap.sql  — creates playerbot
    shared DB + tables (handcrafted_road, playerbots_names,
    playerbot_dungeon_routes, playerbot_nav_links,
    playerbot_v2_world_metadata)
  sql/playerbot_v2/0001..0016*.sql  — character DB tables

SQL auto-applied by TC DBUpdater:
  sql/updates/auth/master/
  sql/updates/characters/master/

Manual fallback:
  sql/playerbot/playerbot_bootstrap.sql

Static data (manual):
  src/modules/PlayerbotV2/sql/shared/
  src/modules/PlayerbotV2/sql/world/

Includes: Log.h, SpellAuras.h (PlayerbotAPI), Position.h (PlayerbotHooks)
2026-08-11 16:42:02 +10:00

45 lines
2.2 KiB
SQL

-- Migration: 0002_owner_squad_control
-- Date: 2026-05-06
-- Purpose: Owner-bot binding + squad-control state. Adds persistent
-- owner_account_id / owner_player_guid so a bot's authority
-- model survives logout / group disband. Also adds squad-
-- control state (formation type/slot, follow distance,
-- verbose flag) so commands like /follow, /formation wedge,
-- and /verbose persist across restarts.
-- Reverts: yes (DROP COLUMN ... and DROP TABLE on the squad preset).
-- Per-character owner + squad state. All columns default to "no owner /
-- autonomous defaults" so existing rows keep current behaviour.
ALTER TABLE playerbot_v2_character
ADD COLUMN owner_account_id INT UNSIGNED NOT NULL DEFAULT 0
AFTER spawn_state,
ADD COLUMN owner_player_guid BIGINT UNSIGNED NOT NULL DEFAULT 0
AFTER owner_account_id,
ADD COLUMN formation_type TINYINT UNSIGNED NOT NULL DEFAULT 0
AFTER owner_player_guid,
ADD COLUMN formation_slot TINYINT UNSIGNED NOT NULL DEFAULT 0
AFTER formation_type,
ADD COLUMN follow_distance_yd FLOAT NOT NULL DEFAULT 5.0
AFTER formation_slot,
ADD COLUMN owner_verbose TINYINT(1) NOT NULL DEFAULT 0
AFTER follow_distance_yd,
ADD KEY idx_owner_account (owner_account_id),
ADD KEY idx_owner_player (owner_player_guid);
-- Owner-saved squad presets (formation per role/class snapshots that an
-- owner can re-apply after a wipe / new dungeon entry / etc).
-- One row per (owner_account_id, preset_name); the payload_json stores
-- {bot_guid → {slot, type}} mappings. We use TEXT (JSON in 8.0+) for
-- forward compat; the application layer parses.
CREATE TABLE IF NOT EXISTS playerbot_v2_squad_preset (
owner_account_id INT UNSIGNED NOT NULL,
preset_name VARCHAR(64) NOT NULL,
saved_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
payload_json TEXT NOT NULL,
PRIMARY KEY (owner_account_id, preset_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Record this migration as applied.
INSERT INTO playerbot_v2_schema_version (version, sha256)
VALUES (2, 'pending-fill-at-release-time-with-actual-sha256-of-this-file');