コード例 #1
0
        public void ToBitStream(WriteOnlyBitStream packetStream)
        {
            packetStream.Write((byte)CharacterDataList.Count);
            packetStream.Write(LastActiveCharacterIndex);

            foreach (CharacterData characterData in CharacterDataList)
            {
                CharacterInfo characterInfo = characterData.CharacterInfo;

                packetStream.Write(characterInfo.CharacterId);
                packetStream.Write(characterData.ObjectTemplate);
                packetStream.WriteWideString(characterInfo.Name, 33);
                packetStream.WriteWideString(characterInfo.PendingName, 33);
                packetStream.Write(characterInfo.PendingNameRejected ? (byte)1 : (byte)0);
                packetStream.Write(characterData.IsFtp);
                packetStream.Write(characterData.Unknown1);
                packetStream.Write(characterInfo.HeadColor);
                packetStream.Write(characterInfo.Head);
                packetStream.Write(characterInfo.ChestColor);
                packetStream.Write(characterInfo.Chest);
                packetStream.Write(characterInfo.Legs);
                packetStream.Write(characterInfo.HairStyle);
                packetStream.Write(characterInfo.HairColor);
                packetStream.Write(characterInfo.LeftHand);
                packetStream.Write(characterInfo.RightHand);
                packetStream.Write(characterInfo.EyebrowStyle);
                packetStream.Write(characterInfo.EyesStyle);
                packetStream.Write(characterInfo.MouthStyle);
                packetStream.Write(characterData.Unknown2);
                packetStream.Write(characterInfo.ZoneId);
                packetStream.Write(characterData.LastInstanceId);
                packetStream.Write(characterInfo.CloneId);
                packetStream.Write(characterInfo.LastLogout);

                packetStream.Write((ushort)characterData.EquippedObjectTemplates.Count);

                foreach (uint equippedObjectTemplate in characterData.EquippedObjectTemplates)
                {
                    packetStream.Write(equippedObjectTemplate);
                }
            }
        }
コード例 #2
0
        public void ToBitStream(WriteOnlyBitStream packetStream)
        {
            packetStream.Write((byte)LoginResult);
            packetStream.WriteString(Unknown1, 33);
            packetStream.WriteString(Unknown2, 33);
            packetStream.WriteString(Unknown3, 33);
            packetStream.WriteString(Unknown4, 33);
            packetStream.WriteString(Unknown5, 33);
            packetStream.WriteString(Unknown6, 33);
            packetStream.WriteString(Unknown7, 33);
            packetStream.WriteString(Unknown8, 33);
            packetStream.Write(ClientVersionMajor);
            packetStream.Write(ClientVersionCurrent);
            packetStream.Write(ClientVersionMinor);
            packetStream.WriteWideString(SessionSecret, 33);
            packetStream.WriteString(CharacterInstanceIp, 33);
            packetStream.WriteString(ChatInstanceIp, 33);
            packetStream.Write(CharacterInstancePort);
            packetStream.Write(ChatInstancePort);
            packetStream.WriteString(Unknown9, 33);
            packetStream.WriteString(UniqueId, 37);
            packetStream.Write(Unknown10);
            packetStream.WriteString(Locale, 3);
            packetStream.Write(JustSubscribed);
            packetStream.Write(IsFtp);
            packetStream.Write(Unknown11);

            if (CustomErrorMessage != null)
            {
                packetStream.Write((ushort)CustomErrorMessage.Length);
                packetStream.WriteWideString(CustomErrorMessage, CustomErrorMessage.Length);
            }
            else
            {
                packetStream.Write((ushort)0);
            }

            packetStream.Write((uint)4);
        }
