public static void RemoveTimer(Mobile m) { if (m == null) { return; } var contains = Contains(m); if (contains != null) { ExpireTimer t = contains.Timer; if (t != null) { t.Stop(); Table.Remove(contains); if (((PlayerMobile)m).AcceleratedStart > DateTime.UtcNow) { ((PlayerMobile)m).AcceleratedStart = DateTime.UtcNow; } m.PlaySound(0x100); BuffInfo.RemoveBuff(m, BuffIcon.ArcaneEmpowerment); m.SendLocalizedMessage(1077957);// The intense energy dissipates. You are no longer under the effects of an accelerated skillgain scroll. } } }
public void OnExpired() { ExpireTimer.Stop(); Owner.SendLocalizedMessage(1112822); // You fail to find the next ingredient in time. Your clockwork assembly crumbles. Mechanism.Delete(); m_Table.Remove(Owner); }
public void StartTimer() { if (ExpireTimer != null) { ExpireTimer.Stop(); } ExpireTimer = Timer.DelayCall(Timeout, new TimerCallback(OnExpired)); SutekIngredient[] ingredients = (SutekIngredient[])Enum.GetValues(typeof(SutekIngredient)); CurrentIngredient = ingredients[Utility.Random(ingredients.Length)]; Owner.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1112821, string.Format("#{0}", (int)CurrentIngredient)); // I need to add some ~1_INGREDIENT~. IngredientsLeft--; }
public override void OnCast() { BaseWeapon weapon = Caster.Weapon as BaseWeapon; if (Caster.Player && (weapon == null || weapon is Fists)) { Caster.SendLocalizedMessage(501078); // You must be holding a weapon. } else if (CheckSequence()) { /* Temporarily imbues a weapon with a life draining effect. * Half the damage that the weapon inflicts is added to the necromancer's health. * The effects lasts for (Spirit Speak skill level / 34) + 1 seconds. * * NOTE: Above algorithm is fixed point, should be : * (Spirit Speak skill level / 3.4) + 1 * * TODO: What happens if you curse a weapon then give it to someone else? Should they get the drain effect? */ Caster.PlaySound(0x387); Caster.FixedParticles(0x3779, 1, 15, 9905, 32, 2, EffectLayer.Head); Caster.FixedParticles(0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255); new SoundEffectTimer(Caster).Start(); TimeSpan duration = TimeSpan.FromSeconds((Caster.Skills[SkillName.SpiritSpeak].Value / 3.4) + 1.0); ExpireTimer t = null; if (m_Table.ContainsKey(Caster)) { t = m_Table[Caster]; } if (t != null) { t.Stop(); } m_Table[Caster] = t = new ExpireTimer(weapon, Caster, duration); t.Start(); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.CurseWeapon, 1060512, 1153780, duration, Caster)); } FinishSequence(); }
public void OnIngredientAcquired() { if (IngredientsLeft == 0) { ExpireTimer.Stop(); Mechanism.OnCompleted(Owner); Mechanism.Delete(); Owner.AddToBackpack(new CompletedClockworkAssembly()); m_Table.Remove(Owner); } else { StartTimer(); } }
public static void StopTimer(Mobile m) { if (m == null) { return; } var contains = Contains(m); if (contains != null) { ExpireTimer t = contains.Timer; if (t != null) { t.Stop(); if (((PlayerMobile)m).AcceleratedStart > DateTime.UtcNow) { ((PlayerMobile)m).AcceleratedStart = DateTime.UtcNow; } } } }
public void RestartTimer() { m_Timer.Stop(); m_Timer.Start(); }