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


C# PacketReader.ReadByte方法代码示例

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


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

示例1: OnHuedEffect

 private static void OnHuedEffect(PacketReader p, PacketHandlerEventArgs args)
 {
     byte type = p.ReadByte();
     Serial src = p.ReadUInt32();
     Serial dest = p.ReadUInt32();
     ItemID itemID = p.ReadUInt16();
     p.Seek(10, SeekOrigin.Current);
     byte speed = p.ReadByte();
     byte count = p.ReadByte();
     p.ReadUInt32();
     uint hue = p.ReadUInt32();
     uint mode = p.ReadUInt32();
     Handle(huedEffect, args, type, src, dest, itemID, speed, count, hue, mode);
 }
开发者ID:jaryn-kubik,项目名称:RazorEx,代码行数:14,代码来源:Event.Others.cs

示例2: ReadPacket

 public void ReadPacket(PacketReader reader)
 {
     FailureReason = (LoginFailureReason)reader.ReadInt32();
     var fingerprintJson = reader.ReadString();
     if (fingerprintJson != null)
         Fingerprint = new Fingerprint(fingerprintJson);
     HostName = reader.ReadString();
     AssetsRootUrl = reader.ReadString();
     iTunesUrl = reader.ReadString();
     Unknown1 = reader.ReadString();
     RemainingTime = reader.ReadInt32();
     Unknown2 = reader.ReadByte();
     CompressedFingerprintJson = reader.ReadByteArray();
     Unknown3 = reader.ReadString();
     Unknown4 = reader.ReadString();
 }
开发者ID:maithanhtan,项目名称:CoCSharp,代码行数:16,代码来源:LoginFailedPacket.cs

