コード例 #1
0
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.IsSubclassOf(typeof(ISerializablePacket)))
     {
         Info.SetValue(Packet, val);
     }
 }
コード例 #2
0
 public override void OnRead(RiftClient From)
 {
     ISerializablePacket Packet = new ISerializablePacket();
     Packet.Opcode = 0x1E9A;
     Packet.AddField(1, EPacketFieldType.True, false);
     From.SendSerialized(Packet);
 }
コード例 #3
0
ファイル: BoolBit.cs プロジェクト: SageSBR/ChameleonProject
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(bool)))
     {
         Info.SetValue(Packet, val);
     }
 }
コード例 #4
0
ファイル: ListBit.cs プロジェクト: Easun/ChameleonProject
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            if (Field.Equals(typeof(List<uint>)))
            {
                List<uint> Luint = new List<uint>();
                foreach (ISerializableField Value in (List<ISerializableField>)val)
                    Luint.Add(Value.GetUint());
                Info.SetValue(Packet, Luint);
            }
            else if(Field.Equals(typeof(List<ISerializablePacket>)))
            {
                List<ISerializablePacket> Packets = new List<ISerializablePacket>();
                foreach (ISerializableField Value in (List<ISerializableField>)val)
                    Packets.Add(Value.GetPacket());
                Info.SetValue(Packet, Packets);
            }
            else if (Field.Equals(typeof(List<bool>)))
            {
                List<bool> Bools = new List<bool>();
                foreach (ISerializableField Value in (List<ISerializableField>)val)
                    Bools.Add((bool)Value.val);
                Info.SetValue(Packet, Bools);
            }
            else if (Field.Equals(typeof(List<float>)))
            {
                List<float> floats = new List<float>();
                foreach (ISerializableField Value in (List<ISerializableField>)val)
                    floats.Add(Value.GetFloat());

                Info.SetValue(Packet, floats);
            }
        }
コード例 #5
0
ファイル: ArrayBit.cs プロジェクト: alterego21/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(byte[])))
         Info.SetValue(Packet, val);
     else if(Field.Equals(typeof(string)))
         Info.SetValue(Packet,Marshal.ConvertToString((byte[])val));
 }
コード例 #6
0
        public static PacketOutStream WritePacket(ISerializablePacket Packet)
        {
            PacketOutStream Stream = new PacketOutStream();

            WritePacket(ref Stream, Packet, true, true, true);

            return(Stream);
        }
コード例 #7
0
ファイル: Raw8Bit.cs プロジェクト: alterego21/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(byte[])))
         Info.SetValue(Packet, (byte[])val);
     else if (Field.Equals(typeof(long)))
     {
         Array.Reverse((val as byte[]));
         Info.SetValue(Packet, BitConverter.ToInt64((byte[])val, 0));
     }
 }
コード例 #8
0
ファイル: ArrayBit.cs プロジェクト: dsstest/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(byte[])))
     {
         Info.SetValue(Packet, val);
     }
     else if (Field.Equals(typeof(string)))
     {
         Info.SetValue(Packet, Marshal.ConvertToString((byte[])val));
     }
 }
コード例 #9
0
ファイル: Raw8Bit.cs プロジェクト: dsstest/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(byte[])))
     {
         Info.SetValue(Packet, (byte[])val);
     }
     else if (Field.Equals(typeof(long)))
     {
         Array.Reverse((val as byte[]));
         Info.SetValue(Packet, BitConverter.ToInt64((byte[])val, 0));
     }
 }
コード例 #10
0
ファイル: DicBit.cs プロジェクト: alterego21/SiennaCore
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            if (Field.Equals(typeof(Dictionary<long, ISerializablePacket>)))
            {
                Dictionary<long, ISerializablePacket> Dic = new Dictionary<long, ISerializablePacket>();

                foreach (KeyValuePair<ISerializableField, ISerializableField> KP in (val as Dictionary<ISerializableField, ISerializableField>))
                {
                    Dic.Add((long)KP.Key.GetLong(), KP.Value.GetPacket());
                }

                Info.SetValue(Packet, Dic);
            }
        }
コード例 #11
0
ファイル: Raw4Bit.cs プロジェクト: alterego21/SiennaCore
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            byte[] Data = val as byte[];
            object Result = Data;

            if(Field.Equals(typeof(UInt32)))
                Result = Marshal.ConvertToUInt32(Data[3], Data[2], Data[1], Data[0]);
            else if(Field.Equals(typeof(Int32)))
                Result = BitConverter.ToInt32(Data, 0);
            else if(Field.Equals(typeof(long)))
                Result = (long)BitConverter.ToUInt32(Data,0);

            Info.SetValue(Packet, Result);
        }
コード例 #12
0
ファイル: RiftClient.cs プロジェクト: dsstest/SiennaCore
        public void SendSerialized(ISerializablePacket Packet)
        {
            PacketOutStream Out = PacketProcessor.WritePacket(Packet);

            byte[] ToSend = Out.ToArray();
            SendTCP(ToSend);

            List <Cache_Info> Entries = CacheMgr.Instance.GetBinCache(Packet.Opcode, false);

            foreach (Cache_Info Entry in Entries)
            {
                SendCache(Entry.Type, (uint)Entry.CacheId);
            }
        }
