当前位置: 首页>>代码示例>>C#>>正文


C# PacketWriter.WriteFloat方法代码示例

本文整理汇总了C#中Framework.Network.Packets.PacketWriter.WriteFloat方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteFloat方法的具体用法?C# PacketWriter.WriteFloat怎么用?C# PacketWriter.WriteFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Framework.Network.Packets.PacketWriter的用法示例。


在下文中一共展示了PacketWriter.WriteFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCreatureStats

        public static void HandleCreatureStats(ref PacketReader packet, ref WorldClass session)
        {
            int id = packet.ReadInt32();
            ulong guid = packet.ReadUInt64();

            Creature creature = DataMgr.FindCreature(id);
            if (creature != null)
            {
                CreatureStats stats = creature.Stats;

                PacketWriter creatureStats = new PacketWriter(LegacyMessage.CreatureStats);

                creatureStats.WriteInt32(stats.Id);
                creatureStats.WriteCString(stats.Name);

                for (int i = 0; i < 7; i++)
                    creatureStats.WriteCString("");

                creatureStats.WriteCString(stats.SubName);
                creatureStats.WriteCString("");
                creatureStats.WriteCString(stats.IconName);

                foreach (var v in stats.Flag)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteInt32(stats.Type);
                creatureStats.WriteInt32(stats.Family);
                creatureStats.WriteInt32(stats.Rank);

                foreach (var v in stats.QuestKillNpcId)
                    creatureStats.WriteInt32(v);

                foreach (var v in stats.DisplayInfoId)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteFloat(stats.HealthModifier);
                creatureStats.WriteFloat(stats.PowerModifier);

                creatureStats.WriteUInt8(stats.RacialLeader);

                foreach (var v in stats.QuestItemId)
                    creatureStats.WriteInt32(v);

                creatureStats.WriteInt32(stats.MovementInfoId);
                creatureStats.WriteInt32(stats.ExpansionRequired);

                session.Send(ref creatureStats);
            }
            else
                Log.Message(LogType.DEBUG, "Creature (Id: {0}) not found.", id);
        }
开发者ID:antiker,项目名称:Arctium,代码行数:51,代码来源:CacheHandler.cs

示例2: HandleSendNewTimeSpeed

        public static void HandleSendNewTimeSpeed(ref WorldClass session)
        {
            PacketWriter newTimeSpeed = new PacketWriter(LegacyMessage.SendNewTimeSpeed);

            newTimeSpeed.WritePackedTime();
            newTimeSpeed.WritePackedTime();
            newTimeSpeed.WriteFloat(0.01666667f);
            newTimeSpeed.WriteInt32(0);
            newTimeSpeed.WriteInt32(0);

            session.Send(ref newTimeSpeed);
        }
开发者ID:Mathias1000,项目名称:Arctium,代码行数:12,代码来源:TimeHandler.cs

