mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 00:58:33 +00:00
[BUG FIX] - Preserve buffs on summon by avoiding aura clears (#1958)
### Summary - Add a preserveAuras flag to summon teleport helpers. - Keep auras when using the summon command. - Leave meeting stone behavior unchanged (auras can still be cleared there). ### Motivation Summon command was clearing buffs (e.g., Hellscream’s Warsong in ICC) because auras were explicitly interrupted before teleporting. This change keeps existing meeting stone behavior but preserves auras for the summon path to avoid losing valid buffs. ### Details Solve : https://github.com/mod-playerbots/mod-playerbots/issues/1862 https://github.com/mod-playerbots/mod-playerbots/issues/1942 ### Testing Go to ICC and téléport Bots
This commit is contained in:
@@ -59,7 +59,7 @@ bool AcceptInvitationAction::Execute(Event event)
|
|||||||
|
|
||||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
||||||
{
|
{
|
||||||
Teleport(inviter, bot);
|
Teleport(inviter, bot, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ bool UseMeetingStoneAction::Execute(Event event)
|
|||||||
if (!goInfo || goInfo->entry != 179944)
|
if (!goInfo || goInfo->entry != 179944)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Teleport(master, bot);
|
return Teleport(master, bot, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SummonAction::Execute(Event event)
|
bool SummonAction::Execute(Event event)
|
||||||
@@ -70,16 +70,16 @@ bool SummonAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
// botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Set({});
|
// botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Set({});
|
||||||
AI_VALUE(std::list<FleeInfo>&, "recently flee info").clear();
|
AI_VALUE(std::list<FleeInfo>&, "recently flee info").clear();
|
||||||
return Teleport(master, bot);
|
return Teleport(master, bot, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SummonUsingGos(master, bot) || SummonUsingNpcs(master, bot))
|
if (SummonUsingGos(master, bot, true) || SummonUsingNpcs(master, bot, true))
|
||||||
{
|
{
|
||||||
botAI->TellMasterNoFacing("Hello!");
|
botAI->TellMasterNoFacing("Hello!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SummonUsingGos(bot, master) || SummonUsingNpcs(bot, master))
|
if (SummonUsingGos(bot, master, true) || SummonUsingNpcs(bot, master, true))
|
||||||
{
|
{
|
||||||
botAI->TellMasterNoFacing("Welcome!");
|
botAI->TellMasterNoFacing("Welcome!");
|
||||||
return true;
|
return true;
|
||||||
@@ -88,7 +88,7 @@ bool SummonAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SummonAction::SummonUsingGos(Player* summoner, Player* player)
|
bool SummonAction::SummonUsingGos(Player* summoner, Player* player, bool preserveAuras)
|
||||||
{
|
{
|
||||||
std::list<GameObject*> targets;
|
std::list<GameObject*> targets;
|
||||||
AnyGameObjectInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig->sightDistance);
|
AnyGameObjectInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig->sightDistance);
|
||||||
@@ -98,14 +98,14 @@ bool SummonAction::SummonUsingGos(Player* summoner, Player* player)
|
|||||||
for (GameObject* go : targets)
|
for (GameObject* go : targets)
|
||||||
{
|
{
|
||||||
if (go->isSpawned() && go->GetGoType() == GAMEOBJECT_TYPE_MEETINGSTONE)
|
if (go->isSpawned() && go->GetGoType() == GAMEOBJECT_TYPE_MEETINGSTONE)
|
||||||
return Teleport(summoner, player);
|
return Teleport(summoner, player, preserveAuras);
|
||||||
}
|
}
|
||||||
|
|
||||||
botAI->TellError(summoner == bot ? "There is no meeting stone nearby" : "There is no meeting stone near you");
|
botAI->TellError(summoner == bot ? "There is no meeting stone nearby" : "There is no meeting stone near you");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
|
bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player, bool preserveAuras)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->summonAtInnkeepersEnabled)
|
if (!sPlayerbotAIConfig->summonAtInnkeepersEnabled)
|
||||||
return false;
|
return false;
|
||||||
@@ -139,7 +139,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
|
|||||||
Spell spell(player, spellInfo, TRIGGERED_NONE);
|
Spell spell(player, spellInfo, TRIGGERED_NONE);
|
||||||
spell.SendSpellCooldown();
|
spell.SendSpellCooldown();
|
||||||
|
|
||||||
return Teleport(summoner, player);
|
return Teleport(summoner, player, preserveAuras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SummonAction::Teleport(Player* summoner, Player* player)
|
bool SummonAction::Teleport(Player* summoner, Player* player, bool preserveAuras)
|
||||||
{
|
{
|
||||||
// Player* master = GetMaster();
|
// Player* master = GetMaster();
|
||||||
if (!summoner)
|
if (!summoner)
|
||||||
@@ -208,7 +208,11 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
|
|||||||
|
|
||||||
player->GetMotionMaster()->Clear();
|
player->GetMotionMaster()->Clear();
|
||||||
AI_VALUE(LastMovement&, "last movement").clear();
|
AI_VALUE(LastMovement&, "last movement").clear();
|
||||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TELEPORTED | AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
|
||||||
|
if (!preserveAuras)
|
||||||
|
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TELEPORTED |
|
||||||
|
AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
||||||
|
|
||||||
player->TeleportTo(mapId, x, y, z, 0);
|
player->TeleportTo(mapId, x, y, z, 0);
|
||||||
|
|
||||||
if (botAI->HasStrategy("stay", botAI->GetState()))
|
if (botAI->HasStrategy("stay", botAI->GetState()))
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ public:
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Teleport(Player* summoner, Player* player);
|
bool Teleport(Player* summoner, Player* player, bool preserveAuras);
|
||||||
bool SummonUsingGos(Player* summoner, Player* player);
|
bool SummonUsingGos(Player* summoner, Player* player, bool preserveAuras);
|
||||||
bool SummonUsingNpcs(Player* summoner, Player* player);
|
bool SummonUsingNpcs(Player* summoner, Player* player, bool preserveAuras);
|
||||||
};
|
};
|
||||||
|
|
||||||
class UseMeetingStoneAction : public SummonAction
|
class UseMeetingStoneAction : public SummonAction
|
||||||
|
|||||||
Reference in New Issue
Block a user