示例#1
0
        public static void Start(string[] args)
        {
            var session = GetSession();
            var pChar   = session.Character;

            SQLResult result = DB.Characters.Select("SELECT map, posX, posY, posZ, posO FROM character_creation_data WHERE race = {0} AND class = {1}", pChar.Race, pChar.Class);

            Vector4 vector = new Vector4()
            {
                X = result.Read <float>(0, "PosX"),
                Y = result.Read <float>(0, "PosY"),
                Z = result.Read <float>(0, "PosZ"),
                W = result.Read <float>(0, "PosO")
            };

            uint mapId = result.Read <uint>(0, "Map");

            if (pChar.Map == mapId)
            {
                MoveHandler.HandleMoveTeleport(ref session, vector);
                ObjectMgr.SetPosition(ref pChar, vector);
            }
            else
            {
                MoveHandler.HandleTransferPending(ref session, mapId);
                MoveHandler.HandleNewWorld(ref session, vector, mapId);

                ObjectMgr.SetPosition(ref pChar, vector);
                ObjectMgr.SetMap(ref pChar, mapId);

                ObjectHandler.HandleUpdateObject(ref session);
            }
        }
示例#2
0
        public static void Teleport(string[] args, WorldClass session)
        {
            var     pChar = session.Character;
            Vector4 vector;
            uint    mapId;

            if (args.Length > 2)
            {
                vector = new Vector4()
                {
                    X = CommandParser.Read <float>(args, 1),
                    Y = CommandParser.Read <float>(args, 2),
                    Z = CommandParser.Read <float>(args, 3),
                    O = CommandParser.Read <float>(args, 4)
                };

                mapId = CommandParser.Read <uint>(args, 5);
            }
            else
            {
                string    location = CommandParser.Read <string>(args, 1);
                SQLResult result   = DB.World.Select("SELECT * FROM teleport_locations WHERE location = ?", location);

                if (result.Count == 0)
                {
                    ChatMessageValues chatMessage = new ChatMessageValues(0, "Teleport location '" + location + "' does not exist.");

                    ChatHandler.SendMessage(ref session, chatMessage);
                    return;
                }

                vector = new Vector4()
                {
                    X = result.Read <float>(0, "X"),
                    Y = result.Read <float>(0, "Y"),
                    Z = result.Read <float>(0, "Z"),
                    O = result.Read <float>(0, "O")
                };

                mapId = result.Read <uint>(0, "Map");
            }

            if (pChar.Map == mapId)
            {
                MoveHandler.HandleMoveTeleport(ref session, vector);
                ObjectMgr.SetPosition(ref pChar, vector);
            }
            else
            {
                MoveHandler.HandleTransferPending(ref session, mapId);
                MoveHandler.HandleNewWorld(ref session, vector, mapId);

                ObjectMgr.SetPosition(ref pChar, vector);
                ObjectMgr.SetMap(ref pChar, mapId);

                ObjectHandler.HandleUpdateObjectCreate(ref session);
            }
        }
示例#3
0
        public static void Teleport(string[] args)
        {
            var     session = GetSession();
            var     pChar   = session.Character;
            Vector4 vector;
            uint    mapId;

            if (args.Length > 2)
            {
                vector = new Vector4()
                {
                    X = CommandParser.Read <float>(args, 1),
                    Y = CommandParser.Read <float>(args, 2),
                    Z = CommandParser.Read <float>(args, 3),
                    W = CommandParser.Read <float>(args, 4)
                };

                mapId = CommandParser.Read <uint>(args, 5);
            }
            else
            {
                string    location = CommandParser.Read <string>(args, 1);
                SQLResult result   = DB.World.Select("SELECT * FROM teleport_locations WHERE location = '{0}'", location);

                vector = new Vector4()
                {
                    X = result.Read <float>(0, "X"),
                    Y = result.Read <float>(0, "Y"),
                    Z = result.Read <float>(0, "Z"),
                    W = result.Read <float>(0, "O")
                };

                mapId = result.Read <uint>(0, "Map");
            }

            if (pChar.Map == mapId)
            {
                MoveHandler.HandleMoveTeleport(ref session, vector);
                ObjectMgr.SetPosition(ref pChar, vector);
            }
            else
            {
                MoveHandler.HandleTransferPending(ref session, mapId);
                MoveHandler.HandleNewWorld(ref session, vector, mapId);

                ObjectMgr.SetPosition(ref pChar, vector);
                ObjectMgr.SetMap(ref pChar, mapId);

                ObjectHandler.HandleUpdateObject(ref session);
            }
        }
