Пример #1
0
        public void HandleTextEmote(ref IPacketReader packet, ref IWorldManager manager)
        {
            uint      emote     = packet.ReadUInt32();
            uint      emotenum  = packet.ReadUInt32();
            ulong     guid      = packet.ReadUInt64();
            uint      emoteId   = Emotes.Get((TextEmotes)emote);
            Character character = (Character)manager.Account.ActiveCharacter;

            PacketWriter pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TEXT_EMOTE], "SMSG_TEXT_EMOTE");

            pw.Write(character.Guid);
            pw.Write(emote);
            pw.Write(emotenum);
            pw.WriteUInt32(0);
            pw.WriteUInt8(0);
            manager.Send(pw);

            switch ((TextEmotes)emote)
            {
            case TextEmotes.EMOTE_SIT:
                character.StandState = StandState.SITTING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_STAND:
                character.StandState = StandState.STANDING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_SLEEP:
                character.StandState = StandState.SLEEPING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_KNEEL:
                character.StandState = StandState.KNEEL;
                manager.Send(character.BuildUpdate());
                return;
            }

            if (emoteId > 0)
            {
                pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_EMOTE], "SMSG_EMOTE");
                pw.WriteUInt32(emoteId);
                pw.WriteUInt64(character.Guid);
                manager.Send(pw);
            }
        }
Пример #2
0
        public void HandlePing(ref IPacketReader packet, ref IWorldManager manager)
        {
            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_PONG], "SMSG_PONG");

            writer.WriteUInt32(packet.ReadUInt32());
            manager.Send(writer);
        }
Пример #3
0
        public void HandleWorldTeleport(ref IPacketReader packet, ref IWorldManager manager)
        {
            packet.ReadUInt32();
            byte zone = packet.ReadUInt8();

            var character = manager.Account.ActiveCharacter;

            character.Location.Update(packet, true);
            character.Teleport(character.Location, ref manager);
        }
Пример #4
0
        public void HandleMovementStatus(ref IPacketReader packet, ref IWorldManager manager)
        {
            if (manager.Account.ActiveCharacter.IsTeleporting)
            {
                return;
            }

            uint Flags = packet.ReadUInt32();

            manager.Account.ActiveCharacter.Location.Update(packet, true);
        }
Пример #5
0
        public void HandleAreaTrigger(ref IPacketReader packet, ref IWorldManager manager)
        {
            uint id = packet.ReadUInt32();

            if (AreaTriggers.Triggers.ContainsKey(id))
            {
                var loc = AreaTriggers.Triggers[id];
                manager.Account.ActiveCharacter.Teleport(loc, ref manager);
            }
            else
            {
                Log.Message(LogType.ERROR, "AreaTrigger for {0} missing.", id);
            }
        }
Пример #6
0
        public void HandleMessageChat(ref IPacketReader packet, ref IWorldManager manager)
        {
            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT");

            writer.WriteUInt8((byte)packet.ReadInt32()); //System Message
            packet.ReadUInt32();
            writer.WriteUInt32(0);                       //Language: General
            writer.WriteUInt64(manager.Account.ActiveCharacter.Guid);

            string message = packet.ReadString();

            writer.WriteString(message);
            writer.WriteUInt8(0);

            if (!CommandManager.InvokeHandler(message, manager))
            {
                manager.Send(writer);
            }
        }
Пример #7
0
        public void HandleAreaTrigger(ref IPacketReader packet, ref IWorldManager manager)
        {
            uint id = packet.ReadUInt32();

            if (AreaTriggers.Triggers.ContainsKey(id))
            {
                // HACK - Scarlet Monastery
                Location loc = AreaTriggers.Triggers[id];
                if (id == 45)
                {
                    loc = new Location(77f, -1f, 20f, 0, 44);
                }

                manager.Account.ActiveCharacter.Teleport(loc, ref manager);
            }
            else
            {
                Log.Message(LogType.ERROR, "AreaTrigger for {0} missing.", id);
            }
        }
Пример #8
0
        public void HandleAreaTrigger(ref IPacketReader packet, ref IWorldManager manager)
        {
            uint id = packet.ReadUInt32();

            if (AreaTriggers.Triggers.ContainsKey(id))
            {
                var loc = AreaTriggers.Triggers[id];

                // Hacky override
                switch (id)
                {
                case 45:     // Scarlet Monestary
                    loc = new Common.Structs.Location(77f, -1f, 20f, 0, 44);
                    break;
                }

                manager.Account.ActiveCharacter.Teleport(loc, ref manager);
            }
            else
            {
                Log.Message(LogType.ERROR, "AreaTrigger for {0} missing.", id);
            }
        }
