Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-09-29 23:22:47 +08:00
74 changed files with 806 additions and 146 deletions
@@ -2417,6 +2417,8 @@ public:
ObjectGuid _grabbedPlayer;
bool didbelow50pct;
bool dropped;
bool grabbed;
float _lastSpeed;
InstanceScript* _instance;
bool IsHeroic() { return me->GetMap()->IsHeroic(); }
@@ -2547,6 +2549,8 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED))
return;
HandleSpeedChangeIfNeeded();
switch (_events.ExecuteEvent())
{
case EVENT_GRAB_PLAYER:
@@ -2557,6 +2561,8 @@ public:
}
break;
case EVENT_MOVE_TO_DROP_POS:
grabbed = true;
_lastSpeed = me->GetSpeed(MOVE_WALK);
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
me->SetCanFly(false);
me->SetDisableGravity(false);
@@ -2596,6 +2602,24 @@ public:
break;
}
}
// For some reason, when the Valkyr has a slowdown effect, the speed of PointMovementGenerator
// and the speed on the client side differ, which leads to a "teleportation" effect when a stun aura is applied.
// Restarting the motion master on speed change ensures the movement is synced between the server and client.
void HandleSpeedChangeIfNeeded()
{
if (!grabbed || dropped)
return;
if (me->GetSpeed(MOVE_WALK) == _lastSpeed)
return;
_lastSpeed = me->GetSpeed(MOVE_WALK);
me->GetMotionMaster()->Clear();
me->StopMovingOnCurrentPos();
_events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 0);
}
};
CreatureAI* GetAI(Creature* creature) const override
@@ -27,6 +27,7 @@
#include "PassiveAI.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SmartAI.h"
#include "SpellAuraEffects.h"
#include "SpellScriptLoader.h"
@@ -26,7 +26,6 @@
#include "PassiveAI.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
@@ -24,7 +24,6 @@
#include "SpellAuras.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "Vehicle.h"
#include "ulduar.h"
#define SPELL_FLAME_JETS_10 62680
@@ -21,7 +21,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "Transport.h"
#include "Vehicle.h"
#include "WorldPacket.h"
#include "ulduar.h"