コード例 #13
0
ファイル: DicBit.cs プロジェクト: dsstest/SiennaCore
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            if (Field.Equals(typeof(Dictionary <long, ISerializablePacket>)))
            {
                Dictionary <long, ISerializablePacket> Dic = new Dictionary <long, ISerializablePacket>();

                foreach (KeyValuePair <ISerializableField, ISerializableField> KP in (val as Dictionary <ISerializableField, ISerializableField>))
                {
                    Dic.Add((long)KP.Key.GetLong(), KP.Value.GetPacket());
                }

                Info.SetValue(Packet, Dic);
            }
        }
コード例 #14
0
        public override void OnRead(RiftClient From)
        {
            Character[] Chars = CharacterMgr.Instance.GetCharacters(From.Acct.Id, From.Realm.RealmId);

            long pGUID = ByteOperations.ByteSwap.Swap(GUID);

            foreach (Character charac in Chars)
                if (charac.Id == pGUID)
                    CharacterMgr.Instance.RemoveObject(charac);

            ISerializablePacket DeleteResult = new ISerializablePacket();
            DeleteResult.Opcode = (long)Opcodes.LobbyCharacterDeleteOk;
            DeleteResult.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)0); // Result, 15 Error must wait logout, 0 OK

            From.SendSerialized(DeleteResult);
        }
コード例 #15
0
        public override void OnRead(RiftClient From)
        {
            Log.Debug("LobbyCharacterDelete", "GUID = " + GUID);

            Character Char = CharacterMgr.Instance.GetCharacter((int)GUID);
            if (Char != null && Char.AccountId == From.Acct.Id)
            {
                CharacterMgr.Instance.RemoveObject(Char);

                foreach (Character_Item Itm in CharacterMgr.Instance.GetPlayerItems(Char.Id))
                    CharacterMgr.Instance.RemoveObject(Itm);
            }

            ISerializablePacket DeleteResult = new ISerializablePacket();
            DeleteResult.Opcode = (long)Opcodes.LobbyCharacterDeleteResponse;
            DeleteResult.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)0); // Result, 15 Error must wait logout, 0 OK
            From.SendSerialized(DeleteResult);
        }
コード例 #16
0
ファイル: Raw4Bit.cs プロジェクト: dsstest/SiennaCore
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            byte[] Data   = val as byte[];
            object Result = Data;

            if (Field.Equals(typeof(UInt32)))
            {
                Result = Marshal.ConvertToUInt32(Data[3], Data[2], Data[1], Data[0]);
            }
            else if (Field.Equals(typeof(Int32)))
            {
                Result = BitConverter.ToInt32(Data, 0);
            }
            else if (Field.Equals(typeof(long)))
            {
                Result = (long)BitConverter.ToUInt32(Data, 0);
            }

            Info.SetValue(Packet, Result);
        }
コード例 #17
0
ファイル: ListBit.cs プロジェクト: SageSBR/ChameleonProject
        public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
        {
            if (Field.Equals(typeof(List <uint>)))
            {
                List <uint> Luint = new List <uint>();
                foreach (ISerializableField Value in (List <ISerializableField>)val)
                {
                    Luint.Add(Value.GetUint());
                }
                Info.SetValue(Packet, Luint);
            }
            else if (Field.Equals(typeof(List <ISerializablePacket>)))
            {
                List <ISerializablePacket> Packets = new List <ISerializablePacket>();
                foreach (ISerializableField Value in (List <ISerializableField>)val)
                {
                    Packets.Add(Value.GetPacket());
                }
                Info.SetValue(Packet, Packets);
            }
            else if (Field.Equals(typeof(List <bool>)))
            {
                List <bool> Bools = new List <bool>();
                foreach (ISerializableField Value in (List <ISerializableField>)val)
                {
                    Bools.Add((bool)Value.val);
                }
                Info.SetValue(Packet, Bools);
            }
            else if (Field.Equals(typeof(List <float>)))
            {
                List <float> floats = new List <float>();
                foreach (ISerializableField Value in (List <ISerializableField>)val)
                {
                    floats.Add(Value.GetFloat());
                }

                Info.SetValue(Packet, floats);
            }
        }
コード例 #18
0
        public override void Deserialize(ref PacketInStream Data)
        {
            long Opcode = Data.ReadEncoded7Bit();
            PacketHandlerDefinition Handler = PacketProcessor.GetPacketHandler(Opcode);
            ISerializablePacket     Packet  = Activator.CreateInstance(Handler.GetClass()) as ISerializablePacket;

            Packet.Opcode = Opcode;

            ISerializableField Field = null;

            Log.Debug("Packet", "----------------------> New " + Opcode.ToString("X8"));

            while ((Field = PacketProcessor.ReadField(ref Data)) != null)
            {
                Log.Success("Packet", "------> ++T : " + Field.PacketType);
                Packet.AddField(Field.Index, Field);
            }

            Log.Debug("Packet", "----------------------> End ");

            Packet.ApplyToFieldInfo();
            val = Packet;
        }
