Ejemplo n.º 1
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader r    = packet.CreateReader();
            uint         unk1 = r.ReadUInt32();

            session.SendRealmSplitPkt(unk1);
        }
Ejemplo n.º 2
0
 public void Dispatch(ISession session, IPacket packet)
 {
     var reader = packet.CreateReader();
     var guid = reader.ReadUInt64();
     var questId = reader.ReadUInt32();
     var a = reader.ReadByte();
 }
Ejemplo n.º 3
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader r = packet.CreateReader();
            uint unk1 = r.ReadUInt32();

            session.SendRealmSplitPkt(unk1);
        }
Ejemplo n.º 4
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader  = packet.CreateReader();
            int          guildId = reader.ReadInt32();
            var          guild   = new Guild
            {
                Id   = guildId,
                Name = "guild"
            };

            IPacketBuilder responce = WorldPacketFactory.Build(
                WMSG.SMSG_GUILD_QUERY_RESPONSE,
                writer =>
            {
                writer.Write(guild.Id);
                writer.WriteCString(guild.Name);
                foreach (GuildRank rank in guild.Ranks)
                {
                    writer.WriteCString(rank.Name);
                }
                for (int i = 0; i < 10 - guild.Ranks.Count; i++)
                {
                    writer.WriteCString(string.Empty);
                }
                writer.Write(guild.Tabard.EmblemStyle);
                writer.Write(guild.Tabard.EmblemColor);
                writer.Write(guild.Tabard.BorderStyle);
                writer.Write(guild.Tabard.BorderColor);
                writer.Write(guild.Tabard.BackgroundColor);
                writer.Write(0);         // NEW 3.0.2
            });

            session.Send(responce);
        }
Ejemplo n.º 5
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader    = packet.CreateReader();
            byte         castCount = reader.ReadByte();
            uint         spellId   = reader.ReadUInt32();
            byte         unklags   = reader.ReadByte();


            IPacket      pkt    = WorldPacketFactory.Create(WMSG.SMSG_SPELL_START);
            BinaryWriter writer = pkt.CreateWriter();

            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0);             //cast flags
            writer.Write(0);             //ticks count
            writer.Write(0);             //targetflags
            session.Send(pkt);

            Thread.Sleep(5000);
            pkt    = WorldPacketFactory.Create(WMSG.SMSG_SPELL_GO);
            writer = pkt.CreateWriter();
            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0);             //cast flags
            writer.Write(0);             //ticks count
            writer.Write((byte)1);       //hit count
            writer.Write(session.Player.Guid);
            writer.Write((byte)0);       //miss count
            writer.Write(0);             // targetflags
            session.Send(pkt);
        }
Ejemplo n.º 6
0
        private void HandleXferResume(IPacket packet)
        {
            AcceptPatch = true;
            BinaryReader gr = packet.CreateReader();

            SendPatch("wow-patch.mpq", gr.ReadInt64());
        }
Ejemplo n.º 7
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var type = (MessageType) reader.ReadUInt32();
            uint language = reader.ReadUInt32();
            string channel = type == MessageType.Channel || type == MessageType.Whisper
                                 ? reader.ReadCString()
                                 : string.Empty;
            string message = reader.ReadCString();

            var pkt = WorldPacketFactory.Create(WMSG.SMSG_MESSAGECHAT);
            var writer = pkt.CreateWriter();
            writer.Write((byte)type);
            writer.Write((uint)0);
            writer.Write(session.Player.Guid);
            writer.Write(0);
            /*
            if (target != null)
                writer.WritePascalString(target);
            */
            writer.Write((ulong)0);
            writer.WritePascalString(message);
            writer.Write((byte)0);

            var players = ObjectManager.GetPlayersNear(session.Player);
            foreach (var player in players)
            {
                player.Session.Send(pkt);
            }

            Console.WriteLine("{0} {1} {2} {3}", type, language, channel, message);
        }
