Exemplo n.º 1
0
        public static void LoadSpells(bool init)
        {
            if (!loaded)
            {
                InitEffectHandlers();
                //LoadOtherDBCs();

                SpellEffect.InitMiscValueTypes();
                loaded = true;
                //Spell.InitDbcs();
                //new DBCReader<Spell.SpellDBCConverter>(RealmServerConfiguration.GetDBCFile(WCellConstants.DBC_SPELL));

                //ContentMgr.Load<SpellLearnRelation>();
                //InitSummonHandlers();
                LoadOverrides();
                //SkillHandler.Initialize();
                //TalentMgr.Initialize();

                SpellLines.InitSpellLines();

                //ContentMgr.Load<SpellProcEventEntry>();
                ProcEventHelper.PatchSpells(ById);
            }

            if (init)
            {
                Initialize2();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a list of all SpellLines that are affected by the given spell family set (very long bit field)
        /// </summary>
        public static HashSet <SpellLine> GetAffectedSpellLines(ClassId clss, uint[] mask)
        {
            var lines    = SpellLines.GetLines(clss);
            var affected = new HashSet <SpellLine>();

            if (lines != null)
            {
                foreach (var line in lines)
                {
                    foreach (var spell in line)
                    {
                        if (spell.MatchesMask(mask))
                        {
                            affected.Add(line);
                            break;
                        }
                    }
                }
                //foreach (var spell in ById)
                //{
                //    if (spell != null && spell.ClassId == clss && spell.MatchesMask(mask))
                //    {
                //        if (spell.Line != null)
                //        {
                //            affected.Add(line);
                //        }
                //        break;
                //    }
                //}
            }
            return(affected);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Apply the given action on all Spells with the given ids
 /// </summary>
 /// <param name="action"></param>
 public static void Apply(this Action <Spell> action, params SpellLineId[] ids)
 {
     foreach (var lineId in ids)
     {
         var line = SpellLines.GetLine(lineId);
         Apply(action, line);
     }
 }
Exemplo n.º 4
0
 public void Add(params SpellLineId[] ids)
 {
     foreach (var id in ids)
     {
         var line = SpellLines.GetLine(id);
         Add(line);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Apply the given action on all Spells with the given ids
        /// </summary>
        /// <param name="action"></param>
        public static void Apply(this SpellLineId id, Action <Spell> action)
        {
            var line = SpellLines.GetLine(id);

            if (line == null)
            {
                throw new Exception("Invalid SpellLineId: " + id);
            }
            Apply(action, line);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Adds a set of spells to the explicite relationship set of this effect, which is used to determine whether
 /// a certain Spell and this effect have some kind of influence on one another (for procs, talent modifiers etc).
 /// Only adds the spells, will not work on the spells' trigger spells.
 /// </summary>
 /// <param name="abilities"></param>
 public void AddAffectingSpells(params SpellLineId[] abilities)
 {
     if (AffectSpellSet == null)
     {
         AffectSpellSet = new HashSet <Spell>();
     }
     foreach (var ability in abilities)
     {
         AffectSpellSet.AddRange(SpellLines.GetLine(ability));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Apply the given action on all Spells with the given ids
        /// </summary>
        /// <param name="action"></param>
        public static void Apply(Action <Spell> action, SpellLineId id, params SpellId[] ids)
        {
            var line = SpellLines.GetLine(id);

            if (line == null)
            {
                throw new Exception("Invalid SpellLineId: " + id);
            }
            Apply(action, line);
            Apply(action, (IEnumerable <SpellId>)ids);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Add Spells which, when casted by others on the owner of this Aura, can cause it to trigger it's procs
        /// Don't add damage spells (they will generate a Proc event anyway).
        /// </summary>
        public void AddTargetProcSpells(params SpellLineId[] spellSetIds)
        {
            var list = new List <Spell>(spellSetIds.Length * 6);

            foreach (var id in spellSetIds)
            {
                var line = SpellLines.GetLine(id);
                list.AddRange(line);
            }
            AddTargetProcSpells(list.ToArray());
        }
Exemplo n.º 9
0
        /// <summary>
        /// Adds a set of spells to this Effect's AffectMask, which is used to determine whether
        /// a certain Spell and this effect have some kind of influence on one another (for procs, talent modifiers etc).
        /// Usually the mask also contains any spell that is triggered by the original spell.
        ///
        /// If you get a warning that the wrong set is affected, use AddAffectingSpells instead.
        /// </summary>
        public void AddToAffectMask(params SpellLineId[] abilities)
        {
            var newMask = new uint[SpellConstants.SpellClassMaskSize];

            // build new mask from abilities
            if (abilities.Length != 1)
            {
                foreach (var ability in abilities)
                {
                    var spell = SpellLines.GetLine(ability).FirstRank;
                    for (int i = 0; i < SpellConstants.SpellClassMaskSize; i++)
                    {
                        newMask[i] |= spell.SpellClassMask[i];
                    }
                }
            }
            else
            {
                SpellLines.GetLine(abilities[0]).FirstRank.SpellClassMask.CopyTo(newMask, 0);
            }

            // verification
            var affectedLines = SpellHandler.GetAffectedSpellLines(Spell.ClassId, newMask);

            if (affectedLines.Count != abilities.Length)
            {
                LogManager.GetCurrentClassLogger().Warn("[SPELL Inconsistency for {0}] " +
                                                        "Invalid affect mask affects a different set than the one intended: {1} (intended: {2}) - " +
                                                        "You might want to use AddAffectingSpells instead!",
                                                        Spell, affectedLines.ToString(", "), abilities.ToString(", "));
            }

            for (int i = 0; i < SpellConstants.SpellClassMaskSize; i++)
            {
                AffectMask[i] |= newMask[i];
            }
        }
Exemplo n.º 10
0
 internal static void InitSpellLines()
 {
     SpellLines.SetupSpellLines();
 }