public SpiritGem( Serial serial ) : base( serial )
		{
            //On server restart the timer is reset to 120 seconds which ensures that the item actually decays.
            //This is inaccurate but this way we don't have to save the value and restore it.
            m_TimeLeft = DELETE_AFTER_SECONDS;
            m_Timer = new DeleteTimer(this);
        }
Example #2
0
        /// <summary>
        ///     Resets the MyProgramsDefault controls. (For use if the user selects another program mid-edit).
        /// </summary>
        private void CancelProgramEditing()
        {
            if (InvokeRequired)
            {
                Invoke(new CancelEditingDelegate(CancelProgramEditing));
            }
            else
            {
                // Re-enables the 'Create Program' button.
                ButtonCreateProgram.Enabled = true;

                // Disables all MyProgramsDefault controls to prevent editing.
                SetControls(false);

                DeleteTimer.Stop();
                _secondCounter              = 3;
                ButtonDeleteProgram.Text    = "Delete Program (3)";
                ButtonDeleteProgram.Enabled = false;

                // Resets the btnEditSave text value to 'Edit Program'.
                ButtonEditProgram.Text = "Edit Program";

                // Enables the Manage Program button.
                ButtonManageProgram.Enabled = true;
            }
        }
Example #3
0
        public void RemoveInstance()
        {
            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m.Player && (m.Map == this || m.LogoutMap == this))
                {
                    if (m.NetState != null)
                    {
                        m.MoveToWorld(m_ReturnPoint, m_ReturnMap);
                    }
                    else
                    {
                        m.LogoutMap      = m_ReturnMap;
                        m.LogoutLocation = m_ReturnPoint;
                    }
                }
            }

            if (m_DeleteTimer != null)
            {
                m_DeleteTimer.Stop();
                m_DeleteTimer = null;
            }

            Delete();
        }
Example #4
0
 public SpiritGem() : base(0x1EA7)
 {
     Weight     = 5;
     Hue        = 1159;
     m_TimeLeft = DELETE_AFTER_SECONDS;
     m_Timer    = new DeleteTimer(this);
 }
Example #5
0
 public SpiritGem(Serial serial) : base(serial)
 {
     //On server restart the timer is reset to 120 seconds which ensures that the item actually decays.
     //This is inaccurate but this way we don't have to save the value and restore it.
     m_TimeLeft = DELETE_AFTER_SECONDS;
     m_Timer    = new DeleteTimer(this);
 }
Example #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
                FailedLockpick   = reader.ReadBool();
                _Quality         = (ChestQuality)reader.ReadInt();
                DigTime          = reader.ReadDateTime();
                AncientGuardians = reader.ReadStrongMobileList();
                goto case 3;

            case 3:
                FirstOpenedByOwner = reader.ReadBool();
                TreasureMap        = reader.ReadItem() as TreasureMap;
                goto case 2;

            case 2:
            {
                Guardians = reader.ReadStrongMobileList();
                Temporary = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                Owner = reader.ReadMobile();

                goto case 0;
            }

            case 0:
            {
                Level      = reader.ReadInt();
                DeleteTime = reader.ReadDeltaTime();
                m_Lifted   = reader.ReadStrongItemList();

                if (version < 2)
                {
                    Guardians = new List <Mobile>();
                }

                break;
            }
            }

            if (!Temporary)
            {
                Timer = new DeleteTimer(this, DeleteTime);
                Timer.Start();
            }
            else
            {
                Delete();
            }
        }
Example #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int   version     = reader.ReadInt();
            Timer deleteTimer = new DeleteTimer(this);

            deleteTimer.Start();
        }
Example #8
0
 public HolyHandGrenade() : base(0xE73)
 {
     Name          = "Holy Hand Grenade of Antioch";
     Weight        = 10.0;
     Hue           = 1717;
     m_DeleteTimer = new DeleteTimer(this);
     m_TimeLeft    = 600;
 }
 public KrofinBOMB() : base(0x0F04)
 {
     Name          = "A Handmade Krofin Bomb";
     Weight        = 20.0;
     Hue           = 1175;
     m_DeleteTimer = new DeleteTimer(this);
     m_TimeLeft    = 300;
 }
