This commit is contained in:
tomrus88 2008-11-16 21:15:37 +03:00
parent e69e5d8336
commit dcb39d1512
9 changed files with 94 additions and 164 deletions

View file

@ -1567,26 +1567,6 @@ void WorldSession::HandleDungeonDifficultyOpcode( WorldPacket & recv_data )
}
}
void WorldSession::HandleNewUnknownOpcode( WorldPacket & recv_data )
{
sLog.outDebug("New Unknown Opcode %u", recv_data.GetOpcode());
recv_data.hexlike();
/*
New Unknown Opcode 837
STORAGE_SIZE: 60
02 00 00 00 00 00 00 00 | 00 00 00 00 01 20 00 00
89 EB 33 01 71 5C 24 C4 | 15 03 35 45 74 47 8B 42
BA B8 1B 40 00 00 00 00 | 00 00 00 00 77 66 42 BF
23 91 26 3F 00 00 60 41 | 00 00 00 00
New Unknown Opcode 837
STORAGE_SIZE: 44
02 00 00 00 00 00 00 00 | 00 00 00 00 00 00 80 00
7B 80 34 01 84 EA 2B C4 | 5F A1 36 45 C9 39 1C 42
BA B8 1B 40 CE 06 00 00 | 00 00 80 3F
*/
}
void WorldSession::HandleDismountOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA");

View file

