コード例 #1
0
ファイル: CharacterPackets.cs プロジェクト: Besyaka/swtor-emu
        void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
        {
            uint id = packet.ReadObjectIDRev();
            int namelen = packet.ReadInt();
            string name = "";
            for (int i = 0; i < namelen; i++)
            {
                name += (char)packet.ReadByte();
            }
            packet.ReadInt(); packet.ReadInt();
            packet.ReadInt();

            uint CHARSPEC1 = packet.ReadUInt();
            byte CHARSPEC2 = (byte)packet.ReadByte();

            packet.ReadBytes(36);

            uint CHARSPECAPP1 = packet.ReadUInt();
            uint CHARSPECAPP2 = packet.ReadUInt();
            uint CHARSPECAPP3 = packet.ReadUInt();
            ushort CHARSPECAPP4 = packet.ReadUShort();

            packet.ReadByte(); // separator

            byte[] classBytes = packet.ReadBytes(8);
            Array.Reverse(classBytes);
            ulong classNodeRefId = BitConverter.ToUInt64(classBytes, 0);

            Console.WriteLine("----- Creating Character -----");
            Console.WriteLine("Name = " + name);
            Console.WriteLine("Class ID = " + classNodeRefId);
            Console.WriteLine("App1 = " + CHARSPECAPP1);
            Console.WriteLine("App2 = " + CHARSPECAPP2);
            Console.WriteLine("App3 = " + CHARSPECAPP3);
            Console.WriteLine("App4 = " + CHARSPECAPP4);

            /*byte[] known_offs = new byte[] { 84, 88, 91, 92, 95, 96, 100, 104, 107, 108, 112 };
            long originalPositon = packet.Position;
            byte[] thispkt = packet.ReadBytes((int)(packet.Length - packet.Position));
            packet.Position = originalPositon;

            if (lastpacket != null)
            {

                for (byte i = 0; i < thispkt.Length; i++)
                {
                    if (lastpacket[i] != thispkt[i] && !known_offs.Contains<byte>(i))
                        Console.WriteLine("Data differs at " + i + " : " + lastpacket[i] + " => " + thispkt[i]);
                }
            }

            lastpacket = thispkt;*/

            Character c = new Character()
            {
                //APP1 = CHARSPECAPP1,
                //APP2 = CHARSPECAPP2,
                //APP3 = CHARSPECAPP3,
                //APP4 = CHARSPECAPP4,
                AreaSpec = TORBusiness.Data.MapAreas.PCShip_XSFreighter,
                Class = (CharacterClass)classNodeRefId,
                Level = 44,
                Name = name,
                spec2 = CHARSPEC1,
                spec3 = CHARSPEC2,
            };

            packet.ReadBytes(78);
            packet.ReadByte();
            byte appDataCount = (byte)packet.ReadByte();
            c.Appearance = new Tuple<byte, byte>[appDataCount];
            packet.ReadByte();
            Console.WriteLine("appearance entries: " + appDataCount);
            for (int i = 0; i < appDataCount; i++)
            {
                byte[] data = packet.ReadBytes(4);
                c.Appearance[i] = new Tuple<byte, byte>(data[0], data[3]);
                Console.WriteLine("Appearance = " + data[3]);
            }

            Program.LastCreatedChar = c;

            connection.SendPacket(new SMsg_CharacterCreateResponse(id, name, 0x07));
        }
コード例 #2
0
ファイル: CharacterPackets.cs プロジェクト: Besyaka/swtor-emu
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     TORLog.Info("CharacterListRequest@" + objid);
     connection.SendPacket(new SMsg_CharacterListResponse(objid));
 }
コード例 #3
0
ファイル: CharacterPackets.cs プロジェクト: Besyaka/swtor-emu
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     packet.ReadByte();
     uint charid = packet.ReadUInt();
     TORLog.Info("CharacterSelectRequest@" + objid + " - " + charid);
     connection.SendPacket(new SMsg_CharacterSelectResponse(objid));
     connection.SendPacket(new SMsg_CharacterCurrentMap(objid, "ord_main", "4611686019802843831"));
     connection.SendPacket(new SMsg_CharacterAreaEnter(objid));
     connection.SendPacket(new SMsg_CharacterAreaServerSpec(objid, "ord_main", "4611686019802843831"));
 }
コード例 #4
0
ファイル: SystemPackets.cs プロジェクト: Besyaka/swtor-emu
 void IClientPacket.ExecutePacket(AsyncConnection connection, ByteBuffer packet)
 {
     uint objid = packet.ReadObjectIDRev();
     TORLog.Info("GetServerAddress@" + objid);
     //connection.SendPacket(new SMsg_ServerAddressResponse(objid, "swtor.privateserver.com"));
 }