Example #10
0
 private void StartDeleteGate(BBTravelEnd gate)
 {
     if (gate != null)
     {
         Delete_Timer = new DeleteTimer(gate);
         Delete_Timer.Start();
     }
 }
		public KrofinBOMB() : base( 0x0F04 )
		{
			Name = "A Handmade Krofin Bomb";
			Weight = 20.0;
			Hue = 1175;
			m_DeleteTimer = new DeleteTimer( this );
			m_TimeLeft = 300;
		}
		public HolyHandGrenade() : base( 0xE73 )
		{
			Name = "Holy Hand Grenade of Antioch";
			Weight = 10.0;
			Hue = 1717;
			m_DeleteTimer = new DeleteTimer( this );
			m_TimeLeft = 600;
		}
		public SpiritGem() : base( 0x1EA7 )
		{
			Weight = 5;
			Name = "a spirit gem";
			Hue = 1159;
            m_TimeLeft = DELETE_AFTER_SECONDS;
            m_Timer = new DeleteTimer(this);
		}
Example #14
0
        public DungPile()
            : base(0x913)
        {
            Hue  = Utility.RandomList(2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 42);
            Name = "a pile of dung";
            Timer deleteTimer = new DeleteTimer(this);

            deleteTimer.Start();
        }
Example #15
0
 private void ResetTimer()
 {
     if (m_Timer != null)
     {
         m_Timer.Stop();
         m_Timer = null;
     }
     m_Timer = new DeleteTimer(this, DateTime.Now + TimeSpan.FromMinutes(m_DeleteMinutes));
     m_Timer.Start();
 }
Example #16
0
 private void ResetTimer()
 {
     if (m_Timer != null)
     {
         m_Timer.Stop();
         m_Timer = null;
     }
     // auto delete after 10 minutes?
     m_Timer = new DeleteTimer(this, DateTime.Now + TimeSpan.FromMinutes(10));
     m_Timer.Start();
 }
Example #17
0
        public BaseInstance(Map map, string name, Point3D retloc, Map retmap, DateTime exp) : base(map, name, MapRules.FeluccaRules)
        {
            m_ExpireDate  = exp;
            m_ReturnPoint = retloc;
            m_ReturnMap   = retmap;

            if (m_ExpireDate < DateTime.MaxValue)
            {
                m_DeleteTimer = new DeleteTimer(this, m_ExpireDate - DateTime.UtcNow);
                m_DeleteTimer.Start();
            }
        }
Example #18
0
		public BaseInstance(Map map, string name, Point3D retloc, Map retmap, DateTime exp) : base( map, name, MapRules.FeluccaRules )
		{
			m_ExpireDate = exp;
			m_ReturnPoint = retloc;
			m_ReturnMap = retmap;

			if ( m_ExpireDate < DateTime.MaxValue )
			{
				m_DeleteTimer = new DeleteTimer(this, m_ExpireDate - DateTime.UtcNow);
				m_DeleteTimer.Start();
			}
		}
Example #19
0
        private void DeleteTimer_Tick(object sender, EventArgs e)
        {
            ButtonDeleteProgram.Text = String.Format("Delete Program ({0})", --_secondCounter);

            if (_secondCounter == 0)
            {
                DeleteTimer.Stop();
                _secondCounter = 3;
                ButtonDeleteProgram.Enabled = true;
                ButtonDeleteProgram.Text    = "Delete Program";
            }
        }
        public SmallMobViewModel(NPC npc) : base(npc)
        {
            NPC = npc;

            WindowManager.BossWindow.VM.NpcListChanged += () => N(nameof(Compact));

            NPC.PropertyChanged += OnPropertyChanged;
            NPC.DeleteEvent     += () =>
            {
                WindowManager.BossWindow.VM.RemoveMe(NPC, Delay);
                DeleteTimer.Start();
            };
        }