コード例 #19
0
        public static bool WritePacket(ref PacketOutStream Stream, ISerializablePacket Packet, bool WithSize = true, bool WithTerminator = true, bool WithOpcode = true)
        {
            if (Packet == null)
            {
                Log.Error("WritePacket", "Packet == null");
                return(false);
            }

            Packet.ConvertToField();

            PacketOutStream Data = new PacketOutStream();

            if (WithOpcode)
            {
                Data.WriteEncoded7Bit(Packet.Opcode);
            }

            foreach (ISerializableField Field in Packet.GetFields().Values)
            {
                WriteField(ref Data, Field);
            }

            if (WithTerminator && Packet.Opcode != (int)Opcodes.ProtocolHandshakeCompression)
            {
                WriteField(ref Data, null, 0, (int)EPacketFieldType.Terminator);
            }

            if (WithSize)
            {
                Stream.WriteEncoded7Bit(Data.Length);
            }

            Stream.Write(Data.ToArray());

            return(true);
        }
コード例 #20
0
        public void BuildChar(Character Char)
        {
            // NO_CACHE_REF
            this.AddField(4, EPacketFieldType.Unsigned7BitEncoded, (long)1001);
            this.AddField(7, EPacketFieldType.True, true);

            GUID = Char.Id;

            if(Packets == null)
                Packets = new List<ISerializablePacket>();

            // Unk Packet
            ISerializablePacket UnkPck = new ISerializablePacket();
            UnkPck.Opcode = 0x0259;
            UnkPck.AddField(3, EPacketFieldType.Raw4Bytes, (float)50.0f);

            // World Position
            ISerializablePacket posextra = GetFieldByOpcode((long)Opcodes.WorldPositionExtra);
            UpdateClientPosition(Char, ref posextra);

            ISerializablePacket UnkPck3 = new ISerializablePacket();
            UnkPck3.Opcode = 0x026B;

            Packets.Add(UnkPck);
            Packets.Add(CreateJunk(0x025A));

            // Dic
            //Packets.Add(CreateJunk(0x026B));

            Packets.Add(CreateJunk(0x026E));

            // Unk Data, Social Related
            /*ISerializablePacket UnkPck4 = new ISerializablePacket();
            UnkPck4.Opcode = 0x0272;
            ISerializablePacket UnkPck4Pck = new ISerializablePacket();
            UnkPck4Pck.Opcode = 0x0CC;
            UnkPck4Pck.AddField(3, EPacketFieldType.Unsigned7BitEncoded, (long)907);
            UnkPck4Pck.AddField(5, EPacketFieldType.Unsigned7BitEncoded, (long)1501);
            UnkPck4.AddField(1, EPacketFieldType.Packet, UnkPck4Pck);
            Packets.Add(UnkPck4);*/
            Packets.Add(CreateJunk(0x0272));

            // Friend List ?
            Packets.Add(CreateJunk(0x0289));

            // Guild ?
            Packets.Add(CreateJunk(0x028A));

            // Another Social Junk ?
            ISerializablePacket UnkPck5 = new ISerializablePacket();
            UnkPck5.Opcode = 0x028F;
            ISerializablePacket UnkPck5Pck = new ISerializablePacket();
            UnkPck5Pck.Opcode = 0x0354;
            UnkPck5Pck.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)2);
            UnkPck5.AddField(4, EPacketFieldType.Packet, UnkPck5Pck);
            Packets.Add(UnkPck5);

            ISerializablePacket CharInfo = GetFieldByOpcode(0x02AE);
            ISerializablePacket CharStats = GetFieldByOpcode(0x0294);

            PrepareCharInfo(Char, ref CharInfo);
            PrepareStatsInfo(Char, ref CharStats);

            /*Packets.Add(CreateJunk(0x033A));
            Packets.Add(CreateJunk(0x08A2));*/

            // Others

            Packets.Add(CreateJunk(0x08FC));

            // Others2

            /*Packets.Add(CreateJunk(0x0F41));
            Packets.Add(CreateJunk(0x0F45));*/

            // 0x1A20 Macro Related
        }
コード例 #21
0
 public abstract void ApplyToFieldInfo(FieldInfo Info,ISerializablePacket Packet, Type Field);
コード例 #22
0
ファイル: RiftClient.cs プロジェクト: dsstest/SiennaCore
        public bool ReadPacket()
        {
            if (Received.Count <= 0)
            {
                return(false);
            }

            if (!ReceiveCompress && !Crypted)
            {
                PacketInStream Packet = new PacketInStream(Received.ToArray(), Received.Count);
                long           Size   = Packet.ReadEncoded7Bit();

                if (Size > Packet.Length)
                {
                    return(false);
                }

                Received.RemoveRange(0, (int)(Packet.Position + Size));

                ISerializablePacket Pack = PacketProcessor.ReadPacket(ref Packet);
                if (Pack != null)
                {
                    Pack.OnRead(this);

                    List <Cache_Info> Entries = CacheMgr.Instance.GetBinCache(Pack.Opcode, true);

                    foreach (Cache_Info Entry in Entries)
                    {
                        SendCache(Entry.Type, (uint)Entry.CacheId);
                    }
                }

                return(true);
            }

            if (Crypted)
            {
                byte[] Packet = Received.ToArray();
                Received.Clear();
                Decrypt(Packet);
            }

            if (ReceiveCompress)
            {
                int End = -1;
                while ((End = GetEndCompression(ref Decrypted)) >= 0)
                {
                    byte[] ToUnCompress = new byte[End];
                    Buffer.BlockCopy(Decrypted.ToArray(), 0, ToUnCompress, 0, End);
                    Decrypted.RemoveRange(0, End);

                    byte[] Result = UnCompress(ToUnCompress);

                    Log.Dump("Decrypted", Result, 0, Result.Length);
                    PacketInStream Packet = new PacketInStream(Result, Result.Length);
                    long           Size   = Packet.ReadEncoded7Bit();

                    if (Size > Packet.Length)
                    {
                        Log.Error("ReadPacket", "Size > Packet.Lenght,Size=" + Size + ",Lenght=" + Packet.Length);
                        continue;
                    }

                    ISerializablePacket Pack = PacketProcessor.ReadPacket(ref Packet);
                    if (Pack != null)
                    {
                        Pack.OnRead(this);

                        List <Cache_Info> Entries = CacheMgr.Instance.GetBinCache(Pack.Opcode, true);

                        foreach (Cache_Info Entry in Entries)
                        {
                            SendCache(Entry.Type, (uint)Entry.CacheId);
                        }
                    }
                }
            }

            return(false);
        }
