Core/Spells: CastSpell Cleanup

Port From (https://github.com/TrinityCore/TrinityCore/commit/)
This commit is contained in:
hondacrx
2021-04-18 18:42:11 -04:00
parent b1ea7212f3
commit d0faa12ef6
45 changed files with 775 additions and 632 deletions
+7 -2
View File
@@ -15,9 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.World
@@ -27,10 +29,13 @@ namespace Scripts.World
{
public trigger_periodic(Creature creature) : base(creature)
{
var interval = me.GetBaseAttackTime(Framework.Constants.WeaponAttackType.BaseAttack);
var interval = me.GetBaseAttackTime(WeaponAttackType.BaseAttack);
var spell = me.m_spells[0] != 0 ? Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID()) : null;
_scheduler.Schedule(TimeSpan.FromMilliseconds(interval), task =>
{
me.CastSpell(me, me.m_spells[0], true);
if (spell != null)
me.CastSpell(me, spell.Id, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetCastDifficulty(spell.Difficulty));
task.Repeat(TimeSpan.FromMilliseconds(interval));
});
}