Exemplo n.º 1
0
		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile m = state.Mobile;

			switch( info.ButtonID )
			{
				default:
				case 0:
					{
						if( _entry.Handler != state.Mobile )
						{
							PageQueueGump g = new PageQueueGump();

							g.SendTo( state );
						}

						break;
					}
				case 1: //go to sender
					{
						if( _entry.Sender.Deleted )
						{
							m.SendMessage( "That character no longer exists." );
						}
						else if( _entry.Sender.Map == null || _entry.Sender.Map == Map.Internal )
						{
							m.SendMessage( "That character is not in this world." );
						}
						else
						{
							m.MoveToWorld( _entry.Sender.Location, _entry.Sender.Map );

							m.SendMessage( "You have been teleported to that page's sender." );

							Resend( state );
						}

						break;
					}
				case 2: //go to handler
					{
						Mobile h = _entry.Handler;

						if( h != null )
						{
							if( h.Deleted )
							{
								m.SendMessage( "That character no longer exists." );
							}
							else if( h.Map == null || h.Map == Map.Internal )
							{
								m.SendMessage( "That character is not in this world." );
							}
							else
							{
								m.MoveToWorld( h.Location, h.Map );

								m.SendMessage( "You have been teleported to that page's handler." );

								Resend( state );
							}
						}

						break;
					}
				case 3: //go to page location
					{
						if( _entry.OriginMap == null || _entry.OriginMap == Map.Internal )
						{
							m.SendMessage( "That location is not in this world." );
						}
						else
						{
							m.MoveToWorld( _entry.OriginLocation, _entry.OriginMap );

							m.SendMessage( "You have been teleported to the original page location." );

							Resend( state );
						}

						break;
					}
				case 4: //handle page
					{
						if( _entry.Handler == null )
						{
							_entry.Handler = m;

							m.SendMessage( "You are now handling this page." );

							ChatGump.SendTo( _entry.Sender, _entry.Sender, m, false, _entry );
							ChatGump.SendTo( m, _entry.Sender, m, true, _entry );

							_entry.WriteLine( "##############################" );
							_entry.WriteLine( String.Format( "--------Page Type: {0}--------", PageQueue.GetPageTypeName( _entry.Type ) ) );
							_entry.WriteLine( String.Format( "--- Description: {0} ---", _entry.Message ) );
							_entry.WriteLine( "##############################" );
							_entry.WriteLine();
						}
						else
							m.SendMessage( "{0} is already handling this page.", _entry.Handler.RawName );

						break;
					}
				case 5: //delete page
					{
						if( _entry.Handler == null )
						{
							PageQueue.Remove( _entry );

							m.SendMessage( "You delete the page." );

							PageQueueGump g = new PageQueueGump();
							g.SendTo( state );
						}
						else
						{
							m.SendMessage( "Someone is handling that page, and it cannot be deleted." );

							Resend( state );
						}

						break;
					}
				case 6: //abandon page
					{
						if( _entry.Handler == state.Mobile )
						{
							m.SendMessage( "You have abandoned the page." );

							ChatGump.Close( _entry.Sender );
							ChatGump.Close( m );

							_entry.Handler = null;
						}
						else
							m.SendMessage( "You are not handling that page." );

						Resend( state );

						break;
					}
				case 7: //page handled
					{
						if( _entry.Handler == state.Mobile )
						{
							PageQueue.Remove( _entry );

							if( _entry.Sender.HasGump( typeof( ChatGump ) ) )
							{
								m.SendMessage( 0x35, String.Format( "{0} still has the chat gump open.", _entry.Sender.RawName ) );

								Resend( state );
							}

							_entry.Handler = null;

							m.SendMessage( "You mark the page as handled, and remove it from the queue." );

							PageQueueGump g = new PageQueueGump();
							g.SendTo( state );
						}
						else
						{
							m.SendMessage( "You are not handling that page." );

							Resend( state );
						}

						break;
					}
				case 8: //send message
					{
						TextRelay text = info.GetTextEntry( 0 );

						if( text != null )
						{
							_entry.Sender.SendGump( new MessageSentGump( _entry.Sender, m, text.Text ) );
						}

						Resend( state );

						break;
					}
				case 9: //view speech log
					{
						if( _entry.SpeechLog != null )
						{
							m.SendGump( new Server.Engines.Help.SpeechLogGump( _entry.Sender, _entry.SpeechLog ) );
						}

						Resend( state );

						break;
					}
			}
		}