コード例 #23
0
        public override void OnRead(RiftClient From)
        {
            long CharacterId = From.Char.Id;

            {
                WorldTemplateUpdate Update = new WorldTemplateUpdate();
                Update.GUID = CharacterId;
                Update.Field1 = new byte[]
                {
                    0xEB,0x04,0x4F,0x1F,0x02,0x5F,0x17,0x07,0x90,0x01,0x07,0xAE,0x05,0x9E,0x02,0x00,0x9F,
                    0x12,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDF,0x12,0x24,
                    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD0,
                    0x05,0xD8,0x05,0x07,0xC1,0x1E,0x57,0xF5,0x05,0x07,0x07
                };
                From.SendSerialized(Update);
            }

            {
                ISerializablePacket Packet = new ISerializablePacket();
                Packet.Opcode = 0x1973;
                From.SendSerialized(Packet);
            }

            {
                ISerializablePacket Packet = new ISerializablePacket();
                Packet.Opcode = 0x1E7F;
                Packet.AddField(0, EPacketFieldType.False, false);
                Packet.AddField(1, EPacketFieldType.False, false);
                Packet.AddField(2, EPacketFieldType.False, false);

                Packet.AddField(3, EPacketFieldType.List, new List<ISerializablePacket>());

                Packet.AddField(4, EPacketFieldType.Unsigned7BitEncoded, (long)3);
                Packet.AddField(5, EPacketFieldType.Unsigned7BitEncoded, (long)30);

                Packet.AddField(6, EPacketFieldType.False, false);

                Packet.AddField(7, EPacketFieldType.List, new List<long>());
                Packet.AddField(8, EPacketFieldType.List, new List<long>());
                From.SendSerialized(Packet);
            }

            {
                WorldChannelJoinned Channel = new WorldChannelJoinned();
                Channel.ChannelName = "Niveau 1-9";
                Channel.CharacterName = From.Char.Name;
                Channel.Field2 = 5;
                From.SendSerialized(Channel);
            }

            {
                WorldChannelJoinned Channel = new WorldChannelJoinned();
                Channel.ChannelName = "Mathosia";
                Channel.CharacterName = From.Char.Name;
                Channel.Field2 = 2;
                From.SendSerialized(Channel);
            }

            {
                WorldTemplateUpdate Update = new WorldTemplateUpdate();
                Update.GUID = CharacterId;
                Update.Field1 = new byte[]
                {
            0xEB,0x04,0x4F,0x1F,0x02,0x5F,0x17,0x07,0xE7,0x02,0xBB,0x99,0x01,0x4E,0xA0,0x1F,0x1A,0x02,0x07,0x56,0xA0,0x1F,0x1A,0x02,0x07,0x58,0xA0,0x1F,0x1A,0x02,0x07,0x5E,0xA0,0x1F,0x19,0x07,0x60,0xA0,0x1F,0x19,0x07,0x66,0xA0,0x1F,0x19,0x07,0x70,0xA0,0x1F,0x1A,0x02,0x07,0xEA,0xBA,0xC9,0x65,0xA0,0x1F,0x19,0x07,0xAC,0xBA,0xEE,0x78,0xA0,0x1F,0x1A,0x02,0x07,0xA0,0x8C,0x88,0x9C,0x01,0xA0,0x1F,0x19,0x07,0x90,0xD6,0xBA,0x88,0x02,0xA0,0x1F,0x1A,0x02,0x07,0xD8,0xD2,0x84,0xAA,0x02,0xA0,0x1F,0x1A,0x02,0x07,0x9E,0x83,0x90,0x87,0x03,0xA0,0x1F,0x1A,0x02,0x07,0x8C,0xE7,0xF5,0x8E,0x03,0xA0,0x1F,0x1A,0x02,0x07,0x86,0xDE,0x9D,0xE9,0x03,0xA0,0x1F,0x19,0x07,0xF6,0xD4,0xCE,0xF4,0x03,0xA0,0x1F,0x1A,0x02,0x07,0xE2,0xA8,0xF2,0x8A,0x04,0xA0,0x1F,0x1A,0x02,0x07,0xD2,0x92,0xCB,0xB3,0x05,0xA0,0x1F,0x19,0x07,0xE0,0xFD,0xF3,0x92,0x06,0xA0,0x1F,0x1A,0x02,0x07,0xE6,0xB7,0xF4,0x94,0x06,0xA0,0x1F,0x1A,0x02,0x07,0xAE,0xBA,0xFD,0xC6,0x06,0xA0,0x1F,0x1A,0x02,0x07,0xB6,0xA5,0xF2,0x8C,0x07,0xA0,0x1F,0x19,0x07,0xC2,0xE4,0xA7,0x9A,0x07,0xA0,0x1F,0x1A,0x02,0x07,0xDE,0x9A,0xE4,0xCA,0x07,0xA0,0x1F,0x19,0x07,0xEC,0xF9,0xF1,0xDF,0x07,0xA0,0x1F,0x1A,0x02,0x07,0xA4,0xDE,0xC0,0xB1,0x08,0xA0,0x1F,0x1A,0x02,0x07,0xE8,0xCE,0xFA,0x81,0x09,0xA0,0x1F,0x1A,0x02,0x07,0x94,0xB1,0xA8,0xBB,0x09,0xA0,0x1F,0x1A,0x02,0x07,0x8A,0x95,0x8E,0xC8,0x09,0xA0,0x1F,0x1A,0x02,0x07,0xD8,0xF7,0xF3,0xFD,0x09,0xA0,0x1F,0x1A,0x02,0x07,0xFA,0xF1,0xE0,0xBA,0x0A,0xA0,0x1F,0x1A,0x02,0x07,0xCE,0xDA,0xE7,0xEE,0x0B,0xA0,0x1F,0x19,0x07,0xF6,0xA2,0x94,0xC1,0x0C,0xA0,0x1F,0x1A,0x02,0x07,0xE2,0xD0,0xE6,0xD0,0x0C,0xA0,0x1F,0x1A,0x02,0x07,0x88,0xFD,0xC2,0xD6,0x0D,0xA0,0x1F,0x1A,0x02,0x07,0x8C,0xA8,0xAA,0xF8,0x0D,0xA0,0x1F,0x19,0x07,0x88,0xBF,0x82,0xFE,0x0E,0xA0,0x1F,0x1A,0x02,0x07,0xBA,0xC4,0xB6,0x90,0x0F,0xA0,0x1F,0x1A,0x02,0x07,0xE7,0x03,0xBB,0x05,0x0A,0xAF,0x02,0x01,0x07,0x90,0x01,0x07,0x94,0x05,0xE7,0x05,0xBB,0x21,0x02,0xBF,0x1B,0x24,0xDF,0x92,0xC3,0x45,0x2C,0xC8,0x23,0xCF,0x7D,0x3C,0x82,0x9B,0xBB,0x22,0x97,0x04,0x90,0x1C,0x04,0x9B,0xEC,0x3E,0x73,0x07,0x07,0x04,0xBF,0x1B,0x24,0xEB,0x36,0xDE,0x44,0x2C,0x33,0x45,0x7A,0x77,0x32,0x15,0x3C,0x82,0x9B,0xBB,0x22,0x97,0x04,0x90,0x1C,0x04,0x5F,0x2D,0x02,0x4F,0x07,0x07,0x0A,0xBF,0x1B,0x24,0x87,0xD4,0x3F,0x5B,0x3A,0x02,0x97,0x04,0x90,0x1C,0x04,0x1E,0x3B,0xD5,0x2D,0x07,0x07,0x0E,0xBF,0x1B,0x24,0x62,0x00,0xDB,0x11,0x3C,0x6F,0x69,0x28,0x59,0x97,0x04,0x90,0x1C,0x04,0x7F,0xC2,0xC0,0x7C,0x07,0x07,0x10,0xBF,0x1B,0x24,0x9A,0x41,0xDC,0x01,0x3C,0x6F,0x69,0x28,0x59,0x97,0x04,0x90,0x1C,0x04,0x5E,0x8B,0x6F,0x26,0x07,0x07,0x12,0xBF,0x1B,0x24,0x9E,0xFC,0x62,0x77,0x3C,0x82,0x9B,0xBB,0x22,0x97,0x04,0x90,0x1C,0x04,0xB7,0x94,0xB3,0x29,0x07,0x07,0x16,0xBF,0x1B,0x24,0x48,0xF1,0xD4,0x0D,0x32,0x14,0x3C,0x6F,0x69,0x28,0x59,0x97,0x04,0x90,0x1C,0x04,0x8A,0x09,0x42,0x17,0x07,0x07,0x2E,0xBF,0x1B,0x24,0xE6,0x82,0x84,0x33,0x3C,0xB3,0xCD,0x6F,0x6A,0x97,0x04,0x90,0x1C,0x04,0x53,0x58,0x26,0x30,0x07,0x07,0x9F,0x06,0x57,0xA9,0x0E,0x02,0x03,0x2A,0xE8,0x07,0x41,0x07,0xDF,0x06,0x57,0x94,0x0E,0x07,0xD7,0x07,0xC2,0x05,0x12,0x05,0xDF,0x05,0x93,0x07,0x06,0xC6,0x01,0x14,0x14,0x1A,0x14,0x12,0x00,0x14,0x14,0x14,0x14,0x14,0x02,0x16,0x1A,0x00,0x00,0x00,0x00,0x8C,0x02,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0xCC,0x0B,0xD0,0x0F,0xC8,0x01,0x14,0x04,0x00,0x00,0x14,0x00,0x00,0x00,0xC8,0x01,0xC8,0x01,0x00,0x00,0x06,0x00,0xC8,0x01,0x00,0x00,0x00,0x00,0x00,0xC8,0x01,0x00,0x00,0x00,0x14,0x00,0x14,0x00,0x00,0xD0,0x0F,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x01,0x00,0x00,0x00,0xC8,0x01,0xC8,0x01,0xC8,0x01,0xC8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC8,0x01,0x00,0x00,0x00,0xDF,0x06,0x93,0x07,0x06,0xC6,0x01,0x14,0x14,0x1A,0x14,0x12,0x00,0x14,0x14,0x14,0x14,0x14,0x02,0x16,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0xCC,0x0B,0xD0,0x0F,0xC8,0x01,0x14,0x04,0x00,0x00,0x14,0x00,0x00,0x00,0xC8,0x01,0xC8,0x01,0x00,0x00,0x06,0x00,0xC8,0x01,0x00,0x00,0x00,0x00,0x00,0xC8,0x01,0x00,0x00,0x00,0x14,0x00,0x14,0x00,0x00,0xD0,0x0F,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x01,0x00,0x00,0x00,0xC8,0x01,0xC8,0x01,0xC8,0x01,0xC8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC8,0x01,0x00,0x00,0x00,0x07,0xDA,0x01,0x0F,0xE4,0x01,0x82,0x86,0x19,0x66,0x07,0xAE,0x05,0x97,0x04,0xF4,0x05,0x0C,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,0x07,0x9F,0x1E,0x97,0x02,0xB6,0x0E,0x01,0xDF,0x01,0xD7,0x01,0x90,0x1C,0x07,0x90,0x1C,0x07,0x90,0x1C,0x07,0x07,0xB6,0x0E,0xDF,0x01,0xD7,0x01,0x90,0x1C,0x07,0x90,0x1C,0x07,0x90,0x1C,0x07,0x07,0xB6,0x0E,0xDF,0x01,0xD7,0x01,0x90,0x1C,0x07,0x90,0x1C,0x07,0x90,0x1C,0x07,0x07,0xB6,0x0E,0xDF,0x01,0xD7,0x01,0x90,0x1C,0x07,0x90,0x1C,0x07,0x90,0x1C,0x07,0x07,0x07,0xC1,0x1E,0x57,0xF5,0x05,0x0F,0x1F,0x0A,0x01,0x5F,0x0B,0x84,0x9A,0xCC,0xE1,0x0C,0x07,0x4F,0x1F,0x0A,0x01,0x5F,0x0B,0x1E,0x07,0x07,0x9F,0x07,0x2B,0x06,0x08,0x18,0x04,0x02,0x07
                };
                From.SendSerialized(Update);
            }

            {
                byte[] data = CharacterMgr.Instance.GetBuild(1);
                PacketInStream ps = new PacketInStream(data, data.Length);
                WorldEntityUpdate EntPck = (WorldEntityUpdate)PacketProcessor.ReadPacket(ref ps); //new WorldEntityUpdate();
                EntPck.BuildChar(From.Char);
                From.SendSerialized(EntPck);
            }

            WorldServerMOTD Motd = new WorldServerMOTD();
            Motd.Text = ConfigMgr.GetConfig<WorldConfig>().ServerMOTD;
            From.SendSerialized(Motd);
        }