@ -170,70 +170,22 @@ void WorldSession::HandleMoveWorldportAckOpcode()
void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
{
sLog.outDebug("WORLD: Recvd %s (%u,0x%X) opcode", LookupOpcodeName(recv_data.GetOpcode()), recv_data.GetOpcode(), recv_data.GetOpcode());
CHECK_PACKET_SIZE(recv_data, 4+2+4+4+4+4+4);
uint32 opcode = recv_data.GetOpcode();
sLog.outDebug("WORLD: Recvd %s (%u,0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
if(GetPlayer()->GetDontMove())
return;
/* extract packet */
if(opcode == CMSG_MOVE_NOT_ACTIVE_MOVER)
{
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8);
uint64 old_mover_guid;
recv_data >> old_mover_guid;
}
MovementInfo movementInfo;
uint32 MovementFlags;
recv_data >> MovementFlags;
recv_data >> movementInfo.unk1;
recv_data >> movementInfo.time;
recv_data >> movementInfo.x;
recv_data >> movementInfo.y;
recv_data >> movementInfo.z;
recv_data >> movementInfo.o;
if(MovementFlags & MOVEMENTFLAG_ONTRANSPORT)
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8+4+4+4+4+4+1);
recv_data >> movementInfo.t_guid;
recv_data >> movementInfo.t_x;
recv_data >> movementInfo.t_y;
recv_data >> movementInfo.t_z;
recv_data >> movementInfo.t_o;
recv_data >> movementInfo.t_time;
recv_data >> movementInfo.t_seat;
}
if((MovementFlags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (movementInfo.unk1 & 0x20))
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> movementInfo.s_pitch; // pitch, -1.55=looking down, 0=looking straight forward, +1.55=looking up
}
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> movementInfo.fallTime; // duration of last jump (when in jump duration from jump begin to now)
if(MovementFlags & MOVEMENTFLAG_JUMPING)
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4+4+4+4);
recv_data >> movementInfo.j_unk; // constant, but different when jumping in water and on land?
recv_data >> movementInfo.j_sinAngle; // sin of angle between orientation0 and players orientation
recv_data >> movementInfo.j_cosAngle; // cos of angle between orientation0 and players orientation
recv_data >> movementInfo.j_xyspeed; // speed of xy movement
}
if(MovementFlags & MOVEMENTFLAG_SPLINE)
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> movementInfo.u_unk1; // unknown
}
ReadMovementInfo(recv_data, &movementInfo);
/*----------------*/
if(recv_data.size() != recv_data.rpos())
@ -247,7 +199,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
return;
/* handle special cases */
if (MovementFlags & MOVEMENTFLAG_ONTRANSPORT)
if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
{
// transports size limited
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
@ -288,7 +240,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
if (recv_data.GetOpcode() == MSG_MOVE_FALL_LAND && !GetPlayer()->isInFlight())
if (opcode == MSG_MOVE_FALL_LAND && !GetPlayer()->isInFlight())
{
// calculate total z distance of the fall
// it is currently only used for the achievement system. It might be used in a more correct falldamage formula later
@ -337,14 +289,14 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
}
if(recv_data.GetOpcode() == CMSG_DISMISS_CONTROLLED_VEHICLE)
if(opcode == CMSG_DISMISS_CONTROLLED_VEHICLE)
{
// using charm guid, because we don't have vehicle guid...
if(Vehicle *vehicle = ObjectAccessor::GetVehicle(_player->GetCharmGUID()))
_player->ExitVehicle(vehicle);
}
if(((MovementFlags & MOVEMENTFLAG_SWIMMING) != 0) != GetPlayer()->IsInWater())
if(((movementInfo.flags & MOVEMENTFLAG_SWIMMING) != 0) != GetPlayer()->IsInWater())
{
// now client not include swimming flag in case jumping under water
GetPlayer()->SetInWater( !GetPlayer()->IsInWater() || GetPlayer()->GetBaseMap()->IsUnderWater(movementInfo.x, movementInfo.y, movementInfo.z) );
@ -364,7 +316,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
{
_player->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
_player->m_movementInfo = movementInfo;
_player->SetUnitMovementFlags(MovementFlags);
_player->SetUnitMovementFlags(movementInfo.flags);
}
else
{
@ -372,13 +324,13 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
{
if(Map *map = mover->GetMap())
map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
mover->SetUnitMovementFlags(MovementFlags);
mover->SetUnitMovementFlags(movementInfo.flags);
}
else // player
{
((Player*)mover)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
((Player*)mover)->m_movementInfo = movementInfo;
((Player*)mover)->SetUnitMovementFlags(MovementFlags);
((Player*)mover)->SetUnitMovementFlags(movementInfo.flags);
}
}
@ -411,21 +363,11 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
{
sLog.outDebug("WORLD: Recvd %s (%u,0x%X) opcode", LookupOpcodeName(recv_data.GetOpcode()), recv_data.GetOpcode(), recv_data.GetOpcode());
CHECK_PACKET_SIZE(recv_data, 8+4+4+2+4+4+4+4+4);
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8+4);
/* extract packet */
uint64 guid;
uint16 unkB;
uint32 unk1, flags, time, fallTime;
float x, y, z, orientation;
uint64 t_GUID;
float t_x, t_y, t_z, t_o;
uint32 t_time;
uint8 t_unk;
float s_pitch;
float j_unk1, j_sinAngle, j_cosAngle, j_xyspeed;
float u_unk1;
uint32 unk1;
float newspeed;
recv_data >> guid;
@ -436,47 +378,10 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
// continue parse packet
recv_data >> unk1;
recv_data >> flags >> unkB >> time;
recv_data >> x >> y >> z >> orientation;
if (flags & MOVEMENTFLAG_ONTRANSPORT)
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+8+4+4+4+4+4+1);
recv_data >> unk1; // counter
recv_data >> t_GUID;
recv_data >> t_x >> t_y >> t_z >> t_o >> t_time >> t_unk;
}
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (unkB & 0x20))
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> s_pitch; // pitch, -1.55=looking down, 0=looking straight forward, +1.55=looking up
}
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> fallTime; // duration of last jump (when in jump duration from jump begin to now)
if ((flags & MOVEMENTFLAG_JUMPING) || (flags & MOVEMENTFLAG_FALLING))
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4+4+4+4);
recv_data >> j_unk1; // ?constant, but different when jumping in water and on land?
recv_data >> j_sinAngle >> j_cosAngle; // sin + cos of angle between orientation0 and players orientation
recv_data >> j_xyspeed; // speed of xy movement
}
if(flags & MOVEMENTFLAG_SPLINE)
{
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);
recv_data >> u_unk1; // unknown
}
MovementInfo movementInfo;
ReadMovementInfo(recv_data, &movementInfo);
// recheck
CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4);