示例#4
0
        public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
        {
            PacketWriter moveUpdate = new PacketWriter(ServerMessage.MoveUpdate);
            BitPack      BitPack    = new BitPack(moveUpdate, guid);

            BitPack.WriteGuidMask(0);

            BitPack.Write(!movementValues.HasRotation);
            BitPack.Write(!movementValues.HasMovementFlags2);

            BitPack.WriteGuidMask(5);

            if (movementValues.HasMovementFlags2)
            {
                BitPack.Write((uint)movementValues.MovementFlags2, 13);
            }

            BitPack.Write(!movementValues.HasMovementFlags);
            BitPack.Write(0);
            BitPack.Write <uint>(0, 22);
            BitPack.Write(1);
            BitPack.Write(1);
            BitPack.Write(0);
            BitPack.Write(0);

            BitPack.WriteGuidMask(7);

            BitPack.Write(movementValues.IsTransport);
            BitPack.Write(1);

            BitPack.WriteGuidMask(4, 1);

            BitPack.Write(movementValues.IsFallingOrJumping);

            if (movementValues.HasMovementFlags)
            {
                BitPack.Write((uint)movementValues.MovementFlags, 30);
            }

            BitPack.Write(movementValues.Time == 0);

            if (movementValues.IsFallingOrJumping)
            {
                BitPack.Write(movementValues.HasJumpData);
            }

            BitPack.WriteGuidMask(2, 3, 6);

            BitPack.Flush();

            BitPack.WriteGuidBytes(6);

            if (movementValues.Time != 0)
            {
                moveUpdate.WriteUInt32(movementValues.Time);
            }

            if (movementValues.IsFallingOrJumping)
            {
                moveUpdate.WriteFloat(movementValues.JumpVelocity);

                if (movementValues.HasJumpData)
                {
                    moveUpdate.WriteFloat(movementValues.Cos);
                    moveUpdate.WriteFloat(movementValues.CurrentSpeed);
                    moveUpdate.WriteFloat(movementValues.Sin);
                }

                moveUpdate.WriteUInt32(movementValues.FallTime);
            }

            moveUpdate.WriteFloat(vector.X);

            BitPack.WriteGuidBytes(1);

            moveUpdate.WriteFloat(vector.Y);

            BitPack.WriteGuidBytes(2, 7, 5);

            moveUpdate.WriteFloat(vector.Z);

            BitPack.WriteGuidBytes(0, 4, 3);

            if (movementValues.HasRotation)
            {
                moveUpdate.WriteFloat(vector.O);
            }

            var session = WorldMgr.GetSession(guid);

            if (session != null)
            {
                Character pChar = session.Character;

                ObjectMgr.SetPosition(ref pChar, vector, false);
                WorldMgr.SendToInRangeCharacter(pChar, moveUpdate);
            }
        }
