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


C# PacketReader.ReadUInt64方法代码示例

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


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

示例1: ProcessPlayerList

        public static void ProcessPlayerList(Client client, PacketReader packet)
        {
            var playerId = packet.ReadUInt64();
            var channelId = packet.ReadUInt64();
            var page = packet.ReadInt32();

            client.ClientPlayer.ChannelPage = page;

            if (client.GetChannel() != null)
                client.GetChannel().PlayerList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:11,代码来源:Channel.cs

示例2: ProcessChannelList

        public static void ProcessChannelList(Client client, PacketReader packetReader)
        {
            var uid = packetReader.ReadUInt64();
            var type = packetReader.ReadInt32();

            if (!Enum.IsDefined(typeof (ChannelType), (byte) type))
            {
                client.Disconnect();
                return;
            }

            var channels = ChannelList.GetList((ChannelType)type);
            if (channels.Count == 0)
                return;

            ChannelPackets.ResponseChannelList(client, channels);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:17,代码来源:Channel.cs

示例3: ProcessEquipItem

        public static void ProcessEquipItem(Client client, PacketReader packetReader)
        {
            var uidChar = packetReader.ReadUInt64();
            var nItemLow = packetReader.ReadInt32();
            var nItemHigh = packetReader.ReadInt32();
            var nItemSlot = packetReader.ReadInt32();
            Results result = Results.Accepted;

            if (!Enum.IsDefined(typeof(ItemSlotType), nItemSlot))
            {
                client.Disconnect();
                return;
            }

            Items.Item nItem = client.GetCharacter().Items.Find(i => i.ItemCid == nItemHigh);
            if (nItem == null)
                result = Results.ShopItemNonExistant;
            else if (nItem.Level > client.GetCharacter().Level)
            {
                result = Results.ShopLevelTooLow;
            }
            else if ((ItemSlotType)nItemSlot == ItemSlotType.primary_slot && nItem.ItemId == client.GetCharacter().EquippedItems[(int)ItemSlotType.secondary_slot].ItemId)
            {
                result = Results.ShopInvalidItem;
            }
            else if ((ItemSlotType)nItemSlot == ItemSlotType.secondary_slot && nItem.ItemId == client.GetCharacter().EquippedItems[(int)ItemSlotType.primary_slot].ItemId)
            {
                result = Results.ShopInvalidItem;
            }
            else
            {
                client.GetCharacter().EquippedItems[nItemSlot].ItemCid = nItemHigh;
                client.GetCharacter().EquippedItems[nItemSlot].ItemId = nItem.ItemId;
                Globals.GunzDatabase.UpdateSlot(client.GetCharacter().CharacterId, (ItemSlotType)nItemSlot, nItemHigh);
            }

            Match.ResponseEquipItem(client, result);
            Match.ResponseCharacterItemList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:39,代码来源:Item.cs

示例4: ProcessBuyItem

        public static void ProcessBuyItem(Client client, PacketReader packetReader)
        {
            var uid = packetReader.ReadUInt64();
            var itemid = packetReader.ReadInt32();
            var count = packetReader.ReadInt32();
            Results result = Results.Accepted;

            Items.Item item = ItemList.Find(itemid);
            if (item == null)
                result = Results.ShopItemNonExistant;
            else if ((item.Price > client.GetCharacter().Bp && Globals.Config.Items.UseBounty) || count > 0 && item.Price * count > client.GetCharacter().Bp && Globals.Config.Items.UseBounty)
                result = Results.ShopInsufficientBounty;
            else if (client.GetCharacter().Items.Count == Globals.Config.Character.MaxItems)
                result = Results.ShopInventoryFull;
            else
            {
                var temp = new Items.Item();
                temp.ItemId = item.ItemId;
                temp.Level = item.Level;
                temp.MaxWeight = item.MaxWeight;
                temp.Weight = item.Weight;
                temp.Price = item.Price;
                temp.Quantity = count;
                temp.ItemCid = Globals.GunzDatabase.AddItem(client.GetCharacter().CharacterId, item.ItemId, count);
                client.GetCharacter().Items.Add(temp);

                if (Globals.Config.Items.UseBounty)
                {
                    client.GetCharacter().Bp -= item.Price;
                    Globals.GunzDatabase.UpdateBp(client.GetCharacter().Bp, client.GetCharacter().CharacterId);
                }
            }

            Match.ResponseBuyItem(client, result);
            Match.ResponseCharacterItemList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:36,代码来源:Item.cs

示例5: Handshake

        void Handshake(ushort packet_opcode, PacketReader packet_data, bool packet_encrypted)
        {
            if (packet_encrypted)
            {
                throw (new Exception("[SecurityAPI::Handshake] Received an illogical (encrypted) handshake packet."));
            }
            if (m_client_security)
            {
                // If this object does not need a handshake
                if (m_security_flags.handshake == 0)
                {
                    // Client should only accept it then
                    if (packet_opcode == 0x9000)
                    {
                        if (m_accepted_handshake)
                        {
                            throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (duplicate 0x9000)."));
                        }
                        m_accepted_handshake = true; // Otherwise, all good here
                        return;
                    }
                    // Client should not send any 0x5000s!
                    else if (packet_opcode == 0x5000)
                    {
                        throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (0x5000 with no handshake)."));
                    }
                    // Programmer made a mistake in calling this function
                    else
                    {
                        throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (programmer error)."));
                    }
                }
                else
                {
                    // Client accepts the handshake
                    if (packet_opcode == 0x9000)
                    {
                        // Can't accept it before it's started!
                        if (!m_started_handshake)
                        {
                            throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (out of order 0x9000)."));
                        }
                        if (m_accepted_handshake) // Client error
                        {
                            throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (duplicate 0x9000)."));
                        }
                        // Otherwise, all good here
                        m_accepted_handshake = true;
                        return;
                    }
                    // Client sends a handshake response
                    else if (packet_opcode == 0x5000)
                    {
                        if (m_started_handshake) // Client error
                        {
                            throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (duplicate 0x5000)."));
                        }
                        m_started_handshake = true;
                    }
                    // Programmer made a mistake in calling this function
                    else
                    {
                        throw (new Exception("[SecurityAPI::Handshake] Received an illogical handshake packet (programmer error)."));
                    }
                }

                ulong key_array = 0;
                byte[] tmp_bytes;

                m_value_B = packet_data.ReadUInt32();
                m_client_key = packet_data.ReadUInt64();

                m_value_K = G_pow_X_mod_P(m_value_p, m_value_x, m_value_B);

                key_array = MAKELONGLONG_(m_value_A, m_value_B);
                KeyTransformValue(ref key_array, m_value_K, (byte)(LOBYTE_(LOWORD_(m_value_K)) & 0x03));
                m_blowfish.Initialize(BitConverter.GetBytes(key_array));

                tmp_bytes = m_blowfish.Decode(BitConverter.GetBytes(m_client_key));
                m_client_key = BitConverter.ToUInt64(tmp_bytes, 0);

                key_array = MAKELONGLONG_(m_value_B, m_value_A);
                KeyTransformValue(ref key_array, m_value_K, (byte)(LOBYTE_(LOWORD_(m_value_B)) & 0x07));
                if (m_client_key != key_array)
                {
                    throw (new Exception("[SecurityAPI::Handshake] Client signature error."));
                }

                key_array = MAKELONGLONG_(m_value_A, m_value_B);
                KeyTransformValue(ref key_array, m_value_K, (byte)(LOBYTE_(LOWORD_(m_value_K)) & 0x03));
                m_blowfish.Initialize(BitConverter.GetBytes(key_array));

                m_challenge_key = MAKELONGLONG_(m_value_A, m_value_B);
                KeyTransformValue(ref m_challenge_key, m_value_K, (byte)(LOBYTE_(LOWORD_(m_value_A)) & 0x07));
                tmp_bytes = m_blowfish.Encode(BitConverter.GetBytes(m_challenge_key));
                m_challenge_key = BitConverter.ToUInt64(tmp_bytes, 0);

                KeyTransformValue(ref m_handshake_blowfish_key, m_value_K, 0x3);
                m_blowfish.Initialize(BitConverter.GetBytes(m_handshake_blowfish_key));

//.........这里部分代码省略.........
开发者ID:dawnoble,项目名称:blackcatproject,代码行数:101,代码来源:Security.cs

示例6: ProcessGameSpawn

        public static void ProcessGameSpawn(Client client, PacketReader packetReader)
        {
            var uid = packetReader.ReadUInt64();
            var xpos = packetReader.ReadSingle();
            var ypos = packetReader.ReadSingle();
            var zpos = packetReader.ReadSingle();
            var xdir = packetReader.ReadSingle();
            var ydir = packetReader.ReadSingle();
            var zdir = packetReader.ReadSingle();

            if (client.GetStage() != null)
            {
                var traits = client.GetStage().GetTraits();

                if (traits.Ruleset.IsDuel())
                {
                    if (traits.DuelQueue.Challenger != client && traits.DuelQueue.Champion != client)
                        return;
                }
                if (traits.Ruleset.IsTeam())
                    return;

                var position = new Position();
                var direction = new Direction();

                position.X = xpos;
                position.Y = ypos;
                position.Z = zpos;

                direction.X = xdir;
                direction.Y = ydir;
                direction.Z = zdir;
                lock (client.GetStage().ObjectLock)
                {
                    Battle.GameSpawn(client.GetStage().GetTraits().Players, client.GetMuid(),
                                     position, direction);
                }
            }
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:39,代码来源:StageHandler.cs

示例7: ResponseStageChat

        public static void ResponseStageChat(Client client, PacketReader packetReader)
        {
            var uidChar = packetReader.ReadUInt64();
            var uidStage = packetReader.ReadUInt64();
            var message = packetReader.ReadString();

            if (client.GetStage() != null)
                client.GetStage().Chat(client, message);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:9,代码来源:StageHandler.cs

示例8: ProcessStageList

        public static void ProcessStageList(Client client, PacketReader packetReader)
        {
            var uidChar = packetReader.ReadUInt64();
            var uidChan = packetReader.ReadUInt64();
            var page = packetReader.ReadInt32();

            client.ClientPlayer.StageIndex = Convert.ToByte(page);
            if (client.GetChannel() != null)
                client.GetChannel().StageList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:10,代码来源:StageHandler.cs

示例9: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            PacketReader reader = new PacketReader(data);
            // This packet is "Compressed" basically.
            reader.ReadBytes(6); // Get past the junk
            // For simplicity's sake, read the 3 flag bytes into a big int
            byte[] flagBytes = reader.ReadBytes(3);
            uint dataFlags = flagBytes[0];
            dataFlags |= (uint)(flagBytes[1] << 8);
            dataFlags |= (uint)(flagBytes[2] << 16);

            PackedData theFlags = (PackedData)dataFlags;

            // Debug
            Logger.WriteInternal("[MOV] Movement packet from {0} contains {1} data.", context.Character.Name, theFlags);

            // TODO: Maybe do this better someday
            FullMovementData dstData = new FullMovementData();

            if (theFlags.HasFlag(PackedData.ENT1_ID))
            {
                dstData.entity1.ID = (uint)reader.ReadUInt64();
            }
            if (theFlags.HasFlag(PackedData.ENT1_TYPE))
            {
                dstData.entity1.EntityType = (EntityType)reader.ReadUInt16();
            }
            if (theFlags.HasFlag(PackedData.ENT1_A))
            {
                dstData.entity1.Unknown_A = reader.ReadUInt16();
            }
            if (theFlags.HasFlag(PackedData.ENT2_ID))
            {
                dstData.entity1.ID = (uint)reader.ReadUInt64();
            }
            if (theFlags.HasFlag(PackedData.ENT2_TYPE))
            {
                dstData.entity1.EntityType = (EntityType)reader.ReadUInt16();
            }
            if (theFlags.HasFlag(PackedData.ENT2_A))
            {
                dstData.entity1.Unknown_A = reader.ReadUInt16();
            }
            if (theFlags.HasFlag(PackedData.TIMESTAMP))
            {
                dstData.timestamp = reader.ReadUInt32();
                context.MovementTimestamp = dstData.timestamp;
            }
            if (theFlags.HasFlag(PackedData.ROT_X))
            {
                dstData.rotation.x = reader.ReadUInt16();
                context.CurrentLocation.RotX = Helper.FloatFromHalfPrecision(dstData.rotation.x);
            }
            if (theFlags.HasFlag(PackedData.ROT_Y))
            {
                dstData.rotation.y = reader.ReadUInt16();
                context.CurrentLocation.RotY = Helper.FloatFromHalfPrecision(dstData.rotation.y);
            }
            if (theFlags.HasFlag(PackedData.ROT_Z))
            {
                dstData.rotation.z = reader.ReadUInt16();
                context.CurrentLocation.RotZ = Helper.FloatFromHalfPrecision(dstData.rotation.z);
            }
            if (theFlags.HasFlag(PackedData.ROT_W))
            {
                dstData.rotation.w = reader.ReadUInt16();
                context.CurrentLocation.RotW = Helper.FloatFromHalfPrecision(dstData.rotation.w);
            }
            if (theFlags.HasFlag(PackedData.CUR_X))
            {
                dstData.currentPos.x = reader.ReadUInt16();
                context.CurrentLocation.PosX = Helper.FloatFromHalfPrecision(dstData.currentPos.x);
            }
            if (theFlags.HasFlag(PackedData.CUR_Y))
            {
                dstData.currentPos.y = reader.ReadUInt16();
                context.CurrentLocation.PosY = Helper.FloatFromHalfPrecision(dstData.currentPos.y);
            }
            if (theFlags.HasFlag(PackedData.CUR_Z))
            {
                dstData.currentPos.z = reader.ReadUInt16();
                context.CurrentLocation.PosZ = Helper.FloatFromHalfPrecision(dstData.currentPos.z);
            }
            if (theFlags.HasFlag(PackedData.UNKNOWN4))
            {
                dstData.Unknown2 = reader.ReadUInt16();
            }
            if (theFlags.HasFlag(PackedData.UNK_X))
            {
                dstData.unknownPos.x = reader.ReadUInt16();
                context.LastLocation.PosX = Helper.FloatFromHalfPrecision(dstData.unknownPos.x);
            }
            if (theFlags.HasFlag(PackedData.UNK_Y))
            {
                dstData.unknownPos.y = reader.ReadUInt16();
                context.LastLocation.PosY = Helper.FloatFromHalfPrecision(dstData.unknownPos.y);
            }
            if (theFlags.HasFlag(PackedData.UNK_Z))
            {
                dstData.unknownPos.z = reader.ReadUInt16();
//.........这里部分代码省略.........
开发者ID:Joslyn-Maddie,项目名称:PolarisServer,代码行数:101,代码来源:MovementHandlers.cs

示例10: ReadUInt64_Should_Read_In_LittleEndian

        public void ReadUInt64_Should_Read_In_LittleEndian()
        {
            var buffer = Helpers.GetRandomBytes(8);
            ulong expected = buffer[0] + ((ulong)buffer[1] << 8) + ((ulong)buffer[2] << 16) + ((ulong)buffer[3] << 24) + ((ulong)buffer[4] << 32) + ((ulong)buffer[5] << 40) + ((ulong)buffer[6] << 48) + ((ulong)buffer[7] << 56);

            var reader = new PacketReader(buffer);
            ulong actual = reader.ReadUInt64();

            actual.Should().Be(expected);
        }
开发者ID:shoftee,项目名称:OpenStory,代码行数:10,代码来源:UnsafePacketReadingFixture.cs

示例11: ResponseChannelJoinFromName

        public static void ResponseChannelJoinFromName(Client client, PacketReader packetReader)
        {
            var uid = packetReader.ReadUInt64();
            var type = packetReader.ReadInt32();
            var name = packetReader.ReadString();

            if (!Enum.IsDefined(typeof(ChannelType), (byte)type))
            {
                client.Disconnect();
                return;
            }

            Channels.Channel c = ChannelList.Find((ChannelType) type, name);
            if (c == null)
            {
                var channel = new ChannelTraits();
                channel.ChannelName = name;
                channel.Rule = ChannelRule.Elite;
                channel.Type = (ChannelType)type;
                channel.MaxLevel = 100;
                channel.MinLevel = 0;
                channel.MaxUsers = 100;

                ChannelList.AddAndJoin(client, channel);
                return;
            }
            client.ClientPlayer.PlayerChannel = c;
            c.Join(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:29,代码来源:Channel.cs

示例12: ProcessSellItem

        public static void ProcessSellItem(Client client, PacketReader packetReader)
        {
            var uidChar = packetReader.ReadUInt64();
            var low = packetReader.ReadInt32();
            var high = packetReader.ReadInt32();
            var result = Results.Accepted;

            var item = client.GetCharacter().Items.Find(i => i.ItemCid == high);
            if (item == null)
                result = Results.ShopItemNonExistant;
            else
            {
                Globals.GunzDatabase.Deletetem(item.ItemCid);
                client.GetCharacter().Bp += item.Price;
                Globals.GunzDatabase.UpdateBp(client.GetCharacter().Bp, client.GetCharacter().CharacterId);
                client.GetCharacter().Items.Remove(item);
            }

            Match.ResponseSellItem(client, result);
            Match.ResponseCharacterItemList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:21,代码来源:Item.cs

示例13: ProcessTakeOffItem

        public static void ProcessTakeOffItem(Client client, PacketReader packetReader)
        {
            var uidChar = packetReader.ReadUInt64();
            var nItemSlot = packetReader.ReadInt32();

            if (!Enum.IsDefined(typeof(ItemSlotType), nItemSlot))
            {
                client.Disconnect();
                return;
            }
            client.GetCharacter().EquippedItems[nItemSlot].ItemCid = 0;
            client.GetCharacter().EquippedItems[nItemSlot].ItemId = 0;
            Globals.GunzDatabase.UpdateSlot(client.GetCharacter().CharacterId, (ItemSlotType)nItemSlot, 0);

            Match.ResponseTakeOffItem(client);
            Match.ResponseCharacterItemList(client);
        }
开发者ID:Theoretical,项目名称:bunnyemu,代码行数:17,代码来源:Item.cs


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