Esempio n. 1
0
        /// <summary>
        /// Performs a choice after it's been selected by a user
        /// </summary>
        /// <param name="m">The user of the conversation</param>
        /// <param name="choice">The choice selected through the gump</param>
        public void PerformChoice(Mobile m, DialogChoice choice)
        {
            if (!Verify(m))
            {
                return;
            }

            if (choice.Invoke)
            {
                choice.PerformInvoke(m, this);
            }

            if (choice.EndDialog)
            {
                m_Users.Remove(m);
                return;
            }

            DialogSpeech speech = m_Dialog.GetSpeech(choice.ChoiceID);

            if (!VerifySpeech(m, speech))
            {
                m_Users.Remove(m);
                return;
            }

            SendSpeechGump(speech, m);
        }
Esempio n. 2
0
        /// <summary>
        /// Verifies if a speech is valid. This because some might used un-verified configurations.
        /// </summary>
        /// <param name="m">The mobile using the NPC</param>
        /// <param name="speech">The speech object being checked</param>
        /// <returns>True if the speech exists, false if it's null</returns>
        private bool VerifySpeech(Mobile m, DialogSpeech speech)
        {
            if (speech == null)
            {
                m.SendMessage(0x40, "The script for this NPC is incorrect. Please contact a Game Master and inform that the script '{0}' is bugged.", DialogName);
            }

            return(speech != null);
        }
Esempio n. 3
0
		public ConversationGump( Dialog dialog, DialogSpeech speech, ArrayList choices, DialogNPC npc, Mobile m ) : base( 100, 50 )
		{
			m_NPC = npc;
			m_Choices = choices;
			m_Dialog = dialog;
			m_Speech = speech;

			m.CloseGump( typeof( ConversationGump ) );

			MakeGump();
		}
Esempio n. 4
0
        public ConversationGump(Dialog dialog, DialogSpeech speech, ArrayList choices, DialogNPC npc, Mobile m) : base(100, 50)
        {
            m_NPC     = npc;
            m_Choices = choices;
            m_Dialog  = dialog;
            m_Speech  = speech;

            m.CloseGump(typeof(ConversationGump));

            MakeGump();
        }
Esempio n. 5
0
        /// <summary>
        /// Sends the specified player the speech identified by the specified ID.
        /// This function will do nothing if the ID isn't valid for this Dialog, and should be only called
        /// from external functions
        /// </summary>
        /// <param name="guid">The unique GUID of the speech that should be displayed</param>
        /// <param name="m">The Mobile who should receive the speech</param>
        public void RunSpeechGump(Guid guid, Mobile m)
        {
            if (!Verify(m))
            {
                return;
            }

            DialogSpeech speech = m_Dialog.GetSpeech(guid);

            if (!VerifySpeech(m, speech))
            {
                return;
            }

            SendSpeechGump(speech, m);
        }
Esempio n. 6
0
        /// <summary>
        /// Sends the actual speech gump
        /// </summary>
        /// <param name="speech">The speech object being displayed</param>
        /// <param name="m">The player receiving the gump</param>
        private void SendSpeechGump(DialogSpeech speech, Mobile m)
        {
            ArrayList choices = new ArrayList();

            foreach (Guid id in speech.Choices)
            {
                DialogChoice c = m_Dialog.GetChoice(id);

                if (c != null)
                {
                    choices.Add(c);
                }
            }

            m.SendGump(new ConversationGump(m_Dialog, speech, choices, this, m));
        }
Esempio n. 7
0
        /// <summary>
        /// Begins a conversation with a player by sending them the first gump
        /// </summary>
        /// <param name="m">The mobile beginning the conversation</param>
        /// <param name="init">The DialogInit object specifying the starting condition</param>
        private void StartConversation(Mobile m, DialogInit init)
        {
            if (!Verify(m))
            {
                return;
            }

            DialogSpeech speech = m_Dialog.GetSpeech(init.Speech);

            if (!VerifySpeech(m, speech))
            {
                return;
            }

            m_Users.Add(m);

            SendSpeechGump(speech, m);
        }
		/// <summary>
		/// Sends the actual speech gump
		/// </summary>
		/// <param name="speech">The speech object being displayed</param>
		/// <param name="m">The player receiving the gump</param>
		private void SendSpeechGump( DialogSpeech speech, Mobile m )
		{
			ArrayList choices = new ArrayList();

			foreach( Guid id in speech.Choices )
			{
				DialogChoice c = m_Dialog.GetChoice( id );

				if ( c != null )
					choices.Add( c );
			}

			m.SendGump( new ConversationGump( m_Dialog, speech, choices, this, m ) );
		}
		/// <summary>
		/// Verifies if a speech is valid. This because some might used un-verified configurations.
		/// </summary>
		/// <param name="m">The mobile using the NPC</param>
		/// <param name="speech">The speech object being checked</param>
		/// <returns>True if the speech exists, false if it's null</returns>
		private bool VerifySpeech( Mobile m, DialogSpeech speech )
		{
			if ( speech == null )
			{
				m.SendMessage( 0x40, "The script for this NPC is incorrect. Please contact a Game Master and inform that the script '{0}' is bugged.", DialogName );
			}

			return speech != null;
		}