protected override void OnTarget(Mobile from, object targeted) { if (m_Coin.Deleted) { return; } if (!m_Coin.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. return; } if (targeted is FontOfFortuneAddonComponent) { PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } if (pm.NextLuckyCoinWish > DateTime.UtcNow) { // You already made a wish today. Try again tomorrow! from.SendLocalizedMessage(1113368); } else { if (0.2 > Utility.RandomDouble()) { // 20% Reward FontOfFortune.Award(from); } else { // 80% Blessing FontOfFortune.Bless(from); } pm.NextLuckyCoinWish = DateTime.UtcNow + TimeSpan.FromHours(12.0); m_Coin.Consume(); } } else { // That is not sacred waters. Try looking in the Underworld. from.SendLocalizedMessage(1113369); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; from.CloseGump <ResurrectGump>(); if (info.ButtonID == 2) { from.PlaySound(0x214); from.Resurrect(); from.Hits = (int)(from.HitsMax * 0.8); FontOfFortune.AddCooldown(from); } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042010); // You must have the object in your backpack to use it. } else if (m_Table.ContainsKey(from)) { from.SendLocalizedMessage(1095133); // You are already under the effect of a balm or lotion. from.CloseGump(typeof(ReplaceBalmOrLotionGump)); from.SendGump(new ReplaceBalmOrLotionGump(this)); } else if (FontOfFortune.HasAnyBlessing(from)) { from.SendLocalizedMessage(1095133); // You are already under the effect of a balm or lotion. } else { Use(from); } }