public override void OnRead(RiftClient From)
        {
            Log.Success("Authentification", "Email = " + Email + " SessionTicket = " + SessionTicket);

            long Char = MapServer.Maps.GetConnecting(Email);

            if (Char == 0)
            {
                Log.Error("Authentification", "Not authentified email : " + Email);
                From.Disconnect();
                return;
            }

            From.Acct = MapServer.Accounts.GetAccountByUsername(Email);

            if (From.Acct == null)
            {
                Log.Error("Authentification", "Not valid account :" + Email);
                From.Disconnect();
                return;
            }

            From.Character = MapServer.Characters.GetCharacter(Char);

            if (From.Acct == null)
            {
                Log.Error("Authentification", "Not valid character :" + Char);
                From.Disconnect();
                return;
            }

            WorldAuthenticationResponse Rp = new WorldAuthenticationResponse();
            Rp.AddField(0, EPacketFieldType.True, (bool)true);
            From.SendSerialized(Rp);

            CacheTemplate[] Tmps = MapServer.World.GetTemplates();
            foreach (CacheTemplate Tmp in Tmps)
                From.SendSerialized(WorldMgr.BuildCache(Tmp.CacheID, Tmp.CacheType, Tmp));

            CacheData[] Dts = MapServer.World.GetDatas();
            foreach (CacheData Tmp in Dts)
                From.SendSerialized(WorldMgr.BuildCache(Tmp.CacheID, Tmp.CacheType, Tmp));

            WorldCacheUpdated Updated = new WorldCacheUpdated();
            Updated.GUID = Char;
            From.SendSerialized(Updated);

            /////////////////////////////////////////////////////////////////////
            // Send Inventory
            /////////////////////////////////////////////////////////////////////

            WorldEntityUpdate Update = new WorldEntityUpdate();
            Update.AddField(6, EPacketFieldType.Raw8Bytes, (long)Char);
            From.SendSerialized(Update);

            //////////////////////////////////////////////////////////////////////

            ISerializablePacket Packet1 = new ISerializablePacket();
            Packet1.Opcode = 0x03F6;
            Packet1.AddField(0, EPacketFieldType.Raw4Bytes, new byte[4] { 0x20, 0xB1, 0x59, 0x41 });
            Packet1.AddField(1, EPacketFieldType.ByteArray, new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                             00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                             00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 });

            byte[] UnkGuid = new byte[8] { 0xCB, 0x34, 0x3D, 0x94, 0x23, 0x04, 0xCC, 0x01 };
            Packet1.AddField(2, EPacketFieldType.Raw8Bytes, UnkGuid);
            From.SendSerialized(Packet1);

            ISerializablePacket Packet2 = new ISerializablePacket();
            Packet2.Opcode = 0x02E9;
            Packet2.AddField(0, EPacketFieldType.List, new List<long>() { 3605869292 });
            From.SendSerialized(Packet2);

            ISerializablePacket Packet3 = new ISerializablePacket();
            Packet3.Opcode = 0x2D7F;
            From.SendSerialized(Packet3);

            /********************************************/

            WorldZoneInfo ZoneInfo = new WorldZoneInfo();
            ZoneInfo.ZoneFileName = "Mathosia1";
            ZoneInfo.Description = MapServer.World.GetText(290412351);
            ZoneInfo.DisplayName = MapServer.World.GetText(1647389394);
            From.SendSerialized(ZoneInfo);

            WorldStartingPosition StartPosition = new WorldStartingPosition();
            StartPosition.MapName = "guardian_map";
            From.SendSerialized(StartPosition);

            WorldPositionExtra ExtraPosition = new WorldPositionExtra();
            ExtraPosition.MapName = "guardian_map";

            ISerializablePacket Extra = new ISerializablePacket();
            Extra.Opcode = (long)Opcodes.WorldStartingPositionExtra;
            Extra.AddField(0, EPacketFieldType.Packet, ExtraPosition);
            From.SendSerialized(Extra);
        }