Ejemplo n.º 8
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            int guildId = reader.ReadInt32();
            var guild = new Guild
                            {
                                Id = guildId,
                                Name = "guild"
                            };

            IPacketBuilder responce = WorldPacketFactory.Build(
                WMSG.SMSG_GUILD_QUERY_RESPONSE,
                writer =>
                    {
                        writer.Write(guild.Id);
                        writer.WriteCString(guild.Name);
                        foreach (GuildRank rank in guild.Ranks)
                            writer.WriteCString(rank.Name);
                        for (int i = 0; i < 10 - guild.Ranks.Count; i++)
                            writer.WriteCString(string.Empty);
                        writer.Write(guild.Tabard.EmblemStyle);
                        writer.Write(guild.Tabard.EmblemColor);
                        writer.Write(guild.Tabard.BorderStyle);
                        writer.Write(guild.Tabard.BorderColor);
                        writer.Write(guild.Tabard.BackgroundColor);
                        writer.Write(0); // NEW 3.0.2
                    });
            session.Send(responce);
        }
Ejemplo n.º 9
0
 public void Dispatch(ISession session, IPacket packet)
 {
     var reader  = packet.CreateReader();
     var guid    = reader.ReadUInt64();
     var questId = reader.ReadUInt32();
     var a       = reader.ReadByte();
 }
Ejemplo n.º 10
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte castCount = reader.ReadByte();
            uint spellId = reader.ReadUInt32();
            byte unklags = reader.ReadByte();

            IPacket pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_START);
            BinaryWriter writer = pkt.CreateWriter();
            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0); //cast flags
            writer.Write(0); //ticks count
            writer.Write(0); //targetflags
            session.Send(pkt);

            Thread.Sleep(5000);
            pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_GO);
            writer = pkt.CreateWriter();
            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0); //cast flags
            writer.Write(0); //ticks count
            writer.Write((byte)1); //hit count
            writer.Write(session.Player.Guid);
            writer.Write((byte)0); //miss count
            writer.Write(0); // targetflags
            session.Send(pkt);
        }
Ejemplo n.º 11
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            ulong guid = reader.ReadUInt64();
            Player player = session.Account.GetPlayer(guid);

            session.Login(player);
        }
Ejemplo n.º 12
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            ulong        guid   = reader.ReadUInt64();
            Player       player = session.Account.GetPlayer(guid);

            session.Login(player);
        }
Ejemplo n.º 13
0
 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader r = packet.CreateReader();
     uint itemId = r.ReadUInt32();
     ItemTemplate template = IoC.Resolve<IItemTemplateRepository>().FindById(itemId);
     if(template != null) {
         session.SendItemQuerySingleResponse(template);
     }
 }
Ejemplo n.º 14
0
 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader reader = packet.CreateReader();
     uint id = reader.ReadUInt32();
     GameObjectTemplate template = IoC.Resolve<IGameObjectTemplateRepository>().FindById(id);
     if(template != null) {
         session.SendGameObjectQueryResponce(template);
     }
 }
Ejemplo n.º 15
0
 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader r = packet.CreateReader();
     uint creatureId = r.ReadUInt32();
     CreatureTemplate creature = IoC.Resolve<ICreatureTemplateRepository>().FindById(creatureId);
     if(creature != null) {
         session.SendCreatureQueryResponce(creature);
     }
 }
Ejemplo n.º 16
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte srcSlot = reader.ReadByte();
            byte dstSlot = reader.ReadByte();

            Player player = session.Player;

            SwapItems(player.Inventory, srcSlot, player.Inventory, dstSlot);
        }
Ejemplo n.º 17
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader  = packet.CreateReader();
            byte         srcSlot = reader.ReadByte();
            byte         dstSlot = reader.ReadByte();

            Player player = session.Player;

            SwapItems(player.Inventory, srcSlot, player.Inventory, dstSlot);
        }
