|
8 | 8 | #include "Event.h"
|
9 | 9 | #include "LastMovementValue.h"
|
10 | 10 | #include "Playerbots.h"
|
| 11 | +#include "PlayerbotAIConfig.h" |
| 12 | +#include "Config.h" |
11 | 13 |
|
12 | 14 | bool TaxiAction::Execute(Event event)
|
13 | 15 | {
|
@@ -48,6 +50,36 @@ bool TaxiAction::Execute(Event event)
|
48 | 50 | }
|
49 | 51 | }
|
50 | 52 |
|
| 53 | + // stagger bot takeoff |
| 54 | + uint32 delayMin = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiDelayMinMs", 350u, false); |
| 55 | + uint32 delayMax = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiDelayMaxMs", 5000u, false); |
| 56 | + uint32 gapMs = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiGapMs", 200u, false); |
| 57 | + uint32 gapJitterMs = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiGapJitterMs", 100u, false); |
| 58 | + |
| 59 | + // Only for follower bots |
| 60 | + if (botAI->HasRealPlayerMaster()) |
| 61 | + { |
| 62 | + uint32 index = botAI->GetGroupSlotIndex(bot); |
| 63 | + uint32 delay = delayMin + index * gapMs + urand(0, gapJitterMs); |
| 64 | + |
| 65 | + delay = std::min(delay, delayMax); |
| 66 | + |
| 67 | + // Store the npc’s GUID so we can re-acquire the pointer later |
| 68 | + ObjectGuid npcGuid = npc->GetGUID(); |
| 69 | + |
| 70 | + // schedule the take-off |
| 71 | + botAI->AddTimedEvent( |
| 72 | + [bot = bot, &movement, npcGuid]() -> void |
| 73 | + { |
| 74 | + if (Creature* npcPtr = ObjectAccessor::GetCreature(*bot, npcGuid)) |
| 75 | + if (!movement.taxiNodes.empty()) |
| 76 | + bot->ActivateTaxiPathTo(movement.taxiNodes, npcPtr); |
| 77 | + }, |
| 78 | + delay); |
| 79 | + botAI->SetNextCheckDelay(delay + 50); |
| 80 | + return true; |
| 81 | + } |
| 82 | + |
51 | 83 | if (param == "?")
|
52 | 84 | {
|
53 | 85 | botAI->TellMasterNoFacing("=== Taxi ===");
|
|
0 commit comments