Exemple #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 0 && PageQueue.List.IndexOf(m_Entry) < 0)
            {
                state.Mobile.SendGump(new PageQueueGump(state.Mobile));
                state.Mobile.SendMessage("That page has been removed.");
                return;
            }

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

                    g.SendTo(state);
                }

                break;
            }

            case 1:     // go to sender
            {
                Mobile m = state.Mobile;

                if (m_Entry.Sender.Deleted)
                {
                    m.SendMessage("That character no longer exists.");
                }
                else if (m_Entry.Sender.Map == null || m_Entry.Sender.Map == Map.Internal)
                {
                    m.SendMessage("That character is not in the world.");
                }
                else
                {
                    m_Entry.AddResponse(state.Mobile, "[Go Sender]");
                    m.MoveToWorld(m_Entry.Sender.Location, m_Entry.Sender.Map);

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

                    Resend(state);
                }

                break;
            }

            case 2:     // go to handler
            {
                Mobile m = state.Mobile;
                Mobile h = m_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 the world.");
                    }
                    else
                    {
                        m_Entry.AddResponse(state.Mobile, "[Go Handler]");
                        m.MoveToWorld(h.Location, h.Map);

                        m.SendMessage("You have been teleported to that page's handler.");
                        Resend(state);
                    }
                }
                else
                {
                    m.SendMessage("Nobody is handling that page.");
                    Resend(state);
                }

                break;
            }

            case 3:     // go to page location
            {
                Mobile m = state.Mobile;

                if (m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal)
                {
                    m.SendMessage("That location is not in the world.");
                }
                else
                {
                    m_Entry.AddResponse(state.Mobile, "[Go PageLoc]");
                    m.MoveToWorld(m_Entry.PageLocation, m_Entry.PageMap);

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

                    Resend(state);
                }

                break;
            }

            case 4:     // handle page
            {
                if (m_Entry.Handler == null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Handling]");
                    m_Entry.Handler = state.Mobile;

                    state.Mobile.SendMessage("You are now handling the page.");
                }
                else
                {
                    state.Mobile.SendMessage("Someone is already handling that page.");
                }

                Resend(state);

                break;
            }

            case 5:     // delete page
            {
                if (m_Entry.Handler == null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Deleting]");
                    PageQueue.Remove(m_Entry);

                    state.Mobile.SendMessage("You delete the page.");

                    PageQueueGump g = new PageQueueGump(state.Mobile);

                    g.SendTo(state);
                }
                else
                {
                    state.Mobile.SendMessage("Someone is handling that page, it can not be deleted.");

                    Resend(state);
                }

                break;
            }

            case 6:     // abandon page
            {
                if (m_Entry.Handler == state.Mobile)
                {
                    m_Entry.AddResponse(state.Mobile, "[Abandoning]");
                    state.Mobile.SendMessage("You abandon the page.");

                    m_Entry.Handler = null;
                }
                else
                {
                    state.Mobile.SendMessage("You are not handling that page.");
                }

                Resend(state);

                break;
            }

            case 7:     // page handled
            {
                if (m_Entry.Handler == state.Mobile)
                {
                    m_Entry.AddResponse(state.Mobile, "[Handled]");
                    PageQueue.Remove(m_Entry);

                    m_Entry.Handler = null;

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

                    PageQueueGump g = new PageQueueGump(state.Mobile);

                    g.SendTo(state);
                }
                else
                {
                    state.Mobile.SendMessage("You are not handling that page.");

                    Resend(state);
                }

                break;
            }

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

                if (text != null)
                {
                    m_Entry.AddResponse(state.Mobile, "[Response] " + text.Text);
                    m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, text.Text));
                    //m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
                    //m_Entry.Sender.SendMessage( 0x482, text.Text );
                }

                Resend(state);

                break;
            }

            case 9:     // predef overview
            {
                Resend(state);
                state.Mobile.SendGump(new PredefGump(state.Mobile, null));

                break;
            }

            case 10:     // View Speech Log
            {
                Resend(state);

                if (m_Entry.SpeechLog != null)
                {
                    Gump gump = new SpeechLogGump(m_Entry.Sender, m_Entry.SpeechLog);
                    state.Mobile.SendGump(gump);
                }

                break;
            }

            default:
            {
                int       index   = info.ButtonID - 100;
                ArrayList preresp = PredefinedResponse.List;

                if (index >= 0 && index < preresp.Count)
                {
                    m_Entry.AddResponse(state.Mobile, "[PreDef] " + ((PredefinedResponse)preresp[index]).Title);
                    m_Entry.Sender.SendGump(new MessageSentGump(m_Entry.Sender, state.Mobile.Name, ((PredefinedResponse)preresp[index]).Message));
                }

                Resend(state);

                break;
            }
            }
        }
		public override void OnResponse( NetState state, RelayInfo info )
		{
			switch ( info.ButtonID )
			{
				case 0: // close
				{
					if ( m_Entry.Handler != state.Mobile )
					{
						PageQueueGump g = new PageQueueGump();

						g.SendTo( state );
					}

					break;
				}
				case 1: // go to sender
				{
					Mobile m = state.Mobile;

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

						m.SendMessage( "You have been teleported to that pages sender." );

						Resend( state );
					}

					break;
				}
				case 2: // go to handler
				{
					Mobile m = state.Mobile;
					Mobile h = m_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 the world." );
						}
						else
						{
							m.MoveToWorld( h.Location, h.Map );

							m.SendMessage( "You have been teleported to that pages handler." );
							Resend( state );
						}
					}
					else
					{
						m.SendMessage( "Nobody is handling that page." );
						Resend( state );
					}

					break;
				}
				case 3: // go to page location
				{
					Mobile m = state.Mobile;

					if ( m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal )
					{
						m.SendMessage( "That location is not in the world." );
					}
					else
					{
						m.MoveToWorld( m_Entry.PageLocation, m_Entry.PageMap );

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

						Resend( state );
					}

					break;
				}
				case 4: // handle page
				{
					if ( m_Entry.Handler == null )
					{
						m_Entry.Handler = state.Mobile;

						state.Mobile.SendMessage( "You are now handling the page." );
					}
					else
					{
						state.Mobile.SendMessage( "Someone is already handling that page." );
					}

					Resend( state );

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

						state.Mobile.SendMessage( "You delete the page." );

						PageQueueGump g = new PageQueueGump();

						g.SendTo( state );
					}
					else
					{
						state.Mobile.SendMessage( "Someone is handling that page, it can not be deleted." );

						Resend( state );
					}

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

						m_Entry.Handler = null;
					}
					else
					{
						state.Mobile.SendMessage( "You are not handling that page." );
					}

					Resend( state );

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

						m_Entry.Handler = null;

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

						PageQueueGump g = new PageQueueGump();

						g.SendTo( state );
					}
					else
					{
						state.Mobile.SendMessage( "You are not handling that page." );

						Resend( state );
					}

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

					if ( text != null )
					{
						m_Entry.Sender.SendGump( new MessageSentGump( m_Entry.Sender, state.Mobile.Name, text.Text ) );
						//m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
						//m_Entry.Sender.SendMessage( 0x482, text.Text );
					}

					Resend( state );

					break;
				}
				case 9: // predef overview
				{
					Resend( state );
					state.Mobile.SendGump( new PredefGump( state.Mobile, null ) );

					break;
				}
				default:
				{
					int index = info.ButtonID - 100;
					ArrayList preresp = PredefinedResponse.List;

					if ( index >= 0 && index < preresp.Count )
						m_Entry.Sender.SendGump( new MessageSentGump( m_Entry.Sender, state.Mobile.Name, ((PredefinedResponse)preresp[index]).Message ) );

					Resend( state );

					break;
				}
			}
		}
		public override void OnResponse( NetState state, RelayInfo info )
		{
			if ( info.ButtonID != 0 && PageQueue.List.IndexOf( m_Entry ) < 0 )
			{
				state.Mobile.SendGump( new PageQueueGump() );
				state.Mobile.SendMessage( "That page has been removed." );
				return;
			}

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

						g.SendTo( state );
					}

					break;
				}
				case 1: // go to sender
				{
					Mobile m = state.Mobile;

					if ( m_Entry.Sender.Deleted )
					{
						m.SendMessage( "That character no longer exists." );
					}
					else if ( m_Entry.Sender.Map == null || m_Entry.Sender.Map == Map.Internal )
					{
						m.SendMessage( "That character is not in the world." );
					}
					else
					{
						m_Entry.AddResponse( state.Mobile, "[Go Sender]" );
						m.MoveToWorld( m_Entry.Sender.Location, m_Entry.Sender.Map );

						m.SendMessage( "You have been teleported to that pages sender." );

						Resend( state );
					}

					break;
				}
				case 2: // go to handler
				{
					Mobile m = state.Mobile;
					Mobile h = m_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 the world." );
						}
						else
						{
							m_Entry.AddResponse( state.Mobile, "[Go Handler]" );
							m.MoveToWorld( h.Location, h.Map );

							m.SendMessage( "You have been teleported to that pages handler." );
							Resend( state );
						}
					}
					else
					{
						m.SendMessage( "Nobody is handling that page." );
						Resend( state );
					}

					break;
				}
				case 3: // go to page location
				{
					Mobile m = state.Mobile;

					if ( m_Entry.PageMap == null || m_Entry.PageMap == Map.Internal )
					{
						m.SendMessage( "That location is not in the world." );
					}
					else
					{
						m_Entry.AddResponse( state.Mobile, "[Go PageLoc]" );
						m.MoveToWorld( m_Entry.PageLocation, m_Entry.PageMap );

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

						Resend( state );
					}

					break;
				}
				case 4: // handle page
				{
					if ( m_Entry.Handler == null )
					{
						m_Entry.AddResponse( state.Mobile, "[Handling]" );
						m_Entry.Handler = state.Mobile;

						state.Mobile.SendMessage( "You are now handling the page." );
					}
					else
					{
						state.Mobile.SendMessage( "Someone is already handling that page." );
					}

					Resend( state );

					break;
				}
				case 5: // delete page
				{
					if ( m_Entry.Handler == null || state.Mobile.AccessLevel >= AccessLevel.Seer )
					{
						m_Entry.AddResponse( state.Mobile, "[Deleting]" );
						PageQueue.Remove( m_Entry );

						state.Mobile.SendMessage( "You delete the page." );

						PageQueueGump g = new PageQueueGump();

						g.SendTo( state );
					}
					else
					{
						state.Mobile.SendMessage( "Someone is handling that page, it can not be deleted." );

						Resend( state );
					}

					break;
				}
				case 6: // abandon page
				{
					if ( m_Entry.Handler == state.Mobile )
					{
						m_Entry.AddResponse( state.Mobile, "[Abandoning]" );
						state.Mobile.SendMessage( "You abandon the page." );

						m_Entry.Handler = null;
					}
					else
					{
						state.Mobile.SendMessage( "You are not handling that page." );
					}

					Resend( state );

					break;
				}
				case 7: // page handled
				{
					if ( m_Entry.Handler == state.Mobile )
					{
						m_Entry.AddResponse( state.Mobile, "[Handled]" );
						PageQueue.Remove( m_Entry );

						m_Entry.Handler = null;

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

						PageQueueGump g = new PageQueueGump();

						g.SendTo( state );
					}
					else
					{
						state.Mobile.SendMessage( "You are not handling that page." );

						Resend( state );
					}

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

					if ( text != null )
					{
						m_Entry.AddResponse( state.Mobile, "[Response] " + text.Text );

                        if (m_Entry.Sender.NetState == null) //Offline
                        {
                            PlayerMobile pm = ((PlayerMobile)m_Entry.Sender);
                            pm.OfflineMessagesText.Add(text.Text);
                            pm.OfflineMessagesFrom.Add(state.Mobile.Name);
                        }
                        else
						    m_Entry.Sender.SendGump( new MessageSentGump( m_Entry.Sender, state.Mobile.Name, text.Text, true ) );

                        state.Mobile.SendAsciiMessage("You sent a response to " + m_Entry.Sender.Name);
						//m_Entry.Sender.SendMessage( 0x482, "{0} tells you:", state.Mobile.Name );
						//m_Entry.Sender.SendMessage( 0x482, text.Text );
					}

					Resend( state );

					break;
				}
				case 9: // predef overview
				{
					Resend( state );
					state.Mobile.SendGump( new PredefGump( state.Mobile, null ) );

					break;
				}
				case 10: // View Speech Log
				{
					Resend( state );

					if ( m_Entry.SpeechLog != null )
					{
						Gump gump = new SpeechLogGump( m_Entry.Sender, m_Entry.SpeechLog );
						state.Mobile.SendGump( gump );
					}

					break;
				}
				default:
				{
					int index = info.ButtonID - 100;
					ArrayList preresp = PredefinedResponse.List;

					if ( index >= 0 && index < preresp.Count )
					{
						m_Entry.AddResponse( state.Mobile, "[PreDef] " + ((PredefinedResponse)preresp[index]).Title );
						m_Entry.Sender.SendGump( new MessageSentGump( m_Entry.Sender, state.Mobile.Name, ((PredefinedResponse)preresp[index]).Message, true ) );
                        state.Mobile.SendAsciiMessage("You sent a predifined response to " + state.Mobile.Name);
					}

					Resend( state );

					break;
				}
			}
		}