0.1.40: bots since 0.1.39.1 (Kel'Thuzad fight work, dungeon routes for the Shaper's Terrace, Blackmaw Hold, Alcaz Prison and Wailing Caverns, bots open keyed doors, gather tools, bot names, bug fixes)
Ubuntu x64 / build (clang-17, clang++-17, <nil>, 1) (push) Canceled after 0s
Ubuntu x64 / build (clang-17, clang++-17, ccache, 0) (push) Canceled after 0s
Ubuntu x64 / build (gcc-13, g++-13, <nil>, 1) (push) Canceled after 0s
macOS arm64 / build (push) Canceled after 0s
Windows x64 / build (push) Canceled after 0s

This commit is contained in:
Karrz1
2026-11-28 15:48:24 +00:00
parent 9a843b9804
commit 909a69a07d
133 changed files with 8672 additions and 1799 deletions
@@ -0,0 +1,16 @@
-- Migration: 0060_companion_owner_orders
-- Date: 2026-11-21
-- Purpose: The owner's standing orders on a companion, "loot all" and "gather on", were kept in the bot logic only and were gone after
-- every relog, `.bot call` and restart (Alex Black Cat, RU general 11-21: an alt's gather and loot all reset on each relog).
-- They are stored with the companion and given back at its login.
--
-- Columns:
-- owner_orders bits: 0x01 loot all (rolls on everything, greys included), 0x02 gather on (herbs, ore, skins). 0 = neither.
-- Reverts: yes (DROP COLUMN owner_orders).
ALTER TABLE playerbot_v2_character
ADD COLUMN owner_orders TINYINT UNSIGNED NOT NULL DEFAULT 0;
INSERT INTO playerbot_v2_schema_version (version, sha256) VALUES
(60, REPEAT('0', 64))
ON DUPLICATE KEY UPDATE applied_at = CURRENT_TIMESTAMP;
@@ -0,0 +1,13 @@
-- Migration: 0061_drowned_city_marrow_crumb
-- Date: 2026-11-23
-- Purpose: The Drowned City (map 2970) route crumb 107 stood on Deathless Marrow's dais (-13322.97,3073.15,-6.07), a bump of
-- navmesh 3 y high and 3 y wide. drowned_full af63: after Marrow every route step that landed on the dais sent the tank
-- back south; it paced y 3040-3060 for 2100 s and never came nearer the crumb than 13 y. The crumb moves to the floor
-- east of the dais, 8.8 y from Marrow's spot (still the crumb nearest her, where the walk to the next boss starts);
-- the walks 106 -> 107 -> 108 stay on the flat floor (navmesh polygons 5973, 5978, 5980, 5979, z -7.8 to -7.2).
-- Reverts: UPDATE ... SET position_x = -13322.97, position_y = 3073.15, position_z = -6.07 for the same row.
-- @target: shared
UPDATE {SHARED}.playerbot_dungeon_routes SET position_x = -13316.50, position_y = 3079.00, position_z = -7.80
WHERE map_id = 2970 AND difficulty = 0 AND seq = 107;
@@ -0,0 +1,39 @@
-- Migration: 0062_blackmaw_hold_route_varrox_room
-- Date: 2026-11-23
-- Purpose: Blackmaw Hold (map 2974): the route's last leg, from Elder Shaman Bloodmane to Varrox Bleakhoof's new spot in the high north
-- room of the east cave (world SQL 2026_11_23_24_world_forever_blackmaw_varrox_room). Varrox stood on the only short way from
-- the Unbound Spirit to the Behemoth: the old crumbs 131-132 passed 10 y from him, and the tank pulled him fifth, before the
-- Behemoth and Bloodmane (blackmaw_full chain69b, 23 Nov: both left standing when the goal fell). Crumbs 0-155 stay; 156-178
-- replace the old 156-167. Built on the 2974 navmesh: the shortest path from crumb 155 (by Bloodmane) to the new spot, a crumb
-- about every 15-30 y, each leg a straight line on the walkable mesh (checked every yard), each crumb at least 4.8 y from a
-- wall. The way passes route pack 44 and two Blackmaw Shaman / Grizzly packs north of the shrine.
-- Reverts: no (0044 has the old tail).
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 2974 AND difficulty = 0 AND seq >= 156;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(2974,0,156,3506.58,2995.78,145.90),
(2974,0,157,3501.31,3010.93,145.41),
(2974,0,158,3482.27,3031.40,149.97),
(2974,0,159,3471.87,3037.51,156.28),
(2974,0,160,3467.73,3051.82,162.82),
(2974,0,161,3472.87,3064.80,165.70),
(2974,0,162,3498.04,3076.02,166.11),
(2974,0,163,3506.67,3081.33,167.07),
(2974,0,164,3507.80,3090.80,166.41),
(2974,0,165,3518.87,3093.80,166.00),
(2974,0,166,3536.93,3099.67,167.68),
(2974,0,167,3544.48,3102.24,169.02),
(2974,0,168,3559.13,3113.60,171.36),
(2974,0,169,3568.71,3125.91,172.30),
(2974,0,170,3582.62,3131.09,174.86),
(2974,0,171,3599.78,3126.31,176.19),
(2974,0,172,3629.80,3120.53,178.47),
(2974,0,173,3643.11,3124.53,179.49),
(2974,0,174,3660.91,3122.35,180.66),
(2974,0,175,3671.80,3115.87,182.09),
(2974,0,176,3673.33,3088.67,189.49),
(2974,0,177,3668.78,3074.49,189.22),
(2974,0,178,3660.47,3060.67,189.15);
@@ -0,0 +1,23 @@
-- Migration: 0065_wailing_caverns_route_to_the_cliff_link
-- Date: 2026-11-24
-- Purpose: Wailing Caverns (map 43): the route from Lord Serpentis' cliff link no longer goes into the pocket under his ledge.
-- 0036 ran Skum (crumb 167), then crumbs 168-191 back north-east to the floor under the ledge (-61.6,-15.5), a dead end,
-- and only then the link's lower end (crumb 192). wc_full af69i: the squad walked that pocket in and out, about 540 y in
-- and 800 y back round by the south to the link, and crossed at 3317 s of a 3600 s run. The new crumbs 168-183 go straight
-- from Skum up the west passage to the link's upper end B (-288.23,-6.15,-58.98), about 350 y, the way the tank walked
-- to it in that run. 184 on is 0036's 192-208 (link end A, then the ledge to Serpentis and Verdan) renumbered.
-- Built from the map 43 navmesh: a crumb every 18-32 y, every crumb-to-crumb leg a clean path of at most 7 polygons
-- and at most 1.45x its straight line.
-- Reverts: yes (crumbs 168-208 of map 43 as 0036 has them).
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 43 AND difficulty = 0 AND seq >= 168;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(43,0,168,-270.76,-302.58,-68.23),(43,0,169,-263.13,-290.53,-66.93),(43,0,170,-263.73,-269.38,-64.94),(43,0,171,-272.16,-252.00,-62.35),(43,0,172,-274.49,-232.18,-62.23),(43,0,173,-267.57,-204.43,-62.79),
(43,0,174,-283.13,-193.87,-60.90),(43,0,175,-298.13,-179.91,-61.98),(43,0,176,-306.73,-158.60,-59.46),(43,0,177,-313.01,-136.37,-61.64),(43,0,178,-308.80,-119.91,-61.92),(43,0,179,-307.73,-94.51,-64.11),
(43,0,180,-315.04,-73.07,-64.08),(43,0,181,-313.67,-51.73,-63.05),(43,0,182,-307.20,-31.69,-61.15),(43,0,183,-288.23,-6.15,-58.98),(43,0,184,-289.07,3.2,-63.96),(43,0,185,-277.57,19.56,-60.51),
(43,0,186,-266.07,35.93,-55.63),(43,0,187,-253.17,51.14,-52.57),(43,0,188,-233.62,55.38,-48.85),(43,0,189,-213.74,57.04,-49.05),(43,0,190,-193.9,55.52,-47.16),(43,0,191,-174.16,52.3,-41.38),
(43,0,192,-159.28,40.37,-34.94),(43,0,193,-149.28,23.05,-28.41),(43,0,194,-139.28,5.73,-27.52),(43,0,195,-129.28,-11.59,-27.49),(43,0,196,-120.16,-24.62,-28.58),(43,0,197,-108.08,-8.68,-27.89),
(43,0,198,-96,7.26,-29.89),(43,0,199,-83.92,23.2,-30.37),(43,0,200,-81.86,32.26,-30.99);
@@ -0,0 +1,50 @@
-- Migration: 0066_alcaz_prison_route_west_wing_first
-- Date: 2026-11-24
-- Purpose: Alcaz Prison (map 2994): the route takes the west wing first. The old order (Overseer Wrex, Katerina the Cleaner, The
-- Questioner, Tidemistress Ca'zass, Blazeroar) walked from the entrance into Wrex's east cell block, back across the hall
-- into the west wing, and back across the hall again from The Questioner to the stair down to Ca'zass. The new order is
-- Katerina the Cleaner, The Questioner, Overseer Wrex, Tidemistress Ca'zass, Blazeroar: west wing, back through the hall
-- once to Wrex beside the stair, then down. 720 y of walk on the 2994 navmesh instead of 789, and the hall is crossed
-- once instead of twice. The crumbs are the 0043 crumbs in the new order (3 and 9, the hall crumbs of the old double
-- crossing, are left out). Every leg is a clean navmesh path of at most 30 y. AlcazPrisonScript.cpp has the same order.
-- Reverts: run 0043 again.
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 2994;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(2994,0,0,-8796.80,2838.10,29.90),
(2994,0,1,-8796.73,2858.93,21.55),
(2994,0,2,-8796.80,2881.27,19.09),
(2994,0,3,-8802.58,2886.67,19.49),
(2994,0,4,-8823.64,2889.60,15.58),
(2994,0,5,-8845.78,2889.60,15.13),
(2994,0,6,-8852.40,2889.38,14.02),
(2994,0,7,-8871.63,2889.60,14.42),
(2994,0,8,-8886.00,2893.69,14.42),
(2994,0,9,-8867.38,2889.60,14.95),
(2994,0,10,-8849.29,2889.60,15.22),
(2994,0,11,-8830.13,2888.75,14.10),
(2994,0,12,-8812.11,2887.04,17.51),
(2994,0,13,-8792.07,2887.60,19.35),
(2994,0,14,-8769.96,2886.40,15.13),
(2994,0,15,-8762.13,2882.13,15.31),
(2994,0,16,-8758.44,2864.22,14.15),
(2994,0,17,-8758.67,2847.51,14.02),
(2994,0,18,-8763.13,2869.33,14.35),
(2994,0,19,-8764.98,2887.64,15.13),
(2994,0,20,-8764.98,2906.27,12.15),
(2994,0,21,-8763.29,2924.71,6.69),
(2994,0,22,-8745.87,2932.40,6.15),
(2994,0,23,-8727.60,2932.40,6.15),
(2994,0,24,-8745.87,2932.40,6.15),
(2994,0,25,-8764.98,2932.00,6.73),
(2994,0,26,-8783.91,2932.31,6.46),
(2994,0,27,-8802.40,2932.40,6.42),
(2994,0,28,-8806.93,2950.76,7.13),
(2994,0,29,-8818.89,2970.40,6.55),
(2994,0,30,-8837.60,2968.53,7.04),
(2994,0,31,-8858.47,2966.20,7.22),
(2994,0,32,-8875.82,2975.38,6.15),
(2994,0,33,-8886.83,2974.72,5.89);
+315
View File
@@ -0,0 +1,315 @@
-- Migration: 0067_bot_text_pools
-- Date: 2026-11-25
-- Purpose: Move the chat lines that were hard-coded in the source into the shared text table,
-- so a realm can rewrite bot speech without rebuilding. Every line below is the text the
-- code already said, verbatim ({} fmt args became %placeholders), the code keeps its
-- builtin pool as fallback for a server whose shared table has no rows for a key.
--
-- New keys (playerbot_v2_bot_text.name):
-- guild_ding a bot levels up, %my_level is the new level
-- guild_login_greet greet the guild at login
-- guild_smalltalk idle guild smalltalk (only with a human guildmate online)
-- guild_tavern_hangout tavern-night pitch, %venue is the faction tavern name
-- guild_rival a rival guild's members are near
-- guild_quest_brag a quest was turned in
-- guild_lfm long LFG queue pulse
-- guild_event_announce officer callout before a guild event, %event_label, %mins_until
-- guild_tavern_chat chatter during the tavern party
-- guild_staging_* chatter during a raid / dungeon / bg night staging (generic = fallback)
-- guild_babble the slow ambient babble (30 min per bot)
-- guild_join_welcome a real player joined the guild, %s is the joiner's first name
-- banter_<kind> a companion's party-chat banter (ready / wipe / thanks / ouch /
-- bosskill), banter_<kind>_<tank|healer|caster|polite|rude|rp> are
-- the per-role / per-personality extras, merged in with the base key
-- banter_raid_wipe one corpse in a wiped raid says so in raid chat
-- say_kindness_heal a free bot healed a passing player: the /say with it
-- say_kindness_rez a free bot resurrects a passing player: the /say with it
--
-- INSERT IGNORE against the (name, reply_type, text(200)) unique key: re-running is a no-op.
-- No text contains a ',' (the migration runner splits statements on it).
-- Reverts: yes (DELETE the rows of the keys above).
--
-- @target: shared
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_ding', 'Ding %my_level!', 0, 0),
('guild_ding', '%my_level achieved', 0, 0),
('guild_ding', 'hit %my_level :)', 0, 0),
('guild_ding', 'Level %my_level!', 0, 0),
('guild_ding', 'ding %my_level', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_login_greet', 'hi all', 0, 0),
('guild_login_greet', 'hey :)', 0, 0),
('guild_login_greet', 'o/', 0, 0),
('guild_login_greet', 'hello!', 0, 0),
('guild_login_greet', 'evening', 0, 0),
('guild_login_greet', 'yo', 0, 0),
('guild_login_greet', 'hi guild', 0, 0),
('guild_login_greet', 'hey hey', 0, 0),
('guild_login_greet', 'o/ everyone', 0, 0),
('guild_login_greet', 'back online', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_smalltalk', 'anyone need help with anything?', 0, 0),
('guild_smalltalk', 'what''s good tonight folks', 0, 0),
('guild_smalltalk', 'soloing this is rough', 0, 0),
('guild_smalltalk', 'anyone running dungeons?', 0, 0),
('guild_smalltalk', 'pulled too much again, classic', 0, 0),
('guild_smalltalk', 'where is everyone leveling?', 0, 0),
('guild_smalltalk', 'the new patch feels good', 0, 0),
('guild_smalltalk', 'anyone got mats to spare?', 0, 0),
('guild_smalltalk', 'drinking tea, brb', 0, 0),
('guild_smalltalk', 'good run earlier, ty', 0, 0),
('guild_smalltalk', 'checking AH brb', 0, 0),
('guild_smalltalk', 'this zone is gorgeous', 0, 0),
('guild_smalltalk', 'lf groupmates for tonight', 0, 0),
('guild_smalltalk', 'back from a break, hi all', 0, 0),
('guild_smalltalk', 'rolling around questing', 0, 0),
('guild_smalltalk', 'anyone seen [redacted-name] online?', 0, 0),
('guild_smalltalk', 'love this server', 0, 0),
('guild_smalltalk', 'phase is acting weird, anyone else?', 0, 0),
('guild_smalltalk', 'great patch notes today', 0, 0),
('guild_smalltalk', 'stretch break', 0, 0),
('guild_smalltalk', 'tea then back to grinding', 0, 0),
('guild_smalltalk', 'anyone need a port?', 0, 0),
('guild_smalltalk', 'this mount drop is brutal', 0, 0),
('guild_smalltalk', 'looking for a leveling buddy', 0, 0),
('guild_smalltalk', 'kicking back, easy night', 0, 0),
('guild_smalltalk', 'anyone want to chain quests?', 0, 0),
('guild_smalltalk', 'this rep grind...', 0, 0),
('guild_smalltalk', 'soloing dungeons for chests', 0, 0),
('guild_smalltalk', 'wow my repair bill', 0, 0),
('guild_smalltalk', 'good music tonight, share recs', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_tavern_hangout', 'anyone want to hit the tavern? %venue', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_rival', 'rival guild spotted', 0, 0),
('guild_rival', 'show them how it''s done', 0, 0),
('guild_rival', 'they think they''re tough', 0, 0),
('guild_rival', 'second place again', 0, 0),
('guild_rival', 'watch the rivals here', 0, 0),
('guild_rival', 'let''s outperform them', 0, 0),
('guild_rival', 'rival in sight, on guard', 0, 0),
('guild_rival', 'amateurs', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_quest_brag', 'another one down', 0, 0),
('guild_quest_brag', 'just finished a quest', 0, 0),
('guild_quest_brag', 'feeling productive tonight', 0, 0),
('guild_quest_brag', 'quest log getting lighter', 0, 0),
('guild_quest_brag', 'another tick on the list', 0, 0),
('guild_quest_brag', 'ding XP', 0, 0),
('guild_quest_brag', 'easy gold', 0, 0),
('guild_quest_brag', 'quest hub clear', 0, 0),
('guild_quest_brag', 'love a good quest chain', 0, 0),
('guild_quest_brag', 'rolling through quests', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_lfm', 'LFM for a dungeon, anyone?', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_event_announce', '%event_label starts in %mins_until min!', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_tavern_chat', 'this is fun', 0, 0),
('guild_tavern_chat', 'cheers everyone', 0, 0),
('guild_tavern_chat', '/dance', 0, 0),
('guild_tavern_chat', 'best night of the week', 0, 0),
('guild_tavern_chat', 'love these party nights', 0, 0),
('guild_tavern_chat', 'more people should hit the tavern', 0, 0),
('guild_tavern_chat', 'great turnout', 0, 0),
('guild_tavern_chat', 'tavern night incoming', 0, 0),
('guild_tavern_chat', 'rolling tipsy', 0, 0),
('guild_tavern_chat', '/toast', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_staging_generic', 'anyone joining?', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_staging_raid', 'raid night, who''s in?', 0, 0),
('guild_staging_raid', 'rolling for raid spots', 0, 0),
('guild_staging_raid', '/g raid in 10', 0, 0),
('guild_staging_raid', 'looking for one more dps', 0, 0),
('guild_staging_raid', 'loot reservations open', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_staging_dungeon', 'dungeon night, who''s down?', 0, 0),
('guild_staging_dungeon', 'lf2m for keys', 0, 0),
('guild_staging_dungeon', 'let''s chain some 5-mans', 0, 0),
('guild_staging_dungeon', 'got a healer?', 0, 0),
('guild_staging_dungeon', 'rolling tank dual spec', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_staging_bg', 'BG night! /join wsg', 0, 0),
('guild_staging_bg', 'premade rolling', 0, 0),
('guild_staging_bg', 'honor cap incoming', 0, 0),
('guild_staging_bg', 'anyone seen the queue times?', 0, 0),
('guild_staging_bg', 'rated arena later maybe', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_babble', 'Hey everyone!', 0, 0),
('guild_babble', 'anyone need a hand with anything?', 0, 0),
('guild_babble', 'Got some good loot today.', 0, 0),
('guild_babble', 'Anyone running dungeons later?', 0, 0),
('guild_babble', 'Crafting reagents up in the bank if anyone needs them.', 0, 0),
('guild_babble', 'Who''s online tonight?', 0, 0),
('guild_babble', 'lfg if anyone wants to group', 0, 0),
('guild_babble', 'How''s everyone doing?', 0, 0),
('guild_babble', 'Just dinged again — slow grind.', 0, 0),
('guild_babble', 'Hope to see folks at the next raid night.', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('guild_join_welcome', 'welcome %s!', 0, 0),
('guild_join_welcome', 'welcome to the guild %s :)', 0, 0),
('guild_join_welcome', 'hey %s, welcome!', 0, 0),
('guild_join_welcome', 'welcome aboard %s!', 0, 0),
('guild_join_welcome', '%s welcome! :)', 0, 0),
('guild_join_welcome', 'glad to have you %s!', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('say_kindness_heal', 'there you go', 0, 0),
('say_kindness_heal', 'patched you up', 0, 0),
('say_kindness_heal', 'heal inc', 0, 0),
('say_kindness_heal', 'careful out there', 0, 0),
('say_kindness_heal', 'you looked like you needed that', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('say_kindness_rez', 'rez inc', 0, 0),
('say_kindness_rez', 'hold on, rezzing you', 0, 0),
('say_kindness_rez', 'got you', 0, 0),
('say_kindness_rez', 'rez coming', 0, 0),
('say_kindness_rez', 'don''t release, rezzing', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_raid_wipe', 'well, that went badly', 0, 0),
('banter_raid_wipe', 'wipe :(', 0, 0),
('banter_raid_wipe', 'ouch', 0, 0),
('banter_raid_wipe', 'ok that one is on me', 0, 0),
('banter_raid_wipe', 'and we''re all dead', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ready', 'ready', 0, 0),
('banter_ready', 'rdy', 0, 0),
('banter_ready', 'yep ready', 0, 0),
('banter_ready', 'good to go', 0, 0),
('banter_ready', 'all set', 0, 0),
('banter_ready', 'ready :)', 0, 0),
('banter_ready', 'yup', 0, 0),
('banter_ready', 'ready when you are', 0, 0);
-- 'ready' was listed twice in the builtin pool (twice as likely), the unique key keeps one row,
-- so the repeat becomes weight 2 (the same trick migration 0022 used for the ike3 repeats).
UPDATE {SHARED}.playerbot_v2_bot_text SET weight = 2
WHERE name = 'banter_ready' AND reply_type = 0 AND text = 'ready';
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ready_tank', 'ready to tank', 0, 0),
('banter_ready_tank', 'tank ready', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ready_healer', 'healer ready', 0, 0),
('banter_ready_healer', 'heals ready', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ready_caster', 'ready, mana is good', 0, 0),
('banter_ready_caster', 'mana is good', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ready_rp', 'aye, ready', 0, 0),
('banter_ready_rp', 'ready, lead on', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_wipe', 'my bad', 0, 0),
('banter_wipe', 'wp', 0, 0),
('banter_wipe', 'wp wp', 0, 0),
('banter_wipe', 'ouch', 0, 0),
('banter_wipe', 'rip', 0, 0),
('banter_wipe', 'well that went well', 0, 0),
('banter_wipe', 'oof', 0, 0),
('banter_wipe', 'that was rough', 0, 0),
('banter_wipe', 'rip us', 0, 0),
('banter_wipe', 'wow ok', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_wipe_tank', 'my bad, bad pull', 0, 0),
('banter_wipe_tank', 'sorry, lost them', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_wipe_healer', 'sorry, too slow with the heals', 0, 0),
('banter_wipe_healer', 'my bad, couldn''t keep up', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_wipe_polite', 'sorry everyone', 0, 0),
('banter_wipe_polite', 'sorry guys, my fault', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_wipe_rude', 'great job everyone', 0, 0),
('banter_wipe_rude', 'wow', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_thanks', 'ty', 0, 0),
('banter_thanks', 'thanks', 0, 0),
('banter_thanks', 'thx', 0, 0),
('banter_thanks', 'ty!', 0, 0),
('banter_thanks', 'tyvm', 0, 0),
('banter_thanks', 'ty rez', 0, 0),
('banter_thanks', 'thx rez', 0, 0),
('banter_thanks', 'ty :)', 0, 0),
('banter_thanks', 'thanks for the rez', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_thanks_polite', 'thank you!', 0, 0),
('banter_thanks_polite', 'much appreciated', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_thanks_rude', 'finally', 0, 0),
('banter_thanks_rude', 'about time', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ouch', 'ouch', 0, 0),
('banter_ouch', 'ow', 0, 0),
('banter_ouch', 'oof', 0, 0),
('banter_ouch', 'that hurt', 0, 0),
('banter_ouch', 'ugh', 0, 0),
('banter_ouch', 'argh', 0, 0),
('banter_ouch', 'rip', 0, 0),
('banter_ouch', 'owie', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ouch_tank', 'that stings', 0, 0),
('banter_ouch_tank', 'ow, my armor', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_ouch_caster', 'squishy, i know', 0, 0),
('banter_ouch_caster', 'paper armor strikes again', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_bosskill', 'gg', 0, 0),
('banter_bosskill', 'gg!', 0, 0),
('banter_bosskill', 'gg wp', 0, 0),
('banter_bosskill', 'nice', 0, 0),
('banter_bosskill', 'well done', 0, 0),
('banter_bosskill', 'nice one', 0, 0),
('banter_bosskill', 'woo', 0, 0),
('banter_bosskill', 'finally', 0, 0),
('banter_bosskill', 'good one', 0, 0),
('banter_bosskill', 'that went well', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_bosskill_polite', 'gg everyone', 0, 0),
('banter_bosskill_polite', 'well played all', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_bosskill_tank', 'easy', 0, 0),
('banter_bosskill_tank', 'gg, nice heals', 0, 0);
INSERT IGNORE INTO {SHARED}.playerbot_v2_bot_text (name, text, say_type, reply_type) VALUES
('banter_bosskill_rp', 'victory!', 0, 0),
('banter_bosskill_rp', 'for glory, gg', 0, 0);
INSERT INTO {SHARED}.playerbot_v2_schema_version (version, sha256) VALUES
(67, REPEAT('0', 64))
ON DUPLICATE KEY UPDATE applied_at = CURRENT_TIMESTAMP;
@@ -0,0 +1,62 @@
-- Migration: 0068_shapers_terrace_route_from_the_live_landing
-- Date: 2026-11-25
-- Purpose: The Shaper's Terrace (map 3001) as live has it (world 2026_11_25_80..84, from Karrz's capture of 25 Nov 2026): live lands a
-- player on a ledge 54 y over a pool (-5921.34,-975.49,63.26), not by the exit trigger down by the tar as 0045 had it, and the
-- standing bosses are at live's spots. The ledge is not joined to the rest of the navmesh: Karrz walked 7 y to its south-east
-- edge and jumped into the pool (START_SWIM at -5894.65,-1006.33,9.58, no fall damage). So:
-- * a one-way nav link from that edge to that splash (bots fall it as a jump, PlayerbotAPI move_to drop),
-- * a new route: crumb 0 the landing, 1 the link's mouth, 2 the splash, then one wing at a time: the north (Cinder on his
-- hill, Titanosaur by the Titanic Door, Snowtalon at the ice panel, Vitrix), the middle (Tor'Rel and Izha'Rel, Venomridge
-- and Bolt), the south (Thunderhoof, King Op, the Direhorn Matriarch) and Nanaya on the Pillar of Assimilation last
-- (about 4140 y, the shortest walk that ends at Nanaya, ShapersTerraceScript.cpp has the same order).
-- Built from the map 3001 navmesh: a crumb every 20 y of walked path or so (215 crumbs, gaps up to 33 y), every crumb-to-crumb
-- leg after the splash is a path on the navmesh of at most 8 polygons (centroid path, two legs on slopes walk 2.4x their straight line).
-- Reverts: yes (0045's route of map 3001, delete the link).
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 3001;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(3001,0,0,-5921.34,-975.49,63.26),(3001,0,1,-5914.01,-977.20,63.38),(3001,0,2,-5894.65,-1006.33,9.60),(3001,0,3,-5877.33,-1013.33,12.26),(3001,0,4,-5875.68,-992.16,12.26),(3001,0,5,-5860.84,-977.38,12.26),
(3001,0,6,-5836.27,-969.07,13.33),(3001,0,7,-5821.00,-951.00,19.60),(3001,0,8,-5814.40,-930.80,23.80),(3001,0,9,-5804.44,-915.38,24.97),(3001,0,10,-5793.60,-900.00,23.82),(3001,0,11,-5793.87,-875.02,25.60),
(3001,0,12,-5772.69,-863.25,26.56),(3001,0,13,-5783.02,-852.09,28.62),(3001,0,14,-5785.07,-844.00,29.86),(3001,0,15,-5804.73,-835.13,34.93),(3001,0,16,-5814.13,-822.13,41.17),(3001,0,17,-5835.33,-812.47,51.86),
(3001,0,18,-5842.27,-793.67,58.80),(3001,0,19,-5864.60,-798.20,70.46),(3001,0,20,-5889.07,-800.18,79.82),(3001,0,21,-5905.73,-802.58,87.28),(3001,0,22,-5908.80,-813.24,92.00),(3001,0,23,-5909.07,-821.07,98.06),
(3001,0,24,-5907.38,-828.89,104.17),(3001,0,25,-5897.51,-842.93,110.13),(3001,0,26,-5904.20,-862.50,113.10),(3001,0,27,-5894.45,-847.20,111.57),(3001,0,28,-5901.47,-830.80,107.40),(3001,0,29,-5907.38,-828.89,104.17),
(3001,0,30,-5909.07,-821.07,98.06),(3001,0,31,-5908.80,-813.24,92.00),(3001,0,32,-5905.73,-802.58,87.28),(3001,0,33,-5889.07,-800.18,79.82),(3001,0,34,-5868.27,-800.60,73.33),(3001,0,35,-5856.20,-794.47,65.66),
(3001,0,36,-5836.76,-803.64,54.44),(3001,0,37,-5821.87,-803.47,46.22),(3001,0,38,-5806.93,-788.71,42.13),(3001,0,39,-5800.53,-770.76,43.20),(3001,0,40,-5792.00,-757.33,40.86),(3001,0,41,-5770.67,-757.33,37.53),
(3001,0,42,-5770.67,-737.47,38.00),(3001,0,43,-5749.33,-736.00,34.93),(3001,0,44,-5728.00,-736.00,31.33),(3001,0,45,-5706.67,-736.00,28.60),(3001,0,46,-5696.60,-723.80,30.86),(3001,0,47,-5695.04,-723.79,30.88),
(3001,0,48,-5688.09,-725.07,28.80),(3001,0,49,-5689.47,-706.13,26.33),(3001,0,50,-5685.33,-693.33,24.73),(3001,0,51,-5685.33,-672.00,21.93),(3001,0,52,-5681.71,-647.82,19.68),(3001,0,53,-5685.33,-672.00,21.93),
(3001,0,54,-5685.33,-693.33,24.73),(3001,0,55,-5682.93,-715.20,26.53),(3001,0,56,-5670.73,-723.93,28.06),(3001,0,57,-5664.00,-736.00,27.53),(3001,0,58,-5642.67,-736.00,29.93),(3001,0,59,-5621.33,-736.00,31.33),
(3001,0,60,-5600.00,-736.00,31.73),(3001,0,61,-5578.67,-736.00,31.06),(3001,0,62,-5557.73,-737.20,27.20),(3001,0,63,-5537.81,-735.79,24.32),(3001,0,64,-5521.78,-746.13,19.91),(3001,0,65,-5514.89,-761.33,18.66),
(3001,0,66,-5501.65,-776.21,19.46),(3001,0,67,-5496.32,-801.65,18.82),(3001,0,68,-5493.16,-810.40,18.66),(3001,0,69,-5483.11,-809.87,20.62),(3001,0,70,-5469.92,-808.59,23.20),(3001,0,71,-5454.13,-797.92,21.97),
(3001,0,72,-5443.10,-792.40,21.74),(3001,0,73,-5458.04,-799.73,21.42),(3001,0,74,-5473.00,-806.20,22.86),(3001,0,75,-5484.20,-813.07,19.00),(3001,0,76,-5505.47,-817.87,18.66),(3001,0,77,-5514.24,-825.65,19.14),
(3001,0,78,-5520.80,-845.80,22.62),(3001,0,79,-5547.33,-849.40,18.66),(3001,0,80,-5555.47,-862.77,18.66),(3001,0,81,-5575.80,-872.13,18.66),(3001,0,82,-5578.67,-884.62,19.24),(3001,0,83,-5578.67,-906.67,20.53),
(3001,0,84,-5578.67,-928.00,21.93),(3001,0,85,-5578.67,-949.33,21.26),(3001,0,86,-5578.67,-970.67,19.53),(3001,0,87,-5578.67,-992.00,17.93),(3001,0,88,-5578.67,-1013.33,13.73),(3001,0,89,-5578.67,-1034.67,10.13),
(3001,0,90,-5591.38,-1044.80,9.33),(3001,0,91,-5599.64,-1057.73,9.33),(3001,0,92,-5611.47,-1070.22,9.26),(3001,0,93,-5622.22,-1089.16,10.42),(3001,0,94,-5628.44,-1091.11,9.98),(3001,0,95,-5637.53,-1102.87,12.40),
(3001,0,96,-5642.67,-1120.00,17.80),(3001,0,97,-5642.03,-1141.65,25.80),(3001,0,98,-5642.35,-1165.28,29.80),(3001,0,99,-5644.75,-1186.03,33.37),(3001,0,100,-5644.64,-1205.60,34.60),(3001,0,101,-5624.27,-1205.67,35.33),
(3001,0,102,-5628.32,-1223.80,34.17),(3001,0,103,-5624.27,-1205.67,35.33),(3001,0,104,-5644.64,-1205.60,34.60),(3001,0,105,-5644.75,-1186.03,33.37),(3001,0,106,-5642.35,-1165.28,29.80),(3001,0,107,-5659.73,-1151.20,25.71),
(3001,0,108,-5656.36,-1131.64,22.60),(3001,0,109,-5660.09,-1123.91,17.71),(3001,0,110,-5668.80,-1131.47,11.49),(3001,0,111,-5685.33,-1141.33,9.60),(3001,0,112,-5697.27,-1159.20,8.26),(3001,0,113,-5720.53,-1171.82,8.82),
(3001,0,114,-5736.36,-1188.89,2.51),(3001,0,115,-5760.98,-1189.16,-4.16),(3001,0,116,-5778.13,-1180.93,-2.94),(3001,0,117,-5792.00,-1184.00,-3.54),(3001,0,118,-5813.33,-1184.00,-2.94),(3001,0,119,-5834.13,-1184.00,-1.54),
(3001,0,120,-5854.45,-1186.03,-0.71),(3001,0,121,-5877.33,-1184.00,1.37),(3001,0,122,-5908.77,-1192.19,6.76),(3001,0,123,-5933.00,-1183.30,9.07),(3001,0,124,-5933.00,-1204.20,8.84),(3001,0,125,-5933.60,-1225.42,9.53),
(3001,0,126,-5933.53,-1249.60,9.44),(3001,0,127,-5921.28,-1269.87,10.35),(3001,0,128,-5918.29,-1290.61,9.71),(3001,0,129,-5918.73,-1312.00,8.84),(3001,0,130,-5920.00,-1333.33,6.84),(3001,0,131,-5932.80,-1343.29,7.22),
(3001,0,132,-5934.08,-1351.47,8.43),(3001,0,133,-5942.67,-1373.78,11.66),(3001,0,134,-5960.40,-1382.53,11.51),(3001,0,135,-5964.27,-1395.68,10.77),(3001,0,136,-5962.67,-1418.67,10.77),(3001,0,137,-5962.67,-1440.00,9.71),
(3001,0,138,-5952.41,-1463.46,8.84),(3001,0,139,-5962.56,-1482.24,9.12),(3001,0,140,-5958.84,-1500.18,7.66),(3001,0,141,-5962.67,-1525.33,7.57),(3001,0,142,-5961.60,-1546.29,7.57),(3001,0,143,-5956.27,-1565.73,7.71),
(3001,0,144,-5951.15,-1585.97,7.57),(3001,0,145,-5955.02,-1609.60,7.82),(3001,0,146,-5957.78,-1630.13,7.82),(3001,0,147,-5966.44,-1651.47,8.97),(3001,0,148,-5964.64,-1672.37,8.24),(3001,0,149,-5971.15,-1691.25,8.72),
(3001,0,150,-5964.40,-1716.09,10.88),(3001,0,151,-5962.61,-1735.31,18.59),(3001,0,152,-5956.40,-1750.00,25.75),(3001,0,153,-5960.00,-1769.42,26.57),(3001,0,154,-5972.44,-1780.98,32.44),(3001,0,155,-5985.07,-1800.27,41.42),
(3001,0,156,-5998.40,-1817.40,47.82),(3001,0,157,-6016.18,-1820.71,54.84),(3001,0,158,-6025.60,-1833.67,59.42),(3001,0,159,-6037.87,-1841.00,60.75),(3001,0,160,-6042.60,-1859.27,58.35),(3001,0,161,-6061.28,-1865.33,60.40),
(3001,0,162,-6078.40,-1864.67,59.55),(3001,0,163,-6093.33,-1878.33,59.68),(3001,0,164,-6082.87,-1886.07,60.68),(3001,0,165,-6077.60,-1902.61,59.02),(3001,0,166,-6060.00,-1910.88,54.96),(3001,0,167,-6053.11,-1925.20,54.31),
(3001,0,168,-6061.24,-1946.13,48.80),(3001,0,169,-6082.83,-1957.07,46.06),(3001,0,170,-6097.40,-1971.80,42.95),(3001,0,171,-6107.08,-1971.40,43.91),(3001,0,172,-6090.40,-1961.53,43.82),(3001,0,173,-6066.80,-1952.36,46.88),
(3001,0,174,-6054.31,-1932.80,52.44),(3001,0,175,-6056.47,-1914.40,54.88),(3001,0,176,-6071.42,-1907.24,57.64),(3001,0,177,-6084.96,-1893.71,60.35),(3001,0,178,-6084.27,-1880.76,60.08),(3001,0,179,-6084.05,-1871.52,59.76),
(3001,0,180,-6066.49,-1859.91,59.73),(3001,0,181,-6050.84,-1865.96,58.97),(3001,0,182,-6040.98,-1847.73,58.93),(3001,0,183,-6029.28,-1837.87,59.92),(3001,0,184,-6016.18,-1820.71,54.84),(3001,0,185,-5998.40,-1817.40,47.82),
(3001,0,186,-5985.07,-1800.27,41.42),(3001,0,187,-5972.44,-1780.98,32.44),(3001,0,188,-5960.00,-1769.42,26.57),(3001,0,189,-5941.33,-1760.00,21.42),(3001,0,190,-5918.99,-1758.83,16.46),(3001,0,191,-5900.84,-1738.36,14.04),
(3001,0,192,-5891.73,-1742.00,14.48),(3001,0,193,-5877.73,-1740.18,14.17),(3001,0,194,-5862.11,-1739.59,13.57),(3001,0,195,-5834.67,-1738.67,14.17),(3001,0,196,-5813.33,-1738.67,14.64),(3001,0,197,-5792.00,-1738.67,15.64),
(3001,0,198,-5767.11,-1737.20,22.35),(3001,0,199,-5760.27,-1727.56,27.37),(3001,0,200,-5754.27,-1726.60,31.04),(3001,0,201,-5751.15,-1717.81,34.31),(3001,0,202,-5749.33,-1696.00,35.97),(3001,0,203,-5750.24,-1674.13,34.04),
(3001,0,204,-5739.07,-1653.93,33.04),(3001,0,205,-5724.00,-1641.20,37.77),(3001,0,206,-5733.00,-1620.80,38.17),(3001,0,207,-5740.60,-1610.80,37.91),(3001,0,208,-5750.24,-1608.16,39.11),(3001,0,209,-5770.67,-1606.73,39.97),
(3001,0,210,-5770.67,-1594.40,39.93),(3001,0,211,-5798.00,-1591.20,37.93),(3001,0,212,-5813.33,-1589.33,37.33),(3001,0,213,-5836.44,-1590.31,37.71),(3001,0,214,-5854.20,-1587.50,37.26);
-- The landing ledge's south-east edge, where Karrz stood before he jumped, to where he hit the water. One way, radius 8 takes in
-- the whole landing spot (7.5 y from the mouth).
DELETE FROM {SHARED}.playerbot_nav_links WHERE map_id = 3001 AND kind = 'drop' AND comment LIKE 'Shaper''s Terrace landing ledge%';
INSERT INTO {SHARED}.playerbot_nav_links (map_id, from_x, from_y, from_z, to_x, to_y, to_z, radius, bidirectional, kind, comment, verified, created_by) VALUES
(3001,-5914.01,-977.20,63.38,-5894.65,-1006.33,9.60,8,0,'drop','Shaper''s Terrace landing ledge into the pool: live capture 25 Nov 2026 (Karrz jumped here, no fall damage)',1,'karrz');
@@ -0,0 +1,63 @@
-- Migration: 0069_blackmaw_hold_route_from_the_live_landing
-- Date: 2026-11-26
-- Purpose: Blackmaw Hold (map 2974) as live has it (world 2026_11_26_40..42, from Karrz's capture of 25-26 Nov 2026). Live lands a
-- player at the tunnel's north end (3375.09,3822.24,306.98), not at (3470,3690) as 0044 had it, the Blackmaw Behemoth and
-- Clawbert stand low in the west hall (136 y) where Elder Shaman Bloodmane stood, Bloodmane in the east cave where they stood,
-- and Varrox Bleakhoof waits in a deep chamber about 200 y below the Behemoth's hall (z -62), not in the high north room
-- 0062 walked to. That chamber is not joined to the rest of the navmesh: after the Behemoth Karrz walked west to the hall's
-- edge and fell (from (3423.8,2936.9,133.4), 4.5 s), into a pool (START_SWIM at 3396.2,2921.1,-65.5, no fall damage), swam
-- north-east to the shore and walked to Varrox. There is no way back up. So:
-- * a one-way nav link from that edge to that splash (bots fall it as a jump, PlayerbotAPI move_to drop),
-- * a new route: the landing, then Withermaw, Bonesnout the Unbroken, Impaan the Imprisoner, the Unbound Spirit, Elder
-- Shaman Bloodmane and the Blackmaw Behemoth, the link's mouth, the splash, and Varrox last (about 4150 y, the shortest
-- walk from the landing that ends with the Behemoth before the fall, BlackmawHoldScript.cpp has the same order).
-- Built from the map 2974 navmesh: a crumb every 20 y of walked path or so (209 crumbs, gaps up to 30 y), every crumb-to-crumb
-- leg but the fall is a path on the navmesh of at most 9 polygons. The pool is in the chamber's navmesh (its water
-- polygons), so the swim to the shore needs no second link.
-- Reverts: yes (0044 and 0062's route of map 2974, delete the link).
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 2974;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(2974,0,0,3375.09,3822.24,306.98),(2974,0,1,3370.84,3803.91,308.00),(2974,0,2,3371.79,3791.15,306.77),(2974,0,3,3383.93,3774.80,308.67),(2974,0,4,3392.44,3763.20,306.58),(2974,0,5,3407.73,3752.13,306.20),
(2974,0,6,3425.69,3748.36,309.07),(2974,0,7,3432.43,3738.72,306.83),(2974,0,8,3445.33,3722.67,304.47),(2974,0,9,3446.93,3702.20,302.41),(2974,0,10,3460.53,3693.56,301.50),(2974,0,11,3461.96,3691.56,302.12),
(2974,0,12,3477.16,3684.62,300.78),(2974,0,13,3489.87,3680.16,296.93),(2974,0,14,3497.51,3659.73,295.54),(2974,0,15,3500.67,3633.93,294.94),(2974,0,16,3512.53,3616.27,294.83),(2974,0,17,3520.80,3606.73,295.34),
(2974,0,18,3533.60,3595.69,295.14),(2974,0,19,3545.16,3578.76,294.83),(2974,0,20,3546.80,3558.33,296.07),(2974,0,21,3551.31,3530.77,293.19),(2974,0,22,3549.80,3508.07,291.94),(2974,0,23,3558.13,3486.29,295.22),
(2974,0,24,3566.71,3469.73,297.32),(2974,0,25,3574.40,3452.00,296.83),(2974,0,26,3570.47,3433.13,296.61),(2974,0,27,3584.09,3416.98,296.07),(2974,0,28,3596.00,3398.22,293.10),(2974,0,29,3622.22,3400.44,290.12),
(2974,0,30,3636.27,3408.27,289.47),(2974,0,31,3647.47,3429.07,291.87),(2974,0,32,3659.47,3422.08,291.97),(2974,0,33,3665.33,3400.22,291.45),(2974,0,34,3673.07,3383.73,290.12),(2974,0,35,3679.20,3368.80,289.32),
(2974,0,36,3697.27,3359.00,287.47),(2974,0,37,3712.09,3359.29,284.52),(2974,0,38,3734.30,3369.20,284.11),(2974,0,39,3714.31,3362.40,284.52),(2974,0,40,3697.27,3359.00,287.47),(2974,0,41,3679.20,3368.80,289.32),
(2974,0,42,3667.36,3368.69,290.85),(2974,0,43,3648.98,3359.20,288.43),(2974,0,44,3625.33,3351.02,278.38),(2974,0,45,3612.40,3336.53,272.87),(2974,0,46,3593.80,3331.60,272.67),(2974,0,47,3577.65,3333.33,273.09),
(2974,0,48,3572.31,3355.29,268.30),(2974,0,49,3550.93,3361.56,261.18),(2974,0,50,3536.87,3379.20,257.47),(2974,0,51,3510.24,3382.45,254.85),(2974,0,52,3489.44,3380.32,254.42),(2974,0,53,3466.22,3380.31,253.98),
(2974,0,54,3443.20,3378.71,253.72),(2974,0,55,3424.16,3379.36,254.10),(2974,0,56,3402.27,3378.13,252.61),(2974,0,57,3381.87,3380.00,251.98),(2974,0,58,3359.79,3382.88,250.74),(2974,0,59,3339.07,3383.40,250.67),
(2974,0,60,3338.67,3402.67,251.34),(2974,0,61,3317.33,3402.67,251.21),(2974,0,62,3297.80,3409.80,250.45),(2974,0,63,3317.33,3402.67,251.21),(2974,0,64,3338.67,3402.67,251.34),(2974,0,65,3357.42,3413.69,256.61),
(2974,0,66,3360.89,3433.96,263.98),(2974,0,67,3381.27,3438.00,274.07),(2974,0,68,3402.51,3442.40,285.57),(2974,0,69,3423.82,3446.58,293.67),(2974,0,70,3423.31,3465.55,298.58),(2974,0,71,3419.47,3470.67,301.47),
(2974,0,72,3403.73,3482.83,305.03),(2974,0,73,3380.22,3480.93,314.12),(2974,0,74,3362.99,3481.71,321.99),(2974,0,75,3346.33,3491.00,333.14),(2974,0,76,3331.13,3492.53,336.74),(2974,0,77,3313.07,3502.31,339.10),
(2974,0,78,3309.40,3511.00,341.07),(2974,0,79,3317.33,3529.87,347.07),(2974,0,80,3310.58,3544.27,344.34),(2974,0,81,3310.31,3559.91,344.34),(2974,0,82,3314.99,3573.33,343.22),(2974,0,83,3316.32,3596.64,342.31),
(2974,0,84,3318.31,3616.27,343.98),(2974,0,85,3323.20,3628.53,345.50),(2974,0,86,3323.20,3634.47,347.07),(2974,0,87,3348.10,3641.90,343.24),(2974,0,88,3323.20,3634.47,347.07),(2974,0,89,3324.09,3627.11,344.78),
(2974,0,90,3318.31,3616.27,343.98),(2974,0,91,3316.32,3596.64,342.31),(2974,0,92,3314.99,3573.33,343.22),(2974,0,93,3309.33,3552.07,344.61),(2974,0,94,3310.58,3544.27,344.34),(2974,0,95,3317.33,3529.87,347.07),
(2974,0,96,3309.40,3511.00,341.07),(2974,0,97,3318.40,3499.02,338.65),(2974,0,98,3331.13,3492.53,336.74),(2974,0,99,3349.87,3491.13,332.47),(2974,0,100,3370.04,3480.80,318.92),(2974,0,101,3396.47,3482.73,307.41),
(2974,0,102,3410.45,3475.04,304.13),(2974,0,103,3429.67,3470.47,298.47),(2974,0,104,3444.21,3464.43,296.18),(2974,0,105,3455.07,3442.47,297.81),(2974,0,106,3464.62,3430.00,298.12),(2974,0,107,3462.08,3411.09,293.46),
(2974,0,108,3461.67,3383.60,292.67),(2974,0,109,3462.40,3356.75,300.55),(2974,0,110,3466.44,3336.13,309.32),(2974,0,111,3465.07,3315.87,318.14),(2974,0,112,3461.44,3293.65,325.51),(2974,0,113,3460.22,3272.80,329.18),
(2974,0,114,3464.53,3246.27,325.07),(2974,0,115,3465.96,3225.60,323.36),(2974,0,116,3478.22,3222.76,323.10),(2974,0,117,3499.57,3212.27,321.73),(2974,0,118,3522.00,3214.80,320.47),(2974,0,119,3543.84,3216.80,319.33),
(2974,0,120,3556.37,3208.69,317.19),(2974,0,121,3563.40,3194.80,315.36),(2974,0,122,3575.42,3192.49,314.02),(2974,0,123,3581.27,3171.60,312.16),(2974,0,124,3587.07,3156.40,311.22),(2974,0,125,3597.49,3139.79,310.45),
(2974,0,126,3597.67,3117.60,309.22),(2974,0,127,3615.82,3104.40,304.69),(2974,0,128,3620.32,3082.35,301.12),(2974,0,129,3616.71,3061.82,297.54),(2974,0,130,3592.76,3060.31,294.82),(2974,0,131,3572.89,3070.04,291.71),
(2974,0,132,3555.29,3078.49,287.54),(2974,0,133,3543.56,3093.07,282.91),(2974,0,134,3520.62,3105.51,276.42),(2974,0,135,3502.56,3111.25,273.54),(2974,0,136,3482.40,3111.67,262.56),(2974,0,137,3459.56,3109.69,257.49),
(2974,0,138,3443.80,3102.67,254.36),(2974,0,139,3434.40,3089.78,249.40),(2974,0,140,3419.80,3075.40,244.29),(2974,0,141,3419.68,3056.59,241.38),(2974,0,142,3421.69,3042.31,240.51),(2974,0,143,3412.40,3034.47,238.89),
(2974,0,144,3406.31,3019.20,232.69),(2974,0,145,3394.19,3014.40,227.62),(2974,0,146,3375.07,3011.13,223.89),(2974,0,147,3364.00,2998.49,219.85),(2974,0,148,3351.87,2986.00,218.02),(2974,0,149,3334.93,2977.47,217.02),
(2974,0,150,3324.33,2971.00,219.56),(2974,0,151,3305.78,2965.60,216.25),(2974,0,152,3293.40,2942.53,210.16),(2974,0,153,3276.00,2933.81,207.41),(2974,0,154,3274.67,2912.00,205.49),(2974,0,155,3249.10,2911.50,203.89),
(2974,0,156,3274.67,2912.00,205.49),(2974,0,157,3303.47,2912.11,205.22),(2974,0,158,3318.71,2897.87,205.22),(2974,0,159,3338.56,2888.69,207.36),(2974,0,160,3354.04,2883.20,205.67),(2974,0,161,3378.98,2886.00,201.58),
(2974,0,162,3395.80,2879.07,200.29),(2974,0,163,3406.40,2860.59,199.20),(2974,0,164,3408.31,2843.16,196.29),(2974,0,165,3423.20,2839.13,195.82),(2974,0,166,3449.07,2849.24,193.58),(2974,0,167,3467.47,2855.60,192.96),
(2974,0,168,3489.65,2849.17,193.28),(2974,0,169,3492.80,2824.58,193.54),(2974,0,170,3509.69,2805.20,192.47),(2974,0,171,3529.00,2799.00,189.89),(2974,0,172,3545.97,2801.23,185.06),(2974,0,173,3556.27,2819.47,175.96),
(2974,0,174,3554.19,2839.15,169.38),(2974,0,175,3567.38,2857.07,169.05),(2974,0,176,3580.53,2870.19,169.44),(2974,0,177,3603.56,2868.27,173.05),(2974,0,178,3626.49,2868.44,173.40),(2974,0,179,3637.33,2868.27,172.74),
(2974,0,180,3658.80,2867.02,172.16),(2974,0,181,3681.30,2868.80,172.20),(2974,0,182,3658.80,2867.02,172.16),(2974,0,183,3637.33,2868.27,172.74),(2974,0,184,3617.40,2870.53,174.22),(2974,0,185,3593.78,2867.33,170.91),
(2974,0,186,3571.87,2869.20,169.49),(2974,0,187,3576.93,2889.29,171.14),(2974,0,188,3587.73,2903.91,164.96),(2974,0,189,3594.73,2922.20,159.89),(2974,0,190,3591.60,2941.78,156.82),(2974,0,191,3586.40,2964.71,149.85),
(2974,0,192,3568.27,2977.33,146.60),(2974,0,193,3552.13,2981.47,145.22),(2974,0,194,3531.56,2974.93,146.87),(2974,0,195,3510.08,2977.12,145.17),(2974,0,196,3500.44,2961.51,139.54),(2974,0,197,3479.60,2962.00,136.80),
(2974,0,198,3453.33,2957.33,135.89),(2974,0,199,3451.91,2944.98,135.89),(2974,0,200,3436.49,2935.24,136.47),(2974,0,201,3426.60,2938.20,134.43),(2974,0,202,3396.20,2921.10,-65.50),(2974,0,203,3424.00,2912.00,-63.84),
(2974,0,204,3445.96,2920.09,-63.84),(2974,0,205,3458.20,2937.07,-63.84),(2974,0,206,3463.84,2962.83,-63.10),(2974,0,207,3480.00,2976.07,-62.11),(2974,0,208,3482.40,3001.00,-62.45);
-- The west edge of the Behemoth's hall, on the navmesh 3 y short of where Karrz left it, to where he hit the water. One way.
DELETE FROM {SHARED}.playerbot_nav_links WHERE map_id = 2974 AND kind = 'drop' AND comment LIKE 'Blackmaw Hold Behemoth hall%';
INSERT INTO {SHARED}.playerbot_nav_links (map_id, from_x, from_y, from_z, to_x, to_y, to_z, radius, bidirectional, kind, comment, verified, created_by) VALUES
(2974,3426.60,2938.20,134.43,3396.20,2921.10,-65.50,8,0,'drop','Blackmaw Hold Behemoth hall edge into the pool by Varrox: live capture 26 Nov 2026 (Karrz fell here, no fall damage)',1,'karrz');
@@ -0,0 +1,52 @@
-- Migration: 0070_shapers_terrace_route_not_through_the_titanic_door
-- Date: 2026-11-26
-- Purpose: The Shaper's Terrace (map 3001): 0068's route went from the Titanic Door's front (crumb 48) through the door to the
-- Titanosaur (crumbs 49-55) and back. The door is live's locked raid gate (world 2026_11_25_82, state closed, Karrz used it 12
-- times on 25 Nov 2026 and it never opened), and the Titanosaur stands behind it: with the door closed the navmesh has no other
-- way to him. A closed door is not walked through (PathGenerator's closed-door check), so the tank stood at the door's front for
-- good (shapers_full af84 26 Nov 2026: group_stalled at 565 s, reach_reject PATHFIND_INCOMPLETE from crumb 47 toward 49).
-- This is 0068's route without crumbs 49-55: from the door's front straight on to the east (crumb 48 to 0068's 56, 17 y along
-- the door's face, 8 y clear of it), renumbered, 208 crumbs. ShapersTerraceScript and shapers_full drop the Titanosaur. The
-- landing link of 0068 stays.
-- Reverts: yes (0068's route).
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 3001;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(3001,0,0,-5921.34,-975.49,63.26),(3001,0,1,-5914.01,-977.20,63.38),(3001,0,2,-5894.65,-1006.33,9.60),(3001,0,3,-5877.33,-1013.33,12.26),(3001,0,4,-5875.68,-992.16,12.26),(3001,0,5,-5860.84,-977.38,12.26),
(3001,0,6,-5836.27,-969.07,13.33),(3001,0,7,-5821.00,-951.00,19.60),(3001,0,8,-5814.40,-930.80,23.80),(3001,0,9,-5804.44,-915.38,24.97),(3001,0,10,-5793.60,-900.00,23.82),(3001,0,11,-5793.87,-875.02,25.60),
(3001,0,12,-5772.69,-863.25,26.56),(3001,0,13,-5783.02,-852.09,28.62),(3001,0,14,-5785.07,-844.00,29.86),(3001,0,15,-5804.73,-835.13,34.93),(3001,0,16,-5814.13,-822.13,41.17),(3001,0,17,-5835.33,-812.47,51.86),
(3001,0,18,-5842.27,-793.67,58.80),(3001,0,19,-5864.60,-798.20,70.46),(3001,0,20,-5889.07,-800.18,79.82),(3001,0,21,-5905.73,-802.58,87.28),(3001,0,22,-5908.80,-813.24,92.00),(3001,0,23,-5909.07,-821.07,98.06),
(3001,0,24,-5907.38,-828.89,104.17),(3001,0,25,-5897.51,-842.93,110.13),(3001,0,26,-5904.20,-862.50,113.10),(3001,0,27,-5894.45,-847.20,111.57),(3001,0,28,-5901.47,-830.80,107.40),(3001,0,29,-5907.38,-828.89,104.17),
(3001,0,30,-5909.07,-821.07,98.06),(3001,0,31,-5908.80,-813.24,92.00),(3001,0,32,-5905.73,-802.58,87.28),(3001,0,33,-5889.07,-800.18,79.82),(3001,0,34,-5868.27,-800.60,73.33),(3001,0,35,-5856.20,-794.47,65.66),
(3001,0,36,-5836.76,-803.64,54.44),(3001,0,37,-5821.87,-803.47,46.22),(3001,0,38,-5806.93,-788.71,42.13),(3001,0,39,-5800.53,-770.76,43.20),(3001,0,40,-5792.00,-757.33,40.86),(3001,0,41,-5770.67,-757.33,37.53),
(3001,0,42,-5770.67,-737.47,38.00),(3001,0,43,-5749.33,-736.00,34.93),(3001,0,44,-5728.00,-736.00,31.33),(3001,0,45,-5706.67,-736.00,28.60),(3001,0,46,-5696.60,-723.80,30.86),(3001,0,47,-5695.04,-723.79,30.88),
(3001,0,48,-5688.09,-725.07,28.80),(3001,0,49,-5670.73,-723.93,28.06),(3001,0,50,-5664.00,-736.00,27.53),(3001,0,51,-5642.67,-736.00,29.93),(3001,0,52,-5621.33,-736.00,31.33),(3001,0,53,-5600.00,-736.00,31.73),
(3001,0,54,-5578.67,-736.00,31.06),(3001,0,55,-5557.73,-737.20,27.20),(3001,0,56,-5537.81,-735.79,24.32),(3001,0,57,-5521.78,-746.13,19.91),(3001,0,58,-5514.89,-761.33,18.66),(3001,0,59,-5501.65,-776.21,19.46),
(3001,0,60,-5496.32,-801.65,18.82),(3001,0,61,-5493.16,-810.40,18.66),(3001,0,62,-5483.11,-809.87,20.62),(3001,0,63,-5469.92,-808.59,23.20),(3001,0,64,-5454.13,-797.92,21.97),(3001,0,65,-5443.10,-792.40,21.74),
(3001,0,66,-5458.04,-799.73,21.42),(3001,0,67,-5473.00,-806.20,22.86),(3001,0,68,-5484.20,-813.07,19.00),(3001,0,69,-5505.47,-817.87,18.66),(3001,0,70,-5514.24,-825.65,19.14),(3001,0,71,-5520.80,-845.80,22.62),
(3001,0,72,-5547.33,-849.40,18.66),(3001,0,73,-5555.47,-862.77,18.66),(3001,0,74,-5575.80,-872.13,18.66),(3001,0,75,-5578.67,-884.62,19.24),(3001,0,76,-5578.67,-906.67,20.53),(3001,0,77,-5578.67,-928.00,21.93),
(3001,0,78,-5578.67,-949.33,21.26),(3001,0,79,-5578.67,-970.67,19.53),(3001,0,80,-5578.67,-992.00,17.93),(3001,0,81,-5578.67,-1013.33,13.73),(3001,0,82,-5578.67,-1034.67,10.13),(3001,0,83,-5591.38,-1044.80,9.33),
(3001,0,84,-5599.64,-1057.73,9.33),(3001,0,85,-5611.47,-1070.22,9.26),(3001,0,86,-5622.22,-1089.16,10.42),(3001,0,87,-5628.44,-1091.11,9.98),(3001,0,88,-5637.53,-1102.87,12.40),(3001,0,89,-5642.67,-1120.00,17.80),
(3001,0,90,-5642.03,-1141.65,25.80),(3001,0,91,-5642.35,-1165.28,29.80),(3001,0,92,-5644.75,-1186.03,33.37),(3001,0,93,-5644.64,-1205.60,34.60),(3001,0,94,-5624.27,-1205.67,35.33),(3001,0,95,-5628.32,-1223.80,34.17),
(3001,0,96,-5624.27,-1205.67,35.33),(3001,0,97,-5644.64,-1205.60,34.60),(3001,0,98,-5644.75,-1186.03,33.37),(3001,0,99,-5642.35,-1165.28,29.80),(3001,0,100,-5659.73,-1151.20,25.71),(3001,0,101,-5656.36,-1131.64,22.60),
(3001,0,102,-5660.09,-1123.91,17.71),(3001,0,103,-5668.80,-1131.47,11.49),(3001,0,104,-5685.33,-1141.33,9.60),(3001,0,105,-5697.27,-1159.20,8.26),(3001,0,106,-5720.53,-1171.82,8.82),(3001,0,107,-5736.36,-1188.89,2.51),
(3001,0,108,-5760.98,-1189.16,-4.16),(3001,0,109,-5778.13,-1180.93,-2.94),(3001,0,110,-5792.00,-1184.00,-3.54),(3001,0,111,-5813.33,-1184.00,-2.94),(3001,0,112,-5834.13,-1184.00,-1.54),(3001,0,113,-5854.45,-1186.03,-0.71),
(3001,0,114,-5877.33,-1184.00,1.37),(3001,0,115,-5908.77,-1192.19,6.76),(3001,0,116,-5933.00,-1183.30,9.07),(3001,0,117,-5933.00,-1204.20,8.84),(3001,0,118,-5933.60,-1225.42,9.53),(3001,0,119,-5933.53,-1249.60,9.44),
(3001,0,120,-5921.28,-1269.87,10.35),(3001,0,121,-5918.29,-1290.61,9.71),(3001,0,122,-5918.73,-1312.00,8.84),(3001,0,123,-5920.00,-1333.33,6.84),(3001,0,124,-5932.80,-1343.29,7.22),(3001,0,125,-5934.08,-1351.47,8.43),
(3001,0,126,-5942.67,-1373.78,11.66),(3001,0,127,-5960.40,-1382.53,11.51),(3001,0,128,-5964.27,-1395.68,10.77),(3001,0,129,-5962.67,-1418.67,10.77),(3001,0,130,-5962.67,-1440.00,9.71),(3001,0,131,-5952.41,-1463.46,8.84),
(3001,0,132,-5962.56,-1482.24,9.12),(3001,0,133,-5958.84,-1500.18,7.66),(3001,0,134,-5962.67,-1525.33,7.57),(3001,0,135,-5961.60,-1546.29,7.57),(3001,0,136,-5956.27,-1565.73,7.71),(3001,0,137,-5951.15,-1585.97,7.57),
(3001,0,138,-5955.02,-1609.60,7.82),(3001,0,139,-5957.78,-1630.13,7.82),(3001,0,140,-5966.44,-1651.47,8.97),(3001,0,141,-5964.64,-1672.37,8.24),(3001,0,142,-5971.15,-1691.25,8.72),(3001,0,143,-5964.40,-1716.09,10.88),
(3001,0,144,-5962.61,-1735.31,18.59),(3001,0,145,-5956.40,-1750.00,25.75),(3001,0,146,-5960.00,-1769.42,26.57),(3001,0,147,-5972.44,-1780.98,32.44),(3001,0,148,-5985.07,-1800.27,41.42),(3001,0,149,-5998.40,-1817.40,47.82),
(3001,0,150,-6016.18,-1820.71,54.84),(3001,0,151,-6025.60,-1833.67,59.42),(3001,0,152,-6037.87,-1841.00,60.75),(3001,0,153,-6042.60,-1859.27,58.35),(3001,0,154,-6061.28,-1865.33,60.40),(3001,0,155,-6078.40,-1864.67,59.55),
(3001,0,156,-6093.33,-1878.33,59.68),(3001,0,157,-6082.87,-1886.07,60.68),(3001,0,158,-6077.60,-1902.61,59.02),(3001,0,159,-6060.00,-1910.88,54.96),(3001,0,160,-6053.11,-1925.20,54.31),(3001,0,161,-6061.24,-1946.13,48.80),
(3001,0,162,-6082.83,-1957.07,46.06),(3001,0,163,-6097.40,-1971.80,42.95),(3001,0,164,-6107.08,-1971.40,43.91),(3001,0,165,-6090.40,-1961.53,43.82),(3001,0,166,-6066.80,-1952.36,46.88),(3001,0,167,-6054.31,-1932.80,52.44),
(3001,0,168,-6056.47,-1914.40,54.88),(3001,0,169,-6071.42,-1907.24,57.64),(3001,0,170,-6084.96,-1893.71,60.35),(3001,0,171,-6084.27,-1880.76,60.08),(3001,0,172,-6084.05,-1871.52,59.76),(3001,0,173,-6066.49,-1859.91,59.73),
(3001,0,174,-6050.84,-1865.96,58.97),(3001,0,175,-6040.98,-1847.73,58.93),(3001,0,176,-6029.28,-1837.87,59.92),(3001,0,177,-6016.18,-1820.71,54.84),(3001,0,178,-5998.40,-1817.40,47.82),(3001,0,179,-5985.07,-1800.27,41.42),
(3001,0,180,-5972.44,-1780.98,32.44),(3001,0,181,-5960.00,-1769.42,26.57),(3001,0,182,-5941.33,-1760.00,21.42),(3001,0,183,-5918.99,-1758.83,16.46),(3001,0,184,-5900.84,-1738.36,14.04),(3001,0,185,-5891.73,-1742.00,14.48),
(3001,0,186,-5877.73,-1740.18,14.17),(3001,0,187,-5862.11,-1739.59,13.57),(3001,0,188,-5834.67,-1738.67,14.17),(3001,0,189,-5813.33,-1738.67,14.64),(3001,0,190,-5792.00,-1738.67,15.64),(3001,0,191,-5767.11,-1737.20,22.35),
(3001,0,192,-5760.27,-1727.56,27.37),(3001,0,193,-5754.27,-1726.60,31.04),(3001,0,194,-5751.15,-1717.81,34.31),(3001,0,195,-5749.33,-1696.00,35.97),(3001,0,196,-5750.24,-1674.13,34.04),(3001,0,197,-5739.07,-1653.93,33.04),
(3001,0,198,-5724.00,-1641.20,37.77),(3001,0,199,-5733.00,-1620.80,38.17),(3001,0,200,-5740.60,-1610.80,37.91),(3001,0,201,-5750.24,-1608.16,39.11),(3001,0,202,-5770.67,-1606.73,39.97),(3001,0,203,-5770.67,-1594.40,39.93),
(3001,0,204,-5798.00,-1591.20,37.93),(3001,0,205,-5813.33,-1589.33,37.33),(3001,0,206,-5836.44,-1590.31,37.71),(3001,0,207,-5854.20,-1587.50,37.26);
@@ -0,0 +1,64 @@
-- Migration: 0071_alcaz_prison_route_as_live_clears_it
-- Date: 2026-11-27
-- Purpose: Alcaz Prison (map 2994): the route for live's layout (world 2026_11_27_40..43, from Karrz's capture of a full clear on
-- 26 Nov) in live's kill order: Overseer Wrex, Katerina the Cleaner, Blazeroar, The Questioner. From live's landing
-- (-8796.59, 2838.67, 28.77) only Wrex's wing is open: with live's doors shut, the 2994 navmesh joins the landing to Wrex
-- and to the Maximum Security Door 649547 (-8791.3, 2932.4), and nothing else. Legs 21-22 go through that door (the rogue
-- picks its lock, as on live) to Katerina and Blazeroar, legs 39-40 come back out through it, legs 43-44 go through the
-- Prison Gate 649552 (-8763.4, 2871.3), which shuts 3 s after each use, to The Questioner. No other leg crosses a door.
-- Crumbs 10, 26, 31 and 46 are the bosses' spots. 47 crumbs, 789 y, every leg is a navmesh path of at most 26 y.
-- Tidemistress Ca'zass is not spawned (live has her nowhere), so the route does not go down to her old room.
-- Reverts: run 0066 again.
-- @target: shared
DELETE FROM {SHARED}.playerbot_dungeon_routes WHERE map_id = 2994;
INSERT INTO {SHARED}.playerbot_dungeon_routes (map_id, difficulty, seq, position_x, position_y, position_z) VALUES
(2994,0,0,-8796.59,2838.67,28.77),
(2994,0,1,-8796.73,2858.93,21.55),
(2994,0,2,-8797.60,2876.21,19.33),
(2994,0,3,-8801.53,2887.93,19.35),
(2994,0,4,-8823.64,2889.60,15.58),
(2994,0,5,-8836.62,2886.40,15.13),
(2994,0,6,-8852.40,2889.38,14.02),
(2994,0,7,-8873.15,2887.47,14.20),
(2994,0,8,-8889.24,2901.42,15.04),
(2994,0,9,-8886.00,2904.93,14.69),
(2994,0,10,-8885.80,2921.30,14.91),
(2994,0,11,-8885.97,2902.29,14.85),
(2994,0,12,-8873.15,2887.47,14.20),
(2994,0,13,-8853.60,2886.67,14.33),
(2994,0,14,-8836.62,2886.40,15.13),
(2994,0,15,-8823.64,2889.60,15.58),
(2994,0,16,-8802.58,2886.67,19.49),
(2994,0,17,-8780.13,2888.00,17.29),
(2994,0,18,-8762.13,2893.16,14.86),
(2994,0,19,-8761.78,2910.89,10.64),
(2994,0,20,-8764.98,2932.00,6.73),
(2994,0,21,-8783.91,2932.31,6.46),
(2994,0,22,-8802.40,2932.40,6.42),
(2994,0,23,-8807.47,2933.53,7.09),
(2994,0,24,-8807.93,2949.00,7.22),
(2994,0,25,-8797.13,2966.40,6.89),
(2994,0,26,-8808.50,2971.10,6.01),
(2994,0,27,-8825.07,2966.27,7.22),
(2994,0,28,-8847.73,2968.53,7.40),
(2994,0,29,-8858.47,2966.20,7.22),
(2994,0,30,-8875.82,2975.38,6.15),
(2994,0,31,-8901.20,2971.50,5.89),
(2994,0,32,-8875.82,2975.38,6.15),
(2994,0,33,-8858.47,2966.20,7.22),
(2994,0,34,-8837.60,2968.53,7.04),
(2994,0,35,-8825.07,2966.27,7.22),
(2994,0,36,-8811.67,2955.53,6.55),
(2994,0,37,-8807.93,2949.00,7.22),
(2994,0,38,-8806.40,2929.16,6.86),
(2994,0,39,-8802.40,2932.40,6.42),
(2994,0,40,-8780.13,2932.13,6.82),
(2994,0,41,-8762.13,2926.49,6.78),
(2994,0,42,-8764.98,2906.27,12.15),
(2994,0,43,-8764.98,2887.64,15.13),
(2994,0,44,-8763.13,2869.33,14.35),
(2994,0,45,-8771.84,2863.52,13.57),
(2994,0,46,-8773.00,2854.20,13.86);
+1
View File
@@ -24,6 +24,7 @@ Applied in ascending numeric order; each file records itself in
- `0040_companion_talent_code.sql` — `playerbot_v2_character.companion_talents`: a companion's own talent build, given as a Wowhead Forever talent calculator code (`change talents <link>`), kept across relog and restart
- `0041_bot_text_fixes.sql` — (shared DB) removes stock lines that read as nonsense or as a bot: the `suggest_something` line that was only `%zone_name`, and "dont ask me %s, im just a bot"
- `0042_bot_text_meta_lines.sql` — (shared DB) removes four "not understood" replies that talk about the chat like a program ("getting confused from chat again", "i will attempt to understand that comment", ...)
- `0060_companion_owner_orders.sql` — `playerbot_v2_character.owner_orders`: a companion's standing "loot all" and "gather on" orders, kept across relog, `.bot call` and restart
## Discipline
- Never edit a numbered migration after it ships. Add a new one to amend.
@@ -23,4 +23,6 @@
<Binding name="CLICK ForeverBotsKeyIgnoreTarget:LeftButton" category="ADDONS"/>
<Binding name="CLICK ForeverBotsKeyIgnoreClear:LeftButton" category="ADDONS"/>
<Binding name="CLICK ForeverBotsKeyLazy:LeftButton" category="ADDONS"/>
<Binding name="CLICK ForeverBotsKeyLazyHeal:LeftButton" category="ADDONS"/>
<Binding name="CLICK ForeverBotsKeyLazyTank:LeftButton" category="ADDONS"/>
</Bindings>
@@ -212,6 +212,18 @@ for _, c in ipairs(CLASSES) do
end
local ROLE_LABEL = { tank = L["Tank"], healer = L["Heal"], dps = L["DPS"] }
-- The specs of each class for the bot menu's Spec list: { spec id the bot's setspec takes, name }.
local MENU_SPECS = {
WARRIOR = { { 71, "Arms" }, { 72, "Fury" }, { 73, "Protection" } },
PALADIN = { { 65, "Holy" }, { 66, "Protection" }, { 70, "Retribution" } },
HUNTER = { { 253, "Beast Mastery" }, { 254, "Marksmanship" }, { 255, "Survival" } },
ROGUE = { { 259, "Assassination" }, { 260, "Combat" }, { 261, "Subtlety" } },
PRIEST = { { 256, "Discipline" }, { 257, "Holy" }, { 258, "Shadow" } },
SHAMAN = { { 262, "Elemental" }, { 263, "Enhancement" }, { 264, "Restoration" } },
MAGE = { { 62, "Arcane" }, { 63, "Fire" }, { 64, "Frost" } },
WARLOCK = { { 265, "Affliction" }, { 266, "Demonology" }, { 267, "Destruction" } },
DRUID = { { 102, "Balance" }, { 103, "Feral" }, { 104, "Feral (bear)" }, { 105, "Restoration" } },
}
-- What the add-on was doing when the client blocked a call: set before the steps that touch the client's own frames.
local currentStep = ""
@@ -938,15 +950,22 @@ do
end
end
-- Lazy lock (warlock): one key, the server picks the next spell (dots, curse, Shadow Bolt, cooldowns) and casts it on your target.
-- Lazy key (every class): one key, the server picks the next spell of your class and role (the warlock's dots and Shadow Bolt, a
-- warrior's Revenge and Sunder in Defensive Stance, a priest's heal on the most hurt group member...) and casts it.
-- The client will not let an add-on choose spells in a fight, so the key clicks a secure button that runs the server command
-- ".playerbot lazy" as the player's own line, in combat too. Press it again for every cast.
-- ".playerbot lazy" as the player's own line, in combat too. Press it again for every cast. The heal and tank keys play that role
-- whatever your spec is (a feral druid tanking, a shadow priest healing a pull).
do
local b = CreateFrame("Button", "ForeverBotsKeyLazy", UIParent, "SecureActionButtonTemplate")
b:RegisterForClicks("AnyUp", "AnyDown")
b:SetAttribute("type", "macro")
b:SetAttribute("macrotext", ".playerbot lazy")
_G["BINDING_NAME_CLICK ForeverBotsKeyLazy:LeftButton"] = L["Lazy lock (warlock: next spell on your target)"]
local function LazyKey(name, macrotext, label)
local b = CreateFrame("Button", name, UIParent, "SecureActionButtonTemplate")
b:RegisterForClicks("AnyUp", "AnyDown")
b:SetAttribute("type", "macro")
b:SetAttribute("macrotext", macrotext)
_G["BINDING_NAME_CLICK " .. name .. ":LeftButton"] = label
end
LazyKey("ForeverBotsKeyLazy", ".playerbot lazy", L["Lazy key (any class: next spell of your spec)"])
LazyKey("ForeverBotsKeyLazyHeal", ".playerbot lazy heal", L["Lazy key: heal (most hurt group member)"])
LazyKey("ForeverBotsKeyLazyTank", ".playerbot lazy tank", L["Lazy key: tank (threat on your target)"])
end
-- Duplicate macros: a key bound to a macro ("bind ALT-E MACRO Corruption" in bindings-cache.wtf) runs the first macro of that
@@ -1699,6 +1718,7 @@ function UI.BuildBots()
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(L["Gear: %s"]:format(GEAR_NAME[ForeverBotsDB.gear or "match"] or "?"))
GameTooltip:AddLine(L["The gear the next bots wear. Click to go to the next choice: Match, Best, BiS, T1, T2, T3."], 1, 1, 1, true)
GameTooltip:AddLine(L["BiS and T1 to T3 start at level 60. Below that the bots wear gear for their level, as with Match."], 1, 0.82, 0, true)
GameTooltip:Show()
end)
gearBtn:SetScript("OnLeave", function() GameTooltip:Hide() end)
@@ -1946,7 +1966,10 @@ local function BuildFrame()
frame:SetSize(LAYOUT.W, LAYOUT.TOP + LAYOUT.PANE_H + LAYOUT.FOOTER)
frame:SetScale(WindowScale())
frame:SetPoint("CENTER")
frame:SetFrameStrata("DIALOG")
-- the same layer as the bags and the game's own windows, and raised on a click: an opened bag can sit over it (row 352, the
-- DIALOG layer kept it on top of every bag)
frame:SetFrameStrata("MEDIUM")
frame:SetToplevel(true)
frame:SetMovable(true)
frame:SetClampedToScreen(true)
frame:EnableMouse(true)
@@ -2755,6 +2778,16 @@ local function AddBotMenu(root, unit, who)
end
end
-- Spec: every spec of the class ("setspec <id>": the spec, its role and its talents). Role "Damage" keeps the damage spec
-- the bot plays, so a shaman stayed Enhancement with no menu way to Elemental (row 286).
local specs = MENU_SPECS[token]
if specs then
local specMenu = menu:CreateButton(L["Spec"])
for _, s in ipairs(specs) do
specMenu:CreateButton(L[s[2]], function() Send("setspec " .. s[1]) end)
end
end
-- Raid icons: the bot follows the icon you put on a mob (the server's "assign <marker> [kill|cc|tank]").
-- One list, a title per job: a submenu per job made this menu four levels deep, and where the screen has no room on the
-- right the client opens each level on the other side, so the fourth level lay over the bot menu and the third over the
@@ -1,7 +1,8 @@
--[[
ForeverBots_Spec: the Spec page of the bot manager. The picked bot's spec and role, buttons to give it another role (its
talents follow the role) or to hand the role back to its talents, and Re-pick talents (the starter build of its spec).
The bot's own orders setrole and talents apply, sent hidden.
talents follow the role) or to hand the role back to its talents, a button per spec of its class (Elemental or Enhancement
for a damage shaman, Fire or Frost for a mage), and Re-pick talents (the starter build of its spec).
The bot's own orders setrole, setspec and talents apply, sent hidden.
]]
local ADDON, ns = ...
@@ -25,6 +26,13 @@ local CLASS_ROLES = {
WARRIOR = { "tank", "dps" }, PALADIN = { "tank", "healer", "dps" }, SHAMAN = { "healer", "dps" }, HUNTER = { "dps" },
ROGUE = { "dps" }, PRIEST = { "healer", "dps" }, MAGE = { "dps" }, WARLOCK = { "dps" }, DRUID = { "tank", "healer", "dps" },
}
-- The specs of each class, in talent tab order: "setspec <id>" plays that spec and re-learns its talents. "Damage" alone keeps
-- the damage spec the bot plays, Enhancement for a new shaman; Elemental was only a whisper away (row 286).
local CLASS_SPECS = {
WARRIOR = { 71, 72, 73 }, PALADIN = { 65, 66, 70 }, HUNTER = { 253, 254, 255 }, ROGUE = { 259, 260, 261 },
PRIEST = { 256, 257, 258 }, SHAMAN = { 262, 263, 264 }, MAGE = { 62, 63, 64 }, WARLOCK = { 265, 266, 267 },
DRUID = { 102, 103, 104, 105 },
}
local ROLE_LABEL = { tank = L["Tank"], healer = L["Healer"], dps = L["Damage"] }
local ROLE_TOKEN = { TANK = "tank", HEALER = "healer", DPS = "dps" }
@@ -66,6 +74,19 @@ local function Refresh(bot)
b:Hide()
end
end
local specs = bot and CLASS_SPECS[bot.class] or {}
for i, b in ipairs(pane.specButtons) do
local s = specs[i]
b.spec = s
if s then
b:SetText(SPEC_NAME[s] or tostring(s))
b:SetEnabled(bot.online and true or false)
if bot.specId == s then b:LockHighlight() else b:UnlockHighlight() end
b:Show()
else
b:Hide()
end
end
local online = bot and bot.online or false
pane.auto:SetEnabled(online)
pane.talents:SetEnabled(online)
@@ -97,6 +118,17 @@ local function Build(p)
p.talents:SetPoint("TOPLEFT", p, "TOPLEFT", 118, -134)
p.talents:SetScript("OnClick", function() Order("talents", "apply") end)
W.Tip(p.talents, L["Re-pick talents"], L["The bot takes the starter talent build of its spec again (not in combat)."])
local shead = p:CreateFontString(nil, "OVERLAY", "GameFontNormal")
shead:SetPoint("TOPLEFT", 0, -170)
shead:SetText(L["Pick a spec"])
p.specButtons = {}
for i = 1, 4 do
local b = W.MakeButton(p, "", 68)
b:SetPoint("TOPLEFT", p, "TOPLEFT", (i - 1) * 72, -188)
b:SetScript("OnClick", function(self) if self.spec then Order("setspec", self.spec) end end)
W.Tip(b, L["Pick a spec"], L["The bot plays this spec from now on (its role follows) and re-learns its talents for it. Kept across relog and Call."])
p.specButtons[i] = b
end
end
W.AddTab({
@@ -109,6 +109,7 @@ ForeverBotsLocale = {
["Match"] = "Как у меня",
["Best"] = "Лучшее",
["The gear the next bots wear. Click to go to the next choice: Match, Best, BiS, T1, T2, T3."] = "Экипировка следующих ботов. Щелкните для следующего варианта: Как у меня, Лучшее, BiS, T1, T2, T3.",
["BiS and T1 to T3 start at level 60. Below that the bots wear gear for their level, as with Match."] = "BiS и T1-T3 действуют с 60-го уровня. До него боты носят экипировку по своему уровню, как при «Как у меня».",
["Your saved bots"] = "Сохраненные боты",
["Save group"] = "Сохранить группу",
["Puts every bot with you on your saved list."] = "Добавляет всех ваших текущих ботов в список сохраненных.",
@@ -199,7 +200,9 @@ ForeverBotsLocale = {
["raid ready: calling your saved bots..."] = "проверка готовности: призыв сохраненных ботов...",
["Show / hide the bot window"] = "Показать / скрыть окно ботов",
["Show / hide the bot window (works in combat)"] = "Показать / скрыть окно ботов (работает в бою)",
["Lazy lock (warlock: next spell on your target)"] = "Автокаст чернокнижника (следующее заклинание по вашей цели)",
["Lazy key (any class: next spell of your spec)"] = "Автокаст (любой класс: следующее заклинание вашей специализации)",
["Lazy key: heal (most hurt group member)"] = "Автокаст: лечение (самый раненый член группы)",
["Lazy key: tank (threat on your target)"] = "Автокаст: танк (угроза на вашей цели)",
["removed %d duplicate macro(s) (same name and text as another), so macro keys stay on the same macro."] = "удалено повторяющихся макросов: %d (то же имя и текст, что у другого), чтобы клавиши макросов не сбивались.",
["two macros are named %s but differ; a key bound to that name uses the first. Rename or delete one in /macro."] = "два макроса называются %s, но различаются; клавиша с этим именем запускает первый. Переименуйте или удалите один в /macro.",
["Call saved bots"] = "Призвать сохраненных",
@@ -596,4 +599,6 @@ ForeverBotsLocale = {
["Tank leads"] = "Танк ведет группу", -- check
["In a dungeon or a raid your tank bot leads: it walks on, pulls pack by pack, waits for mana and for you, and goes boss to boss. You follow. In a raid it stops before each boss: pull it yourself, or say go.\nClick: on or off. Right-click: pause (it holds where it stands) or go on.\nGreen: on. Blue: paused. It ends when you leave the dungeon or raid. Follow, Stay and Come pause it: say go (or right-click) and it leads on."] = "В подземелье или рейде группу ведет ваш бот-танк: идет вперед, пулит по одной группе мобов, ждет ману и вас и идет от босса к боссу. Вы следуете за ним. В рейде он останавливается перед каждым боссом: пульте его сами или скажите go.\nЩелчок: вкл. или выкл. Правый щелчок: пауза (стоит на месте) или дальше.\nЗеленый: вкл. Синий: пауза. Заканчивается, когда вы выходите из подземелья или рейда. «За мной», «Стоять» и «Ко мне» ставят ведение на паузу: скажите go (или правый щелчок), и танк ведет дальше.", -- check
["the tank does not lead now: click the button first."] = "танк сейчас не ведет: сначала нажмите кнопку.",
["Pick a spec"] = "Выбрать специализацию", -- check
["The bot plays this spec from now on (its role follows) and re-learns its talents for it. Kept across relog and Call."] = "Бот играет в этой специализации (роль меняется вместе с ней) и заново учит таланты для нее. Сохраняется после перезахода и вызова.", -- check
}
@@ -149,6 +149,8 @@ Timings (0.5.18): every handler the add-on gives the client is timed. A call ove
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 (Next stance since the stance button got three steps), Show / hide the bot window, and one key each for the stances Passive, Defensive and Aggressive and for Ignore my target and Clear ignored mobs. The order keys send the same line as the window buttons and work in combat.
Lazy lock key (0.2.4, warlocks): one key that does the right next thing on your target. Each press casts one spell at an enemy, never a pet summon: the curse (Curse of Tongues on mana users, Curse of Agony on the rest), Corruption, Immolate and Siphon Life kept up, Conflagrate, Shadow Bolt as the filler (the free instant bolt on a Shadow Trance proc), Life Tap when mana runs low, Death Coil / Drain Life when your health is low. An enemy hitting you in melee gets Death Coil, then Howl of Terror when two or more are on you, then Fear (not on bosses, and not on mobs in dungeons and raids). Both on-use trinkets and your racial go whenever ready on a long fight, in the same press as the next spell. The wand takes over when mana is dry. Press it with no enemy selected to put Demon Armor up and summon your pet. It also sends your pet at the target. Bind it under "Lazy lock" and tap or mash it; it runs the server command `.playerbot lazy`, which you can also type.
Lazy key for every class: the same key now plays every class, on the role of your spec. Damage: procs and executes first (Overpower, Execute, Hammer of Wrath, Riposte, Mongoose Bite), cooldowns on bosses and players (Arcane Power, Combustion, Rapid Fire, Adrenaline Rush, Elemental Mastery), dots kept up (Rend, Serpent Sting, Shadow Word: Pain, Flame Shock, Moonfire, Rake, Rip), combo points spent at five (Slice and Dice, Eviscerate, Ferocious Bite), then the filler (Sinister Strike, Frostbolt, Lightning Bolt, Wrath, Smite, Mind Flay; Heroic Strike / Maul with rage to spare), the wand when the mana is gone. Tank: Defensive Stance or Bear Form first, Taunt / Growl when your target hits someone else, then Shield Block, Revenge, Shield Slam, Thunder Clap on two or more, Demoralizing Shout / Roar and Sunder Armor / Maul; a paladin keeps Righteous Fury, Holy Shield and Consecration up. Heal: the most hurt group member in 40 yards (you included) gets the heal that fits: a shield, Holy Shock, Swiftmend or Nature's Swiftness when it is close to death, Prayer of Healing / Chain Heal when three are hurt, the HoT (Renew, Rejuvenation), then the main heal; a druid leaves its form to heal. With nobody hurt the key fights. Interrupts (Pummel / Shield Bash, Kick, Counterspell, Earth Shock, Silence, Bash) go on any cast. Out of combat with nothing selected it keeps your buffs up (Battle Shout, blessing and aura, aspect, Fortitude and Inner Fire, Lightning Shield and the weapon imbue, Arcane Intellect and armor, Mark of the Wild and Thorns). Melee classes start their swing and the pet joins the fight. Two more keys play a role whatever your spec: "Lazy key: heal" (`.playerbot lazy heal`) and "Lazy key: tank" (`.playerbot lazy tank`); `.playerbot lazy dps` is the damage rotation. The warlock keeps its own rotation above.
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.
## 0.5.1 window
+45
View File
@@ -89,4 +89,49 @@ inline bool SettleKeepsFollowRange(float dx, float dy, float dz, float follow_ra
return limit > 0.0f && dx * dx + dy * dy + dz * dz < limit * limit;
}
// A goal under the water: well under the swim z. The navmesh holds deep water as polygons on its surface only, so the polygon nearest
// such a goal is the surface right over it, not ground a stride off. The far-end snap put a rogue's melee spot by a murloc on the
// Vile Reef floor 57 y up on the surface (vile_reef_fight af60), and the rogue swam up and down at the surface for the whole fight.
inline bool IsUnderwaterGoal(float goal_z, float swim_z)
{
return goal_z < swim_z - kDiveMargin;
}
// One straight swim (no route through the water): across no more than a pool or a flooded hall, longer trips are the router's; down
// or up as deep as the water goes there. The 40 y cap on the whole leg kept a bot on the surface 57 y over the fight it was ordered to.
constexpr float kMaxSwimLegAcross = 40.0f;
constexpr float kMaxSwimLegLength = 90.0f;
inline bool SwimLegFits(float dxy, float len)
{
return len >= 1.0f && dxy <= kMaxSwimLegAcross && len <= kMaxSwimLegLength;
}
// A bot under the water by what it is down there for (its fight, or the player who leads its group, himself under the water) stays at
// that depth: the settle lifted a rogue that catch-up had set beside his leader on the reef floor straight back to the surface, 59 y
// up (vile_reef_fight af60). Its breath is BreathGoesUp's.
constexpr float kHoldDepthYards = 12.0f;
inline bool HoldsDepth(float bot_z, float swim_z, float anchor_dist, float anchor_z)
{
return bot_z < swim_z && anchor_dist <= kHoldDepthYards && IsUnderwaterGoal(anchor_z, swim_z);
}
// Breath, from the server's own timer (Player::HandleDrowning: it runs down while the head is under water, comes back ten times as fast
// above it, and stops, -1, once full or for a bot that cannot drown: water breathing, undead's longer breath counted in). A player under
// water keeps fighting or swimming and goes up when the bar runs short, then stays up until it is full before he dives again. The bot's
// own 35 s clock counted only the time out of combat: a mage fought on the Vile Reef, sat down to eat at 25 y deep once the fight ended,
// and drowned before the clock got to 35 s (vile_reef_fight af64). Up with 25 s left: from the reef 60 y down that is 13 s of swimming.
// `refilling` is the bot's latch across ticks: true from the moment it goes up until the timer stops.
constexpr int BreathUpAtLeftMs = 25000;
inline bool BreathGoesUp(int breath_left_ms, bool& refilling)
{
if (breath_left_ms < 0)
{
refilling = false;
return false;
}
if (breath_left_ms <= BreathUpAtLeftMs)
refilling = true;
return refilling;
}
} // namespace Playerbot::BotMovement::Swim
+203 -17
View File
@@ -13,6 +13,7 @@
#include "PlayerbotAPI.h"
#include "BotLanguage.h"
#include "Bot/QuestLoot.h"
#include "Bot/Quest/CompanionQuest.h"
#include "Bot/BotBridge.h"
#include "ClassicBotSkills.h"
#include "Travel/ReachMemory.h"
@@ -1836,7 +1837,11 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop,
float const sx = p_->GetPositionX(), sy = p_->GetPositionY(), sz = p_->GetPositionZ();
float const dxy = std::sqrt((x - sx) * (x - sx) + (y - sy) * (y - sy));
float const fall = sz - z;
if (dxy > 40.0f || fall < 4.0f || fall > 40.0f || p_->IsFlying() || p_->IsInFlight() || p_->GetVehicle() || p_->IsInWater())
// 220 y down, 45 y out: The Shaper's Terrace's landing ledge stands 54 y over the pool players jump into, 35-41 y out from
// where a bot on the ledge leaves it (live capture 25 Nov 2026); in Blackmaw Hold the way to Varrox is a 200 y fall from the
// Behemoth's hall into a pool, 35 y out (live capture 26 Nov 2026). At these sizes the jump below stays under MoveJump's
// 50 y/s, so it lands when flight_ms says.
if (dxy > 45.0f || fall < 4.0f || fall > 220.0f || p_->IsFlying() || p_->IsInFlight() || p_->GetVehicle() || p_->IsInWater())
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
@@ -1858,6 +1863,10 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop,
{
if (!dp->IsInWorld() || !dp->IsAlive())
return;
// A fall into water does no harm: the client ends it swimming and sends no fall landing (live, The Shaper's Terrace
// 25 Nov 2026: a 54 y jump into the pool, START_SWIM, no environmental damage).
if (dp->GetMap() && dp->GetMap()->IsInWater(dp->GetPhaseShift(), dx, dy, dz))
return;
dp->m_movementInfo.pos.Relocate(dx, dy, dz);
dp->HandleFall();
}, Milliseconds(flight_ms));
@@ -2645,7 +2654,11 @@ Result API::move_to(float x, float y, float z, bool run, bool direct, bool drop,
// one, so the goal was picked again and again (Burning Steppes, Simer: 53 path_fail Magma for one quest goal in 3 minutes).
// Left unsnapped, the goal ends as FarFromPolyEnd, which suppresses it for long and lets goal selection move on.
bool const end_in_hazard = BotMovement::ClassifyDestinationLiquid(p_, ae.x, ae.y, ae.z) == BotMovement::LiquidVerdict::Hazard;
if (off_end <= 12.0f && std::fabs(dz_end) < max_dz && !snaps_under && !end_in_hazard && !::Playerbot::V2::Fleet::PathHasCliff(path.GetPath())
// Nor is the water's surface over a goal under the water (BotMovement::Swim::IsUnderwaterGoal): it is swum to (TrySwimLeg below).
float goal_swim_z = 0.f;
bool const underwater_goal = BotMovement::SwimLevel(p_, x, y, z, goal_swim_z) && BotMovement::Swim::IsUnderwaterGoal(z, goal_swim_z);
if (off_end <= 12.0f && std::fabs(dz_end) < max_dz && !snaps_under && !end_in_hazard && !underwater_goal &&
!::Playerbot::V2::Fleet::PathHasCliff(path.GetPath())
&& !rise_onto_model(ae.x, ae.y, ae.z))
{
if (SehSafeCalculatePath(path, ae.x, ae.y, ae.z) && !(path.GetPathType() & (PATHFIND_NOPATH | PATHFIND_FARFROMPOLY_END)))
@@ -3636,13 +3649,13 @@ bool API::TrySwimLeg(float x, float y, float z, bool run)
if (BotMovement::g_LiquidPathPolicy && BotMovement::g_LiquidPathPolicy(p_) != BotMovement::LiquidPolicy::None)
return false;
// Longer than a pool or a flooded hall: that is a trip for the router, not one straight swim.
constexpr float kMaxLeg = 40.0f;
// Across more than a pool or a flooded hall: that is a trip for the router, not one straight swim. A dive goes as deep as the water
// (BotMovement::Swim::SwimLegFits).
constexpr float kSampleStep = 2.0f;
float const sx = p_->GetPositionX(), sy = p_->GetPositionY(), sz = p_->GetPositionZ();
float const dx = x - sx, dy = y - sy, dz = z - sz;
float const len = std::sqrt(dx * dx + dy * dy + dz * dz);
if (len < 1.0f || len > kMaxLeg)
if (!BotMovement::Swim::SwimLegFits(std::sqrt(dx * dx + dy * dy), len))
return false;
// In water at a point: water or ocean only (magma and slime are never swum), below the surface or on it. A bot that crossed the
@@ -4094,7 +4107,13 @@ Result API::start_attack(ObjectGuid target, uint8 avoid_school_mask)
// A hunter engaged from range stands at its shooting spot (chase to 28 y). When the mob then comes inside Auto Shot's dead zone the
// fight turns to melee, but this path never chased again: the hunter stood a few yards off, unable to shoot or swing (Isane, 2026-10-20).
// Close in once it stands still; a hunter already walking keeps its chase.
if (p_->GetClass() == CLASS_HUNTER && hunter_dead_zone && melee_swing && p_->movespline->Finalized() && !p_->IsWithinMeleeRange(tu))
// Not for a grouped hunter with shots whose mob someone else holds: that hunter steps back out of the dead zone (the classic hunter
// rotation's dead-zone step), and closing in here walked it back in front of the mob each time (alcaz_full af70c: Blazeroar's Flame
// Breath). A hunter with nothing to shoot still closes in.
bool const held_by_other = p_->GetGroup() && tu->GetVictim() && tu->GetVictim() != p_ &&
p_->GetWeaponForAttack(RANGED_ATTACK, true) != nullptr && (!p_->NeedsAmmo() || (p_->GetAmmoId() != 0 && p_->HasItemCount(p_->GetAmmoId())));
if (p_->GetClass() == CLASS_HUNTER && hunter_dead_zone && melee_swing && !held_by_other && p_->movespline->Finalized() &&
!p_->IsWithinMeleeRange(tu))
{ p_->GetMotionMaster()->MoveChase(tu); logHunterChase("dead_zone_close_in"); }
// The opening engage chases once; another layer's move (formation slot, follow) replaces that chase and this path never issued it
// again, so a hunter ordered at a mob beyond its shooting range stood in the aim pose for good (PC 20 Oct, whelp ~30+ y away).
@@ -4266,7 +4285,9 @@ Result API::stop_attack(bool clear_ghost_combat)
// Attack off ends Auto Shot as well (a player's attack toggle does); left running it keeps the hunter in the aim pose with no target.
if (p_->GetClass() == CLASS_HUNTER)
p_->InterruptSpell(CURRENT_AUTOREPEAT_SPELL, false);
if (!p_->IsInCombat())
// A station show's sheath hold keeps the tool out — an OOC stop_attack is no
// reason to stow it mid-visit (the hold itself drops the moment combat starts).
if (!p_->IsInCombat() && !p_->BotSheathHold())
p_->SetSheath(SHEATH_STATE_UNARMED);
// Mirror a real client deselecting on disengage — keeps the published
// UNIT_FIELD_TARGET truthful for other players' target-of-target frames.
@@ -4976,7 +4997,22 @@ Result API::face_target(ObjectGuid target, bool combat)
if (!p_) return Result::Other;
if (target.IsEmpty()) return Result::InvalidTarget;
Unit* u = ObjectAccessor::GetUnit(*p_, target);
if (!u) return Result::InvalidTarget;
if (!u)
{
// A station (anvil, cooking fire, loom): the bot at work faces the gameobject. SetFacingToObject
// takes any WorldObject; the same already-facing guard as the unit path skips a no-op turn.
if (combat) return Result::InvalidTarget;
GameObject* go = p_->GetMap() ? p_->GetMap()->GetGameObject(target) : nullptr;
if (!go) return Result::InvalidTarget;
if (!p_->isMoving())
{
ClearStaleMoveFlags(p_);
float const off = Position::NormalizeOrientation(p_->GetOrientation() - p_->GetAbsoluteAngle(go));
if (off > 0.1f && off < 2.0f * float(M_PI) - 0.1f)
p_->SetFacingToObject(go, /*force*/ true);
}
return Result::Ok;
}
if (combat)
{
// Combat re-face. The melee swing needs the victim within +-60 degrees
@@ -6077,6 +6113,27 @@ Result API::set_stand_state(uint8 state)
return Result::Ok;
}
Result API::set_sheath(uint8 sheath, int8_t hold)
{
if (!p_) return Result::Other;
SheathState const state = sheath > SHEATH_STATE_RANGED ? SHEATH_STATE_UNARMED : static_cast<SheathState>(sheath);
p_->SetSheath(state);
// Drawn bots get auto-resheathed after 3 idle seconds (Player::Update) — a show
// drawing weapons on purpose holds that off until it's resheathed or fights.
// hold < 0 keeps that default; a passing call (skill-up cast) draws without it
// so the resheath timer cleans the pose up itself when the casts stop.
p_->SetBotSheathHold(hold < 0 ? state != SHEATH_STATE_UNARMED : hold != 0);
TC_LOG_INFO("playerbot.v2", "[sheath] {} -> state={} now={}", p_->GetName(), uint32(sheath), uint32(p_->GetSheath()));
return Result::Ok;
}
Result API::play_sound(uint32 sound_kit)
{
if (!p_ || !sound_kit) return Result::Other;
p_->PlayDistanceSound(sound_kit);
return Result::Ok;
}
Result API::dismiss_pet()
{
if (!p_) return Result::Other;
@@ -6779,11 +6836,40 @@ Result API::sell_trash(ObjectGuid npc)
constexpr uint32 kTightBagThreshold = 3;
bool const bags_tight = CountFreeBagSlots(p_) <= kTightBagThreshold;
// Craft surplus: products of recipes the bot knows that aren't also an
// input to a known recipe — the smith hawks his sharpening stones, the
// cook her baked eggs. Bars / bolts / powders that feed a known recipe
// stay as working stock. Conjured outputs (healthstones, mage water)
// vendor for nothing — skip them; gear stays under IsBagRot's rules, and
// uncommon-or-better products are worth more than the vendor pays.
std::unordered_set<uint32> craft_in;
std::unordered_set<uint32> craft_out;
for (auto const& [sid, ps] : p_->GetSpellMap())
{
if (ps.state == PLAYERSPELL_REMOVED || !ps.active || ps.disabled) continue;
SpellInfo const* si = sSpellMgr->GetSpellInfo(sid, DIFFICULTY_NONE);
if (!si) continue;
for (SpellEffectInfo const& eff : si->GetEffects())
if (eff.Effect == SPELL_EFFECT_CREATE_ITEM && eff.ItemType)
craft_out.insert(uint32(eff.ItemType));
for (size_t r = 0; r < si->Reagent.size(); ++r)
if (si->Reagent[r] > 0)
craft_in.insert(uint32(si->Reagent[r]));
}
for (uint32 const e : craft_in) craft_out.erase(e);
std::vector<Item*> to_sell;
p_->ForEachItem(ItemSearchLocation::Inventory, [this, &to_sell, bags_tight](Item* it)
p_->ForEachItem(ItemSearchLocation::Inventory, [this, &to_sell, bags_tight, &craft_out](Item* it)
{
ItemTemplate const* tmpl = it ? it->GetTemplate() : nullptr;
if (IsBagRot(p_, it, tmpl, bags_tight)) to_sell.push_back(it);
uint32 const cls = tmpl ? tmpl->GetClass() : 0;
if (tmpl && !it->IsNotEmptyBag() && !tmpl->HasFlag(ITEM_FLAG_CONJURED)
&& tmpl->GetQuality() < ITEM_QUALITY_UNCOMMON
&& cls != ITEM_CLASS_WEAPON && cls != ITEM_CLASS_ARMOR
&& craft_out.count(it->GetEntry()))
to_sell.push_back(it);
else if (IsBagRot(p_, it, tmpl, bags_tight))
to_sell.push_back(it);
return ItemSearchCallbackResult::Continue;
});
@@ -7114,17 +7200,29 @@ Result API::loot_corpse(ObjectGuid corpse, bool quest_items_only)
if (quest_items_only)
{
ObjectGuid const owner = loot->GetOwnerGUID();
uint32 taken = 0;
uint32 taken = 0, left = 0;
for (uint8 slot = 0; slot < loot->items.size(); ++slot)
{
if (!IsPendingQuestLoot(p_, loot, slot)) continue;
if (!IsPendingQuestLoot(p_, loot, slot))
{
// One for the whole group that a player of the group still needs: left for him (QuestLootIsAPlayers).
LootItem const& li = loot->items[slot];
if (li.needs_quest && !li.is_looted && li.HasAllowedLooter(p_->GetGUID()) && QuestLootIsAPlayers(p_, loot, li))
{
++left;
TC_LOG_INFO("playerbot.v2", "[loot_quest] {} corpse={} leaves item {} for the player (one for the group, he needs it)",
p_->GetName(), corpse.GetCounter(), li.itemid);
}
continue;
}
LootItem const& qi = loot->items[slot];
ItemPosCountVec dest;
if (p_->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, qi.itemid, qi.count) != EQUIP_ERR_OK) continue;
p_->StoreLootItem(owner, slot, loot);
++taken;
}
TC_LOG_INFO("playerbot.v2", "[loot_quest] {} corpse={} took {} quest item(s)", p_->GetName(), corpse.GetCounter(), taken);
TC_LOG_INFO("playerbot.v2", "[loot_quest] {} corpse={} took {} quest item(s), left {} for the player", p_->GetName(), corpse.GetCounter(),
taken, left);
if (WorldSession* sess = p_->GetSession())
sess->DoLootRelease(loot);
return Result::Ok;
@@ -7390,6 +7488,26 @@ void TakeGameObjectLoot(Player* p, GameObject* obj, ObjectGuid go_guid)
p->SendLootRelease(go_guid);
}
// A door whose lock has a Lockpicking case (Pick Lock opens it) and no case a plain click opens.
bool DoorTakesLockpicking(GameObjectTemplate const* info)
{
LockEntry const* lock = info ? sLockStore.LookupEntry(info->GetLockId()) : nullptr;
if (!lock)
return false;
bool pick = false;
for (uint8 i = 0; i < MAX_LOCK_CASE; ++i)
{
if (lock->Type[i] != LOCK_KEY_SKILL)
continue;
SkillType const skill = SkillByLockType(LockType(lock->Index[i]));
if (skill == SKILL_LOCKPICKING)
pick = true;
else if (skill == SKILL_NONE)
return false; // a hand door (Open, Quick Open): clicked, not picked
}
return pick;
}
// The bot's spell that opens a lock of this kind (Herbalism 2366 for LOCKTYPE_HERBALISM, Mining 2575 for LOCKTYPE_MINING): the
// spell a player's right-click on an herb or vein casts. Of several ranks the one with the largest bonus to the lock skill
// (Spell::CanOpenLock adds the effect's value to the skill), 0 when the bot knows none.
@@ -7687,6 +7805,10 @@ Result API::use_game_object(ObjectGuid go_guid)
// found none (Discord 2026-11-09). A bot never opens one of these by a plain click.
if (obj->GetGoType() == GAMEOBJECT_TYPE_CHEST && Playerbot::ChestNeedsSkill(obj->GetGOInfo()))
return gather_node(obj);
// A shut door whose lock takes Lockpicking (Alcaz Prison's Maximum Security Door 649547): a rogue casts Pick Lock on it, as on a
// locked box. A plain click on such a door does nothing for a player (the client asks for the key).
if (obj->GetGoType() == GAMEOBJECT_TYPE_DOOR && obj->GetGoState() == GO_STATE_READY && DoorTakesLockpicking(obj->GetGOInfo()))
return gather_node(obj);
// Mounted-restriction check from HandleGameObjectUseOpcode: most GOs
// refuse interaction while mounted unless flagged UsableMounted.
if (p_->IsMounted() && !obj->GetGOInfo()->IsUsableMounted())
@@ -7841,7 +7963,9 @@ Result API::gather_node(GameObject* obj)
if (lock->Type[i] != LOCK_KEY_SKILL)
continue;
SkillType const skill = SkillByLockType(LockType(lock->Index[i]));
if (skill != SKILL_HERBALISM && skill != SKILL_MINING)
// A door takes only Pick Lock (use_game_object sends no other door here); a chest, Herb Gathering or Mining.
bool const door = obj->GetGoType() == GAMEOBJECT_TYPE_DOOR;
if (door ? skill != SKILL_LOCKPICKING : (skill != SKILL_HERBALISM && skill != SKILL_MINING))
continue;
if (p_->GetSkillValue(skill) == 0 || p_->GetSkillValue(skill) < lock->Skill[i])
continue;
@@ -7859,6 +7983,25 @@ Result API::gather_node(GameObject* obj)
ClearStaleMoveFlags(p_);
if (!p_->HasInArc(static_cast<float>(M_PI), obj))
p_->SetFacingToObject(obj, true);
// The tool the spell asks for in the bags (SpellInfo Totem): Pick Lock (1804) wants Thieves' Tools (5060), which a rogue buys
// from a trade vendor for 15 silver. A bot does not shop. Without it every cast fails SPELL_FAILED_TOTEMS (153): alcaz_full in the
// alcaz-1127-r3 run (27 Nov) cast Pick Lock on the Maximum Security Door all run long, 153 each time, and the grant at levelling
// (BotSetupPipeline LearnLevelKit) never showed on the scenario rogue. So the bot takes it here, where the spell is cast.
if (SpellInfo const* info = sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE))
{
for (int32 const tool : info->Totem)
{
if (tool <= 0 || p_->HasItemCount(uint32(tool), 1, true))
continue;
ItemPosCountVec dest;
InventoryResult const ir = p_->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, uint32(tool), 1);
if (ir == EQUIP_ERR_OK && p_->StoreNewItem(dest, uint32(tool), true))
TC_LOG_INFO("playerbot.v2", "[gather] {} takes tool item {} for spell {}", p_->GetName(), tool, spell);
else
TC_LOG_INFO("playerbot.v2", "[gather] {} cannot take tool item {} for spell {}: bag result {}", p_->GetName(), tool,
spell, uint32(ir));
}
}
SpellCastResult const r = p_->CastSpell(obj, spell, false);
TC_LOG_INFO("playerbot.v2", "[gather] {} cast {} on entry={} skill {} {}/{} result={}", p_->GetName(), spell, obj->GetEntry(),
uint32(skill), uint32(p_->GetSkillValue(skill)), uint32(lock->Skill[i]), uint32(r));
@@ -7932,9 +8075,28 @@ Result API::accept_quest(ObjectGuid quest_giver, uint32 quest_id)
TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
}
if (!object) { log_reject("giver_not_found", QuestRefusal::NoGiver); return Result::InvalidTarget; }
if (quest_giver.IsPlayer()) { log_reject("player_giver_unsupp", QuestRefusal::Other); return Result::Other; }
if (!object->hasQuest(quest_id)) { log_reject("giver_lost_relation", QuestRefusal::NoGiver); return Result::InvalidTarget; }
if (!p_->CanInteractWithQuestGiver(object)) { log_reject("out_of_range", QuestRefusal::OutOfRange); return Result::OutOfRange; }
if (quest_giver.IsPlayer())
{
// A group mate passes on a quest that an item started (a dropped crest, a note): no creature or object hands it out and the
// one item went to him, so the bot takes it from him like a shared quest (the owner's "accept", row 240). Nothing else
// comes from a player here.
Player* mate = object->ToPlayer();
if (!mate || mate == p_ || !p_->IsInSameGroupWith(mate))
{ log_reject("player_giver_not_group", QuestRefusal::NoGiver); return Result::InvalidTarget; }
QuestStatus const ms = mate->GetQuestStatus(quest_id);
if ((ms != QUEST_STATUS_INCOMPLETE && ms != QUEST_STATUS_COMPLETE) || !CompanionQuest::QuestStartedByItemOnly(quest_id))
{ log_reject("player_giver_unsupp", QuestRefusal::Other); return Result::Other; }
if (!p_->IsWithinDistInMap(mate, INTERACTION_DISTANCE))
{ log_reject("out_of_range", QuestRefusal::OutOfRange); return Result::OutOfRange; }
// The mate stays the giver, as for a quest he shares (WorldSession::HandleQuestgiverAcceptQuestOpcode passes the sharer):
// AddQuest reads a timed quest's time left from him, and AddQuestAndCheckCompletion runs no giver script for a player.
// Every later use of `object` is null-safe as well; it is never an item here, so no quest item is taken from anyone.
}
else
{
if (!object->hasQuest(quest_id)) { log_reject("giver_lost_relation", QuestRefusal::NoGiver); return Result::InvalidTarget; }
if (!p_->CanInteractWithQuestGiver(object)) { log_reject("out_of_range", QuestRefusal::OutOfRange); return Result::OutOfRange; }
}
// Junk-quest accept-gate (R2, defense-in-depth). A quest with ZERO
// objectives AND no creature/GO turn-in NPC is structurally unfinishable
// and unturnable — accepting it parks the bot forever (current_quest_id=0
@@ -8525,6 +8687,26 @@ Result API::equip_item(uint8 from_bag, uint8 from_slot, uint8 to_slot)
return Result::Ok;
}
Result API::give_item(uint32 entry, uint16 count)
{
if (!p_) return Result::Other;
if (!entry || !count) return Result::InvalidTarget;
if (!sObjectMgr->GetItemTemplate(entry)) return Result::InvalidTarget;
ItemPosCountVec dest;
if (p_->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, entry, count) != EQUIP_ERR_OK)
return Result::ServerRefused;
return p_->StoreNewItem(dest, entry, true) ? Result::Ok : Result::ServerRefused;
}
Result API::learn_spell(uint32 spell_id)
{
if (!p_) return Result::Other;
if (!spell_id || !sSpellMgr->GetSpellInfo(spell_id, DIFFICULTY_NONE)) return Result::InvalidTarget;
if (p_->HasSpell(spell_id)) return Result::Ok;
p_->LearnSpell(spell_id, /*dependent=*/false);
return p_->HasSpell(spell_id) ? Result::Ok : Result::ServerRefused;
}
Result API::accept_shared_quest()
{
last_quest_refusal_ = QuestRefusal::None;
@@ -11434,6 +11616,10 @@ static uint32 LearnHigherRanksOfKnownSpells(Player* p)
{
if (!entry || entry->Spell >= 100000 || !seen.insert(entry->Spell).second || p->HasSpell(entry->Spell))
continue;
// A spell no player can learn (all its skill line abilities NeverLearned, e.g. the 1-point Holy Light copy 19981) is no rank
// to teach a bot
if (SpellFamily::IsNeverLearned(entry->Spell))
continue;
SpellInfo const* si = sSpellMgr->GetSpellInfo(entry->Spell, DIFFICULTY_NONE);
if (!si || si->IsPassive() || si->SpellLevel == 0 || si->SpellLevel > p->GetLevel() || si->SpellFamilyName != classEntry->SpellClassSet)
continue;
+15 -1
View File
@@ -558,7 +558,8 @@ public:
// SMSG_EMOTE packet visible to nearby players. `target` is optional and
// changes the emote's directional cue (wave at someone, etc.).
Result perform_emote(uint32 emote_id, ObjectGuid target = ObjectGuid::Empty);
// Face the bot toward `target` (Unit::SetFacingToObject). Used for RP /
// Face the bot toward `target` (Unit::SetFacingToObject; also resolves a gameobject — a bot at a
// craft station faces the anvil). Used for RP /
// screenshots / pet-pose alignment. Returns InvalidTarget when the named
// object isn't visible from the bot's map.
// combat = true: re-face a fight victim (see PlayerbotAPI.cpp): turns only a standing,
@@ -689,6 +690,10 @@ public:
// raw byte mirrors UnitStandStateType. ServerRefused mid-cast since
// sitting cancels the cast; otherwise idempotent.
Result set_stand_state(uint8 state);
// Draw or stow the visible weapons (SheathState: 0=UNARMED, 1=MELEE,
// 2=RANGED). The station show draws the tool; combat paths manage it themselves.
Result set_sheath(uint8 sheath, int8_t hold = -1);
Result play_sound(uint32 sound_kit);
// Inventory
// `target` may be a unit or one of the bot's own items (a poison or
@@ -741,6 +746,15 @@ public:
// destination can't be unequipped (cursed gear / quest item).
Result equip_item(uint8 from_bag, uint8 from_slot, uint8 to_slot);
// Put `count` of an item entry into the bot's bags (the same CanStoreNewItem +
// StoreNewItem the setup pipeline uses — a profession tool granted at its
// station). InvalidTarget = unknown entry; ServerRefused = bags full.
Result give_item(uint32 entry, uint16 count);
// Teach the bot a spell it doesn't yet know — the starter recipe a craft-
// station visit grants, backfilling bots set up before DoLearnProfessions.
Result learn_spell(uint32 spell_id);
// ---- Group loot --------------------------------------------------
// Cast the bot's vote on a master/group loot roll. `loot_object` is
// the loot source guid (creature corpse / GO chest), `loot_list_id`
@@ -10,6 +10,7 @@
#include "MMapManager.h"
#include "MMapDefines.h"
#include "FollowMovementGenerator.h"
#include "Group.h"
#include "MotionMaster.h"
#include "MoveSplineInit.h"
#include "Object.h"
@@ -176,6 +177,223 @@ int SehSafeNearestPolyProbe(void const* query, float const* detourPt,
return NearestPolyProbeGuarded(query, detourPt, extents, filter, nearestOut);
}
// ---- MeshIslandExit ----------------------------------------------------------
namespace {
bool RefIn(dtPolyRef const* refs, int n, dtPolyRef r) noexcept
{
for (int i = 0; i < n; ++i)
if (refs[i] == r)
return true;
return false;
}
// The polygons linked to `start` (links of any kind, off-mesh connections too), breadth first, at most `cap` of them in `seen`.
// A region that reaches `cap` is no scrap; the search stops there. Plain data only: it runs inside the SEH frame of
// IslandExitGuarded.
int FloodRegion(dtNavMesh const* nav, dtQueryFilter const* filter, dtPolyRef start, dtPolyRef* seen, int cap) noexcept
{
int n = 0, head = 0;
seen[n++] = start;
while (head < n)
{
dtPolyRef const ref = seen[head++];
dtMeshTile const* tile = nullptr;
dtPoly const* poly = nullptr;
if (dtStatusFailed(nav->getTileAndPolyByRef(ref, &tile, &poly)))
continue;
for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next)
{
dtPolyRef const nref = tile->links[i].ref;
if (!nref || RefIn(seen, n, nref))
continue;
dtMeshTile const* ntile = nullptr;
dtPoly const* npoly = nullptr;
if (dtStatusFailed(nav->getTileAndPolyByRef(nref, &ntile, &npoly)) || !filter->passFilter(nref, ntile, npoly))
continue;
if (n >= cap)
return n;
seen[n++] = nref;
}
}
return n;
}
// 1: the bot at `pos` (Detour order) stands on a scrap of mesh, and `exitOut` holds a point 1 y inside the nearest polygon of a
// region of at least kMeshIslandPolys polygons (at most maxYd away on the level, 6 y up or down). 2: on a scrap, no such region
// in reach. 0: not on a scrap.
int IslandExitSearch(void const* queryV, void const* floodV, void const* standV, float const* pos, float maxYd, float* exitOut,
int* islandPolys) noexcept
{
auto const* q = static_cast<dtNavMeshQuery const*>(queryV);
auto const* flood = static_cast<dtQueryFilter const*>(floodV);
auto const* stand = static_cast<dtQueryFilter const*>(standV);
dtNavMesh const* nav = q->getAttachedNavMesh();
if (!nav)
return 0;
float const ext[3] = { 1.5f, 3.0f, 1.5f };
float snapped[3];
dtPolyRef start = 0;
if (dtStatusFailed(q->findNearestPoly(pos, ext, flood, &start, snapped)) || !start)
return 0;
dtPolyRef island[kMeshIslandPolys];
int const n = FloodRegion(nav, flood, start, island, kMeshIslandPolys);
if (n >= kMeshIslandPolys)
return 0;
*islandPolys = n;
constexpr float kClimbYd = 6.0f;
constexpr int kNear = 128;
float const box[3] = { maxYd, kClimbYd, maxYd };
dtPolyRef nearRefs[kNear];
int nc = 0;
if (dtStatusFailed(q->queryPolygons(pos, box, stand, nearRefs, &nc, kNear)))
return 2;
constexpr int kRejectCap = kMeshIslandPolys * 4;
dtPolyRef rejected[kRejectCap]; // other scraps met on the way
int nr = 0;
for (int tries = 0; tries < 8; ++tries) // a slope can hold several scraps between him and the floor
{
int best = -1;
float bestD2 = maxYd * maxYd;
float bp[3] = { 0.f, 0.f, 0.f };
for (int i = 0; i < nc; ++i)
{
if (RefIn(island, n, nearRefs[i]) || RefIn(rejected, nr, nearRefs[i]))
continue;
float cp[3];
if (dtStatusFailed(q->closestPointOnPoly(nearRefs[i], pos, cp, nullptr)))
continue;
if (std::fabs(cp[1] - pos[1]) > kClimbYd)
continue;
float const d2 = (cp[0] - pos[0]) * (cp[0] - pos[0]) + (cp[2] - pos[2]) * (cp[2] - pos[2]);
if (d2 < bestD2)
{
bestD2 = d2;
best = i;
dtVcopy(bp, cp);
}
}
if (best < 0)
return 2;
dtPolyRef region[kMeshIslandPolys];
int const rn = FloodRegion(nav, flood, nearRefs[best], region, kMeshIslandPolys);
if (rn >= kMeshIslandPolys)
{
// That region's polygon is under his feet as well (two layers of mesh within a yard): he stands on the floor, and the
// scrap is only the polygon Detour picked first. rol_full af63 (23 Nov): "walks 0.0 y off it" at (1525.9,167.3,64.2).
if (bestD2 < 0.5f * 0.5f && std::fabs(bp[1] - pos[1]) < 1.5f)
return 0;
// 1 y past the edge into that polygon, so the bot ends standing on it and not on the seam it shares with the scrap.
float const d = std::sqrt(bestD2);
float in[3] = { bp[0], bp[1], bp[2] };
if (d > 0.01f)
{
in[0] += (bp[0] - pos[0]) / d;
in[2] += (bp[2] - pos[2]) / d;
}
if (dtStatusFailed(q->closestPointOnPoly(nearRefs[best], in, exitOut, nullptr)))
dtVcopy(exitOut, bp);
return 1;
}
for (int j = 0; j < rn && nr < kRejectCap; ++j)
rejected[nr++] = region[j];
}
return 2;
}
#ifdef _MSC_VER
int IslandExitGuarded(void const* query, void const* flood, void const* stand, float const* pos, float maxYd, float* exitOut,
int* islandPolys) noexcept
{
__try
{
return IslandExitSearch(query, flood, stand, pos, maxYd, exitOut, islandPolys);
}
__except (GetExceptionCode() == EXCEPTION_ASSERTION_FAILURE
? EXCEPTION_CONTINUE_SEARCH : EXCEPTION_EXECUTE_HANDLER)
{
return -1;
}
}
#else
int IslandExitGuarded(void const* query, void const* flood, void const* stand, float const* pos, float maxYd, float* exitOut,
int* islandPolys) noexcept
{
return IslandExitSearch(query, flood, stand, pos, maxYd, exitOut, islandPolys);
}
#endif
} // namespace
bool MeshIslandExit(Player* p, float maxYd, Position& out, int* islandPolys)
{
if (!p || !p->IsInWorld() || !p->IsAlive() || p->GetTransport() || p->GetVehicle() || p->IsFlying() || p->IsInWater())
return false;
Map* m = p->GetMap();
if (!m)
return false;
float const x = p->GetPositionX(), y = p->GetPositionY(), z = p->GetPositionZ();
if (!EnsureGridForQuery(m, x, y))
return false;
uint32 const terrainMapId = PhasingHandler::GetTerrainMapId(p->GetPhaseShift(), p->GetMapId(), m->GetTerrain(), x, y);
dtNavMeshQuery const* query = MMAP::MMapManager::instance()->GetNavMeshQuery(terrainMapId, p->GetMapId(), p->GetInstanceId());
if (!query)
return false;
// Linked is linked, whatever the ground: a patch of floor beside a pool is no scrap. The step itself ends on dry footing.
dtQueryFilter flood;
flood.setIncludeFlags(0xFFFF);
flood.setExcludeFlags(0);
dtQueryFilter stand;
stand.setIncludeFlags(NAV_GROUND | NAV_GROUND_STEEP | NAV_ROAD);
stand.setExcludeFlags(0);
float const pos[3] = { y, z, x };
float exitPt[3] = { 0.f, 0.f, 0.f };
int polys = 0;
int found = 0;
{
ReadLockIfOwnQueries const lock;
found = IslandExitGuarded(query, &flood, &stand, pos, maxYd, exitPt, &polys);
}
if (found <= 0)
return false;
float const ex = found == 1 ? exitPt[2] : x, ey = found == 1 ? exitPt[0] : y, ez = found == 1 ? exitPt[1] : z;
// Why a scrap was found and no step taken, once per bot per 10 s: the step is the data to look at.
auto refused = [&](char const* why)
{
static std::mutex s_mu;
static std::unordered_map<uint64, uint32> s_at;
uint32 const now = GameTime::GetGameTimeMS();
std::lock_guard<std::mutex> lk(s_mu);
uint32& at = s_at[p->GetGUID().GetCounter()];
if (at != 0 && now - at < 10000u)
return false;
at = now ? now : 1u;
TC_LOG_INFO("playerbot.v2", "[mesh_scrap] {} on a scrap of navmesh ({} polygons) at ({:.1f},{:.1f},{:.1f}) map {}: no step to ({:.1f},{:.1f},{:.1f}): {}",
p->GetName(), polys, x, y, z, p->GetMapId(), ex, ey, ez, why);
return false;
};
if (found != 1)
return refused("no larger region within reach");
// He walks it: nothing in the way, and ground under every yard of it with no step over 2.5 y (no ledge, no hole).
if (!LineIsClear(p, x, y, z + 1.5f, ex, ey, ez + 1.5f))
return refused("the line is blocked");
int const steps = std::max(1, int(std::ceil(std::hypot(ex - x, ey - y))));
float prev = z;
for (int i = 1; i <= steps; ++i)
{
float const t = float(i) / float(steps);
float g = 0.f;
if (!ProbeGround(p, x + (ex - x) * t, y + (ey - y) * t, z + (ez - z) * t, g))
return refused("no ground under the step");
if (std::fabs(g - prev) > 2.5f)
return refused("a ledge in the step");
prev = g;
}
out.Relocate(ex, ey, ez);
if (islandPolys)
*islandPolys = polys;
return true;
}
// ---- SnapToGround -----------------------------------------------------------
bool SnapToGround(Player* p, float x, float y, float& z)
@@ -190,8 +408,10 @@ bool SnapToGround(Player* p, float x, float y, float& z)
// Pre-load the destination grid. UpdateAllowedPositionZ samples vmap
// through the local grid; if the grid hasn't streamed in yet the
// sampler returns INVALID_HEIGHT and we'd silently keep the bad Z.
// LoadGrid is a no-op when the grid is already resident.
m->LoadGrid(x, y);
// LoadGrid is a no-op when the grid is already resident. From a bot logic thread or a same-map split build the load goes to
// the world thread (EnsureGridForQuery): loading a grid there adds creatures and tiles while the map threads read them.
if (!EnsureGridForQuery(m, x, y))
return false;
float const original = z;
@@ -319,7 +539,8 @@ float GroundZ(Player* p, float x, float y, float zHint, char const* where, bool*
constexpr float kGroundProbeUp = 3.0f;
constexpr float kGroundProbeDown = 40.0f;
m->LoadGrid(x, y);
if (!EnsureGridForQuery(m, x, y)) // the world thread loads it (see SnapToGround)
return zHint;
float g = INVALID_HEIGHT;
try
{
@@ -362,7 +583,8 @@ bool ProbeGround(Player* p, float x, float y, float zHint, float& out)
return false;
constexpr float kProbeUp = 3.0f;
constexpr float kProbeDown = 40.0f;
m->LoadGrid(x, y);
if (!EnsureGridForQuery(m, x, y)) // the world thread loads it (see SnapToGround)
return false;
float g = INVALID_HEIGHT;
try
{
@@ -906,6 +1128,20 @@ void UpdateSwimState(Player* p)
// is out of it, paths again to a navmesh point by the leader, which in water is the surface: a settle that took the follower out
// of range was undone at the leader's next step and the two took turns (lake_swim 2026-11-09: a follower 2 y behind a leader on
// the surface, settled down and lifted back up 14 times in 25 s). Left where it is, it still swims (the flag above).
// Under the swim z by its fight or by its group's leader, both down there too: it stays down (Swim::HoldsDepth).
if (z < swimZ)
{
auto holds = [&](Unit const* anchor)
{
return anchor && anchor->IsInMap(p) && anchor->IsAlive() &&
Swim::HoldsDepth(z, swimZ, p->GetExactDist(anchor), anchor->GetPositionZ());
};
Player const* leader = nullptr;
if (Group const* grp = p->GetGroup(); grp && grp->GetLeaderGUID() != p->GetGUID())
leader = ObjectAccessor::GetPlayer(*p, grp->GetLeaderGUID());
if (holds(p->GetVictim()) || holds(leader))
return;
}
if (gen == FOLLOW_MOTION_TYPE)
{
auto const* follow = static_cast<FollowMovementGenerator const*>(p->GetMotionMaster()->GetCurrentMovementGenerator());
@@ -109,6 +109,16 @@ bool ProbeGround(Player* p, float x, float y, float zHint, float& out);
bool NearestNavPoint(Player* p, float tx, float ty, float tz,
float hxy, float hz, Position& out);
// A bot standing on a scrap of navmesh that no path leaves: a few polygons of a rocky slope that Recast kept apart from the floor
// around them (fewer than kMeshIslandPolys polygons reached by links of any kind). A player walks on and off such a scrap, the
// bot got there on foot in a fight, but every path from it ends on its own edge. blackmaw_full af61 (22 Nov): the tank stood
// 120 s on 6 polygons of the slope at (3589.1,3348.0,274.2); the floor the group stood on was 5.9 y away and 4.5 y up, with four
// more scraps of 2 to 19 polygons in between. Finds the nearest point of a region of at least kMeshIslandPolys polygons, at most
// maxYd away on the level and 6 y up or down, with a clear line and ground under every yard of the step. Writes it to `out` and returns true; false when the bot is
// not on such a scrap or no walkable step off it exists. World thread (or a bot logic thread with its own navmesh queries).
constexpr int kMeshIslandPolys = 64;
bool MeshIslandExit(Player* p, float maxYd, Position& out, int* islandPolys = nullptr);
// Snapshot builds that run beside other builds of the SAME map must not load grids: a grid load adds creatures and navmesh
// tiles while the other threads are reading them. While a ScopedDeferGridLoads is alive on a thread, EnsureGridForQuery
// hands a grid that is not loaded yet to the world thread (LoadDeferredGrids, after the build barrier) and returns false, so
+7
View File
@@ -105,6 +105,11 @@ out of date AddOns"). The addon only sends ordinary chat, so it needs nothing el
circle|arrow|line|none`, `/fb spacing tight|close|spread`, `/fb distance <1-20>`, `/fb maintank [name]`, `/fb tank
<name> <marker>|clear`, `/fb assign <name> <marker> [role]`, `/fb assign list`.
- Confirmation whispers from bots are hidden from your chat frame by the addon (they feed the status line).
- **Lazy key** (Key Bindings > AddOns > "WoW Forever Bots"): one key that plays your own character, one spell per press, in
combat too: `.playerbot lazy` for every class on the role of your spec, "Lazy key: heal" (`.playerbot lazy heal`) and
"Lazy key: tank" (`.playerbot lazy tank`) for that role whatever the spec. The server picks the spell from what you know, what
is ready, your resources and what is on the target; heals go to the most hurt group member in 40 yards. The warlock keeps its
own rotation. The add-on's README lists what each role does.
There is also an older `PlayerbotControl` addon (roster, stats, alts); this guide covers `ForeverBots`.
@@ -162,6 +167,7 @@ from the bot.
| `gear` / `inventory` | yes | yes | `Raveni: 15 pieces worn, avg item level 66, best: Ironfoe, ...; 14 free bag slots; 12g 40s 5c`. `inv` lists bag items; `equipped` lists each worn slot. |
| `money`, `level`, `xp`, `dur`, `skills`, `recipes`, `rep`, `spec` | yes | no | One-line introspection verbs. |
| `change talents <link>` (also `set talents`, `talents <link>`) | yes | no | Learns your own build. Make it in the Wowhead Forever talent calculator (https://www.wowhead.com/forever/talent-calc), copy the page link (or just the code part, such as `--05003201`) and whisper it. The bot drops its talents, learns yours and plays the spec of ours closest to it (a deep Protection build tanks). Below 60 it fills the tree with most points first, row by row, and puts each new level's point down your build: `Talents: learning your build 0/31/20: 21 points now, the rest as I level.` A link for another class, a code from another calculator or a build the game would not allow is refused with the reason. Kept across relog for your companions. `talents link` answers with the bot's talents as a calculator link; `talents default` (or a `setspec`) gives it our builds back. |
| `setspec <spec>` | yes | no | Plays that spec of its class from now on and re-learns its talents for it: `setspec elemental`, `setspec enh`, `setspec resto`, `setspec fire`, `setspec prot`, or `tank`, `heal`, `dps`. Its role follows the spec. Kept across relog for your companions. The ForeverBots add-on has the same as the Spec list in the bot's right-click menu and the spec buttons on the Spec page. |
| `sell grey` / `sell junk` / `sell your junk` / `s *` | yes | yes | Sells everything a vendor visit sells (greys, trade goods for no profession of the bot's, gear it can't use, outgrown greens when the bags are tight) to the vendor you have selected, else the nearest friendly vendor within 200 yards. In reach: `Raveni: selling 7 thing(s) to Dolanaar Vendor`. Farther away it walks over and sells when it arrives (`at Dolanaar Vendor, selling 7 thing(s)`; after a minute without getting there it says so). Nothing to sell: `nothing to sell, my bags only hold things I keep (0 free slots)`. No vendor: `no vendor near here`. Plain `sell` (selected vendor) and `sell <bag> <slot> [n]` also exist. |
| `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`. |
@@ -438,6 +444,7 @@ The module logs nothing unless `Logger.playerbot.v2=3` is set. Grep the server l
| `[quest]` | A quest order the parser handed to `QuestOrders` (`[owner_order] [quest] ...`). |
| `[InstanceCap]` | Group larger than the map holds. |
| `[say_reply]` | A world bot's answer to a player's /say. |
| `[lazykey]` | Every press of the lazy key (not the warlock's, that is `[lazy]`): the spell, the rule that chose it, the server's answer, role, tree and resources. |
| `[world]` | Spawner status line every 60 s. |
| `[death-recovery]`, `[raid_pull]`, `[raid_tank]`, `[solo_flee]`, `[bg_queue]`, `[cast_speed]`, `[GroupRelogin]` | Corpse runs, raid pulls and tanking, fleeing, battleground queues, cast pacing, bots re-joining after your login. |
+85 -20
View File
@@ -24,6 +24,7 @@
#include "BotPersonality.h"
#include "BotArchetype.h"
#include "BotRng.h"
#include "Api/BotSwim.h" // Swim::BreathGoesUp (needs_air)
#include "ObjectGuid.h"
#include <algorithm>
#include <array>
@@ -79,6 +80,12 @@ public:
char const* last_rule_fired() const { return last_rule_fired_; }
void set_last_rule_fired(char const* name);
// Skill-up station prop: a craft_skillup cast at a focus puts the trade tool in the hand and
// keeps the upgrade rule off the mainhand while the cast run is live. Timestamped — a run that
// just stops (moves off, quest, fight) expires on its own, no cleanup emit needed.
bool station_prop_out(uint32 now_ms) const { return int32(station_prop_until_ms_ - now_ms) > 0; }
void station_prop_extend(uint32 now_ms, uint32 span_ms = 12000) { station_prop_until_ms_ = now_ms + span_ms; }
// BG outcome dedup — the post-match leave rule fires multiple times
// (bg_status=4 persists ~2min until TC kicks); we only want to record
// the win/loss tally ONCE per match. Keyed by the snapshot published_at
@@ -530,6 +537,12 @@ public:
bool saw_special_phase() const { return saw_special_phase_; }
void set_saw_special_phase(bool v) { saw_special_phase_ = v; }
// A finder run's goodbye (State_Idle, idle:finder_goodbye_*): once the dungeon is done with a player in the group, each bot
// in turn says goodbye, hearths and leaves the group. `map` and `instance` name the run it was planned for, `at_ms` when the
// next step is due, `stage` 0 = waiting its turn, 1 = said goodbye, 2 = gone.
struct FinderGoodbye { uint32 map = 0; uint32 instance = 0; uint32 at_ms = 0; uint8 stage = 0; };
FinderGoodbye& finder_goodbye() { return finder_goodbye_; }
// Owner-set follow distance preference. The /follow whisper picks this
// up so owners can customize how tightly the bot tails. 0.f means
// "use default" (5yd). Owners with melee-heavy comp prefer 4-5yd, with
@@ -1527,8 +1540,19 @@ public:
// reset on clear_dungeon_cross (landing / relocate).
bool dungeon_cross_direct() const { return dungeon_cross_direct_; }
void set_dungeon_cross_direct(bool d) { dungeon_cross_direct_ = d; }
// A DIRECT crossing down a one-way link whose far end lies far below its mouth (a jump off a ledge into the pool below, as
// The Shaper's Terrace's landing): DungeonHonorCross drives it as a fall (API::move_to drop, a jump spline under gravity)
// instead of a straight walk through the air. Set ONLY by the nav-link hop; reset on clear_dungeon_cross.
bool dungeon_cross_drop() const { return dungeon_cross_drop_; }
void set_dungeon_cross_drop(bool d) { dungeon_cross_drop_ = d; }
// How long (3D, yards) the nav link the bot is crossing is, mouth to far end; 0 when the crossing is not a nav-link hop. Set ONLY
// by the nav-link hop; reset on clear_dungeon_cross. DungeonHonorCross gives up an exit further off than a hop is long, and a
// link can be longer than the usual give-up distance (The Shaper's Terrace's ledge: 66 y down to the pool).
float dungeon_cross_link_len() const { return dungeon_cross_link_len_; }
void set_dungeon_cross_link_len(float l) { dungeon_cross_link_len_ = l; }
void clear_dungeon_cross() { dungeon_cross_until_ms_ = 0; cross_episode_since_ms_ = 0;
dungeon_cross_direct_ = false; cross_fight_yield_ = false; }
dungeon_cross_direct_ = false; dungeon_cross_drop_ = false; dungeon_cross_link_len_ = 0.f;
cross_fight_yield_ = false; }
// A crossing that stalled while mobs hit the bot gives way to the fight until combat ends (DungeonHonorCross); the
// commitment itself is kept, so the hop resumes (or its out-of-combat recovery fires) after the fight.
bool cross_fight_yield() const { return cross_fight_yield_; }
@@ -1733,7 +1757,12 @@ public:
// into a pit at (-13610.7,2775.3,-37.0); the tank ran down and back up the slope beside it every 7 s for 29 minutes
// (1,700 s, z -29 to -37) and the group stood idle below. This tracks the bot's best distance to the step it strides
// at; no headway for kStrideStallMs means the step is a dead end.
static constexpr float kStrideSameStepY = 5.0f; // two steps this close are the same step (the start point moves)
// The step is measured against the first step of the watch (the anchor), not the last one: the dead end's step moves with the
// bot. scan66 drowned_full (af66): the stride toward Captain Dreadrise picked (-13607.6,2777.9), (-13604.6,2780.6) and
// (-13601.6,2783.2) by turns as the tank ran up and down the slope, the outer two 8 y apart, so each pick restarted the watch at
// 5 y; the tank ran that slope for 53 minutes and the run timed out. A step that really moves on (the bot gets somewhere) leaves
// this radius within a couple of seconds of walking and starts a fresh watch.
static constexpr float kStrideSameStepY = 12.0f; // a step this close to the anchor is the same step
static constexpr float kStrideHeadwayY = 1.5f; // the best distance must shrink by this much to count
static constexpr uint32 kStrideStallMs = 8000;
static constexpr uint32 kStrideGapMs = 2000; // not striding for this long starts the watch afresh
@@ -1741,7 +1770,6 @@ public:
uint32 stride_note(uint32 map_id, float sx, float sy, float sz, float bx, float by, float bz, uint32 now_ms)
{
float const ddx = sx - stride_x_, ddy = sy - stride_y_, ddz = sz - stride_z_;
float const d = std::sqrt((bx - sx) * (bx - sx) + (by - sy) * (by - sy) + (bz - sz) * (bz - sz));
bool const same = stride_map_ == map_id && stride_seen_ms_ && now_ms - stride_seen_ms_ < kStrideGapMs &&
ddx * ddx + ddy * ddy + ddz * ddz <= kStrideSameStepY * kStrideSameStepY;
stride_seen_ms_ = now_ms ? now_ms : 1u;
@@ -1749,6 +1777,12 @@ public:
{
stride_map_ = map_id;
stride_x_ = sx; stride_y_ = sy; stride_z_ = sz;
}
// Headway is toward the anchor.
float const d = std::sqrt((bx - stride_x_) * (bx - stride_x_) + (by - stride_y_) * (by - stride_y_) +
(bz - stride_z_) * (bz - stride_z_));
if (!same)
{
stride_best_ = d;
stride_best_ms_ = stride_seen_ms_;
return 0;
@@ -1762,6 +1796,38 @@ public:
}
float stride_best() const { return stride_best_; }
// The same watch one level up: the bot's best distance to the BOSS over all its strides toward it. A dead end the bot runs into
// and back out of takes turns with a step out of it, and the two are far enough apart that each one restarts the step watch
// above, so it never trips. drowned_full af68 (24 Nov, with the 12 y anchor): the stride toward Captain Dreadrise picked
// (-13607.6,2777.9,-36.9) into the pit and the tank came back up to (-13588,2784,-27) between picks, 15 y apart, for 56
// minutes; the run timed out at 2 of 6. A stride that gets nowhere near its boss for kStrideBossStallMs is a dead end too.
// Strides toward a boss through a winding cave that do get somewhere close the distance well inside that time; where they do
// not, the route the dungeon was given takes over, which is the authored way there anyway.
static constexpr float kStrideBossHeadwayY = 5.0f; // the best distance to the boss must shrink by this much to count
static constexpr uint32 kStrideBossStallMs = 60000;
static constexpr uint32 kStrideBossGapMs = 30000; // no stride toward this boss for this long starts the watch afresh
// Returns how long the bot has strode toward this boss without getting kStrideBossHeadwayY closer to it. Only time spent
// striding counts (ticks less than kStrideGapMs apart), so a tank held between strides (the group's mana, a pull) does not run
// the clock down.
uint32 stride_boss_note(uint32 map_id, uint32 boss_entry, float bx, float by, float bz, float tx, float ty, float tz, uint32 now_ms)
{
float const d = std::sqrt((tx - bx) * (tx - bx) + (ty - by) * (ty - by) + (tz - bz) * (tz - bz));
bool const same = stride_boss_map_ == map_id && stride_boss_entry_ == boss_entry && stride_boss_seen_ms_ &&
now_ms - stride_boss_seen_ms_ < kStrideBossGapMs;
if (same && now_ms - stride_boss_seen_ms_ < kStrideGapMs)
stride_boss_stall_ms_ += now_ms - stride_boss_seen_ms_;
stride_boss_seen_ms_ = now_ms ? now_ms : 1u;
if (!same || stride_boss_best_ - d > kStrideBossHeadwayY)
{
stride_boss_map_ = map_id;
stride_boss_entry_ = boss_entry;
stride_boss_best_ = d;
stride_boss_stall_ms_ = 0;
}
return stride_boss_stall_ms_;
}
float stride_boss_best() const { return stride_boss_best_; }
// ---- refused-destination memory (refusal-aware target selection,
// 2026-07-20) ----
// BUG THIS FIXES: PlayerbotAPI::move_to keeps a PER-DESTINATION path-fail
@@ -3467,6 +3533,7 @@ private:
// Bumped by every set_last_rule_fired(): lets a tick tell "a rule fired
// this tick" from a last_rule_fired_ left over from an earlier tick.
uint32 rule_fire_seq_ = 0;
uint32 station_prop_until_ms_ = 0;
public:
uint32 rule_fire_seq() const { return rule_fire_seq_; }
// [attack_rule]: the target of an [attack_start] line logged during this tick's dispatch, and the rule count then. The line names
@@ -3608,8 +3675,7 @@ private:
bool corpse_recovery_emitted_ = false;
uint32 ghost_since_ms_ = 0;
uint32 swimming_since_ms_ = 0;
uint32 underwater_since_ms_ = 0;
uint32 underwater_seen_ms_ = 0;
bool breath_refill_ = false;
ObjectGuid stuck_chase_victim_;
uint16 stuck_chase_ticks_ = 0;
ObjectGuid last_taxi_discover_fm_;
@@ -3725,6 +3791,7 @@ private:
uint32 pending_mail_open_at_ms_ = 0;
uint32 chat_pause_until_ms_ = 0;
bool saw_special_phase_ = false;
FinderGoodbye finder_goodbye_{};
ObjectGuid last_seen_group_;
bool group_greet_primed_ = false;
float follow_distance_ = 0.f;
@@ -4194,6 +4261,11 @@ private:
float stride_best_ = 0.f;
uint32 stride_best_ms_ = 0;
uint32 stride_seen_ms_ = 0;
uint32 stride_boss_map_ = 0; // boss-stride headway toward the boss (stride_boss_note)
uint32 stride_boss_entry_ = 0;
float stride_boss_best_ = 0.f;
uint32 stride_boss_stall_ms_ = 0; // striding time since the best distance last improved
uint32 stride_boss_seen_ms_ = 0;
uint32 move_commit_progress_ms_ = 0;
// Refused-destination ring (see move_refused_recently() above).
struct RefusedDst { float x = 0.f, y = 0.f, z = 0.f; uint32 ms = 0; };
@@ -4204,6 +4276,8 @@ private:
float dungeon_cross_z_ = 0.f;
uint32 dungeon_cross_until_ms_ = 0;
bool dungeon_cross_direct_ = false; // DB nav-link crossing (see accessor)
bool dungeon_cross_drop_ = false; // ... down a one-way link with a long fall (see accessor)
float dungeon_cross_link_len_ = 0.f; // ... and how long that link is (see accessor)
// Cross EPISODE wall-clock — survives set_dungeon_cross re-commits; reset only
// when the crossing is genuinely cleared (landed / relocated). See cross_episode_ms.
uint32 cross_episode_since_ms_ = 0;
@@ -5373,20 +5447,10 @@ public:
return swimming_since_ms_ != 0
&& (now_ms - swimming_since_ms_) > kSwimStuckTimeoutMs;
}
// How long the bot's head has been under water (idle:surface_to_breathe), on the snapshot clock (published_at_ms) as
// update_swim_state is. A sighting more than 5 s after the last one starts a new dive. Returns the time under so far, 0 when not.
uint32 note_underwater(bool under, uint32 now_ms)
{
if (!under)
{
underwater_since_ms_ = 0;
return 0;
}
if (underwater_since_ms_ == 0 || now_ms - underwater_seen_ms_ > 5000u)
underwater_since_ms_ = now_ms ? now_ms : 1u;
underwater_seen_ms_ = now_ms;
return now_ms - underwater_since_ms_;
}
// Up for air (Swim::BreathGoesUp, on the server's breath timer): true from the moment the breath runs short until it is full again.
// Every state asks it (idle:surface_to_breathe, the dungeon preempt, the fight), so time under water counts however it was spent.
bool breath_refilling() const { return breath_refill_; }
bool needs_air(int32 breath_left_ms) { return BotMovement::Swim::BreathGoesUp(breath_left_ms, breath_refill_); }
// Per-target start_attack lockout. When idle:quest_batch:kill (or any
// rule that emits StartAttackIntent) picks a target the server keeps
@@ -5430,7 +5494,8 @@ public:
}
RaidSchoolState& raid_school() { return raid_school_; }
RaidSchoolState const& raid_school() const { return raid_school_; }
// The dungeon pack stop's per-pack walk verdicts (PackPullGate.h). Bot worker only: the tank's own idle tick.
// The dungeon pack stop's per-pack walk verdicts (PackPullGate.h). Bot worker only: the tank's own idle tick, and a crowd-control
// caster's (idle:dungeon_auto_cc_script), which measures the tank's walk to an idle mob before it sheeps it.
PackPullGate& pack_pull_gate() { return pack_pull_gate_; }
PackPullGate const& pack_pull_gate() const { return pack_pull_gate_; }
void prune_start_attack_cache(uint32 now_ms)
+13 -2
View File
@@ -137,7 +137,8 @@ uint32 g_last_bad_warn_ms = 0;
struct ChatAsk { BotId bot = 0; std::string sender; ObjectGuid sender_guid; bool sender_is_bot = false; std::string channel; uint32 asked_ms = 0;
uint64 talk_key = 0; // a bot-to-bot talk line (AskTalk), kept for TakeTalk
std::vector<BotId> group; // a group order (AskGroupOrder): the other bots that take the answer's action too
uint32 deadline_ms = 0; }; // a raid line (AskRaidLine): an answer at or after this time is dropped (the fixed line was said)
uint32 deadline_ms = 0; // a raid line (AskRaidLine): an answer at or after this time is dropped (the fixed line was said)
std::vector<std::string> speakers; }; // AskTalk: the speakers of the talk so far (StripSpeakerLabel)
// Raid lines the program answered in time (AskRaidLine / RaidLineAnswered), by event id.
std::unordered_set<uint64> g_raid_answered;
// The group's part of a group order: each other bot runs the answer's action a moment after the first (HandleGroupFollowups).
@@ -1819,6 +1820,14 @@ void HandleReplies(ConfigReader::BridgeConfig const& cfg, uint32 now_ms)
if (channel == "whisper" && to.empty())
to = ask.sender;
g_chat.erase(it);
// The program labelled the line with a name, as the talk it was shown is written: the game names the speaker already.
if (!text.empty())
{
std::vector<std::string> names = ask.speakers;
names.push_back(bot_name);
names.push_back(ask.sender);
text = StripSpeakerLabel(text, names);
}
if (auto pi = g_post_ask.find(r.reply_to); pi != g_post_ask.end())
{
PostAsk const post = std::move(pi->second);
@@ -2575,7 +2584,9 @@ bool BotBridge::AskTalk(Player* bot, std::string const& scene, std::string const
Write(e);
if (g_chat.size() > 2048)
g_chat.clear();
g_chat[e.id] = ChatAsk{ bot->GetGUID().GetCounter(), std::string(), ObjectGuid::Empty, false, "say", now_ms, key ? key : kNoTalkKey };
ChatAsk ask{ bot->GetGUID().GetCounter(), std::string(), ObjectGuid::Empty, false, "say", now_ms, key ? key : kNoTalkKey };
ask.speakers = TalkSpeakers(chat);
g_chat[e.id] = std::move(ask);
g_talk_minute.push_back(now_ms);
return true;
}
@@ -664,6 +664,66 @@ std::string CleanSayText(std::string const& raw, std::size_t max_bytes)
namespace {
std::string TrimSpaces(std::string_view s)
{
std::size_t b = 0, e = s.size();
while (b < e && (s[b] == ' ' || s[b] == '\t')) ++b;
while (e > b && (s[e - 1] == ' ' || s[e - 1] == '\t')) --e;
return std::string(s.substr(b, e - b));
}
std::string LowerAscii(std::string s)
{
for (char& c : s)
c = char(std::tolower(static_cast<unsigned char>(c)));
return s;
}
} // namespace
std::string StripSpeakerLabel(std::string const& line, std::vector<std::string> const& names)
{
std::size_t const colon = line.find(':');
if (colon == std::string::npos || colon > 26)
return line;
std::string head = TrimSpaces(std::string_view(line).substr(0, colon));
if (head.size() >= 2 && ((head.front() == '<' && head.back() == '>') || (head.front() == '[' && head.back() == ']')))
head = TrimSpaces(std::string_view(head).substr(1, head.size() - 2));
if (head.empty())
return line;
head = LowerAscii(std::move(head));
for (std::string const& n : names)
if (!n.empty() && LowerAscii(n) == head)
{
std::string rest = TrimSpaces(std::string_view(line).substr(colon + 1));
return rest.empty() ? line : rest;
}
return line;
}
std::vector<std::string> TalkSpeakers(std::string const& talk)
{
std::vector<std::string> out;
std::size_t start = 0;
while (start < talk.size())
{
std::size_t const nl = talk.find('\n', start);
std::string_view const l = std::string_view(talk).substr(start, nl == std::string::npos ? std::string::npos : nl - start);
if (std::size_t const c = l.find(": "); c != std::string_view::npos && c > 0 && c <= 24)
{
std::string name(l.substr(0, c));
if (std::find(out.begin(), out.end(), name) == out.end())
out.push_back(std::move(name));
}
if (nl == std::string::npos)
break;
start = nl + 1;
}
return out;
}
namespace {
struct ActWord { Act act; char const* word; };
constexpr ActWord kActs[] = {
{ Act::Follow, "follow" }, { Act::Stay, "stay" }, { Act::Resume, "resume" }, { Act::Attack, "attack" },
@@ -187,6 +187,15 @@ private:
// cut to `max_bytes` on a word boundary without splitting a UTF-8 character. Empty when nothing is left.
std::string CleanSayText(std::string const& raw, std::size_t max_bytes);
// A chat line that opens with a speaker's name as a label ("Name: text", "Name : text", "[Name ]: text", "<Name>: text"), the way
// a model copies the talk it was shown: the label goes when the name is one of `names` (the bot, the one it answers, the others in
// its talk; any case). In game the line already carries the speaker's name, so the label read as a second, odd name ("[Botname ]:"
// in an English talk on a Russian realm, celguar 11-21). The line is returned unchanged when nothing would be left after it.
std::string StripSpeakerLabel(std::string const& line, std::vector<std::string> const& names);
// The names that open the lines of a talk written as "Name: text" lines (BotChatModel::AskSay / BotBridge::AskTalk's `chat`).
std::vector<std::string> TalkSpeakers(std::string const& talk);
// ---- actions: the rules that need no game state ----
// What the game side found out about the bot and the one asking. Filled by BotBridge.cpp, read by CheckActionContext.
+7 -1
View File
@@ -1,6 +1,7 @@
// BotChatModel - see header.
#include "BotChatModel.h"
#include "Bot/BotBridgeFormat.h"
#include "BotBridge.h"
#include "BotChatModelClient.h"
#include "BotConversation.h"
@@ -38,6 +39,7 @@ struct Job
BotId bot = 0;
std::string bot_name;
std::string sender_name;
std::vector<std::string> talk_names; // AskSay: the speakers of the talk so far
BotChatModel::Channel channel = BotChatModel::Channel::Whisper;
uint64 history_key = 0;
std::string question;
@@ -169,7 +171,10 @@ void WorkerLoop()
}
if (job.bot == 0)
continue;
std::string answer = ChatModel::CleanReply(raw, job.bot_name);
std::vector<std::string> names = job.talk_names;
if (!job.sender_name.empty())
names.push_back(job.sender_name);
std::string answer = ChatModel::CleanReply(raw, job.bot_name, 250, names);
if (answer.empty())
{
TC_LOG_INFO("playerbot.v2", "[conv] {} <- {}: chat model reply unusable: \"{}\"", job.bot_name, job.sender_name, raw);
@@ -345,6 +350,7 @@ bool BotChatModel::AskSay(Player* bot, std::string const& system, std::string co
job.bot = id;
job.bot_name = bot->GetName();
job.channel = Channel::Say;
job.talk_names = Bridge::TalkSpeakers(chat);
job.history_key = key;
job.settings = SettingsFrom(cfg);
job.asked = now;
@@ -1,6 +1,7 @@
// BotChatModelClient - see header.
#include "BotChatModelClient.h"
#include "BotBridgeFormat.h"
#include <boost/asio/ip/tcp.hpp>
#include <boost/beast/core/flat_buffer.hpp>
@@ -163,7 +164,7 @@ std::string FilterChars(std::string const& in)
} // namespace
std::string CleanReply(std::string const& raw, std::string const& bot_name, std::size_t max_bytes)
std::string CleanReply(std::string const& raw, std::string const& bot_name, std::size_t max_bytes, std::vector<std::string> const& other_names)
{
std::string s = raw;
@@ -199,15 +200,13 @@ std::string CleanReply(std::string const& raw, std::string const& bot_name, std:
}
s = Trim(s);
// "Name: text", "<Name>: text", "[Name]: text" - the model speaking as the bot by name (the add-on also hides a whisper
// that starts "<Name>:" as an order confirmation).
if (std::size_t const colon = s.find(':'); colon != std::string::npos && colon <= 26)
// "Name: text", "<Name>: text", "[Name ]: text" - the model labelling the line with the bot's name, or with the name of the one
// it answers or of another bot in its talk, as the talk it was shown is written (the add-on also hides a whisper that starts
// "<Name>:" as an order confirmation).
{
std::string head = Lower(Trim(s.substr(0, colon)));
if (head.size() >= 2 && ((head.front() == '<' && head.back() == '>') || (head.front() == '[' && head.back() == ']')))
head = Trim(head.substr(1, head.size() - 2));
if (!bot_name.empty() && head == Lower(bot_name))
s = Trim(s.substr(colon + 1));
std::vector<std::string> names = other_names;
names.push_back(bot_name);
s = Bridge::StripSpeakerLabel(s, names);
}
// Wrapping quotes.
@@ -44,7 +44,9 @@ bool ParseReply(std::string const& body, std::string& out, std::string& error);
// Turns a raw model reply into one chat line a bot can say: drops a <think> block, keeps the first non-empty line, strips a
// leading "Name:" (also "<Name>:" / "[Name]:") and wrapping quotes or asterisks, removes '|' (the client's escape character) and characters the game
// font has no glyph for (emoji), and cuts it to `max_bytes` on a word boundary. Empty when nothing usable is left.
std::string CleanReply(std::string const& raw, std::string const& bot_name, std::size_t max_bytes = 250);
// `other_names`: the one the bot answers and the others in its talk; a line labelled with one of their names loses the label too.
std::string CleanReply(std::string const& raw, std::string const& bot_name, std::size_t max_bytes = 250,
std::vector<std::string> const& other_names = {});
class Client
{
+16 -9
View File
@@ -2052,16 +2052,23 @@ void BotChatReactor::ReactGuildJoin(uint64 guild_id, ObjectGuid joiner_guid,
// Compose a welcome line. Address the joiner by first name where possible.
std::string first = joiner_name;
if (auto sp = first.find(' '); sp != std::string::npos) first.resize(sp);
static constexpr char const* kTemplates[] = {
"welcome {}!", "welcome to the guild {} :)", "hey {}, welcome!",
"welcome aboard {}!", "{} welcome! :)", "glad to have you {}!",
};
constexpr size_t kN = sizeof(kTemplates) / sizeof(*kTemplates);
std::string line = kTemplates[seed % kN];
if (auto pos = line.find("{}"); pos != std::string::npos)
// Migration 0067: the text table's guild_join_welcome key first (%s = the joiner);
// the builtin templates otherwise, picked by the same stable seed.
std::string line = BotTextMgr::instance().Get("guild_join_welcome",
{ { "%s", first.empty() ? std::string("friend") : first } });
if (line.empty())
{
if (!first.empty()) line.replace(pos, 2, first);
else line.replace(pos, 2, "friend");
static constexpr char const* kTemplates[] = {
"welcome {}!", "welcome to the guild {} :)", "hey {}, welcome!",
"welcome aboard {}!", "{} welcome! :)", "glad to have you {}!",
};
constexpr size_t kN = sizeof(kTemplates) / sizeof(*kTemplates);
line = kTemplates[seed % kN];
if (auto pos = line.find("{}"); pos != std::string::npos)
{
if (!first.empty()) line.replace(pos, 2, first);
else line.replace(pos, 2, "friend");
}
}
// Stamp throttle only now that we will emit.
@@ -123,6 +123,20 @@ void ApplyClassicRoleSpec(Player const* p, ::Playerbot::Role role)
// An owner's `/setrole` on a companion is its declared role: stored with it (Role::Unknown clears) so a relog or
// `.bot call` pins the same role again instead of re-inferring one from its talents.
// The owner's standing orders on a companion ("loot all", "gather on") are stored with it, so a relog, `.bot call` or restart keeps them
// (Alex Black Cat, RU general 11-21: an alt's gather and loot all were gone after every relog). Bots nobody owns are not written.
void PersistOwnerOrders(Player const* p, ::Playerbot::BotAI const* ai)
{
if (!p || !ai)
return;
::Playerbot::BotId const id = p->GetGUID().GetCounter();
if (::Playerbot::Services::Owners().GetOwner(id).account_id == 0)
return;
using OR = ::Playerbot::OwnerRegistry;
uint8 const orders = (ai->loot_all() ? OR::kOwnerOrderLootAll : 0) | (ai->gather_ordered() ? OR::kOwnerOrderGather : 0);
::Playerbot::Services::Owners().SaveOwnerOrders(id, orders);
}
void PersistDeclaredRole(Player const* p, ::Playerbot::Role role)
{
::Playerbot::BotId const id = p->GetGUID().GetCounter();
@@ -1476,6 +1490,7 @@ bool OwnerWordOrder(Player* sender, Player* bot, std::string const& n)
return true;
bool const all = n != "loot";
ai->set_loot_all(all);
PersistOwnerOrders(bot, ai);
TC_LOG_INFO("playerbot.v2", "[owner_order] {} <- {}: loot {}", me, sender->GetName(), all ? "all" : "need-greed");
if (MayAnswerGroupQuestion(bot))
say(all ? me + ": looting everything, greys included, and rolling for myself"
@@ -2588,7 +2603,7 @@ bool BotCommandParser::ApplyLeadOrder(Player* sender, std::string const& line, c
reply = fmt::format("{} leads the raid now: it pulls pack by pack, waits for mana and for you, and stops before each boss for you to pull "
"(or say 'go'). Say 'lead pause' to hold, 'lead off' to lead yourself.", name);
else if (in_dungeon)
reply = fmt::format("{} leads the dungeon now: it pulls pack by pack and waits for mana and for you. Say 'lead pause' to hold, 'lead off' to lead yourself.", name);
reply = fmt::format("{} leads the dungeon now: it pulls pack by pack and waits for you, and before a boss for a healer low on mana. Say 'lead pause' to hold, 'lead off' to lead yourself.", name);
else
reply = fmt::format("{} leads once you are inside a dungeon or a raid. Say 'lead off' to lead yourself.", name);
break;
@@ -6003,6 +6018,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
ai->set_aoe_preference(false);
ai->set_aoe_denied(false);
ai->set_gather_ordered(false);
PersistOwnerOrders(bot, ai);
Push(bot, WhisperIntent{sender->GetName(),
"Clearprefs: focus, role, follow_distance, verbose, aoe, gather reset."});
return true;
@@ -6022,6 +6038,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
ai->set_aoe_preference(false);
ai->set_aoe_denied(false);
ai->set_gather_ordered(false);
PersistOwnerOrders(p, ai);
});
Push(bot, WhisperIntent{sender->GetName(),
fmt::format("Clearprefs_all: reset on {} bot(s).", changed)});
@@ -6118,7 +6135,7 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
// gather on — picks the herbs and ore veins near it as it follows you, with the gathering skills it has (GatheringRules.cpp),
// and skins what the group kills once you have looted it (LootDrainRules.cpp)
// gather off — leaves them alone again (the default)
// gather — toggle. gather_all sets every bot of the group. Memory only; clearprefs turns it off.
// gather — toggle. gather_all sets every bot of the group. Stored with a companion (PersistOwnerOrders); clearprefs turns it off.
bool const all = cmd != "gather";
BotAI* self_ai = Services::Registry().ai(bot->GetGUID().GetCounter());
if (!self_ai)
@@ -6135,13 +6152,17 @@ bool BotCommandParser::DispatchSingleImpl(Player* sender, Player* bot, std::stri
const uint32 changed = ForEachGroupBot(bot, [&](Player const* p)
{
if (BotAI* ai = Services::Registry().ai(p->GetGUID().GetCounter()))
{
ai->set_gather_ordered(desired);
PersistOwnerOrders(p, ai);
}
});
Push(bot, WhisperIntent{sender->GetName(),
desired ? fmt::format("Gather: ON for {} bot(s).", changed) : fmt::format("Gather: OFF for {} bot(s).", changed)});
return true;
}
self_ai->set_gather_ordered(desired);
PersistOwnerOrders(bot, self_ai);
std::string what;
for (auto const& [skill, word] : { std::pair{ SKILL_HERBALISM, "herbs" }, std::pair{ SKILL_MINING, "ore" }, std::pair{ SKILL_SKINNING, "skins" } })
if (bot->HasSkill(skill))
+11 -5
View File
@@ -76,6 +76,10 @@ struct NearTeleportToIntent { float x, y, z, o; bool navmesh_point = false; };
// owner-useful ones via whisper (sit/stand) but the intent carries the raw
// byte so future rules (auto-sit on inn furniture etc.) can use the rest.
struct SetStandStateIntent { uint8 stand_state; };
// CMSG_SET_SHEATHED mirror: sheath matches SheathState — 0=UNARMED (hands away),
// 1=MELEE, 2=RANGED. The station show draws the tool so the smith visibly holds it.
struct SetSheathIntent { uint8 sheath; int8_t hold = -1; };
struct PlaySoundIntent { uint32 sound_kit; }; // distance sound to everyone in earshot (station-work audio)
// ---- Movement ----
// direct=true executes a straight MovePoint spline WITHOUT pathfinding ("just
@@ -112,6 +116,8 @@ struct FollowIntent { ObjectGuid leader; float distance; float angle_ra
struct UseItemIntent { uint8 bag, slot; ObjectGuid target; };
struct UseItemByEntryIntent { uint32 item_entry; ObjectGuid target; };
struct EquipItemIntent { uint8 from_bag, from_slot; uint8 to_slot; };
struct GiveItemIntent { uint32 item_entry; uint16 count; }; // conjure-to-bags (profession tool at its station)
struct LearnSpellIntent { uint32 spell_id; }; // teach a spell (starter recipe at a craft station)
struct LootIntent { ObjectGuid corpse_or_object; bool quest_only = false; }; // quest_only: take only this bot's quest drops
struct ReleaseCorpseIntent {};
struct ReviveAtCorpseIntent {};
@@ -648,10 +654,10 @@ struct HousingIntent
using IntentBody = std::variant<
CastSpellIntent, GroundTargetSpellIntent, CancelCastIntent,
StartAttackIntent, StopAttackIntent, PetAttackIntent, PetCastSpellIntent,
DismissPetIntent, SetStandStateIntent, UnstuckIntent, CancelAuraIntent,
DismissPetIntent, SetStandStateIntent, SetSheathIntent, PlaySoundIntent, UnstuckIntent, CancelAuraIntent,
MoveToIntent, TeleportToIntent, StopMovementIntent, JumpIntent,
MountIntent, DismountIntent, HearthIntent, FollowIntent,
UseItemIntent, UseItemByEntryIntent, EquipItemIntent, LootIntent,
UseItemIntent, UseItemByEntryIntent, EquipItemIntent, GiveItemIntent, LearnSpellIntent, LootIntent,
ReleaseCorpseIntent, ReviveAtCorpseIntent,
ReclaimCorpseIntent, SpiritResurrectIntent, AcceptRezIntent,
QuestAcceptIntent, QuestCompleteIntent, QuestAbandonIntent,
@@ -720,17 +726,17 @@ inline size_t IntentKind(Intent const& i) { return i.body.index(); }
// wedge read as "Dismount | ServerRefused" — diagnosed as the wrong bug on
// 2026-06-10). The static_asserts force this list to be updated whenever an
// alternative is added to / removed from IntentBody.
static_assert(std::variant_size_v<IntentBody> == 101,
static_assert(std::variant_size_v<IntentBody> == 105,
"IntentBody changed — update IntentKindName() below to match.");
inline char const* IntentKindName(size_t kind)
{
static constexpr char const* kNames[] = {
"CastSpell", "GroundTargetSpell", "CancelCast",
"StartAttack", "StopAttack", "PetAttack", "PetCastSpell",
"DismissPet", "SetStandState", "Unstuck", "CancelAura",
"DismissPet", "SetStandState", "SetSheath", "PlaySound", "Unstuck", "CancelAura",
"MoveTo", "TeleportTo", "StopMovement", "Jump",
"Mount", "Dismount", "Hearth", "Follow",
"UseItem", "UseItemByEntry", "EquipItem", "Loot",
"UseItem", "UseItemByEntry", "EquipItem", "GiveItem", "LearnSpell", "Loot",
"ReleaseCorpse", "ReviveAtCorpse",
"ReclaimCorpse", "SpiritResurrect", "AcceptRez",
"QuestAccept", "QuestComplete", "QuestAbandon",
@@ -6,6 +6,7 @@
#include "AoeDeny.h"
#include "BotSnapshot.h"
#include "BotSnapshotView.h"
#include "PullDelay.h"
#include "Log.h"
#include "SharedDefines.h"
#include "SpellInfo.h"
@@ -467,6 +468,10 @@ bool BotIntentEmitter::start_attack(ObjectGuid target)
if (ai_->start_attack_recently_refused(target.GetCounter(), now_ms))
return false;
}
// The damage dealers' wait after their tank's pull (Bot/PullDelay.h): every engage path starts its attack here, so the wait
// holds whichever rule picked the mob (af76 dev run: the rogue opened 0.1 s after the tank by a path that never asked the hold).
if (ai_ && school_snap_ && PartyPullDelayHolds(*ai_, BotSnapshotView{ *school_snap_ }, target))
return false;
// An enemy the raid brain forbids this bot is attacked by no rule: the raid layer's own steps honour the list, and so must the
// rotations and the combat state's own target picks, or the bot swings at it between two raid passes and the next pass drops it
// again. naxx_horsemen af43: resting spare tanks had Mograine forbidden and still opened on him ("attack_start ... last_rule
@@ -574,6 +579,19 @@ bool BotIntentEmitter::move_already_emitted(float x, float y, float z) const
bool BotIntentEmitter::move_to(float x, float y, float z, bool run, bool direct, bool drop, bool follow_drop)
{
// A move to the far end of a committed nav-link crossing (DungeonNavLinkHop: a DB traversal link across a real navmesh split)
// IS that crossing, whichever rule emits it, so it goes as the straight no-pathfind spline. The hop hands its far end back to
// its caller as the next step, and the callers emit it as a plain move_to: State_InGroup's rejoin of the tank did, and the
// pathed move toward the far side of the split came back Incomplete 0.9 y on, the bot stopped, and DungeonHonorCross's direct
// re-assert of the same point 3 y away was then swallowed by the dedup below. WC wc_full af67 (24 Nov): the tank crossed
// Serpentis' cliff link 1, the four behind it hopped at (-292,-2,-57.7) and stood 8 y short of (-289.1,3.2,-64.0), walked
// back, the tank was relocated back to them and the group stalled under the ledge.
if (ai_ && !direct && !drop && ai_->dungeon_cross_direct() && ai_->dungeon_cross_active(GameTime::GetGameTimeMS()))
{
const float cdx = x - ai_->dungeon_cross_x(), cdy = y - ai_->dungeon_cross_y(), cdz = z - ai_->dungeon_cross_z();
if (cdx * cdx + cdy * cdy + cdz * cdz <= 1.0f)
direct = true;
}
// Per-bot dedup: skip if the previous move_to went to ~the same XYZ
// within the lockout window. See BotAI::kMoveToEmitLockoutMs / the long
// comment on note_move_to_emitted for the rationale (spline thrash,
@@ -158,6 +158,7 @@ public:
bool dismiss_pet() { return emit(DismissPetIntent{}); }
bool sit() { return emit(SetStandStateIntent{1}); }
bool stand(){ return emit(SetStandStateIntent{0}); }
bool set_sheath(uint8 sheath, int8_t hold = -1) { return emit(SetSheathIntent{sheath, hold}); }
// clear_generators=true tears down stale MotionMaster generators (not just
// the active spline) — see StopMovementIntent. Use it when a movement
// target may have outlived its validity (e.g. on a cross-map teleport).
@@ -468,6 +469,10 @@ public:
{ return emit(VendorIntent{VendorBuyByCategoryIntent{vendor, item_class, item_subclass, total_count}}); }
bool equip_item(uint8 from_bag, uint8 from_slot, uint8 to_slot)
{ return emit(EquipItemIntent{from_bag, from_slot, to_slot}); }
bool give_item(uint32 entry, uint16 count = 1)
{ return emit(GiveItemIntent{entry, count}); }
bool learn_spell(uint32 spell_id)
{ return emit(LearnSpellIntent{spell_id}); }
// 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.
@@ -320,6 +320,8 @@ struct IntentVisitor
Result operator()(PetCastSpellIntent const& i) { return api.pet_cast(i.spell_id, i.target); }
Result operator()(DismissPetIntent const&) { return api.dismiss_pet(); }
Result operator()(SetStandStateIntent const& i) { return api.set_stand_state(i.stand_state); }
Result operator()(SetSheathIntent const& i) { return api.set_sheath(i.sheath, i.hold); }
Result operator()(PlaySoundIntent const& i) { return api.play_sound(i.sound_kit); }
// SayChat/YellChat/EmoteChat/GuildChat/RaidChat/OfficerChat/RaidWarning/
// Whisper/PartyChat are bundled into `ChatIntent`. See operator()(ChatIntent).
Result operator()(UnstuckIntent const& i) { return api.unstuck(i.distance); }
@@ -423,6 +425,8 @@ struct IntentVisitor
Result operator()(LootRollIntent const& i) { return api.loot_roll(i.loot_object, i.loot_list_id, i.vote_type); }
Result operator()(BindHomebindIntent const& i) { return api.bind_homebind(i.innkeeper); }
Result operator()(EquipItemIntent const& i) { return api.equip_item(i.from_bag, i.from_slot, i.to_slot); }
Result operator()(GiveItemIntent const& i) { return api.give_item(i.item_entry, i.count); }
Result operator()(LearnSpellIntent const& i) { return api.learn_spell(i.spell_id); }
// ---- Subsystem-wrapper handlers (variant-pressure relief) ----
//
+58
View File
@@ -371,6 +371,12 @@ struct NearbyUnit
// action). It runs to the nearest friend within CreatureFamilyFleeAssistanceRadius and calls assistance there, which brings
// that friend's pack (SM 2026-10-30: Scarlet mobs flee at 15 % and turned 2-3 mob pulls into 8). A feared mob is not one.
bool seeks_help = false;
// creature_formations (FormationMgr): the spawn id of the formation's leader, 0 = in none; and whether this mob going into combat
// brings others of it (CreatureGroup::MemberEngagingTarget: the leader calls its members with FLAG_MEMBERS_ASSIST_LEADER, a member
// calls the leader with FLAG_LEADER_ASSISTS_MEMBER). Crowd control on such a mob is a pull of its formation (lbrs_full af59: the Polymorph on Scarshield
// Legionnaire 182 brought 181 and 179 onto the mage before the tank had pulled).
uint64 formation_leader = 0;
bool engage_calls_formation = 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
@@ -386,6 +392,10 @@ struct NearbyUnit
// Set from BOTH the live unit flag and the creature_template flag (mirrors
// is_pacified: a static template flag may not be applied to the live unit).
bool untargetable = false;
// Attackers only (combat.attackers): Unit::IsValidAttackTarget from the bot, read by the builder while no map updates. False
// for an attacker the bot can see and reach but never damage (an IMMUNE_TO_PC event creature): the false-combat escape counts
// it as immune instead of looking the unit up from a bot worker (State_Idle). Other unit lists leave it true.
bool valid_attack_target = true;
// Creature-only: Creature::CanNotReachTarget() — the mob's OWN
// ChaseMovementGenerator reports it cannot path to its current target
// (!isInAccessiblePlaceFor / PATHFIND_NOPATH, maintained per-tick by TC).
@@ -1047,6 +1057,9 @@ struct LfgState
bool in_dungeon = false;
// True when an LFG vote-to-kick is active in the bot's group.
bool vote_kick_active = false;
// True once LFGMgr has the run finished (LFG_STATE_FINISHED_DUNGEON: the final encounter of the matched dungeon is done).
// With in_dungeon it tells a finder group apart from a party made by hand. Set under the same gate as in_dungeon.
bool finished_dungeon = false;
void reset() { *this = LfgState{}; }
};
@@ -1416,6 +1429,10 @@ struct CombatTargetsState
// The victim stands in a liquid that burns a player (tar, lava: BotMovement::LiquidHurts at its spot). A melee bot does not follow it
// in (State_InCombat chase_blocked): shapers_full af51, the rogue chased an Ironhide Ravasaur into the Tar Pits and died there.
bool victim_in_damaging_liquid = false;
// A dry spot inside the bot's melee reach of such a victim, reached by a dry path (BotSnapshotBuilder LiquidVictimBankSpot): the
// bank a melee bot walks to and swings from (Ragnaros, who never leaves his lava). Unset when the bot is in reach already or none.
bool victim_bank_known = false;
float victim_bank_x = 0.0f, victim_bank_y = 0.0f, victim_bank_z = 0.0f;
ObjectGuid current_target;
// True only when current_target resolves to a LIVE unit the bot could
// legally attack (IsValidAttackTarget on the world thread). Autonomy
@@ -1472,6 +1489,8 @@ struct CombatTargetsState
victim_reach = 0.0f;
victim_group_target = false;
victim_in_damaging_liquid = false;
victim_bank_known = false;
victim_bank_x = victim_bank_y = victim_bank_z = 0.0f;
current_target = ObjectGuid::Empty;
current_target_hostile = false;
attackers.clear();
@@ -1627,6 +1646,14 @@ struct NearbyObject
// A shut door whose lock takes a key this bot carries (Lock.db2 LOCK_KEY_ITEM: the Gordok Courtyard and Inner Doors in Dire Maul):
// the key's item entry, 0 for any other object. Such a door is in the list as a hand_door too, for this bot only.
uint32 key_item = 0;
// A shut door whose lock this bot opens with a spell of its own: the lock has a skill case (Lockpicking for Pick Lock) and the bot's
// skill reaches it (Alcaz Prison's Maximum Security Door 649547, lock 4295: Lockpicking 250 or the Overseer's Keyring; on live a
// rogue picked it, 26 Nov). For this bot only, like key_item; such a door is in the list as a hand_door too.
bool pick_lock = false;
// DOOR only: its facing in radians (the way through the door runs along it, (cos o, sin o)) and whether it shuts by itself after
// a use (template autoClose: Alcaz Prison's Prison Gates, 3 s). Such a door each bot opens for itself (idle:dungeon_open_hand_door).
float o = 0.f;
bool auto_close = false;
// CHEST (type 3) only: one the bot's dungeon lists as holding a door key (DungeonScript::key_chests), spawned and not yet opened.
bool key_chest = false;
// RITUAL (type 18) without an owner (the Altar of the Keepers / of Archaedas in Uldaman, the Blackrock Altar in UBRS): true when
@@ -1701,6 +1728,9 @@ struct EnvironmentState
bool transport_is_ship = false;
bool is_underwater = false;
float water_surface_z = 0.0f;
// The server's breath timer (Player::HandleDrowning): ms of breath left, counting down while the head is under water and back up
// ten times as fast above it; -1 when it is not running (full, water breathing, dead).
int32 breath_left_ms = -1;
bool is_in_damaging_liquid = false;
// Also set in a liquid that burns (tar, lava, is_in_damaging_liquid), wherever the bot is: idle:flee_damaging_liquid and the combat
// step-out walk to it. A random 25 y heading from the middle of the Tar Pits ended in tar again and the move gate refused it (af51).
@@ -1764,6 +1794,26 @@ struct DungeonExecState
float inside_entrance_y = 0.f;
float inside_entrance_z = 0.f;
// The creatures the dungeon rules look for, collected by the builder (BuildDungeonScan) while no map is updating. The rules run on
// the bot workers, and a grid walk there races the map thread that moves creatures between cells: the af65 worldserver crashed
// (23 Nov, drowned_full) inside the catch-up boss scan's Cell::VisitAllObjects. Positions are the build's.
struct ScanUnit
{
ObjectGuid guid;
uint32 entry = 0;
float x = 0.f, y = 0.f, z = 0.f;
bool fightable = false; // bosses: attackable now, or hostile and asleep until a player comes near
bool in_los = false; // bosses within kScanLosYd: in the bot's line of sight
bool in_combat = false;
};
static constexpr float kScanBossYd = 500.0f; // the whole dungeon, as the boss scans always looked
static constexpr float kScanHostileYd = 150.0f; // the tank's next-pack scan
static constexpr float kScanLosYd = 40.0f;
// Alive creatures of the dungeon's boss list and of its portal hops (the boss beyond, the ones that open it) within kScanBossYd.
std::vector<ScanUnit> scan_bosses;
// Alive creatures within kScanHostileYd the bot may attack, not critters, totems or companion pets.
std::vector<ScanUnit> scan_hostiles;
void reset() { *this = DungeonExecState{}; }
};
@@ -2806,9 +2856,16 @@ 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;
// The player who leads the bot (the owner in its group, else the player who commands it) is in the water, on the bot's map and
// within kLeaderWaterYd: the bot swims with him, as a party member does. The ways out of the water for a bot on its own
// (idle:water_escape, idle:swim_stuck) leave it be (Discord 2026-11-22, Egod: bots in the water stood and watched).
bool leader_in_water = false;
// The character is a real player's own (not on a bot pool account): an alt summoned into the party (`.playerbot summon`, the
// add-on). The free upkeep meant for the server's bots (the gold floor and the free repair, Bot/AlwaysBuffs.h) leaves it out.
bool players_own_character = false;
// The character is played from a game client (a self bot, .playerbot self) or is a player-led scenario's stand-in
// (Scenario::PlaysAsHuman): the bot logic drives a person's character, so it never hands its group to "the human" in it.
bool plays_as_human = false;
// The bot is in a group with a player who controls it although it has no owner in that group: a world bot the player invited
// (or a companion whose owner is not in the group). Same duty as a companion: it does what the group does, no errands, and the
// controller's orders reach it. controller_guid is that player (the group leader when human, else the first human member).
@@ -3126,6 +3183,7 @@ struct BotSnapshot
owner_guid = ObjectGuid::Empty;
owner_in_group = false;
players_own_character = false;
plays_as_human = false;
led_by_player = false;
controller_guid = ObjectGuid::Empty;
no_tag_stance = false;
File diff suppressed because it is too large Load Diff
@@ -453,6 +453,12 @@ float BotSnapshotView::spell_min_range(uint32 spell_id, NearbyUnit const& t) con
float min = si->GetMinRange(false);
if (si->RangeEntry->Flags & SPELL_RANGE_RANGED)
min += std::max(1.5f + t.combat_reach + 4.0f / 3.0f, 5.0f); // DEFAULT_PLAYER_COMBAT_REACH + target reach + 4/3, at least NOMINAL_MELEE_RANGE
// Spell::CalcMinMaxRange's other branch: a range entry without the ranged flag that has a minimum gets both combat reaches added.
// This client's Hunter Range (114, Auto Shot and every shot) has no flags, so against Blazeroar the core's dead zone was 8 + 1.5 + his
// reach while this said 8: the hunter "stepped back" to 12 y, still inside, and the core sent it in to melee in front of him
// (alcaz_full af70c 2026-11-25, killed by Flame Breath).
else if (min > 0.0f)
min += 1.5f + t.combat_reach; // DEFAULT_PLAYER_COMBAT_REACH + target reach
return min;
}
@@ -100,12 +100,15 @@ public:
{ return slot < s_->archetype.role_affinity.size() ? s_->archetype.role_affinity[slot] : 0.f; }
bool lfg_in_queue() const { return s_->lfg.in_queue; }
bool lfg_in_dungeon() const { return s_->lfg.in_dungeon; }
bool lfg_finished_dungeon() const { return s_->lfg.finished_dungeon; }
uint16 completed_quest_count() const { return s_->quest_log.completed_quest_count; }
std::string const& owner_name() const { return s_->owner_name; }
bool has_owner_character() const { return !s_->owner_name.empty(); }
bool is_companion_with_owner() const { return s_->owner_in_group; }
// In a group with a player who commands it: a companion, or a world bot a player invited. Neither runs world errands.
bool is_led_by_player() const { return s_->owner_in_group || s_->led_by_player; }
// The player who leads it is in the water near it (BotSnapshot::leader_in_water).
bool leader_in_water() const { return s_->leader_in_water; }
// A bot of the world: no owner, not in any group, not led by a player.
bool is_free_world_bot() const { return s_->owner_guid.IsEmpty() && s_->owner_name.empty() && s_->group.group_guid.IsEmpty() && !s_->led_by_player; }
bool no_tag_stance() const { return s_->no_tag_stance; }
@@ -197,6 +200,7 @@ public:
bool transport_is_ship() const { return s_->environment.transport_is_ship; }
bool is_underwater() const { return s_->environment.is_underwater; }
float water_surface_z() const { return s_->environment.water_surface_z; }
int32 breath_left_ms() const { return s_->environment.breath_left_ms; }
bool is_in_damaging_liquid() const { return s_->environment.is_in_damaging_liquid; }
// Open-world water-escape focus (FIX #12): nearest DRY footing the builder
// resolved while the bot is in swim-water; idle:water_escape drives to it.
+85 -7
View File
@@ -158,15 +158,9 @@ BotTextMgr::Row const* BotTextMgr::PickWeighted(std::vector<Row> const& rows, Ac
return nullptr;
}
BotTextMgr::Line BotTextMgr::Pick(std::string_view key, TextPlaceholders const& ph) const
BotTextMgr::Line BotTextMgr::FromRow(Row const* row, TextPlaceholders const& ph)
{
Line out;
auto it = texts_.find(std::string(key));
if (it == texts_.end())
return out;
Row const* row = PickWeighted(it->second, [](Row const&) { return true; });
if (!row)
return out;
out.text = row->text;
out.yell = row->say_type == 1;
Fill(out.text, ph);
@@ -176,6 +170,44 @@ BotTextMgr::Line BotTextMgr::Pick(std::string_view key, TextPlaceholders const&
return out;
}
BotTextMgr::Line BotTextMgr::Pick(std::string_view key, TextPlaceholders const& ph) const
{
auto it = texts_.find(std::string(key));
if (it == texts_.end())
return {};
Row const* row = PickWeighted(it->second, [](Row const&) { return true; });
return row ? FromRow(row, ph) : Line{};
}
BotTextMgr::Line BotTextMgr::PickKeys(std::vector<std::string_view> const& keys, TextPlaceholders const& ph) const
{
uint64 total = 0;
for (std::string_view key : keys)
{
auto it = texts_.find(std::string(key));
if (it == texts_.end())
continue;
for (Row const& r : it->second)
total += r.weight;
}
if (total == 0)
return {};
uint64 roll = urand(0, uint32(std::min<uint64>(total, 0xFFFFFFFFu) - 1));
for (std::string_view key : keys)
{
auto it = texts_.find(std::string(key));
if (it == texts_.end())
continue;
for (Row const& r : it->second)
{
if (roll < r.weight)
return FromRow(&r, ph);
roll -= r.weight;
}
}
return {};
}
std::string BotTextMgr::GetReply(ReplyType type, std::string const& other_name) const
{
auto it = texts_.find("reply");
@@ -1417,6 +1449,52 @@ std::string PickBanter(Banter kind, uint8 cls, Role role, BotPersonality const&
bool const rude = pers.politeness == Politeness::Rude;
bool const rp = pers.verbosity == Verbosity::Roleplay;
// The text table's banter_<kind> key first (migration 0067), its role / class / personality
// variants merged in with the same conditionals as the builtin pools below; those pools stand
// for a server whose table has no banter rows.
char const* base = nullptr;
switch (kind)
{
case Banter::Ready: base = "banter_ready"; break;
case Banter::Wipe: base = "banter_wipe"; break;
case Banter::Thanks: base = "banter_thanks"; break;
case Banter::Ouch: base = "banter_ouch"; break;
case Banter::BossKill: base = "banter_bosskill"; break;
}
std::vector<std::string> wanted = { base };
auto add_key = [&](char const* suffix) { wanted.emplace_back(std::string(base) + suffix); };
switch (kind)
{
case Banter::Ready:
if (tank) add_key("_tank");
if (healer) add_key("_healer");
else if (caster) add_key("_caster");
if (rp) add_key("_rp");
break;
case Banter::Wipe:
if (tank) add_key("_tank");
if (healer) add_key("_healer");
if (polite) add_key("_polite");
if (rude) add_key("_rude");
break;
case Banter::Thanks:
if (polite) add_key("_polite");
if (rude) add_key("_rude");
break;
case Banter::Ouch:
if (tank) add_key("_tank");
if (caster) add_key("_caster");
break;
case Banter::BossKill:
if (polite) add_key("_polite");
if (tank) add_key("_tank");
if (rp) add_key("_rp");
break;
}
std::vector<std::string_view> keys(wanted.begin(), wanted.end());
if (std::string line = BotTextMgr::instance().GetKeys(keys); !line.empty())
return line;
std::array<LineSpan, 6> pools{};
size_t n = 0;
auto add = [&](LineSpan s) { pools[n++] = s; };
+9
View File
@@ -112,6 +112,12 @@ public:
Line Pick(std::string_view key, TextPlaceholders const& ph = {}) const;
std::string Get(std::string_view key, TextPlaceholders const& ph = {}) const { return Pick(key, ph).text; }
// One weighted random line among the merged rows of `keys` (a base key and its role / class /
// personality variants, e.g. 'banter_ready' + 'banter_ready_tank'). Keys without rows are skipped;
// empty when none of them has rows.
Line PickKeys(std::vector<std::string_view> const& keys, TextPlaceholders const& ph = {}) const;
std::string GetKeys(std::vector<std::string_view> const& keys, TextPlaceholders const& ph = {}) const { return PickKeys(keys, ph).text; }
// Random 'reply' row of the given type, %s filled with `other_name`. Empty when none.
std::string GetReply(ReplyType type, std::string const& other_name) const;
@@ -133,6 +139,9 @@ private:
template <typename Accept>
static Row const* PickWeighted(std::vector<Row> const& rows, Accept&& accept);
// Row -> Line: text + say_type, placeholders filled; empty when an unfilled one remains.
static Line FromRow(Row const* row, TextPlaceholders const& ph);
std::unordered_map<std::string, std::vector<Row>> texts_;
std::unordered_map<std::string, float> chance_;
size_t count_ = 0;
+5 -2
View File
@@ -2,7 +2,9 @@
// list: the pure choice behind State_Idle idle:dungeon_auto_cc_script.
//
// An eligible candidate is a live enemy of the script's priority list that no teammate has locked yet, that is not hitting the
// bot itself, is not the skull (the group's focus-kill mark) and whose creature type the CC spell accepts. Among them the
// bot itself, is not the skull (the group's focus-kill mark) and whose creature type the CC spell accepts. An idle mob also
// has to be one the tank can walk to: crowd control on an idle mob pulls its pack, and a pack the tank's pull passes by
// (another level, across a gap) comes to the group with nobody able to hold it. Among them the
// group's kill focus (PveOrder::kill_focus, the first priority add of the script's list that is engaged) goes first: it is the
// most dangerous caster, and once it is locked the coordinator moves the focus on to the next add (PveGroupCoordinator skips
// adds a member has CC-locked), so the DPS burn a different one. Deadmines 2026-10-09: the Defias Evoker's Flamestrike (546 damage)
@@ -24,6 +26,7 @@ struct CcCandidate
bool is_skull = false; // the group's focus-kill mark
bool wrong_type = false; // the CC spell cannot take its creature type (mechanical, ...)
bool is_kill_focus = false; // the coordinator's current kill focus
bool tank_cannot_pull = false; // an idle mob the tank can only walk to the long way round, or not at all (PackPullGate.h)
};
constexpr size_t kNoCcTarget = size_t(-1);
@@ -34,7 +37,7 @@ inline size_t PickCcTarget(std::vector<CcCandidate> const& candidates)
for (size_t i = 0; i < candidates.size(); ++i)
{
CcCandidate const& c = candidates[i];
if (!c.in_priority_list || c.locked || c.hits_me || c.is_skull || c.wrong_type)
if (!c.in_priority_list || c.locked || c.hits_me || c.is_skull || c.wrong_type || c.tank_cannot_pull)
continue;
if (c.is_kill_focus)
return i;
@@ -23,6 +23,10 @@ constexpr float kHealTankTroubleCover = 1.25f;
// him to it, and he went on dropping while it cast.
constexpr float kDamageRateTauMs = 3000.0f;
// How far ahead the damage of a member's own periodic auras is counted (GroupMemberSummary::aura_damage_due): one Greater Heal / Holy
// Light, the slowest heal that still has to land in time.
constexpr int32_t kAuraDueHorizonMs = 2500;
struct DamageRate
{
float per_s = 0.0f; // damage per second as of at_ms
@@ -98,6 +98,10 @@ inline void MergeAdvice(DungeonAdvice& dst, DungeonAdvice const& src)
cat(dst.tank_swap_on_spells, src.tank_swap_on_spells);
cat(dst.soak_spells, src.soak_spells);
cat(dst.bosses, src.bosses);
dst.keep_clear_of_carriers.insert(dst.keep_clear_of_carriers.end(),
src.keep_clear_of_carriers.begin(), src.keep_clear_of_carriers.end());
dst.spread_from_bosses.insert(dst.spread_from_bosses.end(),
src.spread_from_bosses.begin(), src.spread_from_bosses.end());
dst.progression_waypoints.insert(dst.progression_waypoints.end(),
src.progression_waypoints.begin(), src.progression_waypoints.end());
}
@@ -64,6 +64,16 @@ struct DungeonAdvice
// move ≥ N yards from allies (M+ Volcanic / Quaking aftershock,
// raid debuffs that explode for AoE).
std::vector<uint32_t> spread_on_self_auras;
// A harmful aura on a player that hurts the players next to its carrier, and a carrier who cannot walk off (confused, stunned,
// rooted): every other member keeps `radius` yards from the carrier while it lasts. Shaper's Terrace Cinder's Conflagration
// 1310512 confuses its carrier for 4 s and every second burns every ally within 5 y of the carrier for 300 (16806).
struct CarrierClearance { uint32_t aura; float radius; };
std::vector<CarrierClearance> keep_clear_of_carriers;
// A boss whose spell lands on one player and hurts every ally within `radius` yards of that player: while the group fights
// it, the ranged members and the healer stand at least `radius` yards from every other member (the melee and the tank stay
// on the boss). Shaper's Terrace Vitrix's Poison Shock 1312870 hits its target and everyone within 10 y of it for 1270-1470.
struct BossSplashSpread { uint32_t boss; float radius; };
std::vector<BossSplashSpread> spread_from_bosses;
// Boss spell ids that, when seen mid-cast, require all bots to
// stack on the boss / a designated target (raid stack-soaks).
std::vector<uint32_t> stack_on_cast_spells;
@@ -306,6 +316,11 @@ public:
// entry id) and must be fixed in bosses[], never masked here.
virtual std::vector<uint32_t> event_summoned_bosses() const { return {}; }
// Bosses of bosses[] that the instance script summons on the way (Majordomo after the eight runes, Ragnaros by Majordomo,
// Nefarian by Victor Nefarius): no creature row, still owed and killed for the clear. Only the smoketest's spawn check reads
// it (no_spawn is no data error for these). Unlike event_summoned_bosses() it does not loosen the dungeon's completion.
virtual std::vector<uint32_t> scripted_spawn_bosses() const { return {}; }
// Doors (GO entries) of this dungeon that players open by hand although the door carries no lock that says so. A shut hand door
// is normally known by its lock (BotSnapshotBuilder IsShutHandDoor: the Deadmines Heavy Doors' Quick Open). The Hall of Thanes'
// Vault Door has no lock and no flag, the same data as the Iron Doors its switch and its bosses open, yet in the official sniff
@@ -5,6 +5,10 @@
// mark (MarksNeedOrder: crowd control on an idle mob is otherwise the owner's call, and a bot-led squad has no owner order).
// The mage's autonomous marked CC (idle:dungeon_auto_cc_marked) does the Polymorph. The tank waits for the mob to read
// is_cc_locked (or a refusal / the wait cap), then runs its pull back (BotAI::PullBackPlan).
// A mob whose formation comes with it (NearbyUnit::engage_calls_formation) is asked for "on the pull": the sheep on it would
// be the pull, with the tank not yet in it. The moon goes on the mob, the mage is not released for an idle mob, the tank
// pulls as soon as the moon is on, and the mage holds the mob once it is in the fight, as it runs in (the in-combat marked CC).
// The coordinator ends such a request when the mob reads held.
#include "ObjectGuid.h"
#include <mutex>
@@ -21,6 +25,7 @@ struct Request
uint32 requested_ms = 0;
uint32 done_ms = 0; // the tank stopped waiting (0 = still waiting)
State state = State::Pending;
bool on_pull = false; // held once it is in the fight, never before the pull (its formation comes with it)
};
inline constexpr uint32 kWaitCapMs = 8000; // the tank waits this long for the mob to be held ...
@@ -28,6 +33,7 @@ inline constexpr uint32 kWaitHardCapMs = 20000; // ... and up to this long while
inline constexpr float kSpellReachY = 30.0f; // Polymorph's range: a mage farther out is still walking in
inline constexpr uint32 kLifeMs = 35000; // a request is dropped this long after it was opened (> hard cap + kAfterDoneMs)
inline constexpr uint32 kAfterDoneMs = 12000; // the mark and the mage's release outlast the tank's wait by this
inline constexpr uint32 kMarkWaitMs = 2000; // an on-pull request: the tank waits this long at most for the moon to go on
namespace detail {
inline std::mutex& Mutex() { static std::mutex m; return m; }
@@ -47,13 +53,13 @@ inline bool Get(uint64 group_low, uint32 now_ms, Request& out)
}
// Open a request unless the group has a live one. True when opened.
inline bool Open(uint64 group_low, ObjectGuid mob, uint64 caster_low, uint32 now_ms)
inline bool Open(uint64 group_low, ObjectGuid mob, uint64 caster_low, uint32 now_ms, bool on_pull = false)
{
Request cur;
if (Get(group_low, now_ms, cur)) return false;
std::lock_guard<std::mutex> lk(detail::Mutex());
Request r;
r.mob = mob; r.caster_low = caster_low; r.requested_ms = now_ms ? now_ms : 1u;
r.mob = mob; r.caster_low = caster_low; r.requested_ms = now_ms ? now_ms : 1u; r.on_pull = on_pull;
detail::Map()[group_low] = r;
return true;
}
@@ -406,6 +406,21 @@ void PveGroupCoordinator::Update(uint32 now_ms)
100.0f * float(u.hp) / float(u.max_hp) <= rule.hpMax)
want = std::max<size_t>(want, mem.size());
}
// An encounter that sends tanked adds the whole fight (RaidRules::allTanks) has every live tank on the roster while it is on.
// naxx_kelthuzad kt62a (1123): the roster stayed at three (0-1 engaged Abominations at a time, the Soldiers and Weavers are no
// tank's) until 133 s; the bear Mctankda played DPS in Cat Form, an Abomination stood on it untanked, and the Abominations killed
// 15 of 43 with the three tanks on Mortal Wound swaps among themselves.
// The fight is the group's combat: a listed enemy alive near it is enough (kt66a/b: keyed on the enemy's own combat flag the
// roster went 4 -> 3 -> 4 three times in the first 70 s, between sent Soldiers).
if (Raid::RaidRules const* rules = Raid::RulesForMap(b.map_id); rules && !rules->allTanks.empty() && b.in_combat)
for (auto const& sn : snaps)
{
if (sn->position.map_id != b.map_id) continue;
for (auto const& u : sn->combat.nearby_enemies)
if (u.hp > 0 &&
std::find(rules->allTanks.begin(), rules->allTanks.end(), u.entry) != rules->allTanks.end())
want = std::max<size_t>(want, mem.size());
}
// A melee-soak boss (RaidRules::meleeSoak, Patchwerk) needs the main tank and every soaker on the roster: with three, the
// fourth tank played DPS, drank no Stoneshield and had no tank healer while the raid layer still sent it in as a soaker, and
// the bear on the roster was not one of the raid layer's soakers (naxx_patchwerk 1115 night, [raid_soak]).
@@ -1860,8 +1875,16 @@ void PveGroupCoordinator::PlanPrePullCc(uint64 bkey, uint64 group_low, uint32 ma
group_low, map_id, cu->entry, pcc.mob.GetCounter(), caster->src->name);
}
}
// The mage may crowd-control the idle marked mob: the squad's tank asked for it (MarksNeedOrder).
if (pcc.state != PrePullCc::State::Refused)
// An on-pull request is done once the mob is held in the fight: the moon and the mage's assignment stay kAfterDoneMs more.
if (pcc.on_pull && !pcc.done_ms && cu->is_cc_locked)
{
PrePullCc::Done(group_low, now_ms);
TC_LOG_INFO("playerbot.v2", "[raid_pull] group={} map={} {} ({}) is held in the fight after {} ms",
group_low, map_id, cu->entry, pcc.mob.GetCounter(), uint32(now_ms - pcc.requested_ms));
}
// The mage may crowd-control the idle marked mob: the squad's tank asked for it (MarksNeedOrder). Not on an on-pull
// request: the moon alone assigns the mob, and the hold waits for the mob to be in the fight (MarkGate::MayEngage).
if (pcc.state != PrePullCc::State::Refused && !pcc.on_pull)
if (auto pit = plan.find(pcc.caster_low); pit != plan.end())
pit->second.marks_released = true;
}
@@ -1918,7 +1941,15 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
if (Raid::GetBrain().AllSchoolsAvoided(group_low, map_id, u.guid)) continue;
if (find_mob(u.guid)) continue;
Member const* v = member_of(u.victim);
mobs.push_back({ &u, v && !v->tank });
// A mob on a tank whose raid order forbids it that mob is loose too: that tank does not hold it, so another tank has to take
// it. naxx_kelthuzad kt70f (1125): the first Abomination was sent at the bear, which takes none (TankSpot::skipClassMask);
// the bear dropped it ("the raid order forbids it") for 10 s while the three warriors stood at their slots with nothing,
// counting it held, until it turned on Mcmagee in the camp and killed it at 43 s.
bool forbiddenOnTank = false;
if (v && v->tank)
if (RaidOrder const* ro = Raid::GetBrain().OrderFor(v->guid_low); ro && ro->active)
forbiddenOnTank = std::find(ro->forbidden_targets.begin(), ro->forbidden_targets.end(), u.guid) != ro->forbidden_targets.end();
mobs.push_back({ &u, v && (!v->tank || forbiddenOnTank) });
}
}
@@ -1959,6 +1990,8 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
auto raid_forbids = [&](uint64 tank_low, ObjectGuid mob) -> bool
{
RaidOrder const* ro = Raid::GetBrain().OrderFor(tank_low);
if (ro && ro->active && ro->no_tank_off && Raid::NoTank(map_id, mob.GetEntry()))
return true;
return ro && ro->active && std::find(ro->forbidden_targets.begin(), ro->forbidden_targets.end(), mob) != ro->forbidden_targets.end();
};
for (auto it = sticky.begin(); it != sticky.end();)
@@ -2255,8 +2288,10 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
if (!pick || is_taken(pick->u->guid))
{
pick = nullptr;
// Not one the raid order forbids this tank: naxx_kelthuzad kt69i (1124), a Soldier of the Frozen Wastes sent at the main tank
// was handed to it 57 times from 50 y out ("takes Soldier ... on Mctankwa why=on_main_tank"), past the fixed row's forbid.
for (auto const& m : mobs)
if (m.u->victim == t->src->guid && !is_taken(m.u->guid) &&
if (m.u->victim == t->src->guid && !is_taken(m.u->guid) && !raid_forbids(t->guid_low, 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"; }
@@ -2325,7 +2360,11 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
Mob const* held = find_mob(sit->second);
if (!held || held->u->is_dungeon_boss || held->u->is_boss_rank || Raid::OffTankMob(map_id, held->u->entry)) continue;
if (mk_grp && (sit->second == mk_grp->GetTargetIcon(7) || sit->second == mk_grp->GetTargetIcon(6))) continue;
int const have = prio_of(*held);
// A summoned add no tank is meant to hold (RaidRules::noTank) is held only while nothing else needs the tank: any loose
// mob it may tank outranks it. naxx_kelthuzad kt61b (1122): the free tanks took Soldiers of the Frozen Wastes 57 y off
// (why=loose_nearest) and Soul Weavers, both priority equal to or above the Abominations', and kept them while an
// Abomination stood on a mage 12 s; the Abominations killed 35 of 43.
int const have = Raid::NoTank(map_id, held->u->entry) ? 0 : prio_of(*held);
if (have >= want) continue;
const float dx = m.u->x - t->src->x, dy = m.u->y - t->src->y;
const float d2 = dx * dx + dy * dy;
@@ -2979,10 +3018,13 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
fl.dmg_total = 0;
fl.dmg_last_ms = 0;
fl.start_mana.clear();
fl.dps_label.clear();
for (auto const& e : mem)
{
TakeDamageDone(e.guid_low, true);
if (e.src && e.src->max_mana > 0) fl.start_mana[e.guid_low] = Pct(e.src->mana, e.src->max_mana);
if (e.src && e.is_bot && !e.tank && !e.healer)
fl.dps_label[e.guid_low] = std::string(e.src->name) + "(" + ShortClass(e.cls) + ")";
}
uint32 alive = 0, tanks = 0, healers = 0;
for (auto const& e : mem)
@@ -3071,8 +3113,10 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
if (listed++ >= 8) continue;
if (!mob_txt.empty()) mob_txt += ", ";
Member const* v = member_of(m.u->victim);
mob_txt += MobName(m.u->entry) + " " + std::to_string(Pct(m.u->hp, m.u->max_hp)) + "%>" +
(v ? v->src->name : std::string("pet")) + (m.loose ? "!" : "");
// The creature's guid counter (#n): one add's life can be followed from line to line (naxx_kelthuzad: how long each Soul
// Weaver lives, from its first line to its last).
mob_txt += MobName(m.u->entry) + " #" + std::to_string(m.u->guid.GetCounter()) + " " + std::to_string(Pct(m.u->hp, m.u->max_hp)) +
"%>" + (v ? v->src->name : std::string("pet")) + (m.loose ? "!" : "");
// Where a boss is: a boss dragged off his spot shows in the line (naxx_horsemen r23: Sir Zeliek's Holy Wrath killed raiders at
// Mograine's corner and then at Korth'azz's, and the log could not say where Zeliek stood; Heigan pulled 40 y west, Feugen across).
if (m.u->is_dungeon_boss || m.u->is_boss_rank)
@@ -3172,6 +3216,14 @@ void PveGroupCoordinator::PlanRaidTanks(uint64 bkey, uint64 group_low, uint32 ma
rows.emplace_back(d, std::string(e.src->name) + "(" + ShortClass(e.cls) + ") " + std::to_string(d) + " (" +
std::to_string(d / dur) + "/s" + mana + ")");
}
for (auto const& [low, label] : fl.dps_label)
{
if (std::any_of(mem.begin(), mem.end(), [&](auto const& e) { return e.guid_low == low; }))
continue; // listed above
if (uint64 const d = TakeDamageDone(low, true))
rows.emplace_back(d, label + " " + std::to_string(d) + " (" + std::to_string(d / dur) + "/s, dead)");
}
fl.dps_label.clear();
std::sort(rows.begin(), rows.end(), [](auto const& a, auto const& b) { return a.first > b.first; });
std::string txt;
for (auto const& r : rows) { if (!txt.empty()) txt += ", "; txt += r.second; }
@@ -3694,6 +3746,7 @@ void PveGroupCoordinator::PlanSightPull(uint64 bkey, uint64 group_low, uint32 ma
constexpr float kArrivedYd = 10.0f; // a mob this close to the spot has come in
// b3ca0b4b67 overnight: a spot the mobs did not come to held the group for 20 s; 12 s is a caster's walk round a corner and back.
constexpr uint32 kSightPullCapMs = 12000;
constexpr uint32 kSightPullSpentMs = 120000; // a mob a plan ended on is left to the tank this long (SightPull::spent)
constexpr float kSideYd = 2.0f; // the spot stays hidden this far to each side of it
constexpr float kFloorDz = 4.0f; // the spot is on the return point's floor
constexpr float kMaxPathYd = 35.0f;
@@ -3882,15 +3935,27 @@ void PveGroupCoordinator::PlanSightPull(uint64 bkey, uint64 group_low, uint32 ma
}
if (left.empty())
return end("every mob that stood off has come in");
auto spend = [&](std::vector<ObjectGuid> const& mobs)
{
for (ObjectGuid const& g : mobs)
sp.spent[g.GetCounter()] = now_ms ? now_ms : 1u;
};
if (now_ms - sp.since_ms > kSightPullCapMs)
return end(fmt::format("{} s cap, {} still out", kSightPullCapMs / 1000u, left.size()).c_str());
{
spend(left);
return end(fmt::format("{} s cap, {} still out, left to the tank for {} s", kSightPullCapMs / 1000u, left.size(),
kSightPullSpentMs / 1000u).c_str());
}
if (seen_again)
{
float x = 0.f, y = 0.f, z = 0.f;
std::string why;
if (sp.replans >= 1 || !search(stopped, sp.x, sp.y, sp.z, x, y, z, why))
{
spend(left);
return end(fmt::format("a mob stopped with the spot in its sight: {}{}", names(stopped),
why.empty() ? std::string() : " (" + why + ")").c_str());
}
++sp.replans;
TC_LOG_INFO("playerbot.v2", "[sight_pull] group={} map={} {} stopped with the spot ({:.1f},{:.1f}) in sight: new spot ({:.1f},{:.1f},{:.1f})",
group_low, map_id, names(stopped), sp.x, sp.y, x, y, z);
@@ -3925,9 +3990,11 @@ void PveGroupCoordinator::PlanSightPull(uint64 bkey, uint64 group_low, uint32 ma
float const ay = pulling_back ? pb.ry : tank->GetPositionY();
float const az = pulling_back ? pb.rz : tank->GetPositionZ();
char const* const from = pulling_back ? "the return point" : "the tank";
for (auto it = sp.spent.begin(); it != sp.spent.end();)
it = now_ms - it->second >= kSightPullSpentMs ? sp.spent.erase(it) : std::next(it);
std::vector<Creature*> mobs;
for (Creature* c : standing)
if (dist2(c->GetPositionX(), c->GetPositionY(), ax, ay) <= kStandOffNearYd * kStandOffNearYd)
if (dist2(c->GetPositionX(), c->GetPositionY(), ax, ay) <= kStandOffNearYd * kStandOffNearYd && !sp.spent.count(c->GetGUID().GetCounter()))
mobs.push_back(c);
if (mobs.empty())
return;
@@ -119,6 +119,9 @@ private:
uint32 dmg_last_ms = 0;
// Mana % of each member when the pull started, for the [raid_dps] line.
std::unordered_map<uint64, int32> start_mana;
// The damage dealers at the pull's start ("Mcmagea(Mag)"), so [raid_dps] also lists the ones dead by its end: the members of the
// last plan are the living ones only (naxx_kelthuzad kt69j: 2 of 24 listed).
std::unordered_map<uint64, std::string> dps_label;
};
// Raid tank -> mob assignment for one (group, map) bucket, the generic
@@ -277,6 +280,10 @@ private:
uint8 replans = 0; // the spot was searched again (a mob saw it from where it stopped next)
std::vector<ObjectGuid> mobs; // the mobs still standing off
uint32 no_spot_log_ms = 0;
// Mobs a plan ended on while they were still out there (the cap, or one that stopped with the spot in sight), and when: a plan
// does not start on them again for kSightPullSpentMs, so the tank's own rules go and fetch them (wc_full af69i: a Deviate
// Venomwing 50-60 y off held the group at the spot in 12 s plans, one after the other, for the last five minutes of the run).
std::unordered_map<uint64, uint32> spent;
};
std::unordered_map<uint64, SightPull> sight_pull_;
uint32 last_plan_ms_ = 0;
@@ -1,8 +1,11 @@
// AlcazPrisonScript - per-dungeon advice for Alcaz Prison (map 2994, Classic 1.60 Forever, levels 50-55).
// The creatures and the boss fights are in classic_instance_alcaz_prison.cpp and 2026_11_14_41_world_forever_alcaz_prison.sql;
// the route (playerbot_dungeon_routes, 0043_alcaz_prison_route.sql) and this file follow the same boss order:
// Overseer Wrex, Katerina the Cleaner, The Questioner, Tidemistress Ca'zass, Blazeroar (the shortest walk through the
// prison that keeps Wrex first and Blazeroar last; every leg was path-checked on the 2994 navmesh).
// The creatures and the boss fights are in classic_instance_alcaz_prison.cpp and the world SQL (since 2026_11_27_40: live's layout,
// from Karrz's capture of a full clear on 26 Nov); the route (playerbot_dungeon_routes, 0071_alcaz_prison_route_as_live_clears_it.sql)
// and this file follow live's kill order: Overseer Wrex, Katerina the Cleaner, Blazeroar, The Questioner. The doors decide it. From the
// landing only Wrex's wing is open. The Maximum Security Door (649547) to Katerina and Blazeroar takes Wrex's Overseer's Keyring or
// Lockpicking 250: on live the group's rogue picked it, and the bots' rogue does the same (idle:dungeon_open_hand_door, pick_lock).
// The Prison Gate (649552) to The Questioner has no lock and shuts 3 s after each use; every bot opens it for itself (hand_doors).
// Tidemistress Ca'zass is not on live and not spawned.
#include "../DungeonScript.h"
@@ -21,7 +24,7 @@ public:
DungeonAdvice a;
// The casters of the packs: their bolts are the spike damage on the group.
a.high_priority_kill_entries = {
255373, // Strashaz Enchantress (Lightning Bolt, Frost Shock; two of them join Ca'zass)
255373, // Strashaz Enchantress (Lightning Bolt, Frost Shock)
255364, // Renegade Conjurer (Frostbolt, Frost Nova)
255262, // Alcaz Chaplain (two of them join Katerina)
};
@@ -38,23 +41,29 @@ public:
260386, // Commander Folkar
264770, // Mason Connery
};
// Live's order (capture 26 Nov, 21:59-22:13).
a.bosses = {
255391, // Overseer Wrex
257016, // Katerina the Cleaner
256236, // The Questioner
255997, // Tidemistress Ca'zass
255702, // Blazeroar
256236, // The Questioner
};
// 1:1 with `bosses`: their spawn spots (guids 48120006, 48120043, 48120052, 48120017, 48120077).
// 1:1 with `bosses`: live's spots (2026_11_27_40; the Questioner walks between this spot and (-8762.1, 2845.5)).
a.progression_waypoints = {
{ -8762.0f, 2852.0f, 14.0f }, // Overseer Wrex
{ -8852.0f, 2888.0f, 14.02f }, // Katerina the Cleaner
{ -8888.0f, 2888.0f, 14.42f }, // The Questioner
{ -8728.0f, 2932.0f, 6.15f }, // Tidemistress Ca'zass
{ -8890.0f, 2966.0f, 5.89f }, // Blazeroar
{ -8885.8f, 2921.3f, 14.91f }, // Overseer Wrex
{ -8808.5f, 2971.1f, 6.01f }, // Katerina the Cleaner
{ -8901.2f, 2971.5f, 5.89f }, // Blazeroar
{ -8773.0f, 2854.2f, 13.86f }, // The Questioner
};
return a;
}
// The Prison Gate to The Questioner: no lock, a click opens it (and it shuts again 3 s later).
std::vector<uint32_t> hand_doors() const override { return { 649552 }; }
// Tidemistress Ca'zass keeps her boss slot (the client's DungeonEncounter 3410, as live) but live spawns her nowhere Karrz went, and
// neither do we (2026_11_27_40): her encounter stays NOT_STARTED, so the clear is complete without her.
std::vector<uint32_t> event_summoned_bosses() const override { return { 255997 }; }
};
} // anonymous
@@ -1,8 +1,10 @@
// BlackmawHoldScript - per-dungeon advice for Blackmaw Hold (map 2974, Classic 1.60 Forever, levels 55-60).
// The creatures and the boss fights are in classic_instance_blackmaw_hold.cpp and 2026_11_19_70/71_world_forever_blackmaw_hold;
// the route (playerbot_dungeon_routes, 0044_blackmaw_hold_route.sql) and this file follow the same boss order: Withermaw,
// Bonesnout the Unbroken, Impaan the Imprisoner, the Unbound Spirit, the Blackmaw Behemoth, Elder Shaman Bloodmane, Varrox
// Bleakhoof (the shortest walk from the landing that ends at Varrox; every leg was path-checked on the 2974 navmesh).
// The boss fights are in classic_instance_blackmaw_hold.cpp, the creatures where live has them in 2026_11_26_41 (a live capture of
// 25-26 Nov 2026); the route (playerbot_dungeon_routes, 0069_blackmaw_hold_route_from_the_live_landing.sql) and this file follow
// the same boss order: Withermaw, Bonesnout the Unbroken, Impaan the Imprisoner, the Unbound Spirit, Elder Shaman Bloodmane, the
// Blackmaw Behemoth, Varrox Bleakhoof (the shortest walk from live's landing that ends with the Behemoth; every leg was path-checked
// on the 2974 navmesh). Varrox waits in a chamber 200 y below the Behemoth's hall: the way down is a one-way fall into a pool
// (0069's nav link) with no way back up, so he is last.
// The Unbound Spirit cannot be hit until Elder Bramblesnap's ritual has run; it starts when the group comes near him, so
// walking to the Spirit's spot is enough.
@@ -48,19 +50,19 @@ public:
247198, // Bonesnout the Unbroken
247206, // Impaan the Imprisoner
247231, // Unbound Spirit
247207, // Blackmaw Behemoth
247209, // Elder Shaman Bloodmane
247207, // Blackmaw Behemoth
247234, // Varrox Bleakhoof
};
// 1:1 with `bosses`: their spawn spots (2026_11_19_70_world_forever_blackmaw_hold.sql).
// 1:1 with `bosses`: live's spawn spots (2026_11_26_41_world_forever_blackmaw_hold_live_spawns.sql).
a.progression_waypoints = {
{ 3694.7f, 3428.0f, 302.4f }, // Withermaw
{ 3386.7f, 3370.7f, 249.98f }, // Bonesnout the Unbroken
{ 3320.0f, 3578.7f, 343.74f }, // Impaan the Imprisoner
{ 3265.0f, 2920.0f, 205.09f }, // Unbound Spirit (Elder Bramblesnap stands 14 y away)
{ 3665.0f, 2905.0f, 172.26f }, // Blackmaw Behemoth
{ 3484.98f, 2968.62f, 138.75f }, // Elder Shaman Bloodmane
{ 3556.27f, 2819.47f, 175.98f }, // Varrox Bleakhoof
{ 3734.3f, 3369.2f, 284.2f }, // Withermaw (by her grotto; the Tunnelweb Matriarch stands 98 y north-west)
{ 3297.8f, 3409.8f, 250.0f }, // Bonesnout the Unbroken
{ 3348.1f, 3641.9f, 342.9f }, // Impaan the Imprisoner
{ 3249.1f, 2911.5f, 204.9f }, // Unbound Spirit (Elder Bramblesnap stands 45 y away)
{ 3681.3f, 2868.8f, 172.2f }, // Elder Shaman Bloodmane (the east cave)
{ 3479.6f, 2962.0f, 136.6f }, // Blackmaw Behemoth (low in the west hall, Clawbert with him)
{ 3482.4f, 3001.0f, -62.5f }, // Varrox Bleakhoof (the chamber below the hall, by the Instance Portal)
};
return a;
}
@@ -18,6 +18,13 @@ public:
uint32_t map_id() const override { return 469; }
char const* name() const override { return "blackwing_lair"; }
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
11583, // Nefarian: summoned by Lord Victor Nefarius (classic_boss_victor_nefarius)
};
}
DungeonAdvice get_advice(BotSnapshotView const& /*s*/) const override
{
DungeonAdvice a;
@@ -63,7 +63,7 @@ DungeonAdvice DeadminesClassicAdvice()
{ -22.8f, -797.3f, 20.4f }, // Mr. Smite
{ -69.0f, -808.0f, 40.8f }, // Captain Greenskin
{ -87.4f, -819.9f, 39.3f }, // Edwin VanCleef
{ -67.6f, -853.7f, 17.1f }, // Cookie
{ -110.0f, -844.9f, 16.9f }, // Cookie (his spawn; the old spot was 43 y off it)
};
return a;
}
@@ -103,7 +103,7 @@ public:
11467, // Tsu'zee
11496, // Immol'thar
11486 }, // Prince Tortheldrin (West final)
{ { 13.5f, 478.3f, -23.3f }, { -106.3f, 551.3f, -4.4f }, { -14.6f, 542.1f, 28.6f }, { 128.6f, 561.8f, -4.3f },
{ { 13.5f, 478.3f, -23.3f }, { 41.5f, 577.9f, -3.6f }, { -14.6f, 542.1f, 28.6f }, { 128.6f, 561.8f, -4.3f },
{ -40.5f, 811.1f, -29.4f }, { 132.6f, 625.9f, -48.4f } },
{ 33.1083f, 158.977f, -3.47126f } },
{ { 14326, // Guard Mol'dar
@@ -1,6 +1,6 @@
// ExcavationSiteScript - Excavation Site: Wetlands (Forever, map 2998, levels 25-30).
// Encounters (DungeonEncounter.db2): Saltspine, Shadetooth, Highland Horror, Relic Guardian (last). The Relic Guardian sleeps
// uninteractible until someone uses the Archival Panel (classic_instance_excavation_site_wetlands.cpp).
// uninteractible until someone uses the Archival Panel (classic_instance_excavation_site_wetlands.cpp); the tank uses it.
//
// Without a script the tank had no boss to walk to: it cleared every pack it could see, walking north away from Saltspine
// (-3935,-2019) and never closer than about 100 y to him, until the priest was dry from 20 minutes of trash fights
@@ -26,14 +26,19 @@ public:
260322, // Saltspine
260325, // Shadetooth
260808, // Highland Horror
260326, // Relic Guardian (last)
};
// The Relic Guardian (260326) is left out: he cannot be attacked until the Archival Panel is used.
// The waypoints are the boss spawns (world DB), index for index with the bosses above.
a.progression_waypoints = {
{ -3935.1f, -2019.2f, 146.2f }, // Saltspine
{ -3826.9f, -1824.0f, 137.1f }, // Shadetooth
{ -3782.6f, -1634.0f, 134.0f }, // Highland Horror
{ -3987.7f, -1917.2f, 163.2f }, // Relic Guardian
};
// The Relic Guardian sleeps (uninteractible) until someone uses the Archival Panel 18 y from him, as players do. Walking to
// his waypoint brings the tank within reach of the panel, and idle:dungeon_use_gate_lever uses it while he is alive; he
// wakes and attacks whoever used it. Without this the bots stopped after the Highland Horror and the run never ended.
a.use_go_entries = { 640041 }; // Archival Panel
return a;
}
};
@@ -28,6 +28,13 @@ public:
};
}
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
10339, // Gyth: summoned by Lord Victor Nefarius after the stadium waves (classic_instance_blackrock_spire)
};
}
DungeonAdvice get_advice(BotSnapshotView const& s) const override
{
DungeonAdvice a;
@@ -18,6 +18,14 @@ public:
uint32_t map_id() const override { return 409; }
char const* name() const override { return "molten_core"; }
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
12018, // Majordomo Executus: summoned when the eight runes are out (classic_instance_molten_core)
11502, // Ragnaros: summoned by Majordomo's event (classic_boss_majordomo_executus)
};
}
DungeonAdvice get_advice(BotSnapshotView const& /*s*/) const override
{
DungeonAdvice a;
@@ -22,6 +22,13 @@ public:
uint32_t map_id() const override { return 533; }
char const* name() const override { return "naxxramas"; }
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
15989, // Sapphiron: summoned by the instance (classic_instance_naxxramas)
};
}
DungeonAdvice get_advice(BotSnapshotView const& /*s*/) const override
{
DungeonAdvice a;
@@ -164,8 +171,10 @@ public:
{ 2642.1f, -3387.0f, 285.5f }, // Gothik the Harvester
{ 2520.5f, -2955.4f, 245.6f }, // Four Horsemen room
// Construct Quarter
{ 3256.4f, -3230.3f, 294.1f }, // Patchwerk
{ 3227.6f, -3378.3f, 311.3f }, // Grobbulus
// Patchwerk and Grobbulus stood at other spots (3256.4,-3230.3 and 3227.6,-3378.3), 52 y and 44 y from their Classic spawns
// (af59c boss smoketest, DungeonBossSpawns); every other boss here sits on its spawn. Both spawns are reachable on the mesh.
{ 3308.5f, -3232.1f, 294.2f }, // Patchwerk
{ 3205.4f, -3341.9f, 320.2f }, // Grobbulus
{ 3283.1f, -3157.0f, 297.8f }, // Gluth
{ 3513.8f, -2926.6f, 302.9f }, // Thaddius
// Frostwyrm Lair
@@ -87,7 +87,7 @@ public:
{ 2468.7f, 1006.8f, 23.8f }, // Glutton
{ 2466.6f, 671.4f, 63.5f }, // Mordresh Fire Eye
{ 2403.4f, 960.9f, 55.1f }, // Amnennar the Coldbringer
{ 2413.0f, 1025.9f, 37.9f }, // Ragglesnout
{ 2453.3f, 947.5f, 36.0f }, // Ragglesnout (his spawn; the old spot was 88 y off it)
};
return a;
}
@@ -20,6 +20,13 @@ public:
uint32_t map_id() const override { return 2999; }
char const* name() const override { return "ruinsoflordaeron"; }
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
250631, // The Abandoned: comes out of the statue (classic_instance_ruins_of_lordaeron)
};
}
DungeonAdvice get_advice(BotSnapshotView const& /*s*/) const override
{
DungeonAdvice a;
@@ -44,6 +44,15 @@ DungeonAdvice ShadowfangKeepClassicAdvice()
};
// Fenrus the Devourer's Toxic Saliva (spell_template: periodic damage, poison), cleansed first.
a.dispel_priority_spells = { 7125 };
// The Courtyard Door to Razorclaw opens when a prisoner of Rethilgore's cells is freed: a player talks to him once Rethilgore is
// dead (gossip 301 / 302, the first option), he walks to the door and opens it (his waypoint script sets the instance's free-NPC
// data). Sorcerer Ashcrombe speaks to the Alliance, Deathstalker Adamant to the Horde; the other one is hostile and is left
// alone. Spawns from the Classic creature data (map 33). Nobody talked to them, so the party walked back and forth at the shut
// door for 45 minutes (sfk_full af58).
a.door_talks = {
{ 3850, -240.9f, 2122.6f, 81.3f, 3886, { 3914 } }, // Sorcerer Ashcrombe
{ 3849, -243.7f, 2113.7f, 81.3f, 3886, { 3914 } }, // Deathstalker Adamant
};
a.bosses = {
3914, // Rethilgore
3886, // Razorclaw the Butcher
@@ -1,9 +1,12 @@
// ShapersTerraceScript - per-dungeon advice for The Shaper's Terrace (map 3001, Classic 1.60 Forever, levels 58-60).
// The creatures and the boss fights are in classic_instance_shapers_terrace.cpp and 2026_11_19_72_world_forever_shapers_terrace.sql;
// the route (playerbot_dungeon_routes, 0045_shapers_terrace_route.sql) and this file follow the same boss order: Venomridge, Bolt,
// Cinder, Tor'Rel and Izha'Rel, Snowtalon, Vitrix, Titanosaur, Thunderhoof, King Op, the Direhorn Matriarch, Nanaya (the shortest
// walk from the landing that ends at Nanaya, about 4150 y; the journal's order would be 10100 y; every leg was path-checked on the
// 3001 navmesh).
// the route (playerbot_dungeon_routes, 0070_shapers_terrace_route_not_through_the_titanic_door.sql) and this file follow the same boss
// order, one wing at a time from live's landing ledge (the bots jump off it into the pool, a nav link): the north (Cinder, Snowtalon,
// Vitrix), the middle (Tor'Rel and Izha'Rel, Venomridge, Bolt), the south (Thunderhoof, King Op, the Direhorn Matriarch),
// then Nanaya (the shortest walk from the pool that ends at Nanaya, about 4140 y; every leg was path-checked on the 3001 navmesh).
// The standing bosses are at live's spots (world 2026_11_25_82, Karrz's capture of 25 Nov 2026); the five live summons at their
// panels stand at ours, Snowtalon beside his ice panel. The Titanosaur is not a boss of the dungeon: he stands behind the Titanic
// Door, live's locked raid gate (Karrz used it 12 times, it never opened), and a closed door is not walked through.
#include "../DungeonScript.h"
@@ -29,32 +32,43 @@ public:
1291380, // Chain Lightning (Nanaya, yellow panel)
8364, // Blizzard (Nanaya, blue panel)
};
// Cinder's Conflagration confuses a player who is not the tank for 4 s and every second burns every ally within 5 y of them
// for 300 (16806, radius index 8; the area check adds the 1.5 y combat reach of whoever it hits). shapers_full af61 (22 Nov):
// the five stood within 5 y of each other at Cinder and the mage died to it. The others keep 7 y from its carrier.
a.keep_clear_of_carriers = {
{ 1310512, 7.0f }, // Conflagration (Cinder)
};
// Vitrix's Poison Shock (1312870, instant, radius index 13: 10 y round its target) hit two of the group for 1269 and 1470 in
// one cast at 6.5 and 10.1 y from him (shapers_full af63, 23 Nov), and the priest, healing the stack through every cast, ran
// out of mana. The ranged and the healer spread 10 y from everyone.
a.spread_from_bosses = {
{ 272561, 10.0f }, // Vitrix
};
a.bosses = {
261813, // Venomridge
262081, // Bolt
261974, // Cinder
261811, // Tor'Rel (with Izha'Rel)
262297, // Snowtalon
272561, // Vitrix
253201, // Titanosaur
261811, // Tor'Rel (with Izha'Rel)
261813, // Venomridge
262081, // Bolt
261812, // Thunderhoof
261993, // King Op
262127, // Direhorn Matriarch
261809, // Nanaya
};
// 1:1 with `bosses`: their spawn spots (2026_11_19_72_world_forever_shapers_terrace.sql).
// 1:1 with `bosses`: their spawn spots (2026_11_25_82_world_forever_shapers_terrace_live_spawns.sql; the summoned five from
// 2026_11_22_79, Snowtalon moved by 82).
a.progression_waypoints = {
{ -5912.5f, -1220.8f, 8.88f }, // Venomridge
{ -5935.0f, -1181.8f, 9.05f }, // Bolt
{ -5904.2f, -862.5f, 112.81f }, // Cinder
{ -5687.5f, -745.8f, 25.93f }, // Tor'Rel
{ -5687.5f, -604.2f, 13.02f }, // Snowtalon
{ -5520.8f, -845.8f, 22.18f }, // Vitrix
{ -5662.5f, -1454.2f, 36.37f }, // Titanosaur
{ -6020.8f, -1554.2f, 9.37f }, // Thunderhoof
{ -6020.8f, -1829.2f, 57.07f }, // King Op
{ -5729.2f, -1762.5f, 34.07f }, // Direhorn Matriarch
{ -5854.2f, -1587.5f, 37.14f }, // Nanaya
{ -5904.2f, -862.5f, 113.15f }, // Cinder
{ -5443.1f, -792.4f, 21.75f }, // Snowtalon
{ -5520.8f, -845.8f, 22.67f }, // Vitrix
{ -5628.3f, -1223.8f, 33.84f }, // Tor'Rel
{ -5908.8f, -1192.2f, 6.80f }, // Venomridge
{ -5933.0f, -1183.3f, 9.12f }, // Bolt
{ -5952.4f, -1463.5f, 8.57f }, // Thunderhoof
{ -6107.1f, -1971.4f, 43.60f }, // King Op
{ -5862.1f, -1739.6f, 13.21f }, // Direhorn Matriarch
{ -5854.2f, -1587.5f, 37.31f }, // Nanaya
};
return a;
}
@@ -30,6 +30,13 @@ public:
};
}
std::vector<uint32_t> scripted_spawn_bosses() const override
{
return {
10439, // Ramstein the Gorger: summoned by the instance after the abominations (classic_instance_stratholme)
};
}
DungeonAdvice get_advice(BotSnapshotView const& s) const override
{
DungeonAdvice a;
@@ -112,7 +112,7 @@ public:
// creature row — skipped); Eye/Body of C'Thun share a spawn.
a.progression_waypoints = {
{ -8346.0f, 2081.0f, 125.7f }, // Prophet Skeram
{ -8598.5f, 2165.3f, -4.0f }, // Bug Trio chamber (Vem spawn)
{ -8598.5f, 2165.3f, -4.0f }, // Bug Trio chamber: node 14 of Vem's patrol (path 800876030), 11 y from Yauj
{ -8302.5f, 1657.7f, -29.8f }, // Battleguard Sartura
{ -8085.4f, 1196.7f, -92.0f }, // Fankriss the Unyielding
{ -7992.4f, 908.2f, -52.6f }, // Viscidus
+7 -2
View File
@@ -139,7 +139,9 @@ FormationOffset ComputeOwnerSlotOffset(FormationType type, uint32_t index, uint3
// Concentric rings round the owner, inner rings first (tanks and melee, the order the caller sorted by), each ring
// holding as many bots as fit `spacing` apart on its circumference. 40 bots make four compact rings instead of one
// 25 y circle. The outer ring is spread evenly over the bots it actually has; odd rings are turned half a step so
// nobody stands directly behind another. Slot 0 is directly behind the owner.
// nobody stands directly behind another. Each ring fills from the front: slot 0 ahead of the owner, then left and
// right in turn towards his back, so the tanks (sorted first) lead and the healers (sorted last) close the ring
// behind him. Before, slot 0 was directly behind the owner and the tank trailed the whole group (row 348).
uint32_t ring = 0, first = 0, in_ring = 0;
float radius = 0.0f;
for (;; ++ring)
@@ -153,7 +155,10 @@ FormationOffset ComputeOwnerSlotOffset(FormationType type, uint32_t index, uint3
}
uint32_t const pos = index - first;
float const step = 2.0f * kPi / float(in_ring);
float const a = kPi + step * (float(pos) + (ring % 2 ? 0.5f : 0.0f)) + jit(21, 0.25f * step);
// Even rings: 0, +1, -1, +2, -2 ... steps; odd rings (half a step turned): -0.5, +0.5, -1.5, +1.5 ... (+ = the owner's left).
float const a = (ring % 2 == 0)
? (pos % 2 == 1 ? 1.0f : -1.0f) * step * float((pos + 1) / 2) + jit(21, 0.25f * step)
: (pos % 2 == 1 ? 1.0f : -1.0f) * step * (float(pos / 2) + 0.5f) + jit(21, 0.25f * step);
float const r = radius + jit(22, 0.2f * spacing);
return FromLocal(r * std::cos(a), r * std::sin(a));
}
+4 -2
View File
@@ -31,14 +31,16 @@ public:
return it->second.gated ? Verdict::Gated : Verdict::Walkable;
}
void Note(std::uint64_t pack, bool gated, std::uint32_t now_ms)
// `gated_ms`: how long a gated verdict stands. A pack the tank could not pull at all (no opener spot, or an opener and a hand pull
// that never woke it: a door or a wall between) is passed by for longer than one it can only walk to the long way round.
void Note(std::uint64_t pack, bool gated, std::uint32_t now_ms, std::uint32_t gated_ms = kGatedMs)
{
for (auto it = entries_.begin(); it != entries_.end();)
{
if (std::int32_t(now_ms - it->second.until_ms) >= 0) it = entries_.erase(it);
else ++it;
}
entries_[pack] = Entry{ now_ms + (gated ? kGatedMs : kWalkableMs), gated };
entries_[pack] = Entry{ now_ms + (gated ? gated_ms : kWalkableMs), gated };
}
void Clear() { entries_.clear(); }
+83
View File
@@ -0,0 +1,83 @@
// PullDelay - the damage dealers' short wait after their tank's pull (PlayerbotV2.Threat.PartyPullDelayMs).
//
// VempirE, Discord 2026-11-22: "dps bots wait a few seconds after the tank pulls". In a group led by a player, with a tank bot
// in it and outside the raid rules, a damage dealer starts its first attack of a fight only once the wait has run, whatever
// threat the tank has built (at low level one hit is the whole opening lead, and the DPS opened with it).
//
// The wait sits in BotIntentEmitter::start_attack, the one call every engage path goes through: the dev run of af76 had the
// rogue open 0.1 s after the tank by a path that never asked the combat state's threat hold. State_InCombat asks it as well,
// so a bot already swinging stops, and its group-fight pick does not start the attack it would stop on the next tick.
//
// One wait per fight and bot, not per mob: the clock starts at the bot's first held start and restarts when the bot has not
// been held for kPullDelayGapMs. Never held: a mob on this bot, on another member or on a member's pet (self-defence), a mob
// of someone outside the group, the leader's Attack or /focus on that mob, tanks and healers.
#pragma once
#include "BotAI.h"
#include "BotSnapshot.h"
#include "BotSnapshotView.h"
#include "../Services.h"
#include "Util/ConfigReader.h"
#include "Log.h"
#include <mutex>
#include <unordered_map>
namespace Playerbot {
constexpr uint32 kPullDelayGapMs = 8000;
inline bool PartyPullDelayHolds(BotAI const& ai, BotSnapshotView const& s, ObjectGuid target)
{
uint32 const delay = Services::Config().threat_party_pull_delay_ms();
if (!delay || target.IsEmpty() || !target.IsCreatureOrVehicle()) return false;
if (!s.is_led_by_player() || s.raid_rules() || s.in_battleground()) return false;
ObjectGuid const tank = s.group_tank();
if (tank.IsEmpty() || tank == s.guid()) return false;
Role const role = ai.effective_role(s);
if (role == Role::Tank || role == Role::Healer) return false;
if (NearbyUnit const* u = s.hostile_unit(target))
{
if (u->hp <= 0) return false;
switch (ThreatVictim(u->victim_kind))
{
case ThreatVictim::Me:
case ThreatVictim::Member:
case ThreatVictim::MemberPet:
case ThreatVictim::Other:
return false;
default:
break;
}
}
uint32 const now = s.published_at_ms();
if (ai.focus_target() == target ||
(ai.is_manual_mode(now) && ai.owner_command() == BotAI::OwnerCommand::Engage && ai.owner_target() == target))
return false;
struct Clock { uint32 first_ms; uint32 last_ms; };
static std::mutex mu;
static std::unordered_map<uint64, Clock> clocks;
uint64 const key = s.guid().GetCounter();
std::lock_guard<std::mutex> lock(mu);
if (clocks.size() > 2048)
for (auto it = clocks.begin(); it != clocks.end();)
it = (now - it->second.last_ms > 60'000u) ? clocks.erase(it) : std::next(it);
auto [it, inserted] = clocks.try_emplace(key, Clock{ now, now });
if (!inserted)
{
if (now - it->second.last_ms > kPullDelayGapMs)
{
it->second.first_ms = now;
inserted = true;
}
it->second.last_ms = now;
}
bool const holds = now - it->second.first_ms < delay;
if (inserted)
TC_LOG_INFO("playerbot.v2", "[pull_delay] {} waits {} ms after the tank's pull before attacking {}", s.name(), delay,
target.ToString());
return holds;
}
} // namespace Playerbot
@@ -6,6 +6,7 @@
#include "Bot/QuestDoable.h"
#include "Bot/QuestObjectiveLocations.h"
#include "Services.h"
#include "Fleet/OwnerRegistry.h"
#include "Util/ConfigReader.h"
#include "Player.h"
#include "GameObject.h"
@@ -21,6 +22,7 @@
#include <cmath>
#include <mutex>
#include <unordered_map>
#include <unordered_set>
namespace Playerbot {
namespace CompanionQuest {
@@ -34,7 +36,8 @@ constexpr float kBotReachYd = 40.0f;
// Quest objects: near the owner, without a long detour for the bot.
constexpr float kObjectOwnerYd = 25.0f;
constexpr float kObjectBotYd = 30.0f;
// Owner within this of a quest object he needs too: he is about to click it himself, leave it to him.
// Owner within this of a quest object that goes away when used and that he still needs: he is about to click it himself, leave it
// to him.
constexpr float kObjectOwnerAtYd = 6.0f;
constexpr size_t kMaxPerList = 6;
@@ -65,6 +68,24 @@ bool FindGiverPos(BotSnapshot const& snap, ObjectGuid guid, float& x, float& y)
return false;
}
// "[cq]" line, at most every 15 s per bot: what the companion quest help saw (or why it stopped) for a bot that has quests and a
// quest partner. Without it a companion that never accepts, hands in or clicks leaves no trace of which gate held it.
void Trace(Player const* bot, CompanionQuestState const& cq, char const* why)
{
static std::mutex mtx;
static std::unordered_map<uint64, uint32> last;
uint32 const now = GameTime::GetGameTimeMS();
{
std::lock_guard lk(mtx);
if (last.size() > 4096) last.clear();
uint32& at = last[bot->GetGUID().GetCounter()];
if (at != 0 && now - at < 15000u) return;
at = now;
}
TC_LOG_INFO("playerbot.v2", "[cq] {} {}: accept {} turn_in {} share {} objects {}, bot in combat {}", bot->GetName(), why,
cq.accept.size(), cq.turn_in.size(), cq.share.size(), cq.objects.size(), bot->IsInCombat() ? 1 : 0);
}
bool ListHas(std::vector<CompanionQuestAction> const& v, ObjectGuid giver, uint32 quest_id)
{
for (auto const& a : v)
@@ -72,19 +93,41 @@ bool ListHas(std::vector<CompanionQuestAction> const& v, ObjectGuid giver, uint3
return false;
}
bool ObjectiveOpen(QuestObjectiveEntry const& o)
{
if (o.amount <= 0 || o.progress >= o.amount) return false;
return !(o.flags & (QUEST_OBJECTIVE_FLAG_HIDDEN | QUEST_OBJECTIVE_FLAG_OPTIONAL));
}
// Is the bot's open objective served by this game object? GAMEOBJECT objectives name the entry; ITEM
// objectives are served by a chest / node / prop whose loot (or gameobject_questitem row) yields the item.
bool ObjectServesObjective(QuestObjectiveEntry const& o, NearbyObject const& go)
{
if (o.amount <= 0 || o.progress >= o.amount) return false;
if (o.flags & (/*HIDDEN*/ QUEST_OBJECTIVE_FLAG_HIDDEN | /*OPTIONAL*/ QUEST_OBJECTIVE_FLAG_OPTIONAL)) return false;
if (o.type == /*GAMEOBJECT*/ 2)
if (!ObjectiveOpen(o)) return false;
if (o.type == QUEST_OBJECTIVE_GAMEOBJECT)
return uint32(o.object_id) == go.entry;
if (o.type == /*ITEM*/ 1)
if (o.type == QUEST_OBJECTIVE_ITEM)
return o.object_id > 0 && QuestItemDropsFromGameObject(uint32(o.object_id), go.entry);
return false;
}
// The open objective of `q` this object serves, or nullptr. Beside the objectives above: an object that is there for this
// quest (its template names the quest: a goober, a prop, a chest only a holder of the quest can use) serves the quest's first
// open objective of any other kind. Those are the "use the X" objectives that a script or the object's spell credits as a
// kill or an event (a summoned alt stood beside such objects and never used them, row 240).
QuestObjectiveEntry const* ServedObjective(QuestEntry const& q, NearbyObject const& go, GameObjectTemplate const* tmpl)
{
for (auto const& o : q.objectives)
if (ObjectServesObjective(o, go))
return &o;
if (!tmpl || tmpl->GetQuestID() != q.quest_id)
return nullptr;
for (auto const& o : q.objectives)
if (ObjectiveOpen(o) && o.type != QUEST_OBJECTIVE_GAMEOBJECT && o.type != QUEST_OBJECTIVE_ITEM)
return &o;
return nullptr;
}
} // namespace
void ArmLatch(uint64 bot_low, Latch which, uint32 now_ms, uint32 window_ms)
@@ -121,6 +164,25 @@ std::string QuestLabel(uint32 quest_id)
return "quest " + std::to_string(quest_id);
}
bool QuestStartedByItemOnly(uint32 quest_id)
{
static std::unordered_set<uint32> item_only;
static std::once_flag built;
std::call_once(built, []
{
std::unordered_set<uint32> given; // quests a creature or game object hands out
for (auto const& [giver, q] : *sObjectMgr->GetCreatureQuestRelationMapHACK())
given.insert(q);
for (auto const& [giver, q] : *sObjectMgr->GetGOQuestRelationMapHACK())
given.insert(q);
for (auto const& [entry, tmpl] : sObjectMgr->GetItemTemplateStore())
if (uint32 const q = tmpl.GetStartQuest())
if (!given.contains(q))
item_only.insert(q);
});
return item_only.contains(quest_id);
}
bool BotCanTake(Player* bot, uint32 quest_id)
{
return bot && bot->SatisfyQuestLog(false) && BotCanStillTakeQuestForHub(bot, quest_id);
@@ -133,8 +195,14 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
// The quest partner is the owner, or, for a world bot a player invited (no owner), the player who leads the group: he gets the same
// accept / turn-in / share / quest-object help (a grouped world bot used to leave a finished quest unrewarded).
ObjectGuid const partner = snap.owner_in_group ? snap.owner_guid : (snap.led_by_player ? snap.controller_guid : ObjectGuid::Empty);
if (!bot || partner.IsEmpty() || !bot->IsAlive())
if (!bot || partner.IsEmpty())
return;
bool const trace = !snap.quest_log.quests.empty() && Services::Owners().OwnerCharacter(bot->GetGUID().GetCounter()) != 0;
if (!bot->IsAlive())
{
if (trace) Trace(bot, cq, "dead");
return;
}
if (bot->InBattleground() || bot->InArena())
return;
ConfigReader const& cfg = Services::Config();
@@ -147,7 +215,10 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
Player* owner = ObjectAccessor::FindConnectedPlayer(partner);
if (!owner || !owner->IsInWorld() || owner->GetMapId() != bot->GetMapId() || owner == bot)
{
if (trace) Trace(bot, cq, owner == bot ? "partner is the bot itself" : "partner offline or on another map");
return;
}
cq.owner_here = true;
cq.owner_x = owner->GetPositionX();
cq.owner_y = owner->GetPositionY();
@@ -172,7 +243,9 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
if (ListHas(cq.accept, giver, qid)) continue;
if (bot->GetQuestStatus(qid) != QUEST_STATUS_NONE) continue;
QuestStatus const os = owner->GetQuestStatus(qid);
bool const owner_holds = os == QUEST_STATUS_INCOMPLETE;
// Complete counts: a quest with nothing to do but hand it in (a note found at a camp, quest 79008) is complete
// the moment the owner takes it, and the companion never followed him into it.
bool const owner_holds = os == QUEST_STATUS_INCOMPLETE || os == QUEST_STATUS_COMPLETE;
if (!owner_holds && !accept_all) continue;
// The player holds the quest: the companion takes it too, whatever other bots elsewhere gave up on.
if (ai && ai->quest_blacklisted(qid, now_ms, /*fleet_memory*/ !owner_holds)) continue;
@@ -194,6 +267,27 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
if (o.go_type != GAMEOBJECT_TYPE_QUESTGIVER) continue;
consider(o.guid, o.x, o.y, sObjectMgr->GetGOQuestRelations(o.entry));
}
// A quest an item starts (a crest from a dungeon boss, a note): no giver to walk to, and the one item went to the owner.
// On his "accept" the companion takes it from him like a shared quest (row 240: Crest of Lordaeron 95189).
if (accept_all && Dist2d(bx, by, cq.owner_x, cq.owner_y) <= kBotReachYd)
{
for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE && cq.accept.size() < kMaxPerList; ++slot)
{
uint32 const qid = owner->GetQuestSlotQuestId(slot);
if (qid == 0 || !QuestStartedByItemOnly(qid)) continue;
QuestStatus const os = owner->GetQuestStatus(qid);
if (os != QUEST_STATUS_INCOMPLETE && os != QUEST_STATUS_COMPLETE) continue;
if (bot->GetQuestStatus(qid) != QUEST_STATUS_NONE) continue;
if (ListHas(cq.accept, owner->GetGUID(), qid)) continue;
if (ai && ai->quest_blacklisted(qid, now_ms, /*fleet_memory*/ false)) continue;
if (!BotCanTake(bot, qid)) continue;
CompanionQuestAction a;
a.giver = owner->GetGUID();
a.quest_id = qid;
a.via_order = true;
cq.accept.push_back(a);
}
}
}
// ---- turn in: the bot's quest is complete and the owner is at the ender ----------------------------------
@@ -288,21 +382,26 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
{
if (cq.objects.size() >= kMaxPerList) break;
if (go.go_type != GAMEOBJECT_TYPE_CHEST && go.go_type != GAMEOBJECT_TYPE_GOOBER &&
go.go_type != GAMEOBJECT_TYPE_GATHERING_NODE && go.go_type != GAMEOBJECT_TYPE_GENERIC)
go.go_type != GAMEOBJECT_TYPE_GATHERING_NODE && go.go_type != GAMEOBJECT_TYPE_GENERIC &&
go.go_type != GAMEOBJECT_TYPE_BUTTON)
continue;
if (Dist2d(bx, by, go.x, go.y) > kObjectBotYd) continue;
float const od = Dist2d(cq.owner_x, cq.owner_y, go.x, go.y);
if (od > kObjectOwnerYd) continue;
GameObjectTemplate const* tmpl = sObjectMgr->GetGameObjectTemplate(go.entry);
for (auto const& q : snap.quest_log.quests)
{
if (q.state == 1) continue;
bool served = false;
for (auto const& o : q.objectives)
if (ObjectServesObjective(o, go)) { served = true; break; }
QuestObjectiveEntry const* served = ServedObjective(q, go, tmpl);
if (!served) continue;
// The owner is standing at it on the same quest: he clicks it first (a quest prop can despawn
// for everyone); the bot takes it once he steps away, or at once when he does not need it.
if (od <= kObjectOwnerAtYd && owner->GetQuestStatus(q.quest_id) == QUEST_STATUS_INCOMPLETE) continue;
// The owner is standing at an object that goes away when used and still needs it for the same objective: he
// clicks it first; the bot takes it once he steps away or has his credit. An object every holder of the quest
// can use (most quest props and goobers) is used at once: an owner who clicked it and then waited beside it for
// his summoned alt held the alt back for good (row 240).
if (od <= kObjectOwnerAtYd && tmpl && tmpl->IsDespawnAtAction() &&
owner->GetQuestStatus(q.quest_id) == QUEST_STATUS_INCOMPLETE &&
!owner->IsQuestObjectiveComplete(q.quest_id, served->id))
continue;
CompanionQuestObject co;
co.go = go.guid;
co.entry = go.entry;
@@ -312,6 +411,8 @@ void BuildState(Player* bot, BotAI* ai, BotSnapshot& snap)
}
}
}
if (trace)
Trace(bot, cq, owner->IsInCombat() ? "built, partner in combat" : "built");
}
} // namespace CompanionQuest
@@ -85,6 +85,11 @@ bool BotCanTake(Player* bot, uint32 quest_id);
// "[Title]" for logs and whispers: the quest's log title, or "quest <id>" when unknown. Static data, any thread.
std::string QuestLabel(uint32 quest_id);
// True for a quest that an item starts (the item's StartQuest names it: a dropped crest, a note) and that no creature or game
// object hands out. A group mate who holds one can pass it to his companion (API::accept_quest with a player giver). Static
// data; the first call builds the table from the item templates (world thread at the latest).
bool QuestStartedByItemOnly(uint32 quest_id);
} // namespace CompanionQuest
} // namespace Playerbot
@@ -246,8 +246,16 @@ std::vector<std::string> AcceptAll(Player* sender, Player* bot, std::string_view
++taken;
}
// A quest an item started that the sender holds ("accept <crest quest>"): no giver has it, I take it from him (the same rule).
bool const from_sender = want && sender && taken == 0 && CompanionQuest::QuestStartedByItemOnly(want) &&
(sender->GetQuestStatus(want) == QUEST_STATUS_INCOMPLETE || sender->GetQuestStatus(want) == QUEST_STATUS_COMPLETE);
if (from_sender)
{
CompanionQuest::ArmLatch(t.id, CompanionQuest::Latch::AcceptAll, GameTime::GetGameTimeMS(), kOrderWindowMs);
out.push_back(fmt::format("I'll take {} from you.", CompanionQuest::QuestLabel(want)));
}
// Walk to the NPCs close to me and take what they offer (the idle:companion_quest_accept rule), for 45 s.
if (want == 0 && needle.empty())
else if (want == 0 && needle.empty())
{
CompanionQuest::ArmLatch(t.id, CompanionQuest::Latch::AcceptAll, GameTime::GetGameTimeMS(), kOrderWindowMs);
if (taken == 0)
+39 -2
View File
@@ -1,18 +1,55 @@
// A quest drop this bot is allowed to take. A bot a player leads loots nothing else: the player takes the rest, but each member with the
// quest has to loot its own quest items (they appear on the corpse for that member alone).
// quest has to loot its own quest items.
#pragma once
#include "Diagnostics/ScenarioHuman.h"
#include "Group.h"
#include "Loot.h"
#include "Player.h"
namespace Playerbot
{
// A quest drop there is one of for the whole group (not ITEM_FLAG_MULTI_DROP: the first member to loot it takes it from the others) that
// a player of the group may loot from this corpse and still needs. It is his: the bot leaves it, as a member who also has the quest leaves
// a group's single quest drop to the player (Discord 2026-11-22, Guard: "my bots grab quest items before me, I don't even get to loot").
// A drop each member gets for himself (multi-drop), a player who has enough, or one who is not on this corpse's looter list (personal
// loot, out of range at the kill) does not hold it.
[[nodiscard]] inline bool QuestLootIsAPlayers(Player const* bot, Loot const* loot, LootItem const& it)
{
if (it.freeforall || !loot)
return false;
Group const* g = bot->GetGroup();
if (!g)
return false;
for (GroupReference const& ref : g->GetMembers())
{
Player const* m = ref.GetSource();
if (!m || m == bot || !Scenario::PlaysAsHuman(m) || !m->IsInWorld())
continue;
if (it.HasAllowedLooter(m->GetGUID()) && m->HasQuestForItem(it.itemid))
return true;
}
return false;
}
// The first quest drop on this loot that would be the bot's but is left for a player (QuestLootIsAPlayers), 0 when none.
[[nodiscard]] inline uint32 QuestLootLeftForPlayer(Player const* p, Loot const* loot)
{
if (!loot)
return 0;
for (LootItem const& it : loot->items)
if (it.needs_quest && !it.is_looted && !it.is_blocked && it.HasAllowedLooter(p->GetGUID()) && QuestLootIsAPlayers(p, loot, it))
return it.itemid;
return 0;
}
[[nodiscard]] inline bool IsPendingQuestLoot(Player* p, Loot* loot, uint8 slot)
{
NotNormalLootItem* ffa = nullptr;
LootItem* it = loot->LootItemInSlot(slot, p, &ffa);
return it && it->needs_quest && !it->is_looted && !it->is_blocked && !(ffa && ffa->is_looted) && it->HasAllowedLooter(p->GetGUID());
return it && it->needs_quest && !it->is_looted && !it->is_blocked && !(ffa && ffa->is_looted) && it->HasAllowedLooter(p->GetGUID()) &&
!QuestLootIsAPlayers(p, loot, *it);
}
} // namespace Playerbot
@@ -14,6 +14,8 @@ void ApplyRaidAdvice(uint32_t mapId, DungeonAdvice& advice)
advice.bosses = rules->bosses;
advice.dangerous_auras.clear();
advice.spread_on_self_auras.clear();
advice.keep_clear_of_carriers.clear(); // the raid rules keep clear of carriers themselves (avoidCarrier)
advice.spread_from_bosses.clear(); // and spread by their own raid positions
advice.kite_creature_entries.clear();
advice.soak_spells.clear();
advice.stack_on_cast_spells.clear();
+502 -32
View File
@@ -31,6 +31,7 @@
#include "../ThreatLimits.h"
#include "../Dungeon/PveGroupCoordinator.h"
#include "../../Group/GroupSnapshot.h"
#include "../../Fleet/BotAccountMgr.h" // is_pool_account: a player's own character keeps its raid role
#include "../../Fleet/BotIdentityRegistry.h"
#include "../../Services.h"
#include "../../Threading/SnapshotPublisher.h"
@@ -993,6 +994,15 @@ std::unordered_map<uint64_t, uint32_t> g_lastSpread;
std::unordered_map<uint64_t, uint32_t> g_lastSpreadLog;
std::unordered_map<uint64_t, uint32_t> g_lastTankFace;
std::unordered_map<uint64_t, uint32_t> g_lastFaceAway;
constexpr float kFaceAwayReach = 10.0f; // the face-away step turns an enemy within this many yards of its tank
// Lead away (RaidRules::leadAway): when the victim last chose a spot, and that spot.
struct LeadSpot { float x, y, z; uint32_t at; };
std::unordered_map<uint64_t, LeadSpot> g_leadSpot;
std::unordered_map<uint64_t, uint32_t> g_lastLeadLog;
constexpr uint32_t kLeadEveryMs = 2000; // a victim picks a new spot at most this often
constexpr float kLeadApexBack = 2.5f; // the enemy stops about this far short of its victim: the cone's apex
constexpr float kLeadPathClear = 6.0f; // a raider this close to the enemy's walk may be taken on the way (its melee reach and a margin)
constexpr float kLeadConeMarginDeg = 10.0f;
std::unordered_map<uint64_t, uint32_t> g_lastRearStep;
std::unordered_map<uint64_t, uint32_t> g_lastCarrierLog;
std::unordered_map<uint64_t, uint32_t> g_lastBombLog;
@@ -1001,6 +1011,8 @@ std::unordered_map<uint64_t, uint32_t> g_lastDragOutLog;
std::unordered_map<uint64_t, uint32_t> g_lastIdleHoldLog;
std::unordered_map<uint64_t, uint32_t> g_lastOutOfReachLog; // [raid_target] a melee bot leaving an enemy it cannot get to, per bot
constexpr float kMeleeChaseMargin = 5.0f; // a chasing melee bot stops this far from its target
constexpr float kRangedNearReach = 30.0f; // rangedNearFirst: a ranged pick past this is ranked after every nearer one
constexpr float kRangedFarDrop = 38.0f; // rangedNearFirst: a ranged bot on a target past this leaves it for a near pick
std::unordered_map<uint64_t, uint32_t> g_lastSafeCrossLog;
// The idle pack whose aggro reach a melee bot at (bx, by) walks into on its way to an enemy at (vx, vy), or -1. The chase stops
@@ -1507,6 +1519,7 @@ constexpr float kGuardRiseScan = 100.0f; // GuardRise: the bones within
std::unordered_map<uint64_t, uint32_t> g_guardRiseLog; // bot -> last [raid_guard_rise] line (ms)
std::unordered_map<uint64_t, uint32_t> g_postHazardLog; // bot -> last [raid_post] "the post is in a hazard" line (ms)
constexpr float kFixedSpotFreshScan = 100.0f; // ... and the adds just spawned within this reach, in nobody's combat yet, are off limits too
constexpr float kFaceAwaySlotSlack = 12.0f; // ... and one holding a FaceAway add from its far side stays this close to its slot (HoldsFacedAway)
// An add of a fixed row that has reached the raid: it stands in melee with a raider, wherever that raider is (another tank's pile, a melee DPS
// beside it, a healer). bwl_nefarian 1109y: a drakonid held at a neighbour's pile (on the arc's far side, 23-26 y from the centre) or on a
@@ -1522,6 +1535,13 @@ bool EnemyInFight(Plan const& plan, uint32_t entry)
});
}
// The enemy has a FaceAway rule whose tank may stand well off the line (FaceAway::maxTurnDeg past 30).
bool TurnedFromTheSide(Plan const& plan, uint32_t entry)
{
return plan.rules && std::any_of(plan.rules->faceAway.begin(), plan.rules->faceAway.end(),
[&](FaceAway const& fa) { return fa.enemy == entry && fa.maxTurnDeg > 30.0f; });
}
bool ReachedRaid(Plan const& plan, Unit* add)
{
Unit* const v = add->GetVictim();
@@ -1546,6 +1566,42 @@ bool ReachedRaid(Plan const& plan, Unit* add)
// same way at 124 s and 145 s, and the raid never reached phase three. FetchesAdd kept every add on another tank off limits, so nobody
// relieved it.
constexpr size_t kHandOffFrom = 3, kHandOffKeep = 2;
// TankSpot::skipClassMask: a tank of a skipped class is left out of the row while a live tank of another class has a hand free (holds none of
// the row's adds). Once every other tank holds one, a further add is better on the bear than on a healer. naxx_kelthuzad kt70g (1125): at
// 291-313 s six Abominations were up, the three warriors held one each, two or three walked through the camp (#1589 on the healers for 20 s)
// while the bear stood at its slot with nothing, and the raid went from 33 alive to 28 before Kel'Thuzad came down.
bool OnEndEnemy(Plan const& plan, TankSpot const& rule, Player const* p);
// Stand::endEnemy and endAfterEnemy: whether the post has ended. With endAfterEnemy the next phase's enemy ends it only once the post's own
// enemy is gone from the fight. naxx_kelthuzad kt74b (1125): Kel'Thuzad came down at 316 s with four Soul Weavers at 100% still walking in;
// the camp posts ended, the ranged and healers spread round him east of the camp, and one Weaver (3745,-5089) killed 16 with one Wail of
// Souls at 322 s, 15 of them 22-38 y from the camp. kt74a: Wail of Souls 18 of the dead, all in phase 2.
bool StandEnded(Plan const& plan, Stand const& rule)
{
if (!EnemyInFight(plan, rule.endEnemy))
return false;
if (!rule.endAfterEnemy)
return true;
return std::none_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e) { return e->IsAlive() && e->GetEntry() == rule.enemy; });
}
bool RowSkips(Plan const& plan, TankSpot const& rule, Player const* p)
{
auto const skipped = [&](Player const* q) { return (rule.skipClassMask & (1u << (q->GetClass() - 1))) != 0; };
if (!skipped(p))
return false;
for (Member const& m : plan.members)
{
if (!m.tank || !m.p->IsAlive() || skipped(m.p) || OnEndEnemy(plan, rule, m.p))
continue;
if (std::none_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e)
{ return e->IsAlive() && InTankSpot(rule, e->GetEntry()) && e->GetVictim() == m.p; }))
return true;
}
return false;
}
bool HandedOffTo(Plan const& plan, TankSpot const& rule, Player* bot, Unit* add)
{
std::vector<Player*> idle;
@@ -1560,15 +1616,20 @@ bool HandedOffTo(Plan const& plan, TankSpot const& rule, Player* bot, Unit* add)
held.push_back(enemy);
if (held.empty())
{
if (m.bot)
if (m.bot && !RowSkips(plan, rule, m.p) && !OnEndEnemy(plan, rule, m.p)) // skipClassMask (while another tank is free), endAfterAdds
idle.push_back(m.p);
continue;
}
if (held.size() < kHandOffFrom)
// TankSpot::handOffFrom: from that many, keeping one. naxx_kelthuzad kt70a (1124): Mctankwa held two Abominations (99%, 100%) and
// a Soul Weaver at 100 s, two Abominations to 106 s, while Mctankwb stood at its slot with nothing at 97-100 s; Mortal Wound killed
// Mctankwa at 109 s.
size_t const from = rule.handOffFrom ? size_t(rule.handOffFrom) : kHandOffFrom;
size_t const keep = rule.handOffFrom ? size_t(1) : kHandOffKeep;
if (held.size() < from)
continue;
std::sort(held.begin(), held.end(), [](Unit* a, Unit* b) { return a->GetHealth() != b->GetHealth() ? a->GetHealth() < b->GetHealth()
: a->GetGUID() < b->GetGUID(); });
pool.insert(pool.end(), held.begin() + kHandOffKeep, held.end());
pool.insert(pool.end(), held.begin() + keep, held.end());
}
std::sort(pool.begin(), pool.end(), [](Unit* a, Unit* b) { return a->GetHealth() != b->GetHealth() ? a->GetHealth() > b->GetHealth()
: a->GetGUID() < b->GetGUID(); });
@@ -1587,10 +1648,29 @@ bool FetchesAdd(Plan const& plan, TankSpot const& rule, Player* bot, Unit* add)
// from 24 s to 57 s at (-7555,-1199), north of every place, and all four tanks died there at 188-208 s.
if (Unit* const v = add->GetVictim(); v && v != bot && v->IsAlive())
if (Player* const vp = v->ToPlayer())
if (std::any_of(plan.members.begin(), plan.members.end(), [&](Member const& m) { return m.p == vp && m.tank; }))
// (A tank the row skips, TankSpot::skipClassMask and RowSkips, counts as a raider: an add sent at the bear is fetched off it.)
if (std::any_of(plan.members.begin(), plan.members.end(), [&](Member const& m)
{ return m.p == vp && m.tank && !RowSkips(plan, rule, m.p); }))
return HandedOffTo(plan, rule, bot, add); // ... unless that tank holds too many and this one none
if (ReachedRaid(plan, add))
return true;
// TankSpot::fetchMax: a loose add that has not reached anybody yet is not fetched out at the edge of the room. naxx_kelthuzad kt69c
// (1124): a tank went 15 y out from its slot to a Soul Weaver at the alcove keep-out rim (3700,-5079, 31 y from the camp), found no
// spot on its far side (inside the keep-out), and the Weaver faced the camp from there: its Wail of Souls killed 28. One in melee with
// a raider is fetched wherever it is (above): kt69e, with this check first, an Abomination sent at a warrior 25 y from the camp was
// left on him and killed him 8 s later (Mortal Wound, 9,642).
// A FaceAway add turned from the side (maxTurnDeg past 30) is met where it is: it walks in slowly, facing the raider it was sent at
// across the camp (kt69f: a Weaver was on its tank 50 s, 36 y from the raid's centre, with no spot found; one at 3694,-5083 killed 8).
// TankSpot::fetchTurned: such an add is met once it is that close to (x, y), wherever the tank stands, and not before. The reach test
// below (within 15 y of the tank as well) left the tanks at their slots while it walked on to its victim at the camp: naxx_kelthuzad
// kt69o (1124): at 87 s three Weavers were in the fight, one on a tank and two on casters, at 90 s none on a tank, and at 93 s one
// 29 y south of the camp (3709,-5134) killed twelve. Further out it is still in an alcove's mouth, among the resting adds (kt69o: no spot behind a Weaver
// at 3704,-5169, "idle pack 27").
if (rule.fetchTurned > 0.0f && TurnedFromTheSide(plan, add->GetEntry()))
return Dist2D(add->GetPositionX(), add->GetPositionY(), rule.x, rule.y) <= rule.fetchTurned;
if (rule.fetchMax > 0.0f && Dist2D(add->GetPositionX(), add->GetPositionY(), rule.x, rule.y) > rule.fetchMax &&
!TurnedFromTheSide(plan, add->GetEntry()))
return false;
if (rule.reach <= 0.0f)
return bot->IsWithinDistInMap(add, kFixedSpotFetchReach);
float const fromCentre = Dist2D(add->GetPositionX(), add->GetPositionY(), rule.x, rule.y);
@@ -1751,11 +1831,44 @@ float SeenArcAngle(Plan const& plan, TankSpot const& rule, Player* bot, uint32_t
}
// waitFor (fixed rows): set to the loose add this tank waits for at its slot instead of walking out to it.
// A fixed row holds while its anchor is in the fight, or any of the adds it is for: Kel'Thuzad's phase 1 has no enemy that is always in the
// raid's combat (he is immune; each sent Soldier lives a few seconds), and the row came and went with the Soldiers.
bool FixedRowUp(Plan const& plan, TankSpot const& rule)
{
return std::any_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e)
{
return e->IsAlive() && (e->GetEntry() == rule.anchor || InTankSpot(rule, e->GetEntry()));
});
}
// TankSpot::endEnemy and endAfterAdds: whether the row has ended. With endAfterAdds the next phase's enemy ends it only once the last of the
// row's adds is dead. naxx_kelthuzad kt72a (1125): Kel'Thuzad came down at 315 s with 16 phase 1 adds up (an Abomination on a tank, Soul
// Weavers, Soldiers); the row and its forbids ended at once, the tanks took Soldiers and Weavers (Mctankwa on a Soldier with an Abomination
// assigned, a Weaver on it), and in the next 60 s Dark Blast killed 5 at once and Wail of Souls 3.
bool RowEnded(Plan const& plan, TankSpot const& rule)
{
if (!EnemyInFight(plan, rule.endEnemy))
return false;
if (!rule.endAfterAdds)
return true;
return std::none_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e) { return e->IsAlive() && InTankSpot(rule, e->GetEntry()); });
}
// TankSpot::endAfterAdds: this tank holds the next phase's enemy (Kel'Thuzad) while the row still holds the last adds: it has no slot,
// takes none of the row's adds, and counts as busy for the bear (RowSkips) and the hand-off (HandedOffTo).
bool OnEndEnemy(Plan const& plan, TankSpot const& rule, Player const* p)
{
if (!rule.endAfterAdds || !rule.endEnemy || !EnemyInFight(plan, rule.endEnemy))
return false;
Unit* const v = p->GetVictim();
return v && v->IsAlive() && v->GetEntry() == rule.endEnemy;
}
bool TankSpotFor(Plan const& plan, TankSpot const& rule, Player* bot, uint32_t now, float& outX, float& outY, Unit** waitFor = nullptr)
{
uint64_t const key = (plan.groupLow << 32) ^ rule.anchor;
TankSpotLock& lock = g_tankSpot[key];
if (EnemyInFight(plan, rule.endEnemy))
if (RowEnded(plan, rule) || OnEndEnemy(plan, rule, bot))
return false;
if (rule.fixed)
{
@@ -1772,11 +1885,7 @@ bool TankSpotFor(Plan const& plan, TankSpot const& rule, Player* bot, uint32_t n
if (waitFor)
*waitFor = v;
}
bool anchorUp = false;
for (Unit* enemy : plan.enemies)
if (enemy->GetEntry() == rule.anchor && enemy->IsAlive())
anchorUp = true;
if (!anchorUp)
if (!FixedRowUp(plan, rule))
return false;
float const along = rule.rowDeg * (float(M_PI) / 180.0f);
lock = { rule.x - rule.reach * std::cos(along + float(M_PI) * 0.5f), rule.y - rule.reach * std::sin(along + float(M_PI) * 0.5f),
@@ -1824,7 +1933,7 @@ bool TankSpotFor(Plan const& plan, TankSpot const& rule, Player* bot, uint32_t n
{
holders.clear();
for (Member const& m : plan.members)
if (m.tank && m.p && m.p->IsAlive())
if (m.tank && m.p && m.p->IsAlive() && !OnEndEnemy(plan, rule, m.p))
holders.push_back(m.p->GetGUID().GetCounter());
std::sort(holders.begin(), holders.end());
}
@@ -1854,8 +1963,13 @@ bool FaceAxisFor(Plan const& plan, Unit* enemy, uint32_t now, float& axis, float
axis = fixedBearingDeg * (float(M_PI) / 180.0f);
return true;
}
uint64_t const key = (plan.groupLow << 32) ^ enemy->GetEntry();
// One lock per creature, not per entry: Kel'Thuzad's Soul Weavers (several at once, each on its own tank round the camp) shared one
// lock and threw it away for one another every pass.
uint64_t const key = (plan.groupLow << 32) ^ enemy->GetGUID().GetCounter();
float const ex = enemy->GetPositionX(), ey = enemy->GetPositionY();
if (g_faceAxis.size() > 256)
for (auto it = g_faceAxis.begin(); it != g_faceAxis.end();)
it = (now - it->second.seenMs > 2 * kAxisStaleMs) ? g_faceAxis.erase(it) : std::next(it);
FaceAxisLock& lock = g_faceAxis[key];
if (lock.seenMs && now - lock.seenMs < kAxisStaleMs && geo::AxisHolds(lock.bossX, lock.bossY, ex, ey, kAxisDrift))
{
@@ -1881,6 +1995,28 @@ bool FaceAxisFor(Plan const& plan, Unit* enemy, uint32_t now, float& axis, float
return true;
}
// The tank holds an add of the fixed row <row> that has a FaceAway rule, and stands on its far side from the raid (the face-away step's own
// 30 degree test), so that add's back is to the raid.
bool HoldsFacedAway(Plan const& plan, RaidRules const& rules, TankSpot const& row, Player* bot, uint32_t now)
{
for (FaceAway const& fa : rules.faceAway)
{
if (!InTankSpot(row, fa.enemy))
continue;
for (Unit* enemy : plan.enemies)
{
if (enemy->GetEntry() != fa.enemy || !enemy->IsAlive() || enemy->GetVictim() != bot || !InPhase(enemy, fa.hpMax, fa.hpMin))
continue;
float axis;
if (FaceAxisFor(plan, enemy, now, axis, fa.bearingDeg) &&
geo::TankOnAxis(enemy->GetPositionX(), enemy->GetPositionY(), bot->GetPositionX(), bot->GetPositionY(), axis,
fa.maxTurnDeg * (float(M_PI) / 180.0f)))
return true;
}
}
return false;
}
// Whether (x,y) lies inside a frontal cone of <enemy> as it faces now, widened by the rule's margin, for a bot like <self>. The same sector test
// the cone step (2b) uses, so a stand point this rejects is one that step would walk the bot out of again.
bool InAnyLiveCone(RaidRules const& rules, Plan const& plan, Member const& self, Unit const* enemy, float x, float y)
@@ -2525,7 +2661,7 @@ int TanksSeenFrom(Player* bot, std::vector<Player*> const& tanks, float x, float
}
SightSpot HealerSightSpot(Plan const& plan, Stand const& rule, std::vector<Circle> const& circles, uint32_t now, Player* bot,
float& outX, float& outY, float& outZ)
float& outX, float& outY, float& outZ, float roam = kSightRoam)
{
std::vector<Player*> tanks;
for (Member const& m : plan.members)
@@ -2535,7 +2671,7 @@ SightSpot HealerSightSpot(Plan const& plan, Stand const& rule, std::vector<Circl
return SightSpot::Post;
float const bx = bot->GetPositionX(), by = bot->GetPositionY();
bool const inRoam = Dist2D(bx, by, rule.x, rule.y) <= kSightRoam;
bool const inRoam = Dist2D(bx, by, rule.x, rule.y) <= roam; // kSightRoam, or a wider post's (Stand::fightTolerance)
int const here = inRoam && !InsideAny(circles, bx, by, 0.0f) ? TanksSeenFrom(bot, tanks, bx, by, bot->GetPositionZ()) : -1;
if (here == int(tanks.size()))
return SightSpot::Here;
@@ -2964,24 +3100,44 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
bool const stayHidden = HidingFromBreath(plan, self, enemy, now);
// Leave through the nearer edge, a few degrees past it, keeping roughly the same distance from the boss (never closer than 6 yards).
float const side = toBot >= 0.0f ? 1.0f : -1.0f;
float const ring = std::max(distance, 6.0f);
// An enemy that turns a lot sweeps whoever stands just past its edge: one no tank holds (it faces each new victim) or one its tank
// turns from the side (FaceAway::maxTurnDeg past 30, a step round it every few seconds). The way out from it keeps 12 y and never
// steps nearer. naxx_kelthuzad kt69h (1124): four healers left the cone of a Soul Weaver their tank could not turn (its far side
// in the keep-out of the alcove at 3768,-5072) onto its flank, 8 y from it (3739-3743,-5084); one Wail of Souls killed some and threw the
// rest 26 y (its knockback) to the north alcove.
Unit* const coneVictim = enemy->GetVictim();
bool const loose = TurnedFromTheSide(plan, enemy->GetEntry()) || !coneVictim ||
std::none_of(plan.members.begin(), plan.members.end(), [&](Member const& m) { return m.tank && m.p == coneVictim; });
float const ring = std::max(distance, loose ? 12.0f : 6.0f);
// The way out stays out of the keep-out circles while another way out is found (pass 0), as the hazard escape's does: the
// keep-out escape (2a) walks a bot that ends inside one straight back out, into the cone again. naxx_kelthuzad kt66a (1124):
// the mages and healers by the alcoves alternated "leave cone" and "leave hazard" every second under a Soul Weaver (488 and
// 474 such steps, kt66b 683 and 621) and cast little. Pass 0 also tries a ring nearer the enemy, off the room's rim.
int pathChecks = 0;
for (int pass = 0; pass < 2; ++pass)
for (float r : { ring, std::max(ring * 0.6f, 6.0f) })
for (float extra : { 0.12f, 0.30f, 0.55f })
for (float flip : { 1.0f, -1.0f })
{
if (pass == 1 && r != ring)
continue; // the second pass is the old search, keep-out circles allowed
if (loose && r < ring)
continue;
float const angle = facing + side * flip * (half + extra);
float const px = enemy->GetPositionX() + ring * std::cos(angle);
float const py = enemy->GetPositionY() + ring * std::sin(angle);
float const px = enemy->GetPositionX() + r * std::cos(angle);
float const py = enemy->GetPositionY() + r * std::sin(angle);
if (!circles.empty() && InsideAny(circles, px, py, 1.0f))
continue;
if (pass == 0 && InsideAny(g_keepOut, px, py, 1.0f))
continue;
// The way out goes round him, never across his face: the walk to the far edge runs past his front (naxx_sapphiron r27:
// three bots 25 y off his flank took the far edge when the near one was no use, passed 3-6 y from him and his Cleave
// killed all three; four more died that way). A straight line that comes nearer to him than most of the ring is not
// taken.
if (SegmentDist2D(bot->GetPositionX(), bot->GetPositionY(), px, py, enemy->GetPositionX(), enemy->GetPositionY()) <
0.8f * std::min(distance, ring))
0.8f * std::min(distance, r))
continue;
if (++pathChecks > 6)
if (++pathChecks > 10)
break;
float pz = 0.0f;
if (!Usable(bot, px, py, bot->GetPositionZ(), pz, /*urgent*/ true, /*hazard*/ true))
@@ -3056,6 +3212,164 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
}
}
// 2c. Lead away (RaidRules::leadAway): the raider an untanked enemy is on stands where its frontal cast hits nobody else. The enemy
// walks up to its victim and faces it, so the victim decides where the cone points: out of the raid, with the raid behind the enemy.
// naxx_kelthuzad kt70e (1125, script19ac): a Soul Weaver walked up to the healer Mchealse in the camp, 19 y from its centre, and at 3%
// health its Wail of Souls killed 13 standing behind the healer; with the Soldiers' Dark Blast the raid went from 31 alive to 5.
// A tank leads one too while it holds none of a fixed row's adds: the enemy takes whoever is in its melee reach on its way in (a Soul
// Weaver whose victim is out of it), and a tank standing at its slot has the camp behind it. naxx_kelthuzad kt77a (1125): a Weaver on
// the bear (which takes no Abomination while a warrior is free) in 14 samples, another in 4, one on Mctankwc in 2; kt77b one on
// Mctankwa in about 11.
bool const holdsRowAdd = self.tank && std::any_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e)
{
return e->IsAlive() && e->GetVictim() == bot &&
std::any_of(rules.tankSpot.begin(), rules.tankSpot.end(), [&](TankSpot const& row) { return row.fixed && InTankSpot(row, e->GetEntry()); });
});
if (!holdsRowAdd)
for (LeadAway const& rule : rules.leadAway)
for (Unit* enemy : plan.enemies)
{
if (enemy->GetEntry() != rule.enemy || !enemy->IsAlive() || enemy->GetVictim() != bot ||
!bot->IsWithinDistInMap(enemy, rule.maxDist))
continue;
float const ex = enemy->GetPositionX(), ey = enemy->GetPositionY();
float const bx = bot->GetPositionX(), by = bot->GetPositionY();
std::vector<std::pair<float, float>> spots;
for (Player* p : others)
if (p->IsAlive())
{
float px, py;
PlannedAt(p, px, py);
spots.emplace_back(px, py);
}
float const cosHalf = std::cos((rule.halfDeg + kLeadConeMarginDeg) * (float(M_PI) / 180.0f));
// The raiders the enemy hits (in) and passes within reach of (near) when its victim stands at (sx, sy): it walks there from
// where it is, facing the victim, and casts from anywhere on that walk once the victim is within the cone's range, from
// range - 2 yards out (or where it stands, if nearer) down to kLeadApexBack short of it. Both ends of that walk count.
// naxx_kelthuzad kt76a (1125): a Weaver 23 y north-east of the camp (3736,-5094) cast at its victim in the camp and threw
// the camp 26 y west, 20 dead; the step had counted the cone from 2.5 y short of the victim only, as for an enemy that casts
// in melee ("Mchealpd leads Soul Weaver (29 y off) 14 y" a second before).
auto exposed = [&](float sx, float sy, int& in, int& near)
{
in = near = 0;
float const d = Dist2D(ex, ey, sx, sy);
float const ux = d > 0.1f ? (sx - ex) / d : std::cos(enemy->GetOrientation());
float const uy = d > 0.1f ? (sy - ey) / d : std::sin(enemy->GetOrientation());
float const nearBack = std::min(kLeadApexBack, d);
float const farBack = std::min(d, std::max(kLeadApexBack, rule.range - 2.0f));
float const ax = sx - ux * nearBack, ay = sy - uy * nearBack;
float const fx = sx - ux * farBack, fy = sy - uy * farBack;
auto const inCone = [&](float apexX, float apexY, float px, float py)
{
float const dx = px - apexX, dy = py - apexY;
float const pd = std::sqrt(dx * dx + dy * dy);
return pd <= rule.range + 2.0f && (pd < 1.0f || (dx * ux + dy * uy) / pd >= cosHalf);
};
for (auto const& s : spots)
{
if (inCone(ax, ay, s.first, s.second) || inCone(fx, fy, s.first, s.second))
++in;
else if (SegmentDist2D(ex, ey, ax, ay, s.first, s.second) < kLeadPathClear)
++near;
}
};
int hereIn = 0, hereNear = 0;
exposed(bx, by, hereIn, hereNear);
uint64_t const key = bot->GetGUID().GetCounter();
if (hereIn == 0 && hereNear == 0)
{
out.at_post = true; // the formation walk and the role post leave the victim where it is
return;
}
auto const last = g_leadSpot.find(key);
if (last != g_leadSpot.end() && now - last->second.at < kLeadEveryMs)
{
if (Dist2D(bx, by, last->second.x, last->second.y) > 1.5f)
{
SetMove(out, last->second.x, last->second.y, last->second.z, "lead away", hereIn > 0 && Dist2D(bx, by, ex, ey) < 12.0f);
Remember(bot, out, now);
}
else
out.at_post = true;
return;
}
// Out of the raid first: from the centre of the others through the victim.
float cx = 0.0f, cy = 0.0f;
for (auto const& s : spots) { cx += s.first; cy += s.second; }
float const outward = spots.empty() ? geo::Bearing(ex, ey, bx, by)
: geo::Bearing(cx / float(spots.size()), cy / float(spots.size()), bx, by);
struct Cand { float x, y; int in, near; float reach, offDeg; };
std::vector<Cand> cands;
for (float reach : { 6.0f, 10.0f, 14.0f, 20.0f })
for (int k = -5; k <= 6; ++k)
{
float const off = float(k) * 30.0f;
float const b = outward + off * (float(M_PI) / 180.0f);
float const sx = bx + reach * std::cos(b), sy = by + reach * std::sin(b);
int in = 0, near = 0;
exposed(sx, sy, in, near);
if (in * 2 + near < hereIn * 2 + hereNear)
cands.push_back({ sx, sy, in, near, reach, std::fabs(off) });
}
std::sort(cands.begin(), cands.end(), [](Cand const& a, Cand const& b)
{
int const sa = a.in * 2 + a.near, sb = b.in * 2 + b.near;
if (sa != sb) return sa < sb;
if (a.reach != b.reach) return a.reach < b.reach;
return a.offDeg < b.offDeg;
});
std::map<std::string, int> refused;
int probes = 0;
for (Cand const& c : cands)
{
if (probes >= 8)
break;
if (!circles.empty() && InsideAny(circles, c.x, c.y, 0.5f))
{
++refused["hazard circle"];
continue;
}
if (rule.knockback > 0.0f)
{
float const d = Dist2D(ex, ey, c.x, c.y);
float const lx = d > 0.1f ? c.x + (c.x - ex) / d * rule.knockback : c.x;
float const ly = d > 0.1f ? c.y + (c.y - ey) / d * rule.knockback : c.y;
if (InsideAny(g_keepOut, lx, ly, 0.0f) || InsideAny(g_idleHostiles, lx, ly, 0.0f))
{
++refused["knockback lands in a keep-out"];
continue;
}
}
++probes;
float pz = 0.0f;
if (!Usable(bot, c.x, c.y, bot->GetPositionZ(), pz, /*urgent*/ true))
{
++refused[UsableWhyName(g_usableWhy)];
continue;
}
g_leadSpot[key] = { c.x, c.y, pz, now ? now : 1u };
bool const urgent = hereIn > 0 && Dist2D(bx, by, ex, ey) < 12.0f;
SetMove(out, c.x, c.y, pz, "lead away", urgent);
Remember(bot, out, now);
TC_LOG_INFO("playerbot.v2.raid", "[raid_lead] {} leads {} ({:.0f} y off) {:.0f} y, {:.0f} deg off the raid's outward line: {} in its "
"cone and {} by its way here, {} and {} there", bot->GetName(), enemy->GetName(), Dist2D(bx, by, ex, ey), c.reach,
c.offDeg, hereIn, hereNear, c.in, c.near);
return;
}
g_leadSpot[key] = { bx, by, bot->GetPositionZ(), now ? now : 1u };
uint32_t& logged = g_lastLeadLog[key];
if (now - logged >= 10000)
{
logged = now;
std::string why;
for (auto const& r : refused)
why += (why.empty() ? "" : ", ") + r.first + " " + std::to_string(r.second);
TC_LOG_INFO("playerbot.v2.raid", "[raid_lead] {} has {} ({:.0f} y off) with {} in its cone and {} by its way here: no better spot "
"({} better, {})", bot->GetName(), enemy->GetName(), Dist2D(bx, by, ex, ey), hereIn, hereNear, cands.size(),
why.empty() ? "none refused" : why);
}
}
// 3. Spread: keep distance from the nearest raid member while the boss is up and open to attack. A boss the raid cannot touch yet casts
// nothing the spread is for: Kel'Thuzad sits immune on his throne through phase 1 while the adds come, and naxx_kelthuzad r25 spent 287
// "spread" steps of the ranged and healers on him ("wants 10 y from the raid at Kel'Thuzad ... no spot"), each one a cast not made.
@@ -3094,11 +3408,16 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
if (enemy->GetEntry() != rule.enemy || !enemy->IsAlive() || enemy->GetVictim() != bot ||
!InPhase(enemy, rule.hpMax, rule.hpMin))
continue;
// Only one the tank has in reach: an add still walking in to it is met first. naxx_kelthuzad kt69o (1124): a Soul Weaver
// just sent at Mctankwa from the south alcove (3704,-5169) had it as its victim, and the tank, 77 y off at its slot,
// looked for a spot behind it on every pass for 40 s, each one in the alcove's resting adds' reach ("idle pack 27").
if (!bot->IsWithinDistInMap(enemy, kFaceAwayReach))
continue;
float const ex = enemy->GetPositionX(), ey = enemy->GetPositionY();
float axis;
if (!FaceAxisFor(plan, enemy, now, axis, rule.bearingDeg))
continue;
if (geo::TankOnAxis(ex, ey, bot->GetPositionX(), bot->GetPositionY(), axis, 30.0f * (float(M_PI) / 180.0f)))
if (geo::TankOnAxis(ex, ey, bot->GetPositionX(), bot->GetPositionY(), axis, rule.maxTurnDeg * (float(M_PI) / 180.0f)))
continue;
uint32_t& at = g_lastFaceAway[bot->GetGUID().GetCounter()];
if (now - at < 5000)
@@ -3109,18 +3428,55 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
// raid), and the tank then never found a spot.
bool found = false;
float px = 0.0f, py = 0.0f, pz = 0.0f;
// The spot behind an add of a fixed row is the encounter's place, like the row's slots (Usable's fixedPlace): ground, path
// and detour count (keep-outs and idle packs too), the fight area round the main tank does not: the tank's place is set by
// the add it holds. naxx_kelthuzad kt69k (1124): a Soul Weaver's tank on the west of Kel'Thuzad's arc "found no spot on the
// axis behind" it on every pass from 90 s, 20-22 y from the camp and clear of the alcove keep-outs; the line gave no reason.
// Each failed probe now says why (refused).
bool const rowAdd = std::any_of(rules.tankSpot.begin(), rules.tankSpot.end(),
[&](TankSpot const& row) { return row.fixed && InTankSpot(row, rule.enemy); });
std::map<std::string, int> refused;
// FaceAway::maxTurnDeg past 30: when the line itself has no spot (the far side of a Soul Weaver at Kel'Thuzad's alcove rim lies
// in the alcove's keep-out), a spot further round, toward the side. naxx_kelthuzad kt69c / kt69f (1124): 3 and 11 "found no
// spot" a run, the Weaver went on facing its tank and the camp behind it, 26 and 28 dead to Wail of Souls.
std::vector<float> turns = { 0.0f, 15.0f, -15.0f, 28.0f, -28.0f };
for (float wide : { 50.0f, 75.0f })
if (wide <= rule.maxTurnDeg - 5.0f)
{
turns.push_back(wide);
turns.push_back(-wide);
}
for (float reach : { 3.5f, 2.8f, 2.2f })
{
for (float turnDeg : { 0.0f, 15.0f, -15.0f, 28.0f, -28.0f })
for (float turnDeg : turns)
{
geo::AxisSpot(ex, ey, axis, reach, turnDeg * (float(M_PI) / 180.0f), px, py);
if (!circles.empty() && InsideAny(circles, px, py, 0.5f))
{
++refused["hazard circle"];
continue;
if (Usable(bot, px, py, enemy->GetPositionZ(), pz, /*urgent*/ true))
}
// FaceAway::knockback: where the enemy's cast throws the tank from that spot, straight away from the enemy. Not into
// a keep-out or an idle pack's reach. naxx_kelthuzad kt70a (1124): Mctankwa stepped behind a Soul Weaver 26 y north of
// the camp, Wail of Souls threw it 26 y on to 3735,-5057 at the north alcove's rim, and it held that Weaver, an
// Abomination and a Soldier there, 50 y from the healers' post, at 97-100 s (44-49% health); it died at 109 s.
if (rule.knockback > 0.0f)
{
float const d = Dist2D(ex, ey, px, py);
float const lx = d > 0.1f ? px + (px - ex) / d * rule.knockback : px;
float const ly = d > 0.1f ? py + (py - ey) / d * rule.knockback : py;
if (InsideAny(g_keepOut, lx, ly, 0.0f) || InsideAny(g_idleHostiles, lx, ly, 0.0f))
{
++refused["knockback lands in a keep-out"];
continue;
}
}
if (Usable(bot, px, py, enemy->GetPositionZ(), pz, /*urgent*/ true, /*hazard*/ false, /*fixedPlace*/ rowAdd))
{
found = true;
break;
}
++refused[UsableWhyName(g_usableWhy)];
}
if (found)
break;
@@ -3128,7 +3484,11 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
at = now;
if (!found)
{
TC_LOG_INFO("playerbot.v2.raid", "[raid_face] {} found no spot on the axis behind {}", bot->GetName(), enemy->GetName());
std::string why;
for (auto const& [reason, n] : refused)
why += fmt::format("{}{} {}", why.empty() ? "" : ", ", reason, n);
TC_LOG_INFO("playerbot.v2.raid", "[raid_face] {} found no spot on the axis behind {} at ({:.0f},{:.0f}): {}", bot->GetName(),
enemy->GetName(), ex, ey, why);
continue;
}
TC_LOG_INFO("playerbot.v2.raid", "[raid_face] {} steps behind {} to turn it away from the raid", bot->GetName(), enemy->GetName());
@@ -3256,8 +3616,7 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
// tank whose victim died turned on the nearest one at the door (bwl_nefarian 1109c run 2: Mctankwc "attacks ... 14263 ... mob
// in_combat 0", then "takes Bronze Drakonid on Mctankwc dist=54y why=already_on_it"; the first tank to die in each run was 35-48 y
// from the camp centre).
if (rule.fixed && self.tank && !EnemyInFight(plan, rule.endEnemy) &&
std::any_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e) { return e->GetEntry() == rule.anchor && e->IsAlive(); }))
if (rule.fixed && self.tank && !RowEnded(plan, rule) && FixedRowUp(plan, rule))
{
std::vector<Unit*> adds(plan.enemies.begin(), plan.enemies.end());
std::list<Creature*> fresh;
@@ -3267,8 +3626,18 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
for (Creature* c : fresh)
if (!c->IsInCombat())
adds.push_back(c);
// TankSpot::skipClassMask: a tank of such a class takes none of the row's adds and keeps its slot. naxx_kelthuzad kt70c (1124):
// the bear (10,153 health, 6,241 armour on its sheet; the warriors 12,119 and 9,617) died to single Mortal Wounds of 9,007 from
// 72% at 95 s, 9,056 from full at 126 s and 8,112 at 193 s.
// Only while another tank has a hand free (RowSkips): kt70g, six Abominations up and the bear idle.
bool const skipsRow = RowSkips(plan, rule, bot) || OnEndEnemy(plan, rule, bot);
for (Unit* enemy : adds)
{
if (skipsRow && enemy->IsAlive() && InTankSpot(rule, enemy->GetEntry()))
{
out.forbidden_targets.push_back(enemy->GetGUID());
continue;
}
// An add already on this tank but still far out is waited for too: it walks to the tank at its slot. The rotation's chase
// walked the tank out to meet it, and the next one, and the one after (bwl_nefarian 1110b: "takes Bronze Drakonid on Mctankwa
// dist=39y why=already_on_it", then its melee spot at -7544,-1185; from 25 s on every tank fought 40-67 y from the camp
@@ -3299,6 +3668,34 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
}
if (Dist2D(bot->GetPositionX(), bot->GetPositionY(), tx, ty) < 3.0f)
continue;
// TankSpot::holdSlack: a tank in melee with an add of the row that is on it stays this close to its slot. The walk turns its back
// to the add, and a blow from behind cannot be parried, dodged or blocked. naxx_kelthuzad kt70c (1124): Mctankwc walked to its
// slot from 3 y off with an Abomination behind it (facing 152 degrees off), and the Abomination's next swing killed it at 135 s.
if (rule.holdSlack > 0.0f && Dist2D(bot->GetPositionX(), bot->GetPositionY(), tx, ty) < rule.holdSlack &&
std::any_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e)
{
return e->IsAlive() && InTankSpot(rule, e->GetEntry()) && e->GetVictim() == bot && e->IsWithinMeleeRange(bot);
}))
continue;
// A tank that holds a FaceAway add of the row and already stands on its far side from the raid stays, a few yards off its slot: the
// face-away step put it there, and the walk back to the slot took it past the add, which turned to the raid again, and the next step
// took it out again (Kel'Thuzad's Soul Weavers, Wail of Souls in front of them).
if (HoldsFacedAway(plan, rules, rule, bot, now) && Dist2D(bot->GetPositionX(), bot->GetPositionY(), tx, ty) < kFaceAwaySlotSlack)
continue;
// One turned from the side (FaceAway::maxTurnDeg past 30, met wherever it was) is fought where it is, turned away or not yet: the
// walk to the slot takes the tank out of the Weaver's melee reach (it turns to the nearest raider in reach, or the top of its
// threat), and only the face-away step moves that tank. naxx_kelthuzad kt69k (1124): a Weaver's tank found no spot behind it at
// 3692,-5120 and walked toward its slot 14 y west of the camp; a second later the Weaver was on another raider 11 y from the tank
// ([tank_loose]), and one Wail of Souls killed seven healers at 92 s (3684,-5106), the start of the wipe.
if (std::any_of(rules.faceAway.begin(), rules.faceAway.end(), [&](FaceAway const& fa)
{
return fa.maxTurnDeg > 30.0f && InTankSpot(rule, fa.enemy) &&
std::any_of(plan.enemies.begin(), plan.enemies.end(), [&](Unit* e)
{
return e->GetEntry() == fa.enemy && e->IsAlive() && e->GetVictim() == bot && InPhase(e, fa.hpMax, fa.hpMin);
});
}))
continue;
uint32_t& at = g_lastTankSpot[bot->GetGUID().GetCounter()];
if (now - at < 3000)
{
@@ -3540,7 +3937,7 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
}
for (Stand const& rule : rules.stand)
{
if (!Matches(rule.who, self, plan.mainTank) || EnemyInFight(plan, rule.endEnemy))
if (!Matches(rule.who, self, plan.mainTank) || StandEnded(plan, rule))
continue;
if (rule.share)
{
@@ -3580,10 +3977,12 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
if (rule.needOtherEnemy ? !other : (rule.needVictimIsMe && boss->GetVictim() != bot))
continue;
out.post_enemy = boss->GetGUID();
bool const fightPost = rule.fightTolerance > 0.0f && EnemyInFight(plan, rule.endEnemy);
float const tolerance = fightPost ? rule.fightTolerance : rule.tolerance;
if (rule.who == Who::Healer && self.healer)
{
float sx = 0.0f, sy = 0.0f, sz = 0.0f;
SightSpot const spot = HealerSightSpot(plan, rule, circles, now, bot, sx, sy, sz);
SightSpot const spot = HealerSightSpot(plan, rule, circles, now, bot, sx, sy, sz, std::max(kSightRoam, tolerance));
if (spot == SightSpot::Here)
{
out.at_post = true;
@@ -3596,7 +3995,7 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
}
}
float const offPost = Dist2D(bot->GetPositionX(), bot->GetPositionY(), rule.x, rule.y);
if (offPost <= rule.tolerance)
if (offPost <= tolerance)
{
out.at_post = true;
continue;
@@ -3604,7 +4003,7 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
// Near its post a healer with a hurt tank in reach heals, and a ranged DPS with its victim in reach casts, before it walks back: a hard
// cast is refused while the bot moves (bwl_nefarian 1108h: the healers walked "role position" for 30 s and more at 97-100% mana, one
// of twelve casting, while all four tanks died 45-80 s in). The post holds it there as if it stood on it.
if (offPost <= rule.tolerance + kPostCastSlack)
if (offPost <= tolerance + kPostCastSlack)
{
bool castsFirst = false;
if (self.healer)
@@ -3641,6 +4040,19 @@ void DecideMove(Plan const& plan, Member const& self, uint32_t now, std::vector<
}
return;
}
// Stand::fightTolerance: back to just inside the wider post, along the line from its centre, not to the centre (the spread would
// walk the bot straight out again).
if (fightPost && offPost > 0.1f)
{
float const f = (tolerance - 3.0f) / offPost;
float const px = rule.x + (bot->GetPositionX() - rule.x) * f, py = rule.y + (bot->GetPositionY() - rule.y) * f;
float pz = 0.0f;
if (Usable(bot, px, py, rule.z, pz))
{
SetMove(out, px, py, pz, "role position");
return;
}
}
SetMove(out, rule.x, rule.y, rule.z, "role position");
return;
}
@@ -4717,6 +5129,18 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
return Matches(Who::Melee, m, plan.mainTank) && enemy->GetVictim() != m.p &&
IdleReachOnApproach(m.p->GetPositionX(), m.p->GetPositionY(), enemy->GetPositionX(), enemy->GetPositionY()) >= 0;
};
// A ranged DPS in a near-first encounter (RaidRules::rangedNearFirst) ranks an enemy past its spell range after every enemy inside it, and
// drops one past kRangedFarDrop for a near pick. naxx_kelthuzad af55 (1121) kt2af55 run 1: the Soldiers (ranged priority 6) are picked as
// they leave the alcoves 40-50 y off; the mages sat on them out of range, "classic_mage:auto_attack" 42 times against 9 nukes, cast_fail
// API_BEYOND_RANGE / OUT_OF_RANGE every few seconds, raid damage near 2,000 a second while the adds piled up on the tanks.
bool rangedNearFirst = false;
for (Unit* enemy : plan.enemies)
if (std::find(rules.rangedNearFirst.begin(), rules.rangedNearFirst.end(), enemy->GetEntry()) != rules.rangedNearFirst.end())
rangedNearFirst = true;
auto const rangedFar = [&](Member const& m, Unit* enemy, float reach)
{
return rangedNearFirst && Matches(Who::Ranged, m, plan.mainTank) && enemy->GetVictim() != m.p && m.p->GetExactDist2d(enemy) > reach;
};
auto const bestFor = [&](Member const& m) -> Unit*
{
uint8_t const schools = MemberDamageSchools(m, plan.mainTank);
@@ -4725,6 +5149,7 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
bool bestHurts = false;
bool bestHeld = false;
bool bestReach = false;
bool bestInRange = false;
for (size_t i = 0; i < candidates.size(); ++i)
{
Unit* enemy = candidates[i];
@@ -4742,11 +5167,14 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
continue;
bool const hurts = (schools & ~candidateAvoid[i]) != 0;
bool const reach = !meleeOutOfReach(m, enemy);
bool const inRange = !rangedFar(m, enemy, kRangedNearReach);
bool better = !best || (hurts && !bestHurts);
if (!better && hurts == bestHurts)
{
if (reach != bestReach)
better = reach;
else if (inRange != bestInRange)
better = inRange;
else if (held != bestHeld)
better = held;
else if (priority != bestPriority)
@@ -4763,6 +5191,7 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
bestHurts = hurts;
bestHeld = held;
bestReach = reach;
bestInRange = inRange;
}
}
return best;
@@ -4776,6 +5205,28 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
continue;
RaidOrder& o = it->second;
o.forbidden_targets.insert(o.forbidden_targets.end(), forbiddenAll.begin(), forbiddenAll.end());
// An enemy no tank holds (RaidRules::noTank) is the DPS's, wherever it runs: while a fixed tank row holds, its tanks hit one only when
// it is on the tank or next to it. naxx_kelthuzad kt69a (1124, the camp script): the tanks' victims were Soldiers of the Frozen Wastes
// 14-50 y away (sent at random raiders, 2,000 health), so the tanks chased them off their slots (58 slot walks, most "NO PROGRESS,
// generator 5"), and the Abominations and Soul Weavers walked loose into the camp. Set here, in every pass: set in the tank spot step
// (kt69d), it was missing whenever an earlier step of the movement pass gave the tank a move, and the tank planner still handed far
// Soldiers to free tanks ("takes Soldier of the Frozen Wastes ... dist=42-56y why=nearest / loose_nearest", 13 of 38 slot walks).
// kt69g (script5): a Soldier sent at the tank itself was still its own (its victim was this tank), and the planner gave it to
// the tank 44-59 y out ("takes Soldier ... on Mctankwa dist=53y why=on_main_tank"), as it gave one sent this tick, before this
// pass listed it (20 of 31 slot walks had a Soldier as the tank's victim). Every one is off now, near or far, on the tank or not:
// the DPS kill them, and no_tank_off tells the planner before the list has the new ones.
// RaidRules::noTankWholeFight: row or not. naxx_kelthuzad kt76b (1125): the last Abomination died at about 330 s in phase 2, the row
// ended, and three tanks took a Soul Weaver each at once; the one Mctankwb held 21 y west of the camp (3695,-5101) faced it and the
// camp behind it, and its Wails of Souls killed 5 at 359 s and 13 at 363 s, 0-13 y from the camp.
bool const rowUp = std::any_of(rules.tankSpot.begin(), rules.tankSpot.end(),
[&](TankSpot const& row) { return row.fixed && !RowEnded(plan, row) && FixedRowUp(plan, row); });
if (m.tank && (rowUp || rules.noTankWholeFight))
{
o.no_tank_off = true;
for (Unit* enemy : plan.enemies)
if (enemy->IsAlive() && NoTank(plan.mapId, enemy->GetEntry()))
o.forbidden_targets.push_back(enemy->GetGUID());
}
if (!m.tank)
o.forbidden_targets.insert(o.forbidden_targets.end(), forbiddenDps.begin(), forbiddenDps.end());
if (Matches(Who::Melee, m, plan.mainTank))
@@ -4798,7 +5249,8 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
// over, and the focus is its pick again once it walks out.
if (!focus.IsEmpty())
for (Unit* enemy : candidates)
if (enemy->GetGUID() == focus && !shieldForbids(m, enemy) && !meleeOutOfReach(m, enemy))
if (enemy->GetGUID() == focus && !shieldForbids(m, enemy) && !meleeOutOfReach(m, enemy) &&
!rangedFar(m, enemy, kRangedNearReach))
pick = enemy;
if (!pick)
pick = bestFor(m);
@@ -4828,6 +5280,22 @@ void PublishTargets(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders,
}
}
}
// A ranged member on an enemy far past its spell range leaves it for a pick inside it (rangedNearFirst), the kill focus too: the
// synchronized focus is most often a Soul Weaver still walking in from its alcove. The drop distance is above the pick's so a
// target walking in and out of range is not swapped back and forth.
if (pick && !rangedFar(m, pick, kRangedNearReach))
if (Unit* const victim = m.p->GetVictim(); victim && victim != pick &&
rangedFar(m, victim, kRangedFarDrop))
{
o.forbidden_targets.push_back(victim->GetGUID());
uint32_t& at = g_lastOutOfReachLog[m.p->GetGUID().GetCounter()];
if (getMSTime() - at >= 10000u)
{
at = getMSTime();
TC_LOG_INFO("playerbot.v2.raid", "[raid_target] {} leaves {} {:.0f} y off for {} {:.0f} y off, inside its range",
m.p->GetName(), victim->GetName(), m.p->GetExactDist2d(victim), pick->GetName(), m.p->GetExactDist2d(pick));
}
}
// A member already on an enemy it cannot hurt leaves it while there is one it can: the fallback alone only steers a member
// with no target.
uint8_t const schools = MemberDamageSchools(m, plan.mainTank);
@@ -6414,8 +6882,10 @@ static void FillRaidRoles(uint64_t key, detail::Plan const& plan, uint32_t now_m
b.guid = m.p->GetGUID().GetCounter();
b.cls = m.p->GetClass();
b.role = m.tank ? RosterRole::Tank : m.healer ? RosterRole::Healer : RosterRole::Dps;
// Humans and bots nobody owns keep what they have.
b.role_set = !m.bot || owners.GetOwner(b.guid).account_id == 0 || owners.DeclaredRole(b.guid) != Role::Unknown;
// Humans, bots nobody owns and a player's own character brought as a bot keep what they have.
WorldSession const* sess = m.p->GetSession();
bool const own_character = sess && !Services::Accounts().is_pool_account(sess->GetAccountId());
b.role_set = !m.bot || own_character || owners.GetOwner(b.guid).account_id == 0 || owners.DeclaredRole(b.guid) != Role::Unknown;
roster.push_back(b);
byGuid[b.guid] = m.p;
}
@@ -215,12 +215,17 @@ namespace Playerbot::Raid {
// cloud's 9 y), 36% of his health in 90 s, and the tanks died at 88-104 s. His tank leads him out of them.
// A cloud's reach grows from 2 y to 20 y over its aura 28158 (classic_spell_grobbulus_cloud_poison); his tank leads him by that.
r.dragOut.push_back({ 15931, 16363, 11.0f, 28158, 2.0f, 20.0f });
r.avoidFrontal.push_back({ 15931, 20.0f, 50.0f, Who::NonTank });
// Slime Spray reaches 45 y (bot_death spell_data radius=45), not 20, and his tank turns him every few seconds while it leads him out
// of the clouds (dragOut): the cone is kept to its full reach and 15 degrees wider on each side. naxx_grobbulus r3af55-2: the first
// spray (25 s) caught Mchealsd and Mcshadb, 7-15 y from him and still on a "leave cone" step from his last turn; their two Fallout
// Slimes killed eight healers by 57 s and the raid wiped at 54%.
constexpr float kGrobSprayReach = 45.0f, kGrobSprayHalfDeg = 50.0f, kGrobSprayMarginDeg = 15.0f;
r.avoidFrontal.push_back({ 15931, kGrobSprayReach, kGrobSprayHalfDeg, Who::NonTank, 0.0f, 100.0f, 0.0f, true, kGrobSprayMarginDeg });
// Every player the spray hits leaves a Fallout Slime where it stands (classic_boss_grobbulus.cpp SpellHitTarget, one each), so
// the main tank is the only one in front of him: the off tanks keep the Fallout Slimes from his flank. naxx_grobbulus 1115a: all
// four tanks stood on him in front from 69 s, one spray at 160 s put six slimes on them at once, the four tanks died to the slimes
// in 11 s and the slimes then killed 30 of the raid.
r.avoidFrontal.push_back({ 15931, 20.0f, 50.0f, Who::OffTank });
r.avoidFrontal.push_back({ 15931, kGrobSprayReach, kGrobSprayHalfDeg, Who::OffTank, 0.0f, 100.0f, 0.0f, true, kGrobSprayMarginDeg });
r.priority.push_back({ 16290, 3 }); // Fallout Slime
// ---------------------------------------------------------------------------------------------------------------
@@ -299,16 +304,88 @@ namespace Playerbot::Raid {
r.spread.push_back({ 15990, 10.0f, Who::Ranged });
r.spread.push_back({ 15990, 10.0f, Who::Healer });
// Phase 1 adds (naxx/classic_naxxramas.h:123-126). Guardians of Icecrown (phase 3) are shackled.
r.priority.push_back({ 16429, 4 }); // Soul Weaver
// Soldiers explode (Dark Blast 28457) when they reach somebody, so the ranged shoot them down on the way in; the melee keep
// the Soul Weavers and the Abominations (first matching row per bot wins, so the ranged row comes first).
// Kill order (first matching row per bot wins, so the ranged and melee rows come first). Soldiers explode (Dark Blast 28457) when
// they reach somebody, so the ranged shoot them down on the way in, then the Soul Weavers (Wail of Souls), then the Abominations.
// The melee take the Abominations first: the tanks hold them, and an Abomination left alive stacks Mortal Wound 28467 on its tank
// until the tank dies and it walks into the raid. naxx_kelthuzad af55 (1121), 4 of 4 wipes with the Abominations last (2): kt2af55
// run 1 lost 13 of 40 to Mortal Wound (200% weapon damage, 8,224-11,015 a hit on cloth), all three warrior tanks dead by 151 s with
// the Abominations at 89-98%, then 11 to Wail of Souls from the Weavers they had held.
r.priority.push_back({ 16427, 6, Who::Ranged });
r.priority.push_back({ 16429, 5, Who::Ranged });
r.priority.push_back({ 16428, 4, Who::Ranged });
r.priority.push_back({ 16428, 5, Who::Melee });
// The unconditional rows are the tanks' order: an Abomination before a Soul Weaver, so a tank holding one never drops it for a loose
// Weaver (af600/af601: "priority 4 over 3", and the loose Abominations killed 37-38 of the 40-43 dead).
r.priority.push_back({ 16428, 5 }); // Unstoppable Abomination (the highest unconditional row: the synchronized kill focus)
r.priority.push_back({ 16429, 4 }); // Soul Weaver
r.priority.push_back({ 16427, 3 }); // Soldier of the Frozen Wastes
// No tank holds a Soldier: each one is sent at a random raider and blows up on arrival (classic_kt_p1AddAI, Dark Blast 28457), so
// the raid shoots them on the way in and the tanks keep the Abominations (naxx-kt-1114e: the tanks chased Soldiers 26-59 y out and
// the DPS held their damage waiting for them, 0 damage a second for 18 s).
r.noTank.push_back(16427);
r.priority.push_back({ 16428, 2 }); // Unstoppable Abomination
// A Soul Weaver is tanked, and turned away from the raid: Wail of Souls 28459 (4,250 shadow and a knockback in front of it) goes
// wherever it faces, and an untanked one faces its victim, in the middle of the raid. It has 70,000 health (classic_boss_kelthuzad.cpp
// Reset), too much for the ranged to burn on the way in. r1 (1122) had left it to the DPS because its tank could not reach it at an alcove's
// keep-out rim; r3 (1123) lets a tank fight a target there from outside the circle. naxx_kelthuzad kt67a / kt67b (1124), untanked:
// 16 and 25 dead to Wail of Souls, four melee at once 1-1.4 y from one Weaver, and 768-792 of the 1,028-1,132 forced moves a bot
// switching between "leave cone" and "leave hazard" (the cone's way out in an alcove circle, the circle's way out in the cone).
// Its tank may stand up to 80 degrees off the line from the camp through it (FaceAway::maxTurnDeg): the cone is 60 degrees each
// side, so the camp stays 100 degrees and more off its middle. At the alcove rim the far side lies in the keep-out.
// AzerothCore-style variant (kt-af61 script17ac, after mod-playerbots NaxxActions_Kelthuzad.cpp, GPL-2.0-or-later): the Weavers
// are not tanked at all. The ranged burn them inside 30 y of the camp, the tanks and melee keep to the Abominations, and nobody
// steps out of a Weaver's cone: the raid stays stacked at the camp (no faceAway row, no avoidFrontal row, noTank below).
// Tried against script16 (tanked and turned, 1124): kt69k-r had a Weaver on a raider in 70-75% of the samples anyway.
r.noTank.push_back(16429);
r.noTankWholeFight = true; // phase 2 too, after the row ends (RaidBrain PublishTargets, kt76b)
// Phase 1 is fought from one camp in the middle of the room, under Kel'Thuzad's dais, where the Nefarian fight's camp is the model
// (RaidEncounterData_BWL_Movement.cpp): the ranged DPS and the healers hold 7 y round it, the tanks hold the Abominations and Weavers
// on an arc 14 y round it, 12 y apart (out of one another's Weaver cones), and the DPS take one focus (the Kel'Thuzad fight script,
// RaidFightScript.h). A Weaver's tank stands on its far side from the camp (FaceAway), so Wail of Souls goes out toward the empty
// ground between the arc and the alcove keep-outs (32 y from the centre), never into the camp; its knockback has 10 y and more there.
// The arc opens west (168 degrees), away from the gap in the alcove ring at the room's east side (alcoves at 33-304 degrees round
// him, every 45). The layout ends when Kel'Thuzad can be hit (phase 2: endEnemy, EnemyInFight leaves an immune enemy out).
// naxx_kelthuzad kt67a / kt67b (1124), without it: the raid stood over the whole floor between the keep-outs and the cones, and
// 768-792 of each run's 1,028-1,132 forced moves were a bot sent from one to the other and back.
// The row and the posts hold while any phase 1 add is in the raid's combat (each sent add is put in it as it is sent): Kel'Thuzad
// himself is immune all of phase 1, and one Soldier lives a few seconds. The healers' first post names the Soldier, the row's
// anchor: the arc's slots are laid on ground that post sees (SeenArcAngle).
constexpr float kKtCampX = 3716.0f, kKtCampY = -5106.0f, kKtFloorZ = 142.0f;
// A tank goes after a loose add only within 22 y of the camp (fetchMax): its far side then lies 25-26 y out, well inside the alcove
// keep-outs (32 y), and the face-away step finds it. The adds walk in to the raider they were sent at, past the arc.
// The row holds the Abominations only (AzerothCore-style variant: the Weavers are not tanked, see the faceAway note above). A tank
// holding two of them hands one to an empty-handed tank (handOffFrom 2): Mortal Wound on two Abominations at once kills a tank in
// seconds.
// The bear takes no Abomination while a warrior has a hand free (skipClassMask: druid; RowSkips), and a tank holding one stays
// within 6 y of its slot (holdSlack).
// When Kel'Thuzad comes down (on a timer, 5:35 into the pull, whatever is still alive) the row holds the last Abominations: the tank
// that takes him leaves the row, the others keep their slots, and the row ends with the last Abomination (endAfterAdds).
r.tankSpot.push_back({ 16427, 16428, 14.0f, 12.0f, true, kKtCampX, kKtCampY, 168.0f, {}, 15990, 22.0f, 0.0f, 2,
1u << (11 - 1) /* druid */, 6.0f, true });
// An Abomination's Mortal Wound takes a full tank to a quarter: its tank's healers keep a heal going on it (burstTank).
r.burstTank.push_back(16428);
for (uint32_t add : { 16427u, 16428u, 16429u })
{
// The posts hold into phase 2 while adds of their entry are left (endAfterEnemy): a raid spread round Kel'Thuzad stood in the
// way of the last Soul Weavers walking in (kt74b, see StandEnded). There they hold within 20 y of the camp (fightTolerance),
// where the ranged and healers spread 10 y apart against Frost Blast: kt79a (1125), kept within 7 y, one Frost Blast stunned
// 21 of the camp at 412 s and killed 18 in 5 s.
r.stand.push_back({ add, Who::Healer, kKtCampX, kKtCampY, kKtFloorZ, 7.0f, false, 0, 100.0f, 0.0f, 0, 15990, 0.0f, true, 20.0f });
r.stand.push_back({ add, Who::Ranged, kKtCampX, kKtCampY, kKtFloorZ, 7.0f, false, 0, 100.0f, 0.0f, 0, 15990, 0.0f, true, 20.0f });
}
// The adds walk in from seven alcoves at once and the ranged priority (Soldiers) is most often a fresh one at the far wall: the ranged
// take what is inside their spell range first (RaidRules::rangedNearFirst), while any phase 1 add or Kel'Thuzad is up.
r.rangedNearFirst.push_back(15990);
r.rangedNearFirst.push_back(16427);
r.rangedNearFirst.push_back(16428);
r.rangedNearFirst.push_back(16429);
// Mortal Wound 28467 stacks on the Abomination's tank (-10% healing a stack, 200% weapon damage a hit): another tank takes it at 5,
// the taker may carry 2 itself (with several Abominations up no tank stays clean). Each tanked Abomination also counts a taker
// for the tank roster (PveGroupCoordinator), so the fourth tank (Mctankda) is on it from the second Abomination, not off it.
r.tankSwap.push_back({ 16428, 28467, 5, 2 });
// Abominations come the whole of phase 1 (44 s, then every 17-30 s: ktAbominationSpawnMs), each needing a tank and a taker:
// all four tanks are on the roster from the first sent Soldier (RaidRules::allTanks), not from the second engaged Abomination.
r.allTanks.push_back(15990);
r.allTanks.push_back(16427);
// The seven alcoves are out of bounds (naxx-kt-1114d: the tanks met the first Soldier at the south alcove, 3704,-5170, pulled its
// 3 Abominations and its Soul Weaver and the raid died in 18 s). Each alcove keeps 10 Soldiers wandering within 14 y of its
// centre, 3 Abominations and a Soul Weaver (classic_boss_kelthuzad.cpp:518-556); they wake for anyone within their own aggro
@@ -325,7 +402,19 @@ namespace Playerbot::Raid {
// Soul Weaver: Wail of Souls 28459, damage and a knockback in front of it. This build's spell data gives it a 32 y radius
// ([bot_death] spell_data radius=32), not the vanilla 30: naxx_kelthuzad af52 sweep 1 killed a healer standing 30.7 y from the
// Weaver. 34 y and a 10 degree margin: a Weaver loose on the raid turns from one victim to the next and casts as it turns.
r.avoidFrontal.push_back({ 16429, 34.0f, 60.0f, Who::NonTank, 0.0f, 100.0f, 0.0f, true, 10.0f });
// AzerothCore-style variant: no cone row for the Weaver (see the faceAway note above). With it, the healers made 74 "leave cone"
// moves in kt69r (1124) and ended north of the camp by the alcoves, where the Soldiers and Abominations picked them off.
// The melee DPS keep 8 y from a Weaver that is not on them, out of its melee reach: one whose victim steps out of that reach takes
// the nearest raider in it (classic_soul_weaver_ai), and the melee beside it took it from its tank (kt69p, 1124: on a raider in 73
// of 94 samples). They do not attack it either (Fight::meleeOff, RaidFightScript.h).
r.avoidEnemy.push_back({ 16429, 8.0f, Who::Melee });
// The raider a Weaver is on leads it (RaidRules::leadAway): it walks to where the Weaver, coming up to it, faces out of the camp
// with nobody else in the cone, and the 26 y knockback (kt70a) lands short of the alcove keep-outs. naxx_kelthuzad kt70e (1125):
// one Weaver on a healer in the camp killed 13 with one Wail of Souls. Only within 40 y: a Weaver walks in slowly from its alcove, and
// a victim 40-49 y from it moved every 2 s for nothing (kt73b: the healers Mchealse and Mchealsc led Weavers 39-49 y off for 25 s);
// but it casts from the cone's range, not from melee (kt76a: from 23 y), so the lead starts before that (25 y in script25ac was
// too late).
r.leadAway.push_back({ 16429, 32.0f, 60.0f, 25.9f, 40.0f });
// Shackle at most 3 Guardians: a 4th frees them all (classic_boss_kelthuzad.cpp:1027-1100).
r.crowdControl.push_back({ 16441, CcKind::Shackle, 0, 3 });
// A Guardian that is tanked stacks Blood Tap 28470 on its tank (+damage, +size per stack, classic_boss_kelthuzad.cpp:104):
@@ -90,6 +90,12 @@ bool RulesPlaceTank(uint32_t mapId, uint32_t boss)
return false;
}
bool HitsTankHard(uint32_t mapId, uint32_t entry)
{
RaidRules const* rules = RulesForMap(mapId);
return rules && std::find(rules->burstTank.begin(), rules->burstTank.end(), entry) != rules->burstTank.end();
}
bool OwnsAura(uint32_t mapId, uint32_t aura)
{
RaidRules const* rules = RulesForMap(mapId);
@@ -118,8 +118,11 @@ struct Spread { uint32_t enemy; float radius; Who who; float hpMax = 100.0f; flo
struct Stand { uint32_t enemy; Who who; float x, y, z; float tolerance; bool needVictimIsMe; uint32_t needOtherEnemy; float hpMax = 100.0f; float hpMin = 0.0f;
uint8_t share = 0; // share 1 / 2: only the even / odd numbered of the members this rule matches (by guid order), so one rule list can split e.g. the off-tanks between two posts
uint32_t endEnemy = 0; // the post ends once this enemy is in the fight (EnemyInFight): a phase's layout that the next phase must not keep
float maxFromEnemy = 0.0f; }; // > 0: the post holds only while the enemy is within this many yards of it (a boss pulled
float maxFromEnemy = 0.0f; // > 0: the post holds only while the enemy is within this many yards of it (a boss pulled
// somewhere else is fought where he is, not from posts across the room); 0 = always
bool endAfterEnemy = false; // endEnemy ends the post only once no <enemy> is left alive in the fight (StandEnded)
float fightTolerance = 0.0f; }; // > 0: once endEnemy is in the fight (the post kept by endAfterEnemy), the post holds within
// this many yards instead, and a bot past it walks back to just inside it (room to spread)
// While <enemy> is alive and fighting, a member carrying <aura> stands <distance> yards from the enemy's live position
// along the fixed world bearing <bearing> (radians) and holds within <tolerance> (Thaddius' Positive / Negative Charge
@@ -289,7 +292,18 @@ struct StayNear { uint32_t enemy; float radius; Who who; float hpMax = 100.0f; f
// the back of the lair, wherever the raid stands (the raid enters from the west and spreads; a bearing taken from where it stood at the pull
// put the tank on the wrong side once the raid moved).
constexpr float kNoBearing = 1000.0f;
struct FaceAway { uint32_t enemy; float hpMax = 100.0f; float hpMin = 0.0f; float bearingDeg = kNoBearing; };
// maxTurnDeg: how far off that line the tank may stand (its spot, and the check that it is already there). Past 30 degrees only for an
// enemy whose frontal hazard is narrow enough that a turn that far still keeps the raid behind it (Kel'Thuzad's Soul Weavers).
struct FaceAway { uint32_t enemy; float hpMax = 100.0f; float hpMin = 0.0f; float bearingDeg = kNoBearing; float maxTurnDeg = 30.0f;
float knockback = 0.0f; }; // > 0: the enemy's frontal cast throws its tank this far straight back; a spot whose landing
// lies in a keep-out or an idle pack's reach is refused
// While an untanked <enemy> is on a raider, that raider leads it (Kel'Thuzad's Soul Weavers): it stands where the enemy, walking up to it,
// faces nobody else with its frontal cast (a cone of <range> yards, <halfDeg> degrees each side of its facing), where its walk there passes
// nobody (an enemy that takes the nearest raider in its melee reach while its victim is out of it), and where the cast's knockback
// (<knockback> yards straight on, 0 for none) lands clear of the keep-outs and the idle packs. A victim already in such a place holds it.
// Only for an enemy within <maxDist> yards of its victim, and never a tank holding an add of a fixed row (its place is its slot).
struct LeadAway { uint32_t enemy; float range; float halfDeg; float knockback = 0.0f; float maxDist = 45.0f; };
// While <anchor> is fighting, the players that hold an <enemy> stand <reach> yards past the spot the anchor stood on when the fight began, away from the
// raid's centre at that moment, side by side <spacing> yards apart (Majordomo: his tank drags him out, each Elite tank one Elite, all visibly apart).
@@ -298,7 +312,17 @@ struct FaceAway { uint32_t enemy; float hpMax = 100.0f; float hpMin = 0.0f; floa
// middle of the arc on bearing rowDeg (a camp at (x, y) then has every tank's pile at the same distance). also: further entries whose holders share the one row (adds of any colour), so no two tanks get the same slot.
// endEnemy: the row ends once this enemy is in the fight (EnemyInFight), as Stand::endEnemy.
struct TankSpot { uint32_t anchor; uint32_t enemy; float reach; float spacing; bool fixed = false; float x = 0.0f, y = 0.0f, rowDeg = 0.0f;
std::vector<uint32_t> also = {}; uint32_t endEnemy = 0; };
std::vector<uint32_t> also = {}; uint32_t endEnemy = 0;
float fetchMax = 0.0f; // > 0 (fixed row): a tank goes after a loose add only within this many yards of (x, y)
float fetchTurned = 0.0f; // > 0 (fixed row): a FaceAway add turned from the side (maxTurnDeg past 30) is met
// once it is within this many yards of (x, y), wherever the tank stands, and not before
uint8_t handOffFrom = 0; // > 0 (fixed row): a tank holding this many of the row's adds hands all but its most hurt
// one to an empty-handed tank of the row (0: from 3, keeping 2)
uint32_t skipClassMask = 0; // fixed row: tanks of these classes (1 << (class - 1)) take none of the row's adds
float holdSlack = 0.0f; // > 0 (fixed row): a tank in melee with one of the row's adds on it stays when it is this
// close to its slot (the walk turns its back to the add)
bool endAfterAdds = false; }; // endEnemy ends the row only once none of the row's adds is alive; until then the tank that
// holds the endEnemy is out of the row and the others keep their slots (RowEnded, OnEndEnemy)
inline bool InTankSpot(TankSpot const& rule, uint32_t entry)
{
return entry == rule.enemy || std::find(rule.also.begin(), rule.also.end(), entry) != rule.also.end();
@@ -379,9 +403,14 @@ struct RaidRules
std::vector<KillTogether> killTogether;
std::vector<StayNear> stayNear;
std::vector<FaceAway> faceAway;
std::vector<LeadAway> leadAway;
std::vector<TankSpot> tankSpot;
std::vector<StandBehind> standBehind;
std::vector<GuardRise> guardRise;
// While any of these enemies is alive and in the fight, every live tank is on the raid's tank roster (PveGroupCoordinator): an
// encounter that sends tanked adds the whole time (Kel'Thuzad's Abominations, each with a Mortal Wound swap) cannot wait for the
// engaged count to grow the roster one add at a time.
std::vector<uint32_t> allTanks;
std::vector<StandFlank> standFlank;
std::vector<ResistPotion> resistPotion;
std::vector<CarrierPotion> carrierPotion;
@@ -390,6 +419,11 @@ struct RaidRules
std::vector<ThreatDrop> threatDrop; // bosses that cut their tank's threat on a schedule (ThreatDropFraction)
std::vector<uint32_t> noDispel; // auras nobody removes (removing them hurts: Wyvern Sting, Mutating Injection)
std::vector<uint32_t> noTank; // summoned adds the DPS burns down: tanks hold every other mob first and never count them as a roster need
// The tanks keep off the noTank adds for the whole fight, not only while a fixed tank row holds (Kel'Thuzad: a Soul Weaver a tank holds
// faces the tank, and the camp behind it).
bool noTankWholeFight = false;
std::vector<uint32_t> burstTank; // adds whose single hits take a full tank to a quarter (Kel'Thuzad's Abominations): their tank's healers
// pre-heal it as they would under a boss, whoever else is hurt (HitsTankHard)
std::vector<uint32_t> tankOrder; // mobs the tanks take in this order, first listed first (Majordomo: Healers, then Elites); unlisted mobs come after
std::vector<uint32_t> tankLast; // a mob the tanks take only when no other free mob is left (Majordomo: he does little damage and cannot die)
std::vector<uint32_t> offTankMob; // a boss the second tank holds from the first second (Majordomo); no area taunt while he is up, the tanks keep their mobs
@@ -398,6 +432,10 @@ struct RaidRules
// then the higher priority, then the most hurt one: wave fights where adds keep coming, an untanked one only means a threat hold, and
// the raid has to finish one before the next (Victor Nefarius' drakonids).
std::vector<uint32_t> focusHeldLowest;
// Encounters (an enemy entry that is up during them) where a ranged DPS looking for a target takes one inside its spell range before
// any farther one, whatever the priority, and leaves a far one it is on for a near one: adds that keep walking in from all sides, where
// the top priority is most often a fresh one at the far wall (Kel'Thuzad's Soldiers from the alcoves).
std::vector<uint32_t> rangedNearFirst;
};
// How long the corridor of a cast breath stays open from the first sighting of the cast. Onyxia's damage is one instant at the end of the 5 s cast
@@ -456,6 +494,10 @@ size_t InterruptOrder(uint32_t mapId, uint32_t spell);
// tank such a mob only when no other engaged mob is free, and the tank roster does not grow for it.
bool NoTank(uint32_t mapId, uint32_t entry);
// True when the map's rules list <entry> as an add whose hits take a full tank to a quarter (burstTank): the tank pre-heal treats
// one on the tank as a boss and keeps a heal going on it whoever else is hurt. Static data, safe on the bot worker threads.
bool HitsTankHard(uint32_t mapId, uint32_t entry);
// RaidRules::tankOrder: the position of <entry> in the map's tank order (0 = first), or UINT32_MAX when it is not listed.
uint32_t TankOrder(uint32_t mapId, uint32_t entry);
@@ -228,7 +228,8 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
// Fight::heldFirst: the enemies a tank of the raid holds.
std::vector<Unit*> held;
if (fight->heldFirst)
bool const anyTankAlive = std::any_of(plan.members.begin(), plan.members.end(), [](Member const& tm) { return tm.tank && tm.p->IsAlive(); });
if (fight->heldFirst || fight->heldOnly || fight->meleeHeldOnly)
for (Unit* enemy : mine)
if (Unit* v = enemy->GetVictim())
if (Player* vp = v->ToPlayer())
@@ -305,6 +306,27 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
continue;
}
// Fight::meleeOff: off limits for a melee DPS bot (see RaidFightScript.h, Kel'Thuzad).
if (fight->meleeOff && !m.ranged)
for (Unit* enemy : mine)
if (enemy->GetEntry() == fight->meleeOff)
o.forbidden_targets.push_back(enemy->GetGUID());
// Fight::meleeCampReach: the melee DPS fight at the camp, beside the tanks and in the healers' reach; an add further out is met there.
// The tanks of the row go no further than its fetchMax (22 y) for an add that has reached nobody. naxx_kelthuzad kt71a (1125): an
// Abomination sent at Mcwarra was met by four melee 32-35 y north-east of the camp (3737-3744,-5081), at the alcove rim, with the four
// tanks at their slots holding nothing; its melee and Mortal Wound killed three of them in 2 s at 58-60 s, a Wail of Souls the fourth.
if (fight->meleeCampReach > 0.f && fight->campReach > 0.f && !m.ranged)
for (Unit* enemy : mine)
if (Dist2D(enemy->GetPositionX(), enemy->GetPositionY(), fight->campX, fight->campY) > fight->meleeCampReach)
o.forbidden_targets.push_back(enemy->GetGUID());
// Fight::meleeHeldOnly: a later-rank add no tank holds is off limits for a melee DPS bot while a tank of the raid lives (see
// RaidFightScript.h, Kel'Thuzad). With every tank dead it is hit again: nobody else will take it off the raid.
if (fight->meleeHeldOnly && !m.ranged && anyTankAlive)
for (Unit* enemy : mine)
if (enemy->GetEntry() != fight->boss && enemy->GetEntry() != fight->untanked && Script::RankOf(*fight, enemy->GetEntry()) > 0 &&
std::find(held.begin(), held.end(), enemy) == held.end())
o.forbidden_targets.push_back(enemy->GetGUID());
// Skull only: everything else of the fight, marked or sheeped or not, is off limits for this bot.
if (fight->skullOnly)
for (Unit* enemy : mine)
@@ -315,6 +337,22 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
// every enemy it can reach resists those, all its class's schools count again.
uint8_t const allSchools = fight->schoolAware ? MemberDamageSchools(m, plan.mainTank) : uint8_t(0);
uint8_t const mainSchools = fight->schoolAware ? MemberMainSchools(m, plan.mainTank) : uint8_t(0);
// Fight::firstRankSquad: this bot is one of the first <firstRankSquad> ranged DPS bots of the raid (plan.members is sorted by guid).
bool inSquad = false;
size_t squadIndex = 0;
if (fight->firstRankSquad && m.ranged)
{
size_t before = 0;
for (Member const& other : plan.members)
{
if (other.p == m.p)
break;
if (other.bot && other.ranged)
++before;
}
inSquad = before < fight->firstRankSquad;
squadIndex = before;
}
std::vector<Script::Enemy> view;
view.reserve(mine.size());
for (size_t i = 0; i < mine.size(); ++i)
@@ -330,6 +368,17 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
e.eligible = enemy->IsAlive() && !forbidden && !(c && c->IsInEvadeMode()) && enemy->IsVisible() && !enemy->IsUninteractible() &&
!enemy->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
e.held = std::find(held.begin(), held.end(), enemy) != held.end();
// Fight::firstRankSquad: the first rank is for the squad only (see RaidFightScript.h, Kel'Thuzad).
if (fight->firstRankSquad && e.eligible && !inSquad && Script::RankOf(*fight, e.entry) == 0)
e.eligible = false;
// Fight::heldOnly: after the first rank, only one a tank holds (see RaidFightScript.h, Kel'Thuzad).
if (fight->heldOnly && e.eligible && !e.held && enemy->GetEntry() != fight->boss && enemy->GetEntry() != fight->untanked &&
Script::RankOf(*fight, e.entry) > 0)
e.eligible = false;
// Fight::meleeFirstReach: a melee DPS bot takes a first-rank enemy only when it is next to it (see RaidFightScript.h, Kel'Thuzad).
if (fight->meleeFirstReach > 0.f && !m.ranged && e.eligible && Script::RankOf(*fight, e.entry) == 0 &&
!m.p->IsWithinDistInMap(enemy, fight->meleeFirstReach))
e.eligible = false;
view.push_back(e);
}
// Before the camp filter, as before: a bot whose schools the camp's enemies all resist still finds one in its reach.
@@ -348,6 +397,7 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
// Fight::campReach: only the enemies at the camp this bot can see, while there is one (see RaidFightScript.h, Nefarian).
// Else the ones in its sight and spell reach (it is not sent walking: its post would walk it back), else every one.
uint64_t const raidFocus = st.focus.IsEmpty() ? 0 : st.focus.GetCounter();
bool outOfReach = false; // Fight::campHold: nothing in this bot's reach, it waits at its post
if (fight->campReach > 0.f)
{
std::vector<bool> atCamp(view.size(), false), seen(view.size(), false);
@@ -364,6 +414,8 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
if (anyAtCamp || anySeen)
for (size_t i = 0; i < view.size(); ++i)
view[i].eligible = anyAtCamp ? atCamp[i] : seen[i];
else if (fight->campHold)
outOfReach = true;
}
// The raid's focus is this bot's previous pick while it can take it; a bot that cannot keeps its own pick until that one dies.
uint64_t previous = raidFocus;
@@ -378,6 +430,46 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
if (auto own = g_ownPick.find(self); own != g_ownPick.end())
previous = own->second;
}
// Fight::campHold, nothing in reach: a bot that would wait for a far first-rank enemy (a Soldier at its alcove) takes an add of a
// later rank instead when there is one (a tanked Abomination), and walks to its reach of it. naxx_kelthuzad kt69k (1124): the
// Soldier squad (Mcmagea-e, Mclocka-c) waited 13-23 s at a time "raid:threat_hold / no target" while the tanks fought 21-41 y out;
// Mcmagea cast for 11 s of the 155 s pull (76/s).
if (outOfReach)
{
bool laterRank = false;
for (Script::Enemy const& e : view)
if (e.eligible && Script::RankOf(*fight, e.entry) > 0)
laterRank = true;
if (laterRank)
for (Script::Enemy& e : view)
if (Script::RankOf(*fight, e.entry) == 0)
e.eligible = false;
}
// Fight::squadPerEnemy: the squad splits over the first rank, nearest the camp first, so the bots of the squad do not all shoot one
// Soldier (see RaidFightScript.h, Kel'Thuzad). The share is the raid's, the same list for every bot (alive, within campReach of the
// camp, by distance to it, then guid); a bot that cannot take its own share (out of its reach or sight) picks as before.
if (inSquad && fight->squadPerEnemy > 0)
{
std::vector<std::pair<float, size_t>> firsts;
for (size_t i = 0; i < mine.size(); ++i)
if (mine[i]->IsAlive() && Script::RankOf(*fight, view[i].entry) == 0)
{
float const d = fight->campReach > 0.f ? Dist2D(mine[i]->GetPositionX(), mine[i]->GetPositionY(), fight->campX, fight->campY)
: m.p->GetExactDist2d(mine[i]);
if (fight->campReach <= 0.f || d <= fight->campReach)
firsts.emplace_back(d, i);
}
std::sort(firsts.begin(), firsts.end(), [&](auto const& a, auto const& b)
{ return a.first != b.first ? a.first < b.first : view[a.second].guid < view[b.second].guid; });
if (firsts.size() > 1)
{
size_t const mineAt = firsts[(squadIndex / fight->squadPerEnemy) % firsts.size()].second;
if (view[mineAt].eligible)
for (auto const& f : firsts)
if (f.second != mineAt)
view[f.second].eligible = false;
}
}
uint64_t const pick = Script::PickFocus(*fight, view.data(), view.size(), ownerMark.IsEmpty() ? 0 : ownerMark.GetCounter(), previous);
if (fight->schoolAware)
{
@@ -403,6 +495,23 @@ void ApplyFightScript(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& order
}
continue; // nothing the script can name for this bot: the generic rules keep it
}
// Fight::campHold: the pick is out of this bot's reach. It holds on it at its post instead of walking out after it (see
// RaidFightScript.h, Kel'Thuzad), and its pick does not count for the raid's focus. Only for a first-rank pick (a Soldier still on
// its way in from an alcove): an add a tank holds is in the room, and the bot goes to its reach of it as usual. kt69j (1124): held
// for every pick, raid:threat_hold was 931 of 2,976 rule samples of the DPS bots (about 28 s a caster in a 146 s pull), while the
// tanks fought Abominations 41-45 y from the camp.
bool firstRankPick = false;
for (Script::Enemy const& e : view)
if (e.guid == pick && Script::RankOf(*fight, e.entry) == 0)
firstRankPick = true;
if (outOfReach && firstRankPick)
{
o.script_owns = true;
o.script_focus = focus;
o.fallback_target = focus;
o.hold_target = focus;
continue;
}
o.script_owns = true;
o.script_focus = focus;
@@ -34,6 +34,15 @@ struct Fight
uint32_t freeAura = 0; // a DPS bot carrying this aura is left to the generic rules (Delusions of Jin'do: only it sees the Shades)
float campX = 0.f, campY = 0.f; // campReach > 0: the raid fights from one camp (Nefarian); an enemy counts for a DPS bot only within campReach
float campReach = 0.f; // of it and in the bot's line of sight, while any enemy of the fight is (else every enemy counts again)
float meleeFirstReach = 0.f; // > 0: the first rank counts for a melee DPS bot only within this many yards of it (Kel'Thuzad's Soldiers)
bool campHold = false; // campReach > 0: a DPS bot with only a first-rank enemy, out of its sight and spell reach, holds at its post
bool heldOnly = false; // the kill order after its first rank counts only while a tank holds it (the boss excepted)
uint8_t firstRankSquad = 0; // > 0: only this many ranged DPS bots (the first by guid) take the first rank; the rest skip it
uint32_t meleeOff = 0; // a creature entry no melee DPS bot attacks (off limits for it, the generic rules included)
uint32_t untanked = 0; // heldOnly: this entry counts though no tank holds it (nobody tanks it)
float meleeCampReach = 0.f; // campReach > 0: an enemy farther than this from the camp is off limits for a melee DPS bot (Kel'Thuzad)
uint8_t squadPerEnemy = 0; // firstRankSquad: > 0, the squad splits over the first rank, this many bots on each enemy (Kel'Thuzad)
bool meleeHeldOnly = false; // a later-rank enemy no tank holds is off limits for a melee DPS bot, its own rules too (Kel'Thuzad)
};
// Lucifron (MC 409): the two Flamewaker Protectors first, then Lucifron. The start wait is the raid's one boss opening wait (Playerbot::kRaidBossOpenWaitMs, 8 s: the main tank takes a while to run in); there is no threat cap after
@@ -83,6 +92,45 @@ struct Fight
// with no script the Priority rows only steered a DPS bot with no target, so the bots already on Fankriss or a Hatchling stayed there
// ("on the focus 0", 13-21 of 24 on one other enemy); the Spawns lived 12-25 s, each at 93-95% 6-8 s in, and from 215 s the enraged
// ones killed 39 of the 40. Fankriss himself has no enrage: his tank keeps him while the adds die.
// Kel'Thuzad (Naxxramas 533): phase 1 is Kel'Thuzad immune on his dais sending adds from the seven alcoves at random raiders
// (classic_boss_kelthuzad.cpp): a Soldier of the Frozen Wastes (16427, 2,000 health) every 3.75 s down to 2 s, which blows up on arrival
// (Dark Blast 28457, 1,750 to the whole room), Unstoppable Abominations (16428, 90,000, Mortal Wound on the tank) and Soul Weavers
// (16429, 70,000, Wail of Souls in front of them). The raid fights from one camp in the middle of the room (RaidEncounterData_NAXX.cpp),
// the tanks hold the Abominations and Weavers on an arc round it. The order: a Soldier that has come in to the camp first (one dies to a
// single volley), then an Abomination a tank holds, then a Weaver, then Kel'Thuzad himself (phases 2 and 3; the Guardians of Icecrown are
// shackled and not on the list). No start wait: the first Soldier is on its way at the pull. A melee DPS bot leaves a Soldier further than
// 8 y from it to the ranged (meleeFirstReach): sent at a random raider it can be anywhere in the camp, and the melee walked from the tanks
// to it and back. naxx_kelthuzad kt67a / kt67b (1124), no script: each DPS bot took its own pick by the generic rows, the raid stood spread
// over the whole room between the alcove keep-outs and the Weavers' cones (768-792 of 1,028-1,132 forced moves a run were that ping-pong),
// and 16 and 25 raiders died to Wail of Souls.
// campReach is 36 y, the whole floor inside the alcove keep-outs: a bot at the camp (7 y round it) then takes a Soldier as soon as it is in
// its 30 y spell reach. At 28 y (kt69a, 1124) a Soldier counted only 2-3 s before it reached the tanks' arc and blew up there: 20 of the 42
// dead were Dark Blast.
// campHold: a DPS bot with no enemy in its 30 y sight and spell reach waits at its post. Without it every enemy counted again, the pick was a
// Soldier just sent from an alcove 35-42 y off, and the ranged walked out after it (kt69b, 1124: "[hunter_chase] ... dist 40-42", a
// "role position" walk back every 1-2 s, 364 "leave hazard" at the keep-out rims); the raid drifted north, and 23 raiders 3-30 y from a
// Soul Weaver at 3702,-5079 (31 y from the camp) died to its Wail of Souls in 8 s.
// firstRankSquad: eight ranged DPS bots shoot the Soldiers, the others stay on the held Abomination. kt69i (1124), every DPS bot on the
// squadPerEnemy: the squad splits two to a Soldier, nearest the camp first. The whole squad on one Soldier (2,000 health) put most of its
// casts into one already dead: kt73a (1125), 7-13 bots on the top target in the samples from 218 s, loose mobs 14 -> 24 in 40 s, and
// Soldiers reaching the camp together killed 8 with Dark Blast at 258-261 s, 27 of the 43 dead in all.
// first rank: 45 of the 63 focus changes went to a Soldier, 232 of 290 script attacks were on one (each dies to the first hits and
// a new one comes every 2-3.75 s, so the casters spent the pull starting casts on the next), the focus was an Abomination 4 times,
// raid damage was 1,528/s, and the Abominations killed all four tanks with Mortal Wound.
// meleeOff: no melee DPS bot attacks a Soul Weaver (it has no melee of its own; the ranged and its tank kill it), and the encounter keeps them
// 8 y from one (RaidEncounterData_NAXX.cpp). A Weaver whose victim is out of its melee reach turns to the nearest raider in it
// (classic_soul_weaver_ai), so the melee beside it took it from its tank: kt69p (1124), a Weaver was on a tank in 4 of 94 [raid_fight]
// samples and on a raider in 73, most often a warrior or rogue (Mcwarra, Mcwarrb, Mcwarrc, Mcrogued, Mcreta), and 29 died to Wail of Souls.
// AzerothCore-style variant (script17ac): the Weavers are not tanked (RaidEncounterData_NAXX.cpp). The order is Soldier, Weaver, Abomination,
// Kel'Thuzad: the eight squad bots take the Soldiers, the other ranged the Weaver nearest the camp's 36 y, the melee (meleeOff) the held
// Abomination; untanked lets a Weaver count under heldOnly.
// heldOnly: an Abomination or Weaver counts only while a tank holds it. A Soul Weaver turns on whoever is nearest in its melee reach when its
// victim is not (classic_soul_weaver_ai), so DPS bots that ran out to a loose one at the alcove rim could hold it there, facing the camp
// (kt69c, 1124: 28 dead to Wail of Souls from a Weaver at 3697-3701,-5079, 31 y from the camp; the camp reach of 36 y counts it).
// meleeHeldOnly: heldOnly steers the script's focus only; a melee DPS bot's own rules still went for a loose Abomination walking in, met it
// 13-23 y from the camp (the row's tanks fetch one only within 22 y of it, and 15 y of themselves), took it off the raider it was sent at
// and died to its Mortal Wound: naxx_kelthuzad kt80a-c (1125), 11 of the 21 deaths to an Abomination before 200 s were melee DPS bots on
// a fresh one (97-100%) sent at another raider, no tank on it.
inline constexpr Fight kFights[] = {
{ 409, 12118, { 12119, 12118, 0, 0 }, kRaidBossOpenWaitMs, "Lucifron" },
{ 409, 12057, { 12057, 0, 0, 0 }, kRaidBossOpenWaitMs, "Garr" },
@@ -106,6 +154,8 @@ inline constexpr Fight kFights[] = {
{ 309, 15084, { 15084, 0, 0, 0 }, kRaidBossOpenWaitMs, "Renataki" },
{ 309, 15085, { 15085, 0, 0, 0 }, kRaidBossOpenWaitMs, "Wushoolay" },
{ 531, 15510, { 15630, 15962, 15510, 0 }, kRaidBossOpenWaitMs, "Fankriss the Unyielding" },
{ 533, 15990, { 16427, 16429, 16428, 15990, 0 }, 0, "Kel'Thuzad", false, 0, true, 0, false, 0, 3716.0f, -5106.0f, 36.0f, 8.0f, true, true, 8, 16429,
16429, 26.0f, 2, true },
};
// The fight an engaged enemy belongs to on this map (nullptr: none).
@@ -183,9 +183,18 @@ std::vector<DoorPlane> HeiganDoors(Unit* heigan)
return doors;
}
// True when (x, y) lies on his side of both doors, kDoorClear inside them.
// His leash (classic_instance_naxxramas.cpp HandleEvadeOutOfHome): he evades the moment he stands east of x 2825 or south of y -3737, and
// he walks to whoever he goes for. naxx_heigan r3af55-1: a druid healing from 2830.8,-3681.7 drew him there and he evaded at 32 s, 97%.
// So a spot off the field stays inside those lines by a melee reach and a margin, wherever the doors stand.
constexpr float kHeiganLeashX = 2825.0f;
constexpr float kHeiganLeashY = -3737.0f;
constexpr float kHeiganLeashClear = 6.0f;
// True when (x, y) lies on his side of both doors, kDoorClear inside them, and inside his leash.
bool InHeiganRoom(std::vector<DoorPlane> const& doors, float x, float y)
{
if (x > kHeiganLeashX - kHeiganLeashClear || y < kHeiganLeashY + kHeiganLeashClear)
return false;
for (DoorPlane const& d : doors)
if (((x - d.x) * d.nx + (y - d.y) * d.ny) * d.side < kDoorClear)
return false;
@@ -1036,6 +1045,12 @@ struct RazOpenSpot
bool goingIn = false; // the priest was last sent to the cast spot (for the log)
};
std::unordered_map<uint32_t, RazOpenSpot> g_razOpenSpot; // instance -> the opener's spots, kept while the priest and target stay
// Cast spots the spell refused for line of sight with the priest standing on them: no search picks a spot this close to one again.
// naxx_razuvious rbaf56-1: the spot (2735.4,-3111.5) passed the search's sight test (2 y above the ground, then the understudy's own height
// again on top) and the cast check (the priest's eyes to the understudy, every model counted), and Mind Control failed LINE_OF_SIGHT on
// each of seven goes in 2.5 min; the fallback pull at 170 s sent the main tank in on an understudy.
constexpr float kRazBlockedNear = 2.0f;
std::unordered_map<uint32_t, std::vector<std::pair<float, float>>> g_razCastBlocked; // instance -> refused cast spots
// The nearest his walk comes to (x, y): the legs of his waypoint path, closed into a loop, and where he stands (he is off the path while
// he walks back to it). With no path, where he stands.
@@ -1374,7 +1389,8 @@ void NaxxPrePullRazuvious(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& o
float const run = std::max(priest->GetSpeed(MOVE_RUN), 1.0f);
struct Candidate { Creature* us; float sx, sy, sz, wx, wy, score, window, need; bool fits; };
std::vector<Candidate> candidates;
int inReach = 0, noGround = 0, noWait = 0, walkFailed = 0;
int inReach = 0, noGround = 0, noWait = 0, walkFailed = 0, refused = 0;
std::vector<std::pair<float, float>> const& blocked = g_razCastBlocked[instance];
for (Creature* c : understudies)
for (int k = 0; k < 24; ++k)
{
@@ -1389,11 +1405,20 @@ void NaxxPrePullRazuvious(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& o
continue;
}
float sz = 0.0f;
if (!RazFloor(priest, sx, sy, c->GetPositionZ(), sz) || !c->IsWithinLOS(sx, sy, sz + 2.0f))
// The sight test the spell makes (Spell::CheckCast, Spell::IsWithinLOS with the target as the source): from the understudy's
// hit sphere to the priest standing on the spot at the understudy's height above its feet, M2 models ignored.
if (!RazFloor(priest, sx, sy, c->GetPositionZ(), sz) ||
!c->IsWithinLOS(sx, sy, sz, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2))
{
++noGround;
continue;
}
if (std::any_of(blocked.begin(), blocked.end(),
[&](std::pair<float, float> const& b) { return Dist2D(b.first, b.second, sx, sy) < kRazBlockedNear; }))
{
++refused;
continue;
}
int j = 1;
for (; j <= kRazWaitSteps; ++j)
{
@@ -1459,8 +1484,8 @@ void NaxxPrePullRazuvious(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& o
spot.failedMs = std::max(now, 1u);
if (g_razOpenLogged.insert(instance).second)
TC_LOG_WARN("playerbot.v2.raid", "[raid_razuvious] {} finds no Mind Control spot with a wait spot out of his sight ({:.0f} y) "
"and a clear walk: {} spots inside an understudy's reach, {} without ground or sight, {} with no wait spot, "
"{} walks refused", priest->GetName(), sight, inReach, noGround, noWait, walkFailed);
"and a clear walk: {} spots inside an understudy's reach, {} without ground or sight, {} refused the cast before, "
"{} with no wait spot, {} walks refused", priest->GetName(), sight, inReach, noGround, refused, noWait, walkFailed);
return;
}
us = best->us;
@@ -1530,7 +1555,21 @@ void NaxxPrePullRazuvious(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& o
"{:.0f} y needed ({:.0f} y to walk, a {:.1f} s cast), him at ({:.1f},{:.1f}) walking {:.1f} y/s", priest->GetName(), closest,
seconds, sight, left, castS, raz->GetPositionX(), raz->GetPositionY(), speed);
spot.goingIn = true;
if (left <= 1.5f && priest->GetExactDist(us) <= mcReach(us) - 0.5f && priest->IsWithinLOSInMap(us) && !priest->isMoving())
if (left <= 1.5f && priest->GetExactDist(us) <= mcReach(us) - 0.5f && !priest->isMoving() &&
!us->IsWithinLOSInMap(priest, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2))
{
// On the spot and the spell's own sight test fails: the spot is dropped for good and the next pass looks for another.
g_razCastBlocked[instance].emplace_back(spot.sx, spot.sy);
TC_LOG_INFO("playerbot.v2.raid", "[raid_razuvious] {} stands on its cast spot ({:.1f},{:.1f},{:.1f}) {:.1f} y from the understudy and "
"the understudy cannot see it as Mind Control checks it: the spot is dropped, another is looked for",
priest->GetName(), priest->GetPositionX(), priest->GetPositionY(), priest->GetPositionZ(), priest->GetExactDist(us));
float const wx = spot.wx, wy = spot.wy, wz = spot.wz;
spot = RazOpenSpot{};
SetMove(o, wx, wy, wz, "razuvious: wait out of his sight");
o.prepull_wait = true;
return;
}
if (left <= 1.5f && priest->GetExactDist(us) <= mcReach(us) - 0.5f && Ready(priest, rank, us, true) && !priest->isMoving())
{
o.move = false;
o.cast_kind = RaidOrder::CastKind::CrowdControl;
@@ -4385,6 +4424,8 @@ void NaxxPrePull(Plan& plan, std::unordered_map<uint64_t, RaidOrder>& orders, st
g_razOpener.clear();
if (g_razOpenLogged.size() > 64)
g_razOpenLogged.clear();
if (g_razCastBlocked.size() > 64)
g_razCastBlocked.clear();
if (g_gothDraw.size() > 64)
g_gothDraw.clear();
if (g_gothSplitSince.size() > 64)
@@ -57,6 +57,9 @@ struct RaidOrder
// (non-tanks), crowd-controlled adds, Majordomo's reflecting adds, the
// swap enemy for a tank that carries its debuff.
std::vector<ObjectGuid> forbidden_targets;
// A tank of a fixed tank row while the row holds: no enemy the map's rules leave untanked (RaidRules::noTank) is its own, whatever
// the forbidden list of the last pass says (the tank planner reads this before the brain has seen an add sent this tick).
bool no_tank_off = false;
// Where a DPS bot goes when its victim is forbidden (empty = stop).
ObjectGuid fallback_target;
// Where an off-tank goes when the enemy it holds becomes forbidden (a banished add): the raid's main target, instead of
+30
View File
@@ -8,6 +8,7 @@
// its ranks ascend by base level. A real chain wins where there is one.
#pragma once
#include "DB2Structure.h"
#include "Define.h"
#include "Log.h"
#include "SpellInfo.h"
@@ -40,6 +41,20 @@ inline std::string KeyOf(SpellInfo const* si, LocaleConstant loc)
std::to_string(uint32(e0.ApplyAuraName)) + '|' + (si->IsPassive() ? 'p' : 'a');
}
// A spell the class can never learn: it has skill line abilities and every one of them is NeverLearned. The Forever client
// carries no-rank copies of some class spells next to their real ranks (Holy Light 19968/19980/19981/19982 with 1 healing,
// Flash of Light 19993): same name, family and first effect, so without this they joined the family as its "highest" rank.
inline bool IsNeverLearned(uint32 spell_id)
{
SkillLineAbilityMapBounds const bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
if (bounds.first == bounds.second)
return false;
for (auto it = bounds.first; it != bounds.second; ++it)
if (it->second->GetAcquireMethod() != SkillLineAbilityAcquireMethod::NeverLearned)
return false;
return true;
}
inline Index const& GetIndex()
{
static Index idx;
@@ -69,6 +84,19 @@ inline Index const& GetIndex()
uint32 const la = sa ? sa->BaseLevel : 0, lb = sb ? sb->BaseLevel : 0;
return la != lb ? la < lb : a < b;
});
// Never-learnable copies leave a family that has a learnable rank (they keep pointing at it through family_of, so a copy
// a bot already has in its book still resolves to the real ranks). The Forever client's 1-point Holy Light 19981 sorted
// after rank 2 639 (both base level 6) and paladin bots healed for 1 (VempirE, Dumpins, y_dem, Discord 2026-11-24).
uint32 dropped = 0;
for (auto& f : idx.families)
{
if (f.size() < 2 || std::all_of(f.begin(), f.end(), IsNeverLearned))
continue;
size_t const before = f.size();
std::erase_if(f, IsNeverLearned);
dropped += uint32(before - f.size());
}
TC_LOG_INFO("playerbot.v2", "[spell_data] {} never-learnable spell copies left out of their rank families", dropped);
// [spell_data] (client moves 70205 -> 70291): which of the curses and tank / raid debuff spells the loaded DB2 data carries and how
// many ranks each family has, once at the first lookup. Curse of the Elements 1490 and Curse of Shadow 17862 were missing in 70205.
for (uint32 const id : { 704u, 702u, 980u, 1490u, 17862u, 1714u, 8647u, 7386u, 20271u, 1130u })
@@ -85,6 +113,8 @@ inline Index const& GetIndex()
} // namespace detail
using detail::IsNeverLearned;
// Ranks of the spell, lowest first: the spell data's chain ranks together with every spell of the same family. The two overlap for
// most spells and differ for some: Mark of the Wild 1126 has a chain that holds only part of its ranks, and a bot that cast a rank
// outside the chain never saw the aura as "its" buff (MC Garr 2026-10-10: the druids recast it for ever, the tracked list stayed empty).
@@ -37,6 +37,12 @@ bool DungeonCombatPositioning(BotSnapshotView const& s, BotAI& ai,
BotIntentEmitter& emit,
DungeonAdvice const& advice);
// Up for air, on the server's breath timer (Swim::BreathGoesUp), in every state: idle:surface_to_breathe, the dungeon preempt and the
// fight. BreathDue updates the bot's latch and logs [breath] when it goes up and when its breath is full again; SurfaceForAir swims it
// straight up and holds it at the surface until then (true = the tick is spent). Definitions in State_Idle.cpp.
bool BreathDue(BotSnapshotView const& s, BotAI& ai);
bool SurfaceForAir(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter& emit, char const* rule);
// Off-mesh-aware single step toward a dungeon target (the tank), GUID-keyed with
// float out-params. Resolves the bot from self_guid, then returns the next
// navmesh waypoint (capped at maxStep) toward (tx,ty,tz); sets is_offmesh when
@@ -19,6 +19,7 @@
#include "Bot/BotSnapshotView.h"
#include "Bot/BotIntentEmitter.h"
#include "Bot/BotIntent.h"
#include "Bot/BotTextMgr.h"
#include "DB2Stores.h"
#include "World.h"
#include "Util/ConfigReader.h"
@@ -31,9 +32,15 @@
#include "Bot/TownErrand.h"
#include "Bot/TownErrandConfig.h"
#include "Bot/ClassicUpkeep.h"
#include "Bot/RecipeDifficulty.h"
#include "Combat/Apl/ApClassicHeal.h" // idle:kind_heal: the class heal and its rank
#include "ClassicSpec.h" // Classic::IsSingleSpecClass
#include "SharedDefines.h"
#include "Player.h" // EQUIPMENT_SLOT_MAINHAND for the station-tool swap
#include "GameObjectData.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "Fleet/GateDuels.h"
#include "Fleet/Gathering.h"
#include "Fleet/StrangerBoard.h"
@@ -920,9 +927,10 @@ bool InnRestFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
InnLog(s, "inn is full, goes on errands", bx, by);
return false;
}
// Stand a few yards from the innkeeper, on the side the bot comes from, each bot in its own slot of a fan so they stand side by side.
// Stand a few yards from the innkeeper on its customer side (the spawn's facing — the innkeeper looks at the
// room, never into the counter or a wall), each bot in its own slot of a fan so they stand side by side.
float tx, ty;
TE::StandPoint(inn->x, inn->y, bx, by, kInnStandYards + float(slot / 5u) * 1.5f, slot, tx, ty);
TE::StandPoint(inn->x, inn->y, bx, by, kInnStandYards + float(slot / 5u) * 1.5f, slot, tx, ty, inn->orientation);
// The stand point is a straight line from the innkeeper and can sit behind a wall; the inn is the goal, so a bot that is within a
// few yards of the innkeeper, or that cannot get closer than a room's width, rests where it is.
float const to_inn = std::hypot(bx - inn->x, by - inn->y);
@@ -994,10 +1002,12 @@ bool MailboxFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
// ---------- idle:town_errand ----------
// A capital's residents go about their business (Bot/TownErrand.h): each runs to a real place anywhere in the city (the auction house,
// the bank, its class trainer, the inn, a mailbox, the flight master, a vendor, now and then the city gate), stops there a few seconds
// facing the NPC, and runs straight on to the next place. The walk is one pathed move to the place, so the bot runs a smooth line
// through the streets and past the player, instead of the 25 y random wander hops with a stop and a turn at each. Every place holds a
// few bots at once (SpotCap); a bot finding one full picks another.
// the bank, its class trainer, the inn, a mailbox, the flight master, a vendor, a craft station, now and then the city gate), stops
// there a while — a few seconds at a trainer, half a minute at the bank or the auction house, a minute working at an anvil — and
// runs straight on to the next place. The walk is one pathed move to the place, so the bot runs a smooth line through the streets
// and past the player, instead of the 25 y random wander hops with a stop and a turn at each. Every place holds a few bots at once
// (SpotCap); a bot finding one full picks another. The Fixture.* counts keep a guaranteed share of bots at the places a living
// city never leaves empty — always someone at the bank, never the same someone for long.
constexpr uint32 kErrandWalkTimeoutMs = 120000u;
constexpr uint32 kErrandStaleMs = 180000u;
constexpr uint64 kGateKeyBase = 0xE0000000ull;
@@ -1019,6 +1029,20 @@ static uint32 PlaceCap(TE::Kind k)
return c.spot_cap;
}
// The bot's own trade skill makes the station it can really work at the more convincing visit (and lets the linger
// cast a real recipe): a smith at the anvil, a cook at the fire, a tailor at the loom or moonwell.
static bool CraftKindMatch(TE::Kind k, BotSnapshotView const& s)
{
switch (k)
{
case TE::Kind::Forge: return s.has_skill(164) || s.has_skill(202) || s.has_skill(186); // blacksmithing, engineering, mining
case TE::Kind::Cookfire: return s.has_skill(185); // cooking
case TE::Kind::Loom: return s.has_skill(197); // tailoring needs no station — the loom is a shop, not a requirement
case TE::Kind::Moonwell: return s.skill_value(197) >= 250; // moonwell work starts at Mooncloth (Tailoring 250)
default: return false;
}
}
// The places of the city within ErrandRadius of (bx, by) that this bot has a reason to go to.
static void TownDests(BotSnapshotView const& s, float bx, float by, float bz, std::vector<TE::Dest>& out)
{
@@ -1042,13 +1066,23 @@ static void TownDests(BotSnapshotView const& s, float bx, float by, float bz, st
else if ((f & UNIT_NPC_FLAG_TRAINER) && n.trainer_class != 0 && n.trainer_class == s.cls()) k = TE::Kind::Trainer;
else if (f & (UNIT_NPC_FLAG_VENDOR_MASK | UNIT_NPC_FLAG_REPAIR)) { k = TE::Kind::Vendor; if (need_vendor) boost = 5.0f; }
if (k == TE::Kind::None) return;
out.push_back({ k, n.spawn_id, n.entry, n.x, n.y, n.z, TE::BaseWeight(k) * boost });
out.push_back({ k, n.spawn_id, n.entry, n.x, n.y, n.z, TE::BaseWeight(k) * boost, 0u, n.orientation });
});
::Playerbot::V2::Travel::TownNpcIndex::Instance().ForEachMailboxNear(s.map_id(), bx, by, c.radius, [&](::Playerbot::V2::Travel::TownNpc const& n)
{
if (std::fabs(n.z - bz) > kLayerYards) return;
out.push_back({ TE::Kind::Mailbox, n.spawn_id, 0u, n.x, n.y, n.z, TE::BaseWeight(TE::Kind::Mailbox) });
});
// The craft stations (anvil, forge, cooking fire, loom, moonwell) the town's gameobjects carry: a bot stops
// there to work like a player does — but only a bot with the trade for it, so the smith at the anvil is a
// real smith (the tool in hand, a recipe it can really cast), never a priest miming.
::Playerbot::V2::Travel::TownNpcIndex::Instance().ForEachFocusNear(s.map_id(), bx, by, c.radius, [&](::Playerbot::V2::Travel::TownNpc const& n)
{
if (!n.focus_kind || std::fabs(n.z - bz) > kLayerYards) return;
TE::Kind const k = TE::Kind(n.focus_kind);
if (!CraftKindMatch(k, s)) return;
out.push_back({ k, n.spawn_id, 0u, n.x, n.y, n.z, TE::BaseWeight(k) * 2.5f, n.focus_type });
});
if (c.exits)
{
V2::GateDuels::GateSpot gate;
@@ -1058,12 +1092,34 @@ static void TownDests(BotSnapshotView const& s, float bx, float by, float bz, st
}
}
static void EndErrand(BotSnapshotView const& s, TE::State& st, bool done)
static uint32 StationToolEntry(TE::Kind kind, BotSnapshotView const& s); // defined below with the recipe table
static void EndErrand(BotSnapshotView const& s, BotIntentEmitter& emit, TE::State& st, bool done)
{
if (st.work_emote)
emit.perform_emote(EMOTE_STATE_NONE); // a looped work emote stops when the bot moves off
if (st.tool_in_hand)
{
// The swap back: the displaced weapon sits in the tool's bag slot. An empty slot means the
// mainhand was empty when the tool went in — nothing to restore. The slot holding the tool
// itself means a gear rule already put the weapon back on — leave it alone.
for (auto const& it : s.raw().inventory.bag_items)
if (it.bag == st.tool_bag && it.slot == st.tool_slot && it.entry != StationToolEntry(st.kind, s))
{
emit.equip_item(st.tool_bag, st.tool_slot, EQUIPMENT_SLOT_MAINHAND);
break;
}
emit.set_sheath(SHEATH_STATE_UNARMED); // the show drew the weapons; hands away again at idle
}
if (st.place) TE::Spots::Get().Release(st.place, s.bot_id());
if (st.key) st.recent.add(st.key);
if (done) ++st.errands;
bool const had_show = st.work_emote;
st.Clear();
// A visit that ran the work show ends on a beat — the smith wipes his hands before
// he walks. Without it the next pick's move_to lands the same tick the emote drops
// and the client slides him out of a mid-swing pose.
if (had_show) st.pause_until_ms = s.published_at_ms() + 1500u;
}
// A bot placed in the town by the spawner (TownPct) is in its profession mode for 45-90 minutes and lives there. Any other bot in a
@@ -1079,6 +1135,36 @@ static bool TownTime(BotSnapshotView const& s, BotAI& ai, uint32 now_ms)
constexpr uint32 kLeaveMs = 10u * 60u * 1000u; // out at the gate: this long with no errands, grind_roam leads the bot off
// Claim a stand slot at `d` and open the errand there. False when the place filled in the meantime.
static bool TakeErrand(BotSnapshotView const& s, TE::State& st, TE::Dest const& d, bool leaving, uint32 now_ms)
{
float bx, by, bz;
s.position(bx, by, bz);
uint64 const place = TE::Spots::PlaceKey(s.map_id(), d.x, d.y);
uint32 slot = 0;
if (!TE::Spots::Get().Claim(place, s.bot_id(), now_ms, kSpotHoldMs, PlaceCap(d.kind), &slot))
return false;
st.Clear();
if (d.kind == TE::Kind::Vendor) st.want_vendor = false; // the sell the last visit couldn't do
st.kind = d.kind; st.key = d.key; st.place = place; st.entry = d.entry; st.slot = slot;
st.focus_type = d.focus_type;
st.leaving = leaving;
st.nx = d.x; st.ny = d.y; st.nz = d.z;
float ring = 3.5f + float(slot / 5u) * 1.5f;
if (d.kind == TE::Kind::Mailbox) ring = 2.5f;
else if (d.kind == TE::Kind::Exit) ring = 3.0f + float(slot % 6u) * 1.5f;
else if (TE::IsCraftKind(d.kind)) ring = 2.8f + float(slot % 3u) * 0.7f; // right at the anvil: two smiths share the fire
TE::StandPoint(d.x, d.y, bx, by, ring, slot, st.tx, st.ty, d.orientation);
st.tz = d.z;
st.phase = 1;
st.phase_start_ms = now_ms;
// One bot in 16 logs its errands, so a soak shows where residents go without a line per errand of every bot.
if (s.bot_id() % 16u == 0u)
TC_LOG_INFO("playerbot.v2", "[town] {} -> {} ({:.0f},{:.0f}) {:.0f} y slot {} (zone {})",
s.name(), TE::KindName(d.kind), d.x, d.y, std::hypot(d.x - bx, d.y - by), slot, s.zone_id());
return true;
}
// Choose the next place and claim a stand slot there. False when the city offers nothing.
static bool PickErrand(BotSnapshotView const& s, BotAI& ai, TE::State& st, uint32 now_ms)
{
@@ -1092,6 +1178,11 @@ static bool PickErrand(BotSnapshotView const& s, BotAI& ai, TE::State& st, uint3
&& std::any_of(dests.begin(), dests.end(), [](TE::Dest const& d) { return d.kind == TE::Kind::Exit; });
if (leaving)
std::erase_if(dests, [](TE::Dest const& d) { return d.kind != TE::Kind::Exit; });
// A kit visit that couldn't start for full bags sent the bot to sell first: the next
// errand is a vendor when one's in reach (cleared when the vendor errand is taken).
if (!leaving && st.want_vendor
&& std::any_of(dests.begin(), dests.end(), [](TE::Dest const& d) { return d.kind == TE::Kind::Vendor; }))
std::erase_if(dests, [](TE::Dest const& d) { return d.kind != TE::Kind::Vendor; });
if (dests.empty()) return false;
uint64 const bot = s.bot_id();
uint32 const map = s.map_id();
@@ -1102,30 +1193,323 @@ static bool PickErrand(BotSnapshotView const& s, BotAI& ai, TE::State& st, uint3
if (!leaving && ai.hearth_rebind_due(s.zone_id())
&& std::any_of(dests.begin(), dests.end(), [&](TE::Dest const& d) { return d.kind == TE::Kind::Inn && !full(d); }))
std::erase_if(dests, [](TE::Dest const& d) { return d.kind != TE::Kind::Inn; });
// Fixture places (Playerbot.World.Town.Fixture.*): a bank, auction house or craft station below its guaranteed share of bots
// draws the next errand before the usual weighted pick. The claim still decides: once `want` bots hold the place (bots on
// their way there count), the steering stops, so the fill cannot over-shoot and the crowd at a place keeps rotating.
if (!leaving)
{
std::vector<TE::Dest> under;
for (TE::Dest const& d : dests)
{
uint32 want = TE::FixtureTarget(TE::Cfg(), d.kind);
if (!want) continue;
uint64 const place = TE::Spots::PlaceKey(map, d.x, d.y);
if (TE::Spots::Get().Count(place, now_ms) >= std::min(want, PlaceCap(d.kind))) continue;
if (full(d)) continue;
under.push_back(d);
}
if (!under.empty())
{
int const k = TE::Pick(under, bx, by, TE::Cfg().radius, st.recent, float(ai.rng().unit()),
[](TE::Dest const&) { return false; });
if (k >= 0 && TakeErrand(s, st, under[size_t(k)], leaving, now_ms))
return true;
}
}
int const k = TE::Pick(dests, bx, by, TE::Cfg().radius, leaving ? TE::Recent{} : st.recent, float(ai.rng().unit()), full);
if (k < 0) return false;
TE::Dest const& d = dests[size_t(k)];
uint64 const place = TE::Spots::PlaceKey(map, d.x, d.y);
uint32 slot = 0;
if (!TE::Spots::Get().Claim(place, bot, now_ms, kSpotHoldMs, PlaceCap(d.kind), &slot))
return false;
st.Clear();
st.kind = d.kind; st.key = d.key; st.place = place; st.entry = d.entry; st.slot = slot;
st.leaving = leaving;
st.nx = d.x; st.ny = d.y; st.nz = d.z;
float const ring = d.kind == TE::Kind::Mailbox ? 2.5f : d.kind == TE::Kind::Exit ? 3.0f + float(slot % 6u) * 1.5f : 3.5f + float(slot / 5u) * 1.5f;
TE::StandPoint(d.x, d.y, bx, by, ring, slot, st.tx, st.ty);
st.tz = d.z;
st.phase = 1;
st.phase_start_ms = now_ms;
// One bot in 16 logs its errands, so a soak shows where residents go without a line per errand of every bot.
if (s.bot_id() % 16u == 0u)
TC_LOG_INFO("playerbot.v2", "[town] {} -> {} ({:.0f},{:.0f}) {:.0f} y slot {} (zone {})",
s.name(), TE::KindName(d.kind), d.x, d.y, std::hypot(d.x - bx, d.y - by), slot, s.zone_id());
return true;
return TakeErrand(s, st, dests[size_t(k)], leaving, now_ms);
}
// At the place: face the NPC, sell the junk or repair at a vendor, one gesture now and then, and stop a few seconds.
// A station of this focus type really stands within its spell-focus reach of the bot — the same check
// idle:craft_skillup makes before a real cast (SPELL_FOCUS gameobject whose type and radius fit).
static bool FocusInReach(BotSnapshotView const& s, uint32 focus_type)
{
float bx = 0.f, by = 0.f, bz = 0.f;
s.position(bx, by, bz);
for (auto const& go : s.raw().world_objects.nearby_objects)
{
GameObjectTemplate const* info = sObjectMgr->GetGameObjectTemplate(go.entry);
if (!info || info->type != GAMEOBJECT_TYPE_SPELL_FOCUS || uint32(info->GetSpellFocusType()) != focus_type)
continue;
float const dx = go.x - bx, dy = go.y - by, dz = go.z - bz;
float const r = float(info->GetSpellFocusRadius());
if (dx * dx + dy * dy + dz * dz <= r * r)
return true;
}
return false;
}
// The best recipe the bot knows for this station: needs this focus — or none, a no-station recipe casts
// anywhere — still gives skill (orange over yellow over green), not on cooldown. Reagents are NOT part of the pick — the caller stocks the bags for the
// chosen recipe (a worker's kit is conjured once per visit), so a recipe it knows always leads to a real cast.
// 0 = no usable recipe at all — the station show then falls back to the work emote.
// The station's own trade only: a smith at the anvil casts smithing, never the leatherworking she
// also knows — the recipe needing no focus at all is not a license to work a foreign craft on this
// fixture (a leatherwork anim at the anvil while the smithing kit clangs was the tell). Same
// station -> skill mapping as CraftKindMatch.
static bool StationSkillMatch(TE::Kind k, uint32 skill_line)
{
switch (k)
{
case TE::Kind::Forge: return skill_line == 164 || skill_line == 202 || skill_line == 186;
case TE::Kind::Cookfire: return skill_line == 185;
case TE::Kind::Loom:
case TE::Kind::Moonwell: return skill_line == 197;
default: return false;
}
}
static uint32 PickCraftSpell(BotSnapshotView const& s, uint32 focus_type, TE::Kind kind)
{
if (!FocusInReach(s, focus_type))
return 0;
uint32 best = 0;
RecipeColor best_color = RecipeColor::Unknown;
uint16 best_skill = 0xFFFFu;
for (uint32 spell_id : s.raw().spellbook.known_recipes)
{
RecipeMeta const* meta = FindRecipeMeta(spell_id);
if (!meta || s.is_skill_capped(meta->skill_line_id)) continue;
if (!StationSkillMatch(kind, meta->skill_line_id)) continue;
SpellInfo const* si = sSpellMgr->GetSpellInfo(spell_id, DIFFICULTY_NONE);
if (!si) continue;
// The station's own focus — or none: vanilla recipes that need no station (the bolts,
// the bandages) cast fine standing anywhere, so a tailor at the loom works for real.
uint32 const need_focus = uint32(si->RequiresSpellFocus);
if (need_focus != 0 && need_focus != focus_type) continue;
uint16 const cur = s.skill_value(meta->skill_line_id);
RecipeColor const c = ResolveRecipeColor(spell_id, cur);
if (c == RecipeColor::Gray || c == RecipeColor::Unknown) continue;
// Cooldown only — NOT is_ready: is_ready folds in has_reagents, and
// missing reagents is precisely the case the caller conjures stock
// for. The other readiness gates (casting / GCD / moving) are
// re-checked on the cast beat itself.
if (s.cd_remaining(spell_id).count() > 0) continue;
bool const better = best == 0 || uint8(c) < uint8(best_color) || (c == best_color && cur < best_skill);
if (better) { best = spell_id; best_color = c; best_skill = cur; }
}
return best;
}
// The tool of the trade in hand while it works: a smith hammers with a hammer, not a sword and an empty fist.
// The equip swap leaves the weapon in the tool's bag slot, so the same equip_item call in EndErrand puts the
// battle kit back on. A bot set up before the tool grant (DoLearnProfessions) has the skill but no tool: it is
// conjured into the bags once (a worker carries their own), and the next use-beat equips it.
static uint32 StationToolEntry(TE::Kind kind, BotSnapshotView const& s)
{
if (kind != TE::Kind::Forge) return 0; // cookfire, loom, moonwell need no tool in vanilla
if (s.has_skill(164)) return 5956; // Blacksmith Hammer
if (s.has_skill(202)) return 6219; // Arclight Spanner
if (s.has_skill(186)) return 2901; // Mining Pick — smelting
return 0;
}
// The one starter recipe a station's trade casts from conjured stock, taught lazily at the station via a
// learn_spell intent — bots set up before DoLearnProfessions' grants (or whose grant missed) still craft
// for real. Mirrors CraftKindMatch's station -> skill mapping.
static uint32 StationRecipeEntry(TE::Kind kind, BotSnapshotView const& s)
{
switch (kind)
{
case TE::Kind::Forge:
if (s.has_skill(164)) return 2660; // Rough Sharpening Stone
if (s.has_skill(202)) return 3918; // Rough Blasting Powder
if (s.has_skill(186)) return 2657; // Smelt Copper
return 0;
case TE::Kind::Cookfire: return s.has_skill(185) ? 8604 : 0; // Herb Baked Egg
case TE::Kind::Loom: return s.has_skill(197) ? 2963 : 0; // Bolt of Linen Cloth
case TE::Kind::Moonwell: return s.has_skill(197) ? 18560 : 0; // Mooncloth
default: return 0;
}
}
enum class KitResult { Working, Ready, Abort };
// The kit of the trade: the station's tool in the hand. The emit can't report an outcome — a refused
// give or swap is invisible to the bot thread — so the bags are the truth: an item that left the bags
// went into the hand (an equipment slot is not a bag), which is what confirms the swap, and an item
// still in the bags means the last emit didn't land and goes out again. Full bags make the give
// impossible outright: the worker goes to sell first (want_vendor steers the next errand to a vendor).
static KitResult StationKit(BotSnapshotView const& s, BotIntentEmitter& emit, TE::State& st)
{
uint32 const tool_entry = StationToolEntry(st.kind, s);
if (!tool_entry || st.tool_in_hand) return KitResult::Ready;
// Already in the hand — left on from an earlier visit's empty-mainhand end. Counts as a
// confirmed kit; without this the bags scan finds nothing and conjures a second tool.
if (s.raw().inventory.equipped.size() > EQUIPMENT_SLOT_MAINHAND &&
s.raw().inventory.equipped[EQUIPMENT_SLOT_MAINHAND].entry == tool_entry)
{
st.tool_in_hand = true;
emit.set_sheath(SHEATH_STATE_MELEE);
emit.emote_text("hefts their hammer."); // debug anchor: the kit confirmed — the hand should show the tool now
return KitResult::Ready;
}
for (auto const& it : s.raw().inventory.bag_items)
if (it.entry == tool_entry)
{
// A swap is already in flight: only the tracked item counts — a second same-entry
// tool in the bags (or the swap-back's spare) must not keep re-triggering swaps.
if (st.tool_guid != 0)
{
if (it.guid.GetCounter() == st.tool_guid)
{
if (emit.equip_item(it.bag, it.slot, EQUIPMENT_SLOT_MAINHAND))
{
st.tool_bag = it.bag;
st.tool_slot = it.slot;
}
return KitResult::Working;
}
continue; // not our tool — keep looking
}
if (emit.equip_item(it.bag, it.slot, EQUIPMENT_SLOT_MAINHAND))
{
st.tool_bag = it.bag;
st.tool_slot = it.slot;
st.tool_guid = it.guid.GetCounter();
}
return KitResult::Working;
}
if (st.tool_bag != 0xFF) // a swap went out and the tool left the bags: it's the hand now
{
st.tool_in_hand = true;
emit.set_sheath(SHEATH_STATE_MELEE); // hands stay sheathed at idle: draw the tool or the show looks empty-handed
emit.emote_text("hefts their hammer."); // debug anchor: the kit confirmed — the hand should show the tool now
return KitResult::Ready;
}
if (s.bag_free_slots() < 2u)
{
// Nowhere for the kit to land — a worker with full bags sells before he stocks up.
st.want_vendor = true;
return KitResult::Abort;
}
if (emit.give_item(tool_entry))
TC_LOG_INFO("playerbot.v2", "[town] {} has no tool: item {} given for the {}", s.name(), tool_entry, TE::KindName(st.kind));
return KitResult::Working;
}
// A bot at a craft station "uses" it every 8-15 s of the linger: cast a known recipe that needs this focus when
// it can (the real smith hammering is the most convincing look there is; CraftCast=0 turns that off), else hold
// the looped work emote for the station.
static void CraftUse(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter& emit, TE::State& st, uint32 now_ms)
{
// The kit comes first, on a quicker cadence than the use-beat: a give or swap the
// server refuses leaves no trace the bot thread can see, so each check retries the
// step that's still short. A few failures and the visit ends — a worker who can't
// get set up walks off; miming the station with empty hands was the tell.
if (!st.kit_ready)
{
if (now_ms < st.next_kit_ms) return;
st.next_kit_ms = now_ms + 2000u;
KitResult const kit = StationKit(s, emit, st);
TC_LOG_INFO("playerbot.v2", "[town-kit] {} attempt={} result={} kind={} guid={}", s.name(),
uint32(st.kit_attempts), kit == KitResult::Ready ? "ready" : kit == KitResult::Abort ? "abort" : "working",
TE::KindName(st.kind), st.tool_guid);
if (kit == KitResult::Ready)
st.kit_ready = true;
else if (kit == KitResult::Abort || ++st.kit_attempts >= 6u)
{
EndErrand(s, emit, st, false);
return;
}
else
return; // the kit's still coming together — the work show waits for it
}
// The tool displaces the weapon for the whole visit: keep the upgrade rule off the mainhand
// the way the skillup path does — a staff swapped back in mid-hammer was the tell.
if (st.tool_guid != 0 || st.tool_in_hand)
ai.station_prop_extend(now_ms);
// The work sound while the emote loops: the kit is a one-shot, so re-push it on the animation's
// strike period (conf-tuned: the clang should land on the visible hit, a fixed period, no jitter).
if (st.work_emote && now_ms >= st.next_sound_ms)
{
static int32 const beat_ms = sConfigMgr->GetIntDefault("Playerbot.World.Town.CraftSoundBeatMs", 1000, true);
st.next_sound_ms = now_ms + uint32(beat_ms > 200 ? beat_ms : 200);
if (uint32 const kit = TE::SoundKitFor(TE::Cfg(), st.kind))
emit.emit(PlaySoundIntent{ kit });
}
if (now_ms < st.next_use_ms) return;
st.next_use_ms = now_ms + 8000u + uint32(ai.rng().int_range(0, 70)) * 100u;
// The work sound: the real cast carries whatever audio its visual kit owns, but the emote beats are
// silent — push the station's own tradeskill kit (anvil clang, pot, loom) to earshot once a beat.
if (uint32 const kit = TE::SoundKitFor(TE::Cfg(), st.kind))
emit.emit(PlaySoundIntent{ kit });
if (TE::Cfg().craft_cast)
if (uint32 const spell = PickCraftSpell(s, st.focus_type, st.kind))
{
if (s.has_reagents(spell))
{
if (s.is_ready(spell))
{
if (st.work_emote)
{
emit.perform_emote(EMOTE_STATE_NONE);
st.work_emote = false;
}
if (s.bot_id() % 16u == 0u)
TC_LOG_INFO("playerbot.v2", "[town] {} crafts spell {} at the {}", s.name(), spell, TE::KindName(st.kind));
emit.cast(spell);
return;
}
}
// The stock of the trade: enough reagents for a few casts, conjured into the bags once per visit
// like the tool (a smith's bag holds the bars). What the visit leaves is the worker's kit — the
// next station visit casts with it; what it makes the bot sells at its next vendor stop.
else if (!st.stock_given)
{
bool all = true;
if (SpellInfo const* si = sSpellMgr->GetSpellInfo(spell, DIFFICULTY_NONE))
{
for (uint8 r = 0; r < MAX_SPELL_REAGENTS; ++r)
if (si->Reagent[r] > 0 && si->ReagentCount[r] > 0)
all &= emit.give_item(uint32(si->Reagent[r]), uint16(si->ReagentCount[r] * 3u));
if (s.bot_id() % 16u == 0u)
TC_LOG_INFO("playerbot.v2", "[town] {} stocked for spell {} at the {}", s.name(), spell, TE::KindName(st.kind));
}
else
all = true; // unknown spell — don't retry every beat
st.stock_given = all; // a full intent queue just retries next beat
}
// This beat falls to the emote; the next one has the stock and casts for real.
}
// No usable recipe for this station: teach the starter once per visit. Covers bots set up
// before DoLearnProfessions' grants — the recipe lands next drain and the next beat picks it.
else if (!st.recipe_given)
if (uint32 const recipe = StationRecipeEntry(st.kind, s))
// Once per visit either way: a recipe already in the book is why the pick came
// back empty (grey-capped or on cooldown) — nothing to teach it then.
st.recipe_given = s.knows_spell(recipe) ? true : emit.learn_spell(recipe);
if (!st.work_emote)
if (uint32 const e = TE::WorkEmoteFor(st.kind))
{
emit.perform_emote(e);
st.work_emote = true;
}
}
// Half-way through a long stop at a banker or auctioneer the bot faces the NPC once more and talks at it —
// the "still doing business" tell of a player paging through bags at the counter.
static void FidgetAt(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter& emit, TE::State& st, uint32 now_ms)
{
if (!st.entry || !st.next_use_ms || now_ms < st.next_use_ms) return;
st.next_use_ms = 0; // once per stay
for (auto const& u : s.nearby_friends())
{
if (u.is_player || u.entry != st.entry || std::hypot(u.x - st.nx, u.y - st.ny) > 15.0f) continue;
emit.face_target(u.guid);
if (ai.rng().chance(0.5))
{
static constexpr uint32 kTalk[] = { EMOTE_ONESHOT_TALK, EMOTE_ONESHOT_TALK, EMOTE_ONESHOT_QUESTION, EMOTE_ONESHOT_POINT };
emit.perform_emote(kTalk[ai.rng().int_range(0, int32(std::size(kTalk)))], u.guid);
}
break;
}
}
// At the place: face the NPC, sell the junk or repair at a vendor, one gesture now and then, and stop a while —
// how long depends on the place: an errand is seconds, the bank or the auction house half a minute, working at a
// craft station a minute or so (Playerbot.World.Town.Linger*Sec).
static void ArriveErrand(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter& emit, TE::State& st, uint32 now_ms)
{
float bx, by, bz;
@@ -1140,10 +1524,10 @@ static void ArriveErrand(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter&
emit.face_target(u.guid);
uint64 const low = u.guid.GetCounter();
bool const in_reach = std::hypot(u.x - bx, u.y - by) <= 5.0f;
if (in_reach && (u.npc_flags & UNIT_NPC_FLAG_VENDOR_MASK) && HasGreyJunkItem(s)
if (in_reach && (u.npc_flags & UNIT_NPC_FLAG_VENDOR_MASK)
&& !ai.action_recently_tried(BotAI::ActionKind::SellTrash, low, now_ms))
{
emit.vendor_sell_trash(u.guid);
emit.vendor_sell_trash(u.guid); // junk AND craft surplus — sell_trash decides what moves
ai.note_action_retry(BotAI::ActionKind::SellTrash, low, now_ms);
}
if (in_reach && (u.npc_flags & UNIT_NPC_FLAG_REPAIR) && s.lowest_equipped_durability_pct() < 100 && s.gold() > 0
@@ -1161,14 +1545,39 @@ static void ArriveErrand(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter&
}
}
auto const& c = TE::Cfg();
uint32 linger = c.linger_min_ms;
if (c.linger_max_ms > c.linger_min_ms)
linger += uint32(ai.rng().int_range(0, int32((c.linger_max_ms - c.linger_min_ms) / 100u) + 1)) * 100u;
uint32 lmin = 0, lmax = 0;
TE::LingerRange(c, st.kind, lmin, lmax);
uint32 linger = lmin;
if (lmax > lmin)
linger += uint32(ai.rng().int_range(0, int32((lmax - lmin) / 100u) + 1)) * 100u;
if (st.kind == TE::Kind::Exit || st.kind == TE::Kind::Mailbox) linger /= 2u; // a look out of the gate, a letter posted
st.phase = 2;
st.phase_start_ms = now_ms;
st.linger_until_ms = now_ms + linger;
st.near_player_ms = 0;
// The first "use the place" beat: a craft station's first cast or work emote lands a breath after arrival; a
// bank or auction-house stop repeats the face-and-talk gesture about halfway through the linger.
if (TE::IsCraftKind(st.kind))
{
// Right at the station and turned to it: the nearest gameobject of the station's focus type is the anvil
// the bot works at (face_target resolves gameobjects — the same SetFacingToObject the spell path uses).
ObjectGuid station;
float best_d2 = 12.0f * 12.0f;
for (auto const& go : s.raw().world_objects.nearby_objects)
{
GameObjectTemplate const* info = sObjectMgr->GetGameObjectTemplate(go.entry);
if (!info || uint32(info->GetSpellFocusType()) != st.focus_type) continue;
float const dx = go.x - st.nx, dy = go.y - st.ny;
float const d2 = dx * dx + dy * dy;
if (d2 < best_d2) { best_d2 = d2; station = go.guid; }
}
if (!station.IsEmpty())
emit.face_target(station);
st.next_kit_ms = now_ms; // the kit run starts on the first linger tick: give -> swap -> confirm
st.next_use_ms = now_ms + 2000u + uint32(ai.rng().int_range(0, 20)) * 100u;
}
else if (st.entry)
st.next_use_ms = now_ms + linger / 2u;
V2::TownLife::Counters().errands.fetch_add(1, std::memory_order_relaxed);
}
@@ -1197,7 +1606,10 @@ bool TownErrandFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
auto& st = ai.town_errand();
// An errand left long ago (a fight, a quest, a show took over) is not resumed: the next place is chosen from here.
if (st.phase != 0 && now_ms - st.phase_start_ms > kErrandStaleMs)
EndErrand(s, st, false);
EndErrand(s, emit, st, false);
// Settle beat: a show that just ended stands a moment before the next errand starts.
if (int32(st.pause_until_ms - now_ms) > 0) return true;
if (st.phase == 2)
{
@@ -1206,10 +1618,14 @@ bool TownErrandFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
if (nudged) V2::TownLife::Counters().player_nudges.fetch_add(1, std::memory_order_relaxed);
if (now_ms < st.linger_until_ms && !nudged)
{
if (TE::IsCraftKind(st.kind))
CraftUse(s, ai, emit, st, now_ms);
else
FidgetAt(s, ai, emit, st, now_ms);
ai.set_last_rule_fired("idle:town_linger");
return true;
}
EndErrand(s, st, true); // done: straight on to the next place, this tick
EndErrand(s, emit, st, true); // done: straight on to the next place, this tick
}
if (st.phase == 0 && !PickErrand(s, ai, st, now_ms))
@@ -1234,7 +1650,7 @@ bool TownErrandFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
V2::TownLife::Counters().errand_gave_up.fetch_add(1, std::memory_order_relaxed);
if (s.bot_id() % 16u == 0u)
TC_LOG_INFO("playerbot.v2", "[town] {} gave up on the {} at ({:.0f},{:.0f}), {:.0f} y short", s.name(), TE::KindName(st.kind), st.nx, st.ny, d_npc);
EndErrand(s, st, false);
EndErrand(s, emit, st, false);
return false;
}
}
@@ -1243,7 +1659,7 @@ bool TownErrandFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
// Out of the gate: no stop, the bot runs on to level (grind_roam, which lets it through the capital's edge until then).
st.leave_until_ms = now_ms + kLeaveMs;
V2::TownLife::Counters().errands.fetch_add(1, std::memory_order_relaxed);
EndErrand(s, st, true);
EndErrand(s, emit, st, true);
return false;
}
if (there)
@@ -1804,8 +2220,14 @@ bool KindHealFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
}
if (urand(0, 3) == 0)
{
static constexpr char const* kLines[] = { "there you go", "patched you up", "heal inc", "careful out there", "you looked like you needed that" };
emit.say_world(kLines[urand(0, uint32(std::size(kLines)) - 1)]);
// Migration 0067: the text table's say_kindness_heal key first; the builtin pool otherwise.
std::string line = BotTextMgr::instance().Get("say_kindness_heal");
if (line.empty())
{
static constexpr char const* kLines[] = { "there you go", "patched you up", "heal inc", "careful out there", "you looked like you needed that" };
line = kLines[urand(0, uint32(std::size(kLines)) - 1)];
}
emit.say_world(std::move(line));
}
board.heals.fetch_add(1, std::memory_order_relaxed);
TC_LOG_INFO("playerbot.v2", "[kindness] {} heals a passing player (guid {}) at {}% with {}", s.name(), t->guid, t->hp_pct, rank);
@@ -1870,8 +2292,14 @@ bool KindRezFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
ObjectGuid const target = ObjectGuid::Create<HighGuid::Player>(t->guid);
emit.face_target(target);
if (!emit.cast(KindRezSpell(s.cls()), target)) return false;
static constexpr char const* kLines[] = { "rez inc", "hold on, rezzing you", "got you", "rez coming", "don't release, rezzing" };
emit.say_world(kLines[urand(0, uint32(std::size(kLines)) - 1)]);
// Migration 0067: the text table's say_kindness_rez key first; the builtin pool otherwise.
std::string rez_line = BotTextMgr::instance().Get("say_kindness_rez");
if (rez_line.empty())
{
static constexpr char const* kLines[] = { "rez inc", "hold on, rezzing you", "got you", "rez coming", "don't release, rezzing" };
rez_line = kLines[urand(0, uint32(std::size(kLines)) - 1)];
}
emit.say_world(std::move(rez_line));
board.rezzes.fetch_add(1, std::memory_order_relaxed);
TC_LOG_INFO("playerbot.v2", "[kindness] {} resurrects a player (guid {})", s.name(), t->guid);
ai.set_last_rule_fired("idle:kind_rez");
@@ -40,6 +40,14 @@ constexpr uint64 kObjectKeyBit = uint64(1) << 41;
bool FindPos(BotSnapshotView const& s, ObjectGuid guid, float& x, float& y, float& z)
{
// A player giver is the owner passing on a quest an item started (CompanionQuest::BuildState); his spot is in the state.
if (guid.IsPlayer())
{
auto const& cq = s.raw().companion_quest;
if (!cq.owner_here) return false;
x = cq.owner_x; y = cq.owner_y; z = cq.owner_z;
return true;
}
for (auto const& u : s.raw().combat.nearby_friends)
if (u.guid == guid) { x = u.x; y = u.y; z = u.z; return true; }
for (auto const& o : s.raw().world_objects.nearby_objects)
@@ -119,7 +119,9 @@ bool SoakTravelFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
bool SwimStuckGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&, uint32)
{
const uint32 swim_now_ms = s.published_at_ms();
ai.update_swim_state(s.is_swimming(), swim_now_ms);
// Swimming with the player who leads it (a fight on the Vile Reef, a dive for a quest item) is not being stuck in the water: the
// clock starts when he is out and the bot is still in.
ai.update_swim_state(s.is_swimming() && !s.leader_in_water(), swim_now_ms);
if (!ai.swim_stuck(swim_now_ms)) return false;
return !s.in_battleground() && !s.is_in_dungeon();
}
@@ -159,9 +161,12 @@ bool SwimStuckFire(BotSnapshotView const& s, BotAI& ai,
// escalation takes over (its gate still runs every tick and updates the swim
// timer). Once the bot is on land the builder clears water_escape_valid and the
// normal rules (now-correct travel) resume.
// A bot whose leading player is in the water near it stays with him (BotSnapshot::leader_in_water): the way out raced the follow, the
// bot went to the bank and back down between fights, and it missed the fights (vile_reef_fight af60, Discord 2026-11-22 Egod). It gets
// out once he does; its breath is the surfacing rule's (SurvivalRules.cpp).
bool WaterEscapeGate(BotSnapshotView const& s, BotAI&, GroupSnapshotView const&, uint32)
{
return s.water_escape_valid()
return s.water_escape_valid() && !s.leader_in_water()
&& s.is_alive() && !s.in_combat() && !s.is_casting()
&& !s.on_transport()
&& !s.in_battleground() && !s.is_in_dungeon();
@@ -23,6 +23,7 @@
#include "Bot/BotSnapshotView.h"
#include "Bot/BotIntentEmitter.h"
#include "Bot/BotIntent.h"
#include "Bot/BotTextMgr.h"
#include "Services.h"
#include "Fleet/BotGuildMgr.h"
#include "Fleet/BotGuildEvent.h"
@@ -423,10 +424,35 @@ bool GuildChatQuietGate(BotSnapshotView const& s, BotAI&, GroupSnapshotView cons
return true;
}
// Migration 0067 moved the chat pools below into the shared text table (guild_* keys), so a realm
// can rewrite guild speech without rebuilding. GuildLine returns a table line for `key` when the
// table carries any; a `pool` line otherwise (placeholders filled the same way), so a server
// without the rows talks exactly as before.
std::string GuildLine(char const* key, BotAI& ai, char const* const* pool, size_t pool_n,
TextPlaceholders const& ph = {})
{
if (std::string line = BotTextMgr::instance().Get(key, ph); !line.empty())
return line;
std::string line = pool[ai.rng().int_range(0, int32_t(pool_n))];
BotTextMgr::Fill(line, ph);
return line;
}
// A /g line needs a real guild member online to hear it: without one, guild chat is bots talking to an
// empty channel — the gate stays closed so the line waits for an audience instead of being spent unheard.
// RecruitChannelGate keeps the plain QuietGate on purpose: its post goes to a public channel, where
// recruiting for a bot-only guild is the point. The event HoldGates keep it too: the gathering itself
// still happens, only the chatter waits.
bool GuildChatAudienceGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
return s.guild_online_human_member_count() > 0;
}
// ---------- idle:guild_chat:ding ----------
bool ChatDingGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
return s.level() > ai.guild_chat_last_ding_level();
}
@@ -439,11 +465,10 @@ bool ChatDingFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&
return false;
}
static constexpr char const* kDingVariants[] = {
"Ding {}!", "{} achieved", "hit {} :)", "Level {}!", "ding {}",
"Ding %my_level!", "%my_level achieved", "hit %my_level :)", "Level %my_level!", "ding %my_level",
};
const int32_t n_dings = static_cast<int32_t>(sizeof(kDingVariants) / sizeof(*kDingVariants));
const size_t idx = static_cast<size_t>(ai.rng().int_range(0, n_dings));
emit.guild_chat(fmt::format(fmt::runtime(kDingVariants[idx]), s.level()));
emit.guild_chat(GuildLine("guild_ding", ai, kDingVariants, std::size(kDingVariants),
{ { "%my_level", std::to_string(s.level()) } }));
// Party-chat ding is handled separately in BotAI::tick (the
// pending_ding_level_ stagger path) — don't double-emit here.
ai.set_guild_chat_last_ding_level(s.level());
@@ -454,7 +479,7 @@ bool ChatDingFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&
// ---------- idle:guild_chat:login_greet ----------
bool ChatLoginGreetGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
return ai.guild_chat_login_greeted_ms() == 0 &&
s.guild_online_member_count() >= 2;
}
@@ -465,9 +490,7 @@ bool ChatLoginGreetFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView c
"hi all", "hey :)", "o/", "hello!", "evening", "yo",
"hi guild", "hey hey", "o/ everyone", "back online",
};
const int32_t n_greets = static_cast<int32_t>(sizeof(kGreetVariants) / sizeof(*kGreetVariants));
const size_t idx = static_cast<size_t>(ai.rng().int_range(0, n_greets));
emit.guild_chat(kGreetVariants[idx]);
emit.guild_chat(GuildLine("guild_login_greet", ai, kGreetVariants, std::size(kGreetVariants)));
ai.note_guild_chat_login_greet(GameTime::GetGameTimeMS());
(void)s;
ai.set_last_rule_fired("idle:guild_chat:login_greet");
@@ -477,12 +500,7 @@ bool ChatLoginGreetFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView c
// ---------- idle:guild_chat:smalltalk ----------
bool ChatSmalltalkGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
// SC-P3c: require at least one ONLINE human guildmate. Smalltalk is
// self-initiated ambient chatter; with no human in the guild it's bots
// babbling to each other, which is pointless traffic and reads as a tell.
// Reactive announces (ding/login_greet/quest_brag) stay unconditional.
if (s.guild_online_human_member_count() < 1) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
if (s.guild_online_member_count() < 3) return false;
const uint32 gc_now_ms = GameTime::GetGameTimeMS();
if (ai.guild_chat_last_smalltalk_ms() != 0 &&
@@ -510,9 +528,7 @@ bool ChatSmalltalkFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView cons
"this rep grind...", "soloing dungeons for chests",
"wow my repair bill", "good music tonight, share recs",
};
const int32_t n_st = static_cast<int32_t>(sizeof(kSmalltalkVariants) / sizeof(*kSmalltalkVariants));
const size_t idx = static_cast<size_t>(ai.rng().int_range(0, n_st));
emit.guild_chat(kSmalltalkVariants[idx]);
emit.guild_chat(GuildLine("guild_smalltalk", ai, kSmalltalkVariants, std::size(kSmalltalkVariants)));
ai.note_guild_chat_smalltalk(GameTime::GetGameTimeMS());
ai.set_last_rule_fired("idle:guild_chat:smalltalk");
return true;
@@ -521,11 +537,8 @@ bool ChatSmalltalkFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView cons
// ---------- idle:guild_chat:tavern_hangout ----------
bool ChatTavernHangoutGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
// SC-P3c: the tavern-hangout pitch is broadcast to /g, so it needs a
// human audience to be worth sending. (The cluster check below only
// confirms 2+ guildmates are physically nearby — those can all be bots.)
if (s.guild_online_human_member_count() < 1) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
// The cluster check below confirms 2+ guildmates are physically nearby — those can all be bots.
const uint32 gc_now_ms = GameTime::GetGameTimeMS();
if (ai.guild_chat_last_hangout_ms() != 0 &&
gc_now_ms - ai.guild_chat_last_hangout_ms() <= 60u * 60u * 1000u)
@@ -547,7 +560,8 @@ bool ChatTavernHangoutFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotVie
const auto kHFaction = FactionOf(s);
char const* venue = (kHFaction == ::Playerbot::V2::BotGuildMgr::FACTION_ALLIANCE)
? "Pig & Whistle" : "Wyvern's Tail";
emit.guild_chat(fmt::format("anyone want to hit the tavern? {}", venue));
static constexpr char const* kHangoutLine[] = { "anyone want to hit the tavern? %venue" };
emit.guild_chat(GuildLine("guild_tavern_hangout", ai, kHangoutLine, std::size(kHangoutLine), { { "%venue", venue } }));
ai.note_guild_chat_hangout(GameTime::GetGameTimeMS());
ai.set_last_rule_fired("idle:guild_chat:tavern_hangout");
return true;
@@ -556,7 +570,7 @@ bool ChatTavernHangoutFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotVie
// ---------- idle:guild_chat:rival_banter ----------
bool ChatRivalBanterGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
if (s.guild_rival_id() == 0) return false;
const uint32 gc_now_ms = GameTime::GetGameTimeMS();
if (ai.guild_chat_last_smalltalk_ms() != 0 &&
@@ -579,9 +593,7 @@ bool ChatRivalBanterFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView co
"watch the rivals here", "let's outperform them",
"rival in sight, on guard", "amateurs",
};
const int32_t n_rv = sizeof(kRivalLines) / sizeof(*kRivalLines);
const size_t ri = static_cast<size_t>(ai.rng().int_range(0, n_rv));
emit.guild_chat(kRivalLines[ri]);
emit.guild_chat(GuildLine("guild_rival", ai, kRivalLines, std::size(kRivalLines)));
ai.note_guild_chat_smalltalk(GameTime::GetGameTimeMS());
ai.set_last_rule_fired("idle:guild_chat:rival_banter");
return true;
@@ -590,7 +602,7 @@ bool ChatRivalBanterFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView co
// ---------- idle:guild_chat:quest_brag ----------
bool ChatQuestBragGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
const uint16 quest_count_now = s.completed_quest_count();
if (ai.guild_chat_last_seen_quest_count() == 0xFFFF)
{
@@ -624,9 +636,7 @@ bool ChatQuestBragFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView co
"easy gold", "quest hub clear",
"love a good quest chain", "rolling through quests",
};
const int32_t n_br = sizeof(kBragVariants) / sizeof(*kBragVariants);
const size_t bi = static_cast<size_t>(ai.rng().int_range(0, n_br));
emit.guild_chat(kBragVariants[bi]);
emit.guild_chat(GuildLine("guild_quest_brag", ai, kBragVariants, std::size(kBragVariants)));
ai.note_guild_chat_brag(GameTime::GetGameTimeMS());
ai.set_last_rule_fired("idle:guild_chat:quest_brag");
return true;
@@ -635,7 +645,7 @@ bool ChatQuestBragFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView co
// ---------- idle:guild_chat:lfm_pulse ----------
bool ChatLfmPulseGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
const uint32 gc_now_ms = GameTime::GetGameTimeMS();
if (!s.lfg_in_queue())
{
@@ -656,7 +666,8 @@ bool ChatLfmPulseGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView con
bool ChatLfmPulseFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView const& g, BotIntentEmitter& emit, uint32)
{
emit.guild_chat("LFM for a dungeon, anyone?");
static constexpr char const* kLfmLine[] = { "LFM for a dungeon, anyone?" };
emit.guild_chat(GuildLine("guild_lfm", ai, kLfmLine, std::size(kLfmLine)));
ai.note_guild_chat_lfm(GameTime::GetGameTimeMS());
ai.set_last_rule_fired("idle:guild_chat:lfm_pulse");
return true;
@@ -665,7 +676,7 @@ bool ChatLfmPulseFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView const
// ---------- idle:guild_event:announce ----------
bool EventAnnounceGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
return s.guild_has_pending_callout() && s.guild_rank_id() <= 1;
}
@@ -684,7 +695,11 @@ bool EventAnnounceFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView co
case ::Playerbot::V2::GuildEventKind::BgNight: event_label = "BG night"; break;
default: break;
}
emit.guild_chat(fmt::format("{} starts in {} min!", event_label, mins_until));
std::string line = BotTextMgr::instance().Get("guild_event_announce",
{ { "%event_label", event_label }, { "%mins_until", std::to_string(mins_until) } });
if (line.empty())
line = fmt::format("{} starts in {} min!", event_label, mins_until);
emit.guild_chat(std::move(line));
ai.set_last_rule_fired("idle:guild_event:announce");
return true;
}
@@ -785,12 +800,14 @@ bool EventStagingHoldFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView
// ---------- idle:guild_event:tavern (dance / chat, in its place) ----------
bool EventTavernGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
// The dance is seen by anyone in the tavern, so it keeps the plain QuietGate; only the /g line
// in EventTavernFire waits for a human guildmate.
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
EventPlace p;
return GuildEventPlace(s, /*tavern*/ true, p) && p.dist <= kEventPlaceReach;
}
bool EventTavernFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView const&, BotIntentEmitter& emit, uint32)
bool EventTavernFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&, BotIntentEmitter& emit, uint32)
{
static constexpr uint32 kPartyEmotes[] = {
10, 4, 3, 5, 71,
@@ -803,17 +820,15 @@ bool EventTavernFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView const&
ai.set_last_rule_fired("idle:guild_event:tavern_dance");
return true;
}
if (ai.rng().int_range(0, 20) == 0)
if (s.guild_online_human_member_count() > 0 && ai.rng().int_range(0, 20) == 0)
{
static constexpr char const* kPartyChat[] = {
"this is fun", "cheers everyone", "/dance",
"best night of the week", "love these party nights",
"more bots should hit the tavern", "great turnout",
"more people should hit the tavern", "great turnout",
"tavern night incoming", "rolling tipsy", "/toast",
};
const int32_t n_pc = sizeof(kPartyChat) / sizeof(*kPartyChat);
const size_t pi = static_cast<size_t>(ai.rng().int_range(0, n_pc));
emit.guild_chat(kPartyChat[pi]);
emit.guild_chat(GuildLine("guild_tavern_chat", ai, kPartyChat, std::size(kPartyChat)));
ai.set_last_rule_fired("idle:guild_event:tavern_chat");
return true;
}
@@ -823,7 +838,7 @@ bool EventTavernFire(BotSnapshotView const&, BotAI& ai, GroupSnapshotView const&
// ---------- idle:guild_event:staging (chat, in its place) ----------
bool EventStagingGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
{
if (!GuildChatQuietGate(s, ai, g, now_ms)) return false;
if (!GuildChatAudienceGate(s, ai, g, now_ms)) return false;
EventPlace p;
return GuildEventPlace(s, /*tavern*/ false, p) && p.dist <= kEventPlaceReach;
}
@@ -833,35 +848,38 @@ bool EventStagingFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView con
const uint8 active_kind = s.guild_active_event_kind();
if (ai.rng().int_range(0, 30) == 0)
{
char const* line = "anyone joining?";
static constexpr char const* kGeneric[] = { "anyone joining?" };
static constexpr char const* kRaidLines[] = {
"raid night, who's in?", "rolling for raid spots",
"/g raid in 10", "looking for one more dps",
"loot reservations open",
};
static constexpr char const* kDungeonLines[] = {
"dungeon night, who's down?", "lf2m for keys",
"let's chain some 5-mans", "got a healer?",
"rolling tank dual spec",
};
static constexpr char const* kBgLines[] = {
"BG night! /join wsg", "premade rolling",
"honor cap incoming", "anyone seen the queue times?",
"rated arena later maybe",
};
char const* key = "guild_staging_generic";
char const* const* pool = kGeneric;
size_t pool_n = 1;
if (active_kind == static_cast<uint8>(::Playerbot::V2::GuildEventKind::RaidNight))
{
static constexpr char const* kRaidLines[] = {
"raid night, who's in?", "rolling for raid spots",
"/g raid in 10", "looking for one more dps",
"loot reservations open",
};
line = kRaidLines[ai.rng().int_range(0, 5)];
key = "guild_staging_raid"; pool = kRaidLines; pool_n = std::size(kRaidLines);
}
else if (active_kind == static_cast<uint8>(::Playerbot::V2::GuildEventKind::DungeonNight))
{
static constexpr char const* kDungeonLines[] = {
"dungeon night, who's down?", "lf2m for keys",
"let's chain some 5-mans", "got a healer?",
"rolling tank dual spec",
};
line = kDungeonLines[ai.rng().int_range(0, 5)];
key = "guild_staging_dungeon"; pool = kDungeonLines; pool_n = std::size(kDungeonLines);
}
else
else if (active_kind == static_cast<uint8>(::Playerbot::V2::GuildEventKind::BgNight))
{
static constexpr char const* kBgLines[] = {
"BG night! /join wsg", "premade rolling",
"honor cap incoming", "anyone seen the queue times?",
"rated arena later maybe",
};
line = kBgLines[ai.rng().int_range(0, 5)];
key = "guild_staging_bg"; pool = kBgLines; pool_n = std::size(kBgLines);
}
emit.guild_chat(line);
emit.guild_chat(GuildLine(key, ai, pool, pool_n));
ai.set_last_rule_fired("idle:guild_event:staging_chat");
return true;
}
@@ -933,10 +951,15 @@ bool ChatBabbleFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
"Just dinged again — slow grind.",
"Hope to see folks at the next raid night.",
};
constexpr uint32 kPoolSize = sizeof(kPhrases) / sizeof(kPhrases[0]);
const uint32 bucket = now_ms / kBabbleThrottleMs;
const uint32 sel = (s.bot_id() ^ bucket) % kPoolSize;
emit.emit(ChatIntent{GuildChatIntent{std::string(kPhrases[sel])}});
std::string line = BotTextMgr::instance().Get("guild_babble");
if (line.empty())
{
// No table rows: the builtin pool, with its deterministic per-bot pick kept as it was.
constexpr uint32 kPoolSize = sizeof(kPhrases) / sizeof(kPhrases[0]);
const uint32 bucket = now_ms / kBabbleThrottleMs;
line = kPhrases[(s.bot_id() ^ bucket) % kPoolSize];
}
emit.emit(ChatIntent{GuildChatIntent{std::move(line)}});
ai.set_last_guild_babble_ms(now_ms);
ai.set_last_rule_fired("idle:guild_chat_babble");
return true;
@@ -157,7 +157,16 @@ bool LootDrainFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&
Creature* c = ObjectAccessor::GetCreature(*p, q.front());
if (!c || !c->IsInWorld()) { q.pop_front(); continue; }
// Led by a player: a corpse with nothing of the bot's quest on it is the player's, never walked to.
if (quest_only && !HasPendingQuestLoot(p, c) && !(skin_for_player && SkinnableForBot(p, c))) { q.pop_front(); continue; }
if (quest_only && !HasPendingQuestLoot(p, c) && !(skin_for_player && SkinnableForBot(p, c)))
{
// Say so when it is a quest drop of the bot's that it leaves to the player (row 308): the corpse is dropped from the
// queue without a walk or a loot call, so nothing else in the log shows the bot had a share in it.
if (uint32 const left = QuestLootLeftForPlayer(p, c->GetLootForPlayer(p)))
TC_LOG_INFO("playerbot.v2", "[loot_quest] {} corpse={} leaves item {} for the player (one for the group, he needs it)",
s.name(), c->GetGUID().GetCounter(), left);
q.pop_front();
continue;
}
const float dx = c->GetPositionX() - bx;
const float dy = c->GetPositionY() - by;
const float dz = c->GetPositionZ() - bz;
@@ -308,11 +308,12 @@ int32 OocDrinkStart(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
}
// A player's bots (grouped, led by him) rest only when they need it and until full (Classic::LedMaySitDown); every other bot keeps the
// personality's food mark and the pull-ready drink marks. With the tank leading a dungeon ("lead on") the tank's pull gate sets the
// pace, as in a group of bots alone, so they drink to its marks between pulls.
// personality's food mark and the pull-ready drink marks. With the tank leading a five-man ("lead on") they still do: the lead mode
// (2026-11-14) put them back on the pull gate's marks, and the healer drank at 80-89 % with the group stopped at nearly every pack,
// what the owner had ruled out on 2026-10-15 and 2026-10-29 (GitHub #23, 2026-11-22). A raid under the lead keeps the raid marks.
bool LedRest(BotSnapshotView const& s, BotAI const& ai)
{
return s.in_group() && s.is_led_by_player() && !ai.tank_leads_here(s);
return s.in_group() && s.is_led_by_player() && (!ai.tank_leads_here(s) || !s.is_in_raid());
}
Classic::RecoveryPick OocRecoveryPick(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const& g, uint32 now_ms)
@@ -341,6 +342,9 @@ bool OocEatFoodGate(BotSnapshotView const& s, BotAI& ai,
if (s.recently_in_combat(5000)) return false;
if (s.raw().movement.is_mounted) return false;
if (s.is_encounter_in_progress()) return false;
// Not with the head under water: a player eats on the bank or at the surface, not on the lake floor with the breath bar running
// (the Vile Reef mage sat down 25 y deep after its fight and drowned there, vile_reef_fight af64).
if (s.is_underwater()) return false;
if (!Classic::SafeToRecover(s, &g)) return false;
// A solo quester does not sit down with its quest kill targets ready to engage in scan range; a grouped bot goes at the
// group's pace, so this never applies to it.
@@ -1046,10 +1046,15 @@ bool PullBackTick(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
if (p.map != s.map_id()) return finish("left the map");
using Phase = BotAI::PullBackPhase;
constexpr uint32 kTimeoutMs = 30000u, kHoldCapMs = 300000u;
constexpr uint32 kUnpullableGateMs = 120000u; // a pack no pull from here could wake (PackPullGate::Note)
auto tag = [&](char const* idle_tag, char const* combat_tag)
{ ai.set_last_rule_fired(in_combat_state ? combat_tag : idle_tag); };
if (p.phase != Phase::Hold && now_ms - p.started_ms > kTimeoutMs)
{
// A pull that never woke its target is no pull from here: the pack is passed by for a while, like an unreachable one
// (see go_home_and_finish below), or the next pick takes the same mob again.
if (p.phase == Phase::Pull)
ai.pack_pull_gate().Note(p.target.GetCounter(), /*gated*/ true, now_ms, kUnpullableGateMs);
// Don't stand where the pull left us (a ledge, the lava edge): walk back to the return point once, off the mob.
if (!s.victim().IsEmpty()) emit.stop_attack();
if (s.is_casting()) emit.cancel_cast();
@@ -1296,18 +1301,42 @@ bool PullBackTick(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
if (!tu && d <= 38.0f)
return finish("target left the scan");
auto go_home_and_finish = [&](char const* why)
auto go_home_and_finish = [&](char const* why, uint32 gate_ms = PackPullGate::kGatedMs)
{
if (!s.victim().IsEmpty()) emit.stop_attack();
if (s.is_casting()) emit.cancel_cast();
emit.move_to(p.rx, p.ry, p.rz, true);
TC_LOG_INFO("playerbot.v2", "[pull_back] {} unreachable: {} -> back to the return point ({:.1f},{:.1f})",
s.name(), why, p.rx, p.ry);
// No opener spot leads to this target from here: the pack is no pull for this tank yet, the same verdict the pack stop
// gives a pack it can only walk to the long way round (PackPullGate), so the advance passes it by and the route reaches it
// from its own side. The path to it can be short while every spot in the opener's window lies over a drop: alcaz_full af66,
// the tank on the main hall's upper floor took a Prisoner in a cell on the level below for the next pack, found no pull spot,
// walked out to the balcony's edge on short steps toward it, gave up, and the pack stop handed it the same Prisoner one
// second later, four times in ten seconds.
ai.pack_pull_gate().Note(p.target.GetCounter(), /*gated*/ true, now_ms, gate_ms);
finish("unreachable");
tag("idle:pull_back_retreat", "combat:pull_back_retreat");
return true;
};
// The opener went out and neither it nor the hand pull after it woke the target: it still stands idle 8 s on. Something the
// snapshot's sight check does not see stands between (sfk_full af70c 2026-11-25: Throw refused LINE_OF_SIGHT x2 on a Shadowfang
// Ragetooth 12 y off behind the courtyard wall, no path to it, "in sight yes"; the order re-threw for its full 30 s, the next pick
// took the same mob, four times, and the run stalled). The pack is passed by for 2 minutes: the advance and the next pull go on to
// a pack the tank can reach, and the route brings it to this one from its own side.
if (opener_failed && now_ms - p.opened_ms > 8000u && tu && tu->victim.IsEmpty() && !tu->unit_in_combat)
{
for (auto const& u : s.raw().combat.nearby_enemies)
{
if (u.hp <= 0 || !u.victim.IsEmpty() || u.unit_in_combat) continue;
float const px = u.x - tx, py = u.y - ty, pz = u.z - tz;
if (px * px + py * py + pz * pz <= 18.0f * 18.0f)
ai.pack_pull_gate().Note(u.guid.GetCounter(), /*gated*/ true, now_ms, kUnpullableGateMs);
}
return go_home_and_finish("the opener and the hand pull did not wake it in 8 s", kUnpullableGateMs);
}
if (!p.stand_pull && (d > reach - 2.0f || d < near_min))
{
// Close to / back off to an in-window spot on the line target -> return point (the raid side; never into an
@@ -1506,9 +1535,14 @@ bool PullBackTick(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,
if (NearbyUnit const* u = pack_on_group_at_point())
return finish_for_pack(*u);
const float td2 = d2xy(bx, by, tu->x, tu->y);
bool others = false; // something besides the pull target is on us
// Something besides the pull target hits the tank here, in melee: the fight has come to the return point. A caster of the pack
// that casts at the tank from where it stands is not that: it stays off and is the line-of-sight pull's to bring in. Counting it
// handed the fight to the rotation the moment the Defias Squallshaper's first bolt landed, and the auto attack walked the tank up
// the gangplank after the Pirate it had pulled (scan66 deadmines_full: Hold at 1484 s, up on the deck at 1490 s with the mage
// behind it, the parrot, a Blackguard and Mr. Smite on the group, the priest dry at 1553 s, the warrior dead at 1561 s).
bool others = false;
for (auto const& u : s.raw().combat.attackers)
if (u.guid != p.target && u.hp > 0) { others = true; break; }
if (u.guid != p.target && u.hp > 0 && d2xy(bx, by, u.x, u.y) <= 8.0f * 8.0f) { others = true; break; }
// A caster on the tank that stays where it stands (Deadmines' Defias Squallshaper up on the ship's deck) does not come to the return
// point: the tank waits here, still, so the line-of-sight pull can start (PveGroupCoordinator::PlanSightPull sees a mob of the fight
// stand off while the tank holds at its return point), and the 8 s cap below still hands the fight on. Handing it to the rotation at
@@ -10,6 +10,8 @@
#include "Bot/BotAI.h"
#include "Bot/BotSnapshotView.h"
#include "Bot/BotIntentEmitter.h"
#include "Bot/States/MaintainHelpers.h" // BreathDue / SurfaceForAir
#include "Log.h"
#include <cmath>
@@ -18,17 +20,27 @@ namespace Playerbot {
namespace {
// ---------- idle:flee_hazard ----------
// Inside a hazard as the core tests it: a trap fires on a unit within its radius in 3D (GameObject::Update, IsWithinDist), so a
// bonfire on the floor below a ledge is no hazard to a bot standing on the ledge. The flat test ignored the height
// (lbrs_full af58: on the ledge above the lower hall the tank walked back and forth, the route stepping it south and this
// rule sending it north; the [flee_hazard] line names the object a bot leaves).
bool InsideHazard(float bx, float by, float bz, BotSnapshot::NearbyObject const& obj, float& out_d)
{
if (!obj.is_hazard || obj.hazard_radius <= 0.0f) return false;
const float dx = bx - obj.x, dy = by - obj.y, dz = bz - obj.z;
const float d2 = dx*dx + dy*dy + dz*dz;
if (d2 >= obj.hazard_radius * obj.hazard_radius) return false;
out_d = std::sqrt(d2);
return true;
}
bool FleeHazardGate(BotSnapshotView const& s, BotAI&, GroupSnapshotView const&,uint32)
{
float bx, by, bz; s.position(bx, by, bz);
float d = 0.0f;
for (auto const& obj : s.raw().world_objects.nearby_objects)
{
if (!obj.is_hazard || obj.hazard_radius <= 0.0f) continue;
const float dx = bx - obj.x;
const float dy = by - obj.y;
if (dx*dx + dy*dy < obj.hazard_radius * obj.hazard_radius)
if (InsideHazard(bx, by, bz, obj, d))
return true;
}
return false;
}
@@ -39,12 +51,9 @@ bool FleeHazardFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
float worst_overlap = 0.0f;
for (auto const& obj : s.raw().world_objects.nearby_objects)
{
if (!obj.is_hazard || obj.hazard_radius <= 0.0f) continue;
const float dx = bx - obj.x;
const float dy = by - obj.y;
const float d2 = dx*dx + dy*dy;
if (d2 >= obj.hazard_radius * obj.hazard_radius) continue;
const float overlap = obj.hazard_radius - std::sqrt(d2);
float d3 = 0.0f;
if (!InsideHazard(bx, by, bz, obj, d3)) continue;
const float overlap = obj.hazard_radius - d3;
if (overlap > worst_overlap) { worst_overlap = overlap; worst = &obj; }
}
if (!worst) return false;
@@ -52,8 +61,16 @@ bool FleeHazardFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const
const float dy = by - worst->y;
const float d = std::max(0.5f, std::sqrt(dx*dx + dy*dy));
const float scale = (worst->hazard_radius + 5.0f) / d;
emit.move_to(worst->x + dx * scale, worst->y + dy * scale, bz);
const float fx = worst->x + dx * scale, fy = worst->y + dy * scale;
emit.move_to(fx, fy, bz);
ai.set_last_rule_fired("idle:flee_hazard");
static uint32 s_flee_hazard_log_ms = 0; // all bots, one line per 2 s
if (s.published_at_ms() - s_flee_hazard_log_ms > 2000u)
{
s_flee_hazard_log_ms = s.published_at_ms();
TC_LOG_INFO("playerbot.v2", "[flee_hazard] {} at ({:.1f},{:.1f},{:.1f}) leaves entry {} at ({:.1f},{:.1f},{:.1f}) radius {:.1f} -> ({:.1f},{:.1f})",
s.name(), bx, by, bz, worst->entry, worst->x, worst->y, worst->z, worst->hazard_radius, fx, fy);
}
return true;
}
@@ -88,28 +105,20 @@ bool FleeDamagingLiquidFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotVi
}
// ---------- idle:surface_to_breathe ----------
// Breath lasts 60 s (Player::getMaxTimer BREATH_TIMER). A player swimming under water to the shore keeps going and comes up only when
// the breath runs short; the rule used to lift every submerged bot to the surface at once, and the swim to dry land (idle:water_escape,
// idle:leave_water), whose path runs along the bottom, took it under again the next tick: r10 12 Nov, 23 leave_water and 14 water_escape
// flips, bots bobbing in place instead of reaching the bank. Up after 35 s under water, with 25 s of breath to spare.
constexpr uint32 kSurfaceAfterUnderwaterMs = 35000u;
// A player swimming under water to the shore, or fighting there, keeps going and comes up only when the breath runs short; the rule
// used to lift every submerged bot to the surface at once, and the swim to dry land (idle:water_escape, idle:leave_water), whose path
// runs along the bottom, took it under again the next tick: r10 12 Nov, 23 leave_water and 14 water_escape flips, bots bobbing in place
// instead of reaching the bank. It went on a 35 s clock of its own after that, which counted only the time out of combat: a mage that
// fought on the Vile Reef sat down to eat 25 y deep afterwards and drowned (vile_reef_fight af64). Now the server's own breath timer
// decides, in every state (SurfaceForAir): up with 25 s left, and up there until the bar is full.
bool SurfaceToBreatheGate(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&, uint32)
{
bool const under = s.is_underwater() && s.water_surface_z() != 0.0f;
uint32 const under_ms = ai.note_underwater(under, s.published_at_ms());
if (!under) return false;
float bx, by, bz; s.position(bx, by, bz);
if (bz >= s.water_surface_z() - 0.5f) return false;
return under_ms >= kSurfaceAfterUnderwaterMs;
return States::BreathDue(s, ai);
}
bool SurfaceToBreatheFire(BotSnapshotView const& s, BotAI& ai, GroupSnapshotView const&,BotIntentEmitter& emit, uint32)
{
float bx, by, bz; s.position(bx, by, bz);
emit.move_to(bx, by, s.water_surface_z() + 0.5f, /*run*/ true);
ai.set_last_rule_fired("idle:surface_to_breathe");
return true;
return States::SurfaceForAir(s, ai, emit, "idle:surface_to_breathe");
}
// ---------- idle:res_sick_wait ----------
@@ -244,10 +244,16 @@ void DispatchDead(BotAI& ai,
{
if (s_last_wipe_chat_ms.compare_exchange_strong(last, wnow ? wnow : 1u))
{
static constexpr char const* kWipe[] = {
"well, that went badly", "wipe :(", "ouch", "ok that one is on me", "and we're all dead",
};
emit.say(kWipe[ai.rng().int_range(0, int32_t(sizeof(kWipe) / sizeof(*kWipe)))]);
// Migration 0067: the text table's banter_raid_wipe key first; the builtin pool otherwise.
std::string wipe_line = BotTextMgr::instance().Get("banter_raid_wipe");
if (wipe_line.empty())
{
static constexpr char const* kWipe[] = {
"well, that went badly", "wipe :(", "ouch", "ok that one is on me", "and we're all dead",
};
wipe_line = kWipe[ai.rng().int_range(0, int32_t(sizeof(kWipe) / sizeof(*kWipe)))];
}
emit.say(std::move(wipe_line));
}
}
}
File diff suppressed because it is too large Load Diff
@@ -20,6 +20,7 @@
#include "Bot/MarkGate.h" // Playerbot.Behavior.MarksNeedOrder
#include "Bot/RacialRules.h" // EscapeArtistWanted
#include "Bot/ThreatDiscipline.h" // opening lead + [raid_threat] / [raid_pull] log pacing
#include "Bot/PullDelay.h" // the damage dealers' wait after the tank's pull
#include "Bot/ThreatLimits.h" // hard threat ratios shared with the raid brain
#include "ClassicSpec.h" // Classic::IsSingleSpecClass — combat:pve_heal_focus
#include "Bot/Dungeon/MarkCc.h" // MarkCc::TryCast - combat:marked_cc
@@ -760,6 +761,8 @@ ThreatHold EvaluateThreatHold(BotAI& ai, BotSnapshotView const& s, ObjectGuid ta
if (ai.effective_role(s) == Role::Tank) return ThreatHold::None;
// A boss fight script owns this bot's start and target (RaidFightScript.h): its start wait is the only hold.
if (s.raw().raid_order.active && s.raw().raid_order.script_owns) return ThreatHold::None;
// The damage dealers' wait after the tank's pull (Bot/PullDelay.h), also for a mob not yet in this bot's scan.
if (PartyPullDelayHolds(ai, s, target)) return ThreatHold::TankOpening;
NearbyUnit const* u = s.hostile_unit(target);
if (!u) return ThreatHold::None;
@@ -1069,6 +1072,11 @@ bool LooseMobEscape(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView const
for (NearbyUnit const& u : s.attackers()) consider(u);
for (NearbyUnit const& u : s.nearby_enemies()) consider(u);
if (!mob) return false;
// An add no tank holds (RaidRules::noTank: Kel'Thuzad's Soldiers and Soul Weavers, sent at a raider) is shed by neither: no tank comes
// for it, so a threat drop only hands it to the next raider and the walk to the tank carries it (and a Weaver's Wail of Souls cone)
// into the tanks' fight while the bot stops casting. naxx_kelthuzad kt61a / kt61b (1122): 34 / 55 "stepping to tank"
// lines on Soldiers and 4 / 10 on Weavers (logged once in 4 s a bot).
if (s.is_in_raid() && Raid::NoTank(s.map_id(), mob->entry)) return false;
constexpr uint32 FEIGN_DEATH = 5384, VANISH = 1856, FEINT = 1966, FADE = 586, FROST_NOVA = 122;
if (s.cls() == CLASS_HUNTER && s.has_aura(FEIGN_DEATH))
@@ -1134,11 +1142,17 @@ bool LooseMobEscape(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView const
// In the group's fight outside the raid rules the bot keeps hitting and its tank takes the mob (GroupFight.h rule 5): the walk to the
// tank stopped the damage (UBRS 2026-10-28: [raid_escape] "stepping to tank" on Jaidal, Gun, Elentinari through every pull).
if (ai.group_fight() && !s.raid_rules())
{
note("the group fights: keeps hitting, the tank takes it");
return false;
}
// Step toward the tank so it can taunt / body-pull the mob off us.
GroupMemberSummary const* tk = GroupAnchorTank(s, ai, g);
if (!tk || !tk->online || !tk->is_alive || tk->guid == s.guid() || tk->map_id != s.map_id() || s.is_rooted())
{
note(!tk ? "no anchor tank" : s.is_rooted() ? "rooted" : "the tank is gone, dead or on another map");
return false;
}
// The tank is feared / stunned: it picks nothing up, and a feared one runs off, so the walk toward it only drags the mob with us
// and costs the casts (Deadmines 627eb082: the priest "stepping to tank" with Terrify on the tank, 25 y away). Stand and cast.
if (tk->is_controlled)
@@ -1148,7 +1162,12 @@ bool LooseMobEscape(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView const
}
const float dx = tk->x - bx, dy = tk->y - by, dz = tk->z - bz;
const float d2 = dx * dx + dy * dy + dz * dz;
if (d2 <= 6.0f * 6.0f || d2 > 80.0f * 80.0f) return false; // already on the tank / not this fight's tank
if (d2 <= 6.0f * 6.0f || d2 > 80.0f * 80.0f) // already on the tank / not this fight's tank
{
if (d2 > 80.0f * 80.0f)
note("the tank is over 80 y away");
return false;
}
const float dist = std::sqrt(d2);
const float step = std::min(15.0f, dist - 4.0f);
// A healer keeps healing on the run: instant heals / HoTs / Power Word:
@@ -1172,10 +1191,21 @@ bool LooseMobEscape(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView const
// rotation keeps the bot alive in place (and the drops above already ran).
// Nor into an idle pack's aggro reach (raid): the tank comes for the mob
// instead (its taunt / pick-up), a step into the next pack adds one.
if (RaidStandPointBlocked(s, sx, sy, sz) || RaidPointInUnpulledReach(s, sx, sy, sz)) return false;
// exc_full af66: Shadetooth feared the mage away four times and killed her 80 y from the group in 90 s, and no line told which of
// these gates kept her from walking it back. Each one says so now (paced with the others, 4 s).
if (RaidStandPointBlocked(s, sx, sy, sz) || RaidPointInUnpulledReach(s, sx, sy, sz))
{
note(fmt::format("the step to the tank, {:.0f} y away, is blocked ({:.1f},{:.1f},{:.1f}): {}", dist, sx, sy, sz,
RaidStandPointBlocked(s, sx, sy, sz) ? "hazard or avoid circle" : "an idle pack's reach").c_str());
return false;
}
if (!emit.move_to(sx, sy, sz, /*run*/ true))
{
if (!s.has_path_destination()) return false;
if (!s.has_path_destination())
{
note(fmt::format("the step to the tank, {:.0f} y away, was refused ({:.1f},{:.1f},{:.1f})", dist, sx, sy, sz).c_str());
return false;
}
heal_on_the_run(); // same step already under way: keep it
return true;
}
@@ -1348,11 +1378,20 @@ bool PreemptiveTankHeal(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView c
if (CH::Dist2(tk->x, tk->y, tk->z, bx, by, bz) > CH::kHealRange * CH::kHealRange || !CH::InLos(s, tk->guid))
return false;
CH::Patient const tank = CH::MakePatient(s, tk->guid, tk->hp, tk->max_hp, tk->x, tk->y, tk->z, true);
if (tank.actual_pct <= 65 || tank.incoming <= 0) return false;
// An add of the map's burstTank list on the tank (Raid::HitsTankHard) is one whose single hit takes the tank from full to a quarter:
// it counts as a boss, and its healers keep a heal going whoever else is hurt and however full the tank is. naxx_kelthuzad kt70c
// (1124): an Unstoppable Abomination's Mortal Wound (200% weapon damage, 7,500-9,000 on a tank) killed the bear from 72% and from
// full, the healers at 95-99% mana cast nothing from 73 s to 94 s ("hurt tanks 0"), and the pre-heal ran 12 times in the pull. The
// Soldiers' Dark Blast (1,750 to the whole room every few seconds) leaves somebody under 80% most of the time, which stands the
// pre-heal down below.
bool burst = false;
for (NearbyUnit const& u : s.nearby_enemies())
if (u.hp > 0 && u.victim == tank.guid && Raid::HitsTankHard(s.map_id(), u.entry)) { burst = true; break; }
if (tank.actual_pct <= 65 || (tank.incoming <= 0 && !burst)) return false;
// No top-off on a tank near full unless the swings on it would take it under the spike mark (a boss on the tank hits every
// 2 s; a heal per hit was the largest mana sink of the Garr kill, MC 2026-10-10).
if (tank.actual_pct >= CH::kRaidTankSpikeFloorPct && tank.hp_pct >= CH::kRaidTankSpikePct) return false;
bool boss = false;
if (!burst && tank.actual_pct >= CH::kRaidTankSpikeFloorPct && tank.hp_pct >= CH::kRaidTankSpikePct) return false;
bool boss = burst;
for (NearbyUnit const& u : s.nearby_enemies())
if (u.hp > 0 && u.victim == tank.guid && Classic::IsBossUnit(u)) { boss = true; break; }
if (!boss && tank.incoming * 20 < tank.max_hp) return false; // light trash hits: the rotation's
@@ -1360,14 +1399,18 @@ bool PreemptiveTankHeal(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView c
// pull was most of the level-21 priest's mana (deadmines_full run 10). In a raid it stays for mana of 70% and up.
if (!boss && (!s.is_in_raid() || CH::ManaPct(s) < 70)) return false;
CH::Patient const best = CH::PickPatient(s, g);
if (best.valid && best.guid != tank.guid && best.hp_pct < 80) return false;
if (!burst && best.valid && best.guid != tank.guid && best.hp_pct < 80) return false;
if (Classic::PickDispel(s, g).spell) return false;
const uint32 top = s.resolve_rank(spell);
SpellInfo const* si = top ? sSpellMgr->GetSpellInfo(top, DIFFICULTY_NONE) : nullptr;
const int32 cast_ms = si && si->CastTimeEntry ? std::max(si->CastTimeEntry->Base, 0) : 2500;
const float swings = std::max(1.0f, float(cast_ms) / 2000.0f);
const float want = float(tank.max_hp - tank.hp) + float(tank.incoming) * swings;
float want = float(tank.max_hp - tank.hp) + float(tank.incoming) * swings;
// A burst add's next hit is a quarter of the tank or more: the heal is sized for that hit, landed or not yet (CancelOverheal stops it
// in its last half-second when the tank is still full).
if (burst)
want = std::max(want, float(tank.max_hp) * 0.5f);
// Only when the swings expected over the cast take the tank clearly under
// full: at 100% a 10% hit leaves it at 90% and the heal lands as an
// overheal (MC 2026-10-06: pre-heals on a 100% tank, cancelled or not,
@@ -1378,7 +1421,7 @@ bool PreemptiveTankHeal(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView c
constexpr float kPreHealProjectedPct = 85.0f;
constexpr float kPreHealBossProjectedPct = 95.0f;
float const projected_limit = boss ? kPreHealBossProjectedPct : kPreHealProjectedPct;
if ((float(tank.hp) - float(tank.incoming) * swings) * 100.0f >= float(tank.max_hp) * projected_limit) return false;
if (!burst && (float(tank.hp) - float(tank.incoming) * swings) * 100.0f >= float(tank.max_hp) * projected_limit) return false;
// Another healer's pre-heal already on its way covers the deficit.
if (CH::HealClaimsOn()) // Playerbot.Behavior.HealClaims
{
@@ -1392,7 +1435,7 @@ bool PreemptiveTankHeal(BotAI& ai, BotSnapshotView const& s, GroupSnapshotView c
CH::NoteHealClaim(s, tank.guid, plan.rank ? plan.rank : top, plan.est > 0.0f ? plan.est : plan.want);
if (RaidLogDue(CH::HealLogKey(s, CH::HealLogKind::PreHeal), s.published_at_ms(), 5000u))
TC_LOG_INFO("playerbot.v2", "[raid_heal] {} pre-heals tank {} at {}% ({} incoming{}) with {} (want {:.0f}, est {:.0f}, mana {}%)",
s.name(), tank.guid.GetCounter(), tank.actual_pct, tank.incoming, boss ? ", boss" : "",
s.name(), tank.guid.GetCounter(), tank.actual_pct, tank.incoming, burst ? ", burst add" : boss ? ", boss" : "",
plan.rank ? plan.rank : top, plan.want, plan.est, CH::ManaPct(s));
ai.set_last_rule_fired("combat:raid_preheal_tank");
return true;
@@ -2452,6 +2495,10 @@ static bool GroupFightPick(BotAI& ai, BotSnapshotView const& s, GroupSnapshotVie
}
if (units[pick]->guid == cur)
return false;
// The pull delay (Bot/PullDelay.h): no start on the tank's mob before it is over, or the victim hold below stops the attack
// on the next tick and the pick starts it again. Melee walk up meanwhile (ThreatHoldWait).
if (role != Role::Tank && PartyPullDelayHolds(ai, s, units[pick]->guid))
return ThreatHoldWait(ai, s, emit, units[pick]->guid, ThreatHold::TankOpening, IsMeleeSpec(s.cls(), s.spec()));
uint32& last = ai.group_fight_pick_ms();
if (last != 0 && now - last < 2000u && cur_ok)
return false;
@@ -2864,7 +2911,8 @@ void DispatchInCombat(BotAI& ai,
// A bot in tar, lava or a slime with a spell walks to the nearest dry ground (the builder's water_escape point) before anything
// below moves it or roots it in a cast, everywhere: idle:flee_damaging_liquid only runs out of combat. shapers_full af51 (20 Nov):
// the rogue chased an Ironhide Ravasaur into the Tar Pits and swung at it there until the tar killed her (killer=self). The melee
// gap-close does not follow a victim standing in such a liquid (chase_blocked below), so the bot stays on the bank.
// gap-close does not follow a victim standing in such a liquid (chase_blocked below): the bot stays on the bank, or walks to a
// dry bank spot inside its reach (victim_bank).
if (snapshot.is_in_damaging_liquid() && snapshot.water_escape_valid() && snapshot.is_alive() &&
!snapshot.is_rooted() && !snapshot.on_transport())
{
@@ -2876,6 +2924,13 @@ void DispatchInCombat(BotAI& ai,
return;
}
// ---- Up for air ([breath], SurfaceForAir) ----
// A fight under water uses up the breath as a swim does, and the idle rule never ran during one: the Vile Reef mage fought on the
// reef, then sat down 25 y deep to eat and drowned before the idle clock got to 35 s (vile_reef_fight af64). On the server's
// breath timer: up with 25 s left, back down to the fight once the bar is full.
if (SurfaceForAir(snapshot, ai, emit, "combat:surface_to_breathe"))
return;
// ---- Out of a fighting mob's area attack ([area_attack_step], State_Idle.cpp) ----
// A healer or ranged bot in reach of a mob's Frost Nova / Thunderclap that is not on it steps out before anything below roots it
// in a cast (rol_full af52: The Abandoned). Instances only.
@@ -4596,11 +4651,45 @@ void DispatchInCombat(BotAI& ai,
// An owner Stay / Hold keeps the bot at its spot too: a mob out of reach is not chased (a mob on the bot lifts the hold).
// Nor is a victim standing in a burning liquid (tar, lava), anywhere: the bot waits on the bank for the mob to come out
// to it, as a player does ([liquid_escape] above takes it out if it is in already).
// ...unless there is a bank in reach of it: a dry spot inside the bot's melee reach, reached by a dry path (the snapshot's
// victim_bank). The bot walks there and swings from it, as a player does. Ragnaros never leaves his lava: with only the wait,
// every melee bot stood 37-40 y off for the whole fight, 0 hits on him (mc_ragnaros af53 1120, BUGS-ALL 312).
const bool victim_in_burning_liquid = snapshot.raw().combat.victim_in_damaging_liquid;
const bool victim_bank = victim_in_burning_liquid && snapshot.raw().combat.victim_bank_known;
// The bot fights from its own side of the victim, at melee reach, not on the victim's centre: the test is where it would
// stand. A victim on the rim of a circle is fought from outside it, a victim deep inside is still waited for.
// naxx_kelthuzad kt62a (1123): an Abomination stood 29.5 y from an alcove's centre (keep-out 30 y, +2 y margin) and 10 y
// from its tank, which stood outside the circle and held ("combat:melee_hold_hazard") for 18 s while the Abomination killed
// five DPS; Taunt is melee range. A victim in a burning liquid with a bank keeps the bank test (the bank is the stand spot).
float stop_x = vu->x, stop_y = vu->y;
bool stand_off_victim = false;
bool chase_hazard = false;
if (victim_bank)
{
chase_hazard = snapshot.is_in_instance() && !snapshot.in_battleground() &&
RaidStandPointBlocked(snapshot, snapshot.raw().combat.victim_bank_x, snapshot.raw().combat.victim_bank_y,
snapshot.raw().combat.victim_bank_z);
}
else if (d2 > kMeleeRange * kMeleeRange && snapshot.is_in_instance() && !snapshot.in_battleground() &&
RaidStandPointBlocked(snapshot, vu->x, vu->y, vu->z))
{
chase_hazard = true;
const float d2d = std::sqrt(dx * dx + dy * dy);
const float stand = std::max(kMeleeRange - 1.0f, 1.0f);
if (d2d > stand + 0.5f)
{
stop_x = vu->x - dx / d2d * stand;
stop_y = vu->y - dy / d2d * stand;
if (!RaidStandPointBlocked(snapshot, stop_x, stop_y, vu->z))
{
chase_hazard = false;
stand_off_victim = true;
}
}
}
const bool chase_blocked = d2 > kMeleeRange * kMeleeRange &&
((snapshot.is_in_instance() && !snapshot.in_battleground() &&
RaidStandPointBlocked(snapshot, vu->x, vu->y, vu->z)) ||
victim_in_burning_liquid ||
(chase_hazard ||
(victim_in_burning_liquid && !victim_bank) ||
HeldByOwner(ai, snapshot));
// Stuck-chase tracking: count ticks where we're out of melee
// range with the same victim. Reset on different victim or once
@@ -4637,10 +4726,15 @@ void DispatchInCombat(BotAI& ai,
}
else if (d2 > kMeleeRange * kMeleeRange)
{
if (ai.stuck_chase_victim() == snapshot.victim())
ai.set_stuck_chase(snapshot.victim(), ai.stuck_chase_ticks() + 1);
else
ai.set_stuck_chase(snapshot.victim(), 1);
// A bot walking to the bank of a victim in a burning liquid is not stuck: the bank can be 40 y off (the melee pre-pull
// spot at Ragnaros), more than the 5 s cap at run speed.
if (!(victim_bank && snapshot.is_moving()))
{
if (ai.stuck_chase_victim() == snapshot.victim())
ai.set_stuck_chase(snapshot.victim(), ai.stuck_chase_ticks() + 1);
else
ai.set_stuck_chase(snapshot.victim(), 1);
}
// A tank never gives up a mob that is on a group member: dropping it leaves the mob killing the healer
// (deadmines_full run 8: Rhahk'Zor on the priest for 57 s, the warrior silent after its 5 s chase cap). Its
// chase ends when the mob is in reach (Taunt / melee) or dies; a victim it truly cannot path to is handled
@@ -4727,7 +4821,9 @@ void DispatchInCombat(BotAI& ai,
while (diff < -float(M_PI)) diff += 2.0f * float(M_PI);
in_front_of_victim = std::fabs(diff) < 0.5f * float(M_PI);
}
if (Services::Config().behavior_spread_out() && in_front_of_victim &&
// Not round a victim in a burning liquid: its spread spot is in the liquid, and the bank the bot stands on is the only
// dry footing in reach.
if (Services::Config().behavior_spread_out() && in_front_of_victim && !victim_in_burning_liquid &&
vu->victim != snapshot.guid() && ai.effective_role(snapshot) != Role::Tank &&
!snapshot.is_rooted() && !snapshot.is_casting() && !snapshot.has_path_destination() &&
!ai.action_recently_tried(BotAI::ActionKind::RaidSpacing, 0, snapshot.published_at_ms()))
@@ -4768,7 +4864,7 @@ void DispatchInCombat(BotAI& ai,
else
{
// Default: gap-close to the victim.
float cx = vu->x, cy = vu->y, cz = vu->z;
float cx = stand_off_victim ? stop_x : vu->x, cy = stand_off_victim ? stop_y : vu->y, cz = vu->z;
// Travel-through-combat (2026-06-15): when the bot has a FAR
// same-map travel objective it is IN TRANSIT — incidental aggro
// must not pull it off-course chasing mobs. Live: Somi drifted
@@ -4810,6 +4906,17 @@ void DispatchInCombat(BotAI& ai,
constexpr float kReplanRange = 3.0f;
if (pd2 < kReplanRange * kReplanRange) already_pathing = true;
}
// A victim in a burning liquid: its bank spot, not its centre (the move gate refuses a point in the liquid).
if (victim_bank)
{
cx = snapshot.raw().combat.victim_bank_x;
cy = snapshot.raw().combat.victim_bank_y;
cz = snapshot.raw().combat.victim_bank_z;
if (RaidLogDue(RaidLogKey(snapshot, RaidLogKind::ThreatHold) ^ 0x62616e6bu, snapshot.published_at_ms(), 5000u))
TC_LOG_INFO("playerbot.v2", "[liquid_bank] {} walks to ({:.1f},{:.1f},{:.1f}) to hit entry {} in a burning liquid from the bank ({:.1f} y from it, reach {:.1f} y)",
snapshot.name(), cx, cy, cz, vu->entry, std::sqrt((cx - vu->x) * (cx - vu->x) + (cy - vu->y) * (cy - vu->y) + (cz - vu->z) * (cz - vu->z)),
kMeleeRange);
}
// SpreadOut: walk to this bot's own spot round the victim's back / sides, not its centre.
if (cx == vu->x && cy == vu->y)
{
@@ -218,7 +218,9 @@ void DispatchInGroup(BotAI& ai,
// When THIS bot is leader AND any non-bot human is in the group,
// hand over leadership. Picks the first non-bot human in the
// member list (stable enough; could be refined to prefer owner).
if (group.leader() == snapshot.raw().guid)
// A self bot is that human: it keeps the lead (selfbot-loot af59c: it handed the group to the other player at once, then counted
// as led by him and left every corpse of the party).
if (group.leader() == snapshot.raw().guid && !snapshot.raw().plays_as_human)
{
BotRegistry& reg_promote = Services::Registry();
ObjectGuid promote_target;
+79 -7
View File
@@ -15,13 +15,15 @@
#include <cstddef>
#include <cstdint>
#include <mutex>
#include <string_view>
#include <unordered_map>
#include <vector>
namespace Playerbot::V2::TownErrand
{
enum class Kind : std::uint8_t { None = 0, Auction, Bank, Trainer, Inn, Mailbox, Flight, Vendor, Battlemaster, Stable, Exit };
enum class Kind : std::uint8_t { None = 0, Auction, Bank, Trainer, Inn, Mailbox, Flight, Vendor, Battlemaster, Stable, Exit,
Forge, Cookfire, Loom, Moonwell };
inline char const* KindName(Kind k)
{
@@ -37,21 +39,66 @@ inline char const* KindName(Kind k)
case Kind::Battlemaster: return "battlemaster";
case Kind::Stable: return "stable master";
case Kind::Exit: return "city gate";
case Kind::Forge: return "forge";
case Kind::Cookfire: return "cooking fire";
case Kind::Loom: return "loom";
case Kind::Moonwell: return "moonwell";
default: return "-";
}
}
// A station a bot can pretend to work at (or really craft at), not an NPC errand.
inline bool IsCraftKind(Kind k)
{
return k == Kind::Forge || k == Kind::Cookfire || k == Kind::Loom || k == Kind::Moonwell;
}
// The SpellFocusObject.dbc name of a station's focus type -> its errand kind. Classification is by name, not id, so the
// mapping survives the focus ids differing between cores and expansions. Kind::None = not a station we send bots to.
inline Kind KindForFocusName(std::string_view name)
{
char lower[64];
std::size_t const n = name.size() < sizeof(lower) - 1 ? name.size() : sizeof(lower) - 1;
for (std::size_t i = 0; i < n; ++i)
lower[i] = char(name[i] | 0x20); // ASCII lowercase
lower[n] = '\0';
std::string_view const s(lower, n);
auto has = [&](std::string_view w) { return s.find(w) != std::string_view::npos; };
if (has("anvil") || has("forge") || has("smelt") || has("furnace")) return Kind::Forge;
if (has("cook") || has("stove") || has("bonfire") || has("campfire")) return Kind::Cookfire;
if (has("loom")) return Kind::Loom;
if (has("moonwell") || has("moon well")) return Kind::Moonwell;
return Kind::None;
}
// The looped "using the station" emote state played while lingering at a craft kind when the bot has nothing it can
// really craft (EMOTE_STATE_* ids; a real craft cast overrides this). Kind::None callers get 0.
inline std::uint32_t WorkEmoteFor(Kind k)
{
switch (k)
{
case Kind::Forge: return 173; // EMOTE_STATE_WORK: hammering loop
case Kind::Cookfire: return 69; // EMOTE_STATE_USE_STANDING: crouched at the fire
case Kind::Loom: return 173; // EMOTE_STATE_WORK
case Kind::Moonwell: return 68; // EMOTE_STATE_KNEEL
default: return 0;
}
}
struct Dest
{
Kind kind = Kind::None;
std::uint64_t key = 0; // the NPC or mailbox spawn id; for the gate, a fixed key
std::uint32_t entry = 0; // creature entry, to face the live NPC on arrival (0 = a mailbox or the gate)
std::uint32_t entry = 0; // creature entry, to face the live NPC on arrival (0 = a mailbox, station or the gate)
float x = 0.f, y = 0.f, z = 0.f;
float weight = 0.f; // how much this place draws a bot right now (BaseWeight, raised by a need)
std::uint32_t focus_type = 0; // craft kinds only: the station's SpellFocusObject id, to match recipes against
float orientation = -1.f; // NPC kinds: the spawn's facing — the customer side for StandPoint (-1 = none)
};
// How much each kind of place draws a resident. The bank and the auction house are where a city's crowd is; a bot's own trainer and
// the flight master are errands with a purpose; vendors are many, so each draws little.
// the flight master are errands with a purpose; vendors are many, so each draws little. The craft stations draw little on their
// own — the fixture steering (Playerbot.World.Town.Fixture.*) is what keeps them occupied, not the roll.
inline float BaseWeight(Kind k)
{
switch (k)
@@ -66,6 +113,10 @@ inline float BaseWeight(Kind k)
case Kind::Battlemaster: return 1.5f;
case Kind::Stable: return 1.5f;
case Kind::Exit: return 2.0f;
case Kind::Forge: return 1.0f;
case Kind::Cookfire: return 0.8f;
case Kind::Loom: return 0.3f;
case Kind::Moonwell: return 0.3f;
default: return 0.0f;
}
}
@@ -122,11 +173,15 @@ inline int Pick(std::vector<Dest> const& dests, float bx, float by, float max_ya
// Where a bot stands at a place: on the side it comes from, at `ring` yards, turned by its slot so the bots at one place stand side by
// side instead of on one point. `slot` 0.. (the order the place was claimed in).
inline void StandPoint(float px, float py, float bx, float by, float ring, std::uint32_t slot, float& sx, float& sy)
// The point on the place's ring a bot stands at. `face` is the direction the place faces its customers
// (an NPC's spawn orientation — a banker faces the queue, an auctioneer the hall); a negative value is
// none, and the near side to the walking bot is used (right for a round prop: mailbox, anvil, gate).
inline void StandPoint(float px, float py, float bx, float by, float ring, std::uint32_t slot, float& sx, float& sy,
float face = -100.0f)
{
float const dx = bx - px, dy = by - py, len = std::hypot(dx, dy);
float base = len > 0.5f ? std::atan2(dy, dx) : 0.0f;
// 0, +0.55, -0.55, +1.1, -1.1 ... radians: a fan on the near side
float base = face >= 0.0f ? face : (len > 0.5f ? std::atan2(dy, dx) : 0.0f);
// 0, +0.55, -0.55, +1.1, -1.1 ... radians: a fan on the facing side
float const step = float((slot + 1u) / 2u) * 0.55f;
base += (slot % 2u) ? step : -step;
sx = px + std::cos(base) * ring;
@@ -244,9 +299,26 @@ struct State
bool issued = false; // the move to the place has gone out
bool leaving = false; // this errand is the walk out of the city (the bot's town time is over)
std::uint32_t leave_until_ms = 0; // out at the gate: no errands, the bot heads off to level until then
std::uint32_t focus_type = 0; // craft kinds: the station's SpellFocusObject id, for matching recipes
std::uint32_t next_use_ms = 0; // the next "use the place" beat (craft cast, work emote, mid-linger fidget)
bool work_emote = false; // a looped work emote is up: clear it when the errand ends
std::uint32_t next_sound_ms = 0; // next one-shot sound push while the work emote loops
std::uint8_t tool_bag = 0xFF; // the bag slot the profession tool came out of for the station show
std::uint8_t tool_slot = 0xFF; // (the swap put the weapon there: equipping it back restores the kit)
std::uint64_t tool_guid = 0; // the swap's item (raw guid) — two same-entry tools (one equipped, one bagged) ping-pong forever on entry matching alone
bool kit_ready = false; // the kit is confirmed: the tool's in hand, or the station needs none
bool tool_in_hand = false; // the swap landed — the tool was seen leaving the bags, not just pushed
std::uint8_t kit_attempts = 0; // failed acquisition checks — a few and the visit is abandoned
std::uint32_t next_kit_ms = 0; // the next kit check (a quicker cadence than the use-beat)
bool stock_given = false; // reagents for the recipe were conjured once this errand
bool recipe_given = false; // the station's starter recipe was taught once this errand (pre-pipeline bots)
bool want_vendor = false; // a kit visit that couldn't start (full bags) steers the next errand to a vendor
std::uint32_t pause_until_ms = 0; // settle beat set by EndErrand after Clear: stand a moment before the next pick walks off (no mid-swing slide)
Recent recent;
void Clear() { kind = Kind::None; key = 0; place = 0; entry = 0; phase = 0; near_player_ms = 0; issued = false; leaving = false; prog_ms = 0; }
// want_vendor outlives the errand that set it — it's the reason for the next one.
void Clear() { kind = Kind::None; key = 0; place = 0; entry = 0; phase = 0; near_player_ms = 0; issued = false; leaving = false; prog_ms = 0;
focus_type = 0; next_use_ms = 0; work_emote = false; next_sound_ms = 0; tool_bag = tool_slot = 0xFF; tool_guid = 0; kit_ready = false; tool_in_hand = false; kit_attempts = 0; next_kit_ms = 0; stock_given = false; recipe_given = false; pause_until_ms = 0; }
};
// Has the walking bot stopped getting closer? It counts as progress to move `yards` in `window_ms`.
@@ -3,6 +3,7 @@
#pragma once
#include "Config.h"
#include "Bot/TownErrand.h"
#include <algorithm>
#include <cstdint>
@@ -16,6 +17,23 @@ struct Config
float radius = 300.0f; // ErrandRadius: how far across the city the next place may be
std::uint32_t linger_min_ms = 4000; // LingerMinSec / LingerMaxSec: the stop at a place
std::uint32_t linger_max_ms = 12000;
std::uint32_t linger_bank_min_ms = 20000; // LingerBankMinSec / LingerBankMaxSec: the bank visit
std::uint32_t linger_bank_max_ms = 40000;
std::uint32_t linger_ah_min_ms = 20000; // LingerAhMinSec / LingerAhMaxSec: the auction-house visit
std::uint32_t linger_ah_max_ms = 40000;
std::uint32_t linger_craft_min_ms = 45000; // LingerCraftMinSec / LingerCraftMaxSec: working at a station
std::uint32_t linger_craft_max_ms = 90000;
std::uint32_t fixture_bank = 3; // Fixture.*: bots guaranteed at each place (0 = no fixture for the kind)
std::uint32_t fixture_ah = 3;
std::uint32_t fixture_forge = 2;
std::uint32_t fixture_cookfire = 1;
std::uint32_t fixture_loom = 0;
std::uint32_t fixture_moonwell = 0;
bool craft_cast = true; // CraftCast: really craft a known recipe at a station (0 = work-emote show only)
std::uint32_t craft_sound_forge = 4614; // CraftSound.*: the sound kit pushed to earshot each work
std::uint32_t craft_sound_cookfire = 7035; // beat (the real Tradeskills kits; 0 = silent like vanilla
std::uint32_t craft_sound_loom = 6425; // emote work). 1166 smelt is under Forge; enchanting has
std::uint32_t craft_sound_moonwell = 0; // no dedicated kit.
std::uint32_t spot_cap = 5; // SpotCap: bots at one place (a bank, an auction house, a trainer) at once
std::uint32_t inn_cap = 4; // InnCap: bots resting at one inn at once
std::uint32_t mailbox_cap = 2; // MailboxCap: bots at one mailbox at once
@@ -29,6 +47,47 @@ struct Config
std::uint32_t field_idle_ms = 30000; // Playerbot.World.IdleSec: the same anywhere else (the idle watch, Bot/IdleWatch.h)
};
// The linger range a place of `kind` gets (the dedicated stays; the generic pair covers everything else).
inline void LingerRange(Config const& c, Kind k, std::uint32_t& min_ms, std::uint32_t& max_ms)
{
switch (k)
{
case Kind::Bank: min_ms = c.linger_bank_min_ms; max_ms = c.linger_bank_max_ms; return;
case Kind::Auction: min_ms = c.linger_ah_min_ms; max_ms = c.linger_ah_max_ms; return;
case Kind::Forge: case Kind::Cookfire: case Kind::Loom: case Kind::Moonwell:
min_ms = c.linger_craft_min_ms; max_ms = c.linger_craft_max_ms; return;
default: min_ms = c.linger_min_ms; max_ms = c.linger_max_ms; return;
}
}
// How many bots a place of `kind` keeps occupied through the fixture steering (0 = no fixture).
inline std::uint32_t FixtureTarget(Config const& c, Kind k)
{
switch (k)
{
case Kind::Bank: return c.fixture_bank;
case Kind::Auction: return c.fixture_ah;
case Kind::Forge: return c.fixture_forge;
case Kind::Cookfire: return c.fixture_cookfire;
case Kind::Loom: return c.fixture_loom;
case Kind::Moonwell: return c.fixture_moonwell;
default: return 0;
}
}
// The SoundKit pushed to earshot on each work beat at a place of a kind (0 = silent).
inline std::uint32_t SoundKitFor(Config const& c, Kind k)
{
switch (k)
{
case Kind::Forge: return c.craft_sound_forge;
case Kind::Cookfire: return c.craft_sound_cookfire;
case Kind::Loom: return c.craft_sound_loom;
case Kind::Moonwell: return c.craft_sound_moonwell;
default: return 0;
}
}
inline Config const& Cfg()
{
static Config const c = []
@@ -39,6 +98,26 @@ inline Config const& Cfg()
k.linger_min_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerMinSec", 4, true), 0, 300)) * 1000u;
k.linger_max_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerMaxSec", 12, true), 0, 600)) * 1000u;
k.linger_max_ms = std::max(k.linger_max_ms, k.linger_min_ms);
k.linger_bank_min_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerBankMinSec", 20, true), 0, 300)) * 1000u;
k.linger_bank_max_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerBankMaxSec", 40, true), 0, 600)) * 1000u;
k.linger_bank_max_ms = std::max(k.linger_bank_max_ms, k.linger_bank_min_ms);
k.linger_ah_min_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerAhMinSec", 20, true), 0, 300)) * 1000u;
k.linger_ah_max_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerAhMaxSec", 40, true), 0, 600)) * 1000u;
k.linger_ah_max_ms = std::max(k.linger_ah_max_ms, k.linger_ah_min_ms);
k.linger_craft_min_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerCraftMinSec", 45, true), 0, 300)) * 1000u;
k.linger_craft_max_ms = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.LingerCraftMaxSec", 90, true), 0, 600)) * 1000u;
k.linger_craft_max_ms = std::max(k.linger_craft_max_ms, k.linger_craft_min_ms);
k.fixture_bank = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Bank", 3, true), 0, 50));
k.fixture_ah = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Ah", 3, true), 0, 50));
k.fixture_forge = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Forge", 2, true), 0, 50));
k.fixture_cookfire = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Cookfire", 1, true), 0, 50));
k.fixture_loom = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Loom", 0, true), 0, 50));
k.fixture_moonwell = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.Fixture.Moonwell", 0, true), 0, 50));
k.craft_cast = sConfigMgr->GetBoolDefault("Playerbot.World.Town.CraftCast", true, true);
k.craft_sound_forge = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.CraftSound.Forge", 4614, true), 0, 100000));
k.craft_sound_cookfire = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.CraftSound.Cookfire", 7035, true), 0, 100000));
k.craft_sound_loom = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.CraftSound.Loom", 6425, true), 0, 100000));
k.craft_sound_moonwell = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.CraftSound.Moonwell", 0, true), 0, 100000));
k.spot_cap = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.SpotCap", 5, true), 1, 100));
k.inn_cap = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.InnCap", 4, true), 0, 100));
k.mailbox_cap = std::uint32_t(std::clamp<int>(sConfigMgr->GetIntDefault("Playerbot.World.Town.MailboxCap", 2, true), 0, 100));
@@ -32,8 +32,8 @@ uint32 HunterPetEntryForRace(uint32 race);
constexpr uint32 GenericAllianceHunterPet = 299; // Young Wolf (Elwynn Forest)
constexpr uint32 GenericHordeHunterPet = 3099; // Dire Mottled Boar (Valley of Trials; 5826 was Geolord Mottle, a quilboar)
// A world (ambient) hunter's own first pet, stable per bot: one of the faction's classic starter beasts picked by guid, so a street of
// hunters is not all one race's beast. Creature entries of HunterPetEntryForRace's classic races; the caller's tameable check still
// A hunter bot's own first pet, stable per bot: one of the faction's classic starter beasts picked by guid, so a street of hunters, or
// a player's hired ones, is not all one race's beast. Creature entries of HunterPetEntryForRace's classic races; the caller's tameable check still
// decides whether the pick exists as a beast in this data. `fallback` (the race's pet) is returned for an owned bot (guid 0).
inline uint32 VariedHunterPetEntry(bool alliance, uint64 guid, uint32 fallback)
{
@@ -561,18 +561,29 @@ std::vector<GrindSpot> const& GrindSpotsFor(bool alliance)
continue;
if ((t->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN) || uint64(data.npcflag.value_or(t->npcflag)) != 0)
continue;
CreatureDifficulty const* cd = t->GetDifficulty(DIFFICULTY_NONE);
if (!cd)
continue;
Optional<ContentTuningLevels> lv = sDB2Manager.GetContentTuningData(cd->ContentTuningID, {});
if (!lv || lv->MinLevel <= 0)
// The level the creature spawns at, read as Creature::ApplyLevelScaling does: the Classic range (the spawn's own, then the
// entry's) first, ContentTuning only for a creature without one. The client's ContentTuning store has about a hundred rows
// and most Classic creatures have none in it: the index kept 347 of some 55,000 spawns and every leveling zone sat at the
// mob supply floor (ForeverCore issue #385, sqmagellan).
std::pair<uint8, uint8> const* classic = sObjectMgr->GetCreatureClassicSpawnLevel(spawn_id);
if (!classic)
classic = sObjectMgr->GetCreatureClassicLevel(data.id);
uint32 level = 0;
if (classic)
level = (uint32(classic->first) + std::max<uint32>(classic->first, classic->second)) / 2;
else if (CreatureDifficulty const* cd = t->GetDifficulty(DIFFICULTY_NONE))
{
Optional<ContentTuningLevels> lv = sDB2Manager.GetContentTuningData(cd->ContentTuningID, {});
if (lv && lv->MinLevel > 0)
level = uint32((lv->MinLevel + std::max<int>(lv->MinLevel, lv->MaxLevel)) / 2);
}
if (!level)
continue;
FactionTemplateEntry const* ft = sFactionTemplateStore.LookupEntry(t->faction);
if (!ft)
continue;
++mobs;
GrindSample smp{ data.mapId, data.spawnPoint.GetPositionX(), data.spawnPoint.GetPositionY(), data.spawnPoint.GetPositionZ(),
uint32((lv->MinLevel + std::max<int>(lv->MinLevel, lv->MaxLevel)) / 2) };
GrindSample smp{ data.mapId, data.spawnPoint.GetPositionX(), data.spawnPoint.GetPositionY(), data.spawnPoint.GetPositionZ(), level };
for (int side = 0; side < 2; ++side)
if (ft_side[side] && (ft->IsHostileTo(ft_side[side]) || ft_side[side]->IsHostileTo(ft)))
samples[side].push_back(smp);
@@ -266,8 +266,10 @@ inline bool InLos(BotSnapshotView const& s, ObjectGuid guid)
return true;
}
// aura_due: what the patient's own periodic auras deal it before a slow heal lands (GroupMemberSummary::aura_damage_due), counted
// whole with the swings (armour does not take it).
inline Patient MakePatient(BotSnapshotView const& s, ObjectGuid guid, int64 hp, int64 max_hp,
float x, float y, float z, bool tank)
float x, float y, float z, bool tank, int64 aura_due = 0)
{
Patient p;
p.guid = guid;
@@ -279,7 +281,7 @@ inline Patient MakePatient(BotSnapshotView const& s, ObjectGuid guid, int64 hp,
return p;
// Swings are pre-armour; a tank in plate (or bear form) takes roughly half of that.
int64 const swings = IncomingMelee(s, guid, x, y, z);
p.incoming = std::min<int64>(tank ? swings / 2 : swings, hp);
p.incoming = std::min<int64>((tank ? swings / 2 : swings) + std::max<int64>(aura_due, 0), hp);
p.actual_pct = int32(hp * 100 / max_hp);
p.hp_pct = int32((hp - p.incoming) * 100 / max_hp);
return p;
@@ -289,11 +291,12 @@ inline Patient MakePatient(BotSnapshotView const& s, ObjectGuid guid, int64 hp,
inline Patient SelfPatient(BotSnapshotView const& s, GroupSnapshotView const& g)
{
bool tank = false;
int64 aura_due = 0;
if (auto const* members = g.members())
for (GroupMemberSummary const& m : *members)
if (m.guid == s.guid()) { tank = IsTank(s, m); break; }
if (m.guid == s.guid()) { tank = IsTank(s, m); aura_due = m.aura_damage_due; break; }
float x, y, z; s.position(x, y, z);
return MakePatient(s, s.guid(), s.hp(), s.max_hp(), x, y, z, tank);
return MakePatient(s, s.guid(), s.hp(), s.max_hp(), x, y, z, tank, aura_due);
}
// Patient data for a specific unit (the bot or a group member).
@@ -305,7 +308,7 @@ inline Patient PatientFor(BotSnapshotView const& s, GroupSnapshotView const& g,
{
for (GroupMemberSummary const& m : *members)
if (m.guid == guid)
return MakePatient(s, m.guid, m.hp, m.max_hp, m.x, m.y, m.z, IsTank(s, m));
return MakePatient(s, m.guid, m.hp, m.max_hp, m.x, m.y, m.z, IsTank(s, m), m.aura_damage_due);
// A member's pet (PickPatient pet case).
for (GroupMemberSummary const& m : *members)
if (m.pet_alive && m.pet_guid == guid)
@@ -714,7 +717,7 @@ inline Patient PickPatient(BotSnapshotView const& s, GroupSnapshotView const& g,
bool const tank = IsTank(s, m);
int32 const pct = m.hp_pct();
if (!tank && pct >= kEmergencyPct && !InLos(s, m.guid)) continue;
Patient const mp = MakePatient(s, m.guid, m.hp, m.max_hp, m.x, m.y, m.z, tank);
Patient const mp = MakePatient(s, m.guid, m.hp, m.max_hp, m.x, m.y, m.z, tank, m.aura_damage_due);
// A warlock's own Life Tap is intentional damage: not a reason for a heal until he is low (playtest, live MC 2026-10-10).
if (raid && LifeTapSkip(m.cls == CLASS_WARLOCK, tank, mp.actual_pct, mp.incoming))
continue;
@@ -598,10 +598,29 @@ void DoSaveAlly(ApPredicateContext const& ctx, BotIntentEmitter& e)
ClassicHeal::EmitHeal(ctx.bot, ctx.group, e, FastHeal(ctx), ClassicHeal::PickPatient(ctx));
}
// A protection paladin heals itself when nobody else will (VempirE, row 382: "as tank, not even self-heals"; the tank rules had
// no heal but Lay on Hands): at 35 % or under, with mana for it and no living healer of its group on its map, the fast heal
// (Flash of Light, before level 20 Holy Light) on itself. With a healer there the tank keeps hitting and the healer heals it.
bool ShouldTankSelfHeal(ApPredicateContext const& ctx)
{
if (ctx.bot.hp_pct() > 35 || ManaPct(ctx) < 15 || !Ready(ctx, FastHeal(ctx)))
return false;
if (auto const* members = ctx.group.members())
for (GroupMemberSummary const& m : *members)
if (m.guid != ctx.bot.raw().guid && m.role == Role::Healer && m.online && m.is_alive && m.map_id == ctx.bot.map_id())
return false;
return true;
}
void DoTankSelfHeal(ApPredicateContext const& ctx, BotIntentEmitter& e)
{
e.cast(FastHeal(ctx), ctx.bot.raw().guid);
}
ApRule const kTankRules[] = {
{ ShouldDivineShield, DoDivineShield, "classic_pal_tank:divine_shield" },
{ ShouldDivineProtection, DoDivineProtection, "classic_pal_tank:divine_protection" },
{ ShouldSelfLayOnHands, DoSelfLayOnHands, "classic_pal_tank:lay_on_hands" },
{ ShouldTankSelfHeal, DoTankSelfHeal, "classic_pal_tank:self_heal" },
{ ShouldSaveAlly, DoSaveAlly, "classic_pal_tank:save_ally" },
{ ShouldRighteousFury, DoRighteousFury, "classic_pal_tank:righteous_fury" },
{ ShouldPaladinAura, DoPaladinAura, "classic_pal_tank:aura" },
@@ -686,6 +686,44 @@ void DoTankThunderClap(ApPredicateContext const& ctx, BotIntentEmitter& e)
}
}
// -- Charge opener in the open world --
// Out of combat with a live target 8-25 y away (Charge's window): Defensive -> Battle -> Charge -> Defensive, the vanilla tank's
// opener, which also brings the first rage. Before, Charge was only in the arms / fury / low-level list, so a Protection bot walked
// to every mob (RU bug list 11-23, row 349). Not in a dungeon or raid: there the pull is planned (the pull back with a ranged opener,
// the pre-pull crowd control) and a Charge into the pack would break it. Never at a crowd-controlled target.
bool ProtChargeWanted(ApPredicateContext const& ctx)
{
if (ctx.bot.in_combat() || ctx.bot.is_in_instance() || !HasLiveTarget(ctx) || !ctx.bot.knows_spell(CHARGE))
return false;
NearbyUnit const* v = ctx.bot.victim_info();
if (!v || v->is_cc_locked || !v->in_los) return false;
float const d = DistToVictim(ctx);
return d >= 8.f && d <= 25.f;
}
bool ShouldChargeStance(ApPredicateContext const& ctx)
{
return Services::Config().behavior_warrior_stance_dance() // off: a Protection warrior never leaves Defensive Stance
&& !StanceForced(ctx) && InStance(ctx, DEFENSIVE_STANCE) && !DanceLockedOut(ctx)
&& Ready(ctx, CHARGE) && StanceReady(ctx, BATTLE_STANCE) && ProtChargeWanted(ctx);
}
void DoChargeStance(ApPredicateContext const& ctx, BotIntentEmitter& e)
{
if (e.cast(BATTLE_STANCE))
DanceBegin(ctx, CHARGE);
}
bool ShouldProtCharge(ApPredicateContext const& ctx)
{
return InStance(ctx, BATTLE_STANCE) && DanceActive(ctx, CHARGE) && Ready(ctx, CHARGE)
&& ctx.bot.victim_in_spell_range(CHARGE) && ProtChargeWanted(ctx);
}
void DoProtCharge(ApPredicateContext const& ctx, BotIntentEmitter& e)
{
if (e.cast(CHARGE, ctx.bot.victim()))
DanceEnd(ctx); // back to Defensive Stance on the next tick
}
// Stay in Battle Stance only while the dance's ability is still wanted and
// waits on nothing but the GCD (the stance change's own); any other case
// ends the dance at once.
@@ -696,6 +734,8 @@ bool DanceHold(ApPredicateContext const& ctx)
return OffOwnCooldown(ctx, MOCKING_BLOW) && Rage(ctx) >= kMockingBlowRage && MockingBlowTarget(ctx) != nullptr;
if (DanceActive(ctx, THUNDER_CLAP))
return OffOwnCooldown(ctx, THUNDER_CLAP) && Rage(ctx) >= kThunderClapRage && ThunderClapWorth(ctx);
if (DanceActive(ctx, CHARGE))
return OffOwnCooldown(ctx, CHARGE) && ProtChargeWanted(ctx);
return false;
}
@@ -1026,6 +1066,8 @@ ApRule const kTankRules[] = {
{ ShouldFearDanceRage, DoFearDanceRage, "classic_prot:fear_berserker_rage" },
{ ShouldFearDanceStance, DoFearDanceStance, "classic_prot:fear_berserker_stance" },
{ ShouldMockingBlow, DoMockingBlow, "classic_prot:mocking_blow" },
{ ShouldProtCharge, DoProtCharge, "classic_prot:charge" },
{ ShouldChargeStance, DoChargeStance, "classic_prot:charge_stance" },
{ ShouldTankThunderClap, DoTankThunderClap, "classic_prot:thunder_clap" },
{ ShouldDefensiveStance, DoDefensiveStance, "classic_prot:defensive_stance" },
{ ShouldChallengingShout, DoChallengingShout, "classic_prot:challenging_shout" },

Some files were not shown because too many files have changed in this diff Show More