Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/PacketIO: Update SMSG_MOVE_UPDATE_KNOCK_BACK and fix SMSG_MOVE…
Browse files Browse the repository at this point in the history
…_KNOCK_BACK.

Fixes spells with SPELL_EFFECT_LEAP_BACK

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed Mar 7, 2019
1 parent e63da4a commit f054098
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 92 deletions.
2 changes: 2 additions & 0 deletions sql/updates/world/2019_03_07_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DELETE FROM spell_script_names WHERE ScriptName='spell_hun_disengage';
DELETE FROM spell_script_names WHERE spell_id=781;
9 changes: 6 additions & 3 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15224,11 +15224,11 @@ void Unit::SendMoveKnockBack(Player* player, float speedXY, float speedZ, float
ObjectGuid guid = GetGUID();
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (1 + 8 + 4 + 4 + 4 + 4 + 4));

data << float(vsin);
data << float(vcos);
data << float(speedXY);
data << uint32(0);
data << float(vsin);
data << float(speedZ);
data << uint32(0);
data << float(vcos);

data.WriteBit(guid [2]);
data.WriteBit(guid [0]);
Expand Down Expand Up @@ -16300,6 +16300,9 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
data << uint32(0);
*/
break;
case MSEFlushBits:
data.FlushBits();
break;
default:
ASSERT(Movement::PrintInvalidSequenceElement(element, __FUNCTION__));
break;
Expand Down
130 changes: 74 additions & 56 deletions src/server/game/Movement/MovementStructures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4157,60 +4157,78 @@ MovementStatusElements const MovementWaterWalkAck[] =

MovementStatusElements const MovementUpdateKnockBack[] =
{
MSEZeroBit,
MSEHasGuidByte4,
MSEHasMovementFlags,
MSEHasGuidByte1,
MSEHasGuidByte0,
MSEHasGuidByte3,
MSEHasGuidByte2,
MSEHasGuidByte7,
MSEHasTransportGuidByte7,
MSEHasTransportGuidByte5,
MSEHasTransportGuidByte1,
MSEHasTransportGuidByte6,
MSEHasTransportGuidByte2,
MSEHasTransportGuidByte4,
MSEHasTransportGuidByte0,
MSEHasTransportGuidByte3,
MSEHasGuidByte5,
MSEHasGuidByte6,
MSEMovementFlags,
MSEHasFallDirection,
MSEHasOrientation,
MSEOrientation,
MSEFallSinAngle,
MSEFallHorizontalSpeed,
MSEFallCosAngle,
MSEFallTime,
MSEFallVerticalSpeed,
MSEGuidByte3,
MSETransportGuidByte5,
MSETransportGuidByte7,
MSETransportSeat,
MSETransportGuidByte3,
MSETransportGuidByte6,
MSETransportPositionZ,
MSETransportGuidByte1,
MSETransportPositionY,
MSETransportPositionX,
MSETransportGuidByte2,
MSETransportGuidByte0,
MSETransportOrientation,
MSETransportTime,
MSETransportGuidByte4,
MSEPitch,
MSEPositionZ,
MSETimestamp,
MSEPositionX,
MSEGuidByte4,
MSEGuidByte6,
MSEGuidByte7,
MSEGuidByte2,
MSEGuidByte1,
MSEPositionY,
MSEGuidByte0,
MSEGuidByte5,
MSEHasGuidByte5, // 21
MSEHasSplineElevation, // 36
MSEHasTimestamp, // 8
MSEForcesCount, // 38
MSEHasMovementFlags2, // 7
MSEHasGuidByte2, // 18
MSEHasGuidByte4, // 20
MSEHasGuidByte6, // 22
MSEHasGuidByte1, // 17
MSEHasGuidByte0, // 16
MSEZeroBit, // 149
MSEHasOrientation, // 12
MSEHasSpline, // 148
MSEHasTransportData, // 104
MSEHasTransportGuidByte5, // 104 (61)
MSEHasTransportGuidByte2, // 104 (58)
MSEHasTransportGuidByte0, // 104 (56)
MSEHasTransportGuidByte7, // 104 (63)
MSEHasTransportGuidByte1, // 104 (57)
MSEHasTransportGuidByte6, // 104 (62)
MSEHasTransportGuidByte4, // 104 (60)
MSEHasTransportTime2, // 104 (92)
MSEHasTransportGuidByte3, // 104 (59)
MSEHasTransportTime3, // 104 (100)
MSEHasGuidByte3, // 19
MSEHasFallData, // 140
MSEHasCounter, // 42
MSEHasFallDirection, // 140 (136)
MSEHasGuidByte7, // 23
MSEZeroBit, // 172
MSEHasPitch, // 28
MSEHasMovementFlags2, // 7
MSEHasMovementFlags, // 6
MSEFlushBits,
MSEGuidByte1, // 17
MSETransportGuidByte5, // 104 (61)
MSETransportTime3, // 104 100 (24)
MSETransportGuidByte3, // 104 (59)
MSETransportGuidByte1, // 104 (57)
MSETransportGuidByte4, // 104 (60)
MSETransportPositionZ, // 104 (18)
MSETransportGuidByte7, // 104 (63)
MSETransportGuidByte6, // 104 (62)
MSETransportGuidByte2, // 104 (58)
MSETransportPositionY, // 104 (17)
MSETransportGuidByte0, // 104 (56)
MSETransportSeat, // 104 (80)
MSETransportOrientation, // 104 (19)
MSETransportPositionX, // 104 (16)
MSETransportTime2, // 104 92 (22)
MSETransportTime, // 104 (21)
MSEGuidByte2, // 18
MSESplineElevation, // 36
MSEFallSinAngle, // 140 136 (32)
MSEFallHorizontalSpeed, // 140 136 (33)
MSEFallCosAngle, // 140 136 (31)
MSEFallVerticalSpeed, // 140 (30)
MSEFallTime, // 140 (29)
MSEPositionY, // 10
MSEHasOrientation, // 12
MSEForces, // 39
MSEGuidByte7, // 23
MSEGuidByte6, // 22
MSEGuidByte4, // 20
MSEPositionZ, // 11
MSECounter, // 42
MSEGuidByte3, // 19
MSEGuidByte0, // 16
MSEPositionX, // 9
MSEPitch, // 28
MSEGuidByte5, // 21
MSETimestamp, // 8
MSEEnd,
};