示例3: Read

        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <param name="packet">
        /// </param>
        public static void Read(Client client, byte[] packet)
        {
            // TODO: Fix this mess.
            ushort data_length = BitConverter.ToUInt16(new[] { packet[3], packet[2] }, 0);
            byte[] sender_ID = BitConverter.GetBytes(client.Character.characterId);
            Array.Reverse(sender_ID);
            MemoryStream m_stream = new MemoryStream();
            m_stream.Write(packet, 0, 9);
            m_stream.Write(sender_ID, 0, 4);
            m_stream.Write(packet, 9, packet.Length - 9);
            m_stream.Capacity = (int)m_stream.Length;
            byte[] message = m_stream.GetBuffer();
            byte[] new_length = BitConverter.GetBytes(message.Length - 4);
            message[2] = new_length[1];
            message[3] = new_length[0];
            m_stream.Close();
            m_stream.Dispose();

            foreach (Client m_client in client.Server.Clients)
            {
                if (!m_client.KnownClients.Contains(client.Character.characterId))
                {
                    byte[] pname = PlayerName.New(client, client.Character.characterId);
                    m_client.Send(pname);
                    m_client.KnownClients.Add(client.Character.characterId);
                }

                m_client.Send(message);
            }

            PacketReader reader = new PacketReader(ref packet);
            reader.ReadUInt16();
            reader.ReadUInt16();
            reader.ReadUInt16();
            reader.ReadUInt16();
            reader.ReadByte();
            string text = reader.ReadString();
            string channelName = ChatChannels.GetChannel(packet).Name;
            ChatLogger.WriteString(channelName, text, client.Character.characterName);
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:47,代码来源:ChannelMessage.cs

示例4: EquipmentUpdate

        private static void EquipmentUpdate( PacketReader p )
        {
            Serial serial = p.ReadUInt32();

            Item i = World.FindItem( serial );
            if ( i == null )
            {
                World.AddItem( i=new Item( serial ) );
                Item.UpdateContainers();
            }

            if ( World.Player != null && World.Player.Holding == i )
                World.Player.Holding = null;

            ushort iid = p.ReadUInt16();
            i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
            i.Layer = p.ReadByte();
            Serial ser = p.ReadUInt32();// cont must be set after hue (for counters)
            i.Hue = p.ReadUInt16();

            i.Container = ser;
        }
开发者ID:herculesjr,项目名称:razor,代码行数:22,代码来源:Handlers.cs

示例5: read_invoke_res

 void read_invoke_res(PacketReader r, out ValueImpl v, out ValueImpl exc, out ValueImpl out_this, out ValueImpl[] out_args)
 {
     int resflags = r.ReadByte ();
     v = null;
     exc = null;
     out_this = null;
     out_args = null;
     if (resflags == 0) {
         exc = r.ReadValue ();
     } else {
         v = r.ReadValue ();
         if ((resflags & 2) != 0)
             out_this = r.ReadValue ();
         if ((resflags & 4) != 0) {
             int nargs = r.ReadInt ();
             out_args = new ValueImpl [nargs];
             for (int i = 0; i < nargs; ++i)
                 out_args [i] = r.ReadValue ();
         }
     }
 }
开发者ID:nerzhulart,项目名称:debugger-libs,代码行数:21,代码来源:Connection.cs

示例6: ExtendedPacket

        private static void ExtendedPacket( PacketReader p, PacketHandlerEventArgs args )
        {
            ushort type = p.ReadUInt16();

            switch ( type )
            {
                case 0x04: // close gump
                {
                    // int serial, int tid
                    if ( World.Player != null )
                        World.Player.HasGump = false;
                    break;
                }
                case 0x06: // party messages
                {
                    OnPartyMessage( p, args );
                    break;
                }
                case 0x08: // map change
                {
                    if ( World.Player != null )
                        World.Player.Map = p.ReadByte();
                    break;
                }
                case 0x14: // context menu
                {
                    p.ReadInt16(); // 0x01
                    UOEntity ent = null;
                    Serial ser = p.ReadUInt32();
                    if ( ser.IsMobile )
                        ent = World.FindMobile( ser );
                    else if ( ser.IsItem )
                        ent = World.FindItem( ser );

                    if ( ent != null )
                    {
                        byte count = p.ReadByte();

                        try
                        {
                            ent.ContextMenu.Clear();

                            for(int i=0;i<count;i++)
                            {
                                ushort idx = p.ReadUInt16();
                                ushort num = p.ReadUInt16();
                                ushort flags = p.ReadUInt16();
                                ushort color = 0;

                                if ( (flags&0x02) != 0 )
                                    color = p.ReadUInt16();

                                ent.ContextMenu.Add( idx, num );
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;
                }
                case 0x18: // map patches
                {
                    if ( World.Player != null )
                    {
                        int count = p.ReadInt32() * 2;
                        try
                        {
                            World.Player.MapPatches = new int[count];
                            for(int i=0;i<count;i++)
                                World.Player.MapPatches[i] = p.ReadInt32();
                        }
                        catch
                        {
                        }
                    }
                    break;
                }
                case 0x19: //  stat locks
                {
                    if ( p.ReadByte() == 0x02 )
                    {
                        Mobile m = World.FindMobile( p.ReadUInt32() );
                        if ( World.Player == m && m != null )
                        {
                            p.ReadByte();// 0?

                            byte locks = p.ReadByte();

                            World.Player.StrLock = (LockType)((locks>>4) & 3);
                            World.Player.DexLock = (LockType)((locks>>2) & 3);
                            World.Player.IntLock = (LockType)(locks & 3);
                        }
                    }
                    break;
                }
                case 0x1D: // Custom House "General Info"
                {
                    Item i = World.FindItem( p.ReadUInt32() );
                    if ( i != null )
//.........这里部分代码省略.........
开发者ID:herculesjr,项目名称:razor,代码行数:101,代码来源:Handlers.cs

示例7: DropRequest

        private static void DropRequest( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial iser = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            if ( Engine.UsePostKRPackets )
                /* grid num */p.ReadByte();
            Point3D newPos = new Point3D( x, y, z );
            Serial dser = p.ReadUInt32();

            if ( Macros.MacroManager.AcceptActions )
                MacroManager.Action( new DropAction( dser, newPos ) );

            Item i = World.FindItem( iser );
            if ( i == null )
                return;

            Item dest = World.FindItem( dser );
            if ( dest != null && dest.IsContainer && World.Player != null && ( dest.IsChildOf( World.Player.Backpack ) || dest.IsChildOf( World.Player.Quiver ) ) )
                i.IsNew = true;

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = DragDropManager.Drop( i, dser, newPos );
        }
开发者ID:herculesjr,项目名称:razor,代码行数:25,代码来源:Handlers.cs

示例8: ClientTextCommand

        private static void ClientTextCommand( PacketReader p, PacketHandlerEventArgs args )
        {
            int type = p.ReadByte();
            string command = p.ReadString();

            switch ( type )
            {
                case 0x24: // Use skill
                {
                    int skillIndex;

                    try{ skillIndex = Convert.ToInt32( command.Split( ' ' )[0] ); }
                    catch{ break; }

                    if ( World.Player != null )
                        World.Player.LastSkill = skillIndex;

                    if ( Macros.MacroManager.AcceptActions )
                        MacroManager.Action( new UseSkillAction( skillIndex ) );

                    if ( skillIndex == (int)SkillName.Stealth && !World.Player.Visible )
                        StealthSteps.Hide();
                    break;
                }
                case 0x27: // Cast spell from book
                {
                    try
                    {
                        string[] split = command.Split( ' ' );

                        if ( split.Length > 0 )
                        {
                            ushort spellID = Convert.ToUInt16( split[0] );
                            Serial serial = Convert.ToUInt32( split.Length > 1 ? Utility.ToInt32( split[1], -1 ) : -1 );
                            Spell s = Spell.Get( spellID );
                            if ( s != null )
                            {
                                s.OnCast( p );
                                args.Block = true;
                                if ( Macros.MacroManager.AcceptActions )
                                    MacroManager.Action( new BookCastSpellAction( s, serial ) );
                            }
                        }
                    }
                    catch
                    {
                    }
                    break;
                }
                case 0x56: // Cast spell from macro
                {
                    try
                    {
                        ushort spellID = Convert.ToUInt16( command );
                        Spell s = Spell.Get( spellID );
                        if ( s != null )
                        {
                            s.OnCast( p );
                            args.Block = true;
                            if ( Macros.MacroManager.AcceptActions )
                                MacroManager.Action( new MacroCastSpellAction( s ) );
                        }
                    }
                    catch
                    {
                    }
                    break;
                }
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:70,代码来源:Handlers.cs

示例9: ChangeSeason

 private static void ChangeSeason( PacketReader p, PacketHandlerEventArgs args )
 {
     if ( World.Player != null )
         World.Player.Season = p.ReadByte();
 }
开发者ID:herculesjr,项目名称:razor,代码行数:5,代码来源:Handlers.cs

示例10: Skills

        private static void Skills( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player == null || World.Player.Skills == null || Engine.MainWindow == null )
                return;

            byte type = p.ReadByte();

            switch ( type )
            {
                case 0x02://list (with caps, 3.0.8 and up)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            if ( skill == null )
                                continue;

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = p.ReadUInt16();
                            if ( !World.Player.SkillsSent )
                                skill.Delta = 0;
                            ClientCommunication.PostSkillUpdate( i-1, skill.FixedBase );
                        }
                        else
                        {
                            p.Seek( 7, SeekOrigin.Current );
                        }
                    }

                    World.Player.SkillsSent = true;
                    Engine.MainWindow.RedrawSkills();
                    break;
                }

                case 0x00: // list (without caps, older clients)
                {
                    int i;
                    while ( (i = p.ReadUInt16()) > 0 )
                    {
                        if ( i>0 && i <= Skill.Count )
                        {
                            Skill skill = World.Player.Skills[i-1];

                            if ( skill == null )
                                continue;

                            skill.FixedValue = p.ReadUInt16();
                            skill.FixedBase = p.ReadUInt16();
                            skill.Lock = (LockType)p.ReadByte();
                            skill.FixedCap = 100;//p.ReadUInt16();
                            if ( !World.Player.SkillsSent )
                                skill.Delta = 0;

                            ClientCommunication.PostSkillUpdate( i-1, skill.FixedBase );
                        }
                        else
                        {
                            p.Seek( 5, SeekOrigin.Current );
                        }
                    }

                    World.Player.SkillsSent = true;
                    Engine.MainWindow.RedrawSkills();
                    break;
                }

                case 0xDF: //change (with cap, new clients)
                {
                    int i = p.ReadUInt16();

                    if ( i >= 0 && i < Skill.Count )
                    {
                        Skill skill = World.Player.Skills[i];

                        if ( skill == null )
                            break;

                        ushort old = skill.FixedBase;
                        skill.FixedValue = p.ReadUInt16();
                        skill.FixedBase = p.ReadUInt16();
                        skill.Lock = (LockType)p.ReadByte();
                        skill.FixedCap = p.ReadUInt16();
                        Engine.MainWindow.UpdateSkill( skill );

                        if ( Config.GetBool( "DisplaySkillChanges" ) && skill.FixedBase != old )
                            World.Player.SendMessage( MsgLevel.Force, LocString.SkillChanged, (SkillName)i, skill.Delta > 0 ? "+" : "", skill.Delta, skill.Value, skill.FixedBase - old > 0 ? "+" : "", ((double)( skill.FixedBase - old )) / 10.0 );
                        ClientCommunication.PostSkillUpdate( i, skill.FixedBase );
                    }
                    break;
                }

                case 0xFF: //change (without cap, older clients)
                {
                    int i = p.ReadUInt16();
//.........这里部分代码省略.........
开发者ID:herculesjr,项目名称:razor,代码行数:101,代码来源:Handlers.cs

示例11: MovementDemand

        private static void MovementDemand( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( PacketPlayer.Playing )
                ClientCommunication.ForceSendToClient( new MobileUpdate( World.Player ) );

            World.Player.ProcessMove( (Direction)p.ReadByte() );
        }
开发者ID:herculesjr,项目名称:razor,代码行数:7,代码来源:Handlers.cs

示例12: MovementAck

        private static void MovementAck( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player != null )
            {
                byte oldNoto = World.Player.Notoriety;

                byte seq = p.ReadByte();
                World.Player.Notoriety = p.ReadByte();

                if ( WalkAction.IsMacroWalk( seq ) )
                    args.Block = true;

                args.Block |= !World.Player.MoveAck( seq );

                if ( oldNoto != World.Player.Notoriety && Config.GetBool( "ShowNotoHue" ) )
                    ClientCommunication.RequestTitlebarUpdate();
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:18,代码来源:Handlers.cs

示例13: MobileStatus

        private static void MobileStatus( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            m.Name = p.ReadString( 30 );

            m.Hits = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();//CanBeRenamed

            byte type = p.ReadByte();

            if ( m == World.Player && type != 0x00 )
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                int oStr = player.Str, oDex = player.Dex, oInt = player.Int;

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                if ( player.Str != oStr && oStr != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.StrChanged, player.Str - oStr > 0 ? "+" : "", player.Str - oStr, player.Str );

                if ( player.Dex != oDex && oDex != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.DexChanged, player.Dex - oDex > 0 ? "+" : "", player.Dex - oDex, player.Dex );

                if ( player.Int != oInt && oInt != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.IntChanged, player.Int - oInt > 0 ? "+" : "", player.Int - oInt, player.Int );

                player.Stam = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold = p.ReadUInt32();
                player.AR = p.ReadUInt16(); // ar / physical resist
                player.Weight = p.ReadUInt16();

                if ( type >= 0x03 )
                {
                    if ( type > 0x04 )
                    {
                        player.MaxWeight = p.ReadUInt16();

                        p.ReadByte(); // race?
                    }

                    player.StatCap = p.ReadUInt16();

                    if ( type > 0x03 )
                    {
                        player.Followers = p.ReadByte();
                        player.FollowersMax = p.ReadByte();

                        player.FireResistance = p.ReadInt16();
                        player.ColdResistance = p.ReadInt16();
                        player.PoisonResistance = p.ReadInt16();
                        player.EnergyResistance = p.ReadInt16();

                        player.Luck = p.ReadInt16();

                        player.DamageMin = p.ReadUInt16();
                        player.DamageMax = p.ReadUInt16();

                        player.Tithe = p.ReadInt32();
                    }
                }

                ClientCommunication.RequestTitlebarUpdate();

                ClientCommunication.PostHitsUpdate();
                ClientCommunication.PostStamUpdate();
                ClientCommunication.PostManaUpdate();

                Engine.MainWindow.UpdateTitle(); // update player name
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:85,代码来源:Handlers.cs

示例14: LoginConfirm

        private static void LoginConfirm( PacketReader p, PacketHandlerEventArgs args )
        {
            World.Items.Clear();
            World.Mobiles.Clear();

            UseNewStatus = false;

            Serial serial = p.ReadUInt32();

            PlayerData m = new PlayerData( serial );
            m.Name = World.OrigPlayerName;

            Mobile test = World.FindMobile( serial );
            if ( test != null )
                test.Remove();

            World.AddMobile( World.Player = m );
            Config.LoadProfileFor( World.Player );

            PlayerData.ExternalZ = false;

            p.ReadUInt32(); // always 0?
            m.Body = p.ReadUInt16();
            m.Position = new Point3D( p.ReadUInt16(), p.ReadUInt16(), p.ReadInt16() );
            m.Direction = (Direction)p.ReadByte();
            m.Resync();

            //ClientCommunication.SendToServer( new SkillsQuery( m ) );
            //ClientCommunication.SendToServer( new StatusQuery( m ) );

            ClientCommunication.RequestTitlebarUpdate();
            ClientCommunication.PostLogin( (int)serial.Value );
            Engine.MainWindow.UpdateTitle(); // update player name & shard name
            /*
            //the rest of the packet: (total length: 37)
            m_Stream.Write( (byte) 0 );
            m_Stream.Write( (int) -1 );

            m_Stream.Write( (short) 0 );
            m_Stream.Write( (short) 0 );
            m_Stream.Write( (short) (map==null?6144:map.Width) );
            m_Stream.Write( (short) (map==null?4096:map.Height) );

            Stream.Fill();
            */

            ClientCommunication.BeginCalibratePosition();
        }
开发者ID:herculesjr,项目名称:razor,代码行数:48,代码来源:Handlers.cs

示例15: LiftReject

        private static void LiftReject( PacketReader p, PacketHandlerEventArgs args )
        {
            /*
            if ( ActionQueue.FilterLiftReject() )
                args.Block = true;
            */
            int reason = p.ReadByte();

            if ( !DragDropManager.LiftReject() )
                args.Block = true;
            //MacroManager.PlayError( MacroError.LiftRej );
        }
开发者ID:herculesjr,项目名称:razor,代码行数:12,代码来源:Handlers.cs


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