Esempio n. 1
0
            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);
                }
            }