View file

@ -1207,7 +1207,7 @@ enum Opcodes
SMSG_SERVER_FIRST_ACHIEVEMENT = 0x498,
SMSG_PET_LEARNED_SPELL = 0x499, // uint16 spellid, Your pet learned spell: %s
SMSG_PET_UNLEARNED_SPELL = 0x49A, // uint16 spellid, Your pet unlearned %s
UMSG_UNKNOWN_1179 = 0x49B, // not found in client
CMSG_UNKNOWN_1179 = 0x49B, // movement opcode
CMSG_UNKNOWN_1180 = 0x49C, // LUA: HearthAndResurrectFromArea
SMSG_UNKNOWN_1181 = 0x49D, // empty
SMSG_CRITERIA_REMOVE = 0x49E, // uint32, broadcasts EVENT_CRITERIA_UPDATE

View file

@ -17537,6 +17537,10 @@ void Player::SendInitialPacketsBeforeAddToMap()
void Player::SendInitialPacketsAfterAddToMap()
{
WorldPacket data(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement
data << uint32(0x00000000); // on blizz it increments periodically
GetSession()->SendPacket(&data);
CastSpell(this, 836, true); // LOGINEFFECT
// set some aura effects that send packet to player client after add player to map

View file

@ -729,7 +729,7 @@ enum InstanceResetWarningType
struct MovementInfo
{
// common
//uint32 flags;
uint32 flags;
uint16 unk1;
uint32 time;
float x, y, z, o;
@ -749,17 +749,17 @@ struct MovementInfo
MovementInfo()
{
//flags =
flags = 0;
time = t_time = fallTime = 0;
unk1 = 0;
x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_unk = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f;
t_guid = 0;
}
/*void SetMovementFlags(uint32 _flags)
void SetMovementFlags(uint32 _flags)
{
flags = _flags;
}*/
}
};
// flags that use in movement check for example at spell casting

View file

@ -3006,6 +3006,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
{
pet->AttackStop();
pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
pet->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
}
}

View file