Exemplo n.º 2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile m = state.Mobile;

            switch (info.ButtonID)
            {
            default:
            case 0:
            {
                if (_entry.Handler != state.Mobile)
                {
                    PageQueueGump g = new PageQueueGump();

                    g.SendTo(state);
                }

                break;
            }

            case 1:                     //go to sender
            {
                if (_entry.Sender.Deleted)
                {
                    m.SendMessage("That character no longer exists.");
                }
                else if (_entry.Sender.Map == null || _entry.Sender.Map == Map.Internal)
                {
                    m.SendMessage("That character is not in this world.");
                }
                else
                {
                    m.MoveToWorld(_entry.Sender.Location, _entry.Sender.Map);

                    m.SendMessage("You have been teleported to that page's sender.");

                    Resend(state);
                }

                break;
            }

            case 2:                     //go to handler
            {
                Mobile h = _entry.Handler;

                if (h != null)
                {
                    if (h.Deleted)
                    {
                        m.SendMessage("That character no longer exists.");
                    }
                    else if (h.Map == null || h.Map == Map.Internal)
                    {
                        m.SendMessage("That character is not in this world.");
                    }
                    else
                    {
                        m.MoveToWorld(h.Location, h.Map);

                        m.SendMessage("You have been teleported to that page's handler.");

                        Resend(state);
                    }
                }

                break;
            }

            case 3:                     //go to page location
            {
                if (_entry.OriginMap == null || _entry.OriginMap == Map.Internal)
                {
                    m.SendMessage("That location is not in this world.");
                }
                else
                {
                    m.MoveToWorld(_entry.OriginLocation, _entry.OriginMap);

                    m.SendMessage("You have been teleported to the original page location.");

                    Resend(state);
                }

                break;
            }

            case 4:                     //handle page
            {
                if (_entry.Handler == null)
                {
                    _entry.Handler = m;

                    m.SendMessage("You are now handling this page.");

                    ChatGump.SendTo(_entry.Sender, _entry.Sender, m, false, _entry);
                    ChatGump.SendTo(m, _entry.Sender, m, true, _entry);

                    _entry.WriteLine("##############################");
                    _entry.WriteLine(String.Format("--------Page Type: {0}--------", PageQueue.GetPageTypeName(_entry.Type)));
                    _entry.WriteLine(String.Format("--- Description: {0} ---", _entry.Message));
                    _entry.WriteLine("##############################");
                    _entry.WriteLine();
                }
                else
                {
                    m.SendMessage("{0} is already handling this page.", _entry.Handler.RawName);
                }

                break;
            }

            case 5:                     //delete page
            {
                if (_entry.Handler == null)
                {
                    PageQueue.Remove(_entry);

                    m.SendMessage("You delete the page.");

                    PageQueueGump g = new PageQueueGump();
                    g.SendTo(state);
                }
                else
                {
                    m.SendMessage("Someone is handling that page, and it cannot be deleted.");

                    Resend(state);
                }

                break;
            }

            case 6:                     //abandon page
            {
                if (_entry.Handler == state.Mobile)
                {
                    m.SendMessage("You have abandoned the page.");

                    ChatGump.Close(_entry.Sender);
                    ChatGump.Close(m);

                    _entry.Handler = null;
                }
                else
                {
                    m.SendMessage("You are not handling that page.");
                }

                Resend(state);

                break;
            }

            case 7:                     //page handled
            {
                if (_entry.Handler == state.Mobile)
                {
                    PageQueue.Remove(_entry);

                    if (_entry.Sender.HasGump(typeof(ChatGump)))
                    {
                        m.SendMessage(0x35, String.Format("{0} still has the chat gump open.", _entry.Sender.RawName));

                        Resend(state);
                    }

                    _entry.Handler = null;

                    m.SendMessage("You mark the page as handled, and remove it from the queue.");

                    PageQueueGump g = new PageQueueGump();
                    g.SendTo(state);
                }
                else
                {
                    m.SendMessage("You are not handling that page.");

                    Resend(state);
                }

                break;
            }

            case 8:                     //send message
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    _entry.Sender.SendGump(new MessageSentGump(_entry.Sender, m, text.Text));
                }

                Resend(state);

                break;
            }

            case 9:                     //view speech log
            {
                if (_entry.SpeechLog != null)
                {
                    m.SendGump(new Server.Engines.Help.SpeechLogGump(_entry.Sender, _entry.SpeechLog));
                }

                Resend(state);

                break;
            }
            }
        }