diff --git a/src/modules/PlayerbotV2/Addon/ForeverBots/Bindings.xml b/src/modules/PlayerbotV2/Addon/ForeverBots/Bindings.xml
new file mode 100644
index 0000000000..4dccfd7c59
--- /dev/null
+++ b/src/modules/PlayerbotV2/Addon/ForeverBots/Bindings.xml
@@ -0,0 +1,19 @@
+
+
+ ForeverBots_ToggleWindow()
+
+
+ ForeverBots_ToggleStance()
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.lua b/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.lua
index a9136618b1..a5225d80ec 100644
--- a/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.lua
+++ b/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.lua
@@ -29,7 +29,7 @@ end
local CLASSES = {
{ key = "warrior", label = "Warrior", token = "WARRIOR", roles = { "tank", "dps" } },
- { key = "paladin", label = "Paladin", token = "PALADIN", roles = { "tank", "healer", "dps" }, faction = "Alliance" },
+ { key = "paladin", label = "Paladin", token = "PALADIN", roles = { "tank", "healer", "dps" } },
{ key = "shaman", label = "Shaman", token = "SHAMAN", roles = { "healer", "dps" }, faction = "Horde" },
{ key = "hunter", label = "Hunter", token = "HUNTER", roles = { "dps" } },
{ key = "rogue", label = "Rogue", token = "ROGUE", roles = { "dps" } },
@@ -57,8 +57,25 @@ local function ServerCommand(text)
SendChatMessage(text, "SAY")
end
--- Stance toggle of the panel: false = the last order sent was passive (the default while you lead a dungeon group).
-local stanceAggressive = false
+-- Stance toggle of the panel: ForeverBotsDB.stance is "passive" or "aggressive" (nil = never picked: passive, the default while
+-- you lead a dungeon group). The pick is kept between sessions and re-sent to the group whenever it changes (new bots).
+local function StanceIsAggressive()
+ return ForeverBotsDB ~= nil and ForeverBotsDB.stance == "aggressive"
+end
+-- What the button shows: the pick; before one, "Passive" inside an instance (that is what is sent to the group there, see the group
+-- change timer below) and "Auto" elsewhere (nothing sent, the bots use their own default).
+local function StanceLabel()
+ local stance = ForeverBotsDB and ForeverBotsDB.stance
+ if stance == "aggressive" then return "Aggressive" end
+ if stance == "passive" then return "Passive" end
+ local okI, inInstance = pcall(IsInInstance)
+ if okI and inInstance then return "Passive" end
+ return "Auto"
+end
+local stanceBtn
+local function RefreshStance()
+ if stanceBtn then stanceBtn:SetText(StanceLabel()) end
+end
-- Bot orders go to the group as addon messages under a fixed prefix; the server reads them like party chat. SendChatMessage
-- from addon code is blocked by this client in combat and in battlegrounds (taint), addon messages are not. Out of combat a
@@ -73,7 +90,14 @@ do
end
end
-local function GroupOrder(text)
+-- Result codes of SendAddonMessage that mean "try again in a moment" (AddonMessageThrottle 3, ChannelThrottle 8): a burst of
+-- clicks in a 40-man raid, or the other raid addons' traffic in a fight, fills the client's addon message budget, and an order
+-- lost to it is no refusal of combat. The order is retried for up to five seconds before it is given up.
+local THROTTLED = { [3] = true, [8] = true }
+local ORDER_RETRIES = 6
+
+local function GroupOrder(text, attempt)
+ attempt = attempt or 0
local channel
if IsInRaid and IsInRaid() then channel = "RAID"
elseif (IsInGroup and IsInGroup()) or (GetNumPartyMembers and GetNumPartyMembers() > 0) then channel = "PARTY"
@@ -81,15 +105,31 @@ local function GroupOrder(text)
Print("you have no group yet: add a bot first.")
return
end
+ local code, errText
if prefixOk then
local send = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage
local ok, res = pcall(send, ORDER_PREFIX, text, channel)
-- Enum.SendAddonMessageResult.Success is 0; older clients return nothing, which counts as sent.
local sent = ok and (res == nil or res == true or res == 0 or (Enum and Enum.SendAddonMessageResult and res == Enum.SendAddonMessageResult.Success))
if sent then return end
+ if ok then code = tonumber(res) or (res == false and -1 or nil) else errText = tostring(res) end
+ if code and THROTTLED[code] and attempt < ORDER_RETRIES and C_Timer and C_Timer.After then
+ C_Timer.After(0.8, function() GroupOrder(text, attempt + 1) end)
+ return
+ end
end
if InCombatLockdown and InCombatLockdown() then
- Print("the order could not be sent in combat.")
+ -- The client lets the player's own Enter send chat in combat (typing "pull back" in raid chat works while the button does
+ -- not), so the line is put in the chat box ready to send: an order is never lost.
+ local why = code and (" (addon message result " .. code .. ")") or errText and (" (" .. errText .. ")") or (prefixOk and "" or " (addon prefix not registered)")
+ -- Only straight from the click (attempt 0): from the C_Timer retry the client blocks chat-box access as "an action only
+ -- available to the Blizzard UI", so a retry prints the hint instead.
+ if attempt == 0 and ChatFrame_OpenChat then
+ ChatFrame_OpenChat((channel == "RAID" and "/raid " or "/party ") .. text)
+ Print("the order could not be sent in combat" .. why .. ": press Enter to send it.")
+ else
+ Print("the order could not be sent in combat" .. why .. ": type it in " .. strlower(channel) .. " chat.")
+ end
return
end
SendChatMessage(text, channel)
@@ -365,6 +405,79 @@ local function MakeButton(parent, text, width, onClick, height)
return b
end
+-- Fixed group orders (Follow, Pull back, Fall back, ...) are secure macro buttons that run "/raid " or "/party ":
+-- the client keeps addon code from sending anything itself during a boss fight (SendAddonMessage is refused and the chat call
+-- raises "Interface action failed because of an AddOn", live MC Baron Geddon 2026-10-12), but a click on a secure button runs
+-- the player's own chat command, in combat too. The server reads that line like typed chat. The macro text names the channel and
+-- is set out of combat (a secure attribute cannot change in a fight): on every group change and when combat ends.
+local secureOrders = {}
+local secureDirty = false
+
+local function OrderChannelWord()
+ return (IsInRaid and IsInRaid()) and "/raid " or "/party "
+end
+
+local function RefreshOrderMacros()
+ if InCombatLockdown and InCombatLockdown() then
+ secureDirty = true
+ return
+ end
+ secureDirty = false
+ local word = OrderChannelWord()
+ for _, b in ipairs(secureOrders) do
+ b:SetAttribute("type", "macro")
+ b:SetAttribute("macrotext", (b.macroPre or "") .. word .. b.orderText)
+ end
+end
+
+local function MakeSecureOrderButton(parent, text, width, order, height)
+ local b = CreateFrame("Button", nil, parent, "UIPanelButtonTemplate,SecureActionButtonTemplate")
+ b:SetSize(width, height or 22)
+ b:SetText(text)
+ b:RegisterForClicks("AnyUp", "AnyDown")
+ b.orderText = order
+ secureOrders[#secureOrders + 1] = b
+ RefreshOrderMacros()
+ return b
+end
+
+local orderMacroFrame = CreateFrame("Frame")
+for _, ev in ipairs({ "GROUP_ROSTER_UPDATE", "PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE", "PLAYER_REGEN_ENABLED", "PLAYER_ENTERING_WORLD" }) do
+ pcall(orderMacroFrame.RegisterEvent, orderMacroFrame, ev)
+end
+orderMacroFrame:SetScript("OnEvent", function() RefreshOrderMacros() end)
+
+------------------------------------------------------------------------------------------------------------- key bindings
+-- Esc > Options > Key Bindings > AddOns > "WoW Forever Bots" (Bindings.xml; unbound until the player picks keys). Order keys
+-- click hidden secure buttons that run the same "/party " or "/raid " line as the window buttons, so they work in
+-- combat. Nothing here touches the chat edit box or runs from a timer.
+local KEY_ORDERS = {
+ { "Attack", "attack", "Attack (your target)" },
+ { "Pull", "pull", "Pull" },
+ { "PullBack", "pull back", "Pull back" },
+ { "Follow", "follow", "Follow" },
+ { "Stay", "stay", "Stay" },
+ { "Resume", "resume", "Resume" },
+ { "Stop", "disengage", "Stop attacking" },
+ { "Flee", "flee", "Flee" },
+ { "Come", "come", "Come" },
+ { "FallBack", "fallback", "Fall back" },
+ { "AttackMouseover", "attack", "Attack (mouseover)", "/target [@mouseover,harm,nodead]\n" },
+}
+BINDING_HEADER_FOREVERBOTS = "WoW Forever Bots"
+BINDING_NAME_FOREVERBOTS_TOGGLE_WINDOW = "Show / hide the bot window"
+BINDING_NAME_FOREVERBOTS_TOGGLE_STANCE = "Toggle stance (Passive / Aggressive)"
+for _, k in ipairs(KEY_ORDERS) do
+ local name = "ForeverBotsKey" .. k[1]
+ local b = CreateFrame("Button", name, UIParent, "SecureActionButtonTemplate")
+ b:RegisterForClicks("AnyUp", "AnyDown")
+ b.orderText = k[2]
+ b.macroPre = k[4] -- optional macro lines before the order (Attack mouseover targets the unit under the cursor first)
+ secureOrders[#secureOrders + 1] = b
+ _G["BINDING_NAME_CLICK " .. name .. ":LeftButton"] = k[3]
+end
+RefreshOrderMacros()
+
local function ClassColor(token)
local c = RAID_CLASS_COLORS and RAID_CLASS_COLORS[token]
if c then
@@ -447,6 +560,79 @@ local function Tip(b, title, body)
b:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
+-- Raid ready: one click for the usual start of a raid night. It calls your saved bots (".bot summon saved", the call every player may use), waits until the group
+-- stops growing, makes it a raid when it holds more than five, sets the formation and spacing, hands the fight back
+-- ("resume"), sets the Main Tank flag when you target a group member, and starts a ready check once the bots have buffed
+-- themselves. A new click or combat cancels a run in progress.
+local raidReadyRun = 0
+local function MemberCount()
+ if GetNumGroupMembers then return GetNumGroupMembers() end
+ if GetNumRaidMembers and GetNumRaidMembers() > 0 then return GetNumRaidMembers() end
+ return (GetNumPartyMembers and GetNumPartyMembers() or 0) + 1
+end
+
+local function RaidReady()
+ if InCombatLockdown and InCombatLockdown() then
+ Print("raid ready: not in combat.")
+ return
+ end
+ if not (C_Timer and C_Timer.After) then
+ Print("raid ready: this client has no timers; use /fb call all.")
+ return
+ end
+ raidReadyRun = raidReadyRun + 1
+ local run = raidReadyRun
+ local function After(sec, fn)
+ C_Timer.After(sec, function()
+ if run == raidReadyRun and not (InCombatLockdown and InCombatLockdown()) then fn() end
+ end)
+ end
+ local function IsRaidNow() return IsInRaid and IsInRaid() end
+
+ local function ReadyCheck()
+ local ok = pcall(function() DoReadyCheck() end)
+ Print(ok and "raid ready: ready check sent." or "raid ready: done (only the leader can start a ready check).")
+ end
+ local function Orders(n)
+ GroupOrder("resume")
+ After(0.4, function() GroupOrder("formation circle") end)
+ After(0.8, function() GroupOrder("spacing close") end)
+ After(1.2, function()
+ GroupOrder(ForeverBotsDB.cc == false and "crowdcontrol off" or "crowdcontrol on")
+ local tgt = UnitExists and UnitExists("target") and not IsSecret(UnitName("target"))
+ if tgt and (UnitInRaid and UnitInRaid("target") or UnitInParty and UnitInParty("target")) then
+ GroupOrder("set main tank")
+ end
+ end)
+ Print("raid ready: " .. n .. " in the group, formation set. Ready check in 20 seconds.")
+ After(20, ReadyCheck)
+ end
+ local function Finish(n)
+ if n <= 1 then
+ Print("raid ready: no bots joined. Save a group with /fb save all first.")
+ return
+ end
+ if n > 5 and not IsRaidNow() then
+ local conv = (C_PartyInfo and C_PartyInfo.ConvertToRaid) or ConvertToRaid
+ if conv then pcall(conv) end
+ After(1.5, function() Orders(MemberCount()) end)
+ else
+ Orders(n)
+ end
+ end
+
+ Print("raid ready: calling your saved bots...")
+ ServerCommand(".bot summon saved")
+ local lastN, stable, waited = -1, 0, 0
+ local function Poll()
+ local n = MemberCount()
+ if n == lastN then stable = stable + 1 else stable = 0; lastN = n end
+ waited = waited + 1
+ if (n > 1 and stable >= 3) or waited >= 30 then Finish(n) else After(1, Poll) end
+ end
+ After(2, Poll)
+end
+
local function BuildFrame()
frame = CreateFrame("Frame", "ForeverBotsFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil)
frame:SetSize(330, 10)
@@ -552,6 +738,10 @@ local function BuildFrame()
"The bots leave marked mobs alone: no crowd control.",
function(on) GroupOrder(on and "crowdcontrol on" or "crowdcontrol off") end)
y = y - 34
+ local raidReadyBtn = MakeButton(frame, "Raid ready", 298, RaidReady, 24)
+ raidReadyBtn:SetPoint("TOPLEFT", 16, y)
+ Tip(raidReadyBtn, "Raid ready", "Calls your saved bots, makes the group a raid if it needs one, sets the formation and spacing, and starts a ready check once the bots have buffed. Target your main tank first to set the Main Tank flag too. Not in combat.")
+ y = y - 32
---------------------------------------------------------------------------------------------- order rows
local function Header(text, hint)
@@ -573,7 +763,11 @@ local function BuildFrame()
local made = {}
for _, d in ipairs(defs) do
local b
- b = MakeButton(frame, d[1], d[2], function() d[5](b) end)
+ if d[6] then
+ b = MakeSecureOrderButton(frame, d[1], d[2], d[6])
+ else
+ b = MakeButton(frame, d[1], d[2], function() d[5](b) end)
+ end
b:SetPoint("TOPLEFT", x, y)
if d[3] then Tip(b, d[3], d[4]) end
made[#made + 1] = b
@@ -586,55 +780,56 @@ local function BuildFrame()
Header("Orders to the group", "Everything below goes to all your bots.")
-- Move and fight.
Row({
- { "Follow", 72, "Follow", "Bots follow you and only defend. They do not advance or pull until you say Attack, Pull or Resume.", function() GroupOrder("follow") end },
- { "Stay", 72, "Stay", "Bots hold where they stand.", function() GroupOrder("stay") end },
- { "Attack", 72, "Attack", "Bots attack your target.", function() GroupOrder("attack") end },
- { "Resume", 72, "Resume", "Hand the fight back: bots go on with their normal play.", function() GroupOrder("resume") end },
+ { "Follow", 72, "Follow", "Bots follow you and only defend. They do not advance or pull until you say Attack, Pull or Resume.", function() GroupOrder("follow") end, "follow" },
+ { "Stay", 72, "Stay", "Bots hold where they stand.", function() GroupOrder("stay") end, "stay" },
+ { "Attack", 72, "Attack", "Bots attack your target.", function() GroupOrder("attack") end, "attack" },
+ { "Resume", 72, "Resume", "Hand the fight back: bots go on with their normal play.", function() GroupOrder("resume") end, "resume" },
})
Row({
- { "Pull", 72, "Pull", "Your tank bots open on your target; the rest join once it is engaged.", function() GroupOrder("pull") end },
- { "Pull back", 72, "Pull back", "The main tank bot opens on your target from range, runs back to the rally point (or where it stood) and tanks it there, so nothing else aggros.", function() GroupOrder("pull back") end },
- { "Stop", 72, "Stop", "Bots stop attacking and go back to normal.", function() GroupOrder("disengage") end },
- { "Flee", 72, "Flee", "Bots break off and run to you.", function() GroupOrder("flee") end },
+ { "Pull", 72, "Pull", "Your tank bots open on your target; the rest join once it is engaged.", function() GroupOrder("pull") end, "pull" },
+ { "Pull back", 72, "Pull back", "The main tank bot opens on your target from range, runs back to the rally point (or where it stood) and tanks it there, so nothing else aggros.", function() GroupOrder("pull back") end, "pull back" },
+ { "Stop", 72, "Stop", "Bots stop attacking and go back to normal.", function() GroupOrder("disengage") end, "disengage" },
+ { "Flee", 72, "Flee", "Bots break off and run to you.", function() GroupOrder("flee") end, "flee" },
})
-- Stance toggle. Passive: the bots start nothing on their own and only defend themselves and the group until you say
-- Attack or Pull. Aggressive: they attack anything hostile within about 10 yards of you. The button shows the stance
-- it last sent (the bots start passive while you lead a dungeon group).
- Row({
- { "Come", 72, "Come", "Bots teleport to you.", function() GroupOrder("come") end },
- { stanceAggressive and "Aggressive" or "Passive", 98, "Stance",
- "Passive: bots start nothing and only defend. Aggressive: they attack anything hostile within about 10 yards of you. Shows what you last sent.",
+ local stanceRow = Row({
+ { "Come", 72, "Come", "Bots teleport to you.", function() GroupOrder("come") end, "come" },
+ { StanceLabel(), 98, "Stance",
+ "Auto: nothing sent yet outside an instance, the bots use their own default. Inside an instance the panel sends Passive until you pick. Passive: bots start nothing and only defend. Aggressive: they attack anything hostile within about 10 yards of you. Shows what you last sent; it is sent again to every bot that joins.",
function(self)
- stanceAggressive = not stanceAggressive
- GroupOrder(stanceAggressive and "aggressive" or "passive")
- self:SetText(stanceAggressive and "Aggressive" or "Passive")
+ ForeverBotsDB.stance = StanceIsAggressive() and "passive" or "aggressive"
+ GroupOrder(ForeverBotsDB.stance)
+ self:SetText(StanceLabel())
end },
})
+ stanceBtn = stanceRow[2]
y = y - 8
Header("After a wipe or to regroup")
Row({
-- Dead bots release their spirit and run back to their corpses; living ones ignore it.
- { "Release", 96, "Release", "After a wipe: every dead bot releases, runs back to its corpse and rejoins you. Living bots ignore it.", function() GroupOrder("release") end },
+ { "Release", 96, "Release", "After a wipe: every dead bot releases, runs back to its corpse and rejoins you. Living bots ignore it.", function() GroupOrder("release") end, "release" },
-- Fall back: every bot drops the fight, runs to the rally point (set with Set rally, else where you stand) and
-- re-forms there; it fights only what follows until Attack, Pull or Resume.
- { "Fall back", 96, "Fall back", "Every bot drops the fight and runs to the rally point, then re-forms there. It fights only what follows until you say Attack, Pull or Resume.", function() GroupOrder("fallback") end },
- { "Set rally", 96, "Set rally", "Sets the rally point to where you stand (used by Fall back and Pull back).", function() GroupOrder("rally here") end },
+ { "Fall back", 96, "Fall back", "Every bot drops the fight and runs to the rally point, then re-forms there. It fights only what follows until you say Attack, Pull or Resume.", function() GroupOrder("fallback") end, "fallback" },
+ { "Set rally", 96, "Set rally", "Sets the rally point to where you stand (used by Fall back and Pull back).", function() GroupOrder("rally here") end, "rally here" },
})
y = y - 8
Header("Formation and spacing")
Row({
-- Formation round you out of combat (None = the plain follow behind you) and the spacing between bots.
- { "Circle", 72, "Circle", "Out of combat the bots stand in a ring round you.", function() GroupOrder("formation circle") end },
- { "Arrow", 72, "Arrow", "Out of combat the bots form an arrow pointing the way you face.", function() GroupOrder("formation arrow") end },
- { "Line", 72, "Line", "Out of combat the bots line up abreast behind you.", function() GroupOrder("formation line") end },
- { "No form.", 72, "No formation", "The plain follow behind you.", function() GroupOrder("formation none") end },
+ { "Circle", 72, "Circle", "Out of combat the bots stand in a ring round you.", function() GroupOrder("formation circle") end, "formation circle" },
+ { "Arrow", 72, "Arrow", "Out of combat the bots form an arrow pointing the way you face.", function() GroupOrder("formation arrow") end, "formation arrow" },
+ { "Line", 72, "Line", "Out of combat the bots line up abreast behind you.", function() GroupOrder("formation line") end, "formation line" },
+ { "No form.", 72, "No formation", "The plain follow behind you.", function() GroupOrder("formation none") end, "formation none" },
})
Row({
- { "Tight", 72, "Tight spacing", "About 2.5 yards between bots.", function() GroupOrder("spacing tight") end },
- { "Close", 72, "Close spacing", "About 4 yards between bots (the default).", function() GroupOrder("spacing close") end },
- { "Spread", 72, "Spread spacing", "About 8 yards between bots.", function() GroupOrder("spacing spread") end },
+ { "Tight", 72, "Tight spacing", "About 2.5 yards between bots.", function() GroupOrder("spacing tight") end, "spacing tight" },
+ { "Close", 72, "Close spacing", "About 4 yards between bots (the default).", function() GroupOrder("spacing close") end, "spacing close" },
+ { "Spread", 72, "Spread spacing", "About 8 yards between bots.", function() GroupOrder("spacing spread") end, "spacing spread" },
})
-- Distance row: how far the bots follow you (and the formation spacing), stepped 1 yard per click.
local distLabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
@@ -810,6 +1005,11 @@ end
-- Sends the coalesced distance order and re-sends it silently when the group grows or shrinks (new bots need it).
+local function GroupSize()
+ if GetNumGroupMembers then return GetNumGroupMembers() end
+ if GetNumRaidMembers and GetNumRaidMembers() > 0 then return GetNumRaidMembers() end
+ return (GetNumPartyMembers and GetNumPartyMembers() or 0)
+end
local distFrame = CreateFrame("Frame")
distFrame.acc = 0
distFrame:SetScript("OnUpdate", function(self, elapsed)
@@ -824,18 +1024,25 @@ distFrame:SetScript("OnUpdate", function(self, elapsed)
self.groupAt = nil
SendDistance(true)
end
+ if self.stanceAt and now >= self.stanceAt then
+ self.stanceAt = nil
+ -- The bots of a group start on the server's default stance, so the stance the panel shows is sent to every one of them
+ -- (new and re-created bots included); a never-picked stance is sent only inside an instance, where Passive is the default.
+ local okI, inInstance = pcall(IsInInstance)
+ if GroupSize() > 0 and (ForeverBotsDB.stance or (okI and inInstance)) then
+ GroupOrder(StanceIsAggressive() and "aggressive" or "passive")
+ end
+ RefreshStance()
+ end
end)
-local function GroupSize()
- if GetNumGroupMembers then return GetNumGroupMembers() end
- if GetNumRaidMembers and GetNumRaidMembers() > 0 then return GetNumRaidMembers() end
- return (GetNumPartyMembers and GetNumPartyMembers() or 0)
-end
local function OnGroupChanged()
local n = GroupSize()
if n ~= lastGroupSize then
lastGroupSize = n
if n == 0 then gearSent = "match" end
if n > 0 and ForeverBotsDB.distance then distFrame.groupAt = Now() + 2 end
+ if n > 0 then distFrame.stanceAt = Now() + 2.5 end
+ RefreshStance()
end
end
for _, ev in ipairs({ "GROUP_ROSTER_UPDATE", "PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE" }) do
@@ -848,6 +1055,16 @@ local function Toggle()
if frame:IsShown() then frame:Hide() else frame:Show() end
end
+function ForeverBots_ToggleWindow() Toggle() end
+
+function ForeverBots_ToggleStance()
+ if not ForeverBotsDB then return end
+ ForeverBotsDB.stance = StanceIsAggressive() and "passive" or "aggressive"
+ GroupOrder(ForeverBotsDB.stance)
+ RefreshStance()
+ Print("stance: " .. StanceLabel())
+end
+
------------------------------------------------------------------------------------------------------------- bot panel
-- A small floating panel for ONE bot: it follows your target whenever that is a friendly player in your group (a bot),
-- and every button is a whisper to that bot ("/w follow"), so the order acts on that bot only and the bot
@@ -878,12 +1095,28 @@ end
-- The player's own invite: the call typed /invite makes (the client's portrait "Invite" sends nothing for a bot on 70338).
local function InviteByName(name)
+ -- Always says what it did, so a click that sends nothing is visible in the chat frame (portrait Invite, 2026-10-12: no
+ -- packet reached the server and nothing was shown).
+ local can
+ if C_PartyInfo and C_PartyInfo.CanInvite then
+ local okC, res = pcall(C_PartyInfo.CanInvite)
+ if okC then can = res end
+ end
+ if can == false then Print("cannot invite " .. name .. " (the game says you may not invite right now)") end
+ local sent, how = false, nil
if C_PartyInfo and C_PartyInfo.InviteUnit then
local ok, err = pcall(C_PartyInfo.InviteUnit, name)
- if ok then return end
- Debug("invite: C_PartyInfo.InviteUnit failed: " .. tostring(err))
+ if ok then sent, how = true, "C_PartyInfo.InviteUnit" else Debug("invite: C_PartyInfo.InviteUnit failed: " .. tostring(err)) end
end
- if SlashCmdList and SlashCmdList.INVITE then SlashCmdList.INVITE(name) else Print("type /invite " .. name) end
+ if not sent and InviteUnit then
+ local ok, err = pcall(InviteUnit, name)
+ if ok then sent, how = true, "InviteUnit" else Debug("invite: InviteUnit failed: " .. tostring(err)) end
+ end
+ if not sent and SlashCmdList and SlashCmdList.INVITE then
+ local ok, err = pcall(SlashCmdList.INVITE, name)
+ if ok then sent, how = true, "/invite" else Debug("invite: /invite failed: " .. tostring(err)) end
+ end
+ if sent then Print("invite sent to " .. name .. " (" .. how .. ")") else Print("could not send the invite; type /invite " .. name) end
end
local function BotWhisper(text)
@@ -1076,88 +1309,35 @@ end)
-- and the floating panel (target-driven) is the way in.
-- Opens the client's chat box already in whisper mode for (no slash text, so the client's slash parser is not involved:
-- on client 70291 in a battleground every slash line errors inside Blizzard's HandleChatType, "table cannot be indexed with
--- secret keys", Karrz 2026-10-09). Enter then sends an ordinary whisper packet. Opened a frame later because a typed "/w" runs
--- from the chat box, which the client closes after the handler returns.
-function OpenWhisperBox(name, text, now)
- local function Open()
- if ForeverBotsDB.bgWhisper == "dot" or not (ChatEdit_ChooseBoxForSend and ChatEdit_ActivateChat and ChatEdit_UpdateHeader) then
- if ChatFrame_OpenChat then ChatFrame_OpenChat(".w " .. name .. " " .. (text or "")) end
- return
- end
- local eb = ChatEdit_ChooseBoxForSend()
- eb:SetAttribute("chatType", "WHISPER")
- eb:SetAttribute("tellTarget", name)
- ChatEdit_UpdateHeader(eb)
- ChatEdit_ActivateChat(eb)
- eb:SetText(text or "")
+-- secret keys", playtest 2026-10-09). Enter then sends an ordinary whisper packet. It touches the chat box, so it is called ONLY
+-- straight from a click handler (the portrait menu's "Whisper (Forever Bots)"): never from a timer, an event or a hook on the
+-- client's own functions, where the client blocks it ("ForeverBots has been blocked from an action only available to the
+-- Blizzard UI", reported 2026-10-15). Anything that is not a click whispers with SendChatMessage / an addon whisper instead.
+function OpenWhisperBox(name, text)
+ if not (ChatEdit_ChooseBoxForSend and ChatEdit_ActivateChat and ChatEdit_UpdateHeader) then
+ Print("type /w " .. name .. " to whisper")
+ return
end
- -- now: called from a button click (the player's own action, so the box may be touched at once, also in a battleground)
- if not now and C_Timer and C_Timer.After then C_Timer.After(0.05, Open) else Open() end
+ local eb = ChatEdit_ChooseBoxForSend()
+ eb:SetAttribute("chatType", "WHISPER")
+ eb:SetAttribute("tellTarget", name)
+ ChatEdit_UpdateHeader(eb)
+ ChatEdit_ActivateChat(eb)
+ eb:SetText(text or "")
end
--- Clicking a name in chat, a name's right-click Whisper, the friends / who / LFG lists all end in ChatFrameUtil.SendTellWithMessage,
--- which puts " Name " in the chat box and asks the box to parse it. On 70291 SLASH_WHISPER1 is "/cw", which the
--- client does not turn into a whisper (Karrz 2026-10-09: clicking a name shows "Say: /cw Berolt"), so the box stays in Say mode with
--- the slash text in it. A post-hook (hooksecurefunc: the client's function is not replaced) then puts the box in whisper mode for
--- that name and clears the slash text. It runs synchronously, inside the click that started it: an addon may only touch the chat box
--- from a player action in a battleground (a timer callback there failed with "Interface action failed because of an AddOn" and left
--- "/cw Name" in the box, Karrz 2026-10-09). The client's own /w /whisper /t /tell are untouched.
-local function HookSendTell()
- if not hooksecurefunc then return end
- local function ToWhisper(eb, name, text)
- local who = strtrim((strsplit("-", name)) or "") -- "Name-Realm" -> "Name": a single realm
- if who == "" then return end
- Debug("whisper box: switching to whisper mode for " .. who)
- eb:SetAttribute("chatType", "WHISPER")
- eb:SetAttribute("tellTarget", who)
- if ChatEdit_UpdateHeader then ChatEdit_UpdateHeader(eb) end
- eb:SetText(SafeStr(text) or "")
- end
- -- The client's own Whisper (portrait menu Interact, friends list, ...) can open the box with the dead "/cw Name" text
- -- instead (SLASH_WHISPER1 is "/cw" on this client). Writing that global from here would taint every reader of it, so the
- -- box is looked at after it opens instead: a box showing "/cw Name [text]" is turned into whisper mode for Name, like the
- -- SendTellWithMessage hook above. Synchronous, inside the click that opened it (an addon may only touch the box from a player
- -- action in a battleground).
- local function FixCwBox()
- pcall(function()
- local eb = ChatEdit_GetActiveWindow and ChatEdit_GetActiveWindow()
- if not eb then return end
- local text = SafeStr(eb:GetText())
- if not text then return end
- local name, rest = strmatch(text, "^/[cC][wW]%s+(%S+)%s*(.-)$")
- if name then ToWhisper(eb, name, rest) end
- end)
- end
- if ChatFrameUtil and ChatFrameUtil.SendTellWithMessage then
- hooksecurefunc(ChatFrameUtil, "SendTellWithMessage", function(name, text)
- name = SafeStr(name)
- if not name then return end
- local eb = ChatEdit_GetActiveWindow and ChatEdit_GetActiveWindow()
- if not eb then return end
- local ok, chatType = pcall(function() return eb:GetAttribute("chatType") end)
- if ok and (chatType == "WHISPER" or chatType == "BN_WHISPER") then
- -- the client already switched to whisper mode but typed "/cw Name" into the box as well (Karrz 2026-10-11,
- -- "Tell Name:" with "/cw Name" after it): keep the mode, clear that text
- FixCwBox()
- return
- end
- ToWhisper(eb, name, text)
- end)
- end
- if ChatFrameUtil and ChatFrameUtil.OpenChat then pcall(hooksecurefunc, ChatFrameUtil, "OpenChat", FixCwBox) end
- if ChatFrame_OpenChat then pcall(hooksecurefunc, "ChatFrame_OpenChat", FixCwBox) end
- if ChatEdit_ActivateChat then pcall(hooksecurefunc, "ChatEdit_ActivateChat", FixCwBox) end
- -- and the text itself: the client sets "/cw Name" with SetText after the box is open
- for i = 1, (NUM_CHAT_WINDOWS or 10) do
- local box = _G["ChatFrame" .. i .. "EditBox"]
- if box and box.SetText then pcall(hooksecurefunc, box, "SetText", FixCwBox) end
- end
-end
+-- The client's own Whisper (name click, friends list, portrait Interact menu) opens the box with "/cw Name"; fixing that used
+-- to hook ChatFrameUtil.SendTellWithMessage, ChatFrame_OpenChat, ChatEdit_ActivateChat and the edit boxes' SetText and rewrite
+-- the box from those callbacks. That is chat-box access without a player action and is what the client blocks
+-- (2026-10-15), so the hooks are gone. The portrait menu's "Whisper (Forever Bots)" and typed /w are the supported ways.
local function AddPopupEntry()
if not (Menu and Menu.ModifyMenu) then return end
+ -- /fb menu off (then /reload) leaves the client's unit menus completely untouched: a menu we modified can taint the client's
+ -- own menu actions ("ForeverBots has been blocked from an action only available to the Blizzard UI", reported 2026-10-15).
+ if ForeverBotsDB.menuEntries == false then return end
-- Entries through the client's supported Menu.ModifyMenu only (no UnitPopup tables, no hooks). The client's own portrait
- -- Invite sends nothing for a bot on 70338 (Karrz 2026-10-11: no CMSG_PARTY_INVITE from the menu, typed /invite works), so
+ -- Invite sends nothing for a bot on 70338 (playtest 2026-10-11: no CMSG_PARTY_INVITE from the menu, typed /invite works), so
-- "Whisper (Forever Bots)" is added for every friendly player, "Invite (Forever Bots)" for one outside my group, and the
-- bot-panel entry for a group member (world, party, raid and battleground menus alike).
-- Right-clicking the target frame crashed the client once with entries of ours in MENU_UNIT_PLAYER (Menu.lua:1103,
@@ -1175,7 +1355,7 @@ local function AddPopupEntry()
if who == "" then return end
local grouped = (UnitInParty and UnitInParty(unit)) or (UnitInRaid and UnitInRaid(unit))
root:CreateDivider()
- root:CreateButton("Whisper (Forever Bots)", function() OpenWhisperBox(who, nil, true) end)
+ root:CreateButton("Whisper (Forever Bots)", function() OpenWhisperBox(who) end)
if grouped then
root:CreateButton("WoW Forever Bots", function()
local token = select(2, UnitClass(unit))
@@ -1184,7 +1364,24 @@ local function AddPopupEntry()
UpdateBotPanel()
end)
else
- root:CreateButton("Invite (Forever Bots)", function() InviteByName(who) end)
+ -- The client's own Invite entry sends nothing on this build: point it at the working call instead of
+ -- leaving a dead entry next to ours. Our own entry stays when the native one is not found.
+ local replaced = false
+ if root.EnumerateElementDescriptions then
+ for _, desc in root:EnumerateElementDescriptions() do
+ pcall(function()
+ local text = desc.GetText and desc:GetText()
+ if type(text) == "string" and not IsSecret(text) and (text == PARTY_INVITE or text == INVITE or text == "Invite")
+ and desc.SetResponder then
+ desc:SetResponder(function() InviteByName(who) end)
+ replaced = true
+ end
+ end)
+ end
+ end
+ if not replaced then
+ root:CreateButton("Invite (Forever Bots)", function() InviteByName(who) end)
+ end
end
end)
if not ok then Debug("unit menu entry skipped") end
@@ -1196,7 +1393,7 @@ end
------------------------------------------------------------------------------------------------------------- slash
--- Typed whispers: on this client "/w Name text" and the unit menu's "/cw Name text" do nothing (Karrz 2026-10-08: no packet
+-- Typed whispers: on this client "/w Name text" and the unit menu's "/cw Name text" do nothing (playtest 2026-10-08: no packet
-- reaches the server, no Lua error, also with every addon off), while SendChatMessage(text, "WHISPER", nil, name) works.
-- So /w /t /tell /cw are defined here as a plain SendChatMessage whisper (the client's own /whisper and /r stay native: they work).
-- Restored 2026-10-11: in a raid (Molten Core) typed "/w Cal hi" did nothing while "/whisper Cal hi" worked, and the box filled by
@@ -1210,6 +1407,21 @@ do
return ok and inInstance and (kind == "pvp" or kind == "arena")
end
+ -- Inside a BG the whisper goes out as an addon whisper (FBOTS) that the server hands to the bot. Remembers the last one so
+ -- the Enter-key path below never sends the same line twice.
+ local lastBg = { at = 0 }
+ local function BgWhisper(name, text)
+ if ForeverBotsDB.bgWhisper == "dot" or not prefixOk then return false end
+ local send = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage
+ local ok, res = pcall(send, ORDER_PREFIX, text, "WHISPER", name)
+ if not (ok and (res == nil or res == true or res == 0 or (Enum and Enum.SendAddonMessageResult and res == Enum.SendAddonMessageResult.Success))) then
+ return false
+ end
+ lastBg.name, lastBg.text, lastBg.at = name, text, GetTime()
+ DEFAULT_CHAT_FRAME:AddMessage("|cffff80ffTo " .. name .. ": " .. text .. "|r")
+ return true
+ end
+
local function Whisper(msg)
msg = SafeStr(msg) or ""
-- the unit menu can leave non-breaking / zero-width blanks after the name (the plain-space trim does not see them)
@@ -1222,29 +1434,18 @@ do
end
name = strtrim((strsplit("-", name))) -- "Name-Realm" -> "Name": a single realm
if name == "" then return end
- -- Inside a battleground or arena the client blocks anything an addon sends itself (Karrz 2026-10-08, WSG: "Interface
- -- action failed because of an AddOn", no packet). There the whisper is put in the chat box as the server command
- -- ".w " and sent by the player's own Enter, which the client lets through.
if InPvP() then
-- The client's own /w and /whisper do nothing in a battleground (70338: the box stays in Say mode). The typed line is
-- sent as an addon whisper under the FBOTS prefix, which the server hands to the bot like a whisper (the bot answers
- -- as usual); it needs no second step. If the client refuses it, the box opens in whisper mode with the text in it
- -- and Enter sends it ("/fb bgw dot" falls back to the ".w " command).
- if text and ForeverBotsDB.bgWhisper ~= "dot" and prefixOk then
- local send = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage
- local ok, res = pcall(send, ORDER_PREFIX, text, "WHISPER", name)
- if ok and (res == nil or res == true or res == 0 or (Enum and Enum.SendAddonMessageResult and res == Enum.SendAddonMessageResult.Success)) then
- DEFAULT_CHAT_FRAME:AddMessage("|cffff80ffTo " .. name .. ": " .. text .. "|r")
- if ChatEdit_SetLastToldTarget then pcall(ChatEdit_SetLastToldTarget, name, "WHISPER") end
- return
- end
- end
- OpenWhisperBox(name, text)
- Print("battleground: press Enter to whisper " .. name .. "; if the client blocks it, /fb bgw dot")
+ -- as usual); it needs no second step.
+ if text and BgWhisper(name, text) then return end
+ -- no chat box from a slash handler: the portrait menu's "Whisper (Forever Bots)" opens it from a click
+ Print("battleground: the whisper to " .. name .. " could not be sent" .. (text and "" or " (type /w " .. name .. " )")
+ .. "; right-click " .. name .. " and choose Whisper (Forever Bots)")
return
end
if not text then
- if ChatFrame_OpenChat then ChatFrame_OpenChat("/w " .. name .. " ") else Print("/w whispers a player") end
+ Print("type /w " .. name .. " to whisper")
return
end
-- Sent straight from the slash handler (no timer, no hook on SendChatMessage): the client's own /w never works in 70205.
@@ -1253,9 +1454,37 @@ do
Print("whisper to " .. name .. " failed: " .. tostring(err))
return
end
- if ChatEdit_SetLastToldTarget then pcall(ChatEdit_SetLastToldTarget, name, "WHISPER") end
end
+ -- The client's own Whisper (name click, friends list, portrait Interact > Whisper) leaves "/cw Name " in the chat box. Outside a
+ -- battleground pressing Enter on it reaches the /cw handler above. In a battleground the client's slash parser fails on such a
+ -- line before any handler runs, so the whisper is lost. For that case the edit boxes' OnEnterPressed gets a post-hook that
+ -- only READS the text (kept from OnTextChanged, since the client clears the box when it sends) and, for "/cw Name message"
+ -- typed in a BG, sends the addon whisper during that same key press (a player action). Nothing writes to the box, no ChatEdit_
+ -- function is called, no client function is replaced.
+ local seen = {} -- [editbox] = { text = last non-empty text, at = time }
+ local function HookBox(box)
+ if not (box and box.HookScript) then return end
+ pcall(box.HookScript, box, "OnTextChanged", function(self)
+ local ok, text = pcall(self.GetText, self)
+ text = ok and SafeStr(text) or nil
+ if text and text ~= "" then seen[self] = { text = text, at = GetTime() } end
+ end)
+ pcall(box.HookScript, box, "OnEscapePressed", function(self) seen[self] = nil end)
+ pcall(box.HookScript, box, "OnEnterPressed", function(self)
+ local rec = seen[self]
+ seen[self] = nil
+ if not rec or GetTime() - rec.at > 30 or not InPvP() then return end
+ local name, text = strmatch(rec.text, "^/[cC][wW]%s+(%S+)%s+(.-)%s*$")
+ if not name or text == "" then return end
+ name = strtrim((strsplit("-", name)))
+ if name == "" then return end
+ if lastBg.name == name and lastBg.text == text and GetTime() - lastBg.at < 2 then return end -- the handler already sent it
+ BgWhisper(name, text)
+ end)
+ end
+ for i = 1, (NUM_CHAT_WINDOWS or 10) do HookBox(_G["ChatFrame" .. i .. "EditBox"]) end
+
for i, word in ipairs({ "/w", "/t", "/tell", "/cw", "/whisper" }) do
_G["SLASH_FOREVERBOTSW" .. i .. "1"] = word
SlashCmdList["FOREVERBOTSW" .. i] = Whisper
@@ -1333,6 +1562,49 @@ SlashCmdList.FOREVERBOTS = function(msg)
show("C_ChatInfo.SendChatMessage", function() return type(C_ChatInfo and C_ChatInfo.SendChatMessage) end)
return
end
+ if verb == "frames" then
+ local list = ForeverBotsListIssueFrames and ForeverBotsListIssueFrames() or {}
+ Print("issue reporter frames hidden: " .. (#list > 0 and table.concat(list, ", ") or "none found"))
+ return
+ end
+ if verb == "chattest" then
+ -- Run this in a fight (type it, or bind it to a macro): says what the client does with a group order sent as an addon message
+ -- and as a plain chat line, so the order buttons can use whichever works in combat. The text "fbtest" is no bot order.
+ local channel = (IsInRaid and IsInRaid()) and "RAID" or "PARTY"
+ local function show(label, fn, ...)
+ local ok, v = pcall(fn, ...)
+ if not ok then v = "error: " .. tostring(v) elseif IsSecret(v) then v = "" end
+ Print("chattest " .. label .. " = " .. tostring(v))
+ end
+ Print("chattest: in combat " .. tostring(InCombatLockdown and InCombatLockdown()) .. ", channel " .. channel .. ", prefix registered " .. tostring(prefixOk))
+ if C_ChatInfo then
+ for _, fn in ipairs({ "InChatMessagingLockdown", "IsAddonChatRestricted" }) do
+ if C_ChatInfo[fn] then show("C_ChatInfo." .. fn, C_ChatInfo[fn]) end
+ end
+ end
+ show("SendAddonMessage result", C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage, ORDER_PREFIX, "fbtest", channel)
+ local seen = false
+ local ev = CreateFrame("Frame")
+ ev:RegisterEvent(channel == "RAID" and "CHAT_MSG_RAID" or "CHAT_MSG_PARTY")
+ ev:RegisterEvent(channel == "RAID" and "CHAT_MSG_RAID_LEADER" or "CHAT_MSG_PARTY_LEADER")
+ ev:SetScript("OnEvent", function(_, _, text) if text == "fbtest" then seen = true end end)
+ show("SendChatMessage call", SendChatMessage, "fbtest", channel)
+ if C_Timer and C_Timer.After then
+ C_Timer.After(2, function()
+ ev:UnregisterAllEvents()
+ Print("chattest: the chat line " .. (seen and "WAS" or "was NOT") .. " delivered to " .. channel .. " chat (a blocked call shows no error, only a missing line)")
+ end)
+ end
+ return
+ end
+ if verb == "menu" then
+ if class == "on" then ForeverBotsDB.menuEntries = true
+ elseif class == "off" then ForeverBotsDB.menuEntries = false
+ else ForeverBotsDB.menuEntries = (ForeverBotsDB.menuEntries == false) end
+ Print("Whisper/Invite entries in the portrait right-click menu: " .. (ForeverBotsDB.menuEntries == false and "off" or "on")
+ .. " (takes effect after /reload) (/fb menu on|off)")
+ return
+ end
if verb == "bgw" then
ForeverBotsDB.bgWhisper = (class == "dot") and "dot" or "native"
Print("battleground whisper mode: " .. ForeverBotsDB.bgWhisper .. " (/fb bgw native|dot)")
@@ -1379,6 +1651,8 @@ SlashCmdList.FOREVERBOTS = function(msg)
ServerCommand(".bot delete " .. class)
elseif verb == "list" then
ServerCommand(".bot list")
+ elseif verb == "raidready" or verb == "ready" then
+ RaidReady()
elseif verb == "fallback" then
GroupOrder("fallback")
elseif verb == "rally" then
@@ -1398,7 +1672,26 @@ SlashCmdList.FOREVERBOTS = function(msg)
elseif verb == "" or verb == nil then
Toggle()
else
- Print("/fb opens the window; /fb add [tank|healer|dps]; /fb call|dismiss|save|unsave|regear [name|all]; /fb delete ; /fb list; /fb fallback; /fb pullback; /fb rally; /fb formation circle|arrow|line|none; /fb spacing tight|close|spread; /fb distance <1-20>; /fb maintank [name]; /fb bot on|off; /fb tank |clear; /fb assign [role]|clear|list; /fb debug on|off")
+ Print("/fb opens the window; /fb add [tank|healer|dps]; /fb raidready; /fb call|dismiss|save|unsave|regear [name|all]; /fb delete ; /fb list; /fb fallback; /fb pullback; /fb rally; /fb formation circle|arrow|line|none; /fb spacing tight|close|spread; /fb distance <1-20>; /fb maintank [name]; /fb bot on|off; /fb tank |clear; /fb assign [role]|clear|list; /fb debug on|off")
+ end
+end
+
+-- Tells the server this client runs the add-on (a self-whisper under the order prefix), so it does not send the download hint.
+-- Tried a few times: the first send can be refused while the client is still loading.
+local function SayHello(attempt)
+ attempt = attempt or 1
+ local send = C_ChatInfo and C_ChatInfo.SendAddonMessage or SendAddonMessage
+ local me = UnitName and UnitName("player")
+ local sent = false
+ if prefixOk and send and me then
+ local ok, res = pcall(send, ORDER_PREFIX, "hello", "WHISPER", me)
+ sent = ok and (res == nil or res == true or res == 0 or (Enum and Enum.SendAddonMessageResult and res == Enum.SendAddonMessageResult.Success))
+ end
+ -- The self-whisper alone did not reach the server in a live test (the download hint came to players who have the add-on), so
+ -- the same greeting also goes as a silent server command, once. It says nothing back.
+ if attempt == 1 then pcall(ServerCommand, ".bot addon") end
+ if not sent and attempt < 4 and C_Timer and C_Timer.After then
+ C_Timer.After(4, function() SayHello(attempt + 1) end)
end
end
@@ -1406,8 +1699,8 @@ local loader = CreateFrame("Frame")
loader:RegisterEvent("PLAYER_LOGIN")
loader:SetScript("OnEvent", function()
Print("type /fb for the bot window.")
+ if C_Timer and C_Timer.After then C_Timer.After(2, SayHello) else SayHello() end
AddPopupEntry()
- HookSendTell()
lastGroupSize = GroupSize()
ShowDistance()
if ForeverBotsDB.distance and lastGroupSize > 0 then distFrame.groupAt = Now() + 3 end
@@ -1418,7 +1711,7 @@ loader:SetScript("OnEvent", function()
end)
-- On client 70291 a battleground leaves the chat box broken: every typed slash line (also /fb, /w) then throws
--- ChatFrameEditBox.lua:206 "table cannot be indexed with secret keys" until /reload (Karrz 2026-10-09). Say so on leaving one.
+-- ChatFrameEditBox.lua:206 "table cannot be indexed with secret keys" until /reload (playtest 2026-10-09). Say so on leaving one.
do
local pvpWas = false
local pvpWatch = CreateFrame("Frame")
@@ -1453,3 +1746,60 @@ do
pcall(groupWatch.RegisterEvent, groupWatch, "GROUP_ROSTER_UPDATE")
groupWatch:SetScript("OnEvent", function(_, ev) Report(ev == "PLAYER_ENTERING_WORLD" and "entering world" or "roster update") end)
end
+
+------------------------------------------------------------------------------------------------------ issue reporter
+-- The beta client's "Issue Reporter" bug button (bottom right, also the "F6 to submit an issue" hint) is hidden (playtest 2026-10-12).
+-- The 70338 interface source is not at hand, so the frame is found by name: any global frame whose name contains "IssueReport"
+-- or "BugReport" (and the common names tried directly). Hide() plus a Show hook that hides it again: nothing is reparented or
+-- replaced, the frame is not protected, so there is no taint and it works in combat. Re-applied on PLAYER_ENTERING_WORLD and on
+-- every ADDON_LOADED (the button may belong to a load-on-demand Blizzard addon). "/fb frames" lists what was found.
+do
+ local hooked, found = {}, {}
+ local function HideFrame(name, f)
+ if hooked[f] then return end
+ hooked[f] = true
+ found[#found + 1] = name
+ pcall(f.Hide, f)
+ pcall(hooksecurefunc, f, "Show", function(self) pcall(self.Hide, self) end)
+ end
+ local function Scan()
+ for _, name in ipairs({ "IssueReporterButton", "IssueReporterFrame", "IssueReporter", "BetaIssueReporter", "BugReportButton", "BugReportFrame" }) do
+ local f = _G[name]
+ if type(f) == "table" and f.Hide and f.GetObjectType then HideFrame(name, f) end
+ end
+ for name, f in pairs(_G) do
+ if type(name) == "string" and not hooked[f] and (name:find("IssueReport", 1, true) or name:find("BugReport", 1, true)) then
+ if type(f) == "table" and f.Hide and f.GetObjectType and f.IsProtected then HideFrame(name, f) end
+ end
+ end
+ end
+ local watch = CreateFrame("Frame")
+ watch:RegisterEvent("PLAYER_ENTERING_WORLD")
+ watch:RegisterEvent("ADDON_LOADED")
+ watch:SetScript("OnEvent", function() pcall(Scan) end)
+ pcall(Scan)
+ ForeverBotsListIssueFrames = function() pcall(Scan); return found end
+end
+
+------------------------------------------------------------------------------------------------------ forbidden-action guard
+-- "ForeverBots has been blocked from an action only available to the Blizzard UI" (ADDON_ACTION_FORBIDDEN) names the protected
+-- function but only in the popup. This records that name (ForeverBotsDB.lastForbidden, and one chat line, so a player can report
+-- it) and, when it is not one of our own chat sends, switches the portrait-menu entries off for the next load: the entries are the
+-- only part of the add-on that runs inside the client's own menus, the place such taint comes from (reported 2026-10-15 when
+-- interacting with a bot portrait). /fb menu on re-enables them.
+do
+ local guard = CreateFrame("Frame")
+ guard:RegisterEvent("ADDON_ACTION_FORBIDDEN")
+ guard:SetScript("OnEvent", function(_, _, addon, func)
+ if addon ~= ADDON then return end
+ func = type(func) == "string" and func or "?"
+ ForeverBotsDB.lastForbidden = { func = func, at = date and date("%Y-%m-%d %H:%M:%S") or "" }
+ if func:find("SendChatMessage", 1, true) or func:find("SendAddonMessage", 1, true) then
+ Print("the client blocked " .. func .. "() (not allowed in this situation)")
+ return
+ end
+ Print("the client blocked " .. func .. "() because of ForeverBots; the portrait menu entries are switched off after /reload (/fb menu on to bring them back). Please report this line.")
+ ForeverBotsDB.menuEntries = false
+ end)
+end
+
diff --git a/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.toc b/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.toc
index 449e0e8f7c..8d03b6664f 100644
--- a/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.toc
+++ b/src/modules/PlayerbotV2/Addon/ForeverBots/ForeverBots.toc
@@ -2,7 +2,7 @@
## Title: WoW Forever Bots
## Notes: One-click PlayerbotV2 companions: add a bot of any class and role, call, dismiss and command your bots.
## Author: Karrz
-## Version: 0.2.0
+## Version: 0.2.3
## SavedVariables: ForeverBotsDB
ForeverBots.lua
diff --git a/src/modules/PlayerbotV2/Addon/ForeverBots/README.md b/src/modules/PlayerbotV2/Addon/ForeverBots/README.md
index b4e42cc6cc..8ec961aae2 100644
--- a/src/modules/PlayerbotV2/Addon/ForeverBots/README.md
+++ b/src/modules/PlayerbotV2/Addon/ForeverBots/README.md
@@ -6,6 +6,10 @@ does not depend on the addon-message protocol PlayerbotControl uses.
Install: copy this folder to `\_classic_beta_\Interface\AddOns\ForeverBots` (the folder name must stay
`ForeverBots`). If the character screen's AddOns list marks it out of date, tick "Load out of date AddOns".
+In game: `/fb` opens the window. The Raid ready button (or `/fb raidready`) calls your saved bots (`.bot summon saved`), makes the group a raid if needed, sets formation and spacing, and starts a ready check once the bots have buffed.
+
+On login the add-on greets the server once (a self-whisper under the `FBOTS` prefix). A player whose client does not greet within 30 seconds gets one chat line with the download link (`Playerbot.AddonHint.*` in the module config).
+
In game: `/fb` opens the window. The window is grouped under headings: Orders to the group (move and fight, wipe and
regroup, formation and spacing, tanks and markers), Assign a bot to an icon, Your bots. Hover any button for what it does.
- "Add bots >" at the top opens a separate drop-down beside the window: "Select gear" (Match my gear, Best for their level,
@@ -94,3 +98,6 @@ The window stays where you put it and stays open (it is not closed by Escape, cl
`/fb fallback`, `/fb pullback`, `/fb rally`, `/fb formation circle|arrow|line|none`, `/fb spacing tight|close|spread`, `/fb distance <1-20>` and `/fb maintank [name]` and `/fb tank |clear` work without the window.
The `.bot` commands need a GM account (gm level 3 on the realm).
+
+Key bindings (0.2.2): Esc > Options > Key Bindings > AddOns > "WoW Forever Bots". Unbound by default; one entry each for Attack, Pull, Pull back, Follow, Stay, Resume, Stop attacking, Flee, Come, Fall back, Toggle stance and Show / hide the bot window. The order keys send the same line as the window buttons and work in combat.
+Attack (mouseover) key: hover a mob and press it; the mob becomes your target and the bots attack it. Group pings (the ping wheel, if your client has one): an Attack ping on an enemy sends the bots in, an On my way ping on the ground sends them there. Needs a server with the ping hooks.
diff --git a/src/modules/PlayerbotV2/Api/ClassicSupplies.cpp b/src/modules/PlayerbotV2/Api/ClassicSupplies.cpp
index 1c3392f94f..8909027c22 100644
--- a/src/modules/PlayerbotV2/Api/ClassicSupplies.cpp
+++ b/src/modules/PlayerbotV2/Api/ClassicSupplies.cpp
@@ -3,6 +3,8 @@
#include "ItemTemplate.h"
#include "ObjectMgr.h"
#include "SharedDefines.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include
#include
@@ -83,7 +85,7 @@ constexpr SupplyFamily kFamilies[] = {
{ "Rebirth Reagent", CLASS_DRUID, 5, kRebirthReagent },
{ "Soul Shard", CLASS_WARLOCK, 5, kSoulShard },
// Open-world bots keep a small stock; raid-level (55+) bots carry what a
- // raid night needs (Karrz: full potion stacks, 20 food, 40 drinks).
+ // raid night needs (the owner: full potion stacks, 20 food, 40 drinks).
{ "Food", 0, 5, kFood, kConsumable, 20 },
{ "Water", 0, 10, kWater, kConsumable | SUPPLY_MANA_USERS, 40 },
{ "Healing Potion", 0, 2, kHealingPotion, kConsumable, 5 },
@@ -99,18 +101,23 @@ constexpr SupplyFamily kFamilies[] = {
// Nightfin Soup 13931, Tender Wolf Steak 18045.
constexpr RaidConsumable kTankKit[] = {
{ 13510, false, 2, true }, { 13445, false, 2 }, { 3825, false, 2 }, { 18045, true, 5 },
+ { 13457, false, 2, false, true }, // Greater Fire Protection Potion: drunk in the fight where the boss data orders it (Ragnaros)
};
constexpr RaidConsumable kMeleeKit[] = {
{ 13452, false, 2 }, { 9206, false, 2 }, { 20452, true, 5 },
+ { 13457, false, 1, false, true }, // Greater Fire Protection Potion: drunk in the fight where the boss data orders it (Ragnaros' Might hits 20 y round a random mana user)
};
constexpr RaidConsumable kCasterKit[] = {
{ 13512, false, 2, true }, { 13454, false, 2 }, { 18254, true, 5 },
+ { 13457, false, 1, false, true }, // Greater Fire Protection Potion: drunk in the fight where the boss data orders it (Ragnaros' Might hits 20 y round a random mana user)
};
constexpr RaidConsumable kHealerKit[] = {
{ 13511, false, 2, true }, { 20007, false, 2 }, { 13931, true, 5 },
+ { 13457, false, 1, false, true }, // Greater Fire Protection Potion: drunk in the fight where the boss data orders it (Ragnaros' Might hits 20 y round a random mana user)
};
constexpr RaidConsumable kHunterKit[] = {
{ 13452, false, 2 }, { 9206, false, 2 }, { 13928, true, 5 },
+ { 13457, false, 1, false, true }, // Greater Fire Protection Potion: drunk in the fight where the boss data orders it (Ragnaros' Might hits 20 y round a random mana user)
};
} // namespace
@@ -144,6 +151,32 @@ bool IsRaidConsumable(uint32 item)
return RaidConsumableStock(item) != 0;
}
+std::span GroupBuffSpells(uint8 cls)
+{
+ // 21562 / 21564 Prayer of Fortitude r1 / r2, 27683 Prayer of Shadow Protection, 23028 Arcane Brilliance, 21849 / 21850 Gift of the Wild r1 / r2.
+ static constexpr uint32 kPriest[] = { 21562, 21564, 27683 };
+ static constexpr uint32 kMage[] = { 23028 };
+ static constexpr uint32 kDruid[] = { 21849, 21850 };
+ switch (cls)
+ {
+ case CLASS_PRIEST: return kPriest;
+ case CLASS_MAGE: return kMage;
+ case CLASS_DRUID: return kDruid;
+ default: return {};
+ }
+}
+
+bool LearnableGroupBuff(uint32 spell, uint8 level)
+{
+ SpellInfo const* si = sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE);
+ if (!si || si->SpellLevel > level)
+ return false;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ if (e.IsEffect() && e.IsAura())
+ return true;
+ return false;
+}
+
std::span GetSupplyFamilies()
{
return kFamilies;
diff --git a/src/modules/PlayerbotV2/Api/ClassicSupplies.h b/src/modules/PlayerbotV2/Api/ClassicSupplies.h
index 024af3f882..0bfc5925b0 100644
--- a/src/modules/PlayerbotV2/Api/ClassicSupplies.h
+++ b/src/modules/PlayerbotV2/Api/ClassicSupplies.h
@@ -67,6 +67,15 @@ TC_GAME_API SupplyFamily const* FindSupplyFamily(std::string_view name);
// Highest rank of `family` usable at `level` that the server knows; 0 when none.
TC_GAME_API uint32 BestSupplyRank(SupplyFamily const& family, uint8 level);
+// ---- Group buff spells ----
+// The party versions of the class buffs (Prayer of Fortitude, Prayer of Shadow Protection, Arcane Brilliance, Gift of the Wild) and
+// their higher ranks: a vanilla player trains them at 48-60, but the Forever trainers do not list them (MC mc_garr 2026-10-12: "spell
+// not known" for every one of them on level 60 bots), so the supplies restock teaches the ones the bot's level allows.
+TC_GAME_API std::span GroupBuffSpells(uint8 cls);
+// Whether `spell` exists in the spell data, is within a bot of `level`, and has an aura effect (Gift of the Wild has none in Forever's data:
+// learning it would give a bot a buff that buffs nobody).
+TC_GAME_API bool LearnableGroupBuff(uint32 spell, uint8 level);
+
// ---- Ammo for the equipped bow / crossbow / gun (Playerbot.Behavior.AmmoSupply) ----
// Kinds match the snapshot's ammo_kind: 1 = arrows (bow, crossbow), 2 = bullets (gun).
// The restock tops the bags up to AMMO_TARGET (several stacks) once the stock is under
@@ -90,6 +99,7 @@ struct RaidConsumable
bool food; // buff is "Well Fed" (the eating spell triggers it) rather than the item's own spell
uint8 stock; // how many a bot is kept stocked with
bool flask = false; // a flask: it fills both elixir slots, so an elixir used on top of it removes it (MC Garr 2026-10-11: Mageblood took the +2000 mana of a Flask of Distilled Wisdom off five healers)
+ bool combat = false; // drunk in the fight when the encounter data orders it (RaidRules::resistPotion), never in the pre-pull; only stocked
};
TC_GAME_API std::span RaidConsumablesFor(RaidConsumableRole role);
@@ -104,7 +114,7 @@ TC_GAME_API uint8 RaidConsumableStock(uint32 item);
template
bool ElixirOverFlask(RaidConsumableRole role, RaidConsumable const& c, Buffed buffed)
{
- if (c.food || c.flask)
+ if (c.food || c.flask || c.combat)
return false;
for (RaidConsumable const& k : RaidConsumablesFor(role))
if (k.flask && buffed(k))
@@ -119,7 +129,7 @@ template
RaidConsumable const* NextRaidConsumable(RaidConsumableRole role, InBags in_bags, Buffed buffed)
{
for (RaidConsumable const& c : RaidConsumablesFor(role))
- if (!buffed(c) && in_bags(c.item) && !ElixirOverFlask(role, c, buffed))
+ if (!c.combat && !buffed(c) && in_bags(c.item) && !ElixirOverFlask(role, c, buffed))
return &c;
return nullptr;
}
diff --git a/src/modules/PlayerbotV2/Api/DiagProbes.h b/src/modules/PlayerbotV2/Api/DiagProbes.h
index 7b712fb6f3..5ae1a6d7e2 100644
--- a/src/modules/PlayerbotV2/Api/DiagProbes.h
+++ b/src/modules/PlayerbotV2/Api/DiagProbes.h
@@ -38,7 +38,7 @@ namespace Playerbot::Probes
if (now >= nextRead.load(std::memory_order_relaxed))
{
nextRead.store(now + 5, std::memory_order_relaxed);
- enabled.store(sConfigMgr->GetBoolDefault("Playerbot.Diag.Probes", false), std::memory_order_relaxed);
+ enabled.store(sConfigMgr->GetBoolDefault("Playerbot.Diag.Probes", false, true), std::memory_order_relaxed);
}
return enabled.load(std::memory_order_relaxed);
}
diff --git a/src/modules/PlayerbotV2/Api/PlayerbotAPI.cpp b/src/modules/PlayerbotV2/Api/PlayerbotAPI.cpp
index 757f659800..0cdf6c6f0c 100644
--- a/src/modules/PlayerbotV2/Api/PlayerbotAPI.cpp
+++ b/src/modules/PlayerbotV2/Api/PlayerbotAPI.cpp
@@ -2,12 +2,14 @@
// First real-bodies pass: cast_spell / move_to / hearth wired to TrinityCore.
// Remaining commands listed in v2/API.md fill in incrementally.
+#include
#include
#include "PlayerbotAPI.h"
#include "ClassicBotSkills.h"
#include "ClassicSpec.h"
#include "ClassicTalentBuilds.h"
#include "ClassicSupplies.h"
+#include "Bot/ClassicUpkeep.h"
#include "BotItemScorer.h"
#include "Player.h"
#include "Corpse.h"
@@ -40,6 +42,7 @@
#include "DetourNavMeshQuery.h"
#include "PlayerbotV2.h" // path-outcome telemetry, bot-leader battleground queue
#include "PlayerbotMovement.h" // unified bot-movement helpers
+#include "Fleet/InstanceEntry.h" // PrepareInstanceEntry: a stale raid lock must not keep a companion out of its owner's instance
#include "PartialRouteStall.h"
#include "NoMotionGuard.h"
#include "TradeFlow.h"
@@ -452,7 +455,7 @@ static uint32 HighestKnownRank(Player const* p, uint32 spell_id)
// Off = the previous path: SetFacingToObject whenever the target is not in front.
static bool CastFacingEnabled()
{
- static bool const enabled = sConfigMgr->GetBoolDefault("Playerbot.Behavior.CastFacing", true);
+ static bool const enabled = sConfigMgr->GetBoolDefault("Playerbot.Behavior.CastFacing", true, true);
return enabled;
}
@@ -545,7 +548,7 @@ Result API::cast_spell(uint32 spell_id, ObjectGuid target, bool exact_rank)
uint32 const requested_id = spell_id;
if (!exact_rank || !p_->HasSpell(spell_id))
spell_id = HighestKnownRank(p_, spell_id);
- // [cast_rank] (Karrz, 2026-10-08: confirm every damage spell goes out at the top known rank): per bot and requested spell, at most one
+ // [cast_rank] (playtest, 2026-10-08: confirm every damage spell goes out at the top known rank): per bot and requested spell, at most one
// line a minute, "requested -> cast".
{
static std::unordered_map s_rank_log;
@@ -759,13 +762,13 @@ Result API::cast_spell(uint32 spell_id, ObjectGuid target, bool exact_rank)
if (!FaceUnitForCast(p_, tu) && CastFacingEnabled())
return last_cast_fail_ = 0, Result::Locked;
// Spells that do not need the target in front (heals, buffs) still turn the caster to a target that is behind it when it
- // can (Karrz, Deadmines 2026-10-10: the priest healed with her back to the target). Best effort: a caster that is moving
+ // can (playtest, Deadmines 2026-10-10: the priest healed with her back to the target). Best effort: a caster that is moving
// keeps its heading and the cast goes out anyway.
if (tu != p_ && CastFacingEnabled() && !(info->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT))
FaceUnitForCast(p_, tu);
// A bot that drank or sat and now casts stands up first, as a client does when its player casts (the drink aura ends on the
- // cast, the sitting pose did not: Karrz saw the priest heal kneeling). Food / drink spells themselves sit the bot, so they are
+ // cast, the sitting pose did not: the owner saw the priest heal kneeling). Food / drink spells themselves sit the bot, so they are
// left alone. [stand_state] logs each change, at most one line per bot per 5 s.
if (p_->GetStandState() == UNIT_STAND_STATE_SIT || p_->GetStandState() == UNIT_STAND_STATE_KNEEL)
if (!info->HasAura(SPELL_AURA_MOD_POWER_REGEN) && !info->HasAura(SPELL_AURA_MOD_REGEN))
@@ -805,7 +808,7 @@ Result API::cast_spell(uint32 spell_id, ObjectGuid target, bool exact_rank)
// Throttled diagnostic: log the first failure per (spell, reason) combo
// so the operator can see WHY a rule is firing but the cast never lands
// (out of range, LOS, moving, etc). Without this the bot looks "stuck"
- // in inspect: LastRule says e.g. "Frostbolt (filler)" because the AI
+ // in inspect: LastRule says e.g. "Frostbolt (filler)" because the bot logic
// picked it, but Casting=0 because the world thread rejected it.
// For BAD_TARGETS we additionally dump the relationship breakdown so
// we can tell apart visibility failures, faction friendliness, At-War
@@ -1070,7 +1073,7 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop)
// Active FlightPath guard. Bot is on a taxi spline (FLIGHT_MOTION_TYPE)
// â issuing MovePoint while in flight queues under, not over, the
// flight generator and the bot looks "stuck" until landing. Refuse so
- // the AI re-evaluates next snapshot when the taxi arrives.
+ // the bot logic re-evaluates next snapshot when the taxi arrives.
if (p_->GetMotionMaster()->GetCurrentMovementGeneratorType() ==
FLIGHT_MOTION_TYPE)
return Result::Locked;
@@ -1117,7 +1120,7 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop)
return Result::Locked;
// A free fall: the jump spline's parabola (height = g*T^2/8, MotionMaster::MoveJump) is exactly gravity over the drop
// when T = sqrt(2*fall/g), so the leap takes that long. A fixed 8 y/s along the whole path took 3 s for a 15 y drop and
- // looked like a slow fall (Karrz, WSG 2026-10-09). The walk off the edge is allowed 16 y/s at most.
+ // looked like a slow fall (playtest, WSG 2026-10-09). The walk off the edge is allowed 16 y/s at most.
float const dist3 = std::sqrt(dxy * dxy + fall * fall);
float const fall_s = std::max(std::sqrt(2.0f * fall / float(Movement::gravity)), dxy / 16.0f);
float const speed = dist3 / fall_s;
@@ -1170,7 +1173,7 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop)
// Battleground start room (STATUS_WAIT_JOIN): the gates are shut and the bots only mill about their start area, so a
// destination whose ground is far above or below the bot is off the platform (a gate-wait spot spread over the edge of
// the plateau, a slope under a cliff). Routing there ends in a straight-line spline over empty air or in the platform
- // step-down relocation below, which is how bots ended up hanging in the air above the AB valley (Karrz, 2026-10-08).
+ // step-down relocation below, which is how bots ended up hanging in the air above the AB valley (playtest, 2026-10-08).
// Refuse it; the idle rule picks another spot.
if (Battleground const* prep_bg = p_->GetBattleground();
prep_bg && prep_bg->GetStatus() == STATUS_WAIT_JOIN &&
@@ -1615,7 +1618,10 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop)
}
// 3D distance, NOT horizontal-only: a harbour dock / pier exit can sit
// almost directly ABOVE the bot (small XY, large Z).
- if (navpt && exd2 > 3.0f * 3.0f)
+ // One yard, not three: a bot in lava two or three yards off the bank is exactly the one that must step out. Ragnaros 2026-10-13
+ // 650994ea: a healer stood 85 s in the magma at the platform's edge, 2.8 y from the dry point its raid order named, hurt every
+ // second and healed back by the others, and did not move once.
+ if (navpt && exd2 > 1.0f * 1.0f)
{
p_->GetMotionMaster()->MovePoint(
0, exit_pt.GetPositionX(), exit_pt.GetPositionY(),
@@ -2634,7 +2640,7 @@ Result API::start_attack(ObjectGuid target, uint8 avoid_school_mask)
}
// A mounted player cannot attack (Unit::Attack returns false), so a bot riding past an enemy emitted start_attack every
- // tick and nothing happened: bots ran past each other mounted in WSG (Karrz, 2026-10-08). Like a real player who clicks
+ // tick and nothing happened: bots ran past each other mounted in WSG (playtest, 2026-10-08). Like a real player who clicks
// an enemy, the bot gets off its mount first.
if (p_->IsMounted() && tu->IsHostileTo(p_))
p_->Dismount();
@@ -2686,7 +2692,7 @@ Result API::start_attack(ObjectGuid target, uint8 avoid_school_mask)
// do not re-call Attack or re-init MoveChase. Both have visible side
// effects every tick â MoveChase resets the chase generator, clearing
// the spline and forcing a path recalc. Calling it every tick (which
- // the AI does as long as the engage rule keeps firing on the same
+ // the bot logic does as long as the engage rule keeps firing on the same
// victim) produces the visible "stutter": bot stops, plans, takes one
// step, stops again. Detect the no-op case and return Ok.
// Mirror what a player click does: keep the selection in sync with the
@@ -2709,7 +2715,7 @@ Result API::start_attack(ObjectGuid target, uint8 avoid_school_mask)
// do not re-call Attack or re-init MoveChase. Both have visible side
// effects every tick â MoveChase resets the chase generator, clearing
// the spline and forcing a path recalc. Calling it every tick (which
- // the AI does as long as the engage rule keeps firing on the same
+ // the bot logic does as long as the engage rule keeps firing on the same
// victim) produces the visible "stutter": bot stops, plans, takes one
// step, stops again. Detect the no-op case and return Ok.
// Ranged-spec hunters with a usable ranged weapon engage RANGED-only:
@@ -2769,7 +2775,7 @@ Result API::start_attack(ObjectGuid target, uint8 avoid_school_mask)
holdAvoidedAutoRepeat(tu);
ensureAutoShot(tu);
- // Real Players chase the target via client input; an AI-driven bot Player
+ // Real Players chase the target via client input; an bot logic-driven bot Player
// has no client and Player::Attack alone doesn't move them. Without an
// explicit MoveChase the bot just stands at whatever range the engage
// rule spotted them â typically 30â40y â which breaks both melee
@@ -2994,7 +3000,7 @@ Result API::mount(uint32 mount_id)
for (uint32 carry_aura : { 23333u, 23335u, 34976u, 121164u, 121175u, 121176u, 121177u })
if (p_->HasAura(carry_aura)) return Result::Locked;
// One rule for battlegrounds (Battleground::GetMountRefusal): closed start doors or an indoor area, no distance radius. Players
- // are held to the same rule in Spell.cpp. One line per bot every 20 s says why a mount is refused (Karrz, WSG 70291).
+ // are held to the same rule in Spell.cpp. One line per bot every 20 s says why a mount is refused (playtest, WSG 70291).
if (Battleground const* bg = p_->GetBattleground())
if (char const* why = bg->GetMountRefusal(p_))
{
@@ -3753,6 +3759,8 @@ Result API::enter_area_trigger(uint32 area_trigger_id)
WorldSession* sess = p_->GetSession();
if (!sess) return Result::Other;
AreaTriggerTeleport const* dest = sObjectMgr->GetAreaTrigger(area_trigger_id);
+ if (dest && dest->Loc.GetMapId() != p_->GetMapId())
+ V2::Fleet::PrepareInstanceEntry(p_, dest->Loc.GetMapId());
WorldPackets::AreaTrigger::AreaTrigger packet{ WorldPacket(CMSG_AREA_TRIGGER) };
packet.AreaTriggerID = int32(area_trigger_id);
packet.Entered = true;
@@ -3823,6 +3831,10 @@ Result API::teleport_to(uint32 map_id, float x, float y, float z, float orientat
if (!p_->IsAlive()) return Result::Locked;
if (p_->IsInCombat()) return Result::Locked;
if (p_->IsNonMeleeSpellCast(false, false, true)) return Result::Locked;
+ // Into an instance (the owner's raid): the door checks run first so a refusal is logged with its reason, and a lock on
+ // another instance is dropped for a companion that follows its owner in.
+ if (map_id != p_->GetMapId() && V2::Fleet::PrepareInstanceEntry(p_, map_id) != TRANSFER_ABORT_NONE)
+ return Result::ServerRefused;
// SafeTeleport probes the destination map (if loaded) for ground
// height and snaps to ground+2 when the requested Z is >50y above
// the queried floor (typical "stale POI / hand-curated coord" bug
@@ -3947,7 +3959,7 @@ Result API::decline_trade()
return Result::Ok;
}
-// `owner` is the trade partner the AI decided to trade with. gift_ok: the bot's owner or a real player in its own group or raid (Bot/TradeRule.h), who may
+// `owner` is the trade partner the bot logic decided to trade with. gift_ok: the bot's owner or a real player in its own group or raid (Bot/TradeRule.h), who may
// hand over gear and gold as a gift; anyone else gets the fair-price bargain (BotTrade.h).
Result API::accept_owner_trade(ObjectGuid owner)
{
@@ -4308,7 +4320,7 @@ Result API::set_raid_difficulty(uint32 difficulty_id, bool legacy)
return Result::Ok;
}
-// A creature the bot mind-controls (priest Mind Control: Razuvious' understudies). It has no pet bar AI and is not
+// A creature the bot mind-controls (priest Mind Control: Razuvious' understudies). It has no pet bar bot logic and is not
// moved by a client, so attack and chase are driven from here. nullptr when the bot controls nothing.
static Creature* PossessedCreature(Player* p)
{
@@ -4438,7 +4450,7 @@ Result API::dismiss_pet()
// (PET_SAVE_NOT_IN_SLOT, kept around for re-summon by spell). The gossip /
// stablemaster flow validates an interact range with the stable NPC. The
// bot path here intentionally bypasses the NPC range check â when running
-// autonomously we want the AI to swap pets based on encounter (e.g. swap
+// autonomously we want the bot logic to swap pets based on encounter (e.g. swap
// to a stabled tank pet for a tough pull) without first dragging the bot
// to a stablemaster. All other invariants (HUNTER_PET-only, exotic-tame
// gating, dead-active refusal, current-pet-not-deletable) match Player::
@@ -5085,7 +5097,7 @@ Result API::repair_all(ObjectGuid npc, bool from_guild_bank)
// durability breaks mid-run (every death strips 10%) degrades into paper
// (0% durability ~ halved armor/stats) and death-spirals (observed
// 2026-06-28: Deadmines tank 38 deaths, durability 16264->12976 HP, never
- // reached the boss). Bots are AI and the player-money branch below already
+ // reached the boss). Bots are bot logic and the player-money branch below already
// grants the shortfall as a stipend, so a self-repair is effectively free â
// exactly the intended "gold self-repair on dungeon staging/running".
if (!npc.IsEmpty())
@@ -5143,7 +5155,7 @@ Result API::repair_all(ObjectGuid npc, bool from_guild_bank)
// repair, so the affordable-partial loop below leaves its costliest slots at
// 0% forever â the poverty death-spiral (broken gear -> can't fight -> can't
// earn -> still can't repair). Grant the shortfall so a broke bot can always
- // fully repair (bots are AI; a free repair is fine and far cheaper than the
+ // fully repair (bots are bot logic; a free repair is fine and far cheaper than the
// leveling time lost to a bot stranded at 0% gear). Solvent bots are
// unaffected â they already cover the bill, so no money is added.
{
@@ -5197,10 +5209,10 @@ static Result UseItemImpl(Player* p, Item* item, ObjectGuid target)
// Spellclick NPCs: when the quest target is a UNIT_NPC_FLAG_SPELLCLICK
// creature, "using the item on it" is, on a real client, a CMSG_SPELL_CLICK â
// Unit::HandleSpellClick both casts the click spell AND fires the creature's
- // OnSpellClick AI. That AI is what credits this whole class of quests
+ // OnSpellClick bot logic. That bot logic is what credits this whole class of quests
// (e.g. Q26118: spellclick Ambassador Slaghammer 42146 -> SmartAI
// SMART_EVENT_ON_SPELLCLICK -> SMART_ACTION_COMPLETE_QUEST). A raw
- // CastItemUseSpell never triggers the AI, so the quest never completes.
+ // CastItemUseSpell never triggers the bot logic, so the quest never completes.
if (tu->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
{
p->SetTarget(tu->GetGUID());
@@ -5273,7 +5285,7 @@ Result API::loot_corpse(ObjectGuid corpse)
{
p_->SendLoot(*loot, false);
// SendLoot opens the loot window (LootGUID, UNIT_FLAG_LOOTING = the kneeling loot pose) and a bot has no client to close
- // it: every bot in a group with party loot rules stayed in the loot pose through every fight and cast (Karrz, Deadmines
+ // it: every bot in a group with party loot rules stayed in the loot pose through every fight and cast (playtest, Deadmines
// 2026-10-10: "they're always looting"). Close it as a player closing the window does - the rolls the open started stay.
if (WorldSession* sess = p_->GetSession())
sess->DoLootRelease(loot);
@@ -5711,7 +5723,7 @@ Result API::use_game_object(ObjectGuid go_guid)
if (!obj)
{
// Not silent for the classic AB banners (entries 180058-180091): a bot standing at a pole that cannot click it was the
- // "bots stand at the Stables, nothing is captured" report (Karrz, AB test 2026-10-08).
+ // "bots stand at the Stables, nothing is captured" report (playtest, AB test 2026-10-08).
if (p_->InBattleground())
if (Map* bmap = p_->GetMap())
if (GameObject* raw = bmap->GetGameObject(go_guid))
@@ -5734,7 +5746,7 @@ Result API::use_game_object(ObjectGuid go_guid)
return Result::Locked;
// A battleground flag or banner is not used in a shapeshift form (a bear-form druid stood at the Lumber Mill banner doing nothing,
- // Karrz AB 2026-10-11): leave the form first, the next click (the rule re-emits) goes through as a caster.
+ // the owner AB 2026-10-11): leave the form first, the next click (the rule re-emits) goes through as a caster.
if (p_->InBattleground() && p_->GetShapeshiftForm() != FORM_NONE &&
(obj->GetGoType() == GAMEOBJECT_TYPE_BUTTON || obj->GetGoType() == GAMEOBJECT_TYPE_GOOBER || obj->GetGoType() == GAMEOBJECT_TYPE_FLAGSTAND ||
obj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP || obj->GetGoType() == GAMEOBJECT_TYPE_NEW_FLAG || obj->GetGoType() == GAMEOBJECT_TYPE_NEW_FLAG_DROP ||
@@ -5747,7 +5759,7 @@ Result API::use_game_object(ObjectGuid go_guid)
// Battleground node banners (AB / AV / Gilneas style BUTTON and GOOBER objects) are not instant for a player: the capture is
// a channel of several seconds that movement or damage breaks. Calling Use() straight away let a whole squad flip the
- // Blacksmith and Lumber Mill Alliance/Horde/Alliance/Horde every second (Karrz, AB test 2026-10-08). The bot now "channels"
+ // Blacksmith and Lumber Mill Alliance/Horde/Alliance/Horde every second (playtest, AB test 2026-10-08). The bot now "channels"
// too: the first call starts the capture, a later call (the rule re-emits every ~3 s) completes it once 5 s have passed and
// the bot has neither moved more than 3 y nor lost health; after a completed capture it must wait 15 s before the next one.
if (p_->InBattleground() &&
@@ -5758,7 +5770,7 @@ Result API::use_game_object(ObjectGuid go_guid)
BannerCapture& cap = s_bannerCapture[p_->GetGUID()];
uint32 const nowMs = GameTime::GetGameTimeMS();
// A cast already running (the capture spell the object's Use() starts) must never be restarted by a second click: a
- // new Use() while the bar is filling cancels it (Karrz, AB test: "she keeps casting and it stops").
+ // new Use() while the bar is filling cancels it (playtest, AB test: "she keeps casting and it stops").
if (p_->IsNonMeleeSpellCast(false))
return Result::Locked;
if (cap.lastDoneMs && nowMs - cap.lastDoneMs < 15000u)
@@ -5795,7 +5807,7 @@ Result API::use_game_object(ObjectGuid go_guid)
// Auto-loot for lootable GO types (CHEST, GOOBER with loot, etc.).
// GameObject::Use opens the loot window server-side (m_loot is
// populated, GO state transitions to ACTIVATED) but for headless
- // bots â and for self-AI bots without auto-loot enabled â there's
+ // bots â and for self-bot logic bots without auto-loot enabled â there's
// no client to send CMSG_LOOT_ITEM. The chest stays open with the
// items inside untaken, the quest objective never progresses, and
// the bot moves on or hearths after stuck-detection.
@@ -6194,7 +6206,7 @@ Result API::complete_quest(ObjectGuid quest_giver, uint32 quest_id, uint32 rewar
// Same-NPC follow-up auto-accept. Scripted escort NPCs (Tarindrella for
// quest chain 28725â28726â28727â28728 in Shadowthread Cave) often despawn
// a few seconds after a turn-in via their SmartAI OOC timer. The
- // post-RewardQuest world tick gives the AI ~1 snapshot to re-probe
+ // post-RewardQuest world tick gives the bot logic ~1 snapshot to re-probe
// CanTakeQuest and emit accept_quest before the giver vanishes â that
// window can close before the bot's accept intent dispatches, producing
// the "giver_not_found" / "giver_lost_relation" reject pair observed for
@@ -6782,14 +6794,29 @@ std::vector ParseCuratedBuild(std::string const& text)
// Empty string means no curated row found.
std::string LookupCuratedBuildRow(uint32 classId, uint32 specId, uint8 context)
{
+ // The curated table only changes by hand and a build is looked up for every
+ // bot setup and respec, so each (class, spec, context) is read from the DB
+ // once per process (misses cached too) instead of once per bot.
+ static std::mutex cacheMutex;
+ static std::unordered_map cache;
auto try_row = [&](uint8 ctx) -> std::string
{
+ uint32 const key = (classId << 16) | ((specId & 0xFFu) << 8) | ctx;
+ {
+ std::lock_guard lock(cacheMutex);
+ if (auto it = cache.find(key); it != cache.end())
+ return it->second;
+ }
+ std::string row;
auto r = CharacterDatabase.PQuery(
"SELECT entries_json FROM playerbot_v2_talent_build "
"WHERE class_id={} AND spec_id={} AND context={}",
classId, specId, ctx);
- if (!r) return {};
- return r->Fetch()[0].GetString();
+ if (r)
+ row = r->Fetch()[0].GetString();
+ std::lock_guard lock(cacheMutex);
+ cache.emplace(key, row);
+ return row;
};
if (auto s = try_row(context); !s.empty()) return s;
if (context != 0)
@@ -7171,11 +7198,39 @@ Result API::restock_class_supplies()
uint32 added = 0;
bool full = false;
uint8 const level = uint8(p_->GetLevel());
+ // The party versions of the class buffs, which no Forever trainer sells.
+ for (uint32 const spell : Classic::GroupBuffSpells(p_->GetClass()))
+ {
+ if (p_->HasSpell(spell))
+ continue;
+ if (!Classic::LearnableGroupBuff(spell, level))
+ continue;
+ SpellInfo const* si = sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE);
+ p_->LearnSpell(spell, false);
+ ++added;
+ TC_LOG_INFO("playerbot.v2", "[supplies] {} learns {} ({})", p_->GetName(), spell, si->SpellName ? (*si->SpellName)[sWorld->GetDefaultDbcLocale()] : "");
+ }
+ // Why a family left nothing in the bags, once per bot and reason ([supplies]; the Demonic Rune never reached the bags of the
+ // Ragnaros squad and nothing said why). World thread only, like the rest of this function.
+ static std::unordered_set s_supplyReasonLogged;
+ auto const skipped = [&](Classic::SupplyFamily const& f, uint32 item, char const* why, uint32 detail)
+ {
+ uint64 const key = std::hash{}(f.name) ^ (uint64(p_->GetGUID().GetCounter()) * 0x9E3779B97F4A7C15ull) ^ (uint64(detail) * 0xC2B2AE3D27D4EB4Full);
+ if (s_supplyReasonLogged.size() > 8192)
+ s_supplyReasonLogged.clear();
+ if (s_supplyReasonLogged.insert(key).second)
+ TC_LOG_INFO("playerbot.v2", "[supplies] {} gets no {} (item {}): {} ({})", p_->GetName(), f.name, item, why, detail);
+ };
for (Classic::SupplyFamily const& f : Classic::GetSupplyFamilies())
{
if (!Classic::SupplyFamilyForClass(f, p_->GetClass())) continue;
+ if (Classic::MageConjuresFamily(p_->GetClass(), f.name, [this](uint32 id) { return p_->HasSpell(id); })) continue;
uint32 const entry = Classic::BestSupplyRank(f, level);
- if (!entry) continue;
+ if (!entry)
+ {
+ skipped(f, 0, "no rank for the level has an item template", level);
+ continue;
+ }
// Bandages need First Aid: every bot knows it at the rank of its
// level (ike3's factory gives bots the skill the same way).
if (f.flags & Classic::SUPPLY_FIRST_AID)
@@ -7195,7 +7250,11 @@ Result API::restock_class_supplies()
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(entry);
// Poisons need the Poisons skill (a level 20 rogue quest); hand out
// only what the bot can actually use.
- if (!proto || p_->CanUseItem(proto) != EQUIP_ERR_OK) continue;
+ if (!proto || p_->CanUseItem(proto) != EQUIP_ERR_OK)
+ {
+ skipped(f, entry, "the bot cannot use the item", proto ? uint32(p_->CanUseItem(proto)) : 0u);
+ continue;
+ }
uint32 have = 0;
if (f.flags & Classic::SUPPLY_ALL_RANKS)
{
@@ -7207,13 +7266,16 @@ Result API::restock_class_supplies()
uint32 const target = Classic::SupplyTarget(f, level);
if (have >= target) continue;
ItemPosCountVec dest;
- if (p_->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, entry, target - have) != EQUIP_ERR_OK)
+ if (InventoryResult const stored = p_->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, entry, target - have); stored != EQUIP_ERR_OK)
{
full = true;
+ skipped(f, entry, "no room in the bags", uint32(stored));
continue;
}
if (p_->StoreNewItem(dest, entry, true))
added += target - have;
+ else
+ skipped(f, entry, "StoreNewItem refused", 0);
}
// Ammo for the equipped bow / crossbow / gun (thrown needs none): the best arrows or
// bullets the level allows, topped up in whole stacks to AMMO_TARGET once under 30%.
@@ -8361,7 +8423,7 @@ Result API::fly_to_node(ObjectGuid flight_master, uint32 to_node)
// Bots are perpetually broke (a fresh L3 has ~67 copper), and
// ActivateTaxiPathTo charges the taxi fare â so flights silently failed and
// the bot ran back and forth at the FM forever. Cover the fare: top the bot
- // up to a flight reserve so it can always afford the hop (bots are AI; a free
+ // up to a flight reserve so it can always afford the hop (bots are bot logic; a free
// ride is fine, and this is far cheaper than the leveling time lost to a bot
// stranded on the wrong continent). 5g covers any single multi-hop route.
constexpr uint64 kFlightReserve = 50000; // 5 gold in copper
diff --git a/src/modules/PlayerbotV2/Api/PlayerbotAPI.h b/src/modules/PlayerbotV2/Api/PlayerbotAPI.h
index ddfd93260c..478d324732 100644
--- a/src/modules/PlayerbotV2/Api/PlayerbotAPI.h
+++ b/src/modules/PlayerbotV2/Api/PlayerbotAPI.h
@@ -161,7 +161,7 @@ public:
// Why a mount spell would draw nothing on the client, nullptr when its model resolves: the display the aura picks (Mount
// DB2 displays, else the creature in the aura's misc value) has no CreatureDisplayInfo or no model data / file. A bot on
- // such a mount runs at mount speed and looks on foot (Karrz, WSG 2026-10-09: Arimer, Fareed). `display_out` receives the
+ // such a mount runs at mount speed and looks on foot (playtest, WSG 2026-10-09: Arimer, Fareed). `display_out` receives the
// first display id checked.
static char const* MountDisplayProblem(uint32 spell_id, uint32* display_out = nullptr);
@@ -652,7 +652,7 @@ public:
// whetstone applied to a weapon).
Result use_item_by_entry(uint32 item_entry, ObjectGuid target = ObjectGuid::Empty);
// use_item_by_slot: same effect resolution as by-entry but addresses the
- // item by bag/slot. Used when AI rules pre-pick a specific stack (e.g.
+ // item by bag/slot. Used when bot logic rules pre-pick a specific stack (e.g.
// a particular potion variant when several share an entry id is rare,
// but bag/slot avoids ambiguity).
Result use_item_by_slot(uint8 bag, uint8 slot, ObjectGuid target = ObjectGuid::Empty);
diff --git a/src/modules/PlayerbotV2/Api/PlayerbotMovement.cpp b/src/modules/PlayerbotV2/Api/PlayerbotMovement.cpp
index 7cd09f57e9..5083e08f85 100644
--- a/src/modules/PlayerbotV2/Api/PlayerbotMovement.cpp
+++ b/src/modules/PlayerbotV2/Api/PlayerbotMovement.cpp
@@ -227,7 +227,7 @@ float GroundZ(Player* p, float x, float y, float zHint, char const* where, bool*
{
if (ok)
*ok = false;
- static bool const enabled = sConfigMgr->GetBoolDefault("Playerbot.Behavior.GroundSnap", true);
+ static bool const enabled = sConfigMgr->GetBoolDefault("Playerbot.Behavior.GroundSnap", true, true);
if (!enabled || !p)
return zHint;
Map* m = p->GetMap();
diff --git a/src/modules/PlayerbotV2/Api/PlayerbotMovement.h b/src/modules/PlayerbotV2/Api/PlayerbotMovement.h
index aa01423ade..4efcf4ba60 100644
--- a/src/modules/PlayerbotV2/Api/PlayerbotMovement.h
+++ b/src/modules/PlayerbotV2/Api/PlayerbotMovement.h
@@ -12,7 +12,7 @@
// * Jumps and other ballistic moves refuse to launch into walls / closed
// doors / cliff faces.
// * Off-mesh recovery (FARFROMPOLY_START) re-snaps the bot to the nearest
-// valid navmesh poly before the AI re-emits movement.
+// valid navmesh poly before the bot logic re-emits movement.
//
// Inspiration: mod-playerbots' SearchForBestPath / CheckCollisionAndGetValidCoords
// (AzerothCore module), mapped onto TrinityCore's PathGenerator + vmap/mmap
@@ -97,7 +97,7 @@ float GroundZ(Player* p, float x, float y, float zHint, char const* where, bool*
// surrounding floor: ~14-16y for city lifts. Detour caps a findNearestPoly
// box at ~128 overlapped polys, so keep `hz` modest (≤8y) to avoid grabbing a
// poly from a different elevator floor. Runs on the world thread (queries the
-// live navmesh); never call from an AI worker.
+// live navmesh); never call from an bot worker.
bool NearestNavPoint(Player* p, float tx, float ty, float tz,
float hxy, float hz, Position& out);
diff --git a/src/modules/PlayerbotV2/BOT_COMMANDS.md b/src/modules/PlayerbotV2/BOT_COMMANDS.md
index 65203fc201..1816fcbd59 100644
--- a/src/modules/PlayerbotV2/BOT_COMMANDS.md
+++ b/src/modules/PlayerbotV2/BOT_COMMANDS.md
@@ -74,6 +74,10 @@ Install the `ForeverBots` folder into `Interface\AddOns` (the folder name must s
out of date AddOns"). The addon only sends ordinary chat, so it needs nothing else on the client.
- `/fb` opens or closes the window (it stays open across relog). The window has:
+ - **Raid ready** (also `/fb raidready`): calls your saved bots (`.bot summon saved`), waits until the group stops growing,
+ makes it a raid when it holds more than five, sets formation circle and spacing close, sends `resume` and the
+ crowd-control switch, sets the Main Tank flag when you target a group member, and starts a ready check about twenty
+ seconds later while the bots buff themselves. Not in combat; a new click or combat cancels it.
- **Add buttons**: one per class and role (`.bot add `).
- **Orders**: Follow, Stay, Attack (your target), Resume, Pull, Flee, Come, Stop, Release, Pull back, Fall back,
Set rally. They go out in party/raid chat, so typing the word is identical.
@@ -87,7 +91,7 @@ out of date AddOns"). The addon only sends ordinary chat, so it needs nothing el
frame (drag it, position is saved): the eight icons (click assigns, right-click clears), Follow, Stay, Attack,
Pull back, Dist -/+, Dismiss and a status line with the bot's last confirmation. `/fb bot on|off` toggles it.
The client cannot tell a bot from a human, so do not use the panel on real players.
-- Slash commands that work without the window: `/fb add [role]`, `/fb call|dismiss|save|unsave|regear
+- Slash commands that work without the window: `/fb add [role]`, `/fb raidready`, `/fb call|dismiss|save|unsave|regear
[name|all]`, `/fb delete `, `/fb list`, `/fb fallback`, `/fb pullback`, `/fb rally`, `/fb formation
circle|arrow|line|none`, `/fb spacing tight|close|spread`, `/fb distance <1-20>`, `/fb maintank [name]`, `/fb tank
|clear`, `/fb assign [role]`, `/fb assign list`.
@@ -147,10 +151,11 @@ from the bot.
| `repair` | yes | yes | Same pattern with a repair vendor: `Raveni: repairing at ...`. |
| `loot` | yes | yes | Need before greed with the usual etiquette (human gets first claim). `Raveni: need before greed, the usual rules`. |
| `loot all` | yes | yes | The bot rolls for itself on every drop and takes every corpse item, greys included. `Raveni: looting everything, greys included, and rolling for myself`. Memory only (resets on relog). |
+| `use ` | yes | yes | Uses a dungeon object near the bot: an altar, brazier, lever or orb (`use altar`, `use brazier`). The bot walks to the nearest match within 30 yards, uses it once and then stays there until you say `follow`. For an object that needs several people, such as the Blackrock Altar in Upper Blackrock Spire (three), click it yourself and send it to two bots by name: `;Raveni:use altar`, `;Doran:use altar`. Nothing matching: `no 'altar' within 30 yards of me`. |
### Gear and economy by whisper (selected NPC needed)
-`buy [n]`, `buyfood`, `buypot`, `buybandage`, `buyall`, `use `, `equip `, `bank`, `auction`,
+`buy [n]`, `buyfood`, `buypot`, `buybandage`, `buyall`, `equip `, `bank`, `auction`,
`mail`, `train`, `talents [apply]`, `upgrades [apply]`, `fly ` and the `*_all` broadcasts such as
`repair_all`, `sell_all`, `buyfood_all`. They need a selected vendor/auctioneer/flight master where the bot has
to interact. The full index is the `commands` whisper.
@@ -265,8 +270,8 @@ World bots are ambient characters with no owner (`Playerbot.World.Enable = 1` sp
Invites: `Playerbot.Interact.AutoAcceptInvites` (`none`, `friends_or_higher`, `guild_or_higher`, `anyone`).
- Companion banter (`PartyBanter`): a short lowercase line now and then on ready check, wipe, rez, death, boss
kill; never in a group over 15 or with `Playerbot.Chatter.Enabled = 0`.
-- Hostile-faction world bots can be placed near you (`Playerbot.World.FriendlyPct`, default 80); set it to 100 to
- avoid fights on a PvP realm.
+- Hostile-faction world bots can be placed near you (`Playerbot.World.FriendlyPct` and the per-zone `*FriendlyPct` keys, all 100 = none by default); lower them to
+ get them (they fight on a PvP realm).
## 12. Config keys
@@ -310,7 +315,7 @@ Defaults are those of `conf/playerbot.conf.dist`. Behaviour switches are read wh
**Social and world (default)**: `BotWhisperable` 1, `WorldBotSayReply` 1, `PoliteWorldBots` 1, `PartyBanter` 1,
`SocialEmotes` 1, `Fidget` 1, `Playerbot.Chatter.Enabled` 1, `Playerbot.Interact.AutoAcceptInvites` friends_or_higher,
`Playerbot.Interact.AutoLeaderHandover` 1, `Playerbot.World.Enable` 0 (`MaxBots` 100, `BotsPerPlayer` 25,
-`ActivityRadius` 300, `FriendlyPct` 80), `Playerbot.Population.TotalTarget` 0.
+`ActivityRadius` 300, `FriendlyPct` 100), `Playerbot.Population.TotalTarget` 0.
**Battlegrounds**: `Playerbot.Bg.AutoSeed.Matches` 0, `Playerbot.Bg.AutoJoin` 0, `Playerbot.Bg.MakeRoomForPlayers` 1,
`Playerbot.Bg.Coordinator.Enable` 1.
diff --git a/src/modules/PlayerbotV2/Bot/AddonHint.h b/src/modules/PlayerbotV2/Bot/AddonHint.h
new file mode 100644
index 0000000000..441c303027
--- /dev/null
+++ b/src/modules/PlayerbotV2/Bot/AddonHint.h
@@ -0,0 +1,48 @@
+// Who still has to be told where to get the ForeverBots add-on: a player is noted at login and dropped as soon as the add-on
+// says hello (a self-whisper under the order prefix) or the player leaves. Whoever is still noted after the grace period is due
+// once, then forgotten, so each login produces at most one hint. Pure bookkeeping: no Player, no clock, no config.
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+
+namespace Playerbot::V2 {
+
+// Text of the add-on's greeting to the server.
+inline constexpr std::string_view kAddonHelloText = "hello";
+
+class AddonHintTracker
+{
+public:
+ void Login(uint64_t player, uint32_t now_ms, uint32_t delay_ms) { due_[player] = now_ms + delay_ms; }
+ void Hello(uint64_t player) { due_.erase(player); }
+ void Logout(uint64_t player) { due_.erase(player); }
+ bool Pending(uint64_t player) const { return due_.count(player) != 0; }
+ size_t Size() const { return due_.size(); }
+
+ // Players whose grace period has run out; they are removed (one hint per login). Wrap-safe for the 32-bit millisecond clock.
+ std::vector TakeDue(uint32_t now_ms)
+ {
+ std::vector out;
+ for (auto it = due_.begin(); it != due_.end();)
+ {
+ if (int32_t(now_ms - it->second) >= 0)
+ {
+ out.push_back(it->first);
+ it = due_.erase(it);
+ }
+ else
+ ++it;
+ }
+ std::sort(out.begin(), out.end());
+ return out;
+ }
+
+private:
+ std::unordered_map due_;
+};
+
+} // namespace Playerbot::V2
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BattlegroundScript.h b/src/modules/PlayerbotV2/Bot/Battleground/BattlegroundScript.h
index 17b9417dfc..4414a44995 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BattlegroundScript.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BattlegroundScript.h
@@ -303,7 +303,7 @@ private:
// nodes can each have an active callout but the same node can't be
// re-shouted by 40 bots.
//
-// Threading: callout claims happen on the AI worker thread (one bot
+// Threading: callout claims happen on the bot worker thread (one bot
// per worker per tick); the registry uses a shared_mutex for read-
// dominant lookups + an upgrade write when claiming/expiring entries.
//
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgAvPlan.h b/src/modules/PlayerbotV2/Bot/Battleground/BgAvPlan.h
index f2c6499051..596fea91b0 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgAvPlan.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgAvPlan.h
@@ -1,4 +1,4 @@
-// Alterac Valley objective rules imported from ike3's bots (the ike3-based playerbot code,
+// Alterac Valley objective rules imported from ike3's bots (Karrz1/wow-1.12 raid10-revamp bcc8b9fe70c42a8fa5d50fa83a472da9e9d19546,
// BattleGroundTacticsAV.cpp): the mine-boss objective and the captain gathering threshold. Pure functions, no game state, so they can be
// tested offline (tests/game/BgAvPlan.cpp). The mid-field fighting tactics are ours and do not live here.
#pragma once
@@ -10,7 +10,7 @@ namespace Playerbot::BgAvPlan
{
// The captain squad goes in once this many of the team stand at the waiting spot (ike3: attackers near the waiting spot >= 5).
constexpr int kCaptainGatherCount = 5;
- // Time cap (Karrz, AV 2026-10-11: a pile of bots waited at the Stonehearth staging spot for a quorum): after kCaptainGatherMaxMs of waiting the squad
+ // Time cap (playtest, AV 2026-10-11: a pile of bots waited at the Stonehearth staging spot for a quorum): after kCaptainGatherMaxMs of waiting the squad
// goes with whoever is there (at least one), so bots arriving one at a time never park for good.
constexpr uint32_t kCaptainGatherMaxMs = 75000;
constexpr bool CaptainGather(int at_stage, bool latched, uint32_t waited_ms = 0)
@@ -164,7 +164,7 @@ namespace Playerbot::BgAvPlan
return n < 1 ? 1 : n;
}
- // ---- Rules from ike3 / mod-playerbots AV that the planner uses (the ike3-based playerbot code raid10-revamp BattleGroundTacticsAV.cpp, mod-playerbots
+ // ---- Rules from ike3 / mod-playerbots AV that the planner uses (Karrz1/wow-1.12 raid10-revamp BattleGroundTacticsAV.cpp, mod-playerbots
// BattleGroundTactics.cpp selectObjective) ----
// A defender already deep in the enemy half becomes an attacker: x >= -62 for the Horde, x <= -462 for the Alliance (AV runs from the
// Frostwolf end at x -1400 to Dun Baldar at x +700); with chance 20 + 15 per own node razed (mod-playerbots BGT 1919-1931).
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgTactics.h b/src/modules/PlayerbotV2/Bot/Battleground/BgTactics.h
index 44ef1a10dd..f7894ad3fc 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgTactics.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgTactics.h
@@ -3,7 +3,7 @@
// Ideas ported from the two reference bot families, rewritten for our team planner (credit: ike3 playerbots for the
// capture-skip / role split ideas, liyunfan1223/mod-playerbots BattleGroundTactics.cpp for the capture abort, the 60 s
// objective reset and the camp-the-enemy-graveyard rule). Values are vanilla 1.12 behaviour (AB capture 60 s, AV tower 5 min).
-// Written for Karrz (Karrz).
+// Written for Karrz.
#pragma once
#include
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgTargetPick.h b/src/modules/PlayerbotV2/Bot/Battleground/BgTargetPick.h
index ec1f31de3f..5338b7c9f4 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgTargetPick.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgTargetPick.h
@@ -1,6 +1,6 @@
// BG victim validity: a battleground bot never keeps a target it cannot hurt, and re-picks when an enemy player is close.
//
-// Karrz, WSG 2026-10-09: a Horde priest stood next to him swinging at nothing and ignored him. The idle engage rule only ran with an empty
+// the owner, WSG 2026-10-09: a Horde priest stood next to him swinging at nothing and ignored him. The idle engage rule only ran with an empty
// victim, and the in-combat BG switches only react to a carrier, a peel or a healer, so a victim that was gone, dead, untargetable or
// not fighting back held the bot for good. Pure function over the snapshot's unit lists (templated, so tests/game/BgTargetPick.cpp can
// run it on plain structs). Used by State_Idle and State_InCombat; both log the result as [bg_target].
@@ -30,7 +30,7 @@ namespace Playerbot::BgTargetPick
}
}
- // How far a battleground bot looks for an enemy to fight (Karrz, WSG 2026-10-09: "make the radius where they attack people bigger").
+ // How far a battleground bot looks for an enemy to fight (playtest, WSG 2026-10-09: "make the radius where they attack people bigger").
// The snapshot scans this far in a battleground (BotSnapshotBuilder), the engage and re-pick rules read it.
constexpr float kBgEngageRange = 55.0f;
constexpr float kIdleMobPlayerRange = 15.0f; // an enemy player this close beats a creature that is not attacking us
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.cpp b/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.cpp
index 8669dc7c15..5fcc7e397d 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.cpp
@@ -364,7 +364,7 @@ void BgTeamCoordinator::PlanCtf(TeamPlanContext& ctx)
ctx.members[pick].assigned = true;
}
}
- // -- WSG zone roles (Karrz 2026-10-08: not just a straight lane between the bases) ---------------------------------------------
+ // -- WSG zone roles (playtest 2026-10-08: not just a straight lane between the bases) ---------------------------------------------
// Free fighters (after carrier, runner, escorts, hunters) are split over the map: mid skirmishers at the tunnel junction, a
// camp at the ENEMY graveyard (they take the fight to the respawn point and make the return trip hard), and a guard at our OWN
// graveyard. The slot a bot gets rotates every few minutes of match time, so the same bot does not hold one spot all game and no
@@ -494,7 +494,7 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
[](Demand const& a, Demand const& b)
{ return a.emergency > b.emergency; });
- // AV open-field brawl share (Karrz 2026-10-08), decided here so it can shrink the garrison budget and
+ // AV open-field brawl share (playtest 2026-10-08), decided here so it can shrink the garrison budget and
// used further down to send the bots (see "AV open-field brawl"). Old Classic AV: a big part of each side
// farmed kills in the valley while the rest took towers, so games lasted. The share is a random 25-55%
// per match and team (hash of instance + team: stable for the whole match, no RNG state) and follows the
@@ -506,7 +506,7 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
for (auto const& m : ctx.members)
if (m.alive && !m.is_carrier) ++alive_total;
uint64 const mid_key = (uint64(ctx.instance_id) << 2) | uint64(ctx.team);
- // Karrz 2026-10-11: the valley brawl is OFF. Bots piled up idle in AV, and he asked to drop the fight in the middle in case it was the
+ // playtest 2026-10-11: the valley brawl is OFF. Bots piled up idle in AV, and he asked to drop the fight in the middle in case it was the
// cause; AV bots now play the way ike3 / mod-playerbots do (towers, graveyards, captain, general, mines). Flip to true to bring it back.
constexpr bool kAvValleyBrawl = false;
if (kAvValleyBrawl && ctx.type_id == 1 && PosSet(ctx.fight_x, ctx.fight_y) && !all_in && !ctx.endgame_unconditional &&
@@ -729,7 +729,7 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
if (m.alive && Dist2(m.x, m.y, ctx.endgame_x, ctx.endgame_y) < 200.f * 200.f) ++friends_near_boss;
bool const general_ok = BgAvPlan::GeneralPushOk(enemy_towers_up, enemy_towers_razed, own_final_gy, friends_near_boss);
- // -- AV open-field brawl (Karrz 2026-10-08) -------------------------------
+ // -- AV open-field brawl (playtest 2026-10-08) -------------------------------
// Send the brawlers (share decided above) to the fight zone as ordinary AttackNode orders. The brawl ends once
// the push for the enemy captain/general is on (a lead, a deficit, low enemy reinforcements), so matches end.
// The brawl also goes on while the general push is held back by standing enemy towers and no captain is left to go for.
@@ -856,7 +856,7 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
{ best_cost = cost; tx = n.x; ty = n.y; tz = n.z; }
}
// Node-race split (WSG-free maps with 4+ nodes, i.e. AB/Gilneas style): the old single concentrated squad sent the whole
- // team Stables -> Blacksmith across the river and nobody took the Lumber Mill, Farm or Mine (Karrz, AB test 2026-10-08).
+ // team Stables -> Blacksmith across the river and nobody took the Lumber Mill, Farm or Mine (playtest, AB test 2026-10-08).
// Spread the free attackers over up to four takeable nodes in proportion to the node weight (script priority + 2, so the
// Blacksmith pivot gets the biggest group), keep about one in eight unordered as roamers. Held nodes keep their garrison
// from the defense pass above; a node that is lost or attacked turns up in the next plan and is re-assigned (the sticky
@@ -885,7 +885,7 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
}
if (split_cands.size() >= 2 && ctx.nodes.size() >= 4)
{
- // Variety (Karrz: no two matches alike): the focus rotates. Every 4 minutes of match time, per match, each candidate's
+ // Variety (the owner: no two matches alike): the focus rotates. Every 4 minutes of match time, per match, each candidate's
// cost and weight are nudged by a hash of its position, so the main squad is not always on the same pivot node and a
// second node regularly gets a real group.
uint32 const var_epoch = ctx.in_progress_ms / (4u * 60u * 1000u) + ctx.instance_id * 7u;
@@ -932,10 +932,10 @@ void BgTeamCoordinator::PlanNodeRace(TeamPlanContext& ctx)
ctx.members[pick].assigned = true;
}
}
- // Road skirmishers (Karrz: fights on the roads between the nodes, not only at the banners). About a fifth of the bots still
+ // Road skirmishers (the owner: fights on the roads between the nodes, not only at the banners). About a fifth of the bots still
// free go to a point midway between two of the contested nodes, picked by a hash that rotates every 3 minutes, and fight
// whatever they meet on the way and there. Their orders are AttackNode at the road point; the 40 y engage does the rest.
- if (split_cands.size() >= 2 && !av) // AV: no road skirmishers (ike3 / mod-playerbots have none; Karrz 2026-10-11)
+ if (split_cands.size() >= 2 && !av) // AV: no road skirmishers (ike3 / mod-playerbots have none; playtest 2026-10-11)
{
int left = 0;
for (auto const& m : ctx.members)
@@ -1092,7 +1092,7 @@ void BgTeamCoordinator::Update(uint32 now_ms)
return;
last_plan_ms_ = now_ms;
- if (!sConfigMgr->GetBoolDefault("Playerbot.Bg.Coordinator.Enable", true))
+ if (!sConfigMgr->GetBoolDefault("Playerbot.Bg.Coordinator.Enable", true, true))
{
if (!orders_.empty()) orders_.clear();
last_dump_ = "coordinator disabled (Playerbot.Bg.Coordinator.Enable=0)";
@@ -1112,6 +1112,8 @@ void BgTeamCoordinator::Update(uint32 now_ms)
Services::Registry().for_each([&](BotId id, BotRegistryEntry const& e)
{
if (!e.ai) return;
+ // A bot stopped with "bgrun stop" (or not armed) never runs an order (BgDispatch returns at once), so it gets no quota slot.
+ if (!e.ai->bg_active()) return;
Player* p = ObjectAccessor::FindConnectedPlayer(
ObjectGuid::Create(id));
if (!p) return;
@@ -1152,13 +1154,13 @@ void BgTeamCoordinator::Update(uint32 now_ms)
const uint16 resolved_type_id = ref->bg.current_type_id;
// Advice is computed HERE, on the world thread, from the immutable
// reference snapshot. Do NOT borrow a member BotAI's BgAdviceCache:
- // that cache is OWNED BY THE AI WORKER THREAD — BgDispatch
+ // that cache is OWNED BY THE bot logic WORKER THREAD — BgDispatch
// reassigns its heap vectors every ≤2s, so reading it here could
// iterate freed buffers (use-after-free; adversarial review
// 2026-06-10). Scripts are stateless and registered once at boot;
// GetAdvice on a snapshot view is thread-safe and costs one call
// per (instance, team) per 750ms plan — negligible next to the
- // per-bot per-tick churn the AI-side cache exists to avoid.
+ // per-bot per-tick churn the bot logic-side cache exists to avoid.
BattlegroundAdvice const adv =
Services::Battlegrounds().GetAdvice(BotSnapshotView(*ref));
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.h b/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.h
index d1ef0a9f99..1a3b629899 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgTeamCoordinator.h
@@ -7,7 +7,7 @@
// rebalancing. This service computes ONE plan per (battleground instance,
// team) on the WORLD THREAD and publishes per-bot orders; the snapshot
// builder copies each bot's order into its snapshot (BotSnapshot::BgState::
-// BgOrder) and the AI executes it, falling back to the legacy per-bot role
+// BgOrder) and the bot logic executes it, falling back to the legacy per-bot role
// logic whenever no order is present — graceful degradation by design.
//
// Threading: Update() is the only WRITER of orders_ and runs on the WORLD
@@ -17,7 +17,7 @@
// writer and the readers are temporally disjoint — orders_ is never mutated
// during the build phase, and concurrent reads of a non-mutating unordered_map
// are well-defined. Move Update() into the parallel phase and this needs a
-// shared_mutex. The AI workers only ever see orders through their snapshots.
+// shared_mutex. The bot workers only ever see orders through their snapshots.
//
// Inputs (all already maintained elsewhere — this class adds no harvest):
// * Roster: live Player objects of V2 bots in the BG (registry walk).
@@ -26,7 +26,7 @@
// snapshot build, including the per-node player-pressure counts).
// * Static script data: BattlegroundScriptMgr::GetAdvice computed HERE
// on the world thread from that same immutable snapshot. Never read a
-// BotAI's BgAdviceCache from this class — it is owned by the AI worker
+// BotAI's BgAdviceCache from this class — it is owned by the bot worker
// thread, which reassigns its heap vectors every ≤2s (use-after-free;
// adversarial review 2026-06-10).
//
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointData.inc b/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointData.inc
index 98f2241ebd..4014b7cfe6 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointData.inc
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointData.inc
@@ -1,4 +1,4 @@
-// Generated from ike3 BattleGroundTactics (the ike3-based playerbot code raid10-revamp, vmangos hand-recorded paths). Do not edit by hand.
+// Generated from ike3 BattleGroundTactics (Karrz1/wow-1.12 raid10-revamp, vmangos hand-recorded paths). Do not edit by hand.
// Each path: name, first/last = junctions; points are x,y,z on the classic maps (AV 30, WSG 489, AB 529).
inline const RoutePath kPathsWsg[] = {
{ "HordeFlagRoom_to_HordeGraveyard", {{933.331f,1433.72f,345.536f}, {944.859f,1423.05f,345.437f}, {966.691f,1422.53f,345.223f}, {979.588f,1422.84f,345.46f}, {997.806f,1422.52f,344.623f}, {1008.53f,1417.02f,343.206f}, {1016.42f,1402.33f,341.352f}, {1029.14f,1387.49f,340.836f}} },
@@ -87,7 +87,7 @@ inline const RoutePath kPathsAv[] = {
{ "Alliance_Base_Bunker_Third_Crossroad_to_Alliance_Base_Flag", {{648.593f,-33.8686f,47.1592f}, {640.404f,-32.0183f,46.2328f}} },
{ "Alliance_Base_Bunker_Third_Crossroad_to_Alliance_Base_Vanndar_Stormpike", {{648.593f,-33.8686f,47.1592f}, {664.325f,-28.0147f,50.6198f}, {690.605f,-20.6846f,50.6198f}, {696.331f,-27.5629f,50.6198f}, {699.006f,-31.7397f,50.6198f}, {704.958f,-34.5659f,50.6198f}, {717.709f,-16.6861f,50.1354f}} },
{ "Stormpike_Crossroad_to_Stormpike_Flag", {{638.087f,-287.84f,30.1471f}, {667.173f,-295.225f,30.29f}} },
- // Added 2026-10-09 from the ike3-based playerbot code BattleBotWaypoints.cpp (it was missing from the first import)
+ // Added 2026-10-09 from Karrz1/wow-1.12 raid10-revamp bcc8b9f BattleBotWaypoints.cpp (it was missing from the first import)
{ "Stormpike_Graveyard_to_Stormpike_Flag", {{676.0f,-374.0f,29.782f}, {665.922f,-347.777f,29.493f}, {667.173f,-295.225f,30.29f}} },
{ "Stormpike_Crossroad_to_Irontooth_Mine_Entrance", {{638.087f,-287.84f,30.1471f}, {665.708f,-283.570f,29.187f}, {685.958f,-274.358f,23.618f}, {701.911f,-271.504f,28.409f}, {715.155f,-276.190f,36.108f}, {727.653f,-288.440f,43.433f}, {742.260f,-305.039f,51.649f}, {753.219f,-314.030f,56.008f}} },
{ "Irontooth_Mine_Entrance_to_Irontooth_Mine_Boss", {{753.219f,-314.030f,56.008f}, {772.425f,-310.607f,54.891f}, {789.429f,-308.122f,54.883f}, {803.955f,-324.896f,52.259f}, {820.946f,-341.782f,49.227f}, {831.603f,-351.672f,47.041f}, {836.755f,-369.026f,48.233f}, {827.558f,-386.418f,47.731f}, {827.334f,-407.188f,48.293f}, {842.166f,-413.971f,47.832f}, {861.532f,-422.612f,51.013f}, {870.832f,-436.016f,51.130f}, {881.273f,-442.002f,54.664f}} },
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointRoutes.h b/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointRoutes.h
index c061886983..21e6e97873 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointRoutes.h
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgWaypointRoutes.h
@@ -29,7 +29,7 @@ struct RoutePath { char const* name; std::vector pts; };
#include "BgWaypointData.inc"
// A path that may only be walked first point to last: a jump / roof drop, and the start-room, cave and graveyard exits that the
-// original bots never walk backwards (vPaths_NoReverseAllowed, the ike3-based playerbot code BattleBotWaypoints.cpp).
+// original bots never walk backwards (vPaths_NoReverseAllowed, Karrz1/wow-1.12 raid10-revamp bcc8b9f BattleBotWaypoints.cpp).
// Horde_Cave_to_Tower_Point_Crossroad is in their list but is NOT one-way here: our router also uses it backwards, it is the only
// link by which a bot from the Alliance half reaches the Horde base (the test below fails when it is made one-way).
inline bool IsOneWayPath(std::string_view nm)
@@ -275,7 +275,7 @@ inline bool NextWaypoint(uint16_t bg_type, float bx, float by, float bz, float t
// A lane is one of the ways across the field a bot may take: either one of the recorded graph paths above (a graveyard-ridge jump
// into the enemy flag room, the second recording of the mid line), or a chain of hand-recorded waypoints (BgWsgLanes.inc: the
// tunnel, the graveyard ridge and the north ramp out of the own base, the mid field, then the enemy tunnel or ramp). The route to a
-// goal is forced through the lane, so a team spreads over the whole map instead of every bot walking the one shortest line (Karrz,
+// goal is forced through the lane, so a team spreads over the whole map instead of every bot walking the one shortest line (the owner,
// WSG 2026-10-09: "just straight out the tunnel and straight back up the tunnel"). Nothing here is invented: every coordinate comes
// from recorded data.
// drop: the leg from the previous point to this one is a drop off a ledge (the previous point is the ledge, this one the landing).
@@ -307,7 +307,7 @@ inline std::vector const& LanesFor(uint16_t bg_type, bool east, bool flank
// A fight below the graveyard ridge: the ridge lane whose drop the bot stands above, when the bot is on the ridge within `reach` y of the ledge
// and has not dropped yet (it stands more than 8 y above the landing). Out: the ridge lane (of the two, `selector` picks) and the landing.
-// The caller sends the bot over the ledge, instead of the random lane, when enemies are at the landing (Karrz, WSG 2026-10-09: the whole
+// The caller sends the bot over the ledge, instead of the random lane, when enemies are at the landing (playtest, WSG 2026-10-09: the whole
// rez wave ran the long way round the back while the enemy was fighting below the cliff).
inline Lane const* RidgeDropAbove(std::vector const& lanes, uint32_t selector, float bx, float by, float bz, float reach, LanePoint* landing = nullptr)
{
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/BgWsgLanes.inc b/src/modules/PlayerbotV2/Bot/Battleground/BgWsgLanes.inc
index 2bba20826f..2c3d0f5ea9 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/BgWsgLanes.inc
+++ b/src/modules/PlayerbotV2/Bot/Battleground/BgWsgLanes.inc
@@ -1,6 +1,6 @@
// Warsong Gulch lanes, hand-recorded waypoint chains.
//
-// Source: the ike3-based playerbot code branch raid10-revamp, commit bcc8b9fe70c42a8fa5d50fa83a472da9e9d19546, src/game/PlayerBots/playerbot/
+// Source: Karrz1/wow-1.12 branch raid10-revamp, commit bcc8b9fe70c42a8fa5d50fa83a472da9e9d19546, src/game/PlayerBots/playerbot/
// strategy/actions/BattleGroundTactics.cpp, BGTactics::wsgPaths() ("old wsg waypoints", the ike3 / cmangos playerbots lineage, GPL).
// Map 489 coordinates, the same map as BgWaypointData.inc. Only the points are taken; the choice among them is ours (per-bot lanes).
// Checked offline against the recorded graph (BgWaypointData.inc): all but the two south mid-field points lie within ~20 y of a
@@ -62,8 +62,8 @@ inline std::vector BuildWsgLanes(bool east, bool flank_only)
// (their own code marks that lane "BUGGED"; ours does not path it, so the NOPATH that made it unusable cannot occur).
char const* const names[6] = { "tunnel>tunnel", "tunnel>ramp", "ridge>tunnel", "ridge>ramp", "ramp>tunnel", "ramp>ramp" };
bool const flank[6] = { false, false, true, true, true, true }; // a base tunnel is not a flank
- // Weights (Karrz, WSG 2026-10-09 playtest: bots ran the long way round the ramp where players drop off the ridge): the ridge
- // lanes carry the drop and are the players' shortcut, so they weigh most. Karrz, same playtest: "still running up and down the middle":
+ // Weights (playtest, WSG 2026-10-09 playtest: bots ran the long way round the ramp where players drop off the ridge): the ridge
+ // lanes carry the drop and are the players' shortcut, so they weigh most. The owner, same playtest: "still running up and down the middle":
// the tunnel lanes and the two plain middle lines are the middle, about a quarter of the picks now; the ramp-out lanes end on the side of
// the field their ramp leads to and no longer cut back through the middle (eastbound they used to go on to the middle point).
int const weight[6] = { 6, 6, 34, 34, 10, 10 };
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AlteracValleyScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AlteracValleyScript.cpp
index 696cac2d7b..7daad0b60d 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AlteracValleyScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AlteracValleyScript.cpp
@@ -5,7 +5,7 @@
// Vandar Stormpike ends the BG.
//
// Authoritative data from V1 (production-tested):
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Siege/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Siege/
// AlteracValleyData.h:35 (REINF_GAIN_PER_CAPTAIN), :128-130 (Vandar),
// :134-136 (Drek'Thar), :149-164 (Captains), :191+ (towers),
// :451-457 (spawns).
@@ -85,7 +85,7 @@ public:
a.endgame_target_z = 98.5f;
a.endgame_creature_entry = 11946; // DREKTHAR_ENTRY
}
- // Captain staging (ike3 BattleGroundTacticsAV.cpp, the ike3-based playerbot code, named locations
+ // Captain staging (ike3 BattleGroundTacticsAV.cpp, Karrz1/wow-1.12 raid10-revamp bcc8b9fe, named locations
// AV_ICEBLOOD_GARRISON_WAITING_ALLIANCE / AV_STONEHEART_OUTPOST_WAITING_HORDE): the squad for the enemy captain gathers here and
// goes in together (BgTeamCoordinator::PlanNodeRace), not one bot after another. The Alliance hunts Galvangar, the Horde Balinda.
if (s.is_horde())
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/ArathiBasinScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/ArathiBasinScript.cpp
index 40839acd44..a864b7ea18 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/ArathiBasinScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/ArathiBasinScript.cpp
@@ -4,7 +4,7 @@
// 4-cap: defend 4, soft-attack the 5th (typically the contested mid).
//
// Authoritative coords + strategic weights from V1
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Domination/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Domination/
// ArathiBasinData.h:54-81 (positions), :110-121 (GetNodeStrategicValue),
// :159, :168 (faction spawns).
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AshranScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AshranScript.cpp
index 710acfc461..c69cd6ba8f 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AshranScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/AshranScript.cpp
@@ -3,7 +3,7 @@
// Glory control points + 8 side events + faction commanders.
//
// Authoritative coords from V1
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Epic/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Epic/
// AshranData.h:118 (event interval), :138-149 (Volrath/Tremblade),
// :156-160 (control points), :171-173 (faction spawns).
//
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/BattleForGilneasScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/BattleForGilneasScript.cpp
index 92cf049c18..8c1e20a3da 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/BattleForGilneasScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/BattleForGilneasScript.cpp
@@ -3,7 +3,7 @@
// Capture 2+ of 3 (Lighthouse / Waterworks / Mines) to score.
//
// Authoritative coords + weights from V1
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Domination/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Domination/
// BattleForGilneasData.h:52-67 (positions), :92-101 (GetNodeStrategicValue),
// :137, :146 (faction spawns).
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/DeepwindGorgeScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/DeepwindGorgeScript.cpp
index 20a185cd17..a77ac66f17 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/DeepwindGorgeScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/DeepwindGorgeScript.cpp
@@ -8,7 +8,7 @@
// DeepwindGorgeData.h:159-374).
//
// Map id: 1105 (NOT 998 — 998 is Temple of Kotmogu, common confusion).
-// V1 coords: src/modules/Playerbot/AI/Coordination/Battleground/Scripts/
+// V1 coords: src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/
// Domination/DeepwindGorgeData.h:50-63 (nodes), :475-483 (faction spawns).
#include "../BattlegroundScript.h"
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/EyeOfTheStormScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/EyeOfTheStormScript.cpp
index 86ccafa261..f304df41b9 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/EyeOfTheStormScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/EyeOfTheStormScript.cpp
@@ -11,7 +11,7 @@
// :92 — BG_OBJECT_FLAG2_EY_ENTRY = 208977 (NEW_FLAG type, ie 36)
// :101 — AREATRIGGER_CAPTURE_FLAG = 33 (capture mechanic)
// V1 coords for towers + center flag:
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Domination/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Domination/
// EyeOfTheStormData.h:64-91
#include "../BattlegroundScript.h"
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/IsleOfConquestScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/IsleOfConquestScript.cpp
index 8f8b0ddf7e..2b3bfd01fe 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/IsleOfConquestScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/IsleOfConquestScript.cpp
@@ -14,7 +14,7 @@
// :182-191, :221-227 — node banners + keep gate entries
// :386-395 — OnUnitKilled (win-condition)
// V1 author-attested coords (NOT TC-validated; DB-driven on TC):
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Siege/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Siege/
// IsleOfConquestData.h:128-134 (nodes), :354-364 (Generals).
#include "../BattlegroundScript.h"
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/StrandOfAncientsScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/StrandOfAncientsScript.cpp
index 0cd6d33a36..33b44ce047 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/StrandOfAncientsScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/StrandOfAncientsScript.cpp
@@ -16,7 +16,7 @@
// :166 — BG_SA_ATTACKER_TEAM worldstate
// :250-251 — Demolisher + Antipersonnel Turret entries
// V1 author-attested coords (not TC-validated; DB-driven):
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/Siege/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/Siege/
// StrandOfTheAncientsData.h:186-188 (relic), :238-245 (gates),
// :251-257 (graveyards), :263-268 (demolisher mount points).
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/TwinPeaksScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/TwinPeaksScript.cpp
index d5caac3e2a..0e3170ae08 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/TwinPeaksScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/TwinPeaksScript.cpp
@@ -7,7 +7,7 @@
// src/server/game/Miscellaneous/SharedDefines.h:3195-3196
// NEW_FLAG=36, NEW_FLAG_DROP=37
// V1 coords:
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/CTF/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/CTF/
// TwinPeaksData.h:80-89 (flag spawns), :165, :187 (defender posts)
#include "../BattlegroundScript.h"
diff --git a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/WarsongGulchScript.cpp b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/WarsongGulchScript.cpp
index 5cc11a34ff..5fa7248f11 100644
--- a/src/modules/PlayerbotV2/Bot/Battleground/Scripts/WarsongGulchScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Battleground/Scripts/WarsongGulchScript.cpp
@@ -10,7 +10,7 @@
// :3195 — GAMEOBJECT_TYPE_NEW_FLAG = 36
// :3196 — GAMEOBJECT_TYPE_NEW_FLAG_DROP = 37
// V1 coords:
-// src/modules/Playerbot/AI/Coordination/Battleground/Scripts/CTF/
+// src/modules/Playerbot/bot logic/Coordination/Battleground/Scripts/CTF/
// WarsongGulchData.h:38-47 (flag spawns), :123-149 (defender posts)
#include "../BattlegroundScript.h"
@@ -40,8 +40,8 @@ public:
a.role_by_slot = {
BgRole::FlagCarrier,
BgRole::FCEscort,
- BgRole::Defender, // flag room guards: two, each at its own post beside the stand (not on it: Karrz, two bots camped on
- BgRole::Defender, // the stand). Ported from the ike3 bots' two defender posts (the ike3-based playerbot code)
+ BgRole::Defender, // flag room guards: two, each at its own post beside the stand (not on it: the owner, two bots camped on
+ BgRole::Defender, // the stand). Ported from the ike3 bots' two defender posts (Karrz1/wow-1.12 raid10-revamp bcc8b9f)
BgRole::Roamer,
BgRole::Roamer,
BgRole::Attacker,
diff --git a/src/modules/PlayerbotV2/Bot/BotAI.cpp b/src/modules/PlayerbotV2/Bot/BotAI.cpp
index 98d0b7999c..47e36497c6 100644
--- a/src/modules/PlayerbotV2/Bot/BotAI.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotAI.cpp
@@ -1,4 +1,5 @@
#include "BotAI.h"
+#include "TownLife.h"
#include "BotSnapshotView.h"
#include "TradeRule.h"
#include "BotTrade.h"
@@ -34,7 +35,9 @@ void BotAI::set_rally_point(uint32 map, float x, float y, float z)
void BotAI::note_cast_outcome(uint32 code, uint32 spell_id, uint32 now_ms, std::string const& bot_name)
{
- if (code == uint32(SPELL_FAILED_NO_AMMO))
+ // A warrior with no thrown weapon equipped fails Throw with EQUIPPED_ITEM, not NO_AMMO: the same "no ranged opener".
+ if (code == uint32(SPELL_FAILED_NO_AMMO) ||
+ (code == uint32(SPELL_FAILED_EQUIPPED_ITEM) && (spell_id == 2764 || spell_id == 2480 || spell_id == 7918 || spell_id == 7919)))
last_no_ammo_ms_.store(now_ms ? now_ms : 1u, std::memory_order_relaxed);
// A refused cast started no global cooldown: release the emitter's GCD hold (note_gcd_started).
// NOT_READY keeps it: the GCD (or a cooldown) the stale snapshot missed is what refused it.
@@ -301,7 +304,7 @@ void BotAI::tick(BotSnapshotView snapshot,
}
// Pet taunt autocast. Growl / Torment / Suffering on autocast rip mobs
- // off the group's tank (Karrz's raid change: pet Growl off in groups).
+ // off the group's tank (the owner's raid change: pet Growl off in groups).
// Off while the bot is grouped with another member who tanks (role Tank,
// or the coordinator's main tank) and the bot is not a tank itself; the
// single-target taunts back on when solo or when the bot tanks (an area
@@ -406,7 +409,7 @@ void BotAI::tick(BotSnapshotView snapshot,
// to detect zones the bot has "settled into" (cumulative >30min) and
// rebind hearth there. Skip while in BG/dungeon (those are transient
// and shouldn't accumulate hearth-relevant time). Delta is bounded
- // by the AI tick interval (typically 200-1000ms).
+ // by the bot tick interval (typically 200-1000ms).
if (snapshot.is_alive() && !snapshot.in_battleground() && !snapshot.is_in_dungeon())
{
const uint32 now_ms = snapshot.published_at_ms();
@@ -497,7 +500,7 @@ void BotAI::tick(BotSnapshotView snapshot,
// The owner's release order is kept: one that reached the bot between
// its real death and this edge (a snapshot or more later) must still
// release it. Only an order from before this death is dropped: it was
- // left by a revival this AI never observed. The death instant is
+ // left by a revival this bot logic never observed. The death instant is
// Module::OnDeath's stamp; if that is missing or plainly from an
// older death, fall back to this edge minus a small slack.
if (const uint32 order = release_order_ms())
@@ -635,9 +638,11 @@ void BotAI::tick(BotSnapshotView snapshot,
void BotAI::update_dungeon_autopilot_hold(BotSnapshotView s, GroupSnapshotView g)
{
- // A companion's party that is not a raid group, inside a raid map (MC 2026-10-06: Karrz's
+ // An owner Stay / Hold: the dungeon autopilot (converge, rejoin, advance, pull) walks nobody who was told to stay.
+ owner_hold_ = holding_position(s.published_at_ms());
+ // A companion's party that is not a raid group, inside a raid map (MC 2026-10-06: the owner's
// 6-man party), never runs the raid autopilot: the tank advanced and pulled Molten Giants
- // the party could not survive while Karrz was still forming the raid. It follows its owner
+ // the party could not survive while the owner was still forming the raid. It follows its owner
// (State_InGroup) and defends (InCombat); converting to a raid group re-arms the run.
// Playerbot.Behavior.OwnerFollowHold off: no hold, and a follow order left over from before
// the switch was turned off is released.
@@ -657,7 +662,7 @@ void BotAI::update_dungeon_autopilot_hold(BotSnapshotView s, GroupSnapshotView g
: (g.exists() && g.is_raid() ? "the group is a raid group" : "left the raid map / owner's group"));
}
- // The owner engaging a mob himself no longer releases his follow order or opens an autopilot window (Karrz, Deadmines
+ // The owner engaging a mob himself no longer releases his follow order or opens an autopilot window (playtest, Deadmines
// 2026-10-10: the tank ran off and pulled everything in the first room once he attacked anything). A suspended bot helps on
// the owner's target and defends the group (State_InGroup assist chain, the tank included); only an order (attack / pull /
// resume / aggressive, release_owner_lead) hands the pulls back to the autopilot.
@@ -737,7 +742,7 @@ void BotAI::dispatch_layers(BotSnapshotView s, GroupSnapshotView g,
// get auto-accepted so owner sparring works without a manual whisper;
// strangers get auto-declined to avoid being trolled into PvP. The
// friend flag is resolved on the world thread by the snapshot builder
- // (Player::GetSocial::HasFriend + group/guild membership), so the AI
+ // (Player::GetSocial::HasFriend + group/guild membership), so the bot logic
// worker just inspects a single bool here.
if (s.has_duel_request())
{
@@ -761,6 +766,9 @@ void BotAI::dispatch_layers(BotSnapshotView s, GroupSnapshotView g,
}
else if (s.duel_initiator_is_friend())
em.duel_accept();
+ else if (!s.duel_initiator_is_real() && !s.has_owner_character() && !s.in_group()
+ && V2::TownLife::PactHolds(s.bot_id(), s.duel_initiator().GetCounter(), s.published_at_ms()))
+ em.duel_accept(); // another world bot asked for this duel (idle:town_duel)
else if (polite)
{
// Answer a moment after the request (0-2 s, per bot), once; the verdict is stable for a minute so a
diff --git a/src/modules/PlayerbotV2/Bot/BotAI.h b/src/modules/PlayerbotV2/Bot/BotAI.h
index 423b6b2d79..05258745b5 100644
--- a/src/modules/PlayerbotV2/Bot/BotAI.h
+++ b/src/modules/PlayerbotV2/Bot/BotAI.h
@@ -1,12 +1,13 @@
// BotAI - The top-level state machine. CONTRACTS.md §2.6.
//
-// Constructed once per bot. Lives on the AI worker thread that runs the bot.
+// Constructed once per bot. Lives on the bot worker thread that runs the bot.
// Pure: tick(snapshot, group, events, emit) — no global mutation, no I/O.
#pragma once
#include "ClassicBuffLedger.h"
#include "IdleWatch.h"
+#include "WalkOrder.h"
#include "BotTypes.h"
#include "BotSnapshot.h" // CurrencyEntry — cached_currencies_ member needs full type
#include "Battleground/BgTactics.h" // BgTactics::StallWatch (bg_stall_ member)
@@ -40,7 +41,7 @@ class BotAI
public:
BotAI(BotId id, BotPersonality personality, BotRng rng);
- // Called by AI worker. Pure: snapshot in → intents out.
+ // Called by bot worker. Pure: snapshot in → intents out.
// BotEventInbox parameter was removed 2026-05-21 — see PlayerbotV2.cpp
// OnDamageTaken comment for rationale.
void tick(BotSnapshotView snapshot,
@@ -204,7 +205,7 @@ public:
// Owner's "release" order (BotCommandParser::OrderRelease, world thread):
// GameTime ms it reached this dead bot, 0 = none. State_Dead releases at
- // once and runs back. NOT cleared on the AI's death edge (an order can
+ // once and runs back. NOT cleared on the bot logic's death edge (an order can
// arrive between the real death and the snapshot showing it); cleared on
// revival (clear_release_order_before) and dropped as stale on the death
// edge when it predates this death (died_at_ms).
@@ -265,6 +266,10 @@ public:
// Last summon to the entrance (companion of an owner inside; see
// idle:rejoin_group_instance), paced so a refused port is not spammed.
uint32 summon_ms = 0;
+ // Direct ports into the owner's instance tried since the rejoin began; after kDirectTries refusals the bot goes by the
+ // entrance trigger again.
+ uint32 direct_tries = 0;
+ static constexpr uint32 kDirectTries = 3;
};
RejoinRun& rejoin_run() { return rejoin_run_; }
RejoinRun const& rejoin_run() const { return rejoin_run_; }
@@ -628,6 +633,10 @@ public:
// marks and DPS wait for it. A Pull never sets it. 0 = never.
void note_owner_attack(uint32 now_ms) { owner_attack_ms_ = now_ms ? now_ms : 1u; }
uint32 owner_attack_ms() const { return owner_attack_ms_; }
+ // The owner's Pull / Pull back reached this (non-pulling) bot: in a party the DPS then wait for his Attack, at most 6 s from the
+ // tank's first hit (EvaluateThreatHold). 0 = never.
+ void note_owner_pull(uint32 now_ms) { owner_pull_ms_ = now_ms ? now_ms : 1u; }
+ uint32 owner_pull_ms() const { return owner_pull_ms_; }
void set_last_owner_name(std::string name) { last_owner_name_ = std::move(name); }
std::string const& last_owner_name() const { return last_owner_name_; }
@@ -640,7 +649,7 @@ public:
// Owner spacing preset (BotCommandParser "spacing tight|close|spread", "tight", "close", "spread out"):
// yards between neighbours in the follow formation (State_InGroup) and, as formation_spacing_scale()
// (yards / 4, Close = 1), the raid ranged / pre-pull arc spacing in State_Idle. Written by the chat
- // handlers (world thread), read by the AI worker.
+ // handlers (world thread), read by the bot worker.
FormationSpacing formation_spacing() const
{ return FormationSpacing(formation_spacing_.load(std::memory_order_relaxed)); }
// Choosing a preset drops any numeric spacing; a "distance " order sets exact yards (memory only, like the
@@ -735,7 +744,7 @@ public:
// Owner "follow" order: the owner leads, so the bot follows its owner and defends, and the
// dungeon autopilot stands down until the owner says attack / assist / tank / pull / resume /
// run (or follow stop), or engages a mob himself. Unlike the 30s manual-mode window it lasts
- // until released. Written by the chat handlers (world thread), read and released by the AI
+ // until released. Written by the chat handlers (world thread), read and released by the bot logic
// worker. Returns true when the value changed (callers log [owner_order] on change).
bool owner_follow_order() const { return owner_follow_order_.load(std::memory_order_relaxed); }
bool set_owner_follow_order(bool on)
@@ -744,7 +753,7 @@ public:
// follow the owner and defend. Recomputed each tick (update_dungeon_autopilot_hold).
bool raid_map_party_hold() const { return raid_map_party_hold_; }
bool dungeon_autopilot_suspended() const
- { return owner_follow_order() || owner_passive() || fallback_active() || pull_back_active() || raid_map_party_hold_ || human_lead_hold_; }
+ { return owner_follow_order() || owner_passive() || fallback_active() || pull_back_active() || raid_map_party_hold_ || human_lead_hold_ || owner_hold_; }
// Owner stance (panel Aggressive / Passive toggle, whisper and group words "passive" / "aggressive"), kept per bot until
// changed (the group order reaches every bot of the group):
// Auto - passive when a human leads the group inside an instance, otherwise the bot's own autonomy;
@@ -752,7 +761,7 @@ public:
// target); it defends itself and the group (a mob already on a member) and fights on the owner's
// attack / pull order (release_owner_lead opens a window);
// Aggressive - besides the group's own fights it attacks any hostile within kAggressiveRadiusYd of the owner.
- // Written by the chat handlers (world thread), read by the AI worker.
+ // Written by the chat handlers (world thread), read by the bot worker.
enum class OwnerStance : uint8_t { Auto = 0, Passive = 1, Aggressive = 2 };
static constexpr float kAggressiveRadiusYd = 10.0f; // Aggressive: hostiles this close to the owner are attacked
OwnerStance owner_stance() const { return OwnerStance(owner_stance_.load(std::memory_order_relaxed)); }
@@ -764,6 +773,8 @@ public:
return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count() <
owner_order_until_.load(std::memory_order_relaxed);
}
+ // "passive" ends the window an Attack / Pull opened, so the stance holds at once and not after 15 s.
+ void close_owner_order_window() { owner_order_until_.store(0, std::memory_order_relaxed); }
// Starts no fight on its own right now (stance Passive, or Auto in an instance led by a human), outside an order window.
bool passive_now(bool human_led_instance) const
{
@@ -781,7 +792,7 @@ public:
// (tanks in front, ranged and healers on an arc behind) and fight only what follows. Suspends
// the autopilot like the follow order, anchored at the rally instead of the owner; released
// by the same orders. The plan is written by the chat handler (world thread) and read by the
- // AI worker (States::FallbackTick), hence the mutex.
+ // bot worker (States::FallbackTick), hence the mutex.
struct FallbackPlan
{
bool active = false;
@@ -818,12 +829,13 @@ public:
// Every order opens the 15 s order window (owner_order_window_open: a passive bot assists the owner's / the group's targets).
// autopilot_window = true (resume / run / "go") also opens the human-lead release window, so the dungeon autopilot runs on its
// own for 15 s (BotAI::update_dungeon_autopilot_hold). Attack / pull / aggressive pass false: they fight what the owner points
- // at and never pull the next pack (Karrz, Deadmines 2026-10-10: Aggressive resumed the autopilot, the tank ran about).
+ // at and never pull the next pack (playtest, Deadmines 2026-10-10: Aggressive resumed the autopilot, the tank ran about).
bool release_owner_lead(bool autopilot_window = true)
{
const bool a = set_owner_follow_order(false);
const bool b = end_fallback();
const bool c = end_pull_back();
+ end_owner_use();
int64_t const now_ms = std::chrono::duration_cast(
std::chrono::steady_clock::now().time_since_epoch()).count();
owner_order_until_.store(now_ms + 15000, std::memory_order_relaxed);
@@ -835,7 +847,7 @@ public:
// Owner "pull back" order (BotCommandParser OrderPullBack, main tank only): open on the target
// from range, run back to the return point (the rally point, else where the tank stood) with
// the mob following, and tank it there (States::PullBackTick). Suspends the autopilot like a
- // fallback. Written by the chat handler (world thread), advanced by the AI worker; same mutex.
+ // fallback. Written by the chat handler (world thread), advanced by the bot worker; same mutex.
enum class PullBackPhase : uint8 { Pull = 0, Retreat = 1, Hold = 2 };
struct PullBackPlan
{
@@ -902,9 +914,35 @@ public:
RallyPoint rally_point() const
{ std::lock_guard lk(fallback_mtx_); return rally_point_; }
void set_rally_point(uint32 map, float x, float y, float z); // BotAI.cpp (stamps GameTime)
+ // Owner "use " (BotCommandParser): walk to this game object and use it once (an altar, brazier, lever, orb); the
+ // bot then stays put, so a ritual's channel is not broken by a follow. Written by the chat handler (world thread), run by
+ // the bot worker (idle:owner_use); same mutex as the fallback. Ends on use, death, map change or after 30 s.
+ struct OwnerUseOrder { bool set = false; uint32 map = 0; ObjectGuid go; float x = 0.f, y = 0.f, z = 0.f; uint32 set_ms = 0; };
+ bool owner_use_active() const { return owner_use_active_.load(std::memory_order_relaxed); }
+ OwnerUseOrder owner_use_order() const
+ { std::lock_guard lk(fallback_mtx_); return owner_use_; }
+ void start_owner_use(OwnerUseOrder o)
+ {
+ std::lock_guard lk(fallback_mtx_);
+ o.set = true;
+ owner_use_ = o;
+ owner_use_active_.store(true, std::memory_order_relaxed);
+ }
+ bool end_owner_use()
+ {
+ std::lock_guard lk(fallback_mtx_);
+ owner_use_ = {};
+ return owner_use_active_.exchange(false, std::memory_order_relaxed);
+ }
// The ranged opener (Throw / Shoot) failed NO_AMMO: remembered so a pull back does not pick it again (world thread
- // writes via note_cast_outcome, AI worker reads).
+ // writes via note_cast_outcome, bot worker reads).
uint32 last_no_ammo_ms() const { return last_no_ammo_ms_.load(std::memory_order_relaxed); }
+ // The [move_to_refused] diagnostics are limited to one a `gap_ms` per bot.
+ bool dedup_log_due(uint32 now_ms, uint32 gap_ms)
+ {
+ uint32 last = move_refused_log_ms_.load(std::memory_order_relaxed);
+ return now_ms - last > gap_ms && move_refused_log_ms_.compare_exchange_strong(last, now_ms);
+ }
// Battleground-run mode (mirrors DungeonRunMode for BG context).
// Active when bot is in a battleground; drives objective-aware
@@ -1144,11 +1182,19 @@ public:
// Last server-time (ms) the bot idle-rotated to "look at" a nearby NPC
// (idle:look_at_npc). Drives a jittered 30-60s cadence so bots aren't
// eerily still in a hub. 0 = primed (fire on first eligible tick).
+ // Next time (module ms; 0 = not seeded yet) the rule in throttle slot `slot` may be looked at for this bot. IdleRuleRegistry::tick.
+ uint32& gate_next_ms(size_t slot, size_t total)
+ {
+ if (gate_next_ms_.size() < total) gate_next_ms_.resize(total, 0u);
+ return gate_next_ms_[slot];
+ }
uint32 last_look_around_ms() const { return last_look_around_ms_; }
void set_last_look_around_ms(uint32 v) { last_look_around_ms_ = v; }
// Last server-time (ms) the bot struck a sustained "state" emote
// (idle:ambient_state_emote — dance/sit/sleep while idle in a hub).
// Low-frequency; 0 = primed.
+ uint32 last_town_show_ms() const { return last_town_show_ms_; } // last duel / campfire (Bot/TownLife.h)
+ void set_last_town_show_ms(uint32 v) { last_town_show_ms_ = v; }
uint32 last_ambient_state_emote_ms() const { return last_ambient_state_emote_ms_; }
void set_last_ambient_state_emote_ms(uint32 v) { last_ambient_state_emote_ms_ = v; }
uint32 last_guild_babble_ms() const { return last_guild_babble_ms_; }
@@ -1515,7 +1561,7 @@ public:
// and the backoff is continuously re-armed => a PERMANENT FREEZE over a
// perfectly valid navmesh (live: bot 164465, dst=(1848.1,1530.5,123.4),
// "[move_lock] reason=path_fail_backoff" repeating forever, headless
- // probes proved the mesh itself was fine). This ring lets the AI side
+ // probes proved the mesh itself was fine). This ring lets the bot logic side
// remember "that spot was just refused by the API" so the NEXT tick's
// candidate selection (dungeon step-emit sites, route-follower crumb
// scan) can skip it and try a DIFFERENT candidate instead of
@@ -2114,11 +2160,17 @@ public:
uint32 last_quest_diag_ms() const { return last_quest_diag_ms_; }
void set_last_quest_diag_ms(uint32 ms) { last_quest_diag_ms_ = ms; }
+ // Throttle stamp for the `[quest_accept_stall]` diagnostic in QuestRules: an offer in sight that idle:quest_accept
+ // did not act on. One line per bot per 30s.
+ uint32 last_accept_stall_diag_ms() const { return last_accept_stall_diag_ms_; }
+ void set_last_accept_stall_diag_ms(uint32 ms) { last_accept_stall_diag_ms_ = ms; }
+
// Throttle stamp for the `[wander_reason]` diagnostic in
// State_Idle. One log line per bot per 60s — wander fires 1000+/min
// fleet-wide so anything tighter would drown the log.
uint32 last_wander_diag_ms() const { return last_wander_diag_ms_; }
::Playerbot::V2::IdleWatch& idle_watch() { return idle_watch_; }
+ ::Playerbot::V2::WalkOrder& walk_order() { return walk_order_; } // the spawner's arrive / leave request (WalkOrder.h)
::Playerbot::BgTactics::StallWatch& bg_stall() { return bg_stall_; }
void set_last_wander_diag_ms(uint32 ms) { last_wander_diag_ms_ = ms; }
@@ -2665,7 +2717,7 @@ public:
// Coordinator-order movement: re-assert the move every 3s
// while marching on the ordered target (combat knockbacks,
// CC and local melee shuffles interrupt the path), without
- // spamming a move_to every AI tick.
+ // spamming a move_to every bot tick.
return 3u * 1000u;
case ActionKind::RaidIcon:
// One icon-set attempt per target per 10s — a refused set
@@ -2869,7 +2921,7 @@ public:
// --- RPG / idle life (Bot/States/Rules/RpgRules.cpp, port of ike3 "rpg") ---
// A world bot in a town strolls from NPC to NPC (visit = approach, then
// linger), and now and then travels to a city or auction house (trip).
- // Owned and read only by the rpg rules on this bot's AI tick.
+ // Owned and read only by the rpg rules on this bot's bot tick.
struct RpgState
{
// Current NPC visit. The target is a TownNpcIndex spawn; its live guid
@@ -3107,7 +3159,7 @@ private:
public:
uint32 rule_fire_seq() const { return rule_fire_seq_; }
- // [dps_idle] tracker (AI worker; State_InCombat's end-of-tick probe).
+ // [dps_idle] tracker (bot worker; State_InCombat's end-of-tick probe).
// idle_since = first tick of the current no-action streak (0 = acting),
// logged = when the streak was last reported (throttle, 10 s per bot).
struct CombatIdleState
@@ -3182,9 +3234,12 @@ private:
FallbackPlan fallback_plan_;
RallyPoint rally_point_;
std::atomic last_no_ammo_ms_{0};
+ std::atomic move_refused_log_ms_{0};
std::atomic fallback_active_{false};
PullBackPlan pull_back_plan_;
std::atomic pull_back_active_{false};
+ OwnerUseOrder owner_use_;
+ std::atomic owner_use_active_{false};
mutable std::mutex manual_travel_mtx_; // guards manual_travel_ (parser writes / builder reads+clears, cross-thread)
bool travel_force_graph_ = false;
uint64 poi_prog_key_ = 0;
@@ -3303,6 +3358,7 @@ private:
uint32 manual_mode_until_ms_ = 0;
uint32 last_owner_command_ms_ = 0;
uint32 owner_attack_ms_ = 0;
+ uint32 owner_pull_ms_ = 0;
std::string last_owner_name_;
uint8 formation_slot_ = 0;
FormationType formation_type_ = FormationType::Free;
@@ -3316,6 +3372,7 @@ private:
std::atomic owner_follow_order_{false};
std::atomic owner_stance_{0}; // OwnerStance
bool raid_map_party_hold_ = false;
+ bool owner_hold_ = false; // an owner Stay / Hold is on: the autopilot walks nobody (update_dungeon_autopilot_hold)
bool human_lead_hold_ = false; // see human_lead_hold()
uint32 human_seen_ms_ = 0; // last tick a leading human was in range (0 = never)
std::atomic human_release_until_{0}; // steady-clock ms: autopilot allowed until then
@@ -3359,14 +3416,14 @@ private:
uint32_t last_built_ms = 0u;
BattlegroundAdvice cached;
};
- // OWNED BY THE AI WORKER THREAD. BgDispatch reassigns `cached`'s heap
+ // OWNED BY THE bot logic WORKER THREAD. BgDispatch reassigns `cached`'s heap
// vectors on every cache miss (≤2s apart), so no other thread may read
// this struct — world-thread consumers use published_bg_advice_ below.
BgAdviceCache bg_advice_cache_;
public:
// World-thread-readable advice mirror (adversarial review 2026-06-10:
// the snapshot builder's bg_role block read bg_advice_cache_.cached
- // directly from the world thread while the AI worker reassigned its
+ // directly from the world thread while the bot worker reassigned its
// vectors — use-after-free window every cache rebuild). On each
// rebuild the worker publishes an IMMUTABLE copy through a C++20
// atomic (same pattern as SnapshotPublisher slots);
@@ -3468,7 +3525,9 @@ private:
bool verbose_logging_ = false;
uint32 last_ambient_emote_ms_ = 0;
uint32 last_look_around_ms_ = 0;
+ std::vector gate_next_ms_; // per-bot throttle table of the idle rules
uint32 last_ambient_state_emote_ms_ = 0;
+ uint32 last_town_show_ms_ = 0;
uint32 last_guild_babble_ms_ = 0;
uint32 last_yell_lfg_ms_ = 0;
// Per-bot throttle on the snapshot builder's 500y hub-radius scan.
@@ -3477,7 +3536,7 @@ private:
// Cell::VisitAllObjects every world frame (50Hz) — 10-25K wide-scans/sec.
// 1s cadence is plenty: hub quest-givers don't move, and the smaller
// 40y scan still captures the immediate neighborhood every tick.
- // Builder reads/writes; AI worker doesn't touch this field.
+ // Builder reads/writes; bot worker doesn't touch this field.
uint32 last_hub_scan_ms_ = 0;
// Same throttle pattern for the 200y extended gather-node scan
// (perf audit #3 — capital-clustered gatherers also fire this
@@ -3982,11 +4041,13 @@ private:
// BotSnapshotBuilder. Single uint32 since the diagnostic logs once
// per bot per 5s regardless of quest_id.
uint32 last_quest_diag_ms_ = 0;
+ uint32 last_accept_stall_diag_ms_ = 0;
uint32 last_moving_ms_ = 0; // for idle:ambient_sit sustained-idle gate
// Throttle for the `[wander_reason]` diagnostic — 1 line per bot
// per 60s. Wander fires ~1000+/min fleet-wide.
uint32 last_wander_diag_ms_ = 0;
::Playerbot::BgTactics::StallWatch bg_stall_; // battleground stand-still watchdog (State_Idle bg_stall)
+ ::Playerbot::V2::WalkOrder walk_order_;
::Playerbot::V2::IdleWatch idle_watch_; // world-wide standing-still detector (DispatchIdle)
// Cached corpse → graveyard distance. Recomputing every snapshot tick
// walks `WorldSafeLocsEntry` against `sConditionMgr` for every nearby
@@ -4018,15 +4079,15 @@ public:
// Optimistic per-spell emit cooldown. Modern WoW puts most abilities on
// a server-side cooldown the moment they cast — but the snapshot that
// reflects that cooldown is published on the next world tick (~200 ms
- // later). Between emit and snapshot reflection, the AI worker may tick
+ // later). Between emit and snapshot reflection, the bot worker may tick
// again on the SAME stale snapshot and re-emit the same cast intent;
// the API rejects with SPELL_FAILED_NOT_READY (91) and the rule fires
// again next tick. Result: 4-5 redundant emits per real cooldown cycle,
// each producing a Server.log rejection line.
//
- // Lock the spell out on the AI side for ~1.5 s after emit (covers the
+ // Lock the spell out on the bot logic side for ~1.5 s after emit (covers the
// GCD plus snapshot publish lag). The next snapshot's real cooldown
- // table catches up before the lockout expires, so the AI never sees
+ // table catches up before the lockout expires, so the bot logic never sees
// a "ready" window the server disagrees with.
static constexpr uint32 kCastEmitLockoutMs = 1500u;
// Longer back-off used when the API REJECTED a cast (vs the short
@@ -4061,6 +4122,21 @@ public:
gcd_emit_until_ms_.store(now_ms + len, std::memory_order_relaxed);
}
void clear_gcd_started() { gcd_emit_until_ms_.store(0, std::memory_order_relaxed); }
+ // A caster at its mana-item threshold whose potion is held back by the cast in flight: no new hard cast starts until the item
+ // is used or the window ends (a healer chaining Greater Heals never has an idle tick, so it never drank).
+ // A break that ended without an item going out is not started again for 12 s, so an item the core keeps refusing cannot starve the
+ // caster of casts.
+ void note_mana_break(uint32 now_ms)
+ {
+ uint32 const until = mana_break_until_ms_.load(std::memory_order_relaxed);
+ if (now_ms < until)
+ return; // already running; the window is not extended
+ if (until && now_ms - until < 12000u)
+ return;
+ mana_break_until_ms_.store(now_ms + 4000u, std::memory_order_relaxed);
+ }
+ void clear_mana_break() { mana_break_until_ms_.store(0, std::memory_order_relaxed); }
+ bool mana_break_active(uint32 now_ms) const { return now_ms < mana_break_until_ms_.load(std::memory_order_relaxed); }
bool gcd_recently_started(uint32 now_ms) const { return now_ms < gcd_emit_until_ms_.load(std::memory_order_relaxed); }
// The core said NOT_READY: lock the spell out for what its cooldown / the GCD still has
// to run (min 250 ms), instead of re-emitting it every tick against a stale snapshot.
@@ -4256,7 +4332,7 @@ public:
// Tier 4 (> 60 s): hearth home (or release-corpse fallback)
// Reset whenever distance drops by >= 5 y (real progress) or the goal
// changes (different target). Stays within BotAI for thread-safety:
- // builder reads/writes from the world thread; AI worker reads to drive
+ // builder reads/writes from the world thread; bot worker reads to drive
// the rule. Eventually-consistent — a stale read just delays escalation
// by one tick.
struct StuckTracker
@@ -4375,8 +4451,8 @@ public:
// non-walk bridge (areatrigger teleport / ship / portal)?" decision, keyed
// by the hub goal so the builder runs the FindRoute probe only once per goal
// change (not per tick). POD (uint64+bool) written + read ONLY on the world
- // thread (the snapshot builder) — never touched by the AI worker, so unlike
- // the travel_plan_ vector it needs no cross-thread synchronization. The AI
+ // thread (the snapshot builder) — never touched by the bot worker, so unlike
+ // the travel_plan_ vector it needs no cross-thread synchronization. The bot logic
// worker sees the result purely through the snapshot's objective_is_relocation
// flag the builder sets from it.
uint64 reloc_bridge_goal_key() const { return reloc_bridge_goal_; }
@@ -4436,7 +4512,7 @@ public:
// bad route. The anchor-wedge cooldown returns "wedged" every tick for 30s,
// so this timestamp gates the skip to once per few seconds — letting the bot
// start moving toward the skipped-to leg before another skip is considered.
- // AI-worker-only (like travel_plan_): no cross-thread synchronization.
+ // bot-worker-only (like travel_plan_): no cross-thread synchronization.
uint32 last_leg_skip_ms() const { return last_leg_skip_ms_; }
void set_last_leg_skip_ms(uint32 ms) { last_leg_skip_ms_ = ms; }
// One-shot escalation: the next driveTravelPlanTo for ANY goal routes
@@ -4448,7 +4524,7 @@ public:
// The reloc-bridge probe's VALIDATED route legs (source attaches checked
// against the live navmesh). World-thread only, like the reloc_bridge
// decision POD: written by the probe, read by the builder when copying
- // into the snapshot's bridge_route. The AI worker consumes them via the
+ // into the snapshot's bridge_route. The bot worker consumes them via the
// snapshot — it must NOT recompute the route itself (its FindRoute can't
// validate attaches off the world thread, so it would get the
// unexecutable euclidean route a wedged bot can't follow).
@@ -4561,7 +4637,7 @@ public:
// The adjustment is a percentage applied ABOVE the hard quality floor in
// AuctionRules, so the floor still clamps the discount — the loop can never
// dump an item below its band floor regardless of how many times it
- // expires. Single-writer (AI worker thread), same model as the other
+ // expires. Single-writer (bot worker thread), same model as the other
// per-bot retry caches below.
struct SellPriceMemo
{
@@ -4621,7 +4697,7 @@ public:
// detects "distance to the leader isn't dropping" so the rule can fall
// back from follow to an explicit, navmesh-validated move_to toward the
// leader (which then engages the walk-first unstick ladder). No teleport.
- // Single-writer (AI worker) — same threading model as the wedge maps.
+ // Single-writer (bot worker) — same threading model as the wedge maps.
struct FollowProgress { uint64 anchor = 0; float last_dist = 0.f; uint32 stale_ticks = 0; uint32 last_repath_ms = 0; };
// Throttle for the validated follow-repath move_to. The follow rule fires
// every tick; without this a follower whose leader is unreachable would
@@ -4711,6 +4787,8 @@ private:
std::unordered_map cast_emit_until_ms_;
// End of the global cooldown the last emitted GCD-bound cast starts (note_gcd_started).
std::atomic gcd_emit_until_ms_{0};
+ // End of the mana break (note_mana_break).
+ std::atomic mana_break_until_ms_{0};
// Per-item-entry equip retry cooldown — see kEquipTryLockoutMs above.
std::unordered_map equip_try_until_ms_;
// Per-hub blacklist for unproductive arrivals — see kHubTriedLockoutMs.
@@ -5177,7 +5255,7 @@ public:
// anchor blacklisting in the snapshot requires the Builder to know
// which anchor failed, but path_blocked_count() is global per-bot
// (path failures from any rule increment it). By tracking baselines
- // per rule name on the AI side, each rule independently sees "from
+ // per rule name on the bot logic side, each rule independently sees "from
// the moment I started firing, has the global block count grown by
// K?" — a clean wedge detector that doesn't need anchor identity.
//
diff --git a/src/modules/PlayerbotV2/Bot/BotActivityTier.h b/src/modules/PlayerbotV2/Bot/BotActivityTier.h
index 3b9c45b728..7866cf874d 100644
--- a/src/modules/PlayerbotV2/Bot/BotActivityTier.h
+++ b/src/modules/PlayerbotV2/Bot/BotActivityTier.h
@@ -10,7 +10,7 @@ struct BotSnapshot; // forward — full type in BotSnapshot.h
// Tick frequency table — lower = more reactive, more CPU. On a 5950X
// with 33% baseline CPU and ~1100 of 1237 bots sitting in Idle tier,
-// halving Idle roughly doubles aggregate AI work and lifts quality
+// halving Idle roughly doubles aggregate bot logic work and lifts quality
// across the fleet (faster BG pivots, smoother movement, snappier
// social timing). Active also bumped a notch since travelling/questing
// bots want quick re-evaluation. Combat unchanged — already at 10 Hz
@@ -20,7 +20,7 @@ struct BotSnapshot; // forward — full type in BotSnapshot.h
// population: a solo, open-world bot that is merely travelling or
// questing (moving OR has an objective) but is NOT human-facing
// (unowned, ungrouped-with-real, no real player nearby), NOT path-blocked,
-// and NOT casting. Such a bot's movement spline is server-side; the AI
+// and NOT casting. Such a bot's movement spline is server-side; the bot logic
// only needs to issue the next waypoint a touch less often, so it
// tolerates 300 ms. This roughly halves snapshot-build cost for the
// questing fleet that previously pinned every moving/objective bot to
@@ -37,7 +37,7 @@ struct BotSnapshot; // forward — full type in BotSnapshot.h
// tail of idle city/inn bots). 2000 ms is deliberately capped at the
// AiWorkerPool staleness guard's 1000 ms ceiling × 2 — a parked bot's
// snapshot can be up to one Parked period old, which only ever causes
-// the worker to *skip* that AI tick (stale_skip), never to act on bad
+// the worker to *skip* that bot tick (stale_skip), never to act on bad
// data or repath; the next scheduler pass re-builds fresh. See
// AiWorkerPool.cpp staleness guard. Any wake event (combat / owner
// control / movement / a real player arriving) demotes the bot back to
diff --git a/src/modules/PlayerbotV2/Bot/BotChatReactor.cpp b/src/modules/PlayerbotV2/Bot/BotChatReactor.cpp
index a9630f41cd..46dad8e437 100644
--- a/src/modules/PlayerbotV2/Bot/BotChatReactor.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotChatReactor.cpp
@@ -745,7 +745,11 @@ void BotChatReactor::React(Player* sender, Group* group, std::string const& msg)
else /* go */
{
mai->set_chat_pause_until_ms(0);
- mai->release_owner_lead(); // DungeonFlow: "go" opens the human-lead release window
+ // DungeonFlow: only "go" opens the human-lead release window. "pull" / "pulling" / "engage" are the owner's own
+ // orders (their handlers decide what the autopilot may do); opening the window for every bot on them let the
+ // tank autopilot pull on and run back and the casters wander (Deadmines 2026-10-14).
+ if (ContainsWord(norm, "go"))
+ mai->release_owner_lead();
}
}
}
diff --git a/src/modules/PlayerbotV2/Bot/BotCommandParser.cpp b/src/modules/PlayerbotV2/Bot/BotCommandParser.cpp
index 45b1b225bb..cdd54ae0d3 100644
--- a/src/modules/PlayerbotV2/Bot/BotCommandParser.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotCommandParser.cpp
@@ -275,6 +275,7 @@ void SetOwnerFollowOrder(Player const* bot, bool on, bool autopilot_window = tru
{
ai->end_fallback();
ai->end_pull_back();
+ ai->end_owner_use();
ai->set_owner_follow_order(true);
}
else
@@ -447,6 +448,7 @@ void OrderFallback(Player* sender, Player* bot)
ai->exit_manual();
ai->set_owner_follow_order(false);
ai->end_pull_back();
+ ai->end_owner_use();
ai->start_fallback(plan);
ai->set_last_owner_name(sender->GetName());
TC_LOG_INFO("playerbot.v2",
@@ -477,7 +479,7 @@ bool RaidPullGateAllows(Player const* bot_c, Unit const* target)
return vp && BotCommandParser::BotRole(const_cast(vp)) == Role::Tank;
}
Group const* grp = bot->GetGroup();
- // A tank with an owner icon assignment pulls its own mob whatever the main-tank flag says (Karrz, MC Garr 2026-10-08: with a
+ // A tank with an owner icon assignment pulls its own mob whatever the main-tank flag says (playtest, MC Garr 2026-10-08: with a
// flagged main tank only that tank went, and the adds killed it).
if (grp && BotCommandParser::BotRole(bot) == Role::Tank)
for (auto const& [tank_low, marker] : Services::Owners().TankMarks(grp->GetGUID().GetCounter()))
@@ -503,11 +505,13 @@ bool RaidPullGateAllows(Player const* bot_c, Unit const* target)
if (tank_low == bot->GetGUID().GetCounter()) return true;
return false;
}
+ // Only a LIVE lower-guid tank holds the pull: the group coordinator picks the first live tank, so a dead one must not
+ // leave the raid without a puller after a wipe.
for (Group::MemberSlot const& slot : grp->GetMemberSlots())
{
if (slot.guid == bot->GetGUID() || slot.guid.GetCounter() >= bot->GetGUID().GetCounter()) continue;
Player* other = ObjectAccessor::FindConnectedPlayer(slot.guid);
- if (other && Services::Registry().has(BotId(slot.guid.GetCounter())) &&
+ if (other && other->IsAlive() && Services::Registry().has(BotId(slot.guid.GetCounter())) &&
BotCommandParser::BotRole(other) == Role::Tank)
return false;
}
@@ -542,6 +546,47 @@ Unit* RtiPullTarget(Player* bot)
return nullptr;
}
+// "attack" with nothing selected: the mob the group is already fighting. The owner's own victim first, then a group member's victim
+// (the tank's before the others'), then the hostile nearest the owner that is attacking any group member. nullptr when the group fights nothing.
+Unit* AttackFallbackTarget(Player* sender, Player* bot)
+{
+ auto usable = [&](Unit* u) -> Unit*
+ {
+ return u && !u->IsPlayer() && u->IsAlive() && bot->IsValidAttackTarget(u) ? u : nullptr;
+ };
+ if (Unit* u = usable(sender->GetVictim()))
+ return u;
+ Group* grp = bot->GetGroup();
+ if (!grp)
+ return nullptr;
+ Unit* tank_victim = nullptr;
+ Unit* other_victim = nullptr;
+ Unit* nearest = nullptr;
+ float nearest_d = 0.f;
+ for (GroupReference const& itr : grp->GetMembers())
+ {
+ Player* m = itr.GetSource();
+ if (!m || !m->IsAlive() || m->GetMapId() != bot->GetMapId())
+ continue;
+ if (Unit* v = usable(m->GetVictim()))
+ {
+ if (!tank_victim && m != sender && Services::Registry().has(m->GetGUID().GetCounter()) && BotCommandParser::BotRole(m) == Role::Tank)
+ tank_victim = v;
+ else if (!other_victim)
+ other_victim = v;
+ }
+ for (Unit* at : m->getAttackers())
+ if (Unit* u = usable(at))
+ {
+ float const d = sender->GetDistance(u);
+ if (!nearest || d < nearest_d) { nearest = u; nearest_d = d; }
+ }
+ }
+ if (tank_victim) return tank_victim;
+ if (other_victim) return other_victim;
+ return nearest;
+}
+
// Owner "pull back" (also "pullback", "pull and back"): the main tank opens on the owner's selected mob (else the
// skull / own rti mark) from range, runs back to the rally point (set with "rally here") or, with none, to where it
// stood, and tanks the mob there (BotAI::PullBackPlan, States::PullBackTick). Tank role only; in a raid map the
@@ -554,7 +599,7 @@ bool OrderPullBack(Player* sender, Player* bot)
BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
if (!ai || !bot->IsAlive() || bot->GetMapId() != sender->GetMapId())
return true;
- // Owner-assigned tank icons (assign , Karrz 2026-10-08): with any in the group only those tanks pull, each
+ // Owner-assigned tank icons (assign , playtest 2026-10-08): with any in the group only those tanks pull, each
// on its own icon's mob; the other tanks, and everyone else, stand by until a mob is brought back.
bool assigned_pull = false;
Unit* target = nullptr;
@@ -1574,7 +1619,8 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
return refuse("you are in a battleground");
if (bm && bm->Instanceable() && bot->GetMapId() != sender->GetMapId())
return refuse("I am inside an instance - walk out first");
- if (sm && sm->Instanceable() && bot->GetMapId() != sender->GetMapId())
+ // Into the owner's instance only as a member of the owner's group (the door checks and their log are API::teleport_to's).
+ if (sm && sm->Instanceable() && bot->GetMapId() != sender->GetMapId() && !(bot->GetGroup() && bot->GetGroup() == sender->GetGroup()))
return refuse("you are inside an instance - invite me and walk in with the group");
Push(bot, TeleportToIntent{sender->GetMapId(), sender->GetPositionX(), sender->GetPositionY(),
sender->GetPositionZ(), sender->GetOrientation()});
@@ -1596,6 +1642,10 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
{
if (ai->set_owner_stance(BotAI::OwnerStance::Passive))
TC_LOG_INFO("playerbot.v2", "[owner_order] {} <- {}: passive (starts no fights until attack / pull)", me, sender->GetName());
+ // Passive after an Attack / Pull ends that order's 15 s window and its Engage at once; a Stay / Hold is kept.
+ ai->close_owner_order_window();
+ if (ai->owner_command() == BotAI::OwnerCommand::Engage)
+ ai->exit_manual();
ai->set_last_owner_name(sender->GetName());
}
say(me + ": passive, defending only until you say attack or pull");
@@ -1608,8 +1658,12 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
if (ai->set_owner_stance(BotAI::OwnerStance::Aggressive))
TC_LOG_INFO("playerbot.v2", "[owner_order] {} <- {}: aggressive (attacks hostiles within {:.0f} yd of the owner)", me,
sender->GetName(), BotAI::kAggressiveRadiusYd);
- ai->exit_manual();
- ai->release_owner_lead(false);
+ // A Stay / Hold stays: aggressive changes the stance only (it used to cancel the Stay silently).
+ if (!ai->holding_position(GameTime::GetGameTimeMS()))
+ {
+ ai->exit_manual();
+ ai->release_owner_lead(false);
+ }
}
say(fmt::format("{}: aggressive, attacking anything hostile within {:.0f} yards of you", me, BotAI::kAggressiveRadiusYd));
return true;
@@ -1620,6 +1674,9 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
if (BotAI* ai = Services::Registry().ai(bid))
{
ai->enter_manual(BotAI::OwnerCommand::Hold, ObjectGuid::Empty, GameTime::GetGameTimeMS(), BotAI::kHoldPositionTtlMs);
+ // Defensive replaces an Aggressive stance (a Passive one already fights only what attacks); the Hold does the rest.
+ if (ai->owner_stance() == BotAI::OwnerStance::Aggressive)
+ ai->set_owner_stance(BotAI::OwnerStance::Auto);
ai->set_last_owner_name(sender->GetName());
}
say(me + ": defensive, holding here and fighting only what attacks");
@@ -1643,7 +1700,7 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
} // anonymous
-// Owner's "release" order (ike3's ReleaseSpiritAction / Karrz's "release"),
+// Owner's "release" order (ike3's ReleaseSpiritAction / the owner's "release"),
// also taken when the owner releases their own spirit (Module::
// OnSpiritReleased): a dead bot releases its spirit now and runs back to its
// corpse as a ghost, or, dying inside a dungeon / raid, revives at the
@@ -1660,7 +1717,7 @@ bool BotCommandParser::OrderRelease(Player const* sender, Player const* bot, cha
BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
if (!ai)
return false;
- // An order latched before this death (a revival the AI never saw cleared
+ // An order latched before this death (a revival the bot logic never saw cleared
// nothing) is stale: replace it rather than keep it.
uint32 const held = ai->release_order_ms();
if (held == 0 || (ai->died_at_ms() != 0 && held < ai->died_at_ms()))
@@ -1679,6 +1736,9 @@ void BotCommandParser::ReleaseOwnerFollowOrder(Player const* sender, Player cons
{
if (!bot) return;
BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
+ // A Pull / Pull back the bot does not carry out itself: it waits for the owner's Attack (party, EvaluateThreatHold).
+ if (ai && why && std::string_view(why).find("pull") != std::string_view::npos)
+ ai->note_owner_pull(GameTime::GetGameTimeMS());
if (ai && ai->release_owner_lead(false))
TC_LOG_INFO("playerbot.v2", "[owner_order] {} from {}: follow / fallback order released ({})",
bot->GetName(), sender ? sender->GetName() : std::string("?"), why ? why : "?");
@@ -2587,6 +2647,8 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
if (Services::Config().behavior_owner_follow_hold())
{
ai->end_fallback();
+ ai->end_pull_back();
+ ai->end_owner_use();
ai->set_owner_follow_order(true);
}
}
@@ -2601,7 +2663,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
// relocation objective; the full travel
// pipeline (walk/taxi/portal/ship/areatrigger)
// drives the bot there organically — never a
- // teleport. The bot resumes normal AI on
+ // teleport. The bot resumes normal bot logic on
// arrival (it's a journey, not a parking).
float a1 = 0.f, a2 = 0.f, a3 = 0.f;
const int n_args = std::sscanf(parsed.tail.c_str(), "%f %f %f", &a1, &a2, &a3);
@@ -2997,6 +3059,11 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
{
ai->enter_manual(BotAI::OwnerCommand::Stay, ObjectGuid::Empty,
GameTime::GetGameTimeMS(), BotAI::kHoldPositionTtlMs);
+ // Stay and Follow replace each other, and Stay ends a pull back / fallback that would walk the bot away.
+ ai->set_owner_follow_order(false);
+ ai->end_fallback();
+ ai->end_pull_back();
+ ai->end_owner_use();
ai->set_last_owner_name(sender->GetName());
}
return true;
@@ -3011,6 +3078,10 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
{
ai->enter_manual(BotAI::OwnerCommand::Hold, ObjectGuid::Empty,
GameTime::GetGameTimeMS(), BotAI::kHoldPositionTtlMs);
+ ai->set_owner_follow_order(false);
+ ai->end_fallback();
+ ai->end_pull_back();
+ ai->end_owner_use();
ai->set_last_owner_name(sender->GetName());
}
Push(bot, WhisperIntent{sender->GetName(), "Hold: holding position."});
@@ -3023,7 +3094,9 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
if (BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter()))
{
ai->exit_manual();
- ai->release_owner_lead();
+ // Resume ends the Stay / Follow / fallback / pull back; it does not start the dungeon autopilot (that is "go" or
+ // "run": the 15 s autopilot window made a resumed tank walk off to the next pack on its own).
+ ai->release_owner_lead(false);
Push(bot, WhisperIntent{sender->GetName(), "Resume: autonomous."});
}
return true;
@@ -3095,7 +3168,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
if (!ai)
{
- Push(bot, WhisperIntent{sender->GetName(), "Bgrun: no AI."});
+ Push(bot, WhisperIntent{sender->GetName(), "Bgrun: no bot logic."});
return true;
}
if (parsed.tail == "pause")
@@ -3177,7 +3250,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
{
// Diagnostic: walk all group bots and report their intent-queue depth.
// Useful for spotting stalled bots — if the queue keeps growing, the
- // AI worker can't keep up with the executor or vice versa.
+ // bot worker can't keep up with the executor or vice versa.
const uint32 reported = ForEachGroupBot(bot, [&](Player const* p)
{
IntentQueue* q = Services::Registry().intents(p->GetGUID().GetCounter());
@@ -3281,76 +3354,12 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
}
if (cmd == "pull")
{
- // Coordinated raid pull. Owner says "pull" with the next pull's
- // target selected. Bot pauses N seconds (default 3) before engaging,
- // matching the WoW pull-timer macro convention. Owners can call /pull
- // 5 for a longer countdown when the puller needs to walk to position.
- // When the bot is a raid leader/assistant, also broadcasts a raid
- // warning ("Pulling in Ns!") so the rest of the raid sees the
- // standard pull-timer cue.
- // "pull rti" (Playerbot.Behavior.Ike3Commands): the mob carrying the bot's own rti symbol, not the selection.
- bool const by_rti = parsed.tail.rfind("rti", 0) == 0 && Services::Config().behavior_ike3_commands();
- Unit const* target = by_rti ? RtiPullTarget(bot) : sender->GetSelectedUnit();
- if (!target || target->GetGUID() == bot->GetGUID())
- {
- Push(bot, WhisperIntent{sender->GetName(),
- by_rti ? "Pull: no marked mob for my rti symbol." : "Pull: select an enemy first."});
- return true;
- }
- uint32 ms = args.size() >= 1 ? static_cast(args[0] * 1000ULL) : 3000u;
- if (ms > 60'000) ms = 60'000;
- // Raid map: the pull goes to the main tank only; every other bot ignores it (it follows / assists).
- if (!RaidPullGateAllows(bot, target))
- return true;
- const uint64 id = bot->GetGUID().GetCounter();
- Services::Registry().for_each([&](BotId bid, BotRegistryEntry const& e)
- {
- if (bid != id) return;
- const uint32_t until = GameTime::GetGameTimeMS() + ms;
- const_cast(e).paused_until_ms.store(until, std::memory_order_relaxed);
- });
- // Broadcast a raid warning if the bot can. raid_warning() bails Locked
- // when not allowed, which is fine — solo bots and non-officers just
- // skip the broadcast and still fire the pull on their end.
- Push(bot, RaidWarningIntent{
- fmt::format("Pulling {} in {}s!", target->GetName(), ms / 1000)});
- Push(bot, StartAttackIntent{target->GetGUID()});
- SetOwnerFollowOrder(bot, false, false);
-
- // Broadcast to all OTHER registered bots in the same group: pause
- // them for the same window then engage the same target. Caller bots
- // already had their pause set above. Healers/casters benefit from
- // the synchronized pull window so they can pre-position; melee bots
- // sync their burst CDs.
- if (Group const* grp = bot->GetGroup())
- {
- const ObjectGuid target_guid = target->GetGUID();
- const uint32_t until = GameTime::GetGameTimeMS() + ms;
- uint32 broadcast_count = 0;
- for (GroupReference const& itr : grp->GetMembers())
- {
- Player* member = itr.GetSource();
- if (!member || member == bot) continue;
- const BotId mid = member->GetGUID().GetCounter();
- if (!Services::Registry().has(mid)) continue;
- if (!RaidPullGateAllows(member, target)) continue;
- Services::Registry().for_each([&](BotId bid, BotRegistryEntry const& e)
- {
- if (bid != mid) return;
- const_cast(e).paused_until_ms
- .store(until, std::memory_order_relaxed);
- });
- Push(member, StartAttackIntent{target_guid});
- SetOwnerFollowOrder(member, false, false);
- ++broadcast_count;
- }
- if (broadcast_count > 0)
- Push(bot, WhisperIntent{sender->GetName(),
- fmt::format("Pull: synced to {} group bot(s).", broadcast_count)});
- }
-
- Push(bot, WhisperIntent{sender->GetName(),
- fmt::format("Pull: engaging {} in {}ms.", target->GetName(), ms)});
+ // One Pull, the same as the word in party chat and on the panel (Module::RouteGroupOrder): the tank takes the owner's
+ // selection, everyone else is handed the fight back and waits for the owner's Attack. The old countdown-and-everyone-attacks
+ // path (pause 3 s, StartAttack on the whole group) was a second Pull.
+ if (BotRole(bot) == Role::Tank)
+ return DispatchSingleImpl(sender, bot, "tank");
+ ReleaseOwnerFollowOrder(sender, bot, "pull");
return true;
}
if (cmd == "trinkets")
@@ -3660,7 +3669,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
if (cmd == "queue")
{
// Per-bot intent-queue diagnostic. Reports queue size + capacity
- // so the owner can see whether the AI worker is stalled (queue
+ // so the owner can see whether the bot worker is stalled (queue
// grows) or healthy (queue empties between ticks).
const uint64 id = bot->GetGUID().GetCounter();
IntentQueue* q = Services::Registry().intents(id);
@@ -4061,6 +4070,10 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
"Assist: anchor has no target."});
return true;
}
+ // The same raid pull gate as attack and assist_all: in a raid the main tank opens, so a whispered assist and the
+ // party-chat word (which is rewritten to attack) answer alike.
+ if (!RaidPullGateAllows(bot, ObjectAccessor::GetUnit(*sender, tgt)))
+ return true;
Push(bot, StartAttackIntent{tgt});
SetOwnerFollowOrder(bot, false, false);
return true;
@@ -4107,6 +4120,8 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
// automatically when the target dies (in_combat→Idle transition
// detects empty victim and resets owner_command).
Unit const* target = sender->GetSelectedUnit();
+ if (!target)
+ target = AttackFallbackTarget(sender, bot); // nothing selected: the mob the group is already fighting
if (!target)
{
Push(bot, WhisperIntent{sender->GetName(),
@@ -4127,6 +4142,12 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
cur->owner_command() == BotAI::OwnerCommand::Engage && cur->owner_target() == target->GetGUID() &&
bot->GetVictim() == target)
return true;
+ // Attack is instant for the whole group (playtest, Deadmines 2026-10-15): every bot opens on the owner's target at once, tank
+ // or not. Only Pull and Pull back keep the tank first.
+ // A healer keeps healing on Attack and does not walk in to melee (playtest, Deadmines 2026-10-15): it takes no engage order. Its
+ // own fight logic heals first and casts or wands at the group's target only while nobody needs healing.
+ if (BotRole(bot) == Role::Healer)
+ return true;
Push(bot, StartAttackIntent{target->GetGUID()});
if (BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter()))
{
@@ -4259,6 +4280,9 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
bool const by_icon = target != nullptr;
if (!target)
target = sender->GetSelectedUnit();
+ // Nothing selected: the owner's skull, else cross (the same pick as "pull back" and "pull rti").
+ if (!target)
+ target = RtiPullTarget(bot);
if (!target)
{ Push(bot, WhisperIntent{sender->GetName(),
"Tank: select a pull target first."});
@@ -4495,7 +4519,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
// Broadcast AoE-preference toggle across all group bots. /aoe_all on /
// off / (no arg → toggle each individually). Mutates BotAI state
// directly via Services::Registry().ai(id), since AoE preference is a
- // per-bot AI flag rather than an emitted intent.
+ // per-bot bot logic flag rather than an emitted intent.
const std::string& want = parsed.tail;
const int mode = (want == "on" || want == "1") ? 1
: (want == "off" || want == "0") ? 0
@@ -4628,7 +4652,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
// Owner emergency unstuck. Clears in-flight movement, attack, and
// pending cast. Does NOT touch the snapshot or intent queue (the
// worker drains the queue as a normal-turn result of the next
- // tick), so the bot picks up fresh AI decisions on the next loop.
+ // tick), so the bot picks up fresh bot logic decisions on the next loop.
// Useful when the bot is wedged on a target it can't reach or
// mid-rotation on a target the owner wants to disengage from.
Push(bot, StopMovementIntent{/*clear_generators*/ true});
@@ -5802,7 +5826,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
if (cmd == "distance" || cmd == "dist")
{
// Report distance from bot to sender's selection (default sender).
- // Whisper-only diagnostic; no AI side effect.
+ // Whisper-only diagnostic; no bot logic side effect.
Unit const* tgt = sender->GetSelectedUnit();
if (!tgt) tgt = sender;
const float dist = bot->GetDistance(tgt);
@@ -5875,18 +5899,67 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
}
if (cmd == "use")
{
- // Use the sender's selected target as a game object (chest, herb,
- // ore, quest object). For NPC interaction use the "talk" command
- // instead. The intent is rejected by the API if the selection is
- // not a GameObject.
+ // "use ": the nearest matching game object within 30 y of the bot (an altar, brazier, lever, orb).
+ // The bot walks over, uses it once and stays there (idle:owner_use); "follow" releases it. A ritual such as the UBRS
+ // Blackrock Altar (3 users) completes once enough different players have used it: the owner plus ";Name:use altar" to two bots.
+ // A selected game object still works for clients that can select one.
ObjectGuid selection = sender->GetTarget();
- if (selection.IsEmpty() || !selection.IsGameObject())
+ std::string want = parsed.tail; // lower case (Normalize)
+ size_t const b = want.find_first_not_of(' ');
+ want = b == std::string::npos ? std::string() : want.substr(b);
+ if (want.empty() && !selection.IsEmpty() && selection.IsGameObject())
{
- Push(bot, WhisperIntent{sender->GetName(),
- "Use: select a game object first."});
+ Push(bot, UseObjectIntent{selection});
return true;
}
- Push(bot, UseObjectIntent{selection});
+ if (want.empty())
+ {
+ Push(bot, WhisperIntent{sender->GetName(), "Use: say 'use ' near the object (for example 'use altar')."});
+ return true;
+ }
+ uint32 const want_entry = args.empty() ? 0u : uint32(args.front());
+ std::list nearby;
+ Trinity::GameObjectInRangeCheck check(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 30.0f);
+ Trinity::GameObjectListSearcher searcher(bot, nearby, check);
+ Cell::VisitGridObjects(bot, searcher, 30.0f);
+ GameObject* best = nullptr;
+ float best_d = 1.0e9f;
+ for (GameObject* go : nearby)
+ {
+ if (!go || !go->isSpawned() || go->HasFlag(GO_FLAG_NOT_SELECTABLE))
+ continue;
+ bool const match = want_entry != 0 ? go->GetEntry() == want_entry
+ : Normalize(go->GetGOInfo()->name).find(want) != std::string::npos;
+ if (!match)
+ continue;
+ float const d = bot->GetDistance(go);
+ if (d < best_d) { best_d = d; best = go; }
+ }
+ if (!best)
+ {
+ Push(bot, WhisperIntent{sender->GetName(), fmt::format("Use: no '{}' within 30 yards of me.", want)});
+ return true;
+ }
+ BotAI* ai = Services::Registry().ai(bot->GetGUID().GetCounter());
+ if (!ai)
+ return true;
+ uint32 const now = GameTime::GetGameTimeMS();
+ // Stay, so the follow does not walk the bot off the object (a ritual's channel breaks when the user moves).
+ ai->enter_manual(BotAI::OwnerCommand::Stay, ObjectGuid::Empty, now, BotAI::kHoldPositionTtlMs);
+ ai->set_owner_follow_order(false);
+ ai->end_fallback();
+ ai->end_pull_back();
+ ai->end_owner_use();
+ ai->set_last_owner_name(sender->GetName());
+ BotAI::OwnerUseOrder o;
+ o.map = bot->GetMapId();
+ o.go = best->GetGUID();
+ o.x = best->GetPositionX(); o.y = best->GetPositionY(); o.z = best->GetPositionZ();
+ o.set_ms = now ? now : 1u;
+ ai->start_owner_use(o);
+ Push(bot, WhisperIntent{sender->GetName(), fmt::format("Use: {} ({:.0f} yards), then I stay there.", best->GetGOInfo()->name, best_d)});
+ TC_LOG_INFO("playerbot.v2", "[owner_use] {} ordered to use {} (entry {}) at {:.0f}y", bot->GetName(),
+ best->GetGOInfo()->name, best->GetEntry(), best_d);
return true;
}
if (cmd == "talents_all" || cmd == "talentsall")
@@ -6123,7 +6196,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
BotAI* ai = Services::Registry().ai(id);
if (!ai)
{
- Push(bot, WhisperIntent{sender->GetName(), "WhyIdle: no AI handle."});
+ Push(bot, WhisperIntent{sender->GetName(), "WhyIdle: no bot logic handle."});
return true;
}
const uint32 now_ms = GameTime::GetGameTimeMS();
@@ -6175,7 +6248,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
if (cmd == "stats" || cmd == "status")
{
// Whisper a one-line status report back to the requester. The data
- // comes from the latest published snapshot — same fact base the AI
+ // comes from the latest published snapshot — same fact base the bot logic
// workers see, so this is naturally consistent.
const BotId id = bot->GetGUID().GetCounter();
auto snap = Services::Snapshots().latest(id);
@@ -7254,7 +7327,7 @@ done_dispel:
}
if (cmd == "age")
{
- // Snapshot freshness — diagnostic for AI staleness investigation.
+ // Snapshot freshness — diagnostic for bot logic staleness investigation.
const uint64 id = bot->GetGUID().GetCounter();
auto snap = Services::Snapshots().latest(id);
if (!snap)
diff --git a/src/modules/PlayerbotV2/Bot/BotIntent.h b/src/modules/PlayerbotV2/Bot/BotIntent.h
index dff59aed7a..0b7a12bce5 100644
--- a/src/modules/PlayerbotV2/Bot/BotIntent.h
+++ b/src/modules/PlayerbotV2/Bot/BotIntent.h
@@ -1,4 +1,4 @@
-// BotIntent - Typed messages from AI workers to world thread.
+// BotIntent - Typed messages from bot workers to world thread.
// First iteration carries the load-bearing intent variants; the full set per
// CONTRACTS.md §2.3 lands as subsystems implement the corresponding paths.
@@ -135,7 +135,7 @@ struct VendorSellTrashIntent { ObjectGuid npc; };
struct MakeBagRoomIntent { uint8 min_free = 4; };
struct RepairAllIntent { ObjectGuid npc; bool from_guild_bank; };
// Buy first vendor item matching item_class/item_subclass that the bot meets
-// the level requirement for. Used by auto-restock rules where the AI doesn't
+// the level requirement for. Used by auto-restock rules where the bot logic doesn't
// know the vendor's exact slot layout. `total_count` is the desired quantity;
// the API stops once that many units have been purchased (multiple buy_slot
// calls if the vendor sells the item in stacks
+#include
#include "BotAI.h"
#include "BotSnapshot.h"
#include "BotSnapshotView.h"
@@ -55,7 +57,7 @@ char const* SchoolSpellName(SpellInfo const* si)
uint8 BotIntentEmitter::SpellSchoolMaskOf(uint32 spell_id, uint8 wand_school_mask)
{
// sSpellMgr is a read-only store after load; the Classic APL helpers read
- // it from the AI workers the same way (ApClassicHeal.h).
+ // it from the bot workers the same way (ApClassicHeal.h).
SpellInfo const* si = spell_id ? sSpellMgr->GetSpellInfo(spell_id, DIFFICULTY_NONE) : nullptr;
if (!si) return 0;
// Spell::Spell: a wand user's ranged-attack spell deals the wand's school.
@@ -262,9 +264,31 @@ bool BotIntentEmitter::start_attack(ObjectGuid target)
if (ai_ && school_snap_)
{
BotAI::RaidSchoolState& rs = ai_->raid_school();
+ // Once a minute per bot and mob: the bot flips between the immune mob and its fallback target every tick (Rag's submerge,
+ // MC 2026-10-12: 3807 lines in one fight), and the first line already says why (the [raid_school_why] line names the aura).
+ // start_attack runs on the bot workers, so the pacing map is locked and bounded.
+ static std::mutex sLoggedMutex;
+ static std::unordered_map sLogged;
+ uint64_t const lkey = (school_snap_->guid.GetCounter() << 24) ^ target.GetCounter();
+ uint32_t const lnow = school_snap_->published_at_ms;
+ bool log_now = false;
if (rs.hold_target != target)
+ {
+ std::lock_guard lock(sLoggedMutex);
+ if (sLogged.size() > 4096)
+ sLogged.clear();
+ uint32_t& lat = sLogged[lkey];
+ if (!lat || lnow - lat > 60000)
+ {
+ lat = lnow;
+ log_now = true;
+ }
+ }
+ if (log_now)
+ {
TC_LOG_INFO("playerbot.v2", "[raid_school] {} on {}: immune to every school -> not attacking it",
school_snap_->identity.name, target.ToString());
+ }
rs.hold_target = target;
rs.hold_mask = 0;
}
@@ -272,6 +296,33 @@ bool BotIntentEmitter::start_attack(ObjectGuid target)
}
const bool pushed = emit(StartAttackIntent{target, avoid});
if (pushed && ai_ && school_snap_)
+ {
+ static std::mutex sOpenLogMutex;
+ static std::unordered_map sOpenLog;
+ uint32_t const onow = school_snap_->published_at_ms;
+ uint64_t const okey = (school_snap_->guid.GetCounter() << 24) ^ target.GetCounter();
+ bool open_log = false;
+ {
+ std::lock_guard lock(sOpenLogMutex);
+ if (sOpenLog.size() > 4096)
+ sOpenLog.clear();
+ uint32_t& last = sOpenLog[okey];
+ if (!last || onow - last > 10000u)
+ {
+ last = onow;
+ open_log = true;
+ }
+ }
+ if (open_log)
+ {
+ int in_combat = -1, victim_kind = -1;
+ for (NearbyUnit const& u : school_snap_->combat.nearby_enemies)
+ if (u.guid == target) { in_combat = u.unit_in_combat ? 1 : 0; victim_kind = int(u.victim_kind); break; }
+ TC_LOG_INFO("playerbot.v2", "[attack_start] {} attacks {} stance {} last_rule {} mob in_combat {} victim_kind {}",
+ school_snap_->identity.name, target.ToString(), int(ai_->owner_stance()), ai_->last_rule_fired() ? ai_->last_rule_fired() : "none", in_combat, victim_kind);
+ }
+ }
+ if (pushed && ai_ && school_snap_)
{
BotAI::RaidSchoolState& rs = ai_->raid_school();
uint8 const white = uint8(SPELL_SCHOOL_MASK_NORMAL | school_snap_->consumables.wand_school_mask);
@@ -285,6 +336,11 @@ bool BotIntentEmitter::start_attack(ObjectGuid target)
return pushed;
}
+bool BotIntentEmitter::move_already_emitted(float x, float y, float z) const
+{
+ return ai_ && ai_->move_to_recently_emitted(x, y, z, GameTime::GetGameTimeMS());
+}
+
bool BotIntentEmitter::move_to(float x, float y, float z, bool run, bool direct, bool drop)
{
// Per-bot dedup: skip if the previous move_to went to ~the same XYZ
@@ -297,7 +353,15 @@ bool BotIntentEmitter::move_to(float x, float y, float z, bool run, bool direct,
{
const uint32 now_ms = GameTime::GetGameTimeMS();
if (ai_->move_to_recently_emitted(x, y, z, now_ms))
+ {
+ // Why a move_to returned false (pull back "refused" on flat ground, Deadmines 2026-10-15): the dedup, not the navmesh.
+ // Per bot: one global throttle was used up by the 300+ dedups of background bots, and the squad's lines never showed.
+ if (ai_->dedup_log_due(now_ms, 1000u))
+ TC_LOG_INFO("playerbot.v2",
+ "[move_to_refused] bot={} dst=({:.1f},{:.1f},{:.1f}) direct={} reason=dedup: a move to within 3 y was emitted in the last 1.5 s",
+ ai_->bot_id(), x, y, z, direct ? 1 : 0);
return false;
+ }
// REFUSAL GUARD (emitter-level on purpose). PlayerbotAPI::move_to
// keeps a per-destination path-fail backoff: one failed pathfind
// poisons that dst, every later move_to to ~it returns Locked
@@ -332,6 +396,13 @@ bool BotIntentEmitter::move_to(float x, float y, float z, bool run, bool direct,
const bool pushed = emit(MoveToIntent{x, y, z, run, direct, drop});
if (pushed)
ai_->note_move_to_emitted(x, y, z, now_ms);
+ else
+ {
+ if (ai_->dedup_log_due(now_ms, 1000u))
+ TC_LOG_INFO("playerbot.v2",
+ "[move_to_refused] bot={} dst=({:.1f},{:.1f},{:.1f}) direct={} reason=intent queue refused the push",
+ ai_->bot_id(), x, y, z, direct ? 1 : 0);
+ }
return pushed;
}
return emit(MoveToIntent{x, y, z, run, direct, drop});
@@ -347,11 +418,32 @@ static uint32 GcdLengthMs(uint32 spell_id)
return uint32(si->StartRecoveryTime);
}
+void BotIntentEmitter::hold_casts_for_mana_item()
+{
+ if (ai_)
+ ai_->note_mana_break(GameTime::GetGameTimeMS());
+}
+
+void BotIntentEmitter::end_mana_break()
+{
+ if (ai_)
+ ai_->clear_mana_break();
+}
+
+// A spell with a cast time: the kind a running cast of the same bot would have to finish first.
+static bool HasCastTime(uint32 spell_id)
+{
+ SpellInfo const* si = sSpellMgr->GetSpellInfo(spell_id, DIFFICULTY_NONE);
+ return si && si->CalcCastTime() > 0;
+}
+
bool BotIntentEmitter::cast(uint32 spell_id, ObjectGuid target)
{
+ if (ai_ && ai_->mana_break_active(GameTime::GetGameTimeMS()) && HasCastTime(spell_id))
+ return false;
// Optimistic per-spell emit dedup. The snapshot's spell_cooldowns
// table reflects server-side cooldowns one world-tick after the cast
- // lands; in the ~200-1000ms gap, the AI worker may re-tick on the
+ // lands; in the ~200-1000ms gap, the bot worker may re-tick on the
// same stale snapshot, see "is_ready=true" for a spell whose cast
// just landed, and re-emit. Server rejects with SPELL_FAILED_NOT_READY
// (91) — every rejection logs to Server.log and burns one intent slot.
@@ -359,7 +451,7 @@ bool BotIntentEmitter::cast(uint32 spell_id, ObjectGuid target)
// Solution: track per-spell emit timestamps in BotAI; drop duplicate
// emits within kCastEmitLockoutMs (~1.5s, > snapshot cadence). The
// next snapshot's real cooldown table picks up before the lockout
- // expires, so the AI never sees a "ready" window the server disagrees
+ // expires, so the bot logic never sees a "ready" window the server disagrees
// with.
//
// Skipped when ai_ is null (test harness etc.) — the dedup is
@@ -389,6 +481,8 @@ bool BotIntentEmitter::cast(uint32 spell_id, ObjectGuid target)
bool BotIntentEmitter::cast_rank(uint32 spell_id, ObjectGuid target)
{
+ if (ai_ && ai_->mana_break_active(GameTime::GetGameTimeMS()) && HasCastTime(spell_id))
+ return false;
// Same raid school gate and per-spell emit dedup as cast(); ranks have their own ids.
if (school_blocked(spell_id, target))
return false;
diff --git a/src/modules/PlayerbotV2/Bot/BotIntentEmitter.h b/src/modules/PlayerbotV2/Bot/BotIntentEmitter.h
index 9606252608..d0402e5305 100644
--- a/src/modules/PlayerbotV2/Bot/BotIntentEmitter.h
+++ b/src/modules/PlayerbotV2/Bot/BotIntentEmitter.h
@@ -1,4 +1,4 @@
-// BotIntentEmitter - Push-only handle to a bot's intent queue. Held by AI
+// BotIntentEmitter - Push-only handle to a bot's intent queue. Held by bot logic
// workers during tick. CONTRACTS.md §2.4.
#pragma once
@@ -103,6 +103,9 @@ public:
// direct=true = straight MovePoint spline, no pathfinding (committed
// traversal-link crossings only — see MoveToIntent).
bool move_to(float x, float y, float z, bool run = true, bool direct = false, bool drop = false);
+ // A move_to to ~(x,y,z) was already emitted in the last 1.5 s (the one move_to dedups, returning false). That is a move under way,
+ // not a refusal: callers that count false results as path refusals ask this first.
+ bool move_already_emitted(float x, float y, float z) const;
// ---- Raid damage-school rule (PveOrder::SchoolHint) ----
// The worker pool hands the emitter the snapshot the bot's tick runs on.
@@ -434,6 +437,11 @@ public:
bool equip_item(uint8 from_bag, uint8 from_slot, uint8 to_slot)
{ return emit(EquipItemIntent{from_bag, from_slot, to_slot}); }
+ // Mana break: a mana item is due but a cast is running. Until the item goes out (or 4 s pass) cast()/cast_rank() refuse any
+ // spell with a cast time, so the running cast is the last one and the next tick can use the item.
+ void hold_casts_for_mana_item();
+ void end_mana_break();
+
private:
bool push(Intent i);
// Raid school rule gate for cast()/cast_rank(); see set_school_source.
diff --git a/src/modules/PlayerbotV2/Bot/BotIntentExecutor.cpp b/src/modules/PlayerbotV2/Bot/BotIntentExecutor.cpp
index ae347c8037..181f2da697 100644
--- a/src/modules/PlayerbotV2/Bot/BotIntentExecutor.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotIntentExecutor.cpp
@@ -716,7 +716,7 @@ size_t V2::Module::DrainIntents()
// Per-target StartAttack lockout. Player::Attack returns
// false (→ Result::ServerRefused) when the target is
// immune / phased / faction-locked / vehicle-locked /
- // already attacking with same melee mode etc. The AI rule
+ // already attacking with same melee mode etc. The bot logic rule
// re-emits next snapshot if we don't gate it; without this
// mark, ~5 emits/sec from a single wedged bot saturate
// the executor and stall the world thread (observed 60 s
@@ -906,7 +906,7 @@ size_t V2::Module::DrainIntents()
}
// Per-bot diagnostic ring. Recorded AFTER the API call so the
// captured Result reflects what actually happened, not what
- // the AI worker hoped would happen. Used by /diag .
+ // the bot worker hoped would happen. Used by /diag .
// MoveTo destinations are captured so alternating-target
// loops show verbatim in /diag — an Ok-per-tick stream is
// ambiguous without them (the API's goal-key dedup also
diff --git a/src/modules/PlayerbotV2/Bot/BotRegistry.h b/src/modules/PlayerbotV2/Bot/BotRegistry.h
index 40064b1902..3b2c9e1596 100644
--- a/src/modules/PlayerbotV2/Bot/BotRegistry.h
+++ b/src/modules/PlayerbotV2/Bot/BotRegistry.h
@@ -48,7 +48,7 @@ struct BotRegistryEntry
size_t intent_history_head = 0; // next write slot
size_t intent_history_size = 0; // [0, kIntentHistoryCap]
mutable std::mutex intent_history_mtx;
- // Corpses queued for looting (FIFO). Drained by State_Idle on the AI
+ // Corpses queued for looting (FIFO). Drained by State_Idle on the bot logic
// worker thread; written by V2::Module::OnDeath on the world thread.
// The mutex bridges those threads — without it the deque races (both
// sides do push_back/pop_front). Bounded by kPendingLootMax so a
diff --git a/src/modules/PlayerbotV2/Bot/BotSnapshot.h b/src/modules/PlayerbotV2/Bot/BotSnapshot.h
index 26abfe9fa3..49507b936b 100644
--- a/src/modules/PlayerbotV2/Bot/BotSnapshot.h
+++ b/src/modules/PlayerbotV2/Bot/BotSnapshot.h
@@ -1,5 +1,5 @@
// BotSnapshot - Per-bot immutable snapshot. Built on world thread, consumed
-// read-only by AI workers. See CONTRACTS.md §2.1.
+// read-only by bot workers. See CONTRACTS.md §2.1.
//
// First-iteration shape: includes the load-bearing fields needed by the initial
// state machine (Idle, LoggingIn, Travelling) and APL evaluator. Additional
@@ -73,7 +73,7 @@ struct EquippedItem
uint8 durability_pct;
// First ON_USE spell from ItemTemplate.Effects, or 0 when the item has
// no on-use effect (most weapons/armor; trinkets / engineering tinkers
- // typically carry one). Resolved in the builder so AI can call
+ // typically carry one). Resolved in the builder so bot logic can call
// is_ready(on_use_spell_id) without dragging ItemTemplate into the
// worker thread. Used by InCombat for trinket auto-fire on cooldown.
uint32 on_use_spell_id = 0;
@@ -94,7 +94,7 @@ struct InventoryItem
bool is_quest_item;
// Item level (0 for non-equippable / non-leveled). Lets the auto-equip
// rule compare upgrades against the currently-equipped item without
- // re-resolving the live Item* on the AI worker thread.
+ // re-resolving the live Item* on the bot worker thread.
uint16 item_level;
// Target equipment slot (EQUIPMENT_SLOT_HEAD .. RANGED) the bot would
// wear this item in. Resolved by Player::FindEquipSlot in the builder
@@ -126,7 +126,7 @@ struct InventoryItem
ItemStatBlock stats{};
};
-// One enumerable objective from `Quest::Objectives`. Captured per-tick so AI
+// One enumerable objective from `Quest::Objectives`. Captured per-tick so bot logic
// can decide which one to chase next without round-tripping the world thread
// for every (quest, obj) pair. `type` matches QuestObjectiveType (KILL=0 /
// ITEM=1 / GAMEOBJECT=2 / TALKTO=3 / AREATRIGGER=10 etc); `object_id` is the
@@ -316,7 +316,7 @@ struct NearbyUnit
ObjectGuid victim; // Who this unit is currently attacking (Empty if none).
// For Creature units: lower 32 bits of UNIT_NPC_FLAG_* (vendor/repair/
// banker/trainer/flightmaster/innkeeper/etc). Zero for player units.
- // Lets AI rules find capability-bearing NPCs without round-tripping
+ // Lets bot logic rules find capability-bearing NPCs without round-tripping
// through a per-creature ObjectAccessor lookup.
uint32 npc_flags = 0;
// Dungeon-boss flag (creature_template.flags_extra & 0x10000000).
@@ -350,6 +350,9 @@ struct NearbyUnit
// and wedge InCombat forever firing at a target that never dies (observed
// live: Grimfang frozen 2.5min shooting Valley-of-Trials Training Dummy).
bool is_pacified = false;
+ // The creature is running away (a low-health mob fleeing for help, or feared): its motion is Fleeing, Timed fleeing or
+ // Assistance. Melee do not chase it out of the group.
+ bool is_fleeing = false;
// UNIT_FLAG_UNINTERACTIBLE (0x02000000, the old NOT_SELECTABLE): players
// cannot select/target the unit, and Unit::IsValidAttackTarget rejects it —
// so a bot can NEVER acquire it as a victim. Invisible "stalker" / trigger
@@ -448,12 +451,12 @@ struct NearbyUnit
// sizing (Combat/Apl/ApClassicHeal.h). 0 for friends.
float melee_swing = 0.f;
- // ---- Threat discipline (port of Karrz's GroupPveRestraint /
- // MCRaidHoldDamage / LooseAttackers, ike3-based bots ike3 playerbot). Read by the
+ // ---- Threat discipline (port of the owner's GroupPveRestraint /
+ // MCRaidHoldDamage / LooseAttackers, wow-1.12 ike3 playerbot). Read by the
// builder from the unit's ThreatManager on the build thread; consumed by
// BotSnapshotView::threat_hold() and loose_attacker(). Zero / false on
// units without a threat list (players, threatless creatures).
- // The bot's threat on this unit: max(bot, bot's pet), as Karrz counts it.
+ // The bot's threat on this unit: max(bot, bot's pet), as the owner counts it.
float my_threat = 0.f;
// Highest threat any group TANK (see CombatTargetsState::group_tank)
// within 50y of the unit holds on it. 0 when the group has no tank.
@@ -1074,7 +1077,7 @@ struct WorldQuestEntry
};
// Quest discovery rollup. Lists of nearby questgivers (offers + turn-ins),
// bag items that start a quest, and world-quest givers within range. All
-// resolved by the snapshot builder so AI workers don't round-trip
+// resolved by the snapshot builder so bot workers don't round-trip
// ObjectMgr / Creature::hasInvolvedQuest from the worker thread.
struct QuestDiscoveryState
{
@@ -1203,7 +1206,7 @@ struct QuestLogState
// The VALIDATED bridge route to the objective, computed by the builder's
// world-thread probe with navmesh-checked source attaches (see
// RouteRequest::validate_source_walk). Mirrors BotAI::PlanLeg field-for-
- // field. The AI worker MUST execute these legs instead of recomputing
+ // field. The bot worker MUST execute these legs instead of recomputing
// the route: its own FindRoute can't validate attaches off the world
// thread, so it would produce the euclidean walk-only route the wedged
// bot provably can't follow (the exact failure this exists to fix —
@@ -1387,7 +1390,7 @@ struct CombatTargetsState
// Per-bot navigation telemetry surfaced to rules so they can short-circuit
// when the bot's been wedged. BotAI tracks path failures via
// `note_path_blocked`; the snapshot Builder copies the count + last-time
-// here so AI worker rules can read without dereferencing BotAI directly.
+// here so bot worker rules can read without dereferencing BotAI directly.
//
// `count` is the CONSECUTIVE (current-wedge) count of API::move_to results
// that returned Result::Locked (NoPath / FarFromPolyEnd / Incomplete / Short).
@@ -1470,7 +1473,7 @@ struct BankState
};
// Active group/master loot rolls awaiting the bot's vote. See
-// LootRollEntry for per-row semantics; AI emits LootRollIntent.
+// LootRollEntry for per-row semantics; bot logic emits LootRollIntent.
struct LootRollEntry
{
ObjectGuid loot_object;
@@ -1479,7 +1482,7 @@ struct LootRollEntry
uint8 vote_mask;
bool is_upgrade;
bool is_quest_item;
- // Loot etiquette with a human in the group (Karrz's LootRollAction):
+ // Loot etiquette with a human in the group (the owner's LootRollAction):
// a human group member on the bot's map, and whether one of them could
// use the item and would want it (HumanWouldWantItem).
bool human_in_group = false;
@@ -1494,7 +1497,7 @@ struct LootRollsState
void reset() { loot_rolls.clear(); }
};
-// Nearby GameObjects within ~30yd that the AI cares about (mailbox,
+// Nearby GameObjects within ~30yd that the bot logic cares about (mailbox,
// chests, herbs/ore, fishing holes, questgivers, binders, hazards,
// portals). go_type mirrors GAMEOBJECT_TYPE_*. Sorted by distance so
// the closest survive the bounded cap.
@@ -1551,7 +1554,7 @@ struct MovementState
bool is_mounted = false;
bool is_moving = false;
// True while the CORE is flying the bot on a taxi path (UNIT_STATE_IN_
- // FLIGHT). The AI must do NOTHING during a taxi flight — the
+ // FLIGHT). The bot logic must do NOTHING during a taxi flight — the
// FlightPathMovementGenerator owns movement; any idle rule that emits a
// move_to / teleport (watchdog_escape, unstick, hearth rescue) would
// corrupt the flight. DispatchIdle and GlobalStuckRescue bail on this.
@@ -1597,7 +1600,7 @@ struct EnvironmentState
// Dungeon execution context (Phase A of GROUP_DUNGEON_PLAN.md). Populated
// when bot is inside an instance map so the dungeon-run rules can drive
// tank pulls, interrupt rotation, wipe recovery, and run-completion
-// without round-tripping the InstanceScript from the AI worker. Also holds
+// without round-tripping the InstanceScript from the bot worker. Also holds
// the cheaper "encounter context" pair (npc_id + phase) used by per-script
// hooks. See per-field comments on the legacy flat fields (now consumed)
// for full semantics.
@@ -1670,6 +1673,8 @@ struct PetState
// the assist-pet rule: bot picks up the pet's target so a hunter
// standing idle while his cat melees a mob actually opens up too.
ObjectGuid pet_victim;
+ // The pet's react state (REACT_PASSIVE 0 / DEFENSIVE 1 / AGGRESSIVE 2 / ASSIST 3).
+ uint8 pet_react = 1;
// Mob guids actively engaging the pet (anyone with the pet in
// m_attackers). Capped at 4 to keep the snapshot lean. Drives the
// peel half of assist_pet: when pet melees mob A but mob B is
@@ -1710,6 +1715,7 @@ struct PetState
pet_auras.clear();
stable_pets.clear();
pet_victim = ObjectGuid::Empty;
+ pet_react = 1;
pet_attackers.clear();
pet_taunt_spells.fill(0);
pet_taunt_count = 0;
@@ -2087,7 +2093,7 @@ struct ReputationEntry { uint32 faction_id; int32 standing; uint8 rank; };
// Bot progression rollup. Trained skills, currency wallet, faction
// reputations. Builder writes; rules read via view accessors. Separated
// out so the snapshot publisher can re-use the cached vector across
-// ticks for AI threads where the underlying player object hasn't
+// ticks for bot logic threads where the underlying player object hasn't
// gained new entries (BotSetupPipeline holds the long-term cache;
// snapshot replays into the vector when invalidated).
struct ProgressionState
@@ -2136,7 +2142,7 @@ inline float EquipFitScore(ItemStatBlock const& blk, uint16 item_level,
return v;
}
-// Bag / equipment summary. Cached aggregates the AI consults to gate
+// Bag / equipment summary. Cached aggregates the bot logic consults to gate
// vendor-visit and equip-upgrade decisions without re-walking equipped[] /
// bag_items every tick. bag_free_slots is the count of empty inventory
// slots across all bags (cached because GetFreeInventorySlotCount walks
@@ -2216,7 +2222,7 @@ struct VendorVisitState
void reset() { *this = VendorVisitState{}; }
};
-// Consumables — stack-quantity counts the AI checks for OOC restock and the
+// Consumables — stack-quantity counts the bot logic checks for OOC restock and the
// vendor-visit FSM gate. Built by the snapshot builder by walking bag_items
// and sniffing item class / subclass. Health vs mana potion split is filled
// only when the potion's primary spell effect is heal vs restore (so healers
@@ -2232,6 +2238,9 @@ struct ConsumablesState
// ammo, 1 = arrows, 2 = bullets. ammo_count is every usable projectile in the bags.
uint8 ammo_kind = 0;
uint32 ammo_count = 0;
+ // Item subclass of the weapon in the ranged slot (ITEM_SUBCLASS_WEAPON_*), 0xFF = slot empty. The pull-back opener
+ // picks the shot that weapon fires (Throw / Shoot Bow / Gun / Crossbow), never one the core refuses EQUIPPED_ITEM.
+ uint8 ranged_subclass = 0xFF;
// Wand users (mage / priest / warlock) with a ranged weapon equipped: the
// school mask of its damage (1 << ItemTemplate::GetDamageType(), as
// Spell::Spell sets for a ranged-attack spell such as Shoot). 0 = none.
@@ -2268,7 +2277,7 @@ struct ClassicUpkeepState
struct BgState
{
// Up to PLAYER_MAX_BATTLEGROUND_QUEUES (3 in 12.0) active queues per
- // bot. AI uses count > 0 to gate against re-queuing the same BG.
+ // bot. bot logic uses count > 0 to gate against re-queuing the same BG.
std::vector queues;
// True when the bot is inside a battleground instance (vs queued for /
@@ -2521,7 +2530,7 @@ struct ArchetypeState
// Craft-order board projection (#4B-2(a)). Read-only slice of
// Fleet::CraftOrderBoard surfaced into each bot's snapshot so economy idle
// rules can decide WITHOUT locking the board (the world thread populates this
-// from the board during Build; rules read it on the AI worker thread). All
+// from the board during Build; rules read it on the bot worker thread). All
// fields default to "no order" so an un-populated snapshot is fail-closed.
//
// my_open_order_count : how many Open orders this bot has POSTED as requester
@@ -2596,7 +2605,7 @@ struct BotSnapshot
SnapshotVer version = 0;
BotId bot_id = 0;
TickId world_tick = 0;
- // GameTimeMS at publication. Lets the AI worker compute snapshot age
+ // GameTimeMS at publication. Lets the bot worker compute snapshot age
// ("how stale is this fact base?") and the /age whisper report it.
// Mirrors GameTime::GetGameTimeMS at builder-exit; uint32 so it
// matches the underlying TC clock.
@@ -2646,7 +2655,7 @@ struct BotSnapshot
GuildState guild{};
// Bot's owner character name resolved at snapshot time (empty when
// unowned or the cache lookup fails). Used by mat-share-to-owner mail
- // rule so the AI worker can address mail without round-tripping the
+ // rule so the bot worker can address mail without round-tripping the
// owner registry + character cache from the worker thread.
std::string owner_name;
// Owner character guid (Empty when unowned or account-only ownership).
@@ -2655,6 +2664,9 @@ struct BotSnapshot
// The owner is in the bot's group: the bot is a companion and does what its owner's party does, not world-bot
// errands (questing, vendors, gathering, travel). See IdleRuleRegistry::tick.
bool owner_in_group = false;
+ // Flat distance to the owner when it is on the bot's map, else -1. nearby_friends keeps only the 12 nearest friends, so in a raid
+ // the owner is rarely in it (companion_may_sit).
+ float owner_dist = -1.0f;
// Owner "max dps" / "save mana" (BotAI::tactic_burn / tactic_save_mana), mirrored by the builder.
bool tactic_burn = false;
bool tactic_save_mana = false;
@@ -2706,10 +2718,10 @@ struct BotSnapshot
// semantics.
SecondaryStatsState secondary_stats{};
// (upgrades_pending migrated into bags.upgrades_pending above)
- // Aggregate stack-quantity counts of consumable categories the AI cares
+ // Aggregate stack-quantity counts of consumable categories the bot logic cares
// about for OOC restock decisions. Filled by the builder by walking
// bag_items and sniffing item template GetClass/GetSubClass — saves the
- // AI worker thread from looking up ItemTemplates for every bag item just
+ // bot worker thread from looking up ItemTemplates for every bag item just
// to know "do I have enough food?". Populated for the categories the
// auto-restock rules actually consult; add more as new rules need them.
// (smallest_bag_capacity / has_empty_bag_slot migrated into bags above)
@@ -2777,17 +2789,17 @@ struct BotSnapshot
// questgivers (creature OR game object) that can accept a complete
// quest from the bot's log. Built by walking nearby_friends +
// nearby_objects in the snapshot builder against the bot's complete
- // quests via Creature/GameObject::hasInvolvedQuest. AI iterates and
+ // quests via Creature/GameObject::hasInvolvedQuest. bot logic iterates and
// emits QuestCompleteIntent for the first matching entry — no need
// to round-trip the live world from the worker thread.
using QuestTurnIn = Playerbot::QuestTurnIn;
// Resolved quest offers: pairs of {giver_guid, quest_id} for nearby
// questgivers that have a quest the bot doesn't yet hold and is
- // eligible for. Same shape as quest_turnins. AI emits QuestAcceptIntent.
+ // eligible for. Same shape as quest_turnins. bot logic emits QuestAcceptIntent.
// (quest_turnins / quest_offers migrated into quest_discovery below)
// Bag items that start a quest the bot hasn't picked up yet (modern WoW
// "letter from X" / "mysterious package" pickups). Each entry is the
- // item entry + quest id; AI fires UseItemByEntryIntent to trigger the
+ // item entry + quest id; bot logic fires UseItemByEntryIntent to trigger the
// pickup dialog and the snapshot's normal quest_offers accept path
// takes it from there. Filtered by CanTakeQuest in the builder so we
// don't surface items the bot can't actually start.
@@ -2837,12 +2849,12 @@ struct BotSnapshot
// scenario hasn't started a step yet.
// * current_step_progress : count of completed criteria so far.
using ScenarioStepInfo = Playerbot::ScenarioStepInfo;
- // scenario_step lives inside quest_log. Keep the alias for AI callers
+ // scenario_step lives inside quest_log. Keep the alias for bot logic callers
// that build a ScenarioStepInfo locally (e.g. /dungeon callouts).
// Active group/master loot rolls awaiting the bot's vote — REFACTOR_2
// sub-struct. See LootRollsState / LootRollEntry above for per-row
- // semantics. AI emits LootRollIntent.
+ // semantics. bot logic emits LootRollIntent.
using LootRollEntry = Playerbot::LootRollEntry;
LootRollsState loot{};
@@ -2912,7 +2924,7 @@ struct BotSnapshot
// Returns this object to the exact state of a freshly default-constructed
// BotSnapshot, but RETAINS the heap capacity of every inner container so
// a subsequent Build() can refill without reallocating. The world thread
- // calls this on the prior snapshot ONLY when use_count()==1 (no AI worker
+ // calls this on the prior snapshot ONLY when use_count()==1 (no bot worker
// can still be reading it) — see BotSnapshotBuilder::Build.
//
// COMPLETENESS IS LOAD-BEARING: a member missed here leaks last tick's
@@ -2934,6 +2946,7 @@ struct BotSnapshot
owner_name.clear();
owner_guid = ObjectGuid::Empty;
owner_in_group = false;
+ owner_dist = -1.0f;
tactic_burn = false;
tactic_save_mana = false;
diff --git a/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.cpp b/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.cpp
index 01e941da4f..4b0091a71f 100644
--- a/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.cpp
@@ -1309,7 +1309,7 @@ bool InvTypeMatchesSlot(uint32 inv_type, uint8 slot)
// idle:travel_to_hub). We probe the UnifiedTravelGraph with a throwaway
// FindRoute and cache only the boolean verdict in BotAI keyed by the hub goal —
// a POD the world thread owns exclusively, so (unlike the travel_plan_ vector,
-// which the AI worker owns) there is no cross-thread race. The AI worker's
+// which the bot worker owns) there is no cross-thread race. The bot worker's
// travel-plan executor rebuilds the actual leg list itself when it runs. The
// probe runs once per goal change, never per tick.
// Does the travel graph reach (toMap,tx,ty,tz) from the bot's CURRENT position
@@ -1560,7 +1560,7 @@ float TriggerCreatureZone(Creature const* c, uint32& out_spell)
// snapshot buffer (reset_for_reuse() clears contents but KEEPS heap capacity),
// so a recycled build does near-zero container allocations.
//
-// SAFETY GATE — the AI worker holds a shared_ptr copy of the published
+// SAFETY GATE — the bot worker holds a shared_ptr copy of the published
// snapshot for the duration of its tick (SnapshotPublisher stores it in an
// atomic; latest() hands out a counted copy). A buffer is only
// safe to overwrite when NO ONE else references it. We detect that with
@@ -1598,6 +1598,7 @@ struct SnapRecyclePool
{
// Two retained buffers per bot.
std::unordered_map, 2>> slots;
+ uint32 acquires_since_sweep = 0;
// Returns a cleared, capacity-retaining buffer to build into. Prefers a
// free (use_count==1) retained slot; otherwise allocates fresh.
@@ -1606,8 +1607,12 @@ struct SnapRecyclePool
// Opportunistic bound: if the map has grown large (bot churn /
// never-pruned despawns), drop entries whose BOTH slots are free so
// it can't grow without limit. Cheap amortised sweep, world thread.
- if (slots.size() > 4096)
+ // Also every 2048 acquires: idle workers steal any map's batch, so each thread's pool came to hold buffers for most bots, and a
+ // logged-out world bot's stayed until the map passed 4096 entries, which a 3000-bot pool never reaches. A bot whose latest
+ // snapshot is still published keeps its entry (that slot is shared).
+ if (++acquires_since_sweep >= 2048 || slots.size() > 4096)
{
+ acquires_since_sweep = 0;
for (auto it = slots.begin(); it != slots.end(); )
{
if ((!it->second[0] || it->second[0].use_count() == 1) &&
@@ -1779,7 +1784,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// same self-cleaning behavior (clear on stop, re-anchor on move).
bool moving = p->isMoving();
BotAI* mc_ai = bot_ai;
- // Fall back to a local anchor when the AI can't be resolved; without
+ // Fall back to a local anchor when the bot logic can't be resolved; without
// persistent state the wedge-corroboration simply trusts the flag,
// which is the safe default (matches a fresh map entry).
BotAI::MoveCorroborate local_anchor{};
@@ -1811,7 +1816,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
mc_ai->clear_move_corroborate();
snap->movement.is_moving = moving;
}
- // UNIT_STATE_IN_FLIGHT — the core is flying the bot on a taxi path. The AI
+ // UNIT_STATE_IN_FLIGHT — the core is flying the bot on a taxi path. The bot logic
// must stand down entirely (DispatchIdle bails) so no idle/unstick/watchdog
// rule fires a move_to or teleport that would corrupt the flight spline.
snap->movement.is_in_taxi = p->IsInFlight();
@@ -2034,7 +2039,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
}
snap->travel.best_mount_spell = best_sid;
- // [mount_pick] (Karrz, AV 2026-10-11: are the 60s on the 100% mount?). One line when the pick changes: the mount, the riding
+ // [mount_pick] (playtest, AV 2026-10-11: are the 60s on the 100% mount?). One line when the pick changes: the mount, the riding
// skill, and whether the bot holds the two mount-speed passives (86457 = 60%, 86458 = 100%) and its race's epic mount.
if (mt_ai && best_sid != mt_ai->cached_best_mount_spell() && p->GetLevel() >= 40)
{
@@ -2072,7 +2077,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// removes a shared-map data-race surface with zero behavior change.
// combat_*_ms()==0 means "not timing" / "never left", exactly as a
// missing map entry did. Fall back to local scalars if the registry
- // can't resolve the AI (mirrors every other ai() use-site here).
+ // can't resolve the bot logic (mirrors every other ai() use-site here).
BotAI* ct_ai = bot_ai;
int64_t local_start = 0, local_exit = 0;
if (snap->vitals.in_combat)
@@ -2136,7 +2141,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// Death recovery: ghost flag, corpse position, reclaim window, and the
// corpse-to-graveyard distance State_Dead reads to choose between
// corpse-run (no sickness, slow) and spirit-healer (sickness, instant).
- // Computed inline because the snapshot is a value type — the AI worker
+ // Computed inline because the snapshot is a value type — the bot worker
// can't safely walk Map / ObjectMgr lookups on its thread.
snap->death.is_ghost = p->HasPlayerFlag(PLAYER_FLAGS_GHOST);
snap->death.has_corpse = p->HasCorpse();
@@ -2349,7 +2354,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
}
// Owner character name for mat-share mail. Resolved once per snapshot
- // via OwnerRegistry → CharacterCache so the AI worker doesn't need to
+ // via OwnerRegistry → CharacterCache so the bot worker doesn't need to
// round-trip those services. Empty string when bot is unowned, or when
// it is bound to a whole account (`.playerbot adopt`) and nobody on that
// account is online. Without the account case an adopted bot had no
@@ -2472,7 +2477,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// Goblin=7). Bots typically only post in their faction's house but might
// have legacy postings elsewhere from cross-faction visits, so we walk
// them all. Per-bot cap matches the live cap of a few hundred — we don't
- // truncate, and the AI has constant-time access via the snapshot copy.
+ // truncate, and the bot logic has constant-time access via the snapshot copy.
{
const ObjectGuid me = p->GetGUID();
const time_t now = GameTime::GetGameTime();
@@ -2890,7 +2895,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// multiple slots, so accumulate (FlatCountMap::add defers the sum to
// finalize()). Tier 3.3: was unordered_map[entry] += count.
snap->inventory.bag_count_by_entry.add(ii.entry, ii.count);
- // Aggregate consumable-class counts so AI can decide "do I have enough
+ // Aggregate consumable-class counts so bot logic can decide "do I have enough
// food?" without re-resolving ItemTemplate on the worker thread.
// Stack count per item — a single 5-stack of food bumps food_drink_count
// by 5, matching how MaintainOocFood uses one charge per use.
@@ -3241,6 +3246,8 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// Classic 1.60 ammo (the hunter's "no ammo" / "low ammo" lines). Every arrow or bullet stack
// the equipped weapon can shoot counts: Player::AutoSelectAmmo moves on to the next stack.
+ if (Item const* worn_ranged = p->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
+ snap->consumables.ranged_subclass = uint8(worn_ranged->GetTemplate()->GetSubClass());
if (p->NeedsAmmo())
{
Item const* ranged = p->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
@@ -3316,6 +3323,9 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
{
snap->group.group_guid = g->GetGUID();
snap->owner_in_group = !snap->owner_guid.IsEmpty() && g->IsMember(snap->owner_guid);
+ if (snap->owner_in_group)
+ if (Player const* owner = ObjectAccessor::FindConnectedPlayer(snap->owner_guid); owner && owner->GetMapId() == p->GetMapId())
+ snap->owner_dist = p->GetExactDist2d(owner);
}
// ---- Spellbook (sorted, binary-searchable in BotSnapshotView::knows_spell) ----
@@ -3741,7 +3751,8 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
auto& cds = snap->cooldowns.spell_cooldowns;
for (auto const& bi : snap->inventory.bag_items)
{
- if (bi.item_class != ITEM_CLASS_CONSUMABLE) continue;
+ // The Demonic Rune is filed under Trade Goods / Other (class 7, subclass 11), and its cooldown is published like a potion's.
+ if (bi.item_class != ITEM_CLASS_CONSUMABLE && !(bi.item_class == ITEM_CLASS_TRADE_GOODS && bi.item_subclass == ITEM_SUBCLASS_TRADE_GOODS_OTHER)) continue;
ItemTemplate const* tmpl = sObjectMgr->GetItemTemplate(bi.entry);
if (!tmpl) continue;
for (ItemEffectEntry const* eff : tmpl->Effects)
@@ -3796,7 +3807,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
snap->cast.last_cast_spell_id = lc_ai->last_cast_spell_id();
// ---- Threat discipline context ----
- // Port of Karrz's group threat rules (ike3-based bots MCRaidHoldDamage /
+ // Port of the owner's group threat rules (wow-1.12 MCRaidHoldDamage /
// LooseAttackersTrigger). Resolve the group's live same-map members and
// tanks once, then stamp every attacker / nearby enemy below with the
// bot's threat, the best tank threat and who the mob is hitting, read
@@ -4598,6 +4609,10 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// HasUnitFlag check read false and the bot still engaged it. The
// template flag is the reliable signal for these static props.
u.is_pacified = c->HasUnitFlag(UNIT_FLAG_PACIFIED);
+ {
+ MovementGeneratorType const mt = c->GetMotionMaster()->GetCurrentMovementGeneratorType();
+ u.is_fleeing = mt == FLEEING_MOTION_TYPE || mt == TIMED_FLEEING_MOTION_TYPE || mt == ASSISTANCE_MOTION_TYPE;
+ }
// Uninteractible (NOT_SELECTABLE): unkillable, unacquirable hazard
// stalkers. Engage/pull rules skip these; the in-combat advance
// walks the tank through them. See NearbyUnit + the harbor note.
@@ -4657,7 +4672,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
int best_cc_pri = -1;
// Affix-buff whitelist — small static list of POSITIVE buff
// aura ids we surface on NearbyUnit.affix_buffs so the
- // dungeon AI can react to M+ Bolstering and similar mob-
+ // dungeon bot logic can react to M+ Bolstering and similar mob-
// empowering affixes without a generic per-unit auras dump.
// Extend as more "mob carries this buff → adjust pull rule"
// mechanics get wired.
@@ -4697,7 +4712,12 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
const int32 age = (abase->IsPermanent() || maxd <= 0)
? std::numeric_limits::max()
: std::max(0, maxd - abase->GetDuration());
- if (u.magic_buff_age_ms < 0 || age < u.magic_buff_age_ms)
+ // Majordomo's Magic Reflection / Damage Shield stop the whole raid from hitting an add until they are stripped:
+ // they come first, whatever younger buff the add carries (n32 mc_majordomo: the purgers took 12579 / 17794 off the
+ // Healers seven times and never the shield).
+ bool const shield = asi->Id == 20619 || asi->Id == 21075;
+ bool const shield_held = u.magic_buff_spell == 20619 || u.magic_buff_spell == 21075;
+ if (shield || (!shield_held && (u.magic_buff_age_ms < 0 || age < u.magic_buff_age_ms)))
{
u.magic_buff_age_ms = age;
u.magic_buff_spell = asi->Id;
@@ -4852,7 +4872,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
u.combat_reach = t->GetCombatReach();
if (Unit const* v = t->GetVictim())
u.victim = v->GetGUID();
- // Capture npc_flags for friendly Creatures so AI can find
+ // Capture npc_flags for friendly Creatures so bot logic can find
// vendors/repairers/bankers/trainers/flightmasters/innkeepers
// by capability (vs by entry id). Players keep npc_flags=0.
if (Creature const* c = t->ToCreature())
@@ -5291,7 +5311,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// are turn-in-ready or only contain implicit objectives (LEARNSPELL,
// MIN_REPUTATION, AREATRIGGER without coords, etc).
{
- // bot_ai is the build-target's pre-resolved AI (function parameter).
+ // bot_ai is the build-target's pre-resolved bot logic (function parameter).
const uint32 now_ms = GameTime::GetGameTimeMS();
const uint32 bot_map = p->GetMapId();
// Track best-eligible "any" + best-eligible "same-map" candidates.
@@ -5845,7 +5865,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
uint64(best_breadcrumb_sm_set ? best_breadcrumb_sm_quest : 0u);
// Per-bot log-dedup signature lives on the bot's own BotAI
// (Phase 4 parallel-by-Map*): formerly a process-wide BotId-keyed
- // static map, now single-writer per worker. When the AI can't be
+ // static map, now single-writer per worker. When the bot logic can't be
// resolved we emit unconditionally (correct, just not deduped).
BotAI* pc_ai = bot_ai;
const uint64 last_sig = pc_ai ? pc_ai->picker_choice_log_sig() : (pc_sig ^ 1ull);
@@ -5900,6 +5920,18 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
bool has_complete = false;
for (auto const& dq : snap->quest_log.quests)
if (dq.state == 1) { has_complete = true; break; }
+ // At most one dump per bot per minute (per build thread): a bot parked on a complete quest wrote it on every build, which
+ // made [picker_none] 79% of the log at 85-150 bots and pushed every other diagnostic out of the rotation.
+ if (has_complete)
+ {
+ thread_local std::unordered_map s_picker_none_ms;
+ uint32 const pn_now = snap->published_at_ms ? snap->published_at_ms : 1u;
+ uint32& pn_last = s_picker_none_ms[snap->guid.GetCounter()];
+ if (pn_last && pn_now - pn_last < 60000u)
+ has_complete = false;
+ else
+ pn_last = pn_now;
+ }
if (has_complete)
{
TC_LOG_INFO("playerbot.v2",
@@ -6658,7 +6690,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// ---- Stuck-by-terrain tracker update ----
// Detects bots wedged on geometry pursuing an unreachable target. Per-bot
- // state lives on BotAI (so the AI worker reads/writes; world thread here
+ // state lives on BotAI (so the bot worker reads/writes; world thread here
// only updates with the latest movement goal + distance).
//
// Goal selection priority: current_objective_poi > nearest quest_turnin
@@ -7137,7 +7169,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// Walks nearby_friends + nearby_objects on the world thread (where
// we have safe access to the live Creature / GameObject ptrs) and
// tags each (giver, quest_id) pair where the giver accepts the quest's
- // turn-in. Lets AI in worker threads emit complete_quest with the
+ // turn-in. Lets bot logic in worker threads emit complete_quest with the
// pre-resolved guid rather than guessing per-NPC.
{
std::vector complete_q;
@@ -7181,7 +7213,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// Quest offers: walk nearby creatures + GOs and surface any quest
// they offer that the bot doesn't have. CanTakeQuest filters by
// level / class / race / faction / prereq + quest log capacity.
- // We cap surfaced offers per snapshot (the AI only acts on the
+ // We cap surfaced offers per snapshot (the bot logic only acts on the
// first per tick; surfacing more is a small DB read but no
// executor cost).
constexpr size_t MAX_OFFERS = 16;
@@ -7472,7 +7504,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
if (u.npc_flags & kQuestGiverFlagMask) ++giver_npc_count;
for (auto const& o : snap->world_objects.nearby_objects)
if (o.go_type == GAMEOBJECT_TYPE_QUESTGIVER) ++giver_go_count;
- // Throttle to once per 5s per bot via the AI's last-scan
+ // Throttle to once per 5s per bot via the bot logic's last-scan
// timestamp so we don't spam every snapshot publish.
if (offer_bot_ai)
{
@@ -7594,13 +7626,13 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
// ---- Active loot rolls ----
- // Surface in-flight group/master rolls so AI can vote without being
+ // Surface in-flight group/master rolls so bot logic can vote without being
// event-driven. LootRoll exposes loot_obj + list_id + vote mask via
// the Playerbot accessors we added on the core side. is_upgrade
// pre-computes whether the roll item is a strict ilvl upgrade for any
// equipped slot of matching inventory type (or fills an empty slot).
{
- // Loot etiquette (Karrz's LootRollAction IsInstanceGroupWithHuman /
+ // Loot etiquette (the owner's LootRollAction IsInstanceGroupWithHuman /
// HumanWouldWantItem): the humans of the bot's group on its map get
// first claim. Only gathered when a roll is waiting.
std::vector humans;
@@ -7755,7 +7787,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
if (eq.entry == 0)
{
// Empty matching-invtype slot: an upgrade
- // (Karrz: need for an empty slot), but never a
+ // (the owner: need for an empty slot), but never a
// cosmetic shirt or tabard.
// An empty off hand is no reason to need a
// one-hander the bot can't wield there (no dual
@@ -7779,7 +7811,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
if (!eq_tmpl) continue;
const float eq_score = score_block(eq.stats, eq.item_level);
// A real upgrade beats the worn item by at least
- // 5% (Karrz); side-grades are greed.
+ // 5% (the owner); side-grades are greed.
const float margin = std::max(1.f, eq_score * 0.05f);
if (roll_score >= eq_score + margin)
{
@@ -7796,7 +7828,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// ---- Mail ----
// Snapshot the bot's mail vector. Player::GetMails() includes both
- // delivered and pending-deliver mails; we publish all and let the AI
+ // delivered and pending-deliver mails; we publish all and let the bot logic
// gate on `deliver_in_sec <= 0`. Skipping deleted entries because the
// server flushes them on _SaveMail; surfacing them would cause
// mail_delete intents to retry against rows that are already gone.
@@ -7850,7 +7882,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
for (GameObject* go : scratch_gos)
{
if (!go) continue;
- // Filter to types AI actually drives. Skip everything else to
+ // Filter to types bot logic actually drives. Skip everything else to
// keep the vector bounded — chairs, transports, etc would
// dominate the cap in major cities. GATHERING_NODE (50) is the
// modern herbalism/mining node type — without it in the
@@ -7880,7 +7912,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// the static portal GO; TRANSPORT (11) is mooring rooms /
// elevators / etc; MO_TRANSPORT (15) is the seafaring
// ships and zeppelins that move between continents. The
- // builder pre-resolves their destinations so the AI can
+ // builder pre-resolves their destinations so the bot logic can
// walk to them and use/board.
t == GAMEOBJECT_TYPE_SPELLCASTER ||
t == GAMEOBJECT_TYPE_TRANSPORT ||
@@ -8032,7 +8064,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
}
// Continental transport (ship / zeppelin). Same teleport_dest
- // semantics: AI walks to the transport, server auto-attaches
+ // semantics: bot logic walks to the transport, server auto-attaches
// the bot as a passenger when the bounding box overlaps, the
// transport carries them across maps, and the bot's same-map
// rules pick up at the destination dock. We populate the
@@ -8062,7 +8094,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
n.teleport_dest_map = map_id;
// No exact dest coords — the transport drops
// the passenger at its dock spawn, which the
- // AI doesn't strictly need to plan; we just
+ // Bot logic doesn't strictly need to plan; we just
// need to know "this transport reaches the
// goal map".
break;
@@ -8077,7 +8109,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// walkable board/disembark LEDGES (nearest navmesh poly beside each
// platform-centre). Cheap after the first encounter — every stop's
// result is cached in ElevatorIndex. The elevator rules then read the
- // ledge via ElevatorIndex::LedgeFor on the AI worker.
+ // ledge via ElevatorIndex::LedgeFor on the bot worker.
else if (n.go_type == GAMEOBJECT_TYPE_TRANSPORT)
{
// Derive ledges for the WHOLE nearby lift cluster (not just this
@@ -9326,7 +9358,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// ---- bg_role: per-slot role from the active BattlegroundScript ----
// Mirrors the slot→role resolution in State_Idle.cpp BgDispatch so
// the snapshot field agrees with the role the bot will actually
- // execute this tick. Reads the IMMUTABLE advice copy the AI worker
+ // execute this tick. Reads the IMMUTABLE advice copy the bot worker
// publishes after each cache rebuild (BotAI::published_bg_advice —
// adversarial review 2026-06-10: reading the worker-owned
// BgAdviceCache directly from this world-thread code raced its
@@ -9410,7 +9442,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// the build WORKER threads. The OrderFor read is race-free because it is
// temporally disjoint from the write — orders_ is immutable for the whole
// build phase (see BgTeamCoordinator.h threading contract). No plan entry
- // leaves order.kind == None and the AI falls back to per-bot role logic.
+ // leaves order.kind == None and the bot logic falls back to per-bot role logic.
if (Services::Initialized())
if (auto const* ord = Services::BgCoordinator().OrderFor(
p->GetGUID().GetCounter()))
@@ -9880,7 +9912,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
}
- // Publish the probe's VALIDATED route legs to the snapshot so the AI
+ // Publish the probe's VALIDATED route legs to the snapshot so the bot logic
// worker executes THIS route instead of recomputing one. The worker's own
// FindRoute runs with validate_source_walk=false (the default — the costly
// live-navmesh probe is reserved for known-wedged bots here), so for a bot
@@ -10099,7 +10131,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// ---- Nearest cross-map portal/transport anchor ----
// When the bot has a current quest goal on a different map, ask the
// global PortalIndex for the closest static portal or ship-dock on
- // the bot's current map that reaches the goal map. The AI rule
+ // the bot's current map that reaches the goal map. The bot logic rule
// (idle:walk_to_known_portal) walks the bot toward this anchor; once
// within 30 y the SPELLCASTER/TRANSPORT GO becomes visible in
// nearby_objects and the in-range rules (use_portal /
@@ -10223,7 +10255,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
}
// ---- Homebind ----
- // Snapshot the bot's bind point so the AI can decide cross-continent
+ // Snapshot the bot's bind point so the bot logic can decide cross-continent
// hearth (when goal is on a different map but homebind is on the goal's
// map, hearth saves a flight + walk). Player::m_homebind.GetMapId() is
// 0 on a freshly-created character before login, but that's gated by
@@ -10347,6 +10379,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// this the bot has no way to know who its pet is fighting.
if (Unit const* pv = pet->GetVictim())
snap->pet.pet_victim = pv->GetGUID();
+ snap->pet.pet_react = uint8(pet->GetReactState());
// Pet attackers — feeds the peel branch of assist_pet. When the
// pet's victim is mob A but mob B (a caster) is hammering the
// pet from range, the rule prefers B so the bot peels instead
@@ -10415,7 +10448,7 @@ std::shared_ptr BotSnapshotBuilder::Build(Player* p, BotAI* b
// their consumers land. Threat list / attackers come with PerceptionBuilder.)
// Path-block telemetry — surface BotAI's monotonic path-blocked count
- // + last-block timestamp so AI worker rules can detect anchor wedge
+ // + last-block timestamp so bot worker rules can detect anchor wedge
// and fall through without dereferencing BotAI directly. Captured at
// build-end so any path failures during the build window are
// included.
diff --git a/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.h b/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.h
index d871088113..9049c2d41f 100644
--- a/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.h
+++ b/src/modules/PlayerbotV2/Bot/BotSnapshotBuilder.h
@@ -29,7 +29,7 @@ public:
// pointer. Resolving once on the world thread (where the registry is
// quiescent w.r.t. this tick) eliminates that race while keeping behavior
// byte-identical (same pointer, resolved once instead of ~32 times). May be
- // null if the bot has no registered AI (Build tolerates a null bot_ai
+ // null if the bot has no registered bot logic (Build tolerates a null bot_ai
// everywhere it is used).
static std::shared_ptr Build(Player* p, BotAI* bot_ai, SnapshotVer next_version, TickId tick);
};
diff --git a/src/modules/PlayerbotV2/Bot/BotSnapshotView.cpp b/src/modules/PlayerbotV2/Bot/BotSnapshotView.cpp
index 49556b0b7c..13302977f3 100644
--- a/src/modules/PlayerbotV2/Bot/BotSnapshotView.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotSnapshotView.cpp
@@ -11,6 +11,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -172,6 +174,18 @@ bool BotSnapshotView::is_ready(uint32 spell_id) const
if (power(uint8(pw->PowerType)) < cost)
return false;
}
+ // Mana: not ready when even the cheapest rank the bot knows costs more than it has (live Deadmines 2026-10-14: a level 14 shaman
+ // sent Lightning Shield and Healing Wave 14 times in 10 s, NO_POWER every time). The cheapest rank, not the one requested, so
+ // a healer that downranks to save mana still gets its cast; the DB2 cost is the untalented one, so a discounted cast waits a few
+ // points longer than the core would need - never fires early.
+ if (int32 cheapest = mana_cost(spell_id); cheapest > 0)
+ {
+ for (uint32 const r : known_ranks(spell_id))
+ if (int32 const c = mana_cost(r); c > 0 && c < cheapest)
+ cheapest = c;
+ if (power(POWER_MANA) < cheapest)
+ return false;
+ }
auto cd = FindCooldownIndexed(s_->cooldowns, spell_id);
if (!cd) return true;
if (cd->charges > 0) return true;
@@ -765,7 +779,7 @@ BotSnapshotView::ThreatHold BotSnapshotView::threat_hold(ObjectGuid target, floa
switch (ThreatVictim(u->victim_kind))
{
// Self-defence: the mob is already hitting this bot or another
- // non-tank member - everyone fights (Karrz: "nobody holds back").
+ // non-tank member - everyone fights (the owner: "nobody holds back").
case ThreatVictim::Me:
case ThreatVictim::Member:
// Someone outside the group: not our tank's fight.
@@ -835,14 +849,39 @@ NearbyUnit const* BotSnapshotView::assigned_tank_mob() const
// target_reach: `range` is a spell's range, measured to the target's combat reach (Spell::GetMinMaxRange), so a big mob counts as in reach
// from further off (MC Garr 2026-10-10: Firesworn 5-6 y from a tank, Taunt reach 4 y centre to centre, never taunted).
// leash: the mob is walked to (a pickup chases it), so with a human owner in the group inside an instance it must stand within
-// kPickupLeashYd of the owner; a tank that chased every mob on every member dragged the fight away from him (Karrz, Deadmines
+// kPickupLeashYd of the owner; a tank that chased every mob on every member dragged the fight away from him (playtest, Deadmines
// 2026-10-10: pickups 25-30 y out moved the melee spot 50 y from the group in four pulls). A taunt does not move the tank and is
// not leashed. The owner is read from the friend sweep; out of it (or no owner) there is no leash.
static constexpr float kPickupLeashYd = 25.0f;
+// A 5-man tank keeps the fight where its healer can see it: the point (x, y) is further than kHealerLeashYd from every healer in the
+// friend sweep (a heal reaches 40 y; the rest is the margin for the line of sight and a step). No healer in the sweep, no leash.
+// Deadmines 2026-10-15 n43 run 6: the tank followed a held Goblin Engineer 20 y out of the room, the healers had no sight line at
+// 29-42 y, and the tank died there with the priest unable to cast.
+static constexpr float kHealerLeashYd = 30.0f;
+static bool BeyondHealerLeash(BotSnapshot const& s, float x, float y)
+{
+ if (!s.instance_ctx.is_in_dungeon || s.instance_ctx.is_in_raid)
+ return false;
+ bool any_healer = false;
+ for (auto const& f : s.combat.nearby_friends)
+ {
+ if (f.role != Role::Healer || f.hp <= 0 || f.guid == s.guid) continue;
+ any_healer = true;
+ const float hx = x - f.x, hy = y - f.y;
+ if (hx * hx + hy * hy <= kHealerLeashYd * kHealerLeashYd)
+ return false;
+ }
+ return any_healer;
+}
+
// A loose mob nobody was assigned goes to ONE tank: the nearest idle one that this bot's friend sweep shows (a tank busy with a
// mob of its own is no contender; ties go to the lower guid). Without it every tank without an assignment ran at the same mob and
// they taunted it back and forth (MC 2026-10-11: [tank_loose] from several tanks on one Firewalker, "claimed by another tank 0").
+// The nearer tank counts only while it can take the mob: within the pickup reach (n24 mc_garr: an idle tank 40 y off was the "nearest", every
+// other idle tank deferred to it and a Firesworn stood 7 y from Mctankwb on a healer for a minute).
+static constexpr float kOtherTankReachYd = 30.0f;
+
static bool OtherTankTakesLoose(BotSnapshot const& s, NearbyUnit const& mob)
{
const float mdx = mob.x - s.position.x, mdy = mob.y - s.position.y;
@@ -856,12 +895,38 @@ static bool OtherTankTakesLoose(BotSnapshot const& s, NearbyUnit const& mob)
if (busy) continue;
const float dx = mob.x - f.x, dy = mob.y - f.y;
const float theirs = dx * dx + dy * dy;
+ if (theirs > kOtherTankReachYd * kOtherTankReachYd) continue;
if (theirs < mine || (theirs == mine && f.guid < s.guid))
return true;
}
return false;
}
+// How long a mob has stood on a group member without a tank on it (ms). The plan's claim on a mob (PveOrder::claimed_by_other_tanks) is
+// "its owner is on the way"; once the mob has been on a member for kClaimStaleMs the owner is not (n24 mc_garr: Firesworn killed seven
+// mages and healers while their claimed tanks held another mob), and any tank may take it. Mob-level state shared by all bots, written
+// only while the mob is seen loose; a gap of kLooseGapMs starts it again.
+static constexpr uint32 kClaimStaleMs = 3000;
+static constexpr uint32 kLooseGapMs = 1500;
+static uint32 LooseOnMemberMs(ObjectGuid mob, uint32 now)
+{
+ struct Seen { uint32 since; uint32 last; };
+ static std::mutex mtx;
+ static std::unordered_map seen;
+ std::lock_guard lock(mtx);
+ if (seen.size() > 512)
+ for (auto it = seen.begin(); it != seen.end();)
+ it = now - it->second.last > 10'000u ? seen.erase(it) : std::next(it);
+ auto [it, fresh] = seen.try_emplace(mob.GetCounter(), Seen{ now, now });
+ if (!fresh)
+ {
+ if (now - it->second.last > kLooseGapMs)
+ it->second.since = now;
+ it->second.last = now;
+ }
+ return now - it->second.since;
+}
+
static NearbyUnit const* UnclaimedLooseAttacker(BotSnapshot const& s, float range, bool target_reach = false, bool leash = false)
{
NearbyUnit const* best = nullptr;
@@ -875,8 +940,17 @@ static NearbyUnit const* UnclaimedLooseAttacker(BotSnapshot const& s, float rang
{
if (e.hp <= 0 || e.is_player || e.untargetable || e.is_pacified) continue;
if (ThreatVictim(e.victim_kind) != ThreatVictim::Member) continue;
- if (s.pve_order.active && s.pve_order.claimed_by_other_tank(e.guid)) continue;
+ if (s.pve_order.active && s.pve_order.claimed_by_other_tank(e.guid) && LooseOnMemberMs(e.guid, s.published_at_ms) < kClaimStaleMs) continue;
if (OtherTankTakesLoose(s, e)) continue;
+ if (leash && BeyondHealerLeash(s, e.x, e.y))
+ {
+ static std::atomic s_hleash_log{ 0 };
+ uint32 last = s_hleash_log.load(std::memory_order_relaxed);
+ if (s.published_at_ms - last >= 5000u && s_hleash_log.compare_exchange_strong(last, s.published_at_ms))
+ TC_LOG_INFO("playerbot.v2", "[tank_leash] {} leaves entry {} alone: further than {:.0f} y from every healer; no pickup chase",
+ s.identity.name, e.entry, kHealerLeashYd);
+ continue;
+ }
if (owner_unit)
{
const float ox = e.x - owner_unit->x, oy = e.y - owner_unit->y;
@@ -936,6 +1010,20 @@ NearbyUnit const* BotSnapshotView::taunt_candidate(float range) const
return UnclaimedLooseAttacker(*s_, range, /*target_reach=*/true);
}
+bool BotSnapshotView::claim_blocks(NearbyUnit const& u) const
+{
+ if (!s_->pve_order.active || !s_->pve_order.claimed_by_other_tank(u.guid))
+ return false;
+ if (ThreatVictim(u.victim_kind) != ThreatVictim::Member)
+ return true;
+ return LooseOnMemberMs(u.guid, s_->published_at_ms) < kClaimStaleMs;
+}
+
+bool BotSnapshotView::beyond_healer_leash(float x, float y) const
+{
+ return BeyondHealerLeash(*s_, x, y);
+}
+
NearbyUnit const* BotSnapshotView::pickup_candidate() const
{
if (NearbyUnit const* a = assigned_tank_mob())
@@ -1026,7 +1114,7 @@ MailEntry const* BotSnapshotView::next_drainable_mail() const
// owner to handle manually.
if (m.cod > 0) continue;
// Returned mails sit in the bot's box but can't be re-returned;
- // include them — the AI may still want to delete or take items
+ // include them — the bot logic may still want to delete or take items
// (returns from auctions land here too).
if (m.money > 0 || m.item_count > 0) return &m;
}
diff --git a/src/modules/PlayerbotV2/Bot/BotSnapshotView.h b/src/modules/PlayerbotV2/Bot/BotSnapshotView.h
index 2a8cb84373..ee972809ba 100644
--- a/src/modules/PlayerbotV2/Bot/BotSnapshotView.h
+++ b/src/modules/PlayerbotV2/Bot/BotSnapshotView.h
@@ -95,13 +95,19 @@ public:
bool tactic_save_mana() const { return s_->tactic_save_mana; } // owner "save mana"
// A companion may sit down to eat or drink only when its owner has stopped next to it: otherwise the group follow
// stands it up again at the next step and the next stop costs another item.
+ // In a raid the group stands spread over 30-40 y round the owner (formation, spacing), so "next to it" is the raid's own reach
+ // (playtest, live MC 2026-10-12: raid bots stood waiting on mana regen and never sat; a 10 y mark kept every bot past the first
+ // rank from ever drinking).
bool companion_may_sit() const
{
if (!s_->owner_in_group) return true;
float x, y, z; position(x, y, z);
+ float const reach = is_in_raid() ? 45.0f : 10.0f;
+ if (s_->owner_dist >= 0.0f)
+ return s_->owner_dist <= reach;
for (auto const& u : s_->combat.nearby_friends)
if (u.guid == s_->owner_guid)
- return (u.x - x) * (u.x - x) + (u.y - y) * (u.y - y) <= 10.0f * 10.0f;
+ return (u.x - x) * (u.x - x) + (u.y - y) * (u.y - y) <= reach * reach;
return false;
}
bool has_duel_request() const { return s_->social_events.has_duel_request; }
@@ -143,6 +149,7 @@ public:
// Classic ammo: 0 = nothing to shoot ammo with, 1 = arrows, 2 = bullets; count of usable ones in bags.
uint8 ammo_kind() const { return s_->consumables.ammo_kind; }
uint32 ammo_count() const { return s_->consumables.ammo_count; }
+ uint8 ranged_subclass() const { return s_->consumables.ranged_subclass; }
int32 hp() const { return s_->vitals.hp; }
int32 max_hp() const { return s_->vitals.max_hp; }
// int64 intermediate prevents overflow at high HP pools — modern raid
@@ -203,7 +210,7 @@ public:
// True if `spell_id` can be cast while moving (instant cast OR no
// Movement interrupt flag). Looked up from SpellInfo via the global
// SpellMgr — that data is read-only after init, so the call is safe
- // from AI worker threads. APL rules pair this with `is_moving()` to
+ // from bot worker threads. APL rules pair this with `is_moving()` to
// gate hard-cast spells: `if (s.is_moving() && !s.can_cast_while_moving(SP)) return false;`.
// Returns true when the spell is unknown (no filtering — let the cast
// attempt and its server-side gates decide).
@@ -369,7 +376,7 @@ public:
// threat-grab behavior. Returns nullptr if every nearby enemy is on us.
NearbyUnit const* untaunted_enemy(float range = 30.f) const;
- // ---- Threat discipline (port of Karrz's ike3-based bots group threat rules) ----
+ // ---- Threat discipline (port of Karrz's wow-1.12 group threat rules) ----
// The attacker / nearby-enemy record for `guid` (attackers first), or null.
NearbyUnit const* hostile_unit(ObjectGuid guid) const;
// Group's tank as resolved by the builder (may be this bot). Empty when
@@ -385,11 +392,11 @@ public:
// this bot or another non-tank member (self-defence) or someone outside
// the group. Role, map-type and config gating are the CALLER's job, as
// is the opening-wait timeout.
- enum class ThreatHold : uint8 { None, TankOpening, OverThreat };
+ enum class ThreatHold : uint8 { None, TankOpening, OverThreat, ShieldUp };
ThreatHold threat_hold(ObjectGuid target, float opening_lead, float max_ratio) const;
// Tank helper (LooseAttackersTrigger): nearest live enemy within `range`
// whose victim is a NON-TANK group member - the mobs a tank must taunt
- // or pick up. loose_attackers_within counts them (Karrz: Challenging
+ // or pick up. loose_attackers_within counts them (the owner: Challenging
// Shout / Roar at 3+ within 10y).
NearbyUnit const* loose_attacker(float range = 30.f) const;
size_t loose_attackers_within(float range) const;
@@ -403,6 +410,12 @@ public:
NearbyUnit const* assigned_tank_mob() const;
NearbyUnit const* taunt_candidate(float range) const;
NearbyUnit const* pickup_candidate() const;
+ // 5-man only: (x, y) lies further than 30 y from every healer in the friend sweep (false with no healer in it). A tank does not
+ // walk after a mob there.
+ bool beyond_healer_leash(float x, float y) const;
+ // The raid plan gave this mob to another tank AND that claim still holds: a claimed mob that has stood on a group member for a few
+ // seconds is not being picked up by its owner, so any tank may take it.
+ bool claim_blocks(NearbyUnit const& u) const;
// Directional look-ahead. Returns the closest threatening hostile
// creature inside a `half_width`-yard corridor from the bot's
@@ -693,7 +706,7 @@ public:
bool has_drainable_mail() const;
MailEntry const* next_drainable_mail() const;
- // Taxi — has the bot visited / been granted node `node_id`? Lets AI
+ // Taxi — has the bot visited / been granted node `node_id`? Lets bot logic
// gate fly_to_node intents on pre-known endpoints rather than
// catching the Result::Locked rebound. node_id is a TaxiNodes.dbc id.
bool is_taxi_node_known(uint32 node_id) const
@@ -706,7 +719,7 @@ public:
// Recommended taxi route accessors — populated by the snapshot builder
// when the bot has a long-distance same-map goal and a viable known-FM
// → known-FM route exists. has_recommended_taxi_route() reflects "≥2
- // hops, both endpoints known"; the AI rule walks to the start FM and
+ // hops, both endpoints known"; the bot logic rule walks to the start FM and
// emits fly_to_node(start_fm, dest_node) on arrival.
ObjectGuid recommended_taxi_start_fm() const { return s_->travel.recommended_taxi_start_fm; }
uint32 recommended_taxi_dest_node() const { return s_->travel.recommended_taxi_dest_node; }
@@ -729,7 +742,7 @@ public:
// Nearest known cross-map travel anchor. Builder fills from the
// global PortalIndex when the bot has a cross-map goal; empty
- // otherwise. AI uses these to walk toward the portal/dock from
+ // otherwise. bot logic uses these to walk toward the portal/dock from
// anywhere on the source map (the GO itself is invisible past 30 y
// so we can't rely on nearby_objects for the long-distance leg).
bool has_nearest_portal_anchor() const
@@ -802,7 +815,7 @@ public:
// destination map (Mage Teleport: City, DK Death Gate, Druid
// Teleport: Moonglade, etc). Builder pre-resolves each spell's
// dest map via spell_target_position so this is a cheap snapshot
- // scan with no DB lookups on the AI worker.
+ // scan with no DB lookups on the bot worker.
std::vector const& self_teleport_spells() const
{ return s_->travel.self_teleport_spells; }
@@ -886,7 +899,7 @@ public:
std::vector const& bg_all_enemy_carriers() const
{ return s_->bg.all_enemy_carriers; }
- // Bank capacity. AI uses bank_free_slots() == 0 to skip deposit attempts;
+ // Bank capacity. bot logic uses bank_free_slots() == 0 to skip deposit attempts;
// bank_tab_count() lets the "buy a bank tab" rule fire when the bot
// has gold and < 4 tabs.
uint8 bank_tab_count() const { return s_->bank.bank_tab_count; }
@@ -998,6 +1011,7 @@ public:
std::string const& pet_name() const { return s_->pet.pet_name; }
bool pet_can_bloodlust() const { return s_->pet.pet_can_bloodlust; }
ObjectGuid pet_victim() const { return s_->pet.pet_victim; }
+ uint8 pet_react() const { return s_->pet.pet_react; }
std::vector const& pet_attackers() const { return s_->pet.pet_attackers; }
AuraEntry const* find_pet_aura(uint32 spell_id) const;
std::vector const& stable_pets() const { return s_->pet.stable_pets; }
@@ -1096,7 +1110,7 @@ private:
// builder stores outbound auras as compact OutboundAura rows, but
// find_aura must return an AuraEntry const*. Materialising the matched
// row here — instead of a reused thread_local — keeps every returned
- // pointer valid for the whole lifetime of this view (one AI tick), so a
+ // pointer valid for the whole lifetime of this view (one bot tick), so a
// caller holding two find_aura results (or calling again before using
// the first) never sees aliased/overwritten data. std::deque is chosen
// because it never invalidates existing element pointers on push_back,
diff --git a/src/modules/PlayerbotV2/Bot/BotTextMgr.cpp b/src/modules/PlayerbotV2/Bot/BotTextMgr.cpp
index c718c5e68b..84fc83879b 100644
--- a/src/modules/PlayerbotV2/Bot/BotTextMgr.cpp
+++ b/src/modules/PlayerbotV2/Bot/BotTextMgr.cpp
@@ -51,16 +51,16 @@ BotTextMgr& BotTextMgr::instance()
void BotTextMgr::Load()
{
- enabled_ = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Enabled", true);
- chance_scale_ = std::max(0.0f, sConfigMgr->GetFloatDefault("Playerbot.Chatter.ChanceScale", 1.0f));
- group_cooldown_ms_ = uint32(std::max(0, sConfigMgr->GetIntDefault("Playerbot.Chatter.GroupCooldownMs", 20000)));
- bot_cooldown_ms_ = uint32(std::max(0, sConfigMgr->GetIntDefault("Playerbot.Chatter.BotCooldownMs", 60000)));
+ enabled_ = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Enabled", true, true);
+ chance_scale_ = std::max(0.0f, sConfigMgr->GetFloatDefault("Playerbot.Chatter.ChanceScale", 1.0f, true));
+ group_cooldown_ms_ = uint32(std::max(0, sConfigMgr->GetIntDefault("Playerbot.Chatter.GroupCooldownMs", 20000, true)));
+ bot_cooldown_ms_ = uint32(std::max(0, sConfigMgr->GetIntDefault("Playerbot.Chatter.BotCooldownMs", 60000, true)));
- auto ms = [](char const* key, int32 def) { return uint32(std::max(0, sConfigMgr->GetIntDefault(key, def))); };
- speech_.callouts_enabled = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Callouts.Enabled", true);
+ auto ms = [](char const* key, int32 def) { return uint32(std::max(0, sConfigMgr->GetIntDefault(key, def, true))); };
+ speech_.callouts_enabled = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Callouts.Enabled", true, true);
speech_.callout_key_cooldown_ms = ms("Playerbot.Chatter.Callouts.KeyCooldownMs", 60000);
speech_.callout_group_cooldown_ms = ms("Playerbot.Chatter.Callouts.GroupCooldownMs", 8000);
- speech_.suggest_enabled = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Suggest.Enabled", true);
+ speech_.suggest_enabled = sConfigMgr->GetBoolDefault("Playerbot.Chatter.Suggest.Enabled", true, true);
speech_.suggest_bot_cooldown_ms = std::max(60000, ms("Playerbot.Chatter.Suggest.BotCooldownMs", 1800000));
speech_.suggest_channel_cooldown_ms = ms("Playerbot.Chatter.Suggest.ChannelCooldownMs", 180000);
speech_.suggest_global_cooldown_ms = ms("Playerbot.Chatter.Suggest.GlobalCooldownMs", 10000);
@@ -72,7 +72,7 @@ void BotTextMgr::Load()
// Realm-independent content: lives in the shared playerbot schema (migration 0019), reached over
// the character connection by qualifying with the configured schema name, as BotNamePool does.
- std::string const shared = sConfigMgr->GetStringDefault("Playerbot.SharedDatabase", "playerbot");
+ std::string const shared = sConfigMgr->GetStringDefault("Playerbot.SharedDatabase", "playerbot", true);
if (QueryResult res = CharacterDatabase.Query(Trinity::StringFormat(
"SELECT name, text, say_type, reply_type, weight FROM `{}`.playerbot_v2_bot_text ORDER BY id", shared).c_str()))
@@ -576,7 +576,7 @@ void SayGoodbye(Player* bot, Player* owner)
namespace {
-// ---- limiter state (AI workers tick bots concurrently: everything below is behind a lock) ----
+// ---- limiter state (bot workers tick bots concurrently: everything below is behind a lock) ----
// One companion's callout memory: the band each watched value was last seen in (so a line is said
// when the value CROSSES into a worse band, not on every tick it stays there), whether the fight's
diff --git a/src/modules/PlayerbotV2/Bot/BotTextMgr.h b/src/modules/PlayerbotV2/Bot/BotTextMgr.h
index 4aa1811061..7dc51078ca 100644
--- a/src/modules/PlayerbotV2/Bot/BotTextMgr.h
+++ b/src/modules/PlayerbotV2/Bot/BotTextMgr.h
@@ -1,7 +1,7 @@
// BotTextMgr - the bots' speech lines, carried over from Karrz's ike3 playerbot build.
//
// Data: {Playerbot.SharedDatabase}.playerbot_v2_bot_text / _bot_text_chance (migration 0019). Loaded
-// once by Module::Init before any bot logs in; read-only afterwards, so the AI workers and the world
+// once by Module::Init before any bot logs in; read-only afterwards, so the bot workers and the world
// thread may read it concurrently without a lock.
//
// A line is picked at random among the rows of one key ('hello', 'goodbye', 'reply',
@@ -21,7 +21,7 @@
// Playerbot.Chatter.GroupCooldownMs 20000 minimum gap between two unsolicited lines in one group
// Playerbot.Chatter.BotCooldownMs 60000 minimum gap between two unsolicited lines from one bot
//
-// SpeechTick (below) is the per-tick side, run by the AI worker from the snapshot: ike3's SayStrategy
+// SpeechTick (below) is the per-tick side, run by the bot worker from the snapshot: ike3's SayStrategy
// combat callouts for companions (critical / low health, low mana, out of ammo, the tank's taunt
// lines, the "so many mobs" line on a big pull) and SuggestWhatToDoAction's lines from world bots in
// their zone's General / Trade channel. It emits ChatIntents like any other rule.
@@ -158,7 +158,7 @@ void AddSelfPlaceholders(TextPlaceholders& ph, uint8 cls, uint8 race, uint8 leve
enum class Slot : uint8 { Greet, LevelUp, Broadcast };
bool TakeSlot(Slot slot, uint64 group_low, BotId bot, uint32 now_ms);
-// ---- lines for the AI worker (snapshot data only; the caller emits them as party chat) ----
+// ---- lines for the bot worker (snapshot data only; the caller emits them as party chat) ----
// ike3 'hello' (or 'hello_follow' for a companion joining its owner). Empty when chatter is off or
// another bot of the group greeted moments ago.
@@ -190,14 +190,14 @@ void SayGoodbye(Player* bot, Player* owner);
// a 90 s gap per bot. The text is a small built-in pool varied by class, role and personality.
enum class Banter : uint8 { Ready, Wipe, Thanks, Ouch, BossKill };
-// AI worker: the line to say now for `kind`, or empty (gates / roll / cooldown said no). The caller emits it.
+// bot worker: the line to say now for `kind`, or empty (gates / roll / cooldown said no). The caller emits it.
std::string BanterLine(Banter kind, BotAI& ai, BotSnapshotView const& s);
// A boss (dungeon boss or world boss) died to `killer` or a group member. Called by the kill listener for any
// killer. One nearby companion of the killer's group may say "gg" and one may bow (the killer is a real player,
// "the owner finished the boss") or cheer.
void OnBossKilled(Player* killer, Creature* boss);
-// ---- per-tick speech (AI worker; snapshot data only; emits at most one ChatIntent per tick) ----
+// ---- per-tick speech (bot worker; snapshot data only; emits at most one ChatIntent per tick) ----
// ike3 SayStrategy + SuggestWhatToDoAction, see the header comment. Called from
// BotAI::dispatch_layers every tick, whatever the bot's state.
diff --git a/src/modules/PlayerbotV2/Bot/CastPacing.h b/src/modules/PlayerbotV2/Bot/CastPacing.h
index fef2aec530..ae8397b563 100644
--- a/src/modules/PlayerbotV2/Bot/CastPacing.h
+++ b/src/modules/PlayerbotV2/Bot/CastPacing.h
@@ -1,6 +1,6 @@
// CastPacing.h - per-bot cast-speed context and multiplier (Playerbot.Cast.*).
//
-// Pure functions over a snapshot view and the config: no Player access, safe on the AI
+// Pure functions over a snapshot view and the config: no Player access, safe on the bot logic
// threads. PlayerbotV2.cpp publishes the result core-side (API::set_cast_speed_multiplier)
// and BotSnapshotView scales its in-flight cast caps by the same number.
#pragma once
diff --git a/src/modules/PlayerbotV2/Bot/CasterStepOut.h b/src/modules/PlayerbotV2/Bot/CasterStepOut.h
deleted file mode 100644
index 83c008e5a2..0000000000
--- a/src/modules/PlayerbotV2/Bot/CasterStepOut.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// CasterStepOut - which engaged mob a ranged / healer bot of a 5-man instance party keeps its distance from: the pure rule behind the
-// dungeon use of State_Idle's ranged spacing (5b), which in raid maps steps back from engaged elites.
-//
-// In a dungeon party the casters follow the tank closely, and a bot that stands inside the pack (Deadmines 2026-10-09: the mage 1.5 y
-// from the Defias Evoker) is in the splash of every melee mob and of the caster's own ground effects. A mob counts when it is alive,
-// targetable, in combat, held by a tank or hitting another member (a mob on the bot itself is left to the tank: running only drags it
-// along) and is a caster: it is casting now, or the dungeon script lists it as a high-priority kill (the script's casters). The step
-// goes to the ranged stand-off (22 y) of the group of such mobs, never into a hazard and never while the bot is casting.
-// Pure: no game types, tested in tests/game/ClassicCasterStepOut.cpp.
-
-#pragma once
-
-namespace Playerbot {
-
-struct StepOutMob
-{
- bool alive = false;
- bool is_player = false;
- bool targetable = false;
- bool in_combat = false;
- bool held_by_tank_or_member = false; // its victim is a tank, a member or a member's pet - not the bot itself
- bool casting_now = false;
- bool listed_caster = false; // the script's high_priority_kill_entries
-};
-
-inline bool StepOutFromMob(StepOutMob const& m)
-{
- return m.alive && !m.is_player && m.targetable && m.in_combat && m.held_by_tank_or_member && (m.casting_now || m.listed_caster);
-}
-
-} // namespace Playerbot
diff --git a/src/modules/PlayerbotV2/Bot/ClassicBuffLedger.h b/src/modules/PlayerbotV2/Bot/ClassicBuffLedger.h
index 81ca20d02c..09d157d23d 100644
--- a/src/modules/PlayerbotV2/Bot/ClassicBuffLedger.h
+++ b/src/modules/PlayerbotV2/Bot/ClassicBuffLedger.h
@@ -17,6 +17,7 @@ namespace Playerbot::Classic {
constexpr uint32_t kGreaterBlessingTrustMs = 6u * 60u * 1000u; // lasts 15 min
constexpr uint32_t kSingleBlessingTrustMs = 3u * 60u * 1000u; // lasts 5 min
constexpr uint32_t kClassBuffTrustMs = 6u * 60u * 1000u; // 30 min and up
+constexpr uint32_t kAreaBuffTrustMs = 15u * 1000u; // a caster-centred party / raid cast: only the snapshot's lag is covered, the aura list decides after
inline uint32_t BuffTrustMs(uint64_t key)
{
@@ -27,6 +28,7 @@ inline uint32_t BuffTrustMs(uint64_t key)
case 3:
case 4: return kClassBuffTrustMs;
case 5: return kSingleBlessingTrustMs;
+ case 6: return kAreaBuffTrustMs;
default: return 0;
}
}
diff --git a/src/modules/PlayerbotV2/Bot/ClassicHealScope.h b/src/modules/PlayerbotV2/Bot/ClassicHealScope.h
index 335f4da69c..266e40ddd8 100644
--- a/src/modules/PlayerbotV2/Bot/ClassicHealScope.h
+++ b/src/modules/PlayerbotV2/Bot/ClassicHealScope.h
@@ -1,6 +1,6 @@
// ClassicHealScope - where the Classic healers' mana-efficiency rules apply (Combat/Apl/ApClassicHeal.h RaidHealing).
//
-// They used to run in raid maps only. A level 21 party in Deadmines (Karrz, 2026-10-09) runs out of mana for the same reasons a
+// They used to run in raid maps only. A level 21 party in Deadmines (playtest, 2026-10-09) runs out of mana for the same reasons a
// raid does - heals sized to the deficit, the efficient spell for everyone but an emergency or a tank under half health, heals
// already on their way counted, topping up held back at low mana, the tank pre-healed - so every group inside an instance map
// (5-man dungeon or raid) gets them. Open-world parties, solo play and battlegrounds keep the plain rules.
diff --git a/src/modules/PlayerbotV2/Bot/ClassicUpkeep.cpp b/src/modules/PlayerbotV2/Bot/ClassicUpkeep.cpp
index 0fa3781b89..82a4307fb5 100644
--- a/src/modules/PlayerbotV2/Bot/ClassicUpkeep.cpp
+++ b/src/modules/PlayerbotV2/Bot/ClassicUpkeep.cpp
@@ -15,7 +15,10 @@
#include "Services.h"
#include "Util/ConfigReader.h"
#include "Log.h"
+#include "World.h"
+#include "fmt/format.h"
#include
+#include
#include
#include
#include
@@ -26,6 +29,7 @@
#include
#include
#include
+#include
namespace Playerbot::Classic {
@@ -110,6 +114,37 @@ std::span MemberBlessingOrder(uint8 cls, uint32 spec, bool raid)
return raid ? std::span(kCasterRaidOrder) : std::span(kCasterOrder);
}
+// A Greater Blessing that does something on this server. The Greater Blessing spells of this data carry no effect at all (the spell
+// audit lists effect 0 on 25782, 25890, 25894, 25898, 25899, 25916): the cast spends a Symbol of Kings, applies nothing, and the paladin
+// that sees no aura on the class casts it again on the next tick (MC Magmadar 2026-10-10 and the 14-17 Greater casts per paladin in 14
+// minutes of the 2026-10-12 raid). Such a spell is not used; the paladin blesses the members one by one with the normal blessings, which
+// the same data does apply. Answered once per spell id.
+bool GreaterBlessingWorks(uint32 spell_id)
+{
+ static std::mutex mu;
+ static std::unordered_map memo;
+ {
+ std::lock_guard lk(mu);
+ if (auto it = memo.find(spell_id); it != memo.end())
+ return it->second;
+ }
+ bool works = false;
+ if (SpellInfo const* si = sSpellMgr->GetSpellInfo(spell_id, DIFFICULTY_NONE))
+ for (SpellEffectInfo const& eff : si->GetEffects())
+ if (eff.Effect != SPELL_EFFECT_NONE)
+ {
+ works = true;
+ break;
+ }
+ {
+ std::lock_guard lk(mu);
+ memo.emplace(spell_id, works);
+ }
+ if (!works)
+ TC_LOG_INFO("playerbot.v2", "[bless] Greater Blessing spell {} has no effect in this data: paladins bless member by member instead", spell_id);
+ return works;
+}
+
// Blessing `b` on a buff list, with more than `min_ms` left, normal or
// Greater. `caster` set: only that paladin's; `not_caster` set: anyone else's.
bool HasBlessing(std::vector const& buffs, Blessing b, int64 min_ms,
@@ -348,6 +383,25 @@ bool FearBossEngaged(BotSnapshotView const& s)
return false;
}
+// Molten Core: one of the bosses whose fire needs resistance (Magmadar, Baron Geddon, Ragnaros) is in combat with the group.
+bool FireResistBossEngaged(BotSnapshotView const& s)
+{
+ for (NearbyUnit const& u : s.raw().combat.nearby_enemies)
+ if (FightingTheGroup(u) && (u.entry == 11982 || u.entry == 12056 || u.entry == 11502))
+ return true;
+ return false;
+}
+
+// The resistance school the fire resistance aura / totem is held for. In Molten Core they are held only against the three fire
+// bosses: the aura puts a gold haze round every player in range (playtest 2026-10-13), so elsewhere the normal aura and totem stand.
+Resist AuraResistance(BotSnapshotView const& s)
+{
+ Resist const r = InstanceResistance(s.map_id());
+ if (r == Resist::Fire && s.map_id() == 409 && !FireResistBossEngaged(s))
+ return Resist::None;
+ return r;
+}
+
// Raid: the shaman's subgroup (itself included) has a tank in it, as the
// coordinator counts tanks (role / tank spec / plan main tank).
bool SubgroupHasTank(BotSnapshotView const& s, GroupSnapshotView const& g)
@@ -366,7 +420,7 @@ uint32 DesiredTotem(BotSnapshotView const& s, GroupSnapshotView const& g, Elemen
bool const self_melee = !ShamanIsCaster(s.spec());
auto const melee_mate = [](GroupMemberSummary const& m) { return m.role == Role::Tank || IsMeleeSpec(m.cls, m.spec); };
size_t const index = ShamanIndexInParty(s, g);
- Resist const resist = InstanceResistance(s.map_id());
+ Resist const resist = AuraResistance(s);
switch (e)
{
case EARTH:
@@ -530,7 +584,7 @@ CastPick PickBlessing(BotSnapshotView const& s, GroupSnapshotView const& g, bool
// a tank in it - that one is blessed member by member below.
ClassPlan const class_plan = plan_for(ClassBlessingOrder(cls, raid), class_has_tank);
int const bc = BlessingAt(s, class_plan.index, std::span(class_plan.order.data(), class_plan.n));
- if (bc >= 0 && greater_ok && s.knows_spell(kBlessings[bc].greater) && !(class_has_tank && bc == SALVATION))
+ if (bc >= 0 && greater_ok && s.knows_spell(kBlessings[bc].greater) && GreaterBlessingWorks(kBlessings[bc].greater) && !(class_has_tank && bc == SALVATION))
{
uint64 const key = (1ull << 48) | (uint64(bc) << 8) | cls;
for (GroupMemberSummary const& m : *members)
@@ -725,9 +779,15 @@ void ShortClassSupplies(BotSnapshotView const& s, std::vector& out)
out.push_back(ammo);
if (!Services::Config().classic_class_supplies())
return;
+ // A party buff spell the bot's level allows and it has not learned: the restock teaches it.
+ for (uint32 spell : GroupBuffSpells(s.cls()))
+ if (!s.knows_spell(spell))
+ if (LearnableGroupBuff(spell, uint8(s.level())))
+ out.push_back(spell);
for (SupplyFamily const& f : GetSupplyFamilies())
{
if (!SupplyFamilyForClass(f, s.cls())) continue;
+ if (MageConjuresFamily(s.cls(), f.name, [&](uint32 id) { return s.knows_spell(id); })) continue;
uint32 const best = BestSupplyRank(f, s.level());
if (!best) continue;
uint32 have = 0;
@@ -748,6 +808,13 @@ void ShortClassSupplies(BotSnapshotView const& s, std::vector& out)
namespace {
constexpr uint8 KindBit(ConsumableKind k) { return uint8(1u << uint8(k)); }
+
+// The item data files the Demonic Rune under Trade Goods / Other (class 7, subclass 11), not Consumable (MC Geddon on next-6: "class 7 subclass 11,
+// 1 item effects [trigger 0 spell 16666 effect 30 ...]"): every bag scan and the classification take both classes, and the effects decide the kind.
+constexpr bool IsConsumableClass(uint32 item_class, uint32 item_subclass)
+{
+ return item_class == ITEM_CLASS_CONSUMABLE || (item_class == ITEM_CLASS_TRADE_GOODS && item_subclass == ITEM_SUBCLASS_TRADE_GOODS_OTHER);
+}
constexpr uint8 kCombatKinds = KindBit(ConsumableKind::Healthstone) | KindBit(ConsumableKind::HealingPotion)
| KindBit(ConsumableKind::ManaPotion) | KindBit(ConsumableKind::ManaItem);
@@ -756,6 +823,7 @@ struct ConsumableInfo
uint8 kinds = 0; // KindBit mask, 0 = not a consumable we use
bool conjured = false;
uint32 spell = 0; // on-use spell (its cooldown is published under this id)
+ uint32 restore_mana = 0; // mana the on-use spell gives (its energize effects at their base roll)
uint32 cooldown_ms = 0; // full cooldown of that spell
int32 req_level = 0;
uint32 item_level = 0;
@@ -767,7 +835,7 @@ ConsumableInfo ClassifyItem(uint32 entry)
{
ConsumableInfo info;
ItemTemplate const* tmpl = sObjectMgr->GetItemTemplate(entry);
- if (!tmpl || tmpl->GetClass() != ITEM_CLASS_CONSUMABLE)
+ if (!tmpl || !IsConsumableClass(tmpl->GetClass(), tmpl->GetSubClass()))
return info;
for (ItemEffectEntry const* eff : tmpl->Effects)
{
@@ -777,6 +845,9 @@ ConsumableInfo ClassifyItem(uint32 entry)
if (!si)
continue;
info.spell = si->Id;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ if (e.IsEffect(SPELL_EFFECT_ENERGIZE) && e.MiscValue == POWER_MANA)
+ info.restore_mana += uint32(std::max(e.CalcValueAsInt(), 0));
info.cooldown_ms = uint32(std::max({ eff->CoolDownMSec, eff->CategoryCoolDownMSec, 0 }));
if (!info.cooldown_ms)
info.cooldown_ms = std::max(si->RecoveryTime, si->CategoryRecoveryTime);
@@ -795,7 +866,16 @@ ConsumableInfo ClassifyItem(uint32 entry)
}
// Instant restores: generic consumables (healthstones, runes,
// mana gems) and potions; elixirs, flasks and scrolls are buffs.
- if (!info.kinds && (sub == ITEM_SUBCLASS_CONSUMABLE || sub == ITEM_SUBCLASS_POTION))
+ // The 12.1 item data files Demonic Runes and the like under "Other" (subclass 8), not "Consumable" (0): the Ragnaros squad
+ // carried runes the bots never counted or used (0 runes in 76 bag censuses).
+ if (!info.kinds && tmpl->GetClass() == ITEM_CLASS_TRADE_GOODS)
+ {
+ // Only a mana restore: a trade good with a healing on-use is not a healthstone.
+ for (SpellEffectInfo const& e : si->GetEffects())
+ if (e.IsEffect(SPELL_EFFECT_ENERGIZE) && e.MiscValue == POWER_MANA)
+ info.kinds |= KindBit(ConsumableKind::ManaItem);
+ }
+ else if (!info.kinds && (sub == ITEM_SUBCLASS_CONSUMABLE || sub == ITEM_SUBCLASS_POTION || sub == ITEM_SUBCLASS_CONSUMABLE_OTHER))
{
for (SpellEffectInfo const& e : si->GetEffects())
{
@@ -875,7 +955,7 @@ uint32 BestConsumable(BotSnapshotView const& s, ConsumableKind kind, bool conjur
ConsumableInfo const* bestInfo = nullptr;
for (InventoryItem const& it : s.raw().inventory.bag_items)
{
- if (it.item_class != ITEM_CLASS_CONSUMABLE || it.entry == best)
+ if (!IsConsumableClass(it.item_class, it.item_subclass) || it.entry == best)
continue;
ConsumableInfo const& info = Classify(it.entry);
if (!(info.kinds & bit) || (conjured_only && !info.conjured) || !UsableNow(s, info))
@@ -896,7 +976,7 @@ bool CombatConsumableUsedRecently(BotSnapshotView const& s, uint32 window_ms)
{
for (InventoryItem const& it : s.raw().inventory.bag_items)
{
- if (it.item_class != ITEM_CLASS_CONSUMABLE)
+ if (!IsConsumableClass(it.item_class, it.item_subclass))
continue;
ConsumableInfo const& info = Classify(it.entry);
if (!(info.kinds & kCombatKinds) || !info.cooldown_ms)
@@ -922,6 +1002,13 @@ bool HealIncoming(BotSnapshotView const& s, GroupSnapshotView const& g)
bool IsEating(BotSnapshotView const& s) { return HasRegenAura(s, false); }
bool IsDrinking(BotSnapshotView const& s) { return HasRegenAura(s, true); }
+bool RecoverBeforeWalking(BotSnapshotView const& s)
+{
+ if (s.hp_pct() < 50) return true;
+ if (IsEating(s) || IsDrinking(s)) return true;
+ return s.max_power(POWER_MANA) > 0 && s.power_pct(POWER_MANA) < 20 && BestConsumable(s, ConsumableKind::Drink) != 0;
+}
+
bool SafeToRecover(BotSnapshotView const& s, GroupSnapshotView const* g)
{
if (!s.is_alive() || s.in_combat() || s.attackers_count() > 0)
@@ -1147,27 +1234,41 @@ uint32 PickCombatHealthItem(BotSnapshotView const& s, GroupSnapshotView const& g
return BestConsumable(s, ConsumableKind::HealingPotion);
}
-uint32 PickCombatManaItem(BotSnapshotView const& s, GroupSnapshotView const* g)
+uint32 PickCombatManaItem(BotSnapshotView const& s, GroupSnapshotView const* g, bool while_casting)
{
- if (s.max_power(POWER_MANA) <= 0 || s.is_casting() || !ConsumablesAllowed(s))
+ if (s.max_power(POWER_MANA) <= 0 || (s.is_casting() && !while_casting) || !ConsumablesAllowed(s))
return 0;
int32 const mana = s.power_pct(POWER_MANA);
- if (mana > kBossHealerManaItemPct)
- return 0;
// A healer in a boss fight, or in any fight of a raid (the trash packs
// run for minutes), drinks early (its mana is the raid's health);
// everyone else at 20%.
- if (mana > 20 && !(g && IsGroupHealer(s, g) && (BossFight(s) || s.is_in_raid())))
+ bool const raid_healer = g && IsGroupHealer(s, g) && (BossFight(s) || s.is_in_raid());
+ // A raid healer uses an item whenever it is ready and the restore fits in what the pool is missing: the items are limited by their
+ // 2-minute cooldown, not by stock, and a bot that waits for 35% fires them late (MC Geddon n8 run 3: potion and rune both at 33% about
+ // 60 s in, the next ones ready at 180 s, the kill at 159 s, four healers dry for the last 30 s).
+ int32 const ceiling = raid_healer ? kHealerManaItemCeilingPct : 20;
+ if (mana > ceiling)
return 0;
if (CombatConsumableUsedRecently(s))
return 0;
- if (uint32 const gem = BestConsumable(s, ConsumableKind::ManaItem, /*conjured_only*/ true))
+ int32 const max_mana = s.max_power(POWER_MANA);
+ auto const fits = [&](uint32 item)
+ {
+ if (!item)
+ return false;
+ if (!raid_healer)
+ return true;
+ int64 const room = int64(max_mana) * (100 - mana) / 100; // mana the pool is missing
+ return mana <= kBossHealerManaItemPct || int64(Classify(item).restore_mana) <= room;
+ };
+ if (uint32 const gem = BestConsumable(s, ConsumableKind::ManaItem, /*conjured_only*/ true); fits(gem))
return gem;
- if (uint32 const potion = BestConsumable(s, ConsumableKind::ManaPotion))
+ if (uint32 const potion = BestConsumable(s, ConsumableKind::ManaPotion); fits(potion))
return potion;
// Dark / Demonic Rune: 600-1000 damage to the user.
if (s.hp_pct() > 50)
- return BestConsumable(s, ConsumableKind::ManaItem);
+ if (uint32 const rune = BestConsumable(s, ConsumableKind::ManaItem); fits(rune))
+ return rune;
return 0;
}
@@ -1207,7 +1308,7 @@ bool BossFight(BotSnapshotView const& s)
namespace {
// One [raid_cd] / [raid_consume] line per (bot, spell or item) per 10 s: the
-// rules run on the AI workers, so the pacing map is locked.
+// rules run on the bot workers, so the pacing map is locked.
bool LogPaced(BotSnapshotView const& s, uint32 id)
{
static std::mutex mtx;
@@ -1245,6 +1346,59 @@ void NoteConsumableUse(BotSnapshotView const& s, uint32 item, char const* what)
BossFight(s) ? 1 : 0);
}
+// A mana user at 20% or less in an instance fight with nothing picked: why, once per 10 s. (MC Ragnaros 2026-10-13 650994ea: 8 mana items in
+// a 4-minute fight for 12 healers, the five holy priests never drank and six healers sat under 10% from 210 s.)
+void NoteManaItemRefused(BotSnapshotView const& s)
+{
+ if (s.max_power(POWER_MANA) <= 0 || !s.in_combat() || !s.is_in_instance() || s.power_pct(POWER_MANA) > 20 || !LogPaced(s, 0x6D616E61u))
+ return;
+ uint32 potions = 0, runes = 0, gems = 0, other = 0, rune_items = 0;
+ for (InventoryItem const& it : s.raw().inventory.bag_items)
+ {
+ if (it.entry == 12662)
+ rune_items += it.count; // Demonic Rune by entry, whatever the classification below says
+ if (!IsConsumableClass(it.item_class, it.item_subclass))
+ continue;
+ ConsumableInfo const& info = Classify(it.entry);
+ if (info.kinds & KindBit(ConsumableKind::ManaPotion))
+ potions += it.count;
+ else if (info.kinds & KindBit(ConsumableKind::ManaItem))
+ (info.conjured ? gems : runes) += it.count;
+ else if (info.kinds & kCombatKinds)
+ other += it.count;
+ }
+ // Runes in the bag that the classification above does not count: what the item data says about them, once per entry and process. The item's
+ // class and subclass, then each effect with its trigger and the spell's effect types (MC scenarios on af2c045a: 5 Demonic Runes by entry in
+ // every healer bag, 0 classified, 218 refusals).
+ if (rune_items > runes)
+ {
+ static std::atomic s_runeLogged{ false };
+ if (!s_runeLogged.exchange(true))
+ {
+ ItemTemplate const* tmpl = sObjectMgr->GetItemTemplate(12662);
+ std::string effects;
+ if (tmpl)
+ for (ItemEffectEntry const* eff : tmpl->Effects)
+ {
+ if (!eff)
+ continue;
+ SpellInfo const* si = eff->SpellID > 0 ? sSpellMgr->GetSpellInfo(uint32(eff->SpellID), DIFFICULTY_NONE) : nullptr;
+ effects += fmt::format(" [trigger {} spell {} known {}", int(eff->TriggerType), eff->SpellID, si ? 1 : 0);
+ if (si)
+ for (SpellEffectInfo const& e : si->GetEffects())
+ effects += fmt::format(" effect {} misc {}", int(e.Effect), e.MiscValue);
+ effects += "]";
+ }
+ TC_LOG_INFO("playerbot.v2", "[raid_consume] Demonic Rune 12662 is not classified as a mana item: template {}, class {} subclass {}, {} item effects{}",
+ tmpl ? 1 : 0, tmpl ? int(tmpl->GetClass()) : -1, tmpl ? int(tmpl->GetSubClass()) : -1, tmpl ? tmpl->Effects.size() : 0u, effects);
+ }
+ }
+ TC_LOG_INFO("playerbot.v2", "[raid_consume] {} mana {}% and no mana item picked: casting {}, consumables allowed {}, a combat consumable used recently {}, "
+ "usable potion {}, in the bags: {} mana potions, {} runes ({} Demonic Runes by entry), {} gems, {} other combat consumables, hp {}%",
+ s.name(), s.power_pct(POWER_MANA), s.is_casting() ? 1 : 0, ConsumablesAllowed(s) ? 1 : 0, CombatConsumableUsedRecently(s) ? 1 : 0,
+ BestConsumable(s, ConsumableKind::ManaPotion), potions, runes, rune_items, gems, other, s.hp_pct());
+}
+
// ======================= Raid support =======================
// Port of Karrz's ike3 generic raid behaviour (playerbot/strategy: priest /
// mage / druid buff strategies with BUFF_PARTY / GREATER_BUFF_PARTY actions,
@@ -1399,6 +1553,70 @@ void BuffCasters(BotSnapshotView const& s, std::vector const
std::sort(out.begin(), out.end(), [](GroupMemberSummary const* a, GroupMemberSummary const* b) { return a->guid < b->guid; });
}
+// Forever's client data leaves some vanilla buff spells without any effect (Mark of the Wild 1126 and its ranks, Gift of the Wild: the
+// [buff_plan] line shows "effect targets" empty and the research diff lists them 0/0), so a cast does nothing and the buff stays missing.
+// The working version is another spell of the same name (Mark of the Wild 364163, level 50). A buff is cast with the spell that applies an
+// aura: the rank 1 id itself, else the highest same-name spell of the class the bot knows and its level allows.
+bool SpellAppliesAura(SpellInfo const* si)
+{
+ if (!si)
+ return false;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ if (e.IsEffect() && e.IsAura())
+ return true;
+ return false;
+}
+
+uint32 EffectiveBuffSpell(BotSnapshotView const& s, uint32 base)
+{
+ static std::mutex mu;
+ static std::unordered_map>> cache; // base -> (spell level, id), ascending
+ std::vector> cands;
+ {
+ std::lock_guard lk(mu);
+ auto it = cache.find(base);
+ if (it == cache.end())
+ {
+ std::vector> built;
+ if (SpellInfo const* bi = sSpellMgr->GetSpellInfo(base, DIFFICULTY_NONE))
+ {
+ if (SpellAppliesAura(bi))
+ built.emplace_back(bi->SpellLevel, base);
+ else if (bi->SpellName)
+ {
+ LocaleConstant const loc = sWorld->GetDefaultDbcLocale();
+ char const* name = (*bi->SpellName)[loc];
+ sSpellMgr->ForEachSpellInfo([&](SpellInfo const* si)
+ {
+ if (!si || si->Id == base || si->SpellFamilyName != bi->SpellFamilyName || !SpellAppliesAura(si))
+ return;
+ if (!si->SpellLevel || si->SpellLevel > 60 || si->HasAttribute(SPELL_ATTR0_PASSIVE) || !si->SpellName)
+ return;
+ char const* n = (*si->SpellName)[loc];
+ if (name && n && std::string_view(name) == std::string_view(n))
+ built.emplace_back(si->SpellLevel, si->Id);
+ });
+ // Ascending level; at one level the LOWEST id comes last, so the walk from the back takes the vanilla rank (Mark of the
+ // Wild: 9885, level 60) before the same-name spells added later (24752 a 30 minute variant, 1291335 and 1310503 retail
+ // versions). MC 2026-10-13 4839bcf3: the druids cast 1310503 and not one of 40 raiders showed the buff.
+ std::sort(built.begin(), built.end(), [](auto const& a, auto const& b) { return a.first != b.first ? a.first < b.first : a.second > b.second; });
+ std::string ids;
+ for (auto const& [lvl, id] : built)
+ ids += fmt::format(" {}(L{})", id, lvl);
+ TC_LOG_INFO("playerbot.v2", "[buff_plan] spell {} \"{}\" has no aura effect; same-name spells that do:{}", base, name ? name : "",
+ ids.empty() ? " none" : ids);
+ }
+ }
+ it = cache.emplace(base, std::move(built)).first;
+ }
+ cands = it->second;
+ }
+ for (auto it = cands.rbegin(); it != cands.rend(); ++it)
+ if (it->first <= s.level() && s.knows_spell(it->second))
+ return it->second;
+ return base;
+}
+
// The rank of the party version this bot casts: the highest rank it knows
// whose reagents (spell data of that rank) are in the bags, walking down the
// chain so a bot with only the lower rank's reagent (Holy Candle, Wild
@@ -1411,8 +1629,8 @@ uint32 GroupBuffRank(BotSnapshotView const& s, ClassBuffDef const& d)
for (int guard = 0; rank && guard < 32; ++guard, rank = sSpellMgr->GetPrevSpellInChain(rank))
{
SpellInfo const* si = sSpellMgr->GetSpellInfo(rank, DIFFICULTY_NONE);
- if (!si)
- continue;
+ if (!si || !SpellAppliesAura(si))
+ continue; // a rank with no effect (Gift of the Wild in Forever's data) buffs nobody
bool have = true;
for (size_t i = 0; i < si->Reagent.size() && have; ++i)
if (si->Reagent[i] > 0 && si->ReagentCount[i] > 0
@@ -1584,7 +1802,7 @@ struct OwnedDispel
// registers its auras (RegisterEncounterOwnedDispel): without it the generic
// plan must remove everything, Molten Core's curses included.
//
-// Readers are the AI worker threads, at any time. Each registration builds a
+// Readers are the bot worker threads, at any time. Each registration builds a
// new immutable list under g_ownedDispelsWrite and publishes it with one
// release store; readers take one acquire load and walk a list that never
// changes. Superseded lists are kept alive (registration happens a handful
@@ -1648,7 +1866,12 @@ uint32 ResistPotionItem(Resist r)
uint32 PickResistPotion(BotSnapshotView const& s)
{
- uint32 const item = s.raw().pve_order.active ? s.raw().pve_order.resist_potion : 0;
+ uint32 item = s.raw().pve_order.active ? s.raw().pve_order.resist_potion : 0;
+ // A carrier aura on the bot itself (Living Bomb) asks for its potion whatever the boss order says.
+ if (!item)
+ if (Raid::RaidRules const* rules = Raid::RulesForMap(s.map_id()))
+ for (Raid::CarrierPotion const& cp : rules->carrierPotion)
+ if (s.has_aura(cp.aura)) { item = cp.item; break; }
if (!item || !s.in_combat() || s.is_casting() || s.item_count(item) == 0 || !ConsumablesAllowed(s))
return 0;
ConsumableInfo const& info = Classify(item);
@@ -1756,6 +1979,137 @@ uint32 CreateHealthstoneSpell(BotSnapshotView const& s)
return s.knows_spell(CREATE_HEALTHSTONE) ? CREATE_HEALTHSTONE : 0;
}
+namespace {
+
+// The item a Conjure Mana Gem spell creates (its Create Item effect), 0 when the spell data has none.
+uint32 ManaGemItemOf(uint32 spell)
+{
+ SpellInfo const* si = sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE);
+ if (!si)
+ return 0;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ if (e.IsEffect(SPELL_EFFECT_CREATE_ITEM) && e.ItemType)
+ return e.ItemType;
+ return 0;
+}
+
+} // namespace
+
+bool HasManaGem(BotSnapshotView const& s)
+{
+ for (InventoryItem const& it : s.raw().inventory.bag_items)
+ {
+ // The item the conjure spells create, by entry: whatever the item data's class, subclass or conjured flag say.
+ for (uint32 const spell : { 10054u, 10053u, 3552u, 759u })
+ if (it.entry == ManaGemItemOf(spell))
+ return true;
+ if (it.item_class == ITEM_CLASS_CONSUMABLE)
+ {
+ ConsumableInfo const& info = Classify(it.entry);
+ if (info.conjured && (info.kinds & KindBit(ConsumableKind::ManaItem)))
+ return true;
+ }
+ }
+ return false;
+}
+
+uint32 CreateManaGemSpell(BotSnapshotView const& s)
+{
+ if (s.cls() != CLASS_MAGE)
+ return 0;
+ // Conjure Mana Ruby 10054 (58), Jade 10053 (48), Citrine 3552 (38), Agate 759 (28)
+ for (uint32 const spell : { 10054u, 10053u, 3552u, 759u })
+ if (s.knows_spell(spell))
+ return spell;
+ return 0;
+}
+
+namespace {
+
+// Conjure Water / Conjure Food spells, found like the healthstones: mage-family spells with a
+// Create Item effect whose item is a drink or food (Classify). Scanned once on first use.
+struct ConjureSpell
+{
+ uint32 spell = 0;
+ uint32 item = 0;
+ uint32 level = 0;
+ ConsumableKind kind = ConsumableKind::Food;
+};
+
+std::vector const& MageConjureSpells()
+{
+ static std::vector const spells = []
+ {
+ std::vector out;
+ sSpellMgr->ForEachSpellInfo([&out](SpellInfo const* si)
+ {
+ if (!si || si->SpellFamilyName != SPELLFAMILY_MAGE)
+ return;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ {
+ if (!e.IsEffect(SPELL_EFFECT_CREATE_ITEM) || !e.ItemType)
+ continue;
+ ConsumableInfo const& info = Classify(e.ItemType);
+ if (!info.conjured)
+ continue;
+ ConsumableKind kind;
+ if (info.kinds & KindBit(ConsumableKind::Drink))
+ kind = ConsumableKind::Drink;
+ else if (info.kinds & KindBit(ConsumableKind::Food))
+ kind = ConsumableKind::Food;
+ else
+ continue;
+ if (std::none_of(out.begin(), out.end(), [&](ConjureSpell const& c) { return c.spell == si->Id; }))
+ out.push_back({ si->Id, e.ItemType, si->SpellLevel, kind });
+ }
+ });
+ return out;
+ }();
+ return spells;
+}
+
+} // namespace
+
+uint32 BestMageConjure(ConsumableKind kind, std::function const& knows)
+{
+ ConjureSpell const* best = nullptr;
+ for (ConjureSpell const& c : MageConjureSpells())
+ if (c.kind == kind && knows(c.spell) && (!best || c.level > best->level))
+ best = &c;
+ return best ? best->spell : 0;
+}
+
+bool MageConjuresFamily(uint8 cls, std::string_view family, std::function const& knows)
+{
+ if (cls != CLASS_MAGE)
+ return false;
+ if (family == "Water")
+ return BestMageConjure(ConsumableKind::Drink, knows) != 0;
+ if (family == "Food")
+ return BestMageConjure(ConsumableKind::Food, knows) != 0;
+ return false;
+}
+
+uint32 MageConjureSpell(BotSnapshotView const& s, ConsumableKind kind, uint32 want_below)
+{
+ if (s.cls() != CLASS_MAGE || (kind != ConsumableKind::Drink && kind != ConsumableKind::Food))
+ return 0;
+ uint32 const family_top = BestMageConjure(kind, [&](uint32 id) { return s.knows_spell(id); });
+ if (!family_top)
+ return 0;
+ // knows_spell answers for the whole rank family, so family_top is the highest rank of the data, not of the spellbook (a level 20
+ // mage asked for rank 7 Conjure Food and got API_NOT_KNOWN on every try, 2026-10-14 Deadmines): cast the rank it has learned.
+ uint32 const spell = s.resolve_rank(family_top);
+ if (!spell)
+ return 0;
+ uint32 have = 0;
+ for (InventoryItem const& it : s.raw().inventory.bag_items)
+ if (it.item_class == ITEM_CLASS_CONSUMABLE && Classify(it.entry).conjured
+ && (Classify(it.entry).kinds & KindBit(kind)))
+ have += it.count;
+ return have < want_below ? spell : 0;
+}
+
bool MemberHasBuff(GroupSnapshotView const& g, ObjectGuid guid, uint32 tracked_id)
{
if (auto const* members = g.members())
@@ -1873,6 +2227,66 @@ MissingBuff MissingGroupBuff(BotSnapshotView const& s, GroupSnapshotView const&
namespace {
+// A class buff whose single spell has no explicit unit target (Mark of the Wild in the Forever data: the cast log shows an empty
+// target, whoever the bot aimed at) is cast around the caster: it reaches the caster's party, or its raid, in range, not a chosen
+// member. Picking a target per member for it casts the same spell once per member (MC 2026-10-12: 42 + 40 casts of a 20 mana spell in a
+// 40-man raid, none of the picked targets showing the buff afterwards).
+struct AreaBuff
+{
+ bool area = false;
+ bool party_only = true; // reaches only the caster's subgroup
+};
+
+AreaBuff AreaBuffOf(uint32 spell)
+{
+ AreaBuff out;
+ SpellInfo const* si = spell ? sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE) : nullptr;
+ if (!si)
+ return out;
+ {
+ // Once per spell: how the data targets it (the cast log's target column is empty for such a spell).
+ static std::mutex seen_mu;
+ static std::unordered_set seen;
+ bool first;
+ {
+ std::lock_guard lk(seen_mu);
+ first = seen.insert(spell).second;
+ }
+ if (first)
+ {
+ std::string targets;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ targets += fmt::format(" [{}/{}]", uint32(e.TargetA.GetTarget()), uint32(e.TargetB.GetTarget()));
+ char const* n = si->SpellName ? (*si->SpellName)[sWorld->GetDefaultDbcLocale()] : "";
+ TC_LOG_INFO("playerbot.v2", "[buff_plan] spell {} \"{}\": explicit unit target {}, targets area {}, effect targets A/B{}", spell, n ? n : "",
+ si->NeedsExplicitUnitTarget() ? "yes" : "no", si->IsTargetingArea() ? "yes" : "no", targets);
+ }
+ }
+ if (si->NeedsExplicitUnitTarget() || !si->IsTargetingArea())
+ return out;
+ out.area = true;
+ for (SpellEffectInfo const& e : si->GetEffects())
+ for (Targets const t : { e.TargetA.GetTarget(), e.TargetB.GetTarget() })
+ if (t == TARGET_UNIT_CASTER_AREA_RAID || t == TARGET_UNIT_TARGET_ALLY_OR_RAID)
+ out.party_only = false;
+ return out;
+}
+
+// Back-off of such a cast that reached nobody: the needy count after a cast was no lower than before it, twice running (the spell
+// does not reach those members: another subgroup, out of its radius, or caster only). The buff then waits kAreaBuffBackoffMs.
+constexpr uint32 kAreaBuffBackoffMs = 5u * 60u * 1000u;
+struct AreaBuffState { uint32 last_needy = 0; uint32 stalls = 0; uint32 backoff_until_ms = 0; };
+std::mutex g_area_buff_mu;
+std::unordered_map g_area_buff; // (caster counter << 8) ^ buff index
+
+bool AreaBuffBackedOff(ObjectGuid caster, size_t di)
+{
+ uint32 const now = GameTime::GetGameTimeMS();
+ std::lock_guard lk(g_area_buff_mu);
+ auto const it = g_area_buff.find((caster.GetCounter() << 8) ^ di);
+ return it != g_area_buff.end() && it->second.backoff_until_ms && int32(it->second.backoff_until_ms - now) > 0;
+}
+
// The class buff this bot owes, whether or not it is shapeshifted right now
// (the plan does not depend on the form: see BuffCasters).
CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, PickSkip skip)
@@ -1889,6 +2303,10 @@ CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, Pic
ClassBuffDef const& d = kClassBuffs[di];
if (d.cls != s.cls() || !s.knows_spell(d.single))
continue;
+ // The spell this buff is cast with (see EffectiveBuffSpell); a buff with no spell that applies an aura is not cast at all.
+ uint32 const single = EffectiveBuffSpell(s, d.single);
+ if (!SpellAppliesAura(sSpellMgr->GetSpellInfo(single, DIFFICULTY_NONE)))
+ continue;
if (d.raid_only && !g.is_raid())
continue;
if (!InstanceDealsSchool(s.map_id(), d.school))
@@ -1903,8 +2321,8 @@ CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, Pic
continue;
// Paced like the group picks: a cast whose aura the snapshot does not show must not repeat every tick.
uint64 const key = (5ull << 48) | uint64(di);
- if (!SelfHasBuff(s, d) && s.is_ready(d.single) && !skip(key))
- return { d.single, s.guid(), key };
+ if (!SelfHasBuff(s, d) && s.is_ready(single) && !skip(key))
+ return { single, s.guid(), key };
continue;
}
@@ -1914,6 +2332,36 @@ CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, Pic
if (me == casters.end())
continue;
+ if (AreaBuff const area = AreaBuffOf(single); area.area)
+ {
+ // One cast from this caster reaches its party (or raid) in range: owed when a member it reaches lacks the buff.
+ GroupMemberSummary const* const mine = *me;
+ if (AreaBuffBackedOff(s.guid(), di))
+ continue;
+ uint32 needy = 0;
+ for (GroupMemberSummary const& m : *members)
+ {
+ if (!NeedsBuff(s, d, m)) continue;
+ if (area.party_only && m.subgroup != mine->subgroup) continue;
+ if (m.guid != s.guid() && MemberDist2(m, bx, by, bz) > kBuffCastRange * kBuffCastRange) continue;
+ ++needy;
+ }
+ if (!needy)
+ continue;
+ // Casters of the same subgroup share the work: the lowest guid casts (a raid-wide spell: every caster that reaches someone).
+ if (area.party_only)
+ if (GroupMemberSummary const* lead = *std::find_if(casters.begin(), casters.end(),
+ [&](GroupMemberSummary const* c) { return c->subgroup == mine->subgroup; });
+ lead && lead->guid != s.guid())
+ continue;
+ uint64 const key = (6ull << 48) | uint64(di);
+ if (!s.is_ready(single) || skip(key))
+ continue;
+ CastPick pick{ single, s.guid(), key };
+ pick.area_needy = needy;
+ return pick;
+ }
+
uint32 const group_rank = GroupBuffRank(s, d);
for (uint8 sg = 0; sg < 8; ++sg)
{
@@ -1955,6 +2403,31 @@ CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, Pic
}
if (!first)
continue;
+ // MC 2026-10-12: 82 single Mark of the Wild and 44 single Power Word: Fortitude casts across two 40-man runs, no Gift of the
+ // Wild or Prayer of Fortitude at all. Name why the party version is not used, once a minute per caster and buff.
+ if (d.group && needy >= 2 && !group_rank)
+ {
+ static std::mutex why_mu;
+ static std::unordered_map why_last;
+ uint32 const now = GameTime::GetGameTimeMS();
+ bool due = false;
+ {
+ std::lock_guard lk(why_mu);
+ uint32& l = why_last[(s.guid().GetCounter() << 20) ^ d.single];
+ if (!l || now - l >= 60000u) { l = now ? now : 1u; due = true; }
+ }
+ if (due)
+ {
+ uint32 const known = s.resolve_rank(d.group);
+ std::string reagents;
+ if (SpellInfo const* si = known ? sSpellMgr->GetSpellInfo(known, DIFFICULTY_NONE) : nullptr)
+ for (size_t i = 0; i < si->Reagent.size(); ++i)
+ if (si->Reagent[i] > 0 && si->ReagentCount[i] > 0)
+ reagents += fmt::format(" {}x{}(has {})", si->ReagentCount[i], si->Reagent[i], s.item_count(uint32(si->Reagent[i])));
+ TC_LOG_INFO("playerbot.v2", "[buff_plan] {} casts single {} on {} needy of subgroup {}: no party version ({}; known rank {}, reagents{})",
+ s.name(), d.single, needy, uint32(sg), known ? "reagents short" : "spell not known", known, reagents.empty() ? " none" : reagents);
+ }
+ }
if (group_rank && needy >= 2)
{
// The party version covers the subgroup: while it is paced
@@ -1972,8 +2445,8 @@ CastPick ClassBuffPick(BotSnapshotView const& s, GroupSnapshotView const& g, Pic
if (m.subgroup != sg || !NeedsBuff(s, d, m)) continue;
if (m.guid != s.guid() && MemberDist2(m, bx, by, bz) > kBuffCastRange * kBuffCastRange) continue;
uint64 const key = (4ull << 48) | (uint64(di) << 40) | (m.guid.GetCounter() & 0xFFFFFFFFFFull);
- if (s.is_ready(d.single) && !skip(key))
- return { d.single, m.guid, key };
+ if (s.is_ready(single) && !skip(key))
+ return { single, m.guid, key };
}
}
}
@@ -1992,6 +2465,29 @@ constexpr int32 kFormDrinkBelowManaPct = 70;
} // namespace
+void NoteAreaBuffCast(ObjectGuid caster, uint64 key, uint32 needy, uint32 now_ms)
+{
+ if ((key >> 48) != 6)
+ return;
+ size_t const di = size_t(key & 0xFFFFu);
+ std::lock_guard lk(g_area_buff_mu);
+ AreaBuffState& st = g_area_buff[(caster.GetCounter() << 8) ^ di];
+ // This cast comes after the last one's trust window: were that many members, or more, still needy, it reached nobody new.
+ if (st.last_needy && needy >= st.last_needy)
+ ++st.stalls;
+ else
+ st.stalls = 0;
+ st.last_needy = needy;
+ if (st.stalls >= 2)
+ {
+ st.backoff_until_ms = now_ms + kAreaBuffBackoffMs;
+ st.stalls = 0;
+ st.last_needy = 0;
+ TC_LOG_INFO("playerbot.v2", "[buff_plan] caster {} buff index {}: {} members still needy after two caster-centred casts, backing off {} s", caster.GetCounter(), di,
+ needy, kAreaBuffBackoffMs / 1000u);
+ }
+}
+
CastPick PickClassBuff(BotSnapshotView const& s, GroupSnapshotView const& g, PickSkip skip)
{
// A druid in a form can't cast Mark of the Wild / Thorns: it leaves the
@@ -2045,7 +2541,7 @@ uint32 PickPaladinAura(BotSnapshotView const& s, GroupSnapshotView const& g)
{
if (!IsVanillaRealm() || s.cls() != CLASS_PALADIN || s.is_mounted())
return 0;
- Resist const resist = InstanceResistance(s.map_id());
+ Resist const resist = AuraResistance(s);
uint32 wishes[8];
size_t n = 0;
@@ -2138,7 +2634,7 @@ bool IsEncounterOwnedDispel(uint32 map_id, uint32 aura_id)
if (o.map_id == map_id && o.aura == aura_id)
return true;
// The raid layer's own rules for every raid map (Bot/Raid/RaidEncounterData_*.cpp): its dispel jobs, mind-controlled
- // members and do-not-dispel auras. Read-only after the registry's one-time init, so safe from the AI workers; this is
+ // members and do-not-dispel auras. Read-only after the registry's one-time init, so safe from the bot workers; this is
// why the raid layer never calls RegisterEncounterOwnedDispel.
return Raid::OwnsAura(map_id, aura_id);
}
diff --git a/src/modules/PlayerbotV2/Bot/ClassicUpkeep.h b/src/modules/PlayerbotV2/Bot/ClassicUpkeep.h
index d0ee7fe3ec..9f3a23d2e0 100644
--- a/src/modules/PlayerbotV2/Bot/ClassicUpkeep.h
+++ b/src/modules/PlayerbotV2/Bot/ClassicUpkeep.h
@@ -9,10 +9,12 @@
// - shaman weapon imbues and totems (one per element, by spec and group);
// - rogue poisons (Instant on the main hand, Deadly on the off hand);
// - whether the bot is short of a class tool or reagent (ClassicSupplies).
-// Pure functions of the snapshot: safe on the AI worker threads.
+// Pure functions of the snapshot: safe on the bot worker threads.
#pragma once
+#include
+#include
#include "InstanceSchools.h"
#include "BotTypes.h"
#include "ObjectGuid.h"
@@ -38,6 +40,8 @@ struct CastPick
// rank 1 id cast at the highest known rank (cast): a party buff whose top
// rank's reagent is missing but the lower rank's is in the bags.
bool exact_rank = false;
+ // A caster-centred buff (key kind 6): how many members it was needy of when picked, so the rule can tell a cast that reached nobody.
+ uint32 area_needy = 0;
};
// Raid support picks skip work the caller is still pacing: `skip(ctx, key)`
@@ -111,6 +115,8 @@ CastPick PickFearWard(BotSnapshotView const& s, GroupSnapshotView const& g);
// change the plan. Out of combat only; nothing while this bot is in a form
// (DruidFormToLeave takes it out first).
CastPick PickClassBuff(BotSnapshotView const& s, GroupSnapshotView const& g, PickSkip skip = {});
+// A cast PickClassBuff returned with a kind 6 key (caster-centred buff): tracks whether it reached anyone, and backs the buff off when not.
+void NoteAreaBuffCast(ObjectGuid caster, uint64 key, uint32 needy, uint32 now_ms);
// Druid, out of combat: the form aura (Cat, Bear, Dire Bear, Travel, Moonkin;
// never Aquatic) to cancel because PickClassBuff has a buff for this druid once
@@ -162,7 +168,7 @@ constexpr int32 kDispelMinManaPct = 15;
// Shadow Word: Pain / Immolate, 409/19408 Magmadar's Panic;
// - register only auras the layer really removes, or nobody will;
// - registration is idempotent and thread-safe at any time (an immutable
-// list is republished atomically; AI workers read it lock-free), but
+// list is republished atomically; bot workers read it lock-free), but
// registering at startup avoids a window in which both the layer and
// the generic plan dispel the same debuff. There is no unregister.
bool IsEncounterOwnedDispel(uint32 map_id, uint32 aura_id);
@@ -192,6 +198,11 @@ bool IsHealthstoneItem(uint32 item_entry);
bool HasHealthstone(BotSnapshotView const& s);
uint32 CreateHealthstoneSpell(BotSnapshotView const& s);
+// Mage mana gems: HasManaGem is a conjured mana-restoring item in the bags; CreateManaGemSpell the best Conjure Mana Agate / Citrine /
+// Jade / Ruby the mage knows (0 = none, or not a mage). The gem is the first mana item PickCombatManaItem takes.
+bool HasManaGem(BotSnapshotView const& s);
+uint32 CreateManaGemSpell(BotSnapshotView const& s);
+
// A group member carries the tracked buff `tracked_id` (any caster).
bool MemberHasBuff(GroupSnapshotView const& g, ObjectGuid guid, uint32 tracked_id);
@@ -276,8 +287,17 @@ enum class ConsumableKind : uint8
// first on a tie. With `conjured_only` only conjured items count. 0 = none.
uint32 BestConsumable(BotSnapshotView const& s, ConsumableKind kind, bool conjured_only = false);
+// Mage Conjure Water / Conjure Food: the best rank the mage knows (found in the spell data, like
+// the healthstones) when fewer than `want_below` conjured items of that kind (Drink / Food) are
+// in the bags, else 0.
+uint32 MageConjureSpell(BotSnapshotView const& s, ConsumableKind kind, uint32 want_below);
+// Best Conjure Water (Drink) / Conjure Food (Food) rank `knows` accepts, 0 = none.
+uint32 BestMageConjure(ConsumableKind kind, std::function const& knows);
+// A mage that can conjure the item of supply family `family` ("Water", "Food") makes its own: the restock skips it.
+bool MageConjuresFamily(uint8 cls, std::string_view family, std::function const& knows);
+
// The bot used a combat consumable (potion, healthstone, rune, mana gem) in
-// the last `window_ms` (Karrz: at most one per 2.5 s, so a healthstone and a
+// the last `window_ms` (the owner: at most one per 2.5 s, so a healthstone and a
// potion never go in the same instant).
bool CombatConsumableUsedRecently(BotSnapshotView const& s, uint32 window_ms = 2500);
@@ -288,7 +308,11 @@ bool HealIncoming(BotSnapshotView const& s, GroupSnapshotView const& g);
bool IsEating(BotSnapshotView const& s);
bool IsDrinking(BotSnapshotView const& s);
-// Karrz's SafeToRecover / UseFoodStrategy: free to sit down - nothing attacks
+// The quest / travel walkers (idle priority 697-700) stand down while the bot should recover first: under half health, a
+// food / drink aura is up (standing up mid-meal wastes the item), or a caster with water in the bags is under a fifth mana.
+bool RecoverBeforeWalking(BotSnapshotView const& s);
+
+// the owner's SafeToRecover / UseFoodStrategy: free to sit down - nothing attacks
// the bot and no group member fights within 45 yards and no enemy engaged with the bot or its group stands within 30 yards (Bot/RecoverRules.h).
// Without a group view only the enemies are checked (a fight next to the bot
// still shows as an enemy with a victim).
@@ -308,9 +332,9 @@ RecoveryPick PickRecovery(BotSnapshotView const& s, int32 start_hp, int32 start_
// Healer mana a grouped instance tank waits for before it pulls (State_Idle
// dungeon group-ready gate). The drink rules start a grouped healer's drink
// below this same value, so a healer that holds the pull always drinks.
-// 85 was Karrz's ike3 "raid prepull recover" target; 75 since 2026-10-07 (Karrz: MC trash takes too long).
+// 85 was Karrz's ike3 "raid prepull recover" target; 75 since 2026-10-07 (the owner: MC trash takes too long).
constexpr int32 kPullReadyHealerManaPct = 75;
-// A five-man healer has no trash-pace cost to weigh (Karrz's 2026-10-07 call was about MC): a drink that starts only below 75 %
+// A five-man healer has no trash-pace cost to weigh (the owner's 2026-10-07 call was about MC): a drink that starts only below 75 %
// never starts for a priest at 75-94 %, so she pulled into every pack three-quarters full and was dry by the boss
// (deadmines_full@sneed). Dungeon healers start the drink, and the tank's pull gate waits, below this.
constexpr int32 kPullReadyDungeonHealerManaPct = 90;
@@ -341,6 +365,9 @@ constexpr int32 kHeldRaidHealerManaPct = 95;
// Same value: the tank's gate waits for such a member for at most
// kPullReadyDpsHoldCapMs per hold (a bot with no drink must not freeze the raid).
constexpr uint32 kPullReadyDpsHoldCapMs = 20000;
+// A member under the pull-ready health mark (70 %) holds the tank's pull for at most this long per hold: the healers top a hurt member off
+// in seconds, so a longer wait means they cannot (out of reach, a tick that keeps hurting it) and the raid goes on.
+constexpr uint32 kPullReadyHpHoldCapMs = 30000;
// This bot drinks for the next pull of its grouped instance: a healer, or
// (PullRecover on) any other mana user.
@@ -355,7 +382,7 @@ bool IsGroupHealer(BotSnapshotView const& s, GroupSnapshotView const* g);
int32 OocDrinkStartManaPct(BotSnapshotView const& s, GroupSnapshotView const* g,
int32 open_world_pct);
-// In-combat emergency heal item (Karrz's UsePotionsStrategy): at 30% health
+// In-combat emergency heal item (the owner's UsePotionsStrategy): at 30% health
// or below, healthstone first, then a healing potion; kept while a heal is
// about to land unless the bot is at 20% or below. 0 = nothing to use.
uint32 PickCombatHealthItem(BotSnapshotView const& s, GroupSnapshotView const& g);
@@ -365,12 +392,15 @@ uint32 PickCombatHealthItem(BotSnapshotView const& s, GroupSnapshotView const& g
// Demonic Rune (which costs health: only above 50%). The potions' shared
// cooldown and the runes' own cooldown are read separately per item (an item
// on cooldown is skipped), so a healer drinks a potion and later a rune.
-uint32 PickCombatManaItem(BotSnapshotView const& s, GroupSnapshotView const* g = nullptr);
+// asks whether an item would be due if no cast were running (the mana break: the caster stops starting casts).
+uint32 PickCombatManaItem(BotSnapshotView const& s, GroupSnapshotView const* g = nullptr, bool while_casting = false);
// Health % at or below which PickCombatHealthItem uses an item.
constexpr int32 kCombatHealthItemPct = 30;
// Mana % at or below which a group healer in a boss fight uses a mana item.
constexpr int32 kBossHealerManaItemPct = 35;
+// ... and the mana % above which it does not even look: from here down an item is used as soon as its restore fits in the missing mana.
+constexpr int32 kHealerManaItemCeilingPct = 85;
// ======================= Boss fights (major cooldowns) =======================
// A boss by its creature data: the dungeon-boss flag or the world-boss rank
@@ -393,5 +423,9 @@ void NoteCooldownUse(BotSnapshotView const& s, uint32 spell, char const* what);
// instance (same pacing as NoteCooldownUse).
void NoteConsumableUse(BotSnapshotView const& s, uint32 item, char const* what);
+// [raid_consume] line for a mana user at 20% or less in an instance fight with no mana item picked: the reason (casting, a recent
+// consumable, none in the bags), once per bot per 10 s.
+void NoteManaItemRefused(BotSnapshotView const& s);
+
} // namespace Classic
} // namespace Playerbot
diff --git a/src/modules/PlayerbotV2/Bot/DeathHotspots.h b/src/modules/PlayerbotV2/Bot/DeathHotspots.h
index 2efcdae673..85119e26f9 100644
--- a/src/modules/PlayerbotV2/Bot/DeathHotspots.h
+++ b/src/modules/PlayerbotV2/Bot/DeathHotspots.h
@@ -2,7 +2,7 @@
// that saw DeathsNeeded deaths within WindowSec is a hotspot, and it is dangerous for a bot that is more than
// LevelMargin levels below the strongest killer seen there. Quest pursuit uses it to give up objectives inside a
// hotspot, so a bot stops walking into the camp that has just killed a dozen of its peers (Booty Bay Bloodsail camp,
-// 2026-10-07: 20 Fireball deaths). Written on the world thread (Module::OnDeath), read from the AI workers.
+// 2026-10-07: 20 Fireball deaths). Written on the world thread (Module::OnDeath), read from the bot workers.
#pragma once
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.cpp b/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.cpp
index 072d970bef..b3e1359a5c 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.cpp
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.cpp
@@ -26,14 +26,14 @@ inline uint64_t MakeKey(uint32_t map_id, uint32_t difficulty)
// Playerbot.Behavior.DungeonTactics (default on): the generated mob tactics (Tactics/DungeonTactics.h) feed the advice on a Classic realm.
bool DungeonTacticsEnabled()
{
- static bool const on = IsVanillaRealm() && sConfigMgr->GetBoolDefault("Playerbot.Behavior.DungeonTactics", true);
+ static bool const on = IsVanillaRealm() && sConfigMgr->GetBoolDefault("Playerbot.Behavior.DungeonTactics", true, true);
return on;
}
std::string const& SharedDb()
{
static std::string const db =
- sConfigMgr->GetStringDefault("Playerbot.SharedDatabase", "playerbot");
+ sConfigMgr->GetStringDefault("Playerbot.SharedDatabase", "playerbot", true);
return db;
}
}
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.h b/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.h
index a67ab39bbc..21d8d4a1cb 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.h
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/DungeonScript.h
@@ -24,9 +24,9 @@ namespace Playerbot {
class BotSnapshotView;
// Advice bundle returned by a DungeonScript per tick. Empty fields
-// mean "no opinion" — the AI uses generic logic. The advice struct
+// mean "no opinion" — the bot logic uses generic logic. The advice struct
// is intentionally small and value-typed so the registry can hand
-// it out by-value to the AI worker without locking.
+// it out by-value to the bot worker without locking.
struct DungeonAdvice
{
// Creature_template entries the bot should pull first / focus
@@ -96,7 +96,7 @@ struct DungeonAdvice
std::vector soak_spells;
// Boss creature entries in encounter order. Order is encounter-
- // progression so the dungeon AI can tell whether the run is complete
+ // progression so the dungeon bot logic can tell whether the run is complete
// (all bosses dead) and which boss is "next". Used by tank-advance
// and by diag commands. Live boss creature positions are read from
// the map; if no waypoints are provided, advancement falls back to a
@@ -157,7 +157,7 @@ struct DungeonAdvice
// platform, or descent reached after the main clear — where the group must
// stay TIGHT and FOCUS-KILL casters instead of CCing/spreading, and the
// tank must not out-range its healer. When the tank descends BELOW this
- // world-Z the dungeon AI switches into "tight engagement" mode:
+ // world-Z the dungeon bot logic switches into "tight engagement" mode:
// * tighter advance-cohesion gate (healer ≤18y, every member ≤25y, ≥85% HP)
// * tighter follower regroup radius (14y vs the default 22y) so the group
// balls up INSIDE the advance gate — eliminates the 18-22y cohesion
@@ -245,7 +245,7 @@ public:
DungeonScriptMgr() = default;
// Takes ownership; called once per script at module init. The
- // registry must be assembled before any AI ticks consult it.
+ // registry must be assembled before any bot ticks consult it.
void Register(std::unique_ptr script);
// Register an "always-on" script whose advice is merged with the
@@ -275,7 +275,7 @@ public:
// again from `.playerbot reloadroutes` (SOAP) whenever the editor commits
// route changes — builds the new table off to the side and atomically swaps
// the shared_ptr under routes_mutex_, so concurrent GetAdvice readers on the
- // AI worker threads keep a consistent (old or new) snapshot and no restart
+ // bot worker threads keep a consistent (old or new) snapshot and no restart
// is needed. Returns the number of waypoints loaded.
size_t LoadGeneratedRoutes();
@@ -322,7 +322,7 @@ private:
// DB-sourced route waypoints keyed by (map_id<<8)|difficulty. The map is
// IMMUTABLE once published; LoadGeneratedRoutes builds a fresh instance and
// swaps the shared_ptr under routes_mutex_ (hot-reload). GetAdvice readers
- // (AI worker threads, every tick) take a brief shared_lock only to copy the
+ // (bot worker threads, every tick) take a brief shared_lock only to copy the
// shared_ptr, then read the immutable map lock-free — an in-flight reader
// keeps the old table alive via its shared_ptr during a swap.
using RouteTable =
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/GroupWedgeWatchdog.cpp b/src/modules/PlayerbotV2/Bot/Dungeon/GroupWedgeWatchdog.cpp
index 4c111f021b..0e862e3d46 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/GroupWedgeWatchdog.cpp
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/GroupWedgeWatchdog.cpp
@@ -45,7 +45,7 @@ void GroupWedgeWatchdog::Update(uint32 now_ms)
return;
last_tick_ms_ = now_ms;
- if (!sConfigMgr->GetBoolDefault("PlayerbotV2.GroupWedge.Enabled", true))
+ if (!sConfigMgr->GetBoolDefault("PlayerbotV2.GroupWedge.Enabled", true, true))
{
if (!groups_.empty()) groups_.clear();
return;
@@ -54,11 +54,11 @@ void GroupWedgeWatchdog::Update(uint32 now_ms)
// Tunables (read live so they are hot-reloadable; quiet defaults so the keys
// are optional). A wedge is "no forward progress (group centroid moved
// < MoveYards) AND not in real combat for WindowMs".
- const uint32 windowMs = uint32(sConfigMgr->GetIntDefault("PlayerbotV2.GroupWedge.WindowMs", 20000));
- const float cohereY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.CohereYards", 30.0));
- const float splitY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.SplitYards", 45.0));
- const float farY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.FarYards", 45.0));
- const float moveY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.MoveYards", 12.0));
+ const uint32 windowMs = uint32(sConfigMgr->GetIntDefault("PlayerbotV2.GroupWedge.WindowMs", 20000, true));
+ const float cohereY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.CohereYards", 30.0, true));
+ const float splitY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.SplitYards", 45.0, true));
+ const float farY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.FarYards", 45.0, true));
+ const float moveY = float(sConfigMgr->GetFloatDefault("PlayerbotV2.GroupWedge.MoveYards", 12.0, true));
// -- Bucket grouped, instanced bots by (group, map) (mirror PveGroupCoordinator) --
struct Bucket
@@ -66,6 +66,7 @@ void GroupWedgeWatchdog::Update(uint32 now_ms)
uint64 group_low = 0;
uint32 map_id = 0;
std::vector> bots;
+ bool owner_ordered = false; // a bot is under the owner's Stay / Hold / Follow order: standing still is the order, not a wedge
};
std::unordered_map buckets;
Services::Registry().for_each([&](BotId id, BotRegistryEntry const& e)
@@ -84,6 +85,8 @@ void GroupWedgeWatchdog::Update(uint32 now_ms)
b.group_low = glow;
b.map_id = m->GetId();
b.bots.emplace_back(uint64(id), p);
+ if (e.ai->holding_position(now_ms) || e.ai->owner_follow_order())
+ b.owner_ordered = true;
});
// Forget groups that are no longer bucketed (left instance / disbanded).
@@ -96,6 +99,13 @@ void GroupWedgeWatchdog::Update(uint32 now_ms)
Services::Snapshots().latest_group(b.bots.front().first);
if (!gs || gs->members.empty())
continue;
+ // A human-led party is the owner's to move (he can be AFK, or wait for his Attack), and an ordered Stay / Hold / Follow is
+ // standing still on purpose: neither is a wedge.
+ if (b.owner_ordered || !GroupSnapshotView(*gs).leader_is_bot())
+ {
+ groups_.erase(key);
+ continue;
+ }
// Alive, same-map member geometry. (Corpse-runners / cross-map laggards
// excluded — a wedge is about the live body's progress.)
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/MarkCc.h b/src/modules/PlayerbotV2/Bot/Dungeon/MarkCc.h
index 7c0614e671..ac502e8e14 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/MarkCc.h
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/MarkCc.h
@@ -127,6 +127,19 @@ inline void LogRefusal(uint64 bot_low, uint32 now_ms, char const* name, char con
TC_LOG_INFO("playerbot.v2", "[mark_cc] {} does not cast: {} (entry {} type {} dist {:.0f})", name, why, entry, ctype, dist);
}
+// The bot's own crowd control still holds a mob other than `except`. Vanilla Polymorph / Shackle / Banish / Hibernate hold one target per
+// caster, so a second cast breaks the first: every crowd-control decider (the group CC pick and the marked CC) asks this one check.
+template
+bool CasterHoldsAnother(View const& s, ObjectGuid except)
+{
+ if (s.cls() == CLASS_ROGUE)
+ return false; // a rogue's Sap holds any number of mobs
+ for (NearbyUnit const& n : s.raw().combat.nearby_enemies)
+ if (n.is_cc_locked && n.cc_caster == s.guid() && n.guid != except)
+ return true;
+ return false;
+}
+
// Cast the bot's crowd control on `target` (the PveOrder::cc_target mob) when it is not held yet. True when it emitted.
template
bool TryCast(View const& s, Emit& emit, ObjectGuid target)
@@ -146,6 +159,8 @@ bool TryCast(View const& s, Emit& emit, ObjectGuid target)
return false;
if (u->is_cc_locked)
return false; // held (by us or another): the goal
+ if (CasterHoldsAnother(s, target))
+ return LogRefusal(low, now, s.name().c_str(), "this caster's crowd control already holds another mob", u->entry, TypeOf(*u), 0.f), false;
// The raid's current kill target, or a mob already under half health, is being killed: a broken hold is not re-applied
// (Garr 2026-10-08: the warlocks re-banished the add the raid was finishing and Garr enraged).
if (s.raw().pve_order.kill_focus == target)
@@ -168,8 +183,8 @@ bool TryCast(View const& s, Emit& emit, ObjectGuid target)
return false;
}
uint32 const spell = SpellFor(s, *o);
- if (!s.is_ready(spell))
- return LogRefusal(low, now, s.name().c_str(), "spell not ready", u->entry, TypeOf(*u), dist), false;
+ // Range and standing still come before the ready check, which refuses a hard cast while the bot walks: a caster held in its
+ // raid formation slot 26-35 y from the mob was "not ready" for 26 s and never walked in (Majordomo n78: Gorham and Elladu).
// Out of reach: walk into it instead of standing out of range (Garr 2026-10-09: the banishers kept their formation slot 38-57 yd
// from the Firesworn, 103 refusals, and the adds ran loose later). The stop point is a few yards inside the range on the line
// from the mob.
@@ -181,11 +196,13 @@ bool TryCast(View const& s, Emit& emit, ObjectGuid target)
return emit.move_to(u->x + (p.x - u->x) * f, u->y + (p.y - u->y) * f, u->z + (p.z - u->z) * f, /*run=*/true);
}
// In range but walking (a formation step): stop, the cast goes out next tick (a hard cast is refused while moving).
- if (s.is_moving())
+ if (s.is_moving() && s.knows_spell(spell))
{
emit.stop_movement();
return true;
}
+ if (!s.is_ready(spell))
+ return LogRefusal(low, now, s.name().c_str(), "spell not ready", u->entry, TypeOf(*u), dist), false;
bool const ok = o->self_cast ? emit.cast(spell) : emit.cast(spell, target);
if (ok)
TC_LOG_INFO("playerbot.v2", "[mark_cc] cast {} spell={} on entry={} ({}) type={} dist={:.0f}",
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.cpp b/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.cpp
index 0ad66be543..6edb08c78e 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.cpp
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.cpp
@@ -40,6 +40,7 @@
#include "WorldSession.h"
#include
+#include
#include
#include
#include
@@ -67,7 +68,7 @@ void PveGroupCoordinator::Update(uint32 now_ms)
return;
last_plan_ms_ = now_ms;
- if (!sConfigMgr->GetBoolDefault("Playerbot.Pve.Coordinator.Enable", true))
+ if (!sConfigMgr->GetBoolDefault("Playerbot.Pve.Coordinator.Enable", true, true))
{
if (!orders_.empty()) orders_.clear();
last_dump_ = "coordinator disabled (Playerbot.Pve.Coordinator.Enable=0)";
@@ -112,15 +113,15 @@ void PveGroupCoordinator::Update(uint32 now_ms)
if (p->IsAlive() && p->IsInCombat())
b.in_combat = true;
// The owner's go (MarksNeedOrder): an attack / engage order, a /focus pin or a pull back running on a member bot.
- // A pull back is NOT the group's go (Karrz, MC Molten Giants 2026-10-08: four marked tanks pulled back and the whole raid
+ // A pull back is NOT the group's go (playtest, MC Molten Giants 2026-10-08: four marked tanks pulled back and the whole raid
// ran in): only the pulling tank is released; the others wait until the mob is on a tank.
if (e.ai->pull_back_active())
b.pullers.push_back(uint64(id));
else if ((!e.ai->focus_target().IsEmpty() ||
(e.ai->is_manual_mode(now_ms) && e.ai->owner_command() == BotAI::OwnerCommand::Engage)) &&
- // A Pull is the tanks' own engage: it must not release the rest of the raid (Karrz, MC Gehennas
- // 2026-10-08: "pull, then I say attack"). Only a non-tank bot carrying the order is the owner's Attack.
- (!m->IsRaid() || BotCommandParser::BotRole(p) != Role::Tank))
+ // A Pull is the tanks' own engage: it must not release the rest of the raid (playtest, MC Gehennas
+ // 2026-10-08: "pull, then I say attack"; a party's Pull waits for the owner's Attack too). Only a non-tank bot carrying the order is the owner's Attack.
+ BotCommandParser::BotRole(p) != Role::Tank) // raid and 5-man alike: Pull never releases the others
b.owner_order = true;
// The spoken Attack, however the pull gate treated this bot (only the main tank carries Engage while the mob is idle).
if (OwnerAttackRecent(now_ms, e.ai->owner_attack_ms(), kOwnerAttackWindowMs))
@@ -134,10 +135,27 @@ void PveGroupCoordinator::Update(uint32 now_ms)
{
// Shared group snapshot: one per group per tick, covers EVERY
// member including humans (roles, positions, vitals).
- std::shared_ptr gs =
- Services::Snapshots().latest_group(b.bots.front().first);
+ // The first bot that has one: a bucket's first bot can be a corpse or a ghost whose group snapshot is gone, and the
+ // whole raid plan (tanks, curses, [raid_fight]) went silent for the rest of the fight (Ragnaros 2026-10-13: the fight
+ // lines stopped at 103 s of 249 s, after the first deaths).
+ std::shared_ptr gs;
+ for (auto const& [blow, p] : b.bots)
+ {
+ gs = Services::Snapshots().latest_group(blow);
+ if (gs && !gs->members.empty())
+ break;
+ }
if (!gs || gs->members.empty())
+ {
+ static uint32 s_cold_log_ms = 0;
+ if (b.in_combat && now_ms - s_cold_log_ms >= 5000u)
+ {
+ s_cold_log_ms = now_ms;
+ TC_LOG_INFO("playerbot.v2", "[pve_plan] group={} map={} skipped: none of its {} bots has a group snapshot, the raid plan does not run",
+ b.group_low, b.map_id, uint32(b.bots.size()));
+ }
continue; // group data cold — legacy runs
+ }
// Reference bot snapshot: freshest member view; provides
// nearby_enemies for the synchronized kill target and the view
@@ -212,7 +230,7 @@ void PveGroupCoordinator::Update(uint32 now_ms)
if (b.owner_order)
mark_release_until_[bkey] = now_ms + 10000u;
// The Attack stands for the whole fight: while the group is in combat a live release is carried on, so it neither
- // lapses when the owner dies or his order expires, nor re-holds the DPS mid-fight (Karrz, MC Gehennas 2026-10-08:
+ // lapses when the owner dies or his order expires, nor re-holds the DPS mid-fight (playtest, MC Gehennas 2026-10-08:
// rogues idle after the owner fell). It ends 10 s after the fight.
else if (b.in_combat && mark_release_until_.count(bkey) && now_ms < mark_release_until_[bkey])
mark_release_until_[bkey] = now_ms + 10000u;
@@ -372,6 +390,12 @@ void PveGroupCoordinator::Update(uint32 now_ms)
uint64 main_tank = 0, off_tank = 0;
for (auto const& e : mem)
if (e.tank && e.alive && e.src->is_main_tank) { main_tank = e.guid_low; break; }
+ // Without the flag the main tank stays whoever it was while that tank lives: a death and a rez no longer hand the role back to the
+ // lowest guid (tank_duty and the heal quotas flipped twice per death).
+ if (!main_tank)
+ if (auto kept = last_main_tank_.find(bkey); kept != last_main_tank_.end())
+ for (auto const& e : mem)
+ if (e.guid_low == kept->second && e.tank && e.alive) { main_tank = e.guid_low; break; }
for (auto const& e : mem)
{
if (!e.tank || !e.alive) continue;
@@ -380,6 +404,8 @@ void PveGroupCoordinator::Update(uint32 now_ms)
if (!off_tank && wants_off_tank)
{ off_tank = e.guid_low; continue; }
}
+ if (main_tank)
+ last_main_tank_[bkey] = main_tank;
for (auto const& e : mem)
{
if (!e.tank) continue;
@@ -599,6 +625,26 @@ void PveGroupCoordinator::Update(uint32 now_ms)
// The brain plans after this coordinator, so this is its previous plan (one raid cadence old).
if (ObjectGuid const rule_focus = Raid::GetBrain().FocusFor(b.group_low, b.map_id); !rule_focus.IsEmpty())
kill_focus = rule_focus;
+ // The owner's skull, else cross, on a mob somebody fights is the kill target, above the script's priority list and the encounter
+ // rule: "skull then cross" is the one order the raid always follows (MC Majordomo 2026-10-15: the owner skulled a Flamewaker Healer,
+ // the priority list picked another one and the raid burned that, while the polymorphers sheeped the skull).
+ if (!GroupSnapshotView(*gs).leader_is_bot() && b.bots.front().second)
+ if (Group* kg = b.bots.front().second->GetGroup())
+ for (uint8 icon : { uint8(7), uint8(6) }) // skull, cross
+ {
+ ObjectGuid const mark = kg->GetTargetIcon(icon);
+ if (mark.IsEmpty())
+ continue;
+ bool fought = false;
+ for (auto const& u : ref->combat.nearby_enemies)
+ if (u.guid == mark && u.hp > 0 && !u.victim.IsEmpty())
+ fought = true;
+ if (fought)
+ {
+ kill_focus = mark;
+ break;
+ }
+ }
if (kill_focus.IsEmpty())
last_kill_focus_.erase(bkey);
else
@@ -612,63 +658,6 @@ void PveGroupCoordinator::Update(uint32 now_ms)
}
}
- // -- Auto skull: after the owner's Attack, the skull follows the fight --------------------------------------------
- // When the skull mob dies the skull moves to the next ENGAGED mob (kill focus first, else the most hurt), and the
- // cross to the one after if the cross is free, so the owner sees what is next and no DPS waits for a new mark
- // (Karrz, MC Gehennas 2026-10-08). Only with a human leader, only once the owner released the marks, only on
- // mobs somebody already fights; an unpulled mob is never marked. Nothing happens until the owner has put a skull.
- if (marks_released && b.in_combat && !GroupSnapshotView(*gs).leader_is_bot() && b.bots.front().second)
- if (Group* grp = b.bots.front().second->GetGroup())
- {
- constexpr uint8 kSkull = 7, kCross = 6;
- Map* gm = b.bots.front().second->GetMap();
- auto mob_of = [&](ObjectGuid g) -> Creature* { return (gm && !g.IsEmpty()) ? gm->GetCreature(g) : nullptr; };
- auto live = [&](Creature* c) { return c && c->IsAlive(); };
- ObjectGuid const skull = grp->GetTargetIcon(kSkull);
- ObjectGuid& seen = last_skull_[bkey];
- if (live(mob_of(skull)))
- seen = skull; // the owner's (or a bot's) live skull: this is the one to follow
- else if (!seen.IsEmpty())
- {
- std::vector engaged;
- for (auto const& u : ref->combat.nearby_enemies)
- {
- if (u.hp <= 0 || u.victim.IsEmpty() || u.guid == seen || u.is_player || u.is_cc_locked) continue;
- if (!live(mob_of(u.guid))) continue;
- ObjectGuid const cross = grp->GetTargetIcon(kCross);
- if (u.guid == cross) continue;
- // A mob carrying any other raid icon is a tank's to hold (moon, square, ... = a tank assignment, Karrz, MC Garr
- // 2026-10-08: the skull jumped to Garr, marked moon for his own tank, the moment the first add died): the
- // skull never moves onto it.
- bool tank_marked = false;
- for (uint8 icon = 0; icon < 6; ++icon)
- if (grp->GetTargetIcon(icon) == u.guid) { tank_marked = true; break; }
- if (tank_marked) continue;
- engaged.push_back(&u);
- }
- std::sort(engaged.begin(), engaged.end(), [&](NearbyUnit const* a, NearbyUnit const* c)
- {
- // Adds before bosses: the boss is the last kill.
- bool const ba = a->is_dungeon_boss || a->is_boss_rank, bc = c->is_dungeon_boss || c->is_boss_rank;
- if (ba != bc) return !ba;
- if ((a->guid == kill_focus) != (c->guid == kill_focus)) return a->guid == kill_focus;
- return a->max_hp > 0 && c->max_hp > 0 ? double(a->hp) / a->max_hp < double(c->hp) / c->max_hp : a->hp < c->hp;
- });
- ObjectGuid const changer = grp->GetLeaderGUID();
- if (!engaged.empty())
- {
- grp->SetTargetIcon(kSkull, engaged[0]->guid, changer);
- seen = engaged[0]->guid;
- if (!live(mob_of(grp->GetTargetIcon(kCross))) && engaged.size() > 1)
- grp->SetTargetIcon(kCross, engaged[1]->guid, changer);
- TC_LOG_INFO("playerbot.v2", "[auto_skull] group={} map={} skull -> entry {} ({}), {} engaged",
- b.group_low, b.map_id, engaged[0]->entry, engaged[0]->guid.GetCounter(), engaged.size());
- }
- else
- seen = ObjectGuid::Empty; // nothing engaged left: the next pull starts from the owner's mark
- }
- }
-
// -- Raid tank -> mob assignment + fight diagnostics ------------------
PlanRaidTanks(bkey, b.group_low, b.map_id, wants_off_tank, now_ms,
main_tank, off_tank, kill_focus,
@@ -801,6 +790,8 @@ void PveGroupCoordinator::Update(uint32 now_ms)
it = buckets.count(it->first) ? std::next(it) : fight_log_.erase(it);
for (auto it = last_tank_target_.begin(); it != last_tank_target_.end();)
it = buckets.count(it->first) ? std::next(it) : last_tank_target_.erase(it);
+ for (auto it = cc_held_.begin(); it != cc_held_.end();)
+ it = buckets.count(it->first) ? std::next(it) : cc_held_.erase(it);
for (auto it = mark_release_until_.begin(); it != mark_release_until_.end();)
it = buckets.count(it->first) ? std::next(it) : mark_release_until_.erase(it);
for (auto it = fight_start_.begin(); it != fight_start_.end();)
@@ -837,8 +828,6 @@ void PveGroupCoordinator::Update(uint32 now_ms)
for (auto it = last_kill_focus_.begin(); it != last_kill_focus_.end();)
it = buckets.count(it->first) ? std::next(it)
: last_kill_focus_.erase(it);
- for (auto it = last_skull_.begin(); it != last_skull_.end();)
- it = buckets.count(it->first) ? std::next(it) : last_skull_.erase(it);
last_dump_ = dump.str();
if (last_dump_.empty())
last_dump_ = "no coordinated dungeon/raid groups";
@@ -1131,6 +1120,7 @@ constexpr uint32 kFightSummaryMs = 3000;
// A spare tank never runs further than this for a mob; beyond it the mob
// belongs to whoever is closer (or the loose-attacker pick-up).
constexpr float kTankAssignRange = 60.0f;
+constexpr uint32 kCcHoldMs = 45000; // how long a tank is remembered as the holder of a mob under a group member's crowd control
// An unpulled mob this close to an engaged one belongs to the pack (the link-pull reach).
constexpr float kPackReach = 25.0f;
@@ -1242,6 +1232,11 @@ void PveGroupCoordinator::PlanMarkOrders(uint64 group_low, uint32 map_id, bool i
if (e.alive && e.src->max_hp > 0 && Pct(e.src->hp, e.src->max_hp) < 40) { emergency = true; break; }
std::vector cc_taken;
+ bool moon_is_tank_mark = false;
+ for (auto const& [tank_low, marker] : Services::Owners().TankMarks(group_low))
+ if (marker == 4) moon_is_tank_mark = true;
+ if (auto h = by_low.find(held_by[4]); held_by[4] && h != by_low.end() && h->second->tank)
+ moon_is_tank_mark = true; // the moon on a tank bot itself
// Pass 1: crowd control. Bots in member order, one bot per mob, never the skull, never a boss.
if (cc_on)
for (auto const& e : mem)
@@ -1255,6 +1250,11 @@ void PveGroupCoordinator::PlanMarkOrders(uint64 group_low, uint32 map_id, bool i
if (uint8 const h = held_symbol(e.guid_low); h != 0xFF && h != 7) order.push_back(h);
for (uint8 c : Services::Owners().RtiOrderOf(e.guid_low).cc)
if (c < 7 && std::find(order.begin(), order.end(), c) == order.end()) order.push_back(c);
+ // No icon or rti cc of its own: the caster holds the owner's moon (ike3's default rti cc). Marked mobs left the auto crowd
+ // control, so without this a moon nobody was assigned to stayed free.
+ // Not when the owner gave the moon to a tank ("assign moon" on a tank bot): that tank holds the mob, and a sheep on
+ // it breaks on the tank's first hit (n71 Majordomo: Deleria sheeped the Healer Yuna was tanking).
+ if (order.empty() && !moon_is_tank_mark) order.push_back(4);
BotSnapshotView const view(*sn->second);
// Sticky: a bot keeps its mob while the icon stays on it and the mob lives; a view that loses the mob for a few
// seconds (a banished mob drops out of a lock's list) is no release (Garr 2026-10-08: Gustinor was assigned and
@@ -1313,6 +1313,96 @@ void PveGroupCoordinator::PlanMarkOrders(uint64 group_low, uint32 map_id, bool i
}
break;
}
+ // No icon call for this caster: it picks a mob of its own to hold, so the owner never has to assign crowd control
+ // (playtest 2026-10-15). In a raid, an entry the encounter rules already crowd-control (RaidBrain::ElectCrowdControl) is left to them.
+ // Never the owner's skull / cross or the raid's kill focus, never a boss or an unpulled mob, never one already under half
+ // health; at least three live mobs are on the group (with two, killing them is quicker than holding one).
+ if (po->second.cc_target.IsEmpty())
+ {
+ static std::mutex auto_cc_mx;
+ static std::unordered_map auto_cc; // caster -> the mob it holds
+ auto const& kill_focus_of = [&](ObjectGuid g)
+ {
+ for (auto const& [low, o] : plan)
+ if (o.kill_focus == g) return true;
+ return false;
+ };
+ std::vector pack;
+ {
+ std::unordered_set seen;
+ for (auto const& sn : snaps)
+ {
+ if (sn->position.map_id != map_id) continue;
+ for (auto const& u : sn->combat.nearby_enemies)
+ if (u.hp > 0 && !u.is_player && !u.untargetable && u.unit_in_combat && !u.victim.IsEmpty() &&
+ !Classic::IsBossUnit(u) && seen.insert(u.guid.GetCounter()).second)
+ if (NearbyUnit const* full = unit_any(u.guid))
+ pack.push_back(full);
+ }
+ }
+ auto holdable = [&](NearbyUnit const& u) -> bool
+ {
+ // A mob carrying any raid icon is the owner's call (or a tank's assignment): no automatic hold on it. Only an icon
+ // the owner put on a caster sends that caster to hold it (the loop above).
+ for (ObjectGuid const& marked : icon)
+ if (u.guid == marked) return false;
+ if (kill_focus_of(u.guid)) return false;
+ // Nor the mob the owner (any human) or a tank is hitting: a sheep on it breaks at once and is recast, over and over.
+ for (auto const& m : mem)
+ if ((!m.is_bot || m.tank) && m.src && m.src->victim == u.guid) return false;
+ if (is_raid)
+ if (Raid::RaidRules const* rr = Raid::RulesForMap(map_id))
+ for (Raid::CrowdControl const& rule : rr->crowdControl)
+ if (rule.enemy == u.entry) return false;
+ if (u.max_hp > 0 && u.hp * 2 < u.max_hp) return false;
+ if (std::find(cc_taken.begin(), cc_taken.end(), u.guid) != cc_taken.end()) return false;
+ MarkCc::Option const* opt = MarkCc::PickOption(view, e.cls, MarkCc::TypeOf(u), !e.src->in_combat && !u.unit_in_combat);
+ // A root is not a hold on a caster: a rooted Flamewaker Elite stands and fireballs the healers (n71 Majordomo: four
+ // raid members died to Fireball). Only the owner's own mark roots one.
+ return opt && !(opt->root && u.is_ranged_caster);
+ };
+ ObjectGuid pick;
+ {
+ std::lock_guard lk(auto_cc_mx);
+ if (auto it = auto_cc.find(e.guid_low); it != auto_cc.end())
+ {
+ NearbyUnit const* kept_u = unit_any(it->second);
+ if (kept_u && holdable(*kept_u))
+ pick = it->second;
+ else
+ auto_cc.erase(it);
+ }
+ }
+ if (pick.IsEmpty() && pack.size() >= 3)
+ {
+ // Mobs nobody tanks first (they are on a member), then the lowest guid so every plan chooses the same one.
+ NearbyUnit const* best = nullptr;
+ bool best_loose = false;
+ for (NearbyUnit const* u : pack)
+ {
+ if (!holdable(*u)) continue;
+ auto tv = by_low.find(u->victim.GetCounter());
+ bool const loose = tv == by_low.end() || !tv->second->tank;
+ if (!best || (loose && !best_loose) || (loose == best_loose && u->guid.GetCounter() < best->guid.GetCounter()))
+ {
+ best = u;
+ best_loose = loose;
+ }
+ }
+ if (best)
+ {
+ pick = best->guid;
+ std::lock_guard lk(auto_cc_mx);
+ auto_cc[e.guid_low] = pick;
+ }
+ }
+ if (!pick.IsEmpty())
+ {
+ po->second.cc_target = pick;
+ po->second.cc_symbol = 0xFF;
+ cc_taken.push_back(pick);
+ }
+ }
}
// [mark_cc] assign / break / release, change-detected per bot (the plan runs every tick).
@@ -1395,7 +1485,9 @@ void PveGroupCoordinator::PlanMarkOrders(uint64 group_low, uint32 map_id, bool i
if (!u || o.cc_reserved_mob(u->guid)) continue;
if (u->is_cc_locked && sym != 7) continue; // a held mob is left alone unless it is the skull
o.mark_target = u->guid;
- if (u->unit_in_combat) o.kill_focus = u->guid; // engaged mobs only: an unpulled mob stays the tank's call
+ // Engaged mobs only: an unpulled mob stays the tank's call. A bot's own kill symbol never replaces the group's kill focus
+ // (the owner's skull / cross); only an icon the owner put on that bot does.
+ if (u->unit_in_combat && (o.kill_focus.IsEmpty() || held != 0xFF)) o.kill_focus = u->guid;
break;
}
}
@@ -1568,12 +1660,14 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
for (auto it = sticky.begin(); it != sticky.end();)
{
auto t = by_low.find(it->first);
- const bool keep = t != by_low.end() && t->second->tank && t->second->alive &&
- find_mob(it->second) != nullptr;
+ bool keep = t != by_low.end() && t->second->tank && t->second->alive &&
+ find_mob(it->second) != nullptr;
if (!keep && t != by_low.end() && t->second->tank && t->second->alive)
{
// [raid_tank] why a tank lost its mob (Garr 2026-10-08: one tank hopped between Firesworn ~15 times).
NearbyUnit const* gone = unit_any_early(it->second);
+ if (gone && gone->is_cc_locked && member_of(gone->cc_caster))
+ cc_held_[bkey][it->second.GetCounter()] = { t->first, now_ms + kCcHoldMs };
TC_LOG_INFO("playerbot.v2", "[raid_tank] group={} map={} {} drops {} ({}): {}", group_low, map_id, t->second->src->name,
it->second.GetEntry(), it->second.GetCounter(),
!gone ? "out of every view or dead" : (gone->is_cc_locked ? "crowd-controlled" : (!gone->unit_in_combat ? "out of combat" : "no longer hitting the group")));
@@ -1700,6 +1794,7 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
auto assign = [&](Member const* t, Mob const& m, char const* why)
{
sticky[t->guid_low] = m.u->guid;
+ cc_held_[bkey].erase(m.u->guid.GetCounter());
taken.push_back(m.u->guid);
const float dx = m.u->x - t->src->x, dy = m.u->y - t->src->y;
Member const* v = member_of(m.u->victim);
@@ -1721,31 +1816,70 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
Mob const* held = find_mob(sit->second);
return held && held->u->guid != m.u->guid && (held->u->is_dungeon_boss || held->u->is_boss_rank);
};
+ // Holds of this bucket still in force: one that ran out is dropped (a CC'd mob is not in `mobs`, so only time ends it).
+ auto& cc_held = cc_held_[bkey];
+ for (auto it = cc_held.begin(); it != cc_held.end();)
+ it = now_ms >= it->second.until_ms ? cc_held.erase(it) : std::next(it);
+ // A mob carrying an icon the owner gave a crowd-control caster is that caster's (Majordomo n78: the circle on an Elite was
+ // Scott's, and Hannorto took the same Elite as "nearest", so his hits broke the sheep over and over). Tanks leave it alone
+ // until it is loose on a member.
+ auto cc_owned = [&](Mob const& m) -> bool
+ {
+ if (!mk_grp || m.loose) return false;
+ for (uint8 sym = 0; sym < 7; ++sym)
+ {
+ if (mk_grp->GetTargetIcon(sym) != m.u->guid) continue;
+ for (Member const& e : mem)
+ {
+ if (!e.is_bot || e.tank || !MarkCc::IsMarkCcClass(e.cls)) continue;
+ if (held_by[sym] == e.guid_low) return true;
+ for (uint8 c : Services::Owners().RtiOrderOf(e.guid_low).cc)
+ if (c == sym) return true;
+ }
+ }
+ return false;
+ };
auto nearest_free = [&](Member const* t) -> Mob const*
{
auto rank = [&](Mob const& m) -> int
{
if (Raid::NoTank(map_id, m.u->entry)) return 3;
+ if (Raid::TankLast(map_id, m.u->entry)) return 4; // Majordomo: the tank left over takes him
+ if (auto const hold = cc_held.find(m.u->guid.GetCounter()); hold != cc_held.end() && hold->second.tank_low == t->guid_low)
+ return -1; // the tank that held it before the crowd control ended takes it back first
if (m.loose) return 0;
return on_boss_tank(m) ? 1 : 2;
};
Mob const* best = nullptr;
int best_rank = 99;
+ uint32 best_order = UINT32_MAX;
float best_d2 = kTankAssignRange * kTankAssignRange;
for (auto const& m : mobs)
{
- if (is_taken(m.u->guid)) continue;
+ if (is_taken(m.u->guid) || cc_owned(m)) continue;
const float dx = m.u->x - t->src->x, dy = m.u->y - t->src->y;
const float d2 = dx * dx + dy * dy;
if (d2 > kTankAssignRange * kTankAssignRange) continue;
const int r = rank(m);
- if (best && (r > best_rank || (r == best_rank && d2 >= best_d2))) continue;
+ // Within a class the encounter's tank order comes before distance (Majordomo: Healers, then Elites).
+ const uint32 order = Raid::TankOrder(map_id, m.u->entry);
+ if (best && (r > best_rank || (r == best_rank && (order > best_order || (order == best_order && d2 >= best_d2))))) continue;
best = &m;
best_rank = r;
+ best_order = order;
best_d2 = d2;
}
return best;
};
+ // A free engaged mob other than that is neither a summoned add nor one the rules leave to the tank left over: while one
+ // exists, a tankLast mob (Majordomo) is nobody's to hold.
+ auto other_free_mob = [&](ObjectGuid except) -> bool
+ {
+ for (auto const& m : mobs)
+ if (m.u->guid != except && !is_taken(m.u->guid) && !Raid::NoTank(map_id, m.u->entry) && !Raid::TankLast(map_id, m.u->entry))
+ return true;
+ return false;
+ };
// The main tank chooses first: the mob it already hits (its pull), else the mob engaged with it, else the
// nearest. Without this a spare tank that ran at the pull target before the main tank had a victim of its own
// would be handed the main tank's mob, and the main tank the next one.
@@ -1757,19 +1891,35 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
Mob const* pick = find_mob(t->src->victim);
char const* why = "already_on_it";
if (pick && Raid::NoTank(map_id, pick->u->entry)) pick = nullptr; // a Spawn is no mob to hold
+ if (pick && Raid::TankLast(map_id, pick->u->entry) && other_free_mob(pick->u->guid)) pick = nullptr; // the adds first
if (!pick || is_taken(pick->u->guid))
{
pick = nullptr;
for (auto const& m : mobs)
- if (m.u->victim == t->src->guid && !is_taken(m.u->guid)) { pick = &m; why = "on_main_tank"; break; }
+ if (m.u->victim == t->src->guid && !is_taken(m.u->guid) &&
+ !(Raid::TankLast(map_id, m.u->entry) && other_free_mob(m.u->guid))) { pick = &m; why = "on_main_tank"; break; }
}
if (!pick) { pick = nearest_free(t); why = "nearest"; }
if (pick) assign(t, *pick, why);
}
+ // A mob that has just come off a group member's crowd control goes back to the tank that held it, before any other tank
+ // is offered it as a loose mob.
for (Member const* t : tanks)
{
if (!t->is_bot || sticky.count(t->guid_low)) continue;
- if (Mob const* cur = find_mob(t->src->victim); cur && !is_taken(cur->u->guid) && !Raid::NoTank(map_id, cur->u->entry))
+ for (auto const& m : mobs)
+ if (auto const hold = cc_held.find(m.u->guid.GetCounter());
+ hold != cc_held.end() && hold->second.tank_low == t->guid_low && !is_taken(m.u->guid) && !Raid::NoTank(map_id, m.u->entry))
+ {
+ assign(t, m, "cc_released");
+ break;
+ }
+ }
+ for (Member const* t : tanks)
+ {
+ if (!t->is_bot || sticky.count(t->guid_low)) continue;
+ if (Mob const* cur = find_mob(t->src->victim); cur && !is_taken(cur->u->guid) && !Raid::NoTank(map_id, cur->u->entry) &&
+ !(Raid::TankLast(map_id, cur->u->entry) && other_free_mob(cur->u->guid)))
assign(t, *cur, "already_on_it");
}
for (Member const* t : tanks)
@@ -1782,6 +1932,46 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
assign(t, *best, best->loose ? "loose_nearest" : "nearest");
}
}
+ // -- The owner's skull and cross are held by a tank -----------------------
+ // They are the owner's kill calls, and a mob nobody tanks is on a healer or a mage while the raid burns it (n78 Majordomo: the
+ // skull moved onto a sheeped Healer, the sheep broke, and no tank took it; then the cross Healer ran loose for 20 s and killed
+ // the owner, while every tank sat on its own Elite or dropped target). A tank with no symbol of the owner's drops its mob for
+ // it: the main tank first, else the one with the fewest mobs on it. Skull first, then cross, each on a different tank.
+ if (mk_grp)
+ for (uint8 const kill_icon : { uint8(7), uint8(6) })
+ {
+ ObjectGuid const sk = mk_grp->GetTargetIcon(kill_icon);
+ if (sk.IsEmpty()) continue;
+ Mob const* sm = find_mob(sk);
+ if (!sm || is_taken(sk) || Raid::NoTank(map_id, sm->u->entry) || sm->u->is_dungeon_boss || sm->u->is_boss_rank)
+ continue;
+ Member const* best = nullptr;
+ size_t best_load = SIZE_MAX;
+ for (Member const* t : tanks)
+ {
+ if (!t->is_bot || !t->alive || user_sym.count(t->guid_low)) continue;
+ // A tank already on the other kill mark keeps it.
+ if (auto sit = sticky.find(t->guid_low); sit != sticky.end() &&
+ (sit->second == mk_grp->GetTargetIcon(7) || sit->second == mk_grp->GetTargetIcon(6)))
+ continue;
+ size_t load = 0;
+ for (Mob const& o : mobs)
+ if (o.u->victim == t->src->guid) ++load;
+ if (!best || (t->guid_low == main_tank && best->guid_low != main_tank) ||
+ (best->guid_low != main_tank && load < best_load))
+ {
+ best = t;
+ best_load = load;
+ }
+ }
+ if (!best) continue;
+ if (auto sit = sticky.find(best->guid_low); sit != sticky.end())
+ {
+ taken.erase(std::remove(taken.begin(), taken.end(), sit->second), taken.end());
+ sticky.erase(sit);
+ }
+ assign(best, *sm, kill_icon == 7 ? "owner_skull" : "owner_cross");
+ }
// -- The boss is never left without a tank ----------------------------
// An engaged boss nobody holds (its tank died, or every tank is busy with adds) is the threat that wipes the raid;
// the strongest bot tank drops its add for it, the add becoming a free mob for the next pass (Garr 2026-10-08: the
@@ -1791,15 +1981,32 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
{
if (!(m.u->is_dungeon_boss || m.u->is_boss_rank) || Raid::NoTank(map_id, m.u->entry) || is_taken(m.u->guid))
continue;
+ bool const tank_last = Raid::TankLast(map_id, m.u->entry);
+ bool const adds_up = tank_last &&
+ std::any_of(mobs.begin(), mobs.end(), [&](Mob const& o) { return o.u->guid != m.u->guid && !Raid::NoTank(map_id, o.u->entry) && !Raid::TankLast(map_id, o.u->entry); });
+ // No tank leaves an add for him while an add is loose: the adds are the threat. Once every add is held he goes to the tank with
+ // the fewest mobs on it, not to whichever tank is left (n44 mc_majordomo: nobody held him, he stood on a healer all fight and
+ // killed two by melee).
+ if (adds_up && std::any_of(mobs.begin(), mobs.end(), [&](Mob const& o) { return o.loose && !Raid::NoTank(map_id, o.u->entry) && !Raid::TankLast(map_id, o.u->entry); }))
+ continue;
Member const* best = nullptr;
+ size_t best_load = SIZE_MAX;
for (Member const* t : tanks)
{
if (!t->is_bot || user_sym.count(t->guid_low)) continue;
- // The main tank first, else the healthiest.
- bool const better = !best || (t->guid_low == main_tank && best->guid_low != main_tank) ||
- (best->guid_low != main_tank && Pct(t->src->hp, t->src->max_hp) > Pct(best->src->hp, best->src->max_hp));
+ size_t load = 0;
+ if (adds_up)
+ for (Mob const& o : mobs)
+ if (o.u->victim == t->src->guid && o.u->guid != m.u->guid) ++load;
+ // The main tank first, else the healthiest (else, with adds up, the lightest load first).
+ bool const better = !best || (adds_up ? (load < best_load || (load == best_load && Pct(t->src->hp, t->src->max_hp) > Pct(best->src->hp, best->src->max_hp)))
+ : ((t->guid_low == main_tank && best->guid_low != main_tank) ||
+ (best->guid_low != main_tank && Pct(t->src->hp, t->src->max_hp) > Pct(best->src->hp, best->src->max_hp))));
if (better)
+ {
best = t;
+ best_load = load;
+ }
}
if (!best) break;
if (auto sit = sticky.find(best->guid_low); sit != sticky.end())
@@ -1957,7 +2164,8 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
}
// Never skull or cross: those are the owner's kill call (explicit_kill_mark), not a tank's assignment (Garr 2026-10-08: the
// main tank marked the boss with skull and the raid left the adds).
- static constexpr uint8 kOrder[] = { 0, 1, 2, 3, 4, 5 };
+ // Nor moon: it is the owner's crowd-control call, and a caster holds whatever carries it.
+ static constexpr uint8 kOrder[] = { 0, 1, 2, 3, 5 };
// An icon is never used automatically while a member holds it (the owner's symbol on a bot).
auto marker_used = [&](uint8 m)
{
@@ -2002,7 +2210,7 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
}
// -- Generic raid kill focus ----------------------------------------
- // Karrz's raid DPS target (DpsTargetValue McFocusTarget): every DPS
+ // the owner's raid DPS target (DpsTargetValue McFocusTarget): every DPS
// on ONE engaged, non-CC'd mob, lowest health first, instead of each
// bot opening on whatever is nearest - 30 DPS spread over a pack
// out-threat every tank at once. A dungeon script's priority add
@@ -2050,7 +2258,7 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
if (mk_grp)
for (uint8 m : { uint8(7), uint8(6), uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5) })
{
- // Only skull and cross are kill orders; the other icons are tank / crowd-control markers (Karrz, MC Garr
+ // Only skull and cross are kill orders; the other icons are tank / crowd-control markers (playtest, MC Garr
// 2026-10-08: circle marked on Garr and every DPS attacked it). An icon some bot has as its own kill symbol
// (assign kill) stays a kill order for the group.
bool kill_icon = m >= 6;
@@ -2093,8 +2301,10 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
// (Garr 2026-10-09: the skull Firesworn read all-school immune and 3 DPS held for minutes). The next mark or the
// generic pick takes over; the skull returns to it once the immunity ends.
!Raid::GetBrain().AllSchoolsAvoided(group_low, map_id, u.guid) &&
- // A skull the owner puts on a crowd-controlled mob is the call to kill it: the CC is released.
- !(u.is_cc_locked && member_of(u.cc_caster) && !(explicit_call && idle_call)) &&
+ // A skull the owner puts on a crowd-controlled mob is the call to kill it, in a fight too: the caster stops
+ // holding it (TryCast refuses the kill target) and the raid switches (n71 Majordomo: the owner rotates the
+ // skull onto each sheeped Healer in turn). Any other mark on a held mob is no kill call.
+ !(u.is_cc_locked && member_of(u.cc_caster) && !explicit_call) &&
(u.unit_in_combat || (explicit_call && idle_call)))
marked = &u;
break;
@@ -2134,8 +2344,13 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
auto loose_unowned = [&](Mob const& m) { return m.loose && !is_taken(m.u->guid); };
Mob const* pick = nullptr;
bool pick_loose = false;
+ // A mob the encounter's rules mark "never a DPS target" (Majordomo: he surrenders when the adds die) is no focus, with or
+ // without adds engaged this tick.
+ Raid::RaidRules const* const focus_rules = Raid::RulesForMap(map_id);
+ auto never_target = [&](NearbyUnit const& u) { return focus_rules && Raid::PriorityFor(*focus_rules, u.entry) < 0; };
for (auto const& m : mobs)
{
+ if (never_target(*m.u)) continue;
if (adds_alive && is_boss(*m.u)) continue; // adds first, the boss last
const bool lu = loose_unowned(m);
if (!lu && !tank_held(m)) continue;
@@ -2158,7 +2373,7 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
if (auto mt = by_low.find(main_tank); mt != by_low.end() && mt->second->alive) mtm = mt->second;
if (!mtm && !tanks.empty()) mtm = tanks.front();
if (mtm)
- if (Mob const* mm = find_mob(mtm->src->victim); mm && !(adds_alive && is_boss(*mm->u)))
+ if (Mob const* mm = find_mob(mtm->src->victim); mm && !(adds_alive && is_boss(*mm->u)) && !never_target(*mm->u))
{
pick = mm;
pick_is_mt = true;
@@ -2169,7 +2384,10 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
auto it = last_raid_focus_.find(bkey);
return it != last_raid_focus_.end() ? it->second : ObjectGuid::Empty;
}();
- if (Mob const* pm = find_mob(prev); pm && pick && pm != pick && !pick_is_mt)
+ // The previous focus is kept while it is still a fair pick: a boss is not once adds are engaged (n31 mc_majordomo: the focus
+ // fell on Majordomo in the first second, before the adds were counted, and the stickiness kept it for two minutes while the
+ // raid hit a boss that cannot die and the adds killed it).
+ if (Mob const* pm = find_mob(prev); pm && pick && pm != pick && !pick_is_mt && !(adds_alive && is_boss(*pm->u)) && !never_target(*pm->u))
{
const bool plu = loose_unowned(*pm);
if ((plu || tank_held(*pm)) && (plu || !pick_loose))
@@ -2219,6 +2437,7 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
else
{
last_tank_target_.erase(bkey);
+ cc_held_.erase(bkey);
last_raid_focus_.erase(bkey);
tank_mark_auto_.erase(bkey);
marks_set_.erase(bkey);
@@ -2465,6 +2684,67 @@ NearbyUnit const* EngagedBoss(uint32 map_id, std::vectorGetAppliedAuras())
+ if (!app->IsPositive())
+ ++n;
+ return n;
+}
+
+char const* ClassTag(uint8 cls)
+{
+ switch (cls)
+ {
+ case CLASS_WARRIOR: return "warrior";
+ case CLASS_PALADIN: return "paladin";
+ case CLASS_HUNTER: return "hunter";
+ case CLASS_ROGUE: return "rogue";
+ case CLASS_PRIEST: return "priest";
+ case CLASS_SHAMAN: return "shaman";
+ case CLASS_MAGE: return "mage";
+ case CLASS_WARLOCK: return "warlock";
+ case CLASS_DRUID: return "druid";
+ default: return "other";
+ }
+}
+
+// What the raid has put on its boss: every harmful aura a player cast, with stacks, time left and the caster's class, and how many of
+// the boss's debuff slots are taken. One line per 10 s while the boss is engaged.
+void LogBossDebuffs(uint64 group_low, uint32 map_id, Creature* boss, uint32 now_ms)
+{
+ static std::unordered_map s_last;
+ uint32& last = s_last[group_low];
+ if (last && now_ms - last < 10'000u)
+ return;
+ last = now_ms ? now_ms : 1u;
+ std::string list;
+ for (auto const& [id, app] : boss->GetAppliedAuras())
+ {
+ if (app->IsPositive())
+ continue;
+ Aura const* a = app->GetBase();
+ Unit* caster = a->GetCaster();
+ if (!caster || !caster->IsPlayer())
+ continue;
+ SpellInfo const* si = a->GetSpellInfo();
+ if (!list.empty()) list += ", ";
+ list += std::string(si && si->SpellName && (*si->SpellName)[LOCALE_enUS] ? (*si->SpellName)[LOCALE_enUS] : "?") + " " + std::to_string(a->GetId());
+ if (a->GetStackAmount() > 1)
+ list += " x" + std::to_string(a->GetStackAmount());
+ list += std::string(" (") + ClassTag(caster->GetClass()) + (a->IsPermanent() ? "" : ", " + std::to_string(a->GetDuration() / 1000) + " s") + ")";
+ }
+ uint32 const slots = HarmfulAuraCount(boss);
+ TC_LOG_INFO("playerbot.v2", "[raid_debuffs] group={} map={} {} {}% carries {}/{} debuff slots: {}{}",
+ group_low, map_id, boss->GetName(), uint32(boss->GetHealthPct()), slots, kBossDebuffSlots,
+ list.empty() ? std::string("none from the raid") : list, slots >= kBossDebuffSlots ? " (full)" : "");
+}
+
} // namespace
void PveGroupCoordinator::PlanCurses(uint64 bkey, uint64 group_low, uint32 map_id, bool is_raid,
@@ -2482,6 +2762,15 @@ void PveGroupCoordinator::PlanCurses(uint64 bkey, uint64 group_low, uint32 map_i
std::unordered_map snap_of;
for (auto const& sp : snaps)
snap_of[sp->guid.GetCounter()] = sp.get();
+ // What the raid has put on the boss it fights, whether or not a warlock is in it.
+ if (NearbyUnit const* fb = EngagedBoss(map_id, snaps, false))
+ for (auto const& [low, p] : bots)
+ if (p && p->IsInWorld() && p->GetMapId() == map_id)
+ {
+ if (Creature* bc = ObjectAccessor::GetCreature(*p, fb->guid); bc && bc->IsAlive())
+ LogBossDebuffs(group_low, map_id, bc, GameTime::GetGameTimeMS());
+ break;
+ }
// The raid's bot warlocks by guid (census order puts bots by guid).
std::vector locks;
std::vector lock_guids;
@@ -2568,8 +2857,9 @@ void PveGroupCoordinator::PlanCurses(uint64 bkey, uint64 group_low, uint32 map_i
}
}
// Agony stacks across casters; two of them are plenty and leave the boss's debuff slots to Sunder / Faerie Fire / Expose.
+ // Only while the boss has slots to spare: a full list loses a Sunder stack or a Faerie Fire to the next debuff cast.
uint32 agony = 0;
- if (!immune(CURSE_OF_AGONY))
+ if (!immune(CURSE_OF_AGONY) && HarmfulAuraCount(mob) + 2 < kBossDebuffSlots)
for (Member const* l : locks)
if (agony < 2 && !assign.count(l->guid_low) && knows(l, CURSE_OF_AGONY))
{
@@ -2702,7 +2992,7 @@ void PveGroupCoordinator::PlanFearAndResist(uint64 bkey, uint64 group_low, uint3
// -- Resistance potions (opt-in): a boss of a resistance instance engaged.
uint32 potion = 0;
NearbyUnit const* boss = nullptr;
- if (sConfigMgr->GetBoolDefault("Playerbot.Raid.ResistPotions", false))
+ if (sConfigMgr->GetBoolDefault("Playerbot.Raid.ResistPotions", false, true))
if (uint32 const item = Classic::ResistPotionItem(Classic::InstanceResistance(map_id)))
if ((boss = EngagedBoss(map_id, snaps, false)) != nullptr)
potion = item;
@@ -2717,6 +3007,21 @@ void PveGroupCoordinator::PlanFearAndResist(uint64 bkey, uint64 group_low, uint3
if (potion)
for (auto& [low, o] : plan)
o.resist_potion = potion;
+ // Boss data (RaidRules::resistPotion): the potion a role drinks when this boss is engaged, whatever the global switch says. Ragnaros'
+ // Elemental Fire killed five tanks in three minutes (MC 2026-10-12). The global order, when on, wins for the bots it covers.
+ if (Raid::RaidRules const* rules = Raid::RulesForMap(map_id))
+ if (!rules->resistPotion.empty())
+ if (NearbyUnit const* eng = EngagedBoss(map_id, snaps, false))
+ for (Raid::ResistPotion const& rp : rules->resistPotion)
+ if (rp.enemy == eng->entry)
+ for (auto& [low, o] : plan)
+ {
+ auto const mit = by_low.find(low);
+ if (o.resist_potion || mit == by_low.end())
+ continue;
+ if (rp.who == Raid::Who::Anyone || (rp.who == Raid::Who::Tank && mit->second->tank))
+ o.resist_potion = rp.item;
+ }
}
std::string PveGroupCoordinator::DebugDump() const
diff --git a/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.h b/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.h
index ef2ef9b93a..f641e065db 100644
--- a/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.h
+++ b/src/modules/PlayerbotV2/Bot/Dungeon/PveGroupCoordinator.h
@@ -29,7 +29,7 @@
// is ever moved to run concurrently with the build, orders_ needs a shared_mutex.
// Inputs are the published immutable GroupSnapshot / BotSnapshot shared_ptrs and
// DungeonScriptMgr::GetAdvice computed HERE from a member snapshot — never a
-// BotAI-owned cache (those are AI-worker property; reading them cross-thread is a
+// BotAI-owned cache (those are bot-worker property; reading them cross-thread is a
// use-after-free, see the 2026-06-10 BG coordinator review).
//
// Human members are never ordered, but they OCCUPY duties: a human tank
@@ -62,7 +62,7 @@ public:
// Order lookup for the snapshot builder. Returns nullptr when no
// current plan covers the bot (consumer publishes a default-inactive
- // order and the AI runs legacy logic).
+ // order and the bot logic runs legacy logic).
PveOrder const* OrderFor(uint64 bot_guid_low) const
{
auto it = orders_.find(bot_guid_low);
@@ -157,10 +157,15 @@ private:
// than a read-back from member orders, which broke when the sampled
// member left the group or the data ticked cold.
std::unordered_map last_kill_focus_;
- std::unordered_map last_skull_; // the skull mob the auto-skull follows (per group bucket)
// Per-(group, map) raid tank -> mob assignment, sticky while the mob
// lives so tanks don't trade mobs (and threat) every plan.
std::unordered_map