コード例 #24
0
        public override void OnRead(RiftClient From)
        {
            if (Message.StartsWith(".teleport"))
            {
                string CmdArgs = Message.Substring(10);
                string[] pos = CmdArgs.Split(new char[] { ' ' });

                WorldServerPositionUpdate WPos = new WorldServerPositionUpdate();

                WPos.GUID = From.Char.Id;

                WPos.Position = new List<float>();
                WPos.Position.Add(float.Parse(pos[0]));
                WPos.Position.Add(float.Parse(pos[1]));
                WPos.Position.Add(float.Parse(pos[2]));

                WPos.Orientation = new List<float>();
                WPos.Orientation.Add(0.0f);
                WPos.Orientation.Add(0.0f);
                WPos.Orientation.Add(0.0f);

                if (long.Parse(pos[3]) != CurrentMapId)
                {
                    WorldTeleport WorldPort = WorldTeleport.FromPorticulum(long.Parse(pos[3]), 1, 0, "tm_Sanctum_SanctumOfTheVigil");
                    From.SendSerialized(WorldPort);

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

                    WorldStartingPosition StartPos = new WorldStartingPosition();
                    StartPos.MapName = "world";
                    StartPos.Position = new List<float>(WPos.Position.ToArray());

                    From.SendSerialized(StartPos);

                    ISerializablePacket PacketContainer = new ISerializablePacket();
                    WorldPositionExtra StartPos2 = new WorldPositionExtra();
                    StartPos2.MapName = "world";
                    StartPos2.MapId = 2;
                    StartPos2.Position = new List<float>(WPos.Position.ToArray());
                    StartPos2.Position2 = new List<float>(WPos.Position.ToArray());

                    PacketContainer.Opcode = (long)Opcodes.WorldStartingPositionExtra;
                    PacketContainer.AddField(0, EPacketFieldType.Packet, StartPos2);

                    From.SendSerialized(PacketContainer);

                    CurrentMapId = long.Parse(pos[3]);

                    List<Cache_Info> CacheData = CacheMgr.Instance.GetBinCache(11319, false);

                    foreach (Cache_Info ci in CacheData)
                        From.SendCache(ci.Type, (uint)ci.CacheId);

                    //From.SendSerialized(WPos);

                }
                else
                    From.SendSerialized(WPos);
            }
            else
            {
                PlayerName = "Magetest";
                Unk1 = 2551;
                Unk2 = 2551;
                From.SendSerialized(this);
            }
        }