Ejemplo n.º 18
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var type = (AccountDataType)reader.ReadUInt32();
            ulong guid = session.Player != null ? session.Player.Guid : 0;

            AccpuntData accpuntData = session.Account.FindAccpuntData(type, guid);

            session.Send(GetUpdateAccountDataPkt(accpuntData));
        }
Ejemplo n.º 19
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var          type   = (AccountDataType)reader.ReadUInt32();
            ulong        guid   = session.Player != null ? session.Player.Guid : 0;

            AccpuntData accpuntData = session.Account.FindAccpuntData(type, guid);

            session.Send(GetUpdateAccountDataPkt(accpuntData));
        }
Ejemplo n.º 20
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader       reader   = packet.CreateReader();
            uint               id       = reader.ReadUInt32();
            GameObjectTemplate template = IoC.Resolve <IGameObjectTemplateRepository>().FindById(id);

            if (template != null)
            {
                session.SendGameObjectQueryResponce(template);
            }
        }
Ejemplo n.º 21
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader r        = packet.CreateReader();
            uint         itemId   = r.ReadUInt32();
            ItemTemplate template = IoC.Resolve <IItemTemplateRepository>().FindById(itemId);

            if (template != null)
            {
                session.SendItemQuerySingleResponse(template);
            }
        }
Ejemplo n.º 22
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader     r          = packet.CreateReader();
            uint             creatureId = r.ReadUInt32();
            CreatureTemplate creature   = IoC.Resolve <ICreatureTemplateRepository>().FindById(creatureId);

            if (creature != null)
            {
                session.SendCreatureQueryResponce(creature);
            }
        }
Ejemplo n.º 23
0
        private static IPacket GetMoveResponce(IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            byte[] bytes = reader.ReadBytes(packet.Size);

            IPacket responce = WorldPacketFactory.Create((WMSG)packet.Code);
            BinaryWriter w = responce.CreateWriter();
            w.Write(bytes);
            return responce;
        }
Ejemplo n.º 24
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            uint textId = reader.ReadUInt32();
            ulong targetGuid = reader.ReadUInt64();

            NpcTexts text = IoC.Resolve<INpcTextRepository>().FindById(textId);
            if(text != null) {
                session.SendNpcTextUpdate(text);
            }
        }
Ejemplo n.º 25
0
 public void Dispatch(ISession client, IPacket packet)
 {
     Player me = client.Player;
     Session.SendNearExceptMe(me, GetMoveResponce(packet));
     BinaryReader reader = packet.CreateReader();
     reader.BaseStream.Seek(0, SeekOrigin.Begin);
     ulong guid = reader.ReadPackGuid();
     if(guid != me.Guid) {
         throw new Exception();
     }
     me.MovementInfo.Read(reader);
 }
Ejemplo n.º 26
0
		public void Dispatch(ISession client, IPacket packet) {
			BinaryReader reader = packet.CreateReader();
			byte srcBag = reader.ReadByte();
			byte srcSlot = reader.ReadByte();
			byte dstBag = reader.ReadByte();
			byte dstSlot = reader.ReadByte();
			byte amount = reader.ReadByte();

			Player player = client.Player;

			SplitItems(player.GetInventory(srcBag), srcSlot, player.GetInventory(dstBag), dstSlot, amount);
		}
Ejemplo n.º 27
0
 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader reader = packet.CreateReader();
     ulong targetGuid = reader.ReadUInt64();
     uint unk1 = reader.ReadUInt32();
     uint option = reader.ReadUInt32();
     if(option==1) {
         session.Player.Health = 0;
     }else {
         session.SendShowBank(targetGuid);
     }
 }
Ejemplo n.º 28
0
 public void Dispatch(ISession client, IPacket packet)
 {
     BinaryReader reader = packet.CreateReader();
     ulong guid = reader.ReadUInt64();
     var gameObject = ObjectManager
                      	.GetSeenObjectsNear(client.Player)
                      	.Where(x => x.Guid == guid)
                      	.FirstOrDefault() as GameObject;
     if(gameObject != null) {
         gameObject.Use(client);
     }
 }
