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


C# BitUnpack.GetPackedValue方法代码示例

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


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

示例1: HandleObjectUpdateFailed

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

            BitUnpack GuidUnpacker = new BitUnpack(packet);

            ulong guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
            Log.Message(LogType.DEBUG, "ObjectUpdate failed for object with Guid {0}", guid);
        }
开发者ID:xyin,项目名称:Arctium,代码行数:10,代码来源:ObjectHandler.cs

示例2: HandleObjectUpdateFailed

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

            BitUnpack GuidUnpacker = new BitUnpack(packet);

            ulong guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
            Log.Message(LogType.Debug, "ObjectUpdate failed for object with Guid {0}", guid);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:10,代码来源:ObjectHandler.cs

示例3: HandleTalkToGossip

        public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 3, 1, 7, 4, 6, 0, 2, 5 };
            byte[] guidBytes = { 0, 1, 7, 6, 5, 2, 4, 3 };

            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
            var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
                BitPack BitPack = new BitPack(gossipMessage, guid);

                BitPack.WriteGuidMask(0, 1);
                BitPack.Write(0, 19);           // gossipData.QuestsCount
                BitPack.WriteGuidMask(2);
                BitPack.Write(0, 20);           // gossipData.OptionsCount

                // QuestsCount not supported.
                // for (int i = 0; i < gossipData.QuestsCount; i++)

                BitPack.WriteGuidMask(3);

                // OptionsCount not supported.
                // for (int i = 0; i < gossipData.OptionsCount; i++)

                BitPack.WriteGuidMask(5, 4, 6, 7);

                BitPack.Flush();

                BitPack.WriteGuidBytes(6);

                // OptionsCount not supported.
                // for (int i = 0; i < gossipData.OptionsCount; i++)

                BitPack.WriteGuidBytes(0);

                // QuestsCount not supported.
                // for (int i = 0; i < gossipData.QuestsCount; i++)

                gossipMessage.WriteInt32(gossipData.Id);

                BitPack.WriteGuidBytes(4, 3);

                gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
                gossipMessage.WriteInt32(gossipData.TextID);

                BitPack.WriteGuidBytes(7, 1, 5, 1);

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

示例4: HandleCharDelete

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

            var GuidUnpacker    = new BitUnpack(packet);
            var guid            = GuidUnpacker.GetPackedValue(guidMask, guidBytes);

            PacketWriter deleteChar = new PacketWriter(ServerMessage.DeleteChar);

            deleteChar.WriteUInt8(0x48);

            session.Send(ref deleteChar);

            DB.Characters.Execute("DELETE FROM characters WHERE guid = ?", guid);
            DB.Characters.Execute("DELETE FROM character_spells WHERE guid = ?", guid);
            DB.Characters.Execute("DELETE FROM character_skills WHERE guid = ?", guid);
        }
开发者ID:Kahath,项目名称:Arctium-WoW,代码行数:18,代码来源:CharacterHandler.cs

示例5: HandleTalkToGossip

        public static void HandleTalkToGossip(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 7, 3, 6, 5, 2, 1, 4, 0 };
            byte[] guidBytes = { 3, 4, 6, 1, 0, 2, 7, 5 };

            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
            var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
                BitPack BitPack = new BitPack(gossipMessage, guid);

                BitPack.WriteGuidMask(7, 6, 0);
                BitPack.Write(0, 19);              // gossipData.QuestsCount
                BitPack.WriteGuidMask(4, 3, 2);
                BitPack.Write(0, 20);              // gossipData.OptionsCount
                BitPack.WriteGuidMask(1, 5);

                BitPack.Flush();

                BitPack.WriteGuidBytes(2, 7);

                gossipMessage.WriteInt32(gossipData.FriendshipFactionID);

                BitPack.WriteGuidBytes(3, 1);

                gossipMessage.WriteInt32(gossipData.TextID);

                BitPack.WriteGuidBytes(5);

                gossipMessage.WriteInt32(gossipData.Id);

                BitPack.WriteGuidBytes(6, 4, 0);

                session.Send(ref gossipMessage);
            }
        }
开发者ID:Kahath,项目名称:Arctium-WoW,代码行数:40,代码来源:GossipHandler.cs

