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


C# PacketReader.ReadByte方法代码示例

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


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

示例1: BountyEntryResponse

        private static void BountyEntryResponse( NetState ns, PacketReader pvSrc )
        {
            Mobile from = ns.Mobile;
            if ( from == null )
                return;
            Mobile killer = World.FindMobile( (Serial)pvSrc.ReadInt32() );
            byte typeid = pvSrc.ReadByte();
            byte index = pvSrc.ReadByte();
            bool cancel = pvSrc.ReadByte() == 0;
            short responseLen = pvSrc.ReadInt16();
            string resp = pvSrc.ReadString();

            if ( killer != null && !cancel )
            {
                int bounty = Utility.ToInt32( resp );
                if ( bounty > 5000 )
                    bounty = 5000;
                bounty = from.BankBox.ConsumeUpTo( typeof( Gold ), bounty, true );

                killer.Kills++;
                if ( killer is PlayerMobile && bounty > 0 )
                {
                    PlayerMobile kpm = (PlayerMobile)killer;
                    kpm.Bounty += bounty;
                    killer.SendAsciiMessage( "{0} has placed a bounty of {1}gp on your head!", from.Name, bounty );
                    if ( kpm.Bounty >= 5000 && kpm.Kills > 1 && kpm.BankBox.Items.Count > 0 && kpm.Karma <= (int)Noto.Dark )
                    {
                        killer.SayTo( killer, true, "A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!" );
                        kpm.Bounty += EmptyAndGetGold( killer.BankBox.Items );
                    }
                }
            }

            SendNext( from );
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:35,代码来源:ReportMurderer.cs

示例2: CustomRunebookTravel

        private static void CustomRunebookTravel(NetState state, PacketReader pvSrc)
        {
            int RuneBookSerial = pvSrc.ReadInt32();

            byte recall = pvSrc.ReadByte();

            var X = pvSrc.ReadInt16();

            var Y = pvSrc.ReadInt16();

            var mapbyte = Convert.ToInt16(pvSrc.ReadByte());

            var runebook = World.FindItem(RuneBookSerial) as Runebook;

            var map = Map.Maps[mapbyte];

            if (runebook != null && runebook.RootParentEntity == state.Mobile && runebook.Entries != null)
            {
                var findentry = runebook.Entries.FirstOrDefault(x => x.Location.X == X && x.Location.Y == Y);
                if (findentry != null)
                {
                    var portentry = findentry.Location;
                    var entry = new RunebookEntry(portentry, findentry.Map, "", null);
                    if (recall == 0)
                    {
                        new RecallSpell(state.Mobile, null, entry, null).Cast();
                    }
                    else
                    {
                        new GateTravelSpell(state.Mobile, null, entry).Cast();
                    }
                }
            }
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:34,代码来源:MapUO.cs

示例3: ChangeOption

        public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGameDealer(state.Mobile))
                return;

            pvSrc.ReadInt16();
            pvSrc.ReadByte();

            int options = pvSrc.ReadByte();

            game.ShowScores = (options & 0x1) != 0;
            game.SpectatorVision = (options & 0x2) != 0;
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:13,代码来源:MahjongPacketHandlers.cs

示例4: DecodeBundledPacket

        public static void DecodeBundledPacket(NetState state, PacketReader pvSrc)
        {
            int packetID = pvSrc.ReadByte();

            PacketHandler ph = GetHandler(packetID);

            if (ph != null)
            {
                if (ph.Ingame && state.Mobile == null)
                {
                    Utility.PushColor(ConsoleColor.DarkRed);
                    Console.WriteLine("Client: {0}: Sent ingame packet (0xF0x{1:X2}) before having been attached to a mobile", state, packetID);
                    Utility.PopColor();
                    state.Dispose();
                }
                else if (ph.Ingame && state.Mobile.Deleted)
                {
                    state.Dispose();
                }
                else
                {
                    ph.OnReceive(state, pvSrc);
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:25,代码来源:ProtocolExtensions.cs

示例5: BBClientRequest

        public static void BBClientRequest(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;

            int packetID = pvSrc.ReadByte();
            BaseBulletinBoard board = World.FindItem(pvSrc.ReadInt32()) as BaseBulletinBoard;

            if (board == null || !board.CheckRange(from))
                return;

            switch ( packetID )
            {
                case 3:
                    BBRequestContent(from, board, pvSrc);
                    break;
                case 4:
                    BBRequestHeader(from, board, pvSrc);
                    break;
                case 5:
                    BBPostMessage(from, board, pvSrc);
                    break;
                case 6:
                    BBRemoveMessage(from, board, pvSrc);
                    break;
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:26,代码来源:BulletinBoards.cs

示例6: OnReceive

        public static void OnReceive( GameClient state, PacketReader pvSrc )
        {
            if ( pvSrc.ReadByte() == 0xFF )
                state.Send( new UOGInfo( String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K", Environment.Config.ServerName, (int) ( DateTime.Now - Server.Items.Clock.ServerStart ).TotalHours, GameServer.Instance.ClientCount, World.Instance.ItemCount, World.Instance.MobileCount, (int) ( System.GC.GetTotalMemory( false ) / 1024 ) ) ) );

            state.Dispose();
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:7,代码来源:UOGQuery.cs

示例7: TargetResponse

		public static void TargetResponse( NetState state, PacketReader pvSrc )
		{
			int type = pvSrc.ReadByte();
			int targetID = pvSrc.ReadInt32();
			int flags = pvSrc.ReadByte();
			Serial serial = pvSrc.ReadInt32();
			int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16();
			int z = pvSrc.ReadInt16();
			int graphic = pvSrc.ReadInt16();

			pvSrc.Seek( 1, System.IO.SeekOrigin.Begin );

			Mobile from = state.Mobile;

			if ( from == null || from.Target == null )
				return;

			if ( x == 0 && y == 0 && z == 0 && serial != from.Serial )
			{
				bool ok = false;
				if ( serial.IsItem )
				{
					Item i = World.FindItem( serial );
					if ( i != null && i.Location == Point3D.Zero )
						ok = true;
				}
				else if ( serial.IsMobile )
				{
					Mobile m = World.FindMobile( serial );
					if ( m != null && m.Location == Point3D.Zero )
						ok = true;
				}

				object o = m_LastTarget[from];
				if ( !ok && o != null && o is Serial && serial != (Serial)o )
				{
					from.SendAsciiMessage( "This EasyUO target has been blocked." );
					from.Target.Cancel( from, TargetCancelType.Canceled );
					return;
				}
			}

			if ( from.Serial != serial )
				m_LastTarget[from] = serial;

			m_Real6C.OnReceive( state, pvSrc );	
		}
开发者ID:greeduomacro,项目名称:GoUO,代码行数:47,代码来源:EasyUO.cs

示例8: AssignDealer

        public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGameDealer(state.Mobile))
                return;

            int position = pvSrc.ReadByte();

            game.Players.AssignDealer(position);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:9,代码来源:MahjongPacketHandlers.cs

示例9: MultiMouseMovementRequest

        public static void MultiMouseMovementRequest(NetState state, PacketReader reader)
        {
            Serial playerSerial = reader.ReadInt32();
            Direction movement = (Direction)reader.ReadByte();
            reader.ReadByte(); // movement direction duplicated
            int speed = reader.ReadByte();

            Mobile mob = World.FindMobile(playerSerial);
            if (mob == null || mob.NetState == null || !mob.Mounted)
                return;

            IMount multi = mob.Mount;
            if (!(multi is BaseBoat))
                return;

            BaseBoat boat = (BaseBoat)multi;
            boat.OnMousePilotCommand(mob, movement, speed);
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:18,代码来源:PacketHandlers.cs

示例10: AccountSearch

        private static void AccountSearch(NetState state, PacketReader pvSrc)
        {
            AcctSearchType type = (AcctSearchType)pvSrc.ReadByte();
            string term = pvSrc.ReadString();

            if (type == AcctSearchType.IP && !Utility.IsValidIP(term))
            {
                state.Send(new MessageBoxMessage("Invalid search term.\nThe IP sent was not valid.", "Invalid IP"));
                return;
            }
            else
            {
                term = term.ToUpper();
            }

            ArrayList list = new ArrayList();

            foreach (Account a in Accounts.GetAccounts())
            {
                if (!CanAccessAccount(state.Account, a))
                    continue;

                switch ( type )
                {
                    case AcctSearchType.Username:
                        {
                            if (a.Username.ToUpper().IndexOf(term) != -1)
                                list.Add(a);
                            break;
                        }
                    case AcctSearchType.IP:
                        {
                            for (int i = 0; i < a.LoginIPs.Length; i++)
                            {
                                if (Utility.IPMatch(term, a.LoginIPs[i]))
                                {
                                    list.Add(a);
                                    break;
                                }
                            }
                            break;
                        }
                }
            }

            if (list.Count > 0)
            {
                if (list.Count <= 25)
                    state.Send(AdminNetwork.Compress(new AccountSearchResults(list)));
                else
                    state.Send(new MessageBoxMessage("There were more than 25 matches to your search.\nNarrow the search parameters and try again.", "Too Many Results"));
            }
            else
            {
                state.Send(new MessageBoxMessage("There were no results to your search.\nPlease try again.", "No Matches"));
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:57,代码来源:PacketHandlers.cs

示例11: GivePoints

        public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
        {
            if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
                return;

            int to = pvSrc.ReadByte();
            int amount = pvSrc.ReadInt32();

            game.Players.TransferScore(state.Mobile, to, amount);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:10,代码来源:MahjongPacketHandlers.cs

示例12: OnPacket

		public static void OnPacket( NetState state, PacketReader pvSrc )
		{
			MahjongGame game = World.FindItem( pvSrc.ReadInt32() ) as MahjongGame;

			if ( game != null )
				game.Players.CheckPlayers();

			pvSrc.ReadByte();

			int cmd = pvSrc.ReadByte();

			OnMahjongPacketReceive onReceive = GetSubCommandDelegate( cmd );

			if ( onReceive != null )
			{
				onReceive( game, state, pvSrc );
			}
			else
			{
				pvSrc.Trace( state );
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:22,代码来源:MahjongPacketHandlers.cs

示例13: TargetResponse

        public static void TargetResponse(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;
            Target t = from.Target;

            if (t == null || IgnoreRegex.IsMatch(t.GetType().FullName))
            {
                m_Target.OnReceive(state, pvSrc);
                return;
            }

            int type = pvSrc.ReadByte();
            int targetID = pvSrc.ReadInt32();
            int flags = pvSrc.ReadByte();
            Serial serial = pvSrc.ReadInt32();

            pvSrc.Seek(1, System.IO.SeekOrigin.Begin);

            if (targetID == unchecked((int)0xDEADBEEF))
                return;

            Mobile target = null;

            if ( serial.IsMobile )
                target = World.FindMobile(serial);

            if (target == null || target == from)
            {
                m_Target.OnReceive(state, pvSrc);
                return;
            }

            HandleTarget(new TargetInfo(from, target, t.GetType()));

            m_Target.OnReceive(state, pvSrc);
        }
开发者ID:greeduomacro,项目名称:divinity,代码行数:36,代码来源:Sync.cs

示例14: OnGuildTrack

        private static void OnGuildTrack( NetState state, PacketReader pvSrc )
        {
            Mobile from = state.Mobile;
            Guild guild = from.Guild as Guild;

            if ( guild != null )
            {
                bool locations = pvSrc.ReadByte() != 0;

                Packets.GuildTrack packet = new Packets.GuildTrack( from, guild, locations );

                if ( packet.UnderlyingStream.Length > ( locations ? 9 : 5 ) )
                    state.Send( packet );
            }
            else
                state.Send( new Packets.GuildTrack() );
        }
开发者ID:svvota,项目名称:runuo,代码行数:17,代码来源:MapUO.cs

示例15: AsciiSpeechChat3

        public static void AsciiSpeechChat3(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;

            MessageType type = (MessageType)pvSrc.ReadByte();
            int hue = pvSrc.ReadInt16();
            pvSrc.ReadInt16(); // font
            string text = pvSrc.ReadStringSafe().Trim();

            if (text.Length <= 0 || text.Length > 128)
                return;

            if (!Enum.IsDefined(typeof(MessageType), type))
                type = MessageType.Regular;

            Channel c = Channel.GetByType(typeof(Guild));
            if (RUOVersion.GuildChat(type) && c != null)
                c.OnChat(from, text);
            else
                from.DoSpeech(text, c_EmptyInts, type, Utility.ClipDyedHue(hue));
        }
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:21,代码来源:Chat3Guild.cs


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