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


C# PacketReader.ReadInt32方法代码示例

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


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

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

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

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

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

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

示例6: BandageRequest

		public static void BandageRequest( NetState state, PacketReader pvSrc )
		{
			Mobile from = state.Mobile;
			
			if ( from.AccessLevel >= AccessLevel.Counselor || DateTime.Now >= from.NextActionTime )
			{
				Serial use = pvSrc.ReadInt32();
				Serial targ = pvSrc.ReadInt32();
				
				Bandage bandage = World.FindItem( use ) as Bandage;
				
				if( bandage != null && from.InRange( bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) )
				{
					from.RevealingAction();
					
					Mobile to = World.FindMobile(targ);
					
					if ( to != null )
					{
						if ( from.InRange( bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) )
						{
							if ( BandageContext.BeginHeal( from, to ) != null )
								bandage.Consume();
						}
						else
						{
							from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
						}
					}
					else
					{
						from.SendLocalizedMessage( 500970 ); // Bandages can not be used on that.
					}
					
					from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 );			
				}
			}
			else
			{
				from.SendActionMessage();
			}
		}
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:42,代码来源:BandagePacket.cs

示例7: BandageRequest

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

			if ( from.Alive )
			{
				if ( from.AccessLevel >= AccessLevel.Counselor || DateTime.UtcNow >= from.NextActionTime )
				{
					Serial use = pvSrc.ReadInt32();
					Serial targ = pvSrc.ReadInt32();

					Bandage bandage = World.FindItem( use ) as Bandage;

					if ( bandage != null && !bandage.Deleted )
					{
						if ( from.InRange( bandage.GetWorldLocation(), 2 ) )
						{
							//from.RevealingAction();

							Mobile to = World.FindMobile( targ );

							if ( to != null )
							{
								if ( BandageContext.BeginHeal( from, to ) != null )
									bandage.Consume();
							}
							else
								from.SendLocalizedMessage( 500970 ); // Bandages can not be used on that.
						}
						else
							from.SendLocalizedMessage( 500295 ); // You are too far away to do that.

                        from.NextActionTime = DateTime.UtcNow + Mobile.ServerWideObjectDelay;
					}
				}
				else
					from.SendActionMessage();
			}
			else
				from.SendLocalizedMessage( 500949 ); // You can't do that when you're dead.
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:41,代码来源:BandagePacket.cs

示例8: LoginServerSeed

        public static void LoginServerSeed(NetState state, PacketReader pvSrc)
        {
            int seed = pvSrc.ReadInt32(); // Seed

            int clientMaj = pvSrc.ReadInt32();
            int clientMin = pvSrc.ReadInt32();
            int clientRev = pvSrc.ReadInt32();
            int clientPat = pvSrc.ReadInt32();

            if ((seed == 0) && (clientMaj == 0) && (clientMin == 0) && (clientPat == 0) && (clientRev == 0))
            {
                state.SentFirstPacket = true;
                // This is UOExt. Cheers!
                state.Send(m_UOExtSupport);
                state.Flush();
                return;
            }

            // Enroute to old EF handler
            pvSrc.Seek(0, System.IO.SeekOrigin.Begin);
            m_OldEFHandler.OnReceive(state, pvSrc);

        }
开发者ID:WildGenie,项目名称:uo-ext,代码行数:23,代码来源:UOExtAdapter.cs

示例9: CustomRunebook

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

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

            if (runebook != null)
            {
                Packets.SallosRunebook packet = new Packets.SallosRunebook(runebook);

                if (packet.UnderlyingStream.Length > 7)
                    state.Send(packet);
            }
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:MapUO.cs

示例10: MobileQuery2

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

			pvSrc.ReadInt32(); // 0xEDEDEDED
			int type = pvSrc.ReadByte();
			Mobile m = World.FindMobile(pvSrc.ReadInt32());

			if (m != null)
			{
				switch (type)
				{
					case 0x00: // Unknown, sent by godclient
					{
						if ( PacketHandlers.VerifyGC( state ) )
							Console.WriteLine( "God Client: {0}: Query 0x{1:X2} on {2} '{3}'", state, type, m.Serial, m.Name );

						break;
					}
					case 0x04: // Stats
					{
						m.OnStatsQuery( from );
						break;
					}
					case 0x05:
					{
						m.SendGump( new TMSS.ParallelSkillsGump( m ) );
						break;
					}
					default:
					{
						pvSrc.Trace( state );
						break;
					}
				}
			}
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:37,代码来源:SkillReplacement.cs

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

示例12: RemoveHighlightKRUIElement

        public static void RemoveHighlightKRUIElement( GameClient state, PacketReader pvSrc )
        {
            Mobile m = World.Instance.FindMobile( (Serial) pvSrc.ReadInt32() );

            int elementID = pvSrc.ReadInt16();

            PlayerMobile pm = m as PlayerMobile;

            if ( pm != null )
            {
                if ( elementID == 0x791F )
                    pm.CheckKRStartingQuestStep( 15 );

                if ( elementID == 0x7919 )
                    pm.CheckKRStartingQuestStep( 6 );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:17,代码来源:UI.cs

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

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

示例15: ReportUseKRHotbarIcon

        public static void ReportUseKRHotbarIcon( GameClient state, PacketReader pvSrc )
        {
            pvSrc.ReadInt32(); // 0x00010006

            /*
             * Types:
             * 0x1 - Spell
             * 0x2 - Weapon Ability
             * 0x3 - Skill
             * 0x4 - Item
             * 0x5 - Scroll
             *
             * As per RUOSI packet guide:
             * "Sometimes between 2.48.0.3 and 2.59.0.2 they changed it again: now type is always 0x06."
             */
            int type = pvSrc.ReadByte();

            pvSrc.ReadByte(); // 0x00

            int objectID = pvSrc.ReadByte();
            objectID |= pvSrc.ReadByte() << 8;
            objectID |= pvSrc.ReadByte() << 16;
            objectID |= pvSrc.ReadByte() << 24;

            #region KR Starting Quest
            Item item = World.Instance.FindItem( (Serial) objectID );

            if ( type == 6 && item != null && item is MagicArrowScroll )
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if ( pm != null )
                    pm.CheckKRStartingQuestStep( 23 );
            }
            #endregion
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:36,代码来源:UI.cs


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