Ejemplo n.º 29
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte srcBag = reader.ReadByte();
            byte srcSlot = reader.ReadByte();

            Player player = session.Player;

            IInventory inventorySrc = player.GetInventory(srcBag);
            IEquipmentInventory inventoryDst = player.Equipment;

            inventorySrc[srcSlot] = inventoryDst.AutoEquip(inventorySrc[srcSlot]);
        }
Ejemplo n.º 30
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader  = packet.CreateReader();
            byte         srcBag  = reader.ReadByte();
            byte         srcSlot = reader.ReadByte();

            Player player = session.Player;

            IInventory          inventorySrc = player.GetInventory(srcBag);
            IEquipmentInventory inventoryDst = player.Equipment;

            inventorySrc[srcSlot] = inventoryDst.AutoEquip(inventorySrc[srcSlot]);
        }
Ejemplo n.º 31
0
        public void Dispatch(ISession client, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte srcBag = reader.ReadByte();
            byte srcSlot = reader.ReadByte();
            byte dstBag = reader.ReadByte();
            byte dstSlot = reader.ReadByte();
            byte amount = reader.ReadByte();

            Player player = client.Player;

            SplitItems(player.GetInventory(srcBag), srcSlot, player.GetInventory(dstBag), dstSlot, amount);
        }
Ejemplo n.º 32
0
        private static IPacket GetMoveResponce(IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();

            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            byte[] bytes = reader.ReadBytes(packet.Size);

            IPacket      responce = WorldPacketFactory.Create((WMSG)packet.Code);
            BinaryWriter w        = responce.CreateWriter();

            w.Write(bytes);
            return(responce);
        }
Ejemplo n.º 33
0
        public void Dispatch(ISession session, IPacket packet)
        {
            ulong targetGuid = packet.CreateReader().ReadUInt64();

            var message = new GossipMessage(2, new[] {
                new GossipMenuItem(2, GossipMenuIcon.Banker, false, "Need bank?"),
                new GossipMenuItem(1, GossipMenuIcon.Gossip, false, "I would die!")
            }, new[] {
                new QuestsMenuItem(3, 2, "hi"),
            });

            session.SendGossipMessage(targetGuid, message);
        }
Ejemplo n.º 34
0
        public void Dispatch(ISession session, IPacket packet)
        {
            ulong targetGuid = packet.CreateReader().ReadUInt64();

            var message = new GossipMessage(2, new[] {
                new GossipMenuItem(2, GossipMenuIcon.Banker, false, "Need bank?"),
                new GossipMenuItem(1, GossipMenuIcon.Gossip, false, "I would die!")
            }, new[] {
                new QuestsMenuItem(3, 2, "hi"),
            });

            session.SendGossipMessage(targetGuid, message);
        }
Ejemplo n.º 35
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte         bag    = reader.ReadByte();
            byte         slot   = reader.ReadByte();

            IInventory inventory = session.Player.GetInventory(bag);

            if (inventory != null)
            {
                inventory.DestroyItem(slot);
            }
        }
Ejemplo n.º 36
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader     = packet.CreateReader();
            uint         textId     = reader.ReadUInt32();
            ulong        targetGuid = reader.ReadUInt64();

            NpcTexts text = IoC.Resolve <INpcTextRepository>().FindById(textId);

            if (text != null)
            {
                session.SendNpcTextUpdate(text);
            }
        }
Ejemplo n.º 37
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            ulong guid = reader.ReadUInt64();

            Player player = ObjectManager
                .GetPlayersNear(session.Player)
                .FirstOrDefault(x => x.Guid == guid);

            if(player != null) {
                session.SendNameQueryResponce(player);
            }
        }