コード例 #3
0
ファイル: Replica.cs プロジェクト: cuzitsjonny/Quicksicle
        public void Serialize(WriteOnlyBitStream packetStream, bool isInitialUpdate)
        {
            if (isInitialUpdate)
            {
                packetStream.Write(ObjectId);
                packetStream.Write(Template);
                packetStream.Write((byte)Name.Length);

                if (Name.Length > 0)
                {
                    packetStream.WriteWideString(Name, Name.Length);
                }

                packetStream.Write((uint)DateTime.Now.Subtract(Creation).TotalSeconds);

                packetStream.Write0(); // config data
                packetStream.Write0(); // trigger id

                if (SpawnerId != 0)
                {
                    packetStream.Write1();
                    packetStream.Write(SpawnerId);
                }
                else
                {
                    packetStream.Write0();
                }

                if (SpawnerNodeId != -1)
                {
                    packetStream.Write1();
                    packetStream.Write(SpawnerNodeId);
                }
                else
                {
                    packetStream.Write0();
                }

                if (Scale != 1.0f)
                {
                    packetStream.Write1();
                    packetStream.Write(Scale);
                }
                else
                {
                    packetStream.Write0();
                }

                if (ObjectWorldState != ObjectWorldState.InWorld)
                {
                    packetStream.Write1();
                    packetStream.Write((byte)ObjectWorldState);
                }
                else
                {
                    packetStream.Write0();
                }

                if (GmLevel != 0)
                {
                    packetStream.Write1();
                    packetStream.Write(GmLevel);
                }
                else
                {
                    packetStream.Write0();
                }
            }

            packetStream.Write1();

            if (ParentId != 0)
            {
                packetStream.Write1();
                packetStream.Write(ParentId);
                packetStream.Write(UpdatePositionWithParent);
            }
            else
            {
                packetStream.Write0();
            }

            long[] childIds = ChildIds;

            if (childIds.Length > 0)
            {
                packetStream.Write1();
                packetStream.Write((ushort)childIds.Length);

                for (int i = 0; i < childIds.Length; i++)
                {
                    packetStream.Write(childIds[i]);
                }
            }
            else
            {
                packetStream.Write0();
            }

            bool statsComponentWritten          = false;
            BaseReplicaComponent statsComponent = GetComponent(ReplicaComponentId.Stats);

            for (int i = 0; i < SerializationOrder.Length; i++)
            {
                ReplicaComponentId currentComponentId = SerializationOrder[i];

                foreach (BaseReplicaComponent component in components)
                {
                    if (component.ComponentId == currentComponentId)
                    {
                        if (!statsComponentWritten && statsComponent != null && (currentComponentId == ReplicaComponentId.COLLECTIBLE || currentComponentId == ReplicaComponentId.QUICKBUILD))
                        {
                            statsComponent.ToBitStream(packetStream, isInitialUpdate);
                            statsComponentWritten = true;
                        }

                        component.ToBitStream(packetStream, isInitialUpdate);

                        if (!statsComponentWritten && statsComponent != null && (currentComponentId == ReplicaComponentId.Destroyable))
                        {
                            statsComponent.ToBitStream(packetStream, isInitialUpdate);
                            statsComponentWritten = true;
                        }
                    }
                }
            }
        }
コード例 #4
0
        public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate)
        {
            PossessionControlComponent.ToBitStream(packetStream, isInitialUpdate);
            LevelProgressionComponent.ToBitStream(packetStream, isInitialUpdate);
            PlayerForcedMovementComponent.ToBitStream(packetStream, isInitialUpdate);

            if (isInitialUpdate)
            {
                packetStream.Write0();
                packetStream.Write0();
                packetStream.Write0();
                packetStream.Write0();

                packetStream.Write(CharacterInfo.HairColor);
                packetStream.Write(CharacterInfo.HairStyle);
                packetStream.Write(CharacterInfo.Head);
                packetStream.Write(CharacterInfo.ChestColor);
                packetStream.Write(CharacterInfo.Legs);
                packetStream.Write(CharacterInfo.Chest);
                packetStream.Write(CharacterInfo.HeadColor);
                packetStream.Write(CharacterInfo.EyebrowStyle);
                packetStream.Write(CharacterInfo.EyesStyle);
                packetStream.Write(CharacterInfo.MouthStyle);
                packetStream.Write(AccountInfo.AccountId);
                packetStream.Write(CharacterInfo.LastLogout);
                packetStream.Write((ulong)0);
                packetStream.Write(CharacterInfo.UniverseScore);
                packetStream.Write(false);

                // this is only temporary
                for (int i = 0; i < 27; i++)
                {
                    packetStream.Write((ulong)0);
                }

                packetStream.Write(IsLaunching);

                if (IsLanding)
                {
                    packetStream.Write1();
                    packetStream.Write((ushort)LandingRocketTextLdf.Length);
                    packetStream.WriteWideString(LandingRocketTextLdf, LandingRocketTextLdf.Length);
                }
                else
                {
                    packetStream.Write0();
                }
            }

            packetStream.Write1();
            packetStream.Write(PvpEnabled);
            packetStream.Write(CharacterInfo.GmLevel > 0);
            packetStream.Write(CharacterInfo.GmLevel);
            packetStream.Write(CharacterInfo.EditorLevel > 0);
            packetStream.Write(CharacterInfo.EditorLevel);

            packetStream.Write1();
            packetStream.Write((uint)CurrentActivity);

            packetStream.Write0();
        }