當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。