Ejemplo n.º 38
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            ulong        guid   = reader.ReadUInt64();

            Player player = ObjectManager
                            .GetPlayersNear(session.Player)
                            .FirstOrDefault(x => x.Guid == guid);

            if (player != null)
            {
                session.SendNameQueryResponce(player);
            }
        }
Ejemplo n.º 39
0
        public void Dispatch(ISession client, IPacket packet)
        {
            BinaryReader reader     = packet.CreateReader();
            ulong        guid       = reader.ReadUInt64();
            var          gameObject = ObjectManager
                                      .GetSeenObjectsNear(client.Player)
                                      .Where(x => x.Guid == guid)
                                      .FirstOrDefault() as GameObject;

            if (gameObject != null)
            {
                gameObject.Use(client);
            }
        }
Ejemplo n.º 40
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte srcBag = reader.ReadByte();
            byte srcSlot = reader.ReadByte();

            Player player = session.Player;

            IInventory inventorySrc = player.GetInventory(srcBag);
            IInventory inventoryDst = GetInventoryDst(player);

            if(inventoryDst.AutoAdd(inventorySrc[srcSlot])) {
                inventorySrc[srcSlot] = null;
            }
        }
Ejemplo n.º 41
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader     = packet.CreateReader();
            ulong        targetGuid = reader.ReadUInt64();
            uint         unk1       = reader.ReadUInt32();
            uint         option     = reader.ReadUInt32();

            if (option == 1)
            {
                session.Player.Health = 0;
            }
            else
            {
                session.SendShowBank(targetGuid);
            }
        }
Ejemplo n.º 42
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader  = packet.CreateReader();
            byte         srcBag  = reader.ReadByte();
            byte         srcSlot = reader.ReadByte();

            Player player = session.Player;

            IInventory inventorySrc = player.GetInventory(srcBag);
            IInventory inventoryDst = GetInventoryDst(player);

            if (inventoryDst.AutoAdd(inventorySrc[srcSlot]))
            {
                inventorySrc[srcSlot] = null;
            }
        }
Ejemplo n.º 43
0
        public void Dispatch(ISession client, IPacket packet)
        {
            Player me = client.Player;

            Session.SendNearExceptMe(me, GetMoveResponce(packet));
            BinaryReader reader = packet.CreateReader();

            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            ulong guid = reader.ReadPackGuid();

            if (guid != me.Guid)
            {
                throw new Exception();
            }
            me.MovementInfo.Read(reader);
        }
Ejemplo n.º 44
0
        private void HandleAuthSession(IPacket packet)
        {
            Stream       dataStream  = packet.GetStream();
            BinaryReader r           = packet.CreateReader();
            uint         version     = r.ReadUInt32();
            uint         unk2        = r.ReadUInt32();
            string       accountName = r.ReadCString();
            uint         unk         = r.ReadUInt32();
            uint         clientSeed  = r.ReadUInt32();
            ulong        unk3        = r.ReadUInt64();
            uint         unk4        = r.ReadUInt32();
            ulong        unk5        = r.ReadUInt64();

            byte[] clientDigest = r.ReadBytes(20);

            session.Account = IoC.Resolve <IAccountRepository>().FindByName(accountName);

            cryptor.SetSymmetricAlgorithm(new WowCryptRC4(session.Account.SessionKey));

            if (!ByteArrayExtensions.Equals(clientDigest, ComputeServerDigest(clientSeed)))
            {
                throw new Exception();
            }

            session.Send(GetAuthResponcePkt());

            uint addonInfoBlockSize = r.ReadUInt32();

            dataStream = new InflaterInputStream(dataStream);             //дальше данные запакованы
            r          = new BinaryReader(dataStream);
            try {
                while (true)
                {
                    var addonInfo = new AddonInfo {
                        Name   = r.ReadCString(),
                        Crc    = r.ReadUInt64(),
                        Status = r.ReadByte(),
                    };
                    AddonManager.Instance[addonInfo.Name] = addonInfo;
                }
            }
            catch (Exception e) {
            }
            //_client.Send(GetAddonInfoPkt());
            session.Send(GetTutorialFlagsPkt());
            session.SendAccountDataTimes(0x15);
        }
