Example #1
0
        /// <summary>
        /// Override this to respond to the completion of a quest command, such as /search
        /// </summary>
        /// <param name="command"></param>
        protected virtual void QuestCommandCompleted(eQuestCommand command, GamePlayer player)
        {
            // override this to do whatever needs to be done when the command is completed
            // Typically this would be: give player an item and advance the step

            QuestPlayer.Out.SendMessage("Error, command completed handler not overriden for quest!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
        }
Example #2
0
        protected virtual int QuestActionCallback(RegionTimer timer)
        {
            GamePlayer player = timer.Owner as GamePlayer;

            if (player != null)
            {
                RemoveActionHandlers(player);

                player.Out.SendCloseTimerWindow();
                player.QuestActionTimer.Stop();
                player.QuestActionTimer = null;
                QuestCommandCompleted(m_currentCommand, player);
            }

            m_currentCommand = eQuestCommand.None;
            return(0);
        }
Example #3
0
        /// <summary>
        /// Starts the progress bar for a command.  Override QuestCommandCompleted to handle this command.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="command"></param>
        /// <param name="seconds"></param>
        /// <param name="label">optional label to display above progress bar</param>
        public virtual void StartQuestActionTimer(GamePlayer player, eQuestCommand command, int seconds, string label = "")
        {
            if (player.QuestActionTimer == null)
            {
                m_currentCommand = command;
                AddActionHandlers(player);

                if (label == "")
                {
                    // Live progress dialog is labeled 'Area Action' but I decided to make label more specific - tolakram
                    label = Enum.GetName(typeof(eQuestCommand), command);
                }

                player.Out.SendTimerWindow(label, seconds);
                player.QuestActionTimer          = new RegionTimer(player);
                player.QuestActionTimer.Callback = new RegionTimerCallback(QuestActionCallback);
                player.QuestActionTimer.Start(seconds * 1000);
            }
            else
            {
                // error message about another action in progress
            }
        }
Example #4
0
        public virtual bool Command(GamePlayer player, eQuestCommand command, AbstractArea area = null)
        {
            if (m_searchAreas == null || m_searchAreas.Count == 0)
            {
                return(false);
            }

            if (player == null || command == eQuestCommand.None)
            {
                return(false);
            }

            if (command == eQuestCommand.Search)
            {
                foreach (AbstractArea playerArea in player.CurrentAreas)
                {
                    if (playerArea is QuestSearchArea)
                    {
                        QuestSearchArea questArea = playerArea as QuestSearchArea;

                        if (questArea != null && questArea.Step == Step)
                        {
                            foreach (QuestSearchArea searchArea in m_searchAreas)
                            {
                                if (searchArea == questArea)
                                {
                                    StartQuestActionTimer(player, command, questArea.SearchSeconds);
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
Example #5
0
        protected void InterruptAction(DOLEvent e, object sender, EventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player != null)
            {
                if (m_currentCommand != eQuestCommand.None)
                {
                    string commandName = Enum.GetName(typeof(eQuestCommand), m_currentCommand).ToLower();
                    if (m_currentCommand == eQuestCommand.SearchStart)
                    {
                        commandName = Enum.GetName(typeof(eQuestCommand), eQuestCommand.Search).ToLower();
                    }

                    player.Out.SendMessage("Your " + commandName + " is interrupted!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }

                RemoveActionHandlers(player);
                player.Out.SendCloseTimerWindow();
                player.QuestActionTimer.Stop();
                player.QuestActionTimer = null;
                m_currentCommand        = eQuestCommand.None;
            }
        }
Example #6
0
        /// <summary>
        /// Override this to respond to the completion of a quest command, such as /search
        /// </summary>
        /// <param name="command"></param>
		protected virtual void QuestCommandCompleted(eQuestCommand command, GamePlayer player)
		{
			// override this to do whatever needs to be done when the command is completed
			// Typically this would be: give player an item and advance the step

			QuestPlayer.Out.SendMessage("Error, command completed handler not overriden for quest!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
		}
Example #7
0
		protected void InterruptAction(DOLEvent e, object sender, EventArgs args)
		{
			GamePlayer player = sender as GamePlayer;

			if (player != null)
			{
				if (m_currentCommand != eQuestCommand.None)
				{
                    string commandName = Enum.GetName(typeof(eQuestCommand), m_currentCommand).ToLower();
                    if (m_currentCommand == eQuestCommand.SearchStart)
                    {
                        commandName = Enum.GetName(typeof(eQuestCommand), eQuestCommand.Search).ToLower();
                    }

					player.Out.SendMessage("Your " + commandName + " is interrupted!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
				}

				RemoveActionHandlers(player);
				player.Out.SendCloseTimerWindow();
				player.QuestActionTimer.Stop();
				player.QuestActionTimer = null;
				m_currentCommand = eQuestCommand.None;
			}
		}
Example #8
0
		protected virtual int QuestActionCallback(RegionTimer timer)
		{
            GamePlayer player = timer.Owner as GamePlayer;

            if (player != null)
            {
                RemoveActionHandlers(player);

                player.Out.SendCloseTimerWindow();
                player.QuestActionTimer.Stop();
                player.QuestActionTimer = null;
                QuestCommandCompleted(m_currentCommand, player);
            }

			m_currentCommand = eQuestCommand.None;
			return 0;
		}
Example #9
0
        /// <summary>
        /// Starts the progress bar for a command.  Override QuestCommandCompleted to handle this command.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="command"></param>
        /// <param name="seconds"></param>
        /// <param name="label">optional label to display above progress bar</param>
        public virtual void StartQuestActionTimer(GamePlayer player, eQuestCommand command, int seconds, string label = "")
		{
			if (player.QuestActionTimer == null)
			{
				m_currentCommand = command;
				AddActionHandlers(player);

                if (label == "")
                {
                    // Live progress dialog is labeled 'Area Action' but I decided to make label more specific - tolakram
                    label = Enum.GetName(typeof(eQuestCommand), command);
                }

				player.Out.SendTimerWindow(label, seconds);
				player.QuestActionTimer = new RegionTimer(player);
				player.QuestActionTimer.Callback = new RegionTimerCallback(QuestActionCallback);
				player.QuestActionTimer.Start(seconds * 1000);
			}
			else
			{
				// error message about another action in progress
			}
		}
Example #10
0
		public virtual bool Command(GamePlayer player, eQuestCommand command, AbstractArea area = null)
		{
			if (m_searchAreas == null || m_searchAreas.Count == 0)
				return false;

			if (player == null || command == eQuestCommand.None)
				return false;

			if (command == eQuestCommand.Search)
			{
				foreach (AbstractArea playerArea in player.CurrentAreas)
				{
					if (playerArea is QuestSearchArea)
					{
						QuestSearchArea questArea = playerArea as QuestSearchArea;

						if (questArea != null && questArea.Step == Step)
						{
							foreach (QuestSearchArea searchArea in m_searchAreas)
							{
								if (searchArea == questArea)
								{
									StartQuestActionTimer(player, command, questArea.SearchSeconds);
									return true;
								}
							}
						}
					}
				}
			}

			return false;
		}
Example #11
0
        protected virtual int QuestActionCallback(RegionTimer timer)
        {
            RemoveActionHandlers(QuestPlayer);

            QuestPlayer.Out.SendCloseTimerWindow();
            QuestPlayer.QuestActionTimer.Stop();
            QuestPlayer.QuestActionTimer = null;
            QuestCommandCompleted(m_currentCommand);
            m_currentCommand = eQuestCommand.None;
            return 0;
        }