Пример #1
0
        public static bool HasHarmfulEffects(Mobile target, Type type)
        {
            foreach (Mobile m in m_Table.Keys)
            {
                for (var index = 0; index < m_Table[m].Count; index++)
                {
                    SkillMasterySpell spell = m_Table[m][index];

                    if (spell != null && spell.GetType() == type && spell.Target == target)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public static SkillMasterySpell GetHarmfulSpell(Mobile target, Type type)
        {
            foreach (Mobile m in m_Table.Keys)
            {
                for (var index = 0; index < m_Table[m].Count; index++)
                {
                    SkillMasterySpell spell = m_Table[m][index];

                    if (spell != null && spell.GetType() == type && spell.Target == target)
                    {
                        return(spell);
                    }
                }
            }

            return(null);
        }
Пример #3
0
        public static SkillMasterySpell GetSpellForParty(Mobile from, Type type)
        {
            CheckTable(from);
            Mobile check = from;

            if (from is BaseCreature bc && (bc.Controlled || bc.Summoned) && bc.GetMaster() != null)
            {
                check = bc.GetMaster();
                CheckTable(check);
            }

            //First checks the caster
            if (m_Table.ContainsKey(check))
            {
                for (var index = 0; index < m_Table[check].Count; index++)
                {
                    SkillMasterySpell spell = m_Table[check][index];

                    if (spell != null && spell.GetType() == type)
                    {
                        return(spell);
                    }
                }
            }
            else
            {
                Party p = Party.Get(check);

                if (p != null)
                {
                    for (var index = 0; index < p.Members.Count; index++)
                    {
                        PartyMemberInfo   info  = p.Members[index];
                        SkillMasterySpell spell = GetSpell(info.Mobile, type);

                        if (spell != null && spell.PartyEffects && from.InRange(info.Mobile.Location, spell.PartyRange) && spell.CheckPartyEffects(info.Mobile))
                        {
                            return(spell);
                        }
                    }
                }
            }

            return(null);
        }
Пример #4
0
        public static bool IsInCooldown(Mobile m, Type type, bool message = true)
        {
            CheckCooldown();

            if (_Cooldown == null)
            {
                return(false);
            }

            bool iscooling = false;

            foreach (KeyValuePair <SkillMasterySpell, DateTime> kvp in _Cooldown)
            {
                SkillMasterySpell spell = kvp.Key;
                DateTime          dt    = kvp.Value;

                if (!iscooling && spell.GetType() == type && spell.Caster == m)
                {
                    if (message)
                    {
                        double left = (dt - DateTime.UtcNow).TotalMinutes;

                        if (left > 1)
                        {
                            m.SendLocalizedMessage(1155787, ((int)left).ToString()); // You must wait ~1_minutes~ minutes before you can use this ability.
                        }
                        else
                        {
                            left = (_Cooldown[spell] - DateTime.UtcNow).TotalSeconds;

                            if (left > 0)
                            {
                                m.SendLocalizedMessage(1079335, left.ToString("F", System.Globalization.CultureInfo.InvariantCulture)); // You must wait ~1_seconds~ seconds before you can use this ability again.
                            }
                        }
                    }

                    iscooling = true;
                }
            }

            return(iscooling);
        }