mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #354 from liyunfan1223/crash-fix-0717
Fix crash caused by summon to instance and avoid aoe
This commit is contained in:
@@ -450,22 +450,24 @@ void PlayerbotAI::HandleTeleportAck()
|
|||||||
|
|
||||||
bot->GetMotionMaster()->Clear(true);
|
bot->GetMotionMaster()->Clear(true);
|
||||||
bot->StopMoving();
|
bot->StopMoving();
|
||||||
if (bot->IsBeingTeleportedNear())
|
if (bot->IsBeingTeleportedNear()) {
|
||||||
{
|
while (bot->IsInWorld() && bot->IsBeingTeleportedNear()) {
|
||||||
WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);
|
Player* plMover = bot->m_mover->ToPlayer();
|
||||||
p << bot->GetGUID().WriteAsPacked();
|
if (!plMover)
|
||||||
p << (uint32) 0; // supposed to be flags? not used currently
|
return;
|
||||||
p << (uint32) time(nullptr); // time - not currently used
|
WorldPacket p = WorldPacket(MSG_MOVE_TELEPORT_ACK, 8 + 4 + 4);
|
||||||
bot->GetSession()->HandleMoveTeleportAck(p);
|
p << plMover->GetPackGUID();
|
||||||
|
p << (uint32) 0; // supposed to be flags? not used currently
|
||||||
// add delay to simulate teleport delay
|
p << (uint32) 0; // time - not currently used
|
||||||
|
bot->GetSession()->HandleMoveTeleportAck(p);
|
||||||
|
}
|
||||||
SetNextCheckDelay(urand(1000, 3000));
|
SetNextCheckDelay(urand(1000, 3000));
|
||||||
}
|
}
|
||||||
else if (bot->IsBeingTeleportedFar())
|
if (bot->IsBeingTeleportedFar())
|
||||||
{
|
{
|
||||||
bot->GetSession()->HandleMoveWorldportAck();
|
while (bot->IsBeingTeleportedFar()) {
|
||||||
|
bot->GetSession()->HandleMoveWorldportAck();
|
||||||
// add delay to simulate teleport delay
|
}
|
||||||
SetNextCheckDelay(urand(2000, 5000));
|
SetNextCheckDelay(urand(2000, 5000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,15 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
|
|||||||
bool SummonAction::Teleport(Player* summoner, Player* player)
|
bool SummonAction::Teleport(Player* summoner, Player* player)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
|
if (master->GetMap() && master->GetMap()->IsDungeon()) {
|
||||||
|
InstanceMap* map = master->GetMap()->ToInstanceMap();
|
||||||
|
if (map) {
|
||||||
|
if (map->CannotEnter(player) == Map::CANNOT_ENTER_MAX_PLAYERS) {
|
||||||
|
botAI->TellError("I can not enter this dungeon");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!summoner->IsBeingTeleported() && !player->IsBeingTeleported())
|
if (!summoner->IsBeingTeleported() && !player->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
float followAngle = GetFollowAngle();
|
float followAngle = GetFollowAngle();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class AreaDebuffValue : public CalculatedValue<Aura*>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AreaDebuffValue(PlayerbotAI* botAI) :
|
AreaDebuffValue(PlayerbotAI* botAI) :
|
||||||
CalculatedValue<Aura*>(botAI, "area debuff", 1 * 1000) { }
|
CalculatedValue<Aura*>(botAI, "area debuff", 1) { }
|
||||||
|
|
||||||
Aura* Calculate() override;
|
Aura* Calculate() override;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user