Пример #1
0
        private void OnMantraSpoken(Mobile from, VirtueBonusEntry bonusEntry)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            if (m_Bonuses.ContainsKey(pm))
            {
                var currentBonusEntry = m_Bonuses[pm];

                // You already feel ~1_VIRTUE~ from your earlier contemplation of the virtues.
                pm.SendLocalizedMessage(1079544, string.Format("#{0}", currentBonusEntry.Cliloc));
            }
            else if (pm.NextAnkhPendantUse > DateTime.Now)
            {
                TimeSpan delta = pm.NextAnkhPendantUse - DateTime.Now;

                if (delta < TimeSpan.FromHours(1.0))
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ minutes.
                    pm.SendLocalizedMessage(1079568, ((int)delta.TotalMinutes).ToString());
                }
                else
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ hours.
                    pm.SendLocalizedMessage(1079566, ((int)delta.TotalHours).ToString());
                }
            }
            else
            {
                List <AttributeMod> mods = ComputeBonuses(pm, bonusEntry);

                foreach (AttributeMod mod in mods)
                {
                    pm.AddAttributeMod(mod);
                }

                m_Bonuses.Add(pm, bonusEntry);
                pm.NextAnkhPendantUse = DateTime.Now + TimeSpan.FromDays(1.0);

                // Contemplating at the shrine has left you feeling more ~1_VIRTUE~.
                pm.SendLocalizedMessage(1079546, string.Format("#{0}", bonusEntry.Cliloc));

                Timer.DelayCall(TimeSpan.FromHours(1.0),
                                delegate
                {
                    foreach (AttributeMod mod in mods)
                    {
                        pm.RemoveAttributeMod(mod);
                    }

                    m_Bonuses.Remove(pm);

                    pm.SendLocalizedMessage(1079553);                               // The effects of meditating at the shrine have worn off.
                });
            }
        }
Пример #2
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            if (m_Bonuses.Contains(pm))
            {
                // You're still feeling lucky from the last time you touched the sculpture.
                pm.SendLocalizedMessage(1079534);
            }
            else if (pm.NextTenthAnniversarySculptureUse > DateTime.Now)
            {
                TimeSpan delta = pm.NextTenthAnniversarySculptureUse - DateTime.Now;

                if (delta < TimeSpan.FromHours(1.0))
                {
                    // You can improve your fortunes in about ~1_TIME~ minutes.
                    pm.SendLocalizedMessage(1079548, ((int)delta.TotalMinutes).ToString());
                }
                else
                {
                    // You can improve your fortunes again in about ~1_TIME~ hours.
                    pm.SendLocalizedMessage(1079550, ((int)delta.TotalHours).ToString());
                }
            }
            else
            {
                int luckBonus = ComputeLuckBonus(pm);

                AttributeMod luckMod = new AttributeMod(MagicalAttribute.Luck, luckBonus);
                pm.AddAttributeMod(luckMod);

                m_Bonuses.Add(pm);
                pm.NextTenthAnniversarySculptureUse = DateTime.Now + TimeSpan.FromDays(1.0);

                pm.SendLocalizedMessage(1079551);                   // Your luck just improved!

                Timer.DelayCall(TimeSpan.FromHours(1.0),
                                delegate
                {
                    pm.RemoveAttributeMod(luckMod);
                    m_Bonuses.Remove(pm);

                    pm.SendLocalizedMessage(1079552);                               // Your luck just ran out.
                });
            }
        }