Example #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.WriteInt64(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);
            }
        }
Example #2
0
        public void HandleAuthSession(ref IPacketReader packet, ref IWorldManager manager)
        {
            packet.ReadUInt64();
            string name = packet.ReadString().ToUpper();

            Account account = new Account(name);

            account.Load <Character>();
            manager.Account = account;

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

            writer.WriteUInt8(0x0C); //AUTH_OK
            writer.WriteUInt32(0);
            writer.WriteUInt8(0);
            writer.WriteUInt32(0);
            manager.Send(writer);
        }
Example #3
0
        public void HandlePlayerLogin(ref IPacketReader packet, ref IWorldManager manager)
        {
            ulong     guid      = packet.ReadUInt64();
            Character character = (Character)manager.Account.SetActiveChar(guid, Sandbox.Instance.Build);

            character.DisplayId = character.GetDisplayId();

            // Verify World : REQUIRED
            PacketWriter verify = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_LOGIN_VERIFY_WORLD], "SMSG_LOGIN_VERIFY_WORLD");

            verify.WriteUInt32(character.Location.Map);
            verify.WriteFloat(character.Location.X);
            verify.WriteFloat(character.Location.Y);
            verify.WriteFloat(character.Location.Z);
            verify.WriteFloat(character.Location.O);
            manager.Send(verify);

            // Account Data Hash : REQUIRED
            PacketWriter accountdata = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ACCOUNT_DATA_MD5], "SMSG_ACCOUNT_DATA_MD5");

            for (int i = 0; i < 31; i++)
            {
                accountdata.WriteInt32(0);
            }
            manager.Send(accountdata);

            // Tutorial Flags : REQUIRED
            PacketWriter tutorial = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TUTORIAL_FLAGS], "SMSG_TUTORIAL_FLAGS");

            for (int i = 0; i < 8; i++)
            {
                tutorial.WriteInt32(-1);
            }
            manager.Send(tutorial);

            HandleQueryTime(ref packet, ref manager);

            manager.Send(character.BuildUpdate());

            // handle flying
            manager.Send(character.BuildFly(character.IsFlying));
        }
Example #4
0
        public void HandleNameCache(ref IPacketReader packet, ref IWorldManager manager)
        {
            ulong guid      = packet.ReadUInt64();
            var   character = manager.Account.GetCharacter(guid, Sandbox.Instance.Build);

            if (character == null)
            {
                return;
            }

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

            nameCache.WriteUInt64(guid);
            nameCache.WriteString(character.Name);
            nameCache.WriteUInt8(0);
            nameCache.WriteUInt32(character.Race);
            nameCache.WriteUInt32(character.Gender);
            nameCache.WriteUInt32(character.Class);
            manager.Send(nameCache);
        }
Example #5
0
        public void HandleMovementStatus(ref IPacketReader packet, ref IWorldManager manager)
        {
            if (manager.Account.ActiveCharacter.IsTeleporting)
            {
                return;
            }

            uint opcode = packet.Opcode;
            long pos    = packet.Position;

            var   character = manager.Account.ActiveCharacter;
            ulong Flags     = packet.ReadUInt64();

            character.Location.Update(packet, true);

            //packet.Position = pos;
            //PacketWriter writer = new PacketWriter(opcode, Sandbox.Instance.Opcodes[opcode].ToString());
            //writer.Write(packet.ReadToEnd());
            //manager.Send(writer);
        }
Example #6
0
        public void HandlePlayerLogin(ref IPacketReader packet, ref IWorldManager manager)
        {
            ulong     guid      = packet.ReadUInt64();
            Character character = (Character)manager.Account.SetActiveChar(guid, Sandbox.Instance.Build);

            character.DisplayId = character.GetDisplayId();

            // Verify World : REQUIRED
            PacketWriter verify = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_LOGIN_VERIFY_WORLD], "SMSG_LOGIN_VERIFY_WORLD");

            verify.WriteUInt32(character.Location.Map);
            verify.WriteFloat(character.Location.X);
            verify.WriteFloat(character.Location.Y);
            verify.WriteFloat(character.Location.Z);
            verify.WriteFloat(character.Location.O);
            manager.Send(verify);

            // Account Data Hash : REQUIRED
            PacketWriter accountdata = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_ACCOUNT_DATA_MD5], "SMSG_ACCOUNT_DATA_MD5");

            accountdata.WriteInt32((int)DateTimeOffset.UtcNow.ToUnixTimeSeconds());
            accountdata.WriteUInt8(1);
            accountdata.WriteUInt32((uint)AccountDataMask.ALL);
            for (int i = 0; i < 8; i++)
            {
                accountdata.WriteUInt32(0);
            }
            manager.Send(accountdata);

            // Tutorial Flags : REQUIRED
            PacketWriter tutorial = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TUTORIAL_FLAGS], "SMSG_TUTORIAL_FLAGS");

            for (int i = 0; i < 8; i++)
            {
                tutorial.WriteInt32(-1);
            }
            manager.Send(tutorial);

            // send language spells so we can type commands
            PacketWriter spells = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_INITIAL_SPELLS], "SMSG_INITIAL_SPELLS");

            spells.WriteUInt8(0);
            spells.WriteUInt16(2); // spell count
            spells.WriteUInt32(CharacterData.COMMON_SPELL_ID);
            spells.WriteUInt16(0);
            spells.WriteUInt32(CharacterData.ORCISH_SPELL_ID);
            spells.WriteUInt16(0);
            spells.WriteUInt16(0); // cooldown count
            manager.Send(spells);

            HandleQueryTime(ref packet, ref manager);

            manager.Send(character.BuildUpdate());

            // handle flying
            manager.Send(character.BuildFly(character.IsFlying));

            // Force timesync : REQUIRED
            PacketWriter timesyncreq = new PacketWriter(Sandbox.Instance.Opcodes[global::Opcodes.SMSG_TIME_SYNC_REQ], "SMSG_TIME_SYNC_REQ");

            timesyncreq.Write(0);
            manager.Send(timesyncreq);
        }
Example #7
0
 public void HandleStandState(ref IPacketReader packet, ref IWorldManager manager)
 {
     packet.ReadUInt64();
     manager.Account.ActiveCharacter.StandState = (StandState)packet.ReadUInt32();
     manager.Send(manager.Account.ActiveCharacter.BuildUpdate());
 }
Example #8
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);
            }
        }