コード例 #25
0
 public abstract void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field);
コード例 #26
0
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.IsSubclassOf(typeof(ISerializablePacket)))
         Info.SetValue(Packet, val);
 }
コード例 #27
0
ファイル: Unsigned7Bit.cs プロジェクト: dsstest/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     Info.SetValue(Packet, (long)val);
 }
コード例 #28
0
ファイル: BoolBit.cs プロジェクト: alterego21/SiennaCore
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     if (Field.Equals(typeof(bool)))
         Info.SetValue(Packet, val);
 }
コード例 #29
0
        protected void SetItemInBagSlot(ref Dictionary<long, ISerializablePacket> IInvDic, long Slot, long ItemGUID)
        {
            ISerializablePacket ItemInfo = new ISerializablePacket();
            ItemInfo.Opcode = 0x012E;
            ItemInfo.AddField(0, EPacketFieldType.Raw8Bytes, ItemGUID);

            IInvDic.Add(Slot, ItemInfo);
        }
コード例 #30
0
 protected void UpdateClientPosition(Character Char, ref ISerializablePacket pck)
 {
     WorldPositionExtra WorldPos = pck as WorldPositionExtra;
     WorldPos.MapId = 676;
     WorldPos.Position = new List<float> { 1113.03967f, 920.1114f, 1444.58533f }; // X,Y,Z
     WorldPos.MapName = "guardian_map";
 }
