NightVibes GM Panel - ServerTools - bots: spawn, talents, limit
===============================================================

What this is
  AnoCore v4 ships its own playerbots: 100 random bots roam the world, and
  every player can run up to 4 of his own characters as bots with
  ".bot add <name>". The server has no command to create a bot of a chosen
  race and class, no command to set a bot's talents, and the bot limit lives
  in a config file. These tools add exactly that, from the server side:

    Spawn-ForeverBot.cmd        a new bot of the race, class, gender, level and
                                spec you choose, on your account, ready for
                                .bot add <name>
    Set-ForeverBotTalents.cmd   talents of any of your characters by spec
                                (frost, fire, protection, feral tank ...) or
                                role (tank, heal, dps), all 27 specs
    Set-ForeverBotLimit.cmd     bots per player 4 -> 39 (for 39-man raids)
    Dump-ForeverCharacter.cmd   read-only dump of one character's rows into
                                logs\ (for bug reports)

  They are for the SERVER OWNER (they stop and start the server and write the
  database). Players on someone else's server cannot use them: ask your
  server owner to run them, or to install this package.

  The in-game part (NV-GMBar, Bots tab) works for everyone with a GM account:
  Add / Remove / List bots, orders, roles, Fight mode, Set Level, Reset
  Talents, Inspect, Give Arrows, Train Target, Prepare Bot (spells, quest
  abilities, weapon skills, both riding, Exalted all), Auto-train on level
  up, Spec row, Bot limit.

Install (server PC only, once)
  1. Copy ALL files of this ServerTools folder into your AnoCore-Server
     folder, next to Start-ForeverServer.cmd:
        Spawn-ForeverBot.cmd          Spawn-ForeverBot.ps1
        Set-ForeverBotTalents.cmd     Set-ForeverBotTalents.ps1
        Set-ForeverBotLimit.cmd       Set-ForeverBotLimit.ps1
        Dump-ForeverCharacter.cmd     Dump-ForeverCharacter.ps1
        ForeverBotTalents.py          ForeverBotBuilds.json
        traits.json                   read_traits.py
     (the teleport and weather tools in this folder are separate, see their
     own README files)
  2. Nothing else. The tools use the server's own python and mariadb and
     ForeverServer.Common.ps1 that are already in that folder.
  3. If you upgrade the repack with Upgrade-ForeverRepack.cmd, add the file
     names above to its FILES line so they are kept, or copy them again.

Spawn a bot
  Double-click Spawn-ForeverBot.cmd and answer:
     Your own character    Enter = the character you played last
                           (the bot lands on that character's account)
     Name for the new bot  2 to 12 letters, a name nobody has
     Race                  Human Dwarf NightElf Gnome (Alliance)
                           Orc Undead Tauren Troll (Horde)
                           It must be your character's faction.
     Class                 Warrior Paladin Hunter Rogue Priest Shaman Mage
                           Warlock Druid
     Gender                male, female, any
     Level                 1-60, or Enter to keep the bot's level
     Spec                  frost, fire, protection, feral tank, discipline
                           smite ... or tank / heal / dps, or Enter for none
  What it does: the server already keeps a pool of random bots it created
  itself (real gear, looks, spells, skills). The tool takes one of the race
  and class you asked for, renames it, moves it to your account, sets the
  level and the talents, and starts the server again (about 15 seconds).
  The pool refills itself.

  Then in game, in Say:   .bot add <name>
  and invite it. If you changed its level, click Train Target once (Bots tab)
  so it learns the spells and weapon skills of the new level.

  "The random bot pool has no <race> <class> right now": run
     Spawn-ForeverBot.cmd list
  in a command prompt to see what the pool holds, or raise
  AiPlayerbot.MaxRandomBots in server\aiplayerbot.conf for a bigger pool.

  Command line form (for scripts):
     Spawn-ForeverBot.cmd Toga Tempo Dwarf Warrior male 12 protection

Change a bot's talents
  Double-click Set-ForeverBotTalents.cmd, type the character name and the
  spec. The character must be logged out (and not online as a bot).
  Specs: Arms Fury Protection / Holy Protection Retribution / Beast Mastery
  Marksmanship Survival / Assassination Combat Subtlety / Discipline Holy
  Shadow / Elemental Enhancement Restoration / Arcane Fire Frost /
  Affliction Demonology Destruction / Balance Feral Restoration.
  Two words pick a build: "feral tank" (bear), "feral cat", "discipline
  smite", "enhancement dps". A role word (tank heal dps melee ranged caster)
  picks the class's usual spec for it.

  Every build is validated against the client's own talent data (traits.json)
  before anything is written, points are spent tier by tier like a player
  would, and the server re-checks them at login. The window also prints a
  NOTE when a spec does not match what the bot AI actually casts (for
  example a Fire mage: the bot opens with Frostbolt. Frost fits it best).
  Specs that match the bot AI fully: Protection warrior, all paladin specs,
  Beast Mastery, Marksmanship, Combat, Discipline, Holy priest, Elemental,
  Restoration shaman, Frost mage, all warlock specs, Feral bear, Restoration
  druid.

Bot limit
  Set-ForeverBotLimit.cmd writes AiPlayerbot.MaxAltBots = 39 into
  server\aiplayerbot.conf (created from aiplayerbot.conf.dist if missing),
  keeps a backup, and restarts the server. Then the Bots tab's "Bot limit"
  dropdown (4 Group, 9 Raid, 39 Raid) decides how many the panel adds.

Logs and undo
  Every run writes logs\spawnbot-<date>.log or logs\bottalents-<date>.log
  with the old rows (talents) or the old name and account (spawn), and the
  SQL it ran as logs\*.sql. To undo a spawn, run Set-ForeverBotTalents and
  Spawn again, or delete the character in game.

Rebuilding traits.json (only after a client update)
  traits.json is read from the client's talent DB2 files. If AnoCore ships a
  new client build, open a command prompt in the server folder and run
     server\python\python.exe read_traits.py data\dbc\enUS
  (read_traits.py needs the addon's Exporter\export_nightvibes_data.py next
  to it or in ..\Exporter).

Verified facts behind these tools (from worldserver.exe and the databases)
  - Bot orders: follow, stay, passive, attack, role tank/heal/dps/auto, grind,
    leave, help. Whispered by the group leader.
  - The bot AI has ONE fixed spell list per class and reads no talents or
    spec. A spec choice changes damage and healing numbers, not what is cast.
  - Talents are stored in character_forever_trait (traitNodeId,
    traitNodeEntryId, rank). The server validates them at login and resets
    invalid ones ("stored Forever talents are invalid").
  - Random bots are characters on accounts named RNDBOT* (prefix from
    aiplayerbot.conf). Moving one to another account removes it from the
    pool. The server creates a new one.
  - Nothing here trades with bots, opens their bags, equips them or makes
    them duel: the server has no such feature. That list has gone to the
    AnoCore developers as a feature request.