示例3: HandleLoginSetTimeSpeed

        public static void HandleLoginSetTimeSpeed(ref WorldClass session)
        {
            PacketWriter loginSetTimeSpeed = new PacketWriter(ServerMessage.LoginSetTimeSpeed);

            loginSetTimeSpeed.WriteInt32(1);
            loginSetTimeSpeed.WriteInt32(1);
            loginSetTimeSpeed.WriteFloat(0.01666667f);
            loginSetTimeSpeed.WritePackedTime();
            loginSetTimeSpeed.WritePackedTime();

            session.Send(ref loginSetTimeSpeed);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:12,代码来源:TimeHandler.cs

示例4: HandleMoveSetRunSpeed

        public static void HandleMoveSetRunSpeed(ref WorldClass session, float speed = 7f)
        {
            PacketWriter setRunSpeed = new PacketWriter(JAMCMessage.MoveSetRunSpeed);
            BitPack BitPack = new BitPack(setRunSpeed, session.Character.Guid);

            BitPack.WriteGuidMask(0, 4, 1, 6, 3, 5, 7, 2);
            BitPack.Flush();

            setRunSpeed.WriteFloat(speed);
            BitPack.WriteGuidBytes(7);
            setRunSpeed.WriteUInt32(0);
            BitPack.WriteGuidBytes(3, 6, 0, 4, 1, 5, 2);

            session.Send(setRunSpeed);
        }
开发者ID:thundergod221,项目名称:Arctium,代码行数:15,代码来源:MoveHandler.cs

示例5: HandleMoveSetFlightSpeed

        public static void HandleMoveSetFlightSpeed(ref WorldClass session, float speed = 7f)
        {
            PacketWriter setFlightSpeed = new PacketWriter(ServerMessage.MoveSetFlightSpeed);
            BitPack BitPack = new BitPack(setFlightSpeed, session.Character.Guid);

            BitPack.WriteGuidMask(5, 4, 2, 1, 7, 6, 3, 0);
            BitPack.Flush();

            setFlightSpeed.WriteUInt32(0);

            BitPack.WriteGuidBytes(5, 7);

            setFlightSpeed.WriteFloat(speed);

            BitPack.WriteGuidBytes(1, 2, 3, 6, 0, 4);

            session.Send(ref setFlightSpeed);
        }
开发者ID:OakCore,项目名称:Arctium,代码行数:18,代码来源:MoveHandler.cs

示例6: HandleMoveSetRunSpeed

        public static void HandleMoveSetRunSpeed(ref WorldClass session, float speed = 7f)
        {
            PacketWriter setRunSpeed = new PacketWriter(ServerMessage.MoveSetRunSpeed);
            BitPack BitPack = new BitPack(setRunSpeed, session.Character.Guid);

            BitPack.WriteGuidMask(6, 1, 2, 5, 0, 3, 7, 4);
            BitPack.Flush();

            BitPack.WriteGuidBytes(3, 0, 1, 5);

            setRunSpeed.WriteFloat(speed);

            BitPack.WriteGuidBytes(7, 4, 2);

            setRunSpeed.WriteUInt32(0);

            BitPack.WriteGuidBytes(6);

            session.Send(ref setRunSpeed);
        }
开发者ID:OakCore,项目名称:Arctium,代码行数:20,代码来源:MoveHandler.cs

示例7: HandleEnumCharactersResult

        public static void HandleEnumCharactersResult(ref PacketReader packet, WorldClass session)
        {
            // Set existing character from last world session to null
            session.Character = null;

            DB.Realms.Execute("UPDATE accounts SET online = 1 WHERE id = ?", session.Account.Id);

            SQLResult result = DB.Characters.Select("SELECT * FROM characters WHERE accountid = ?", session.Account.Id);

            PacketWriter enumCharacters = new PacketWriter(ServerMessage.EnumCharactersResult);
            BitPack BitPack = new BitPack(enumCharacters);

            BitPack.Write(0, 21);
            BitPack.Write(result.Count, 16);

            for (int c = 0; c < result.Count; c++)
            {
                var name = result.Read<string>(c, "Name");
                var loginCinematic = result.Read<bool>(c, "LoginCinematic");

                BitPack.Guid = result.Read<ulong>(c, "Guid");
                BitPack.GuildGuid = result.Read<ulong>(c, "GuildGuid");

                BitPack.WriteGuidMask(0);
                BitPack.WriteGuildGuidMask(4);
                BitPack.WriteGuidMask(7);
                BitPack.WriteGuildGuidMask(3, 7);
                BitPack.WriteGuidMask(5, 4, 6);
                BitPack.WriteGuildGuidMask(1);
                BitPack.WriteGuidMask(3, 2);
                BitPack.WriteGuildGuidMask(0, 2);
                BitPack.WriteGuidMask(1);
                BitPack.WriteGuildGuidMask(5);
                BitPack.Write(loginCinematic);
                BitPack.WriteGuildGuidMask(6);
                BitPack.Write((uint)UTF8Encoding.UTF8.GetBytes(name).Length, 6);
            }

            BitPack.Write(1);

            BitPack.Flush();

            for (int c = 0; c < result.Count; c++)
            {
                string name = result.Read<string>(c, "Name");
                BitPack.Guid = result.Read<ulong>(c, "Guid");
                BitPack.GuildGuid = result.Read<ulong>(c, "GuildGuid");

                enumCharacters.WriteUInt32(result.Read<uint>(c, "PetLevel"));
                enumCharacters.WriteUInt8(result.Read<byte>(c, "Level"));

                BitPack.WriteGuildGuidBytes(2, 3);

                //TODO: implement items
                for (int j = 0; j < 23; j++)
                {
                    enumCharacters.WriteUInt32(0);
                    enumCharacters.WriteUInt32(0);
                    enumCharacters.WriteUInt8(0);
                }

                BitPack.WriteGuildGuidBytes(6);

                enumCharacters.WriteUInt8(0);

                enumCharacters.WriteUInt8(result.Read<byte>(c, "HairStyle"));
                enumCharacters.WriteUInt32(result.Read<uint>(c, "CustomizeFlags"));
                enumCharacters.WriteUInt8(result.Read<byte>(c, "Class"));

                BitPack.WriteGuildGuidBytes(7);

                BitPack.WriteGuidBytes(0);

                enumCharacters.WriteUInt32(result.Read<uint>(c, "PetFamily"));

                BitPack.WriteGuildGuidBytes(1);

                BitPack.WriteGuidBytes(3, 7, 2);

                BitPack.WriteGuildGuidBytes(5);

                enumCharacters.WriteUInt8(result.Read<byte>(c, "Gender"));
                enumCharacters.WriteUInt32(result.Read<uint>(c, "PetDisplayId"));
                enumCharacters.WriteUInt32(result.Read<uint>(c, "Zone"));

                BitPack.WriteGuidBytes(6);

                enumCharacters.WriteUInt8(result.Read<byte>(c, "HairColor"));
                enumCharacters.WriteUInt8(result.Read<byte>(c, "FacialHair"));
                enumCharacters.WriteString(name);
                enumCharacters.WriteUInt8(result.Read<byte>(c, "Race"));

                BitPack.WriteGuildGuidBytes(4);

                enumCharacters.WriteUInt8(result.Read<byte>(c, "Skin"));
                enumCharacters.WriteUInt32(result.Read<uint>(c, "Map"));
                enumCharacters.WriteUInt32(result.Read<uint>(c, "CharacterFlags"));
                enumCharacters.WriteFloat(result.Read<float>(c, "Y"));

                BitPack.WriteGuildGuidBytes(0);
//.........这里部分代码省略.........
开发者ID:Kahath,项目名称:Arctium-WoW,代码行数:101,代码来源:CharacterHandler.cs

示例8: HandleRealmList

        public void HandleRealmList(RealmClass session, PacketReader data)
        {
            Log.Message(LogType.NORMAL, "RealmList");

            PacketWriter realmData = new PacketWriter();

            foreach (var r in Realms)
            {
                realmData.WriteUInt8(1);
                realmData.WriteUInt8(0);
                realmData.WriteUInt8(0);
                realmData.WriteCString(r.Name);
                realmData.WriteCString(r.IP + ":" + r.Port);
                realmData.WriteFloat(0);
                realmData.WriteUInt8(0);  // CharCount
                realmData.WriteUInt8(1);
                realmData.WriteUInt8(0x2C);
            }

            PacketWriter realmList = new PacketWriter();
            realmList.WriteUInt8((byte)ClientLink.CMD_REALM_LIST);
            realmList.WriteUInt16((ushort)(realmData.BaseStream.Length + 8));
            realmList.WriteUInt32(0);
            realmList.WriteUInt16((ushort)Realms.Count);
            realmList.WriteBytes(realmData.ReadDataToSend());
            realmList.WriteUInt8(0);
            realmList.WriteUInt8(0x10);

            session.Send(realmList);
        }
开发者ID:concept45,项目名称:Arctium-RT,代码行数:30,代码来源:RealmClass.cs

示例9: HandleRealmList

        public void HandleRealmList(PacketReader data)
        {
            Log.Message(LogType.NORMAL, "RealmList");

            using (var realmData = new PacketWriter())
            {
                Realms.ToList().ForEach(r =>
                {
                    using (var result = DB.Characters.Select("SELECT COUNT(*) as Count FROM characters WHERE AccountId = ? AND RealmId = ?", account.Id, r.Value.Id))
                    {
                        var charCount = result.Read<byte>(0, "Count");

                        realmData.WriteUInt8(1);
                        realmData.WriteUInt8(0);
                        realmData.WriteUInt8(0);
                        realmData.WriteCString(r.Key);
                        realmData.WriteCString(r.Value.IP + ":" + r.Value.Port);
                        realmData.WriteFloat(0);
                        realmData.WriteUInt8(charCount);
                        realmData.WriteUInt8(1);
                        realmData.WriteUInt8(0x2C);
                    }
                });

                using (var realmList = new PacketWriter())
                {
                    realmList.WriteUInt8((byte)ClientLink.CMD_REALM_LIST);
                    realmList.WriteUInt16((ushort)(realmData.BaseStream.Length + 8));
                    realmList.WriteUInt32(0);
                    realmList.WriteUInt16((ushort)Realms.Count);
                    realmList.WriteBytes(realmData.ReadDataToSend());
                    realmList.WriteUInt8(0);
                    realmList.WriteUInt8(0x10);

                    Send(realmList);
                }
            }
        }
开发者ID:ArkantosWoW,项目名称:ArkantosEmu,代码行数:38,代码来源:RealmClass.cs

示例10: HandleMoveSetFlightSpeed

        public static void HandleMoveSetFlightSpeed(ref WorldClass session, float speed = 7f)
        {
            PacketWriter setFlightSpeed = new PacketWriter(JAMCMessage.MoveSetFlightSpeed);
            BitPack BitPack = new BitPack(setFlightSpeed, session.Character.Guid);

            BitPack.WriteGuidMask(6, 1, 7, 4, 5, 3, 0, 2);
            BitPack.Flush();

            BitPack.WriteGuidBytes(0, 4, 6);
            setFlightSpeed.WriteFloat(speed);
            BitPack.WriteGuidBytes(7, 2);
            setFlightSpeed.WriteUInt32(0);
            BitPack.WriteGuidBytes(5, 1, 3);

            session.Send(ref setFlightSpeed);
        }
开发者ID:concept45,项目名称:Arctium,代码行数:16,代码来源:MoveHandler.cs

示例11: HandleMoveUpdate

        public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
        {
            PacketWriter moveUpdate = new PacketWriter(JAMCMessage.MoveUpdate);
            BitPack BitPack = new BitPack(moveUpdate, guid);

            BitPack.WriteGuidMask(0);
            BitPack.Write(!movementValues.HasMovementFlags);
            BitPack.Write(!movementValues.HasRotation);
            BitPack.WriteGuidMask(2, 6);
            BitPack.Write(!movementValues.HasMovementFlags2);
            BitPack.WriteGuidMask(7);
            BitPack.Write<uint>(0, 24);
            BitPack.WriteGuidMask(1);

            if (movementValues.HasMovementFlags)
                BitPack.Write((uint)movementValues.MovementFlags, 30);

            BitPack.WriteGuidMask(4);
            BitPack.Write(!movementValues.IsAlive);
            BitPack.Write(0);

            if (movementValues.HasMovementFlags2)
                BitPack.Write((uint)movementValues.MovementFlags2, 13);

            BitPack.Write(0);
            BitPack.WriteGuidMask(5);
            BitPack.Write(true);
            BitPack.Write(0);
            BitPack.Write(movementValues.IsInterpolated);
            BitPack.Write(0);
            BitPack.Write(true);
            BitPack.WriteGuidMask(3);
            BitPack.Write(true);

            if (movementValues.IsInterpolated)
                BitPack.Write(movementValues.IsInterpolated2);

            BitPack.Flush();

            if (movementValues.IsInterpolated)
            {
                moveUpdate.WriteUInt32(0);

                if (movementValues.IsInterpolated2)
                {
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                    moveUpdate.WriteFloat(0);
                }

                moveUpdate.WriteFloat(0);
            }

            if (movementValues.IsAlive)
                moveUpdate.WriteUInt32(movementValues.Time);

            BitPack.WriteGuidBytes(5, 7);

            moveUpdate.WriteFloat(vector.Z);

            BitPack.WriteGuidBytes(4, 3, 2, 6, 0);

            moveUpdate.WriteFloat(vector.X);

            if (movementValues.HasRotation)
                moveUpdate.WriteFloat(vector.W);

            moveUpdate.WriteFloat(vector.Y);

            Character pChar = WorldMgr.GetSession(guid).Character;
            ObjectMgr.SetPosition(ref pChar, vector, false);

            WorldMgr.SendToAllInZone(guid, moveUpdate);
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:74,代码来源:MoveHandler.cs

示例12: HandleNewWorld

        public static void HandleNewWorld(ref WorldClass session, Vector4 vector, uint mapId)
        {
            PacketWriter newWorld = new PacketWriter(ServerMessage.NewWorld);

            newWorld.WriteFloat(vector.Z);
            newWorld.WriteFloat(vector.X);
            newWorld.WriteUInt32(mapId);
            newWorld.WriteFloat(vector.Y);
            newWorld.WriteFloat(vector.O);

            session.Send(ref newWorld);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:12,代码来源:MoveHandler.cs

示例13: HandleQueryGameObject

        public static void HandleQueryGameObject(ref PacketReader packet, ref WorldClass session)
        {
            byte[] guidMask = { 4, 6, 7, 5, 3, 2, 1, 0 };
            byte[] guidBytes = { 0, 2, 3, 5, 6, 1, 4, 7 };

            BitUnpack BitUnpack = new BitUnpack(packet);

            var hasData = false;
            var id = packet.Read<int>();
            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);

            PacketWriter queryGameObjectResponse = new PacketWriter(ServerMessage.QueryGameObjectResponse);
            BitPack BitPack = new BitPack(queryGameObjectResponse);

            GameObject gObject = DataMgr.FindGameObject(id);
            if (hasData = (gObject != null))
            {
                GameObjectStats stats = gObject.Stats;

                BitPack.Write(hasData);
                BitPack.Flush();

                queryGameObjectResponse.WriteInt32(stats.Id);
                queryGameObjectResponse.WriteInt32(0);
                queryGameObjectResponse.WriteInt32(stats.Type);
                queryGameObjectResponse.WriteInt32(stats.DisplayInfoId);

                queryGameObjectResponse.WriteCString(stats.Name);

                for (int i = 0; i < 3; i++)
                    queryGameObjectResponse.WriteCString("");

                queryGameObjectResponse.WriteCString(stats.IconName);
                queryGameObjectResponse.WriteCString(stats.CastBarCaption);
                queryGameObjectResponse.WriteCString("");

                foreach (var v in stats.Data)
                    queryGameObjectResponse.WriteInt32(v);

                queryGameObjectResponse.WriteFloat(stats.Size);
                queryGameObjectResponse.WriteUInt8((byte)stats.QuestItemId.Count);

                foreach (var v in stats.QuestItemId)
                    queryGameObjectResponse.WriteInt32(v);

                queryGameObjectResponse.WriteInt32(stats.ExpansionRequired);

                var size = (uint)queryGameObjectResponse.BaseStream.Length - 13;
                queryGameObjectResponse.WriteUInt32Pos(size, 9);

                session.Send(ref queryGameObjectResponse);
            }
            else
            {
                BitPack.Write(hasData);
                Log.Message(LogType.DEBUG, "Gameobject (Id: {0}) not found.", id);
            }
        }
开发者ID:ArkantosWoW,项目名称:ArkantosEmu,代码行数:58,代码来源:CacheHandler.cs

示例14: HandleMoveSetSwimSpeed

        public static void HandleMoveSetSwimSpeed(ref WorldClass session, float speed = 4.72222f)
        {
            PacketWriter setSwimSpeed = new PacketWriter(ServerMessage.MoveSetSwimSpeed);
            BitPack BitPack = new BitPack(setSwimSpeed, session.Character.Guid);

            BitPack.WriteGuidMask(6, 3, 1, 2, 0, 4, 7, 5);

            BitPack.Flush();

            BitPack.WriteGuidBytes(2);

            setSwimSpeed.WriteFloat(speed);

            BitPack.WriteGuidBytes(1, 6);

            setSwimSpeed.WriteUInt32(0);

            BitPack.WriteGuidBytes(3, 4, 0, 7, 5);

            session.Send(ref setSwimSpeed);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:21,代码来源:MoveHandler.cs

示例15: HandleMoveTeleport

        public static void HandleMoveTeleport(ref WorldClass session, Vector4 vector)
        {
            bool IsTransport = false;
            bool Unknown = false;

            PacketWriter moveTeleport = new PacketWriter(ServerMessage.MoveTeleport);
            BitPack BitPack = new BitPack(moveTeleport, session.Character.Guid);

            BitPack.WriteGuidMask(7);
            BitPack.Write(Unknown);
            BitPack.WriteGuidMask(2, 0);

            if (Unknown)
            {
                BitPack.Write(0);
                BitPack.Write(0);
            }

            BitPack.Write(IsTransport);

            if (IsTransport)
                BitPack.WriteTransportGuidMask(4, 3, 5, 7, 0, 2, 6, 1);

            BitPack.WriteGuidMask(5, 1, 3, 6, 4);

            BitPack.Flush();

            BitPack.WriteGuidBytes(0);

            if (IsTransport)
                BitPack.WriteTransportGuidBytes(7, 6, 0, 2, 3, 1, 5, 4);

            BitPack.WriteGuidBytes(6, 1);

            moveTeleport.WriteUInt32(0);

            BitPack.WriteGuidBytes(7, 5);

            moveTeleport.WriteFloat(vector.X);

            BitPack.WriteGuidBytes(4, 3, 2);

            moveTeleport.WriteFloat(vector.Y);
            moveTeleport.WriteFloat(vector.O);
            moveTeleport.WriteFloat(vector.Z);

            if (Unknown)
                moveTeleport.WriteUInt8(0);

            session.Send(ref moveTeleport);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:51,代码来源:MoveHandler.cs


注:本文中的Framework.Network.Packets.PacketWriter.WriteFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。