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


C# PacketReader.ReadInt16方法代码示例

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


在下文中一共展示了PacketReader.ReadInt16方法的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: 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

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

示例4: WorldBroadcast

        private static void WorldBroadcast( NetState state, PacketReader pvSrc )
        {
            string message = pvSrc.ReadUTF8String();
            int hue = pvSrc.ReadInt16();
            bool ascii = pvSrc.ReadBoolean();

            World.Broadcast(hue, ascii, message);

            state.Send( new MessageBoxMessage( "Your message has been broadcasted.", "Message Broadcasted" ) );
        }
开发者ID:nydehi,项目名称:runuo-remote-admin-enrichment,代码行数:10,代码来源:CustomRemoteAdminPacketHandlers.cs

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

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

示例7: ChatAction

        public static void ChatAction( NetState state, PacketReader pvSrc )
        {
            if ( !m_Enabled )
                return;

            try
            {
                Mobile from = state.Mobile;
                ChatUser user = ChatUser.GetChatUser( from );

                if ( user == null )
                    return;

                /*string lang = */pvSrc.ReadStringSafe( 4 );
                int actionID = pvSrc.ReadInt16();
                string param = pvSrc.ReadUnicodeString();

                ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID );

                if ( handler != null )
                {
                    Channel channel = user.CurrentChannel;

                    if ( handler.RequireConference && channel == null )
                    {
                        user.SendMessage( 31 ); /* You must be in a conference to do this.
                                                 * To join a conference, select one from the Conference menu.
                                                 */
                    }
                    else if ( handler.RequireModerator && !user.IsModerator )
                    {
                        user.SendMessage( 29 ); // You must have operator status to do this.
                    }
                    else
                    {
                        handler.Callback( user, channel, param );
                    }
                }
                else
                {
                    log.Warn(String.Format("Client: {0}: Unknown chat action 0x{1:X}: {2}",
                                           state, actionID, param));
                }
            }
            catch ( Exception e )
            {
                log.Error( e );
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:49,代码来源:Chat.cs

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

示例9: ChatAction

		public static void ChatAction( NetState state, PacketReader pvSrc )
		{
			if ( !Enabled )
				return;

			try
			{
				Mobile from = state.Mobile;
				ChatUser user = ChatUser.GetChatUser( from );

				if ( user == null )
					return;

				string lang = pvSrc.ReadStringSafe( 4 );
				int actionId = pvSrc.ReadInt16();
				string param = pvSrc.ReadUnicodeString();

				ChatActionHandler handler = ChatActionHandlers.GetHandler( actionId );

				if ( handler != null )
				{
					Channel channel = user.CurrentChannel;

					if ( handler.RequireConference && channel == null )
					{
						/* You must be in a conference to do this.
						 * To join a conference, select one from the Conference menu.
						 */
						user.SendMessage( 31 );
					}
					else
					{
						handler.Callback( user, channel, param );
					}
				}
				else
				{
					Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param );
				}
			}
			catch ( Exception e )
			{
                Console.WriteLine(e.ToString());
			}
		}
开发者ID:zerodowned,项目名称:justuo-with-ec-support,代码行数:45,代码来源:ChatSystem.cs