Ejemplo n.º 45
0
        private void HandleLogonChallenge(IPacket packet)
        {
            BinaryReader gr          = packet.CreateReader();
            string       tag         = gr.ReadCString();
            var          verMajor    = (int)gr.ReadByte();
            var          verMinor    = (int)gr.ReadByte();
            var          verBuild    = (int)gr.ReadByte();
            var          verRevis    = (int)gr.ReadUInt16();
            string       platform    = gr.ReadCString();
            string       os          = gr.ReadCString();
            string       locale      = Encoding.UTF8.GetString(gr.ReadBytes(4).Reverse());
            int          timezone    = gr.ReadInt32();
            var          ip          = new IPAddress(gr.ReadBytes(4));
            string       accountName = gr.ReadString();

            ClientInfo = new ClientInfo {
                VersionInfo = new VersionInfo {
                    ClientTag = tag,
                    Version   = new Version(verMajor, verMinor, verBuild, verRevis),
                    Platform  = platform,
                    OS        = os,
                    Locale    = locale,
                },
                TimeZone    = timezone,
                IP          = ip,
                AccountName = accountName,
            };

            var repository1 = IoC.Resolve <IAccountRepository>();

            _account = repository1.FindByName(accountName);
            if (_account == null)
            {
                _account = new Account {
                    Name = accountName
                };
                _account.SetPassword(accountName);
                repository1.Save(_account);
                repository1.SubmitChanges();
            }

            bi_s = new BigInteger(_account.PasswordSalt.Reverse());
            bi_v = new BigInteger(_account.PasswordVerifier.Reverse());
            bi_B = (bi_v * bi_k + bi_g.modPow(bi_b, bi_N)) % bi_N;

            _client.Send(GetLogonChallenge());
        }
Ejemplo n.º 46
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var type = (AccountDataType)reader.ReadUInt32();
            DateTime time = DateTimeExtension.ToDateTime(reader.ReadUInt32());
            var decompressedSize = reader.ReadInt32();
            reader = new BinaryReader(new InflaterInputStream(reader.BaseStream));
            string data = Encoding.UTF8.GetString(reader.ReadBytes(decompressedSize));

            var ad = new AccpuntData {
                //Guid =
                Type = type,
                Time = time,
                Data = data,
            };

            session.Account.SetAccountData(ad);
            session.Send(GetUpdateAccountDataCompletePkt(type));
        }
Ejemplo n.º 47
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader           = packet.CreateReader();
            var          type             = (AccountDataType)reader.ReadUInt32();
            DateTime     time             = DateTimeExtension.ToDateTime(reader.ReadUInt32());
            var          decompressedSize = reader.ReadInt32();

            reader = new BinaryReader(new InflaterInputStream(reader.BaseStream));
            string data = Encoding.UTF8.GetString(reader.ReadBytes(decompressedSize));

            var ad = new AccpuntData {
                //Guid =
                Type = type,
                Time = time,
                Data = data,
            };

            session.Account.SetAccountData(ad);
            session.Send(GetUpdateAccountDataCompletePkt(type));
        }
Ejemplo n.º 48
0
 public void Dispatch(ISession session, IPacket packet)
 {
     Account account = session.Account;
     BinaryReader r = packet.CreateReader();
     var player = new Player {
         Name = r.ReadCString(),
         Race = (Races)r.ReadByte(),
         Classe = (Classes)r.ReadByte(),
         Gender = (GenderType)r.ReadByte(),
         Skin = r.ReadByte(),
         Face = r.ReadByte(),
         HairStyle = r.ReadByte(),
         HairColor = r.ReadByte(),
         FacialHair = r.ReadByte(),
     };
     new FakeCharacterCreateHandler(player).Init();
     account.AddPlayer(player);
     //Repository.Account.Save(account);
     //Repository.Account.SubmitChanges();
     session.SendCharCreate();
 }
