Skip to content

Commit 0a3122c

Browse files
CraftedROAokromes
andcommitted
buildfix
Co-Authored-By: Aokromes <Aokromes@users.noreply.github.com>
1 parent 50e5e9c commit 0a3122c

2 files changed

Lines changed: 38 additions & 66 deletions

File tree

src/server/game/Entities/Player/Player.cpp

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
// 1
19-
// 2
20-
// 3
21-
// 4
22-
// 5
23-
// 6
24-
// 7
25-
// 8
26-
// 9
27-
// 10
28-
2918
#include "Player.h"
3019
#include "AccountMgr.h"
3120
#include "AchievementMgr.h"
@@ -50,7 +39,6 @@
5039
#include "CombatPackets.h"
5140
#include "Common.h"
5241
#include "ConditionMgr.h"
53-
#include "Config.h"
5442
#include "Containers.h"
5543
#include "CreatureAI.h"
5644
#include "DatabaseEnv.h"
@@ -1586,7 +1574,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
15861574
// reset movement flags at teleport, because player will continue move with these flags after teleport
15871575
SetUnitMovementFlags(GetUnitMovementFlags() & MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE);
15881576
DisableSpline();
1589-
GetMotionMaster()->Remove(EFFECT_MOTION_TYPE);
1577+
GetMotionMaster()->InterruptOnTeleport();
15901578

15911579
if (Transport* transport = GetTransport())
15921580
{
@@ -1638,13 +1626,15 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
16381626

16391627
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
16401628
// at client packet MSG_MOVE_TELEPORT_ACK
1641-
SetSemaphoreTeleportNear(true);
1629+
SetSemaphoreTeleportNear(IsMovedByClient());
16421630
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
16431631
if (!GetSession()->PlayerLogout())
16441632
{
16451633
SetCanTeleport(true);
16461634
SendTeleportPacket(m_teleport_dest, (options & TELE_TO_TRANSPORT_TELEPORT) != 0);
16471635
}
1636+
if (!IsBeingTeleportedNear()) // update position immediately if we will not be waiting for client ACK
1637+
UpdatePosition(m_teleport_dest, true);
16481638
}
16491639
else
16501640
{
@@ -22533,59 +22523,48 @@ void Player::SendInitialPacketsAfterAddToMap()
2253322523

2253422524
CastSpell(this, 836, true); // LOGINEFFECT
2253522525

22536-
// set some aura effects that send packet to player client after add player to map
22537-
// SendMessageToSet not send it to player not it map, only for aura that not changed anything at re-apply
22538-
// same auras state lost at far teleport, send it one more time in this case also
22539-
static const AuraType auratypes[] =
22540-
{
22541-
SPELL_AURA_MOD_FEAR, SPELL_AURA_TRANSFORM, SPELL_AURA_WATER_WALK,
22542-
SPELL_AURA_FEATHER_FALL, SPELL_AURA_HOVER, SPELL_AURA_SAFE_FALL,
22543-
SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_NONE
22544-
};
22545-
for (AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
22546-
{
22547-
Unit::AuraEffectList const& auraList = GetAuraEffectsByType(*itr);
22548-
if (!auraList.empty())
22549-
auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
22550-
}
22551-
22552-
if (HasAuraType(SPELL_AURA_MOD_STUN))
22553-
SetRooted(true);
22554-
2255522526
WorldPacket setCompoundState(SMSG_MULTIPLE_MOVES, 100);
2255622527
setCompoundState << uint32(0); // size placeholder
2255722528

2255822529
// manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that must not be re-applied.
22559-
if (HasAuraType(SPELL_AURA_MOD_ROOT))
22530+
if (HasAuraType(SPELL_AURA_MOD_STUN) || HasAuraType(SPELL_AURA_MOD_ROOT))
2256022531
{
2256122532
setCompoundState << uint8(2 + GetPackGUID().size() + 4);
2256222533
setCompoundState << uint16(SMSG_FORCE_MOVE_ROOT);
2256322534
setCompoundState << GetPackGUID();
22564-
setCompoundState << uint32(0); //! movement counter
22535+
setCompoundState << uint32(GetMovementCounterAndInc());
2256522536
}
2256622537

2256722538
if (HasAuraType(SPELL_AURA_FEATHER_FALL))
2256822539
{
2256922540
setCompoundState << uint8(2 + GetPackGUID().size() + 4);
2257022541
setCompoundState << uint16(SMSG_MOVE_FEATHER_FALL);
2257122542
setCompoundState << GetPackGUID();
22572-
setCompoundState << uint32(0); //! movement counter0
22543+
setCompoundState << uint32(GetMovementCounterAndInc());
2257322544
}
2257422545

2257522546
if (HasAuraType(SPELL_AURA_WATER_WALK))
2257622547
{
2257722548
setCompoundState << uint8(2 + GetPackGUID().size() + 4);
2257822549
setCompoundState << uint16(SMSG_MOVE_WATER_WALK);
2257922550
setCompoundState << GetPackGUID();
22580-
setCompoundState << uint32(0); //! movement counter0
22551+
setCompoundState << uint32(GetMovementCounterAndInc());
2258122552
}
2258222553

2258322554
if (HasAuraType(SPELL_AURA_HOVER))
2258422555
{
2258522556
setCompoundState << uint8(2 + GetPackGUID().size() + 4);
2258622557
setCompoundState << uint16(SMSG_MOVE_SET_HOVER);
2258722558
setCompoundState << GetPackGUID();
22588-
setCompoundState << uint32(0); //! movement counter0
22559+
setCompoundState << uint32(GetMovementCounterAndInc());
22560+
}
22561+
22562+
if (HasAuraType(SPELL_AURA_FLY) || HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
22563+
{
22564+
setCompoundState << uint8(2 + GetPackGUID().size() + 4);
22565+
setCompoundState << uint16(SMSG_MOVE_SET_CAN_FLY);
22566+
setCompoundState << GetPackGUID();
22567+
setCompoundState << uint32(GetMovementCounterAndInc());
2258922568
}
2259022569

2259122570
if (setCompoundState.size() > 4)
@@ -22594,6 +22573,9 @@ void Player::SendInitialPacketsAfterAddToMap()
2259422573
SendDirectMessage(&setCompoundState);
2259522574
}
2259622575

22576+
if (HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED) || HasAuraType(SPELL_AURA_MOD_CONFUSE) || HasAuraType(SPELL_AURA_MOD_FEAR))
22577+
SetClientControl(this, false);
22578+
2259722579
SendEnchantmentDurations(); // must be after add to map
2259822580
SendItemDurations(); // must be after add to map
2259922581
SendQuestGiverStatusMultiple();

src/server/game/Entities/Unit/Unit.cpp

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,8 +3404,12 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
34043404
}
34053405

