Beispiel #1
0
        public static void RemoveBomb(Unit _Bomb, BombType _Type)
        {
            switch (_Type)
            {
            case BombType.Stasis:
                StasisBomb stasisBomb = Config._StasisBombs.FirstOrDefault <StasisBomb>((Func <StasisBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb));
                if (stasisBomb == null)
                {
                    break;
                }
                if (Config._ParticleManager.HasParticle(stasisBomb._Unit.Handle.ToString()))
                {
                    Config._ParticleManager.Remove(stasisBomb._Unit.Handle.ToString());
                }
                IParticleManager particleManager1 = Config._ParticleManager;
                string           str1             = "st";
                uint             handle           = stasisBomb._Unit.Handle;
                string           str2             = handle.ToString();
                string           name1            = str1 + str2;
                if (particleManager1.HasParticle(name1))
                {
                    IParticleManager particleManager2 = Config._ParticleManager;
                    string           str3             = "st";
                    handle = stasisBomb._Unit.Handle;
                    string str4  = handle.ToString();
                    string name2 = str3 + str4;
                    particleManager2.Remove(name2);
                }
                Config._StasisBombs.Remove(stasisBomb);
                break;

            case BombType.Land:
                LandBomb landBomb = Config._LandBombs.FirstOrDefault <LandBomb>((Func <LandBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb));
                if (landBomb == null)
                {
                    break;
                }
                if (Config._ParticleManager.HasParticle(landBomb._Unit.Handle.ToString()))
                {
                    Config._ParticleManager.Remove(landBomb._Unit.Handle.ToString());
                }
                Config._LandBombs.Remove(landBomb);
                BombManager.ReBindLandStacker(_Bomb);
                break;

            case BombType.Remote:
                RemoteBomb remoteBomb = Config._RemoteBombs.FirstOrDefault <RemoteBomb>((Func <RemoteBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb));
                if (remoteBomb == null)
                {
                    break;
                }
                if (Config._ParticleManager.HasParticle(remoteBomb._Unit.Handle.ToString()))
                {
                    Config._ParticleManager.Remove(remoteBomb._Unit.Handle.ToString());
                }
                Config._RemoteBombs.Remove(remoteBomb);
                BombManager.ReBindStacker(_Bomb);
                break;
            }
        }
Beispiel #2
0
        private async void DrawMiranaLine(Unit unit)
        {
            var startPos = unit.Position;
            await Task.Delay(100);

            var newPos = unit.Position;
            var pos    = (startPos - newPos).Normalized();

            pos *= 3000;
            pos  = startPos - pos;
            Particle.DrawLine(unit, "mirana_arrow", pos, false);
            while (unit.IsValid)
            {
                await Task.Delay(50);
            }
            Particle.Remove("mirana_arrow");
        }
Beispiel #3
0
 private void MenuKeyOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     if (MenuKey)
     {
         if (_configuration.DrawTargetParticle)
         {
             _targetParticleUpdateHandler.IsEnabled = true;
         }
     }
     else
     {
         if (_configuration.DrawTargetParticle)
         {
             _particleManager.Remove("Target");
             _targetParticleUpdateHandler.IsEnabled = false;
         }
     }
 }
Beispiel #4
0
        private void UnLoad()
        {
            EntityManager <Hero> .EntityAdded -= EntityAdded;
            var illusions = EntityManager <Hero> .Entities.Where(x => x.IsAlive && x.Team != MyTeam && x.IsIllusion);

            foreach (var x in illusions)
            {
                Particle.Remove("showIllusion" + x.Handle);
            }
        }