@ -42,8 +42,7 @@ alter table creature_movement add `wpguid` int(11) default '0';
#include <cassert>
//-----------------------------------------------//
void
WaypointMovementGenerator<Creature>::LoadPath(Creature &c)
void WaypointMovementGenerator<Creature>::LoadPath(Creature &c)
{
sLog.outDetail("LoadPath: loading waypoint path for creature %d,%d", c.GetGUIDLow(), c.GetDBTableGUIDLow());
@ -59,26 +58,23 @@ WaypointMovementGenerator<Creature>::LoadPath(Creature &c)
for(uint32 i = 0; i < node_count-1; i++)
i_hasDone[i] = false;
// to prevent a misbehaviour inside "update"
// to prevent a misbehavior inside "update"
// update is always called with the next wp - but the wpSys needs the current
// so when the routine is called the first time, wpSys gets the last waypoint
// and this prevents the system from performing text/emote, etc
i_hasDone[node_count - 1] = true;
}
void
WaypointMovementGenerator<Creature>::ClearWaypoints()
void WaypointMovementGenerator<Creature>::ClearWaypoints()
{
i_path = NULL;
}
void
WaypointMovementGenerator<Creature>::Initialize()
void WaypointMovementGenerator<Creature>::Initialize()
{
}
bool
WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{
if(!&creature)
return true;
@ -103,7 +99,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &di
i_nextMoveTime.Update(diff);
i_destinationHolder.UpdateTraveller(traveller, diff, false, true);
// creature has been stoped in middle of the waypoint segment
// creature has been stopped in middle of the waypoint segment
if (!i_destinationHolder.HasArrived() && creature.IsStopped())
{
if( i_nextMoveTime.Passed()) // Timer has elapsed, meaning this part controlled it
@ -213,14 +209,12 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature &unit)
}
//----------------------------------------------------//
void
FlightPathMovementGenerator::LoadPath(Player &)
void FlightPathMovementGenerator::LoadPath(Player &)
{
objmgr.GetTaxiPathNodes(i_pathId, i_path,i_mapIds);
}
uint32
FlightPathMovementGenerator::GetPathAtMapEnd() const
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
{
if(i_currentNode >= i_mapIds.size())
return i_mapIds.size();
@ -235,8 +229,7 @@ FlightPathMovementGenerator::GetPathAtMapEnd() const
return i_mapIds.size();
}
void
FlightPathMovementGenerator::Initialize(Player &player)
void FlightPathMovementGenerator::Initialize(Player &player)
{
player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
@ -251,7 +244,6 @@ FlightPathMovementGenerator::Initialize(Player &player)
void FlightPathMovementGenerator::Finalize(Player & player)
{
float x, y, z;
i_destinationHolder.GetLocationNow(player.GetMapId(), x, y, z);
player.SetPosition(x, y, z, player.GetOrientation());
@ -271,8 +263,7 @@ void FlightPathMovementGenerator::Finalize(Player & player)
}
}
bool
FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
{
if( MovementInProgress() )
{
@ -307,8 +298,7 @@ FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
return false;
}
void
FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
{
if(i_mapIds.empty())
return;

View file

@ -547,3 +547,51 @@ void WorldSession::SetAccountData(uint32 type, time_t time_, std::string data)
CharacterDatabase.escape_string(data);
CharacterDatabase.PExecute("INSERT INTO account_data VALUES ('%u','%u','%u','%s')", acc, type, (uint32)time_, data.c_str());
}
void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi)
{
CHECK_PACKET_SIZE(data, data.rpos()+4+2+4+4+4+4+4);
data >> mi->flags;
data >> mi->unk1;
data >> mi->time;
data >> mi->x;
data >> mi->y;
data >> mi->z;
data >> mi->o;
if(mi->flags & MOVEMENTFLAG_ONTRANSPORT)
{
CHECK_PACKET_SIZE(data, data.rpos()+8+4+4+4+4+4+1);
data >> mi->t_guid;
data >> mi->t_x;
data >> mi->t_y;
data >> mi->t_z;
data >> mi->t_o;
data >> mi->t_time;
data >> mi->t_seat;
}
if((mi->flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING2)) || (mi->unk1 & 0x20))
{
CHECK_PACKET_SIZE(data, data.rpos()+4);
data >> mi->s_pitch;
}
CHECK_PACKET_SIZE(data, data.rpos()+4);
data >> mi->fallTime;
if(mi->flags & MOVEMENTFLAG_JUMPING)
{
CHECK_PACKET_SIZE(data, data.rpos()+4+4+4+4);
data >> mi->j_unk;
data >> mi->j_sinAngle;
data >> mi->j_cosAngle;
data >> mi->j_xyspeed;
}
if(mi->flags & MOVEMENTFLAG_SPLINE)
{
CHECK_PACKET_SIZE(data, data.rpos()+4);
data >> mi->u_unk1;
}
}

View file

@ -29,6 +29,7 @@ class MailItemsInfo;
struct ItemPrototype;
struct AuctionEntry;
struct DeclinedName;
struct MovementInfo;
class Creature;
class Item;
@ -88,6 +89,8 @@ class MANGOS_DLL_SPEC WorldSession
void SizeError(WorldPacket const& packet, uint32 size) const;
void ReadMovementInfo(WorldPacket &data, MovementInfo *mi);
void SendPacket(WorldPacket const* packet);
void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
void SendNotification(int32 string_id,...);
@ -587,7 +590,6 @@ class MANGOS_DLL_SPEC WorldSession
void HandleLfmSetNoneOpcode(WorldPacket& recv_data);
void HandleLfmSetOpcode(WorldPacket& recv_data);
void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
void HandleNewUnknownOpcode(WorldPacket& recv_data);
void HandleChooseTitleOpcode(WorldPacket& recv_data);
void HandleRealmStateRequestOpcode(WorldPacket& recv_data);
void HandleAllowMoveAckOpcode(WorldPacket& recv_data);