示例#1
0
        public static SkillMasterySpell GetSpellForParty(Mobile from, Type type)
        {
            CheckTable(from);
            Mobile check = from;

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

            //First checks the caster
            if (m_Table.ContainsKey(check))
            {
                foreach (SkillMasterySpell spell in m_Table[check])
                {
                    if (spell != null && spell.GetType() == type)
                    {
                        return(spell);
                    }
                }
            }
            else
            {
                Party p = Party.Get(check);

                if (p != null)
                {
                    foreach (PartyMemberInfo info in p.Members)
                    {
                        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);
        }
示例#2
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);
        }