Beispiel #5
0
        private void onUpdate()
        {
            if (_menu.DrawUltEnabled && _abilities.Scythe.Ability?.Level > 0)
            {
                _particleManager.DrawRange(_owner, "ult_range", _abilities.Scythe.CastRange, Color.Red);
            }
            else
            {
                _particleManager.Remove("ult_range");
            }

            if (_menu.DrawBlinkEnabled && _abilities.Blink != null)
            {
                _particleManager.DrawRange(_owner, "blink_range", _abilities.Blink.CastRange, Color.Gray);
            }
            else
            {
                _particleManager.Remove("blink_range");
            }

            if (_menu.DrawPulseEnabled &&
                _abilities.Pulse.Ability?.Level > 0
                )
            {
                _particleManager.DrawRange(_owner, "pulse_range", _abilities.Pulse.Radius, Color.Purple);
            }
            else
            {
                _particleManager.Remove("pulse_range");
            }
        }
Beispiel #6
0
        private void OnPounce()
        {
            if (Pounce.Level <= 0)
            {
                return;
            }

            if (DrawPouncePosition == true)
            {
                var          pounceCastPos = UnitExtensions.InFront(Owner, PounceDistance + PounceRadius);
                var          red           = new Vector3(255, 0, 0);
                var          green         = new Vector3(0, 255, 0);
                const string file          = "materials/ensage_ui/particles/rectangle.vpcf";
                particle.AddOrUpdate(Owner, $"DrawLine_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 1, this.Owner.InFront(0), 2, pounceCastPos,
                                     3, new Vector3(95, 100, 0), 4, red);

                var targets = EntityManager <Hero> .Entities.FirstOrDefault(
                    x => x.IsAlive && x.Team != this.Owner.Team &&
                    x.Distance2D(this.Owner) < 1500 && !x.IsIllusion);

                if (targets != null && AbilityExtensions.CanBeCasted(this.Pounce) && this.Pounce != null &&
                    !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable())
                {
                    var vectorOfMovement = new Vector2((float)Math.Cos(targets.RotationRad) * targets.MovementSpeed, (float)Math.Sin(targets.RotationRad) * targets.MovementSpeed);
                    var hitPosition      = Intercepts(targets.Position, vectorOfMovement, this.Owner.Position, 933.33f);
                    var hitPosMod        = hitPosition + new Vector3(vectorOfMovement.X * (TimeToTurn(this.Owner, hitPosition)), vectorOfMovement.Y * (TimeToTurn(this.Owner, hitPosition)), 0);
                    var hitPosMod2       = hitPosition + new Vector3(vectorOfMovement.X * (TimeToTurn(this.Owner, hitPosMod)), vectorOfMovement.Y * (TimeToTurn(this.Owner, hitPosMod)), 0);

                    if (this.Owner.Distance2D(hitPosMod2) > ((PounceDistance + PounceRadius) + targets.HullRadius))
                    {
                        return;
                    }

                    if (IsFacing(this.Owner, targets))
                    {
                        particle.AddOrUpdate(Owner, $"DrawLine_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 1, this.Owner.InFront(0), 2, pounceCastPos,
                                             3, new Vector3(95, 100, 0), 4, green);
                    }
                }
            }
            else
            {
                particle.Remove($"DrawLine_{1}");
            }
        }
 public static void OnUpdate()
 {
     if (ParticleRemover.ChangedDrawingsVals["LandBombRange"] != Core.Config._Menu.DrawingsMenu.BombsDrawings.LandBombRange)
     {
         ParticleRemover.ChangedDrawingsVals["LandBombRange"] = Core.Config._Menu.DrawingsMenu.BombsDrawings.LandBombRange;
         ParticleRemover.ChangedDrawings["LandBombRange"]     = true;
     }
     if (ParticleRemover.ChangedDrawingsVals["RemoteBombRange"] != Core.Config._Menu.DrawingsMenu.BombsDrawings.RemoteBombRange)
     {
         ParticleRemover.ChangedDrawingsVals["RemoteBombRange"] = Core.Config._Menu.DrawingsMenu.BombsDrawings.RemoteBombRange;
         ParticleRemover.ChangedDrawings["RemoteBombRange"]     = true;
     }
     if (ParticleRemover.ChangedDrawingsVals["StasisBombRange"] != Core.Config._Menu.DrawingsMenu.BombsDrawings.StasisBombRange)
     {
         ParticleRemover.ChangedDrawingsVals["StasisBombRange"] = Core.Config._Menu.DrawingsMenu.BombsDrawings.StasisBombRange;
         ParticleRemover.ChangedDrawings["StasisBombRange"]     = true;
     }
     if (ParticleRemover.ChangedDrawingsVals["StasisBombSubRange"] != Core.Config._Menu.DrawingsMenu.BombsDrawings.StasisBombSubRange)
     {
         ParticleRemover.ChangedDrawingsVals["StasisBombSubRange"] = Core.Config._Menu.DrawingsMenu.BombsDrawings.StasisBombSubRange;
         ParticleRemover.ChangedDrawings["StasisBombSubRange"]     = true;
     }
     if (ParticleRemover.ChangedDrawingsVals["FrocePath"] != Core.Config._Menu.DrawingsMenu.ForceDrawings.FrocePath)
     {
         ParticleRemover.ChangedDrawingsVals["FrocePath"] = Core.Config._Menu.DrawingsMenu.ForceDrawings.FrocePath;
         ParticleRemover.ChangedDrawings["FrocePath"]     = true;
     }
     if (ParticleRemover.ChangedDrawingsVals["FroceRange"] != Core.Config._Menu.DrawingsMenu.ForceDrawings.FroceRange)
     {
         ParticleRemover.ChangedDrawingsVals["FroceRange"] = Core.Config._Menu.DrawingsMenu.ForceDrawings.FroceRange;
         ParticleRemover.ChangedDrawings["FroceRange"]     = true;
     }
     if (ParticleRemover.ChangedDrawings["LandBombRange"])
     {
         if (!ParticleRemover.ChangedDrawingsVals["LandBombRange"])
         {
             foreach (LandBomb landBomb in Core.Config._LandBombs)
             {
                 IParticleManager particleManager1 = Core.Config._ParticleManager;
                 uint             handle           = landBomb._Unit.Handle;
                 string           name1            = handle.ToString();
                 if (particleManager1.HasParticle(name1))
                 {
                     IParticleManager particleManager2 = Core.Config._ParticleManager;
                     handle = landBomb._Unit.Handle;
                     string name2 = handle.ToString();
                     particleManager2.Remove(name2);
                 }
             }
         }
         ParticleRemover.ChangedDrawings["LandBombRange"] = false;
     }
     if (ParticleRemover.ChangedDrawings["RemoteBombRange"])
     {
         if (!ParticleRemover.ChangedDrawingsVals["RemoteBombRange"])
         {
             foreach (RemoteBomb remoteBomb in Core.Config._RemoteBombs)
             {
                 IParticleManager particleManager1 = Core.Config._ParticleManager;
                 uint             handle           = remoteBomb._Unit.Handle;
                 string           name1            = handle.ToString();
                 if (particleManager1.HasParticle(name1))
                 {
                     IParticleManager particleManager2 = Core.Config._ParticleManager;
                     handle = remoteBomb._Unit.Handle;
                     string name2 = handle.ToString();
                     particleManager2.Remove(name2);
                 }
             }
         }
         ParticleRemover.ChangedDrawings["RemoteBombRange"] = false;
     }
     if (ParticleRemover.ChangedDrawings["StasisBombRange"])
     {
         if (!ParticleRemover.ChangedDrawingsVals["StasisBombRange"])
         {
             foreach (StasisBomb stasisBomb in Core.Config._StasisBombs)
             {
                 IParticleManager particleManager1 = Core.Config._ParticleManager;
                 uint             handle           = stasisBomb._Unit.Handle;
                 string           name1            = handle.ToString();
                 if (particleManager1.HasParticle(name1))
                 {
                     IParticleManager particleManager2 = Core.Config._ParticleManager;
                     handle = stasisBomb._Unit.Handle;
                     string name2 = handle.ToString();
                     particleManager2.Remove(name2);
                 }
             }
         }
         ParticleRemover.ChangedDrawings["StasisBombRange"] = false;
     }
     if (ParticleRemover.ChangedDrawings["StasisBombSubRange"])
     {
         if (!ParticleRemover.ChangedDrawingsVals["StasisBombSubRange"])
         {
             foreach (StasisBomb stasisBomb in Core.Config._StasisBombs)
             {
                 IParticleManager particleManager1 = Core.Config._ParticleManager;
                 string           str1             = "st";
                 uint             handle           = stasisBomb._Unit.Handle;
                 string           str2             = handle.ToString();
                 string           name1            = str1 + str2;
                 if (particleManager1.HasParticle(name1))
                 {
                     IParticleManager particleManager2 = Core.Config._ParticleManager;
                     string           str3             = "st";
                     handle = stasisBomb._Unit.Handle;
                     string str4  = handle.ToString();
                     string name2 = str3 + str4;
                     particleManager2.Remove(name2);
                 }
             }
         }
         ParticleRemover.ChangedDrawings["StasisBombSubRange"] = false;
     }
     if (ParticleRemover.ChangedDrawings["FrocePath"])
     {
         if (!ParticleRemover.ChangedDrawingsVals["FrocePath"])
         {
             foreach (Hero hero in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
             {
                 if (x.Team != Core.Config._Hero.Team)
                 {
                     return(!x.IsIllusion);
                 }
                 return(false);
             })))
             {
                 if (Core.Config._ParticleManager.HasParticle(hero.Name + "force"))
                 {
                     Core.Config._ParticleManager.Remove(hero.Name + "force");
                 }
             }
         }
         ParticleRemover.ChangedDrawings["FrocePath"] = false;
     }
     if (!ParticleRemover.ChangedDrawings["FroceRange"])
     {
         return;
     }
     if (!ParticleRemover.ChangedDrawingsVals["FroceRange"] && Core.Config._ParticleManager.HasParticle("TR_ForceRange"))
     {
         Core.Config._ParticleManager.Remove("TR_ForceRange");
     }
     ParticleRemover.ChangedDrawings["FroceRange"] = false;
 }