示例6: HandleCliQueryNPCText

        public static void HandleCliQueryNPCText(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 4, 7, 3, 6, 0, 1, 5, 2 };
            byte[] guidBytes = { 5, 6, 7, 1, 2, 3, 0, 4 };

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

            var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter queryNPCTextResponse = new PacketWriter(ServerMessage.QueryNPCTextResponse);
                BitPack BitPack = new BitPack(queryNPCTextResponse);

                queryNPCTextResponse.WriteInt32(gossipTextId);
                queryNPCTextResponse.WriteInt32(0);
                queryNPCTextResponse.WriteFloat(1);

                for (int i = 0; i < 7; i++)
                    queryNPCTextResponse.WriteUInt32(0);

                queryNPCTextResponse.WriteInt32(gossipData.BroadCastText.Id);

                for (int i = 0; i < 7; i++)
                    queryNPCTextResponse.WriteUInt32(0);

                BitPack.Write(1);
                BitPack.Flush();

                var size = (uint)queryNPCTextResponse.BaseStream.Length - 13;
                queryNPCTextResponse.WriteUInt32Pos(size, 8);

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

示例7: HandleQueryPlayerName

        public static void HandleQueryPlayerName(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 2, 1, 5, 7, 4, 3, 6, 0 };
            byte[] guidBytes = { 3, 2, 6, 1, 0, 4, 5, 7 };

            uint realmId = packet.Read<uint>();
            ulong guid = BitUnpack.GetPackedValue(guidMask, guidBytes);

            var pSession = WorldMgr.GetSession(guid);
            if (pSession != null)
            {
                var pChar = pSession.Character;

                if (pChar != null)
                {
                    PacketWriter queryPlayerNameResponse = new PacketWriter(ServerMessage.QueryPlayerNameResponse);
                    BitPack BitPack = new BitPack(queryPlayerNameResponse, guid);

                    BitPack.WriteGuidMask(7, 3, 0, 2, 1, 6);
                    BitPack.Write(pChar.Name.Length, 6);
                    BitPack.WriteGuidMask(4);
                    BitPack.Write(0);
                    BitPack.WriteGuidMask(5);
                    BitPack.Write(0);

                    BitPack.Flush();

                    BitPack.WriteGuidBytes(2, 7);

                    queryPlayerNameResponse.WriteUInt8(0);

                    BitPack.WriteGuidBytes(5, 6, 4, 1);

                    queryPlayerNameResponse.WriteUInt8(pChar.Gender);
                    queryPlayerNameResponse.WriteUInt8(pChar.Race);
                    queryPlayerNameResponse.WriteUInt32(realmId);
                    queryPlayerNameResponse.WriteUInt8(pChar.Class);

                    BitPack.WriteGuidBytes(3, 0);

                    queryPlayerNameResponse.WriteString(pChar.Name);

                    session.Send(ref queryPlayerNameResponse);
                }
            }
        }
开发者ID:ArkantosWoW,项目名称:ArkantosEmu,代码行数:48,代码来源:CacheHandler.cs

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

示例9: HandleSetSelection

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

            BitUnpack GuidUnpacker = new BitUnpack(packet);

            ulong fullGuid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
            ulong guid = SmartGuid.GetGuid(fullGuid);

            if (session.Character != null)
            {
                var sess = WorldMgr.GetSession(session.Character.Guid);

                if (sess != null)
                    sess.Character.TargetGuid = fullGuid;

                if (guid == 0)
                    Log.Message(LogType.Debug, "Character (Guid: {0}) removed current selection.", session.Character.Guid);
                else
                    Log.Message(LogType.Debug, "Character (Guid: {0}) selected a {1} (Guid: {2}, Id: {3}).", session.Character.Guid, SmartGuid.GetGuidType(fullGuid), guid, SmartGuid.GetId(fullGuid));
            }
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:23,代码来源:MiscHandler.cs