Example #2
0
        public override void OnRead(RiftClient From)
        {
            Log.Success("Authentification", "Email = " + Email + " SessionTicket = " + SessionTicket);

            long Char = Program.Maps.GetConnecting(Email);

            if (Char == 0)
            {
                Log.Error("Authentification", "Not authentified email : " + Email);
                From.Disconnect();
                return;
            }

            From.Acct = Program.Accounts.GetAccountByUsername(Email);

            if (From.Acct == null)
            {
                Log.Error("Authentification", "Not valid account :" + Email);
                From.Disconnect();
                return;
            }

            From.Character = Program.Characters.GetCharacter(Char);

            if (From.Acct == null)
            {
                Log.Error("Authentification", "Not valid character :" + Char);
                From.Disconnect();
                return;
            }

            WorldAuthenticationResponse Rp = new WorldAuthenticationResponse();

            Rp.AddField(0, EPacketFieldType.True, (bool)true);
            From.SendSerialized(Rp);

            CacheTemplate[] Tmps = Program.World.GetTemplates();
            foreach (CacheTemplate Tmp in Tmps)
            {
                From.SendSerialized(WorldMgr.BuildCache(Tmp.CacheID, Tmp.CacheType, Tmp));
            }

            CacheData[] Dts = Program.World.GetDatas();
            foreach (CacheData Tmp in Dts)
            {
                From.SendSerialized(WorldMgr.BuildCache(Tmp.CacheID, Tmp.CacheType, Tmp));
            }

            WorldCacheUpdated Updated = new WorldCacheUpdated();

            Updated.GUID = Char;
            From.SendSerialized(Updated);

            /////////////////////////////////////////////////////////////////////
            // Send Inventory
            /////////////////////////////////////////////////////////////////////

            WorldEntityUpdate Update = new WorldEntityUpdate();

            Update.AddField(6, EPacketFieldType.Raw8Bytes, (long)Char);
            From.SendSerialized(Update);

            //////////////////////////////////////////////////////////////////////


            ISerializablePacket Packet1 = new ISerializablePacket();

            Packet1.Opcode = 0x03F6;
            Packet1.AddField(0, EPacketFieldType.Raw4Bytes, new byte[4] {
                0x20, 0xB1, 0x59, 0x41
            });
            Packet1.AddField(1, EPacketFieldType.ByteArray, new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 });

            byte[] UnkGuid = new byte[8] {
                0xCB, 0x34, 0x3D, 0x94, 0x23, 0x04, 0xCC, 0x01
            };
            Packet1.AddField(2, EPacketFieldType.Raw8Bytes, UnkGuid);
            From.SendSerialized(Packet1);

            ISerializablePacket Packet2 = new ISerializablePacket();

            Packet2.Opcode = 0x02E9;
            Packet2.AddField(0, EPacketFieldType.List, new List <long>()
            {
                3605869292
            });
            From.SendSerialized(Packet2);

            ISerializablePacket Packet3 = new ISerializablePacket();

            Packet3.Opcode = 0x2D7F;
            From.SendSerialized(Packet3);

            /********************************************/

            WorldZoneInfo ZoneInfo = new WorldZoneInfo();

            ZoneInfo.ZoneFileName = "Mathosia1";
            ZoneInfo.Description  = Program.World.GetText(290412351);
            ZoneInfo.DisplayName  = Program.World.GetText(1647389394);
            From.SendSerialized(ZoneInfo);

            WorldStartingPosition StartPosition = new WorldStartingPosition();

            StartPosition.MapName = "guardian_map";
            From.SendSerialized(StartPosition);

            WorldPositionExtra ExtraPosition = new WorldPositionExtra();

            ExtraPosition.MapName = "guardian_map";

            ISerializablePacket Extra = new ISerializablePacket();

            Extra.Opcode = (long)Opcodes.WorldStartingPositionExtra;
            Extra.AddField(0, EPacketFieldType.Packet, ExtraPosition);
            From.SendSerialized(Extra);
        }
        public override void OnRead(RiftClient From)
        {
            Log.Success("Authentification", "Email = " + Email + " SessionTicket = " + SessionTicket);

            // TMP, Client must ALLWAYS provide SessionTicket, not sended because an invalid certificate probably
            Character PlrInfo = null;

            Account Acct = null;

            if (SessionTicket == 0)
               Acct = AccountMgr.Instance.GetAccount(Email.ToUpper());
             else
                Acct = AccountMgr.Instance.GetAccountBySessionTicket(SessionTicket);

             if (Acct == null)
             {
                 Log.Error("Authentification", "Invalid WORLD_AUTH_REQUEST");
                 From.Disconnect();
                 return;
             }

            PlrInfo = CharacterMgr.Instance.GetCharacter((int)Acct.PendingCharacter);

            if (PlrInfo == null)
            {
                Log.Error("Authentification", "Invalid WORLD_AUTH_REQUEST");
                From.Disconnect();
                return;
            }

            From.Char = PlrInfo;

            WorldAuthenticationResponse Rp = new WorldAuthenticationResponse();
            Rp.AddField(0, EPacketFieldType.True, (bool)true);
            From.SendSerialized(Rp);

            WorldCacheUpdated Updated = new WorldCacheUpdated();
            Updated.GUID = PlrInfo.Id;
            From.SendSerialized(Updated);

            /////////////////////////////////////////////////////////////////////
            // Send Inventory
            /////////////////////////////////////////////////////////////////////

            WorldEntityUpdate Inventory = new WorldEntityUpdate();
            Inventory.BuildInventory(From, From.Char);
            From.SendSerialized(Inventory);

            WorldEntityUpdate Item = new WorldEntityUpdate();
            Item.BuildItem(From, From.Char);
            From.SendSerialized(Item);

            //////////////////////////////////////////////////////////////////////

            /**** One of them seem to delete object ***/

            ISerializablePacket Packet1 = new ISerializablePacket();
            Packet1.Opcode = 0x03F6;
            Packet1.AddField(0, EPacketFieldType.Raw4Bytes, new byte[4] { 0x20, 0xB1, 0x59, 0x41 });
            Packet1.AddField(1, EPacketFieldType.ByteArray, new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                             00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                             00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 });

            byte[] UnkGuid = new byte[8] { 0xCB, 0x34, 0x3D, 0x94, 0x23, 0x04, 0xCC, 0x01 };
            //Array.Reverse(UnkGuid);

            Packet1.AddField(2, EPacketFieldType.Raw8Bytes, UnkGuid);
            From.SendSerialized(Packet1);

            ISerializablePacket Packet2 = new ISerializablePacket();
            Packet2.Opcode = 0x02E9;
            Packet2.AddField(0, EPacketFieldType.List, new List<long>() { 3605869292 });
            From.SendSerialized(Packet2);

            ISerializablePacket Packet3 = new ISerializablePacket();
            Packet3.Opcode = 0x2D7F;
            From.SendSerialized(Packet3);

            /********************************************/

            WorldZoneInfo ZoneInfo = CacheMgr.Instance.GetZoneInfoCache("Mathosia1");
            From.SendSerialized(ZoneInfo);

            WorldStartingPosition StartPosition = new WorldStartingPosition();
            StartPosition.MapName = "guardian_map";
            From.SendSerialized(StartPosition);

            WorldPositionExtra ExtraPosition = new WorldPositionExtra();
            ExtraPosition.MapName = "guardian_map";

            ISerializablePacket Extra = new ISerializablePacket();
            Extra.Opcode = (long)Opcodes.WorldStartingPositionExtra;
            Extra.AddField(0, EPacketFieldType.Packet, ExtraPosition);
            From.SendSerialized(Extra);
        }
        public override void OnRead(RiftClient From)
        {
            Log.Success("Authentification", "Email = " + Email + " SessionTicket = " + SessionTicket);

            // TMP, Client must ALLWAYS provide SessionTicket, not sended because an invalid certificate probably
            Character PlrInfo = null;

            Account Acct = null;

            if (SessionTicket == 0)
            {
                Acct = AccountMgr.Instance.GetAccount(Email.ToUpper());
            }
            else
            {
                Acct = AccountMgr.Instance.GetAccountBySessionTicket(SessionTicket);
            }

            if (Acct == null)
            {
                Log.Error("Authentification", "Invalid WORLD_AUTH_REQUEST");
                From.Disconnect();
                return;
            }

            PlrInfo = CharacterMgr.Instance.GetCharacter((int)Acct.PendingCharacter);

            if (PlrInfo == null)
            {
                Log.Error("Authentification", "Invalid WORLD_AUTH_REQUEST");
                From.Disconnect();
                return;
            }

            From.Char = PlrInfo;

            WorldAuthenticationResponse Rp = new WorldAuthenticationResponse();

            Rp.AddField(0, EPacketFieldType.True, (bool)true);
            From.SendSerialized(Rp);

            WorldCacheUpdated Updated = new WorldCacheUpdated();

            Updated.GUID = PlrInfo.Id;
            From.SendSerialized(Updated);

            /////////////////////////////////////////////////////////////////////
            // Send Inventory
            /////////////////////////////////////////////////////////////////////

            WorldEntityUpdate Inventory = new WorldEntityUpdate();

            Inventory.BuildInventory(From, From.Char);
            From.SendSerialized(Inventory);

            WorldEntityUpdate Item = new WorldEntityUpdate();

            Item.BuildItem(From, From.Char);
            From.SendSerialized(Item);

            //////////////////////////////////////////////////////////////////////

            /**** One of them seem to delete object ***/

            ISerializablePacket Packet1 = new ISerializablePacket();

            Packet1.Opcode = 0x03F6;
            Packet1.AddField(0, EPacketFieldType.Raw4Bytes, new byte[4] {
                0x20, 0xB1, 0x59, 0x41
            });
            Packet1.AddField(1, EPacketFieldType.ByteArray, new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
                                                                         00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 });

            byte[] UnkGuid = new byte[8] {
                0xCB, 0x34, 0x3D, 0x94, 0x23, 0x04, 0xCC, 0x01
            };
            //Array.Reverse(UnkGuid);

            Packet1.AddField(2, EPacketFieldType.Raw8Bytes, UnkGuid);
            From.SendSerialized(Packet1);

            ISerializablePacket Packet2 = new ISerializablePacket();

            Packet2.Opcode = 0x02E9;
            Packet2.AddField(0, EPacketFieldType.List, new List <long>()
            {
                3605869292
            });
            From.SendSerialized(Packet2);

            ISerializablePacket Packet3 = new ISerializablePacket();

            Packet3.Opcode = 0x2D7F;
            From.SendSerialized(Packet3);

            /********************************************/

            WorldZoneInfo ZoneInfo = CacheMgr.Instance.GetZoneInfoCache("Mathosia1");

            From.SendSerialized(ZoneInfo);

            WorldStartingPosition StartPosition = new WorldStartingPosition();

            StartPosition.MapName = "guardian_map";
            From.SendSerialized(StartPosition);

            WorldPositionExtra ExtraPosition = new WorldPositionExtra();

            ExtraPosition.MapName = "guardian_map";

            ISerializablePacket Extra = new ISerializablePacket();

            Extra.Opcode = (long)Opcodes.WorldStartingPositionExtra;
            Extra.AddField(0, EPacketFieldType.Packet, ExtraPosition);
            From.SendSerialized(Extra);
        }