コード例 #31
0
        // 0x294 = STATS_DEFINITION ?
        protected void PrepareStatsInfo(Character Char, ref ISerializablePacket pck)
        {
            // CHAR_CLASS, CRASH CLIENT ...
            //pck.AddField(2, EPacketFieldType.Unsigned7BitEncoded, (long)Char.Class);

            Items_Template[] Templates = CharacterMgr.Instance.GetEquipedItems(Char.Id);

            Dictionary<long, ISerializablePacket> CharDesc = new Dictionary<long, ISerializablePacket>();

            foreach (Items_Template Template in Templates)
            {
                Model_Info model = CharacterMgr.Instance.GetItemModel(Template.ModelEntry, Char.Race, Char.Sex);

                CharacterDesc Desc = new CharacterDesc();

                Desc.AddField(4, EPacketFieldType.Raw4Bytes, (uint)model.Field_4);

                if (model.Field_5 != 0)
                    Desc.AddField(5, EPacketFieldType.Raw4Bytes, model.Field_5);

                if (model.Field_6 != 0)
                    Desc.AddField(6, EPacketFieldType.Raw4Bytes, model.Field_6);

                if (Template.Slot == 10)
                    Desc.AddField(7, EPacketFieldType.Unsigned7BitEncoded, (long)model.Field_7);
                else
                    Desc.AddField(7, EPacketFieldType.Raw4Bytes, (uint)model.Field_7);

                Desc.Field8 = new CharacterInfoCache();
                Desc.Field8.CacheIdentifier = (uint)model.CacheID;

                CharDesc.Add((long)Template.Slot, Desc);
            }

            Model_Info HairEntry = CharacterMgr.Instance.GetModelForCacheID(Char.HairModelID);

            if (HairEntry != null)
            {
                CharacterDesc DescHair = new CharacterDesc();

                DescHair.AddField(4, EPacketFieldType.Raw4Bytes, (uint)HairEntry.Field_4);
                DescHair.AddField(7, EPacketFieldType.Raw4Bytes, (uint)HairEntry.Field_7);

                DescHair.Field8 = new CharacterInfoCache();
                DescHair.Field8.CacheIdentifier = (uint)HairEntry.CacheID;

                CharDesc.Add((long)46, DescHair);
            }

            pck.AddField(11, EPacketFieldType.Dictionary, CharDesc);
        }
コード例 #32
0
        // 0x2AE = CHARACTER_DEFINITION ?
        protected void PrepareCharInfo(Character Char, ref ISerializablePacket pck)
        {
            pck.AddField(12, EPacketFieldType.ByteArray, Char.Name);

            Realm realm_data = CharacterMgr.Instance.GetRealm((byte)Char.RealmId);
            realm_data.GenerateName();

            pck.AddField(54, EPacketFieldType.Unsigned7BitEncoded, realm_data.RiftId);

            byte[] CustomData = Shared.NetWork.Marshal.StringToUTF8ByteArray(Char.Data);
            PacketInStream CustomStream = new PacketInStream(CustomData, CustomData.Length);
            pck.AddField(56, EPacketFieldType.Packet, PacketProcessor.ReadPacket(ref CustomStream) as CharacterCustom);

            // Field 60
            // Character Specializations
        }
