Skip to content

Commit

Permalink
Merge branch 'vmangos:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
oowow-core authored Dec 17, 2023
2 parents 6648904 + c0d5742 commit 0faea7f
Show file tree
Hide file tree
Showing 8 changed files with 1,577 additions and 11 deletions.
1,548 changes: 1,548 additions & 0 deletions sql/migrations/20231216221145_world.sql

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ bool MovementAnticheat::CheckMultiJump(uint16 opcode)
return false;
}

#define NO_WALL_CLIMB_CHECK_MOVE_FLAGS (MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR | MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING | MOVEFLAG_PITCH_UP | MOVEFLAG_PITCH_DOWN | MOVEFLAG_ONTRANSPORT)
#define NO_WALL_CLIMB_CHECK_MOVE_FLAGS (MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR | MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING | MOVEFLAG_PITCH_UP | MOVEFLAG_PITCH_DOWN | MOVEFLAG_ONTRANSPORT | MOVEFLAG_SPLINE_ELEVATION)
#define NO_WALL_CLIMB_CHECK_UNIT_FLAGS (UNIT_FLAG_UNK_0 | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_POSSESSED)

bool MovementAnticheat::CheckWallClimb(MovementInfo const& movementInfo, uint16 opcode) const
Expand All @@ -996,7 +996,17 @@ bool MovementAnticheat::CheckWallClimb(MovementInfo const& movementInfo, uint16
float const angleRad = atan(deltaZ / deltaXY);
//float const angleDeg = angleRad * (360 / (M_PI_F * 2));

return angleRad > sWorld.getConfig(CONFIG_FLOAT_AC_MOVEMENT_CHEAT_WALL_CLIMB_ANGLE);
if (angleRad > sWorld.getConfig(CONFIG_FLOAT_AC_MOVEMENT_CHEAT_WALL_CLIMB_ANGLE))
{
// check height with and without vmaps and compare
// if player is stepping over model like stairs, that can increase wall climb angle
float const height1 = me->GetMap()->GetHeight(movementInfo.pos.x, movementInfo.pos.y, movementInfo.pos.z, false);
float const height2 = me->GetMap()->GetHeight(movementInfo.pos.x, movementInfo.pos.y, movementInfo.pos.z, true);
if ((std::abs(height1 - height2) < 0.5f) || (deltaZ > 5.0f))
return true;
}

return false;
}

bool MovementAnticheat::CheckForbiddenArea(MovementInfo const& movementInfo) const
Expand Down Expand Up @@ -1297,9 +1307,10 @@ bool MovementAnticheat::CheckTeleport(MovementInfo const& movementInfo) const
return true;

// check moving in given axis without appropriate move flags
// during fall collision with cliffs can change xy so skip that case
if (GetLastMovementInfo().ctime &&
!GetLastMovementInfo().HasMovementFlag(MOVEFLAG_MASK_XZ) &&
!movementInfo.HasMovementFlag(MOVEFLAG_MASK_XZ) &&
!GetLastMovementInfo().HasMovementFlag(MOVEFLAG_MASK_XZ | MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR) &&
!movementInfo.HasMovementFlag(MOVEFLAG_MASK_XZ | MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR) &&
GetLastMovementInfo().HasMovementFlag(MOVEFLAG_ONTRANSPORT) == movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
{
float const distance2d = movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT) ?
Expand All @@ -1311,8 +1322,8 @@ bool MovementAnticheat::CheckTeleport(MovementInfo const& movementInfo) const

// swimming flag only included in check because of 1.14
// vanilla clients do not have a descend/ascend flag
if (!GetLastMovementInfo().HasMovementFlag(MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR | MOVEFLAG_SWIMMING) &&
!movementInfo.HasMovementFlag(MOVEFLAG_JUMPING | MOVEFLAG_FALLINGFAR | MOVEFLAG_SWIMMING))
if (!GetLastMovementInfo().HasMovementFlag(MOVEFLAG_SWIMMING) &&
!movementInfo.HasMovementFlag(MOVEFLAG_SWIMMING))
{
float const distanceZ = movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT) ?
std::abs(GetLastMovementInfo().t_pos.z - movementInfo.t_pos.z) :
Expand Down
3 changes: 3 additions & 0 deletions src/game/Commands/UnitCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ bool ChatHandler::HandleUnitStatInfoCommand(char* args)
PSendSysMessage("Frost spell crit chance: %g", pPlayer->GetSpellCritPercent(SPELL_SCHOOL_FROST));
PSendSysMessage("Shadow spell crit chance: %g", pPlayer->GetSpellCritPercent(SPELL_SCHOOL_SHADOW));
PSendSysMessage("Arcane spell crit chance: %g", pPlayer->GetSpellCritPercent(SPELL_SCHOOL_ARCANE));
PSendSysMessage("Melee hit chance: %g", pPlayer->GetBonusHitChanceFromAuras(BASE_ATTACK));
PSendSysMessage("Ranged hit chance: %g", pPlayer->GetBonusHitChanceFromAuras(RANGED_ATTACK));
PSendSysMessage("Spell hit chance: %g", pPlayer->m_modSpellHitChance);
PSendSysMessage("Positive strength: %g", pPlayer->GetPosStat(STAT_STRENGTH));
PSendSysMessage("Positive agility: %g", pPlayer->GetPosStat(STAT_AGILITY));
PSendSysMessage("Positive stamina: %g", pPlayer->GetPosStat(STAT_STAMINA));
Expand Down
2 changes: 1 addition & 1 deletion src/game/Movement/PointMovementGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void ChargeMovementGenerator<T>::Initialize(T& unit)
return;

unit.AddUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE);
unit.m_movementInfo.moveFlags = unit.m_movementInfo.moveFlags & ~MOVEFLAG_MASK_MOVING_OR_TURN;
unit.m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN);
unit.m_movementInfo.ctime = 0;

