Playerbot: fix role verb alias + BotGear addon frame build

- BotCommandParser: accept 'role' (addon verb) and 'role_all'/'roleall' as
  aliases for 'setrole'/'setrole_all' so the PlayerbotControl roster role menu
  works (was refused as unknown verb).
- BotGear.lua: create frames/buttons with 'BackdropTemplate' so SetBackdrop
  doesn't throw (retail 11.x+ requirement) — /botgear did nothing because the
  frame build errored out. Also fix the goldText/bagScroll/bagContent locals
  being declared after first use.
This commit is contained in:
devbox
2026-08-17 08:04:35 +10:00
parent ef35de35e5
commit 8b3c826c16
2 changed files with 7 additions and 7 deletions
@@ -28,6 +28,7 @@ local bagLayout = {} -- [bagNum] = {entry, size}
local gold = 0
local selected = nil -- {bag=, slot=} item picked up for move
local modelActor = nil
local bagScroll, bagContent, goldText
local EQUIP_SLOT_NAMES = {
[0]="Head",[1]="Neck",[2]="Shoulder",[3]="Shirt",[4]="Chest",
@@ -92,7 +93,7 @@ local function RefreshSlot(btn, entry, count, quality, isSelected)
end
local function CreateSlotButton(parent, x, y, slotType, bag, slot)
local btn = CreateFrame("Button", nil, parent)
local btn = CreateFrame("Button", nil, parent, "BackdropTemplate")
btn:SetSize(SLOT_SIZE, SLOT_SIZE)
btn:SetPoint("TOPLEFT", x, -y)
btn:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
@@ -184,8 +185,6 @@ local function RefreshBags()
end
-- Rebuild the bag section layout inside the scroll content.
local bagScroll, bagContent, goldText
local function BuildBagLayout()
local content = bagContent
if not content then return end
@@ -301,7 +300,7 @@ end
local function BuildFrame()
if frame then return end
frame = CreateFrame("Frame", "BotGearFrame", UIParent)
frame = CreateFrame("Frame", "BotGearFrame", UIParent, "BackdropTemplate")
frame:SetSize(520, 700)
frame:SetPoint("CENTER")
frame:SetBackdrop({ bgFile="Interface\\DialogFrame\\Background-DialogFrame",
@@ -352,7 +351,7 @@ local function BuildFrame()
end
-- Bags (scroll)
bagScroll = CreateFrame("ScrollFrame", nil, frame)
bagScroll = CreateFrame("ScrollFrame", nil, frame, "BackdropTemplate")
bagScroll:SetPoint("TOPLEFT", frame, "TOPLEFT", 205, -40)
bagScroll:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -12, 34)
bagScroll:SetBackdrop({ bgFile="Interface\\DialogFrame\\UI-DialogBox-Background" })
@@ -2611,12 +2611,13 @@ bool BotCommandParser::DispatchSingle(Player* sender, Player* bot, std::string c
desired ? "Aoe: ON (rotation biases AoE)" : "Aoe: OFF (single-target)"});
return true;
}
if (cmd == "setrole")
if (cmd == "setrole" || cmd == "role")
{
// /setrole tank|healer|dps|clear — pin the bot to a role
// independent of its spec. Picked up by all group/healer logic via
// BotAI::effective_role(). `clear` (or no argument) drops the
// override so the snapshot's spec-derived role applies again.
// "role" is the PlayerbotControl addon's verb; "setrole" the chat one.
BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
if (!ai)
{
@@ -2664,7 +2665,7 @@ bool BotCommandParser::DispatchSingle(Player* sender, Player* bot, std::string c
fmt::format("Aoe_all: applied to {} bot(s).", changed)});
return true;
}
if (cmd == "setrole_all" || cmd == "setroleall")
if (cmd == "setrole_all" || cmd == "setroleall" || cmd == "role_all" || cmd == "roleall")
{
// Mass role-override across the group. Useful for "everyone DPS, no
// healer for this trash pull" or "everyone tank, /follow_all to taunt