示例10: HandleSetActionButton

        public static void HandleSetActionButton(ref PacketReader packet, WorldClass session)
        {
            var pChar = session.Character;

            byte[] actionMask = { 5, 0, 3, 1, 4, 7, 6, 2 };
            byte[] actionBytes = { 3, 4, 6, 7, 1, 2, 0, 5 };

            BitUnpack actionUnpacker = new BitUnpack(packet);

            var slotId = packet.Read<byte>();
            var actionId = actionUnpacker.GetPackedValue(actionMask, actionBytes);

            if (actionId == 0)
            {
                var action = pChar.ActionButtons.Where(button => button.SlotId == slotId && button.SpecGroup == pChar.ActiveSpecGroup).Select(button => button).First();

                ActionMgr.RemoveActionButton(pChar, action, true);
                Log.Message(LogType.Debug, "Character (Guid: {0}) removed action button {1} from slot {2}.", pChar.Guid, actionId, slotId);

                return;
            }

            var newAction = new ActionButton
            {
                Action    = actionId,
                SlotId    = slotId,
                SpecGroup = pChar.ActiveSpecGroup
            };

            ActionMgr.AddActionButton(pChar, newAction, true);
            Log.Message(LogType.Debug, "Character (Guid: {0}) added action button {1} to slot {2}.", pChar.Guid, actionId, slotId);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:32,代码来源:MiscHandler.cs

示例11: HandlePlayerLogin

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

            BitUnpack GuidUnpacker = new BitUnpack(packet);

            var unknown = packet.Read<float>();
            var guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);

            Log.Message(LogType.Debug, "Character with Guid: {0}, AccountId: {1} tried to enter the world.", guid, session.Account.Id);

            session.Character = new Character(guid);

            if (!WorldMgr.AddSession(guid, ref session))
            {
                Log.Message(LogType.Error, "A Character with Guid: {0} is already logged in", guid);
                return;
            }

            WorldMgr.WriteAccountDataTimes(AccountDataMasks.CharacterCacheMask, ref session);

            MiscHandler.HandleMessageOfTheDay(ref session);
            TimeHandler.HandleLoginSetTimeSpeed(ref session);
            SpecializationHandler.HandleUpdateTalentData(ref session);
            SpellHandler.HandleSendKnownSpells(ref session);
            MiscHandler.HandleUpdateActionButtons(ref session);

            if (session.Character.LoginCinematic)
                CinematicHandler.HandleStartCinematic(ref session);

            ObjectHandler.HandleUpdateObjectCreate(ref session);
        }
开发者ID:Kahath,项目名称:Arctium-WoW,代码行数:33,代码来源:CharacterHandler.cs

示例12: HandleTalkToGossip

        public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 2, 1, 7, 3, 6, 0, 4, 5 };
            byte[] guidBytes = { 5, 3, 6, 2, 7, 0, 4, 1 };

            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
            var gossipData = GossipMgr.GetGossip<Creature>(ObjectGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
                BitPack BitPack = new BitPack(gossipMessage, guid);

                BitPack.WriteGuidMask(0, 5);
                BitPack.Write(gossipData.OptionsCount, 20);
                BitPack.WriteGuidMask(6, 1);

                for (int i = 0; i < gossipData.OptionsCount; i++)
                {
                    // OptionsCount not supported.
                }

                BitPack.WriteGuidMask(2);
                BitPack.Write(gossipData.QuestsCount, 19);
                BitPack.WriteGuidMask(4);

                for (int i = 0; i < gossipData.QuestsCount; i++)
                {
                    // QuestsCount not supported.
                }

                BitPack.WriteGuidMask(3, 7);
                BitPack.Flush();

                for (int i = 0; i < gossipData.OptionsCount; i++)
                {
                    // OptionsCount not supported.
                }

                for (int i = 0; i < gossipData.QuestsCount; i++)
                {
                    // QuestsCount not supported.
                }

                BitPack.WriteGuidBytes(5, 2, 6, 0);

                gossipMessage.WriteInt32(gossipData.Id);

                BitPack.WriteGuidBytes(4, 7);

                gossipMessage.WriteInt32(gossipData.TextID);

                BitPack.WriteGuidBytes(3, 1);

                gossipMessage.WriteInt32(gossipData.FriendshipFactionID);

                session.Send(ref gossipMessage);
            }
        }
开发者ID:Krogonos,项目名称:Arctium,代码行数:61,代码来源:GossipHandler.cs


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