Movement::MoveSplineInit init(unit, "ChargeMovementGenerator<T>::Initialize");
Expand Down
1 change: 1 addition & 0 deletions src/game/Movement/spline/MoveSplineInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ int32 MoveSplineInit::Launch()
if (unit.IsPlayer() || unit.GetPossessorGuid().IsPlayer())
unit.SetSplineDonePending(true);

unit.m_movementInfo.ctime = 0;
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.SetMovementOrigin(movementType);
move_spline.Initialize(args);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@ bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) con
if (spellInfo->Mechanic && GetCreatureInfo()->mechanic_immune_mask & (1 << (spellInfo->Mechanic - 1)))
return true;

if (GetCreatureInfo()->school_immune_mask & (1 << spellInfo->School))
if ((GetCreatureInfo()->school_immune_mask & (1 << spellInfo->School)) && !spellInfo->IsPositiveSpell())
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
DuelComplete(DUEL_FLED);

// reset movement flags at teleport, because player will continue move with these flags after teleport
m_movementInfo.ctime = 0;
m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN);
if (!(options & TELE_TO_NOT_LEAVE_TRANSPORT) || !m_transport)
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
Expand Down Expand Up @@ -2366,7 +2367,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
m_teleportRecover = wps;
wps();
}
m_movementInfo.moveFlags &= ~MOVEFLAG_MASK_MOVING_OR_TURN; // For extrapolation
}
else
{
Expand Down Expand Up @@ -4994,7 +4994,7 @@ void Player::SetFly(bool enable)
pTransport->RemovePassenger(this);
StopMoving(true);
}

m_movementInfo.moveFlags = (MOVEFLAG_LEVITATING | MOVEFLAG_SWIMMING | MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING);
AddUnitState(UNIT_STAT_FLYING_ALLOWED);
}
Expand Down
5 changes: 4 additions & 1 deletion src/game/Objects/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9057,7 +9057,8 @@ void Unit::ModConfuseSpell(bool apply, ObjectGuid casterGuid, uint32 spellId, Mo
else
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);

m_movementInfo.moveFlags &= ~MOVEFLAG_MASK_MOVING_OR_TURN;
m_movementInfo.ctime = 0;
m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN);

if (apply)
{
Expand Down Expand Up @@ -9139,6 +9140,7 @@ void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid, bool success)
{
if (apply)
{
m_movementInfo.ctime = 0;
m_movementInfo.RemoveMovementFlag(MOVEFLAG_MASK_MOVING_OR_TURN);
if (!IsPlayer())
StopMoving();
Expand Down Expand Up @@ -10622,6 +10624,7 @@ void Unit::DisableSpline()
if (Player* me = ToPlayer())
me->SetFallInformation(0, me->GetPositionZ());
m_movementInfo.RemoveMovementFlag(MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD);
m_movementInfo.ctime = 0;
movespline->_Interrupt();
}

Expand Down

0 comments on commit 0faea7f

Please sign in to comment.