Пример #9
0
        public void HandleWorldTeleport(ref IPacketReader packet, ref IWorldManager manager)
        {
            packet.ReadUInt32();
            byte  zone = packet.ReadUInt8();
            float x    = packet.ReadFloat();
            float y    = packet.ReadFloat();
            float z    = packet.ReadFloat();
            float o    = packet.ReadFloat();

            PacketWriter movementStatus = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MOVE_WORLDPORT_ACK], "SMSG_MOVE_WORLDPORT_ACK");

            movementStatus.WriteUInt64(0);
            movementStatus.WriteFloat(0);
            movementStatus.WriteFloat(0);
            movementStatus.WriteFloat(0);
            movementStatus.WriteFloat(0);
            movementStatus.WriteFloat(x);
            movementStatus.WriteFloat(y);
            movementStatus.WriteFloat(z);
            movementStatus.WriteFloat(o);
            movementStatus.WriteFloat(0);
            movementStatus.WriteUInt32(0);
            manager.Send(movementStatus);
        }
Пример #10
0
        public void HandleMessageChat(ref IPacketReader packet, ref IWorldManager manager)
        {
            var character = manager.Account.ActiveCharacter;

            var bitunpack = new BitUnpacker(packet);
            var language  = packet.ReadUInt32();
            var message   = packet.ReadString(bitunpack.GetBits <int>(9));

            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_MESSAGECHAT], "SMSG_MESSAGECHAT");

            writer.WriteUInt8(1);  // System Message
            writer.WriteUInt32(0); // Language: General
            writer.WriteUInt64(character.Guid);
            writer.WriteUInt32(0);
            writer.WriteUInt64(0);
            writer.WriteInt32(message.Length + 1);
            writer.WriteString(message);
            writer.WriteUInt8(0);

            if (!CommandManager.InvokeHandler(message, manager))
            {
                manager.Send(writer);
            }
        }
Пример #11
0
 public void HandleZoneUpdate(ref IPacketReader packet, ref IWorldManager manager)
 {
     manager.Account.ActiveCharacter.Zone = packet.ReadUInt32();
 }
Пример #12
0
 public void HandleStandState(ref IPacketReader packet, ref IWorldManager manager)
 {
     manager.Account.ActiveCharacter.StandState = (StandState)packet.ReadUInt32();
     manager.Send(manager.Account.ActiveCharacter.BuildUpdate());
 }
Пример #13
0
        public void HandleTextEmote(ref IPacketReader packet, ref IWorldManager manager)
        {
            // I don't like to do this but since its the only packet change
            // it's really not worth creating a whole new plugin for it
            bool build_4211 = packet.Size == 22;

            uint emote = packet.ReadUInt32(), emotenum = 0;

            if (build_4211)
            {
                emotenum = packet.ReadUInt32();
            }

            ulong     guid      = packet.ReadUInt64();
            uint      emoteId   = Emotes.Get((TextEmotes)emote);
            Character character = (Character)manager.Account.ActiveCharacter;

            PacketWriter pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TEXT_EMOTE], "SMSG_TEXT_EMOTE");

            pw.Write(character.Guid);
            pw.Write(emote);

            if (build_4211)
            {
                pw.WriteInt64(0);
            }
            else
            {
                pw.WriteInt32(1);
                pw.WriteUInt8(0);
            }
            manager.Send(pw);

            switch ((TextEmotes)emote)
            {
            case TextEmotes.EMOTE_SIT:
                character.StandState = StandState.SITTING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_STAND:
                character.StandState = StandState.STANDING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_SLEEP:
                character.StandState = StandState.SLEEPING;
                manager.Send(character.BuildUpdate());
                return;

            case TextEmotes.EMOTE_KNEEL:
                character.StandState = StandState.KNEEL;
                manager.Send(character.BuildUpdate());
                return;
            }

            if (emoteId > 0)
            {
                pw = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_EMOTE], "SMSG_EMOTE");
                pw.WriteUInt32(emoteId);
                pw.WriteUInt64(character.Guid);
                manager.Send(pw);
            }
        }