示例10: UpdateAccount

		private static void UpdateAccount( NetState state, PacketReader pvSrc )
		{
			string username = pvSrc.ReadString();
			string pass = pvSrc.ReadString();

			Account a = Accounts.GetAccount( username );

			if ( a == null )
				a = Accounts.AddAccount( username, pass );
			else if ( pass != "(hidden)" )
				a.SetPassword( pass );

			if ( a != state.Account )
			{
				a.AccessLevel = (AccessLevel)pvSrc.ReadByte();
				a.Banned = pvSrc.ReadBoolean();
			}
			else
			{
				pvSrc.ReadInt16();//skip both
				state.Send( new MessageBoxMessage( "Warning: When editing your own account, account status and accesslevel cannot be changed.", "Editing Own Account" ) );
			}

			ArrayList list = new ArrayList();
			ushort length = pvSrc.ReadUInt16();
			bool invalid = false;
			for (int i=0;i<length;i++)
			{
				string add = pvSrc.ReadString();
				if ( Utility.IsValidIP( add ) )
					list.Add( add );
				else
					invalid = true;
			}

			if ( list.Count > 0 )
				a.IPRestrictions = (string[])list.ToArray( typeof( string ) );
			else
				a.IPRestrictions = new string[0];

			if ( invalid )
				state.Send( new MessageBoxMessage( "Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction" ) );
			state.Send( new MessageBoxMessage( "Account updated successfully.", "Account Updated" ) );
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:44,代码来源:PacketHandlers.cs

示例11: ProfileReq

		public static void ProfileReq( NetState state, PacketReader pvSrc )
		{
			int type = pvSrc.ReadByte();
			Serial serial = pvSrc.ReadInt32();

			Mobile beholder = state.Mobile;
			Mobile beheld = World.FindMobile( serial );

			if ( beheld == null )
				return;

			switch ( type )
			{
				case 0x00: // display request
				{
					EventSink.InvokeProfileRequest( new ProfileRequestEventArgs( beholder, beheld ) );

					break;
				}
				case 0x01: // edit request
				{
					pvSrc.ReadInt16(); // Skip
					int length = pvSrc.ReadUInt16();

					if ( length > 511 )
						return;

					string text = pvSrc.ReadUnicodeString( length );

					EventSink.InvokeChangeProfileRequest( new ChangeProfileRequestEventArgs( beholder, beheld, text ) );

					break;
				}
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:35,代码来源:PacketHandlers.cs

示例12: NewRegion

		public static void NewRegion( NetState state, PacketReader pvSrc )
		{
			if ( VerifyGC( state ) )
			{
				string name = pvSrc.ReadString( 40 );
				int unk = pvSrc.ReadInt32();
				int x = pvSrc.ReadInt16();
				int y = pvSrc.ReadInt16();
				int width = pvSrc.ReadInt16();
				int height = pvSrc.ReadInt16();
				int zStart = pvSrc.ReadInt16();
				int zEnd = pvSrc.ReadInt16();
				string desc = pvSrc.ReadString( 40 );
				int soundFX = pvSrc.ReadInt16();
				int music = pvSrc.ReadInt16();
				int nightFX = pvSrc.ReadInt16();
				int dungeon = pvSrc.ReadByte();
				int light = pvSrc.ReadInt16();

				Console.WriteLine( "God Client: {0}: New Region '{1}' ('{2}')", state, name, desc );
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:22,代码来源:PacketHandlers.cs

示例13: DeleteStatic

		public static void DeleteStatic( NetState state, PacketReader pvSrc )
		{
			if ( VerifyGC( state ) )
			{
				int x = pvSrc.ReadInt16();
				int y = pvSrc.ReadInt16();
				int z = pvSrc.ReadInt16();
				int id = pvSrc.ReadUInt16();

				Console.WriteLine( "God Client: {0}: Delete Static ({1}, {2}, {3}) 0x{4:X}", state, x, y, z, id );
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:12,代码来源:PacketHandlers.cs

示例14: ChangeZ

		public static void ChangeZ( NetState state, PacketReader pvSrc )
		{
			if ( VerifyGC( state ) )
			{
				int x = pvSrc.ReadInt16();
				int y = pvSrc.ReadInt16();
				int z = pvSrc.ReadSByte();

				Console.WriteLine( "God Client: {0}: Change Z ({1}, {2}, {3})", state, x, y, z );
			}
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:11,代码来源:PacketHandlers.cs

示例15: RequestScrollWindow

		public static void RequestScrollWindow( NetState state, PacketReader pvSrc )
		{
			int lastTip = pvSrc.ReadInt16();
			int type = pvSrc.ReadByte();
		}
开发者ID:Grimoric,项目名称:RunUO.2.3.r1083,代码行数:5,代码来源:PacketHandlers.cs


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