Beispiel #8
0
        private void onUpdate()
        {
            if (_menu.DrawUltEnabled && _abilities.Skill4.Ability?.Level > 0)
            {
                _particleManager.DrawRange(_owner, "ult_range", _abilities.Skill4.CastRange, Color.Red);
            }
            else
            {
                _particleManager.Remove("ult_range");
            }

            if (_menu.DrawBlinkEnabled && _abilities.Blink != null)
            {
                _particleManager.DrawRange(_owner, "blink_range", _abilities.Blink.CastRange, Color.Gray);
            }
            else
            {
                _particleManager.Remove("blink_range");
            }

            if (_menu.DrawSkill1Enabled &&
                _abilities.Skill1.Ability?.Level > 0
                )
            {
                _particleManager.DrawRange(_owner, "skill1_range", _abilities.Skill1.Range + _abilities.Skill1.Radius, Color.Azure);
            }
            else
            {
                _particleManager.Remove("skill1_range");
            }

            if (_menu.DrawSkill2Enabled &&
                _abilities.Skill2.Ability?.Level > 0
                )
            {
                _particleManager.DrawRange(_owner, "skill2_range", _abilities.Skill2.CastRange, Color.Beige);
            }
            else
            {
                _particleManager.Remove("skill2_range");
            }

            if (_menu.DrawSkill3Enabled &&
                _abilities.Skill3.Ability?.Level > 0
                )
            {
                _particleManager.DrawRange(_owner, "skill3_range", _abilities.Skill3.CastRange, Color.CadetBlue);
            }
            else
            {
                _particleManager.Remove("skill3_range");
            }

            var target = _targetSelector.SelectTarget();

            if (_menu.DrawTargetEnabled && target != null)
            {
                _particleManager.DrawTargetLine(
                    _owner,
                    "target_line",
                    target.Position,
                    _menu.ComboKeyItem
                        ? Color.DarkRed
                        : Color.Gray);
            }
            else
            {
                _particleManager.Remove("target_line");
            }
        }