コード例 #33
0
        public void BuildItem(RiftClient From, Character Char)
        {
            GUID = 45875261658941;

            // Cache Ref
            this.AddField(4, EPacketFieldType.Raw4Bytes, (int)456805300);
            this.AddField(6, EPacketFieldType.Raw8Bytes, (long)Char.Id);

            // Unk, Equiped ?
            this.AddField(7, EPacketFieldType.Unsigned7BitEncoded, (long)3);

            Packets = new List<ISerializablePacket>();

            ISerializablePacket DataList = new ISerializablePacket();

            ISerializablePacket NullPck = new ISerializablePacket();
            NullPck.Opcode = 0x026D;

            ISerializablePacket NullPck2 = new ISerializablePacket();
            NullPck2.Opcode = 0x033A;

            Packets.Add(NullPck);
            Packets.Add(NullPck2);

            ISerializablePacket ItemDatas = new ISerializablePacket();
            ItemDatas.Opcode = 0x026C;

            // Unk Slot ?
            ItemDatas.AddField(1, EPacketFieldType.Unsigned7BitEncoded, (long)2);

            CharacterInfoCache Cache = new CharacterInfoCache();
            Cache.CacheIdentifier = 456805300;

            ItemDatas.AddField(10, EPacketFieldType.Packet, Cache);

            From.SendCache(7310, 506516265);
            From.SendCache(623, 456805300);

            Packets.Add(ItemDatas);
        }
コード例 #34
0
        public static PacketOutStream WritePacket(ISerializablePacket Packet)
        {
            PacketOutStream Stream = new PacketOutStream();

            WritePacket(ref Stream, Packet,true,true,true);

            return Stream;
        }
コード例 #35
0
 public override void OnRead(RiftClient From)
 {
     ISerializablePacket Packet = new ISerializablePacket();
     Packet.Opcode = (long)Opcodes.LobbyCharacterCreationCacheResponse;
     From.SendSerialized(Packet);
 }
コード例 #36
0
 public override void ApplyToFieldInfo(FieldInfo Info, ISerializablePacket Packet, Type Field)
 {
     Info.SetValue(Packet, (long)val);
 }
コード例 #37
0
        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);
        }
コード例 #38
0
 private ISerializablePacket CreateJunk(long Opcode)
 {
     ISerializablePacket Junk = new ISerializablePacket();
     Junk.Opcode = Opcode;
     return Junk;
 }
コード例 #39
0
ファイル: RiftClient.cs プロジェクト: alterego21/SiennaCore
        public void SendSerialized(ISerializablePacket Packet)
        {
            PacketOutStream Out = PacketProcessor.WritePacket(Packet);

            byte[] ToSend = Out.ToArray();
            SendTCP(ToSend);

            List<Cache_Info> Entries = CacheMgr.Instance.GetBinCache(Packet.Opcode, false);

            foreach (Cache_Info Entry in Entries)
                SendCache(Entry.Type, (uint)Entry.CacheId);
        }
コード例 #40
0
        public void BuildInventory(RiftClient From, Character Char)
        {
            GUID = 45875261658940;

            // Cache Ref
            this.AddField(4, EPacketFieldType.Raw4Bytes, (int)935832306);
            this.AddField(6, EPacketFieldType.Raw8Bytes, (long)Char.Id);

            // Unk, Equiped ?
            this.AddField(7, EPacketFieldType.Unsigned7BitEncoded, (long)3);

            Packets = new List<ISerializablePacket>();

            ISerializablePacket ItemDatas = new ISerializablePacket();
            ItemDatas.Opcode = 0x026C;

            // Unk Slot ?
            ItemDatas.AddField(1, EPacketFieldType.Unsigned7BitEncoded, (long)2);

            CharacterInfoCache Cache = new CharacterInfoCache();
            Cache.CacheIdentifier = 935832306;

            ISerializablePacket IInventory = new ISerializablePacket();
            IInventory.Opcode = 0x0291;
            Dictionary<long, ISerializablePacket> Inventory = new Dictionary<long, ISerializablePacket>();

            SetItemInBagSlot(ref Inventory, 0, 45875261658941);

            IInventory.AddField(1, EPacketFieldType.Dictionary, Inventory);
            Packets.Add(IInventory);

            ItemDatas.AddField(10, EPacketFieldType.Packet, Cache);

            From.SendCache(7310, 2007607340);
            From.SendCache(623, 935832306);

            Packets.Add(ItemDatas);
        }
コード例 #41
0
        public static bool WritePacket(ref PacketOutStream Stream,ISerializablePacket Packet, bool WithSize = true , bool WithTerminator = true, bool WithOpcode = true)
        {
            if (Packet == null)
            {
                Log.Error("WritePacket", "Packet == null");
                return false;
            }

            Packet.ConvertToField();

            PacketOutStream Data = new PacketOutStream();

            if (WithOpcode)
                Data.WriteEncoded7Bit(Packet.Opcode);

            foreach (ISerializableField Field in Packet.GetFields().Values)
                WriteField(ref Data, Field);

            if (WithTerminator && Packet.Opcode != (int)Opcodes.ProtocolHandshakeCompression)
                WriteField(ref Data, null, 0, (int)EPacketFieldType.Terminator);

            if (WithSize)
                Stream.WriteEncoded7Bit(Data.Length);

            Stream.Write(Data.ToArray());

            return true;
        }