示例#5
0
        public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
        {
            PacketWriter moveUpdate = new PacketWriter(ServerMessage.MoveUpdate);
            BitPack      BitPack    = new BitPack(moveUpdate, guid);

            BitPack.WriteGuidMask(2);
            BitPack.Write(0);
            BitPack.WriteGuidMask(1);
            BitPack.Write(!movementValues.HasMovementFlags2);
            BitPack.Write(true);
            BitPack.Write(true);
            BitPack.Write <uint>(0, 22);
            BitPack.WriteGuidMask(3);
            BitPack.Write(!movementValues.IsAlive);
            BitPack.Write(!movementValues.HasMovementFlags);
            BitPack.WriteGuidMask(6);

            if (movementValues.HasMovementFlags2)
            {
                BitPack.Write((uint)movementValues.MovementFlags2, 13);
            }

            BitPack.WriteGuidMask(4, 7);
            BitPack.Write(movementValues.IsInterpolated);
            BitPack.Write(0);

            if (movementValues.HasMovementFlags)
            {
                BitPack.Write((uint)movementValues.MovementFlags, 30);
            }

            BitPack.Write(!movementValues.HasRotation);
            BitPack.Write(movementValues.IsTransport);
            BitPack.WriteGuidMask(5);

            if (movementValues.IsInterpolated)
            {
                BitPack.Write(movementValues.IsInterpolated2);
            }

            BitPack.Write(true);
            BitPack.Write(0);
            BitPack.WriteGuidMask(0);

            BitPack.Flush();

            moveUpdate.WriteFloat(vector.Z);

            BitPack.WriteGuidBytes(3);

            moveUpdate.WriteFloat(vector.X);

            BitPack.WriteGuidBytes(0, 7);

            moveUpdate.WriteFloat(vector.Y);

            BitPack.WriteGuidBytes(5);

            if (movementValues.IsInterpolated)
            {
                moveUpdate.WriteFloat(0);

                if (movementValues.IsInterpolated2)
                {
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                }

                moveUpdate.WriteUInt32(0);
            }

            BitPack.WriteGuidBytes(6, 2);

            if (movementValues.IsAlive)
            {
                moveUpdate.WriteUInt32(movementValues.Time);
            }

            BitPack.WriteGuidBytes(1, 4);

            if (movementValues.HasRotation)
            {
                moveUpdate.WriteFloat(vector.O);
            }

            var session = WorldMgr.GetSession(guid);

            if (session != null)
            {
                Character pChar = session.Character;

                ObjectMgr.SetPosition(ref pChar, vector, false);
                WorldMgr.SendToInRangeCharacter(pChar, moveUpdate);
            }
        }
示例#6
0
        public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
        {
            PacketWriter moveUpdate = new PacketWriter(JAMCMessage.MoveUpdate);
            BitPack      BitPack    = new BitPack(moveUpdate, guid);

            BitPack.WriteGuidMask(0);
            BitPack.Write(!movementValues.HasMovementFlags);
            BitPack.Write(!movementValues.HasRotation);
            BitPack.WriteGuidMask(2, 6);
            BitPack.Write(!movementValues.HasMovementFlags2);
            BitPack.WriteGuidMask(7);
            BitPack.Write <uint>(0, 24);
            BitPack.WriteGuidMask(1);

            if (movementValues.HasMovementFlags)
            {
                BitPack.Write((uint)movementValues.MovementFlags, 30);
            }

            BitPack.WriteGuidMask(4);
            BitPack.Write(!movementValues.IsAlive);
            BitPack.Write(0);

            if (movementValues.HasMovementFlags2)
            {
                BitPack.Write((uint)movementValues.MovementFlags2, 13);
            }

            BitPack.Write(0);
            BitPack.WriteGuidMask(5);
            BitPack.Write(true);
            BitPack.Write(0);
            BitPack.Write(movementValues.IsInterpolated);
            BitPack.Write(0);
            BitPack.Write(true);
            BitPack.WriteGuidMask(3);
            BitPack.Write(true);

            if (movementValues.IsInterpolated)
            {
                BitPack.Write(movementValues.IsInterpolated2);
            }

            BitPack.Flush();

            if (movementValues.IsInterpolated)
            {
                moveUpdate.WriteUInt32(0);

                if (movementValues.IsInterpolated2)
                {
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                }

                moveUpdate.WriteFloat(0);
            }

            if (movementValues.IsAlive)
            {
                moveUpdate.WriteUInt32(movementValues.Time);
            }

            BitPack.WriteGuidBytes(5, 7);

            moveUpdate.WriteFloat(vector.Z);

            BitPack.WriteGuidBytes(4, 3, 2, 6, 0);

            moveUpdate.WriteFloat(vector.X);

            if (movementValues.HasRotation)
            {
                moveUpdate.WriteFloat(vector.W);
            }

            moveUpdate.WriteFloat(vector.Y);

            Character pChar = WorldMgr.GetSession(guid).Character;

            ObjectMgr.SetPosition(ref pChar, vector, false);

            WorldMgr.SendToAllInZone(guid, moveUpdate);
        }