Ejemplo n.º 49
0
        public void Dispatch(ISession session, IPacket packet)
        {
            Account      account = session.Account;
            BinaryReader r       = packet.CreateReader();
            var          player  = new Player {
                Name       = r.ReadCString(),
                Race       = (Races)r.ReadByte(),
                Classe     = (Classes)r.ReadByte(),
                Gender     = (GenderType)r.ReadByte(),
                Skin       = r.ReadByte(),
                Face       = r.ReadByte(),
                HairStyle  = r.ReadByte(),
                HairColor  = r.ReadByte(),
                FacialHair = r.ReadByte(),
            };

            new FakeCharacterCreateHandler(player).Init();
            account.AddPlayer(player);
            //Repository.Account.Save(account);
            //Repository.Account.SubmitChanges();
            session.SendCharCreate();
        }
Ejemplo n.º 50
0
        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader   = packet.CreateReader();
            var          type     = (MessageType)reader.ReadUInt32();
            uint         language = reader.ReadUInt32();
            string       channel  = type == MessageType.Channel || type == MessageType.Whisper
                                 ? reader.ReadCString()
                                 : string.Empty;
            string message = reader.ReadCString();

            var pkt    = WorldPacketFactory.Create(WMSG.SMSG_MESSAGECHAT);
            var writer = pkt.CreateWriter();

            writer.Write((byte)type);
            writer.Write((uint)0);
            writer.Write(session.Player.Guid);
            writer.Write(0);

/*
 *          if (target != null)
 *              writer.WritePascalString(target);
 */
            writer.Write((ulong)0);
            writer.WritePascalString(message);
            writer.Write((byte)0);

            var players = ObjectManager.GetPlayersNear(session.Player);

            foreach (var player in players)
            {
                player.Session.Send(pkt);
            }


            Console.WriteLine("{0} {1} {2} {3}", type, language, channel, message);
        }
Ejemplo n.º 51
0
 public void Dispatch(ISession client, IPacket packet)
 {
     client.Player.AmmoId = packet.CreateReader().ReadUInt32();
 }
Ejemplo n.º 52
0
 public void Dispatch(ISession session, IPacket packet)
 {
     session.Send(GetPongPkt(packet.CreateReader().ReadUInt32()));
 }
Ejemplo n.º 53
0
 public void Dispatch(ISession client, IPacket packet)
 {
     client.Player.StandState = (StandStates)packet.CreateReader().ReadByte();
 }
Ejemplo n.º 54
0
        private void HandleLogonChallenge(IPacket packet)
        {
            BinaryReader gr = packet.CreateReader();
            string tag = gr.ReadCString();
            var verMajor = (int)gr.ReadByte();
            var verMinor = (int)gr.ReadByte();
            var verBuild = (int)gr.ReadByte();
            var verRevis = (int)gr.ReadUInt16();
            string platform = gr.ReadCString();
            string os = gr.ReadCString();
            string locale = Encoding.UTF8.GetString(gr.ReadBytes(4).Reverse());
            int timezone = gr.ReadInt32();
            var ip = new IPAddress(gr.ReadBytes(4));
            string accountName = gr.ReadString();

            ClientInfo = new ClientInfo {
                VersionInfo = new VersionInfo {
                    ClientTag = tag,
                    Version = new Version(verMajor, verMinor, verBuild, verRevis),
                    Platform = platform,
                    OS = os,
                    Locale = locale,
                },
                TimeZone = timezone,
                IP = ip,
                AccountName = accountName,
            };

            var repository1 = IoC.Resolve<IAccountRepository>();
            _account = repository1.FindByName(accountName);
            if(_account == null) {
                _account = new Account { Name = accountName };
                _account.SetPassword(accountName);
                repository1.Save(_account);
                repository1.SubmitChanges();
            }

            bi_s = new BigInteger(_account.PasswordSalt.Reverse());
            bi_v = new BigInteger(_account.PasswordVerifier.Reverse());
            bi_B = (bi_v * bi_k + bi_g.modPow(bi_b, bi_N)) % bi_N;

            _client.Send(GetLogonChallenge());
        }