Beispiel #9
0
        private void OnUpdate()
        {
            if (RazeShort.Level <= 0)
            {
                return;
            }

            Razes = new List <Ability> {
                RazeShort, RazeMedium, RazeLong
            };

            if (DrawRazeRange == true)
            {
                var raze1 = UnitExtensions.InFront(Owner, this.RazeShort.GetAbilitySpecialData("shadowraze_range"));
                var raze2 = UnitExtensions.InFront(Owner, this.RazeMedium.GetAbilitySpecialData("shadowraze_range"));
                var raze3 = UnitExtensions.InFront(Owner, this.RazeLong.GetAbilitySpecialData("shadowraze_range"));

                var file = "materials/ensage_ui/particles/alert_range.vpcf";
                Particle.AddOrUpdate(Owner, $"DrawRange_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0,
                                     raze1,
                                     1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40));
                Particle.AddOrUpdate(Owner, $"DrawRange_{2}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0,
                                     raze2,
                                     1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40));
                Particle.AddOrUpdate(Owner, $"DrawRange_{3}", file, ParticleAttachment.AbsOrigin, RestartType.None, 0,
                                     raze3,
                                     1, new Vector3(255, 0, 0), 2, new Vector3(200, 255, 40));

                var targets = EntityManager <Hero> .Entities.FirstOrDefault(
                    x => x.IsAlive && x.Team != this.Owner.Team &&
                    x.Distance2D(this.Owner) < 1500 && !x.IsIllusion);


                if (targets != null && this.RazeShort.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() &&
                    CanHit(this.RazeShort, targets, GetRazeDelay(targets, RazeShort), true))
                {
                    Particle.AddOrUpdate(Owner, $"DrawRange_{1}", file, ParticleAttachment.AbsOrigin, RestartType.None,
                                         0,
                                         raze1, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40));
                }

                if (targets != null && this.RazeMedium.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() &&
                    CanHit(this.RazeMedium, targets, GetRazeDelay(targets, RazeMedium), true))
                {
                    Particle.AddOrUpdate(Owner, $"DrawRange_{2}", file, ParticleAttachment.AbsOrigin, RestartType.None,
                                         0,
                                         raze2, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40));
                }

                if (targets != null && this.RazeLong.CanBeCasted() && !UnitExtensions.IsMagicImmune(targets) && !targets.IsInvulnerable() &&
                    CanHit(this.RazeLong, targets, GetRazeDelay(targets, RazeLong), true))
                {
                    Particle.AddOrUpdate(Owner, $"DrawRange_{3}", file, ParticleAttachment.AbsOrigin, RestartType.None,
                                         0,
                                         raze3, 1, new Vector3(0, 255, 0), 2, new Vector3(200, 255, 40));
                }
            }
            else
            {
                Particle.Remove($"DrawRange_{1}");
                Particle.Remove($"DrawRange_{2}");
                Particle.Remove($"DrawRange_{3}");
            }
        }