34063406
if (Player* player = ToPlayer())
3407-
if (sConditionMgr->IsSpellUsedInSpellClickConditions(aurApp->GetBase()->GetId()))
3407+
{
3408+
if (sConditionMgr->IsSpellUsedInSpellClickConditions(aura->GetId()))
34083409
player->UpdateVisibleGameobjectsOrSpellClicks();
3410+
3411+
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_AURA, aura->GetId(), 0, aura->GetCaster());
3412+
}
34093413
}
34103414

34113415
// removes aura application from lists and unapplies effects
@@ -12830,14 +12834,15 @@ bool Unit::CanSwim() const
1283012834

1283112835
void Unit::NearTeleportTo(Position const& pos, bool casting /*= false*/)
1283212836
{
12833-
DisableSpline();
12834-
if (GetTypeId() == TYPEID_PLAYER)
12837+
if (Player* player = ToPlayer())
1283512838
{
1283612839
WorldLocation target(GetMapId(), pos);
12837-
ToPlayer()->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : 0));
12840+
player->TeleportTo(target, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | (casting ? TELE_TO_SPELL : 0));
1283812841
}
1283912842
else
1284012843
{
12844+
DisableSpline();
12845+
GetMotionMaster()->InterruptOnTeleport();
1284112846
SendTeleportPacket(pos);
1284212847
UpdatePosition(pos, true);
1284312848
UpdateObjectVisibility();
@@ -12877,7 +12882,7 @@ void Unit::SendTeleportPacket(Position const& pos, bool teleportingTransport /*=
1287712882
}
1287812883
WorldPacket moveUpdateTeleport(MSG_MOVE_TELEPORT, 38);
1287912884
moveUpdateTeleport << GetPackGUID();
12880-
Unit* broadcastSource = this;
12885+
Unit::BuildMovementPacket(pos, transportPos, teleportMovementInfo, &moveUpdateTeleport);
1288112886

1288212887
if (IsMovedByClient())
1288312888
{
@@ -12888,13 +12893,11 @@ void Unit::SendTeleportPacket(Position const& pos, bool teleportingTransport /*=
1288812893
Unit::BuildMovementPacket(pos, transportPos, teleportMovementInfo, &moveTeleport);
1288912894
playerMover->SendDirectMessage(&moveTeleport);
1289012895

12891-
broadcastSource = playerMover;
12896+
// Broadcast the packet to everyone except self.
12897+
SendMessageToSet(&moveUpdateTeleport, playerMover);
1289212898
}
12893-
12894-
Unit::BuildMovementPacket(pos, transportPos, teleportMovementInfo, &moveUpdateTeleport);
12895-
12896-
// Broadcast the packet to everyone except self.
12897-
broadcastSource->SendMessageToSet(&moveUpdateTeleport, false);
12899+
else
12900+
SendMessageToSet(&moveUpdateTeleport, true);
1289812901
}
1289912902

1290012903
bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool teleport)
@@ -13257,35 +13260,22 @@ void Unit::SetInFront(WorldObject const* target)
1325713260
SetOrientation(GetAbsoluteAngle(target));
1325813261
}
1325913262

13260-
void Unit::SetFacingTo(float ori, bool force)
13263+
void Unit::SetFacingTo(float ori, bool force /*= true*/, uint32 movementId /*= EVENT_FACE*/)
1326113264
{
1326213265
// do not face when already moving
1326313266
if (!force && (!IsStopped() || !movespline->Finalized()))
1326413267
return;
1326513268

13266-
Movement::MoveSplineInit init(this);
13267-
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
13268-
if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !GetTransGUID().IsEmpty())
13269-
init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
13270-
init.SetFacing(ori);
13271-
13272-
//GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_PRIORITY_HIGHEST);
13273-
init.Launch();
13269+
GetMotionMaster()->MoveFace(ori, movementId);
1327413270
}
1327513271

13276-
void Unit::SetFacingToObject(WorldObject const* object, bool force)
13272+
void Unit::SetFacingToObject(WorldObject const* object, bool force /*= true*/, uint32 movementId /*= EVENT_FACE*/)
1327713273
{
1327813274
// do not face when already moving
1327913275
if (!force && (!IsStopped() || !movespline->Finalized()))
1328013276
return;
1328113277

13282-
/// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
13283-
Movement::MoveSplineInit init(this);
13284-
init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
13285-
init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming
13286-
13287-
//GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_FACE, MOTION_PRIORITY_HIGHEST);
13288-
init.Launch();
13278+
GetMotionMaster()->MoveFace(object, movementId);
1328913279
}
1329013280

1329113281
bool Unit::SetWalk(bool enable)

0 commit comments

Comments
 (0)