Ejemplo n.º 1
0
        internal static void TriggerOnDetectSkillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Vector2 originalEnd, Obj_AI_Base unit)
        {
            var skillshot = new Skillshot(detectionType, spellData, startT, start, end, unit)
            {
                OriginalEnd = originalEnd
            };

            OnDetectSkillshot?.Invoke(skillshot);
        }
Ejemplo n.º 2
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit));
 }
Ejemplo n.º 3
0
 private static void TriggerOnDetectSkillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Vector2 originalEnd,
     Obj_AI_Base unit,
     MissileClient missile = null)
 {
     OnDetectSkillshot?.Invoke(new Skillshot(detectionType, spellData, startT, start, end, unit, missile)
     {
         OriginalEnd = originalEnd
     });
 }
Ejemplo n.º 4
0
        /// <summary>
        ///     Gets called when a new skillshot gets detected. It only gets called once per skillshot.
        /// </summary>
        /// <param name="skillshot"></param>
        static void Detector_OnDetectSkillshot(Skillshot skillshot)
        {
            var isAlreadyDetected = false;

            foreach (var detectedSkillshot in DetectedSkillshots)
            {
                if (detectedSkillshot.SData.SpellName != skillshot.SData.SpellName ||
                    detectedSkillshot.Caster.NetworkId != skillshot.Caster.NetworkId)
                {
                    continue;
                }

                //TODO: additional distance check(s) might be required.
                if (skillshot.Direction.AngleBetween(detectedSkillshot.Direction) < 5)
                {
                    isAlreadyDetected = true;

                    //Add the missile information to the detected skillshot.
                    if (skillshot.DetectionType == SkillshotDetectionType.MissileCreate)
                    {
                        try
                        {
                            ((SkillshotMissile)detectedSkillshot).Missile = ((SkillshotMissile)skillshot).Missile;
                        }
                        catch (Exception)
                        {
                            Logging.Write()(
                                LogLevel.Warn,
                                "Wrong SpellType for Skillshot {0}, a Missile Type was expected",
                                skillshot.SData.SpellName);
                        }
                    }
                }
            }

            if (isAlreadyDetected)
            {
                return;
            }

            skillshot.PrintSpellData();
            DetectedSkillshots.Add(skillshot);
            OnDetectSkillshot?.Invoke(skillshot);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Gets called when a new skillshot gets detected. It only gets called once per skillshot.
        /// </summary>
        /// <param name="skillshot"></param>
        static void Detector_OnDetectSkillshot(Skillshot skillshot)
        {
            var isAlreadyDetected = false;

            foreach (var detectedSkillshot in DetectedSkillshots)
            {
                if (detectedSkillshot.SData.SpellName != skillshot.SData.SpellName ||
                    detectedSkillshot.Caster.NetworkId != skillshot.Caster.NetworkId)
                {
                    continue;
                }

                //TODO: additional distance check(s) might be required.
                if (skillshot.Direction.AngleBetween(detectedSkillshot.Direction) < 5)
                {
                    isAlreadyDetected = true;

                    //Add the missile information to the detected skillshot.
                    if (skillshot.DetectionType == SkillshotDetectionType.MissileCreate)
                    {
                        try
                        {
                            ((SkillshotMissile)detectedSkillshot).Missile = ((SkillshotMissile)skillshot).Missile;
                        }
                        catch (Exception)
                        {
                            LogManager.GetCurrentClassLogger()
                            .Warn(
                                $"Wrong SpellType for Skillshot {skillshot.SData.SpellName}, a missile type was expected but instead got {skillshot.GetType().Name}.");
                        }
                    }
                }
            }

            if (isAlreadyDetected)
            {
                return;
            }

            skillshot.PrintSpellData();
            DetectedSkillshots.Add(skillshot);
            OnDetectSkillshot?.Invoke(skillshot);
        }
Ejemplo n.º 6
0
 /// <summary>
 ///     Gets called when a skillshot is detected, take into account that it can trigger twice for the same skillshot, one
 ///     when OnProcessSpellCast is called and another when OnMissileCreate is called.
 /// </summary>
 /// <param name="skillshot">The detected skillshot</param>
 private static void TriggerOnDetectSkillshot(Skillshot skillshot)
 {
     OnDetectSkillshot?.Invoke(skillshot);
 }