Beispiel #10
0
 protected override void OnDeactivate()
 {
     this._MenuManager.Value.DeregisterMenu((object)Core.Config._Menu, true);
     this._Input.MouseClick     -= new EventHandler <MouseEventArgs>(MouseRegionCatch.Input_MouseClick);
     Core.Config._Renderer.Draw -= new EventHandler(Drawings.BombStack.OnDraw);
     Core.Config._Renderer.Draw -= new EventHandler(Drawings.LandStack.OnDraw);
     Core.Config._Renderer.Draw -= new EventHandler(LandTimer.OnDraw);
     Core.Config._Renderer.Draw -= new EventHandler(Info.OnDraw);
     Core.Config._Renderer.Draw -= new EventHandler(Hello.OnDraw);
     UpdateManager.Unsubscribe(new Action(LandRunKillLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(BombOnHitLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(CreepDetonationLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(ForceLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(BombOnHitLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(ModWatcherLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(InvisibleDetonationLogic.OnUpdate));
     UpdateManager.Unsubscribe(new Action(Drawings.BombStack.OnUpdate));
     UpdateManager.Unsubscribe(new Action(Drawings.LandStack.OnUpdate));
     UpdateManager.Unsubscribe(new Action(Bombs.OnUpdate));
     UpdateManager.Unsubscribe(new Action(Force.OnUpdate));
     UpdateManager.Unsubscribe(new Action(EULCombo.OnUpdate));
     UpdateManager.Unsubscribe(new Action(ParticleRemover.OnUpdate));
     UpdateManager.Unsubscribe(new Action(EnemyUpdater.OnUpdate));
     this._InventoryManager.Detach((object)Core.Config._Items);
     Entity.OnAnimationChanged    -= new EntityAnimationChanged(TechiesRage.OnAnimationChanged);
     ObjectManager.OnAddEntity    -= new ObjectManagerAddEntity(BombManager.OnAddEntity);
     ObjectManager.OnRemoveEntity -= new ObjectManagerRemoveEntity(BombManager.OnRemoveEntity);
     Entity.OnInt32PropertyChange -= new EntityInt32PropertyChange(BombManager.OnInt32Change);
     foreach (Models.BombStack bombStack in Core.Config._BombStacks)
     {
         Core.Config._ParticleManager.Remove(bombStack.Id.ToString());
     }
     foreach (Models.LandStack landStack in Core.Config._LandStacks)
     {
         Core.Config._ParticleManager.Remove(landStack.Id.ToString());
     }
     foreach (LandBomb landBomb in Core.Config._LandBombs)
     {
         IParticleManager particleManager1 = Core.Config._ParticleManager;
         uint             handle           = landBomb._Unit.Handle;
         string           name1            = handle.ToString();
         if (particleManager1.HasParticle(name1))
         {
             IParticleManager particleManager2 = Core.Config._ParticleManager;
             handle = landBomb._Unit.Handle;
             string name2 = handle.ToString();
             particleManager2.Remove(name2);
         }
     }
     foreach (RemoteBomb remoteBomb in Core.Config._RemoteBombs)
     {
         IParticleManager particleManager1 = Core.Config._ParticleManager;
         uint             handle           = remoteBomb._Unit.Handle;
         string           name1            = handle.ToString();
         if (particleManager1.HasParticle(name1))
         {
             IParticleManager particleManager2 = Core.Config._ParticleManager;
             handle = remoteBomb._Unit.Handle;
             string name2 = handle.ToString();
             particleManager2.Remove(name2);
         }
     }
     foreach (StasisBomb stasisBomb in Core.Config._StasisBombs)
     {
         IParticleManager particleManager1 = Core.Config._ParticleManager;
         uint             handle           = stasisBomb._Unit.Handle;
         string           name1            = handle.ToString();
         if (particleManager1.HasParticle(name1))
         {
             IParticleManager particleManager2 = Core.Config._ParticleManager;
             handle = stasisBomb._Unit.Handle;
             string name2 = handle.ToString();
             particleManager2.Remove(name2);
         }
         IParticleManager particleManager3 = Core.Config._ParticleManager;
         handle = stasisBomb._Unit.Handle;
         string name3 = handle.ToString();
         if (particleManager3.HasParticle(name3))
         {
             Core.Config._ParticleManager.Remove("st" + (object)stasisBomb._Unit.Handle);
         }
     }
     this._InventoryManager.Detach((object)Core.Config._Items);
 }