Expand Down Expand Up @@ -5615,8 +5633,8 @@ MovementStatusElements const* GetMovementStatusElementsSequence(Opcodes opcode)
return MovementUpdateFlightSpeed;
case SMSG_MOVE_UPDATE_RUN_SPEED:
return MovementUpdateRunSpeed;
//case SMSG_MOVE_UPDATE_KNOCK_BACK:
// return MovementUpdateKnockBack;
case SMSG_MOVE_UPDATE_KNOCK_BACK:
return MovementUpdateKnockBack;
//case SMSG_MOVE_UPDATE_RUN_BACK_SPEED:
// return MovementUpdateRunBackSpeed;
//case SMSG_MOVE_UPDATE_SWIM_SPEED:
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Movement/MovementStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ enum MovementStatusElements
MSEUintCount,

MSEAckCount,
MSEFlushBits,

// Special
MSEZeroBit, // writes bit value 1 or skips read bit
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Server/Protocol/Opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ void OpcodeTable::InitializeServerTable()
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UNSET_CAN_FLY, 0x0162, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UNSET_HOVER, 0x02D3, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_FLIGHT_SPEED, 0x00E1, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_KNOCK_BACK, 0x0251, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_RUN_SPEED, 0x158E, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_MOVE_WATER_WALK, 0x1F9A, STATUS_NEVER ); // 5.4.8 18414
DEFINE_OPCODE_HANDLER(SMSG_QUERY_PLAYER_NAME_RESPONSE, 0x169B, STATUS_NEVER ); // 5.4.8 18414
Expand Down Expand Up @@ -1287,7 +1288,6 @@ void OpcodeTable::InitializeServerTable()
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY, 0x0868, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_COLLISION_HEIGHT, 0x1812, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_FLIGHT_BACK_SPEED, 0x036A, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_KNOCK_BACK, 0x0251, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_PITCH_RATE, 0x09E2, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_RUN_BACK_SPEED, 0x08A3, STATUS_UNHANDLED);
DEFINE_OPCODE_HANDLER(SMSG_OPEN_CONTAINER, 0x14BB, STATUS_UNHANDLED);
Expand Down
32 changes: 0 additions & 32 deletions src/server/scripts/Spells/spell_hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,37 +197,6 @@ class spell_hun_cobra_shot : public SpellScriptLoader
}
};

// 781 - Disengage
class spell_hun_disengage : public SpellScriptLoader
{
public:
spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { }

class spell_hun_disengage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_disengage_SpellScript);

SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->IsInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;

return SPELL_CAST_OK;
}

void Register() OVERRIDE
{
OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast);
}
};

SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_hun_disengage_SpellScript();
}
};

// 82926 - Fire!
class spell_hun_fire : public SpellScriptLoader
{
Expand Down Expand Up @@ -1082,7 +1051,6 @@ void AddSC_hunter_spell_scripts()
new spell_hun_a_murder_of_crows();
new spell_hun_chimera_shot();
new spell_hun_cobra_shot();
new spell_hun_disengage();
new spell_hun_fire();
new spell_hun_improved_mend_pet();
new spell_hun_improved_serpent_sting();
Expand Down

0 comments on commit f054098

Please sign in to comment.