Esempio n. 1
0
        public PSMovement(WorldOpcodes worldOpcode, WorldSession session, PCMoveInfo moveinfo)
            : base(worldOpcode)
        {
            var correctedMoveTime = (uint)Environment.TickCount;

            byte[] packedGUID = session.Player.ObjectGUID.GetGuidBytes();
            this.WriteBytes(packedGUID);
            this.WriteBytes((moveinfo.BaseStream as MemoryStream).ToArray());

            // We then overwrite the original moveTime (sent from the client) with ours
            (this.BaseStream as MemoryStream).Position = 4 + packedGUID.Length;
            this.WriteBytes(BitConverter.GetBytes(correctedMoveTime));
        }
 private void UpdateEntity(WorldSession session, PCMoveInfo handler)
 {
     session.Player.Location.X = handler.X;
     session.Player.Location.Y = handler.Y;
     session.Player.Location.Z = handler.Z;
 }
 private void TransmitMovement(WorldSession session, PCMoveInfo handler, WorldOpcodes code)
 {
     UpdateEntity(session, handler);
     //ToList because collection can be modified while iterating.
     session.Player.SubscribedBy.ToList().ForEach(s => s.SendPacket(new PSMovement(code, session, handler)));
 }