Core/Movement: Fixed knockback visibility for other players (no more "teleport") and knockback strength from creature spells (this does not fix knocking creatures back)

This commit is contained in:
Shauren
2011-09-30 18:24:12 +02:00
parent 18aad847e1
commit da54fb92d5
4 changed files with 20 additions and 8 deletions

View File

@@ -1488,7 +1488,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
float dx = GetPositionX() - x;
float dy = GetPositionY() - y;
if (dx < 0.001f && dy < 0.001f)
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
{
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
vcos = cos(angle);

View File

@@ -16510,7 +16510,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
data.append(GetPackGUID());
data << uint32(0); // Sequence
data << uint32(0); // counter
data << float(vcos); // x direction
data << float(vsin); // y direction
data << float(speedXY); // Horizontal speed

View File

@@ -523,13 +523,29 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
uint64 guid; // guid - unused
uint64 guid;
recv_data.readPackGUID(guid);
if (_player->m_mover->GetGUID() != guid)
return;
recv_data.read_skip<uint32>(); // unk
MovementInfo movementInfo;
ReadMovementInfo(recv_data, &movementInfo);
_player->m_movementInfo = movementInfo;
WorldPacket data(MSG_MOVE_KNOCK_BACK, 66);
data.appendPackGUID(guid);
_player->BuildMovementPacket(&data);
// knockback specific info
data << movementInfo.j_sinAngle;
data << movementInfo.j_cosAngle;
data << movementInfo.j_xyspeed;
data << movementInfo.j_zspeed;
_player->SendMessageToSet(&data, false);
}
void WorldSession::HandleMoveHoverAck(WorldPacket& recv_data)

View File

@@ -6241,11 +6241,7 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
if (unitTarget->IsNonMeleeSpellCasted(true))
unitTarget->InterruptNonMeleeSpells(true);
float ratio = m_caster->GetCombatReach() / std::max(unitTarget->GetCombatReach(), 1.0f);
if (ratio < 1.0f)
ratio = ratio * ratio * ratio * 0.1f; // volume = length^3
else
ratio = 0.1f; // dbc value ratio
float ratio = 0.1f;
float speedxy = float(m_spellInfo->Effects[effIndex].MiscValue) * ratio;
float speedz = float(damage) * ratio;
if (speedxy < 0.1f && speedz < 0.1f)