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


C# BitPack.WriteGuildGuidBytes方法代码示例

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


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

示例1: HandleEnumCharactersResult

        public static void HandleEnumCharactersResult(ref PacketReader packet, ref WorldClass session)
        {
            SQLResult result = DB.Characters.Select("SELECT guid, name, race, class, gender, skin, face, hairstyle, " +
                                                    "haircolor, facialhair, level, zone, map, x, y, z, guildguid, petdisplayid, " +
                                                    "petlevel, petfamily, characterflags, customizeflags, loginCinematic FROM characters WHERE accountid = {0}", session.Account.Id);

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

            BitPack.Write(0, 23);
            BitPack.Write(result.Count, 17);

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

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

                    BitPack.WriteGuidMask(7, 0, 4);
                    BitPack.WriteGuildGuidMask(2);
                    BitPack.WriteGuidMask(5, 3);
                    BitPack.Write((uint)Encoding.ASCII.GetBytes(name).Length, 7);
                    BitPack.WriteGuildGuidMask(0, 5, 3);
                    BitPack.Write(loginCinematic);
                    BitPack.WriteGuildGuidMask(6, 7);
                    BitPack.WriteGuidMask(1);
                    BitPack.WriteGuildGuidMask(4, 1);
                    BitPack.WriteGuidMask(2, 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<UInt64>(c, "Guid");
                    BitPack.GuildGuid = result.Read<UInt64>(c, "GuildGuid");

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "CharacterFlags"));
                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetFamily"));
                    enumCharacters.WriteFloat(result.Read<Single>(c, "Z"));

                    BitPack.WriteGuidBytes(7);
                    BitPack.WriteGuildGuidBytes(6);

                    // Not implanted
                    for (int j = 0; j < 23; j++)
                    {
                        enumCharacters.WriteUInt32(0);
                        enumCharacters.WriteUInt8(0);
                        enumCharacters.WriteUInt32(0);
                    }

                    enumCharacters.WriteFloat(result.Read<Single>(c, "X"));
                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Class"));

                    BitPack.WriteGuidBytes(5);

                    enumCharacters.WriteFloat(result.Read<Single>(c, "Y"));

                    BitPack.WriteGuildGuidBytes(3);
                    BitPack.WriteGuidBytes(6);

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetLevel"));
                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetDisplayId"));

                    BitPack.WriteGuidBytes(2);
                    BitPack.WriteGuidBytes(1);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "HairColor"));
                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "FacialHair"));

                    BitPack.WriteGuildGuidBytes(2);

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "Zone"));
                    enumCharacters.WriteUInt8(0);

                    BitPack.WriteGuidBytes(0);
                    BitPack.WriteGuildGuidBytes(1);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Skin"));

                    BitPack.WriteGuidBytes(4);
                    BitPack.WriteGuildGuidBytes(5);

                    enumCharacters.WriteString(name);

                    BitPack.WriteGuildGuidBytes(0);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Level"));

                    BitPack.WriteGuidBytes(3);
                    BitPack.WriteGuildGuidBytes(7);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "HairStyle"));
//.........这里部分代码省略.........
开发者ID:thundergod221,项目名称:Arctium,代码行数:101,代码来源:CharacterHandler.cs

示例2: 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

示例3: HandleEnumCharactersResult

        public static void HandleEnumCharactersResult(ref PacketReader packet, ref 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(JAMCMessage.EnumCharactersResult);
            BitPack BitPack = new BitPack(enumCharacters);

            BitPack.Write(0, 23);
            BitPack.Write(result.Count, 17);

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

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

                    BitPack.WriteGuidMask(7, 0, 4);
                    BitPack.WriteGuildGuidMask(2);
                    BitPack.WriteGuidMask(5, 3);
                    BitPack.Write((uint)Encoding.ASCII.GetBytes(name).Length, 7);
                    BitPack.WriteGuildGuidMask(0, 5, 3);
                    BitPack.Write(loginCinematic);
                    BitPack.WriteGuildGuidMask(6, 7);
                    BitPack.WriteGuidMask(1);
                    BitPack.WriteGuildGuidMask(4, 1);
                    BitPack.WriteGuidMask(2, 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<UInt64>(c, "Guid");
                    BitPack.GuildGuid = result.Read<UInt64>(c, "GuildGuid");

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "CharacterFlags"));
                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetFamily"));
                    enumCharacters.WriteFloat(result.Read<Single>(c, "Z"));

                    BitPack.WriteGuidBytes(7);
                    BitPack.WriteGuildGuidBytes(6);

                    // Not implanted
                    for (int j = 0; j < 23; j++)
                    {
                        enumCharacters.WriteUInt32(0);
                        enumCharacters.WriteUInt8(0);
                        enumCharacters.WriteUInt32(0);
                    }

                    enumCharacters.WriteFloat(result.Read<Single>(c, "X"));
                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Class"));

                    BitPack.WriteGuidBytes(5);

                    enumCharacters.WriteFloat(result.Read<Single>(c, "Y"));

                    BitPack.WriteGuildGuidBytes(3);
                    BitPack.WriteGuidBytes(6);

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetLevel"));
                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetDisplayId"));

                    BitPack.WriteGuidBytes(2);
                    BitPack.WriteGuidBytes(1);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "HairColor"));
                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "FacialHair"));

                    BitPack.WriteGuildGuidBytes(2);

                    enumCharacters.WriteUInt32(result.Read<UInt32>(c, "Zone"));
                    enumCharacters.WriteUInt8(0);

                    BitPack.WriteGuidBytes(0);
                    BitPack.WriteGuildGuidBytes(1);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Skin"));

                    BitPack.WriteGuidBytes(4);
                    BitPack.WriteGuildGuidBytes(5);

                    enumCharacters.WriteString(name);

                    BitPack.WriteGuildGuidBytes(0);

                    enumCharacters.WriteUInt8(result.Read<Byte>(c, "Level"));

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


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