Exemple #1
0
        public override void StartTeleport(Mobile m)
        {
            TeleportingInfo info;

            if (m_Table.TryGetValue(m, out info))
            {
                if (info.Teleporter == this)
                {
                    if (m.BeginAction(this))
                    {
                        if (m_ProgressMessage != null)
                        {
                            m.SendMessage(m_ProgressMessage);
                        }
                        else if (m_ProgressNumber != 0)
                        {
                            m.SendLocalizedMessage(m_ProgressNumber);
                        }

                        if (m_ShowTimeRemaining)
                        {
                            m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.Now));
                        }

                        Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(5), EndLock, m);
                    }

                    return;
                }
                else
                {
                    info.Timer.Stop();
                }
            }

            if (m_StartMessage != null)
            {
                m.SendMessage(m_StartMessage);
            }
            else if (m_StartNumber != 0)
            {
                m.SendLocalizedMessage(m_StartNumber);
            }

            if (Delay == TimeSpan.Zero)
            {
                DoTeleport(m);
            }
            else
            {
                m_Table[m] = new TeleportingInfo(this, Timer.DelayCall <Mobile>(Delay, DoTeleport, m));
            }
        }
Exemple #2
0
		public override void StartTeleport(Mobile m)
		{
			TeleportingInfo info;

			if (m_Table.TryGetValue(m, out info))
			{
				if (info.Teleporter == this)
				{
					if (m.BeginAction(this))
					{
						if (m_ProgressMessage != null)
						{
							m.SendMessage(m_ProgressMessage);
						}
						else if (m_ProgressNumber != 0)
						{
							m.SendLocalizedMessage(m_ProgressNumber);
						}

						if (m_ShowTimeRemaining)
						{
							m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow));
						}

						Timer.DelayCall(TimeSpan.FromSeconds(5), EndLock, m);
					}

					return;
				}
				else
				{
					info.Timer.Stop();
				}
			}

			if (m_StartMessage != null)
			{
				m.SendMessage(m_StartMessage);
			}
			else if (m_StartNumber != 0)
			{
				m.SendLocalizedMessage(m_StartNumber);
			}

			if (Delay == TimeSpan.Zero)
			{
				DoTeleport(m);
			}
			else
			{
				m_Table[m] = new TeleportingInfo(this, Timer.DelayCall(Delay, DoTeleport, m));
			}
		}