Files
playerbot-v2/sql/playerbot/playerbot_bootstrap.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

111 lines
5.3 KiB
SQL

-- ============================================================================
-- PlayerbotV2: Shared playerbot database bootstrap
-- Creates the `playerbot` database and all tables required by the module.
-- Run this once after installing the module.
--
-- Usage: mysql -u root -p < playerbot_bootstrap.sql
-- This file is NOT part of TrinityCore's auto-updater.
-- ============================================================================
CREATE DATABASE IF NOT EXISTS `playerbot` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
USE `playerbot`;
-- ---------------------------------------------------------------------------
-- Handcrafted roads: operator-curated road centerlines for navmesh re-tagging
-- and bot pathfinding. Queried by HandcraftedRoadStorage.
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `handcrafted_road` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`mapId` INT UNSIGNED NOT NULL,
`fromX` FLOAT NOT NULL,
`fromY` FLOAT NOT NULL,
`fromZ` FLOAT NOT NULL DEFAULT 0,
`toX` FLOAT NOT NULL DEFAULT 0,
`toY` FLOAT NOT NULL DEFAULT 0,
`toZ` FLOAT NOT NULL DEFAULT 0,
`width` FLOAT NOT NULL DEFAULT 2.0,
`comment` VARCHAR(255) DEFAULT NULL,
`verified` TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_map` (`mapId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
-- ---------------------------------------------------------------------------
-- Bot name pool: pre-generated names for spawned bots.
-- Queried by Fleet::BotNamePool.
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `playerbots_names` (
`name_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(12) NOT NULL,
`gender` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`is_used` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`used_by_guid` BIGINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (`name_id`),
UNIQUE KEY `uk_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
-- ---------------------------------------------------------------------------
-- Dungeon route waypoints: auto-generated navmesh corridor chains.
-- Queried by DungeonScriptMgr.
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `playerbot_dungeon_routes` (
`map_id` SMALLINT UNSIGNED NOT NULL,
`difficulty` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '0 = any difficulty',
`seq` SMALLINT UNSIGNED NOT NULL COMMENT 'ordered chain index',
`position_x` FLOAT NOT NULL,
`position_y` FLOAT NOT NULL,
`position_z` FLOAT NOT NULL,
PRIMARY KEY (`map_id`, `difficulty`, `seq`),
KEY `map_idx` (`map_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
-- ---------------------------------------------------------------------------
-- Nav links: DB-authored traversal links (jumps, unmeshed walkable stretches).
-- Queried by the dungeon stepper and travel graph.
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `playerbot_nav_links` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`map_id` SMALLINT UNSIGNED NOT NULL,
`from_x` FLOAT NOT NULL,
`from_y` FLOAT NOT NULL,
`from_z` FLOAT NOT NULL,
`to_x` FLOAT NOT NULL,
`to_y` FLOAT NOT NULL,
`to_z` FLOAT NOT NULL,
`radius` FLOAT NOT NULL DEFAULT 12 COMMENT 'mouth proximity (3D yards)',
`verified` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`created_by` VARCHAR(64) NOT NULL DEFAULT '',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `idx_map` (`map_id`),
KEY `idx_verified` (`verified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
-- ---------------------------------------------------------------------------
-- World metadata: operator-curated world knowledge (cities, roads, danger
-- zones, vendors, mailboxes, innkeepers, crossroads). Populated via
-- `.playerbot meta add` GM commands.
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `playerbot_v2_world_metadata` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`map_id` INT UNSIGNED NOT NULL,
`zone_id` INT UNSIGNED NOT NULL DEFAULT 0,
`kind` TINYINT UNSIGNED NOT NULL,
`pos_x` FLOAT NOT NULL,
`pos_y` FLOAT NOT NULL,
`pos_z` FLOAT NOT NULL,
`radius` FLOAT NOT NULL DEFAULT 10.0,
`label` VARCHAR(96) NOT NULL DEFAULT '',
`notes` VARCHAR(255) NOT NULL DEFAULT '',
`created_by` VARCHAR(64) NOT NULL DEFAULT '',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
KEY `idx_map_kind` (map_id, kind),
KEY `idx_map_xy` (map_id, pos_x, pos_y),
KEY `idx_zone` (zone_id),
KEY `idx_kind` (kind)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;