Ejemplo n.º 55
0
        private void HandleLogonProof(IPacket packet)
        {
            BinaryReader gr = packet.CreateReader();

            var bi_A = new BigInteger(gr.ReadBytes(32).Reverse());
            var bi_M1 = new BigInteger(gr.ReadBytes(20).Reverse());

            byte[] u = H(bi_A.getBytes().Reverse().Concat(bi_B.getBytes().Reverse()));
            var bi_u = new BigInteger(u.Reverse());

            BigInteger bi_Temp2 = (bi_A * bi_v.modPow(bi_u, bi_N)) % bi_N; // v^u
            BigInteger bi_S = bi_Temp2.modPow(bi_b, bi_N); // (Av^u)^b

            byte[] S = bi_S.getBytes().Reverse();
            var S1 = new byte[16];
            var S2 = new byte[16];

            for(int i = 0; i < 16; i++) {
                S1[i] = S[i * 2];
                S2[i] = S[i * 2 + 1];
            }

            var SS_Hash = new byte[40];
            byte[] S1_Hash = H(S1);
            byte[] S2_Hash = H(S2);
            for(int i = 0; i < 20; i++) {
                SS_Hash[i * 2] = S1_Hash[i];
                SS_Hash[i * 2 + 1] = S2_Hash[i];
            }

            _account.SessionKey = (byte[])SS_Hash.Clone();

            var accountRepository = IoC.Resolve<IAccountRepository>();
            accountRepository.Save(_account);
            accountRepository.SubmitChanges();

            byte[] N_Hash = H(bi_N.getBytes().Reverse());
            byte[] G_Hash = H(bi_g.getBytes().Reverse());
            for(int i = 0; (i < 20); i++) {
                N_Hash[i] ^= G_Hash[i];
            }

            byte[] userHash = H(Encoding.UTF8.GetBytes(ClientInfo.AccountName));

            IEnumerable<byte> temp = N_Hash
                .Concat(userHash)
                .Concat(bi_s.getBytes().Reverse())
                .Concat(bi_A.getBytes().Reverse())
                .Concat(bi_B.getBytes().Reverse())
                .Concat(SS_Hash);

            var biM1Temp = new BigInteger(H(temp).Reverse());
            if(biM1Temp != bi_M1) {
                _client.Send(GetLogonProof());
                return;
            }

            temp = bi_A.getBytes().Reverse()
                .Concat(biM1Temp.getBytes().Reverse());
            temp = temp.Concat(SS_Hash);
            byte[] M2 = H(temp);

            _client.Send(GetLogonProof(M2));
        }
Ejemplo n.º 56
0
 private void HandleXferResume(IPacket packet)
 {
     AcceptPatch = true;
     BinaryReader gr = packet.CreateReader();
     SendPatch("wow-patch.mpq", gr.ReadInt64());
 }
Ejemplo n.º 57
0
 public void Dispatch(ISession session, IPacket packet)
 {
     var reader = packet.CreateReader();
     var rankName = reader.ReadCString();
 }
Ejemplo n.º 58
0
 public void Dispatch(ISession session, IPacket packet)
 {
     session.Send(GetPongPkt(packet.CreateReader().ReadUInt32()));
 }
Ejemplo n.º 59
0
 public void Dispatch(ISession session, IPacket packet)
 {
     session.SendShowBank(packet.CreateReader().ReadUInt64());
 }