Example #21
0
        public TreasureMapChest(Mobile owner, int level, bool temporary)
            : base(0xE40)
        {
            Owner      = owner;
            Level      = level;
            DeleteTime = DateTime.UtcNow + TimeSpan.FromHours(3.0);

            Temporary        = temporary;
            Guardians        = new List <Mobile>();
            AncientGuardians = new List <Mobile>();

            Timer = new DeleteTimer(this, DeleteTime);
            Timer.Start();
        }
Example #22
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_ExpireDate  = reader.ReadDeltaTime();
            m_ReturnPoint = reader.ReadPoint3D();
            m_ReturnMap   = reader.ReadMap();
            m_DestPoint   = reader.ReadPoint3D();
            m_DestMap     = reader.ReadMap();

            if (m_ExpireDate < DateTime.MaxValue)
            {
                m_DeleteTimer = new DeleteTimer(this, m_ExpireDate - DateTime.UtcNow);
                m_DeleteTimer.Start();
            }
        }
Example #23
0
		public void RemoveInstance()
		{
			foreach ( Mobile m in World.Mobiles.Values )
			{
				if ( m.Player && (m.Map == this || m.LogoutMap == this) )
				{
					if ( m.NetState != null )
						m.MoveToWorld( m_ReturnPoint, m_ReturnMap );
					else
					{
						m.LogoutMap = m_ReturnMap;
						m.LogoutLocation = m_ReturnPoint;
					}
				}
			}

			if ( m_DeleteTimer != null )
			{
				m_DeleteTimer.Stop();
				m_DeleteTimer = null;
			}

			Delete();
		}
Example #24
0
		private void ResetTimer()
		{
			if (m_Timer != null)
			{
				m_Timer.Stop();
				m_Timer = null;
			}	
			// auto delete after 10 minutes?
			m_Timer = new DeleteTimer(this, DateTime.Now + TimeSpan.FromMinutes(10));
			m_Timer.Start();
		}
Example #25
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			m_ExpireDate = reader.ReadDeltaTime();
			m_ReturnPoint = reader.ReadPoint3D();
			m_ReturnMap = reader.ReadMap();
			m_DestPoint = reader.ReadPoint3D();
			m_DestMap = reader.ReadMap();

			if ( m_ExpireDate < DateTime.MaxValue )
			{
				m_DeleteTimer = new DeleteTimer( this, m_ExpireDate - DateTime.UtcNow );
				m_DeleteTimer.Start();
			}
		}
Example #26
0
        private void ButtonEditProgram_Click(object sender, EventArgs e)
        {
            string programid = LabelProgramName.Text.Split('(', ')')[1];

            // Checks the text value of the btnEditSave button.
            if (ButtonEditProgram.Text == "Edit Program")
            {
                // Sets the $SESSION['Programid'] to the selected Programid.
                Thread tSelectProgram = new Thread(PrepareProgramThreaded);
                tSelectProgram.Start(programid);

                DeleteTimer.Start();

                // Enables all the controls to allow modification.
                SetControls(true);

                // Disables the 'Create Program' button.
                ButtonCreateProgram.Enabled = false;

                // Shows the current character count/limit of the program name/description textboxes.
                LabelProgramName.Text = String.Format("Program Name ({0}) - ({1}/25):", programid,
                                                      TextBoxProgramName.TextLength);
                LabelProgramDescription.Text = String.Format("Program Description ({0}/500):",
                                                             TextBoxProgramDescription.TextLength);

                // Changes the button text and disables it until the program is modified.
                ButtonEditProgram.Text = "Cancel Editing";
            }
            else if (ButtonEditProgram.Text == "Save Changes")
            {
                // Disables all the controls to prevent modification.
                SetControls(false);

                DeleteTimer.Stop();
                _secondCounter = 3;
                ButtonDeleteProgram.Enabled = false;
                ButtonDeleteProgram.Text    = "Delete Program (3)";

                // Disables the btnEditSave button.
                ButtonEditProgram.Enabled = false;

                // Resets the program description label.
                LabelProgramDescription.Text = "Program Description:";

                string programDescription = TextBoxProgramDescription.Text.Replace(Environment.NewLine, "<br>");

                // ProgramDetails = { ProgramName, ProgramVersion, AutoUpdateBOOL, ProgramDescription, Programid }
                string[] programDetails =
                {
                    TextBoxProgramName.Text,
                    LabelVersion.Text.Replace("Version: ",String.Empty),
                    programDescription,
                    programid
                };

                // Updates the database with the new program details on a seperate thread.
                Thread updateProgramThread = new Thread(UpdateProgram);
                updateProgramThread.Start(programDetails);
            }
            else
            {
                // Disables all the controls to prevent modification.
                SetControls(false);

                // Resets the program name/description labels if the user cancels editing.
                LabelProgramName.Text        = String.Format("Program Name ({0}):", programid);
                LabelProgramDescription.Text = "Program Description:";

                // Resets the text of the btnEditSave button.
                ButtonEditProgram.Text = "Edit Program";

                DeleteTimer.Stop();
                _secondCounter = 3;
                ButtonDeleteProgram.Enabled = false;
                ButtonDeleteProgram.Text    = "Delete Program (3)";

                ButtonManageProgram.Enabled = true;
                ButtonCreateProgram.Enabled = true;
            }
        }
Example #27
0
        public override bool OnDragDrop(Mobile m, Item t)
        {
            if (m_Done)
            {
                return(false);
            }

            Container pack = Backpack;

            if (t is BaseClothing)
            {
                Emote("*Puts the clothing on*");
                pack.DropItem(t);
                AddItem(t);
                return(true);
            }

            if (t is Food)
            {
                Emote("*Eats the food*");
                PlaySound(Utility.Random(0x3A, 3));
                pack.DropItem(t);
                AddItem(t);
                return(true);
            }

            if (t is Gold)
            {
                if (CheckTeachingMatch(m))
                {
                    if (Teach(m_Teaching, m, t.Amount, true))
                    {
                        t.Delete();
                        return(true);
                    }
                }

                pack.DropItem(t);
                // Karma gain is 1% of gold with max gain of 25
                int newKarma = (t.Amount > 2500) ? 25 : (t.Amount / 100);
                Titles.AwardKarma(m, newKarma, true);
                Direction = GetDirectionTo(m.Location);

                Animate(32, 5, 1, true, false, 0); // Bow

                if (t.Amount < 50)
                {
                    Say("Thanks.");
                }

                else if ((t.Amount >= 50) && (t.Amount < 100))
                {
                    Say("Thank you for the gold!");
                }

                else if ((t.Amount >= 100) && (t.Amount < 500))
                {
                    Say("Thank you! The pockets are nice and heavy now!");
                }

                else if ((t.Amount >= 500) && (t.Amount < 1000))
                {
                    Say("What a generous sum of gold! Thank you!");
                }

                else if ((t.Amount >= 1000) && (t.Amount < 5000))
                {
                    Say("I owe you my life! Without this money I could not feed or clothe my children!");
                }

                else
                {
                    Say("I am no longer a pauper!");   // t.Amount >= 5000
                }
                if (TotalGold > 5000)
                {
                    DeleteTimer d = new DeleteTimer(this, m);
                    d.Start();
                }

                return(true);
            }

            Say("eh? Whats this for?");
            return(false);
        }
Example #28
0
 protected override void OnNpcDelete()
 {
     WindowManager.ViewModels.NpcVM.RemoveNPC(NPC, Delay);
     DeleteTimer.Start();
 }
Example #29
0
		private void ResetTimer()
		{
			if (m_Timer != null)
			{
				m_Timer.Stop();
				m_Timer = null;
			}
			m_Timer = new DeleteTimer(this, DateTime.Now + TimeSpan.FromMinutes(m_DeleteMinutes));
			m_Timer.Start();
		}