private void GameObject_OnDelete(GameObject sender) { //var emitter = sender as Obj_GeneralParticleEmitter; //if (emitter != null && emitter.CheckTeam()) //{ // SpellData spellData; // if (SpellDetector.onProcessTraps.TryGetValue(emitter.Name.ToLower(), out spellData)) // { // foreach (var entry in SpellDetector.detectedSpells.Where(x => x.Value.info.trapTroyName.ToLower() == emitter.Name.ToLower())) // { // DelayAction.Add(1, () => SpellDetector.DeleteSpell(entry.Key)); // entry.Value.spellObject = null; // } // } //} var aiBase = sender as Obj_AI_Base; if (aiBase != null && aiBase.CheckTeam()) { SpellData spellData; if (SpellDetector.OnProcessTraps.TryGetValue(aiBase.UnitSkinName.ToLower(), out spellData)) { foreach (var entry in SpellDetector.DetectedSpells.Where(x => x.Value.Info.TrapBaseName.ToLower() == aiBase.UnitSkinName.ToLower())) { DelayAction.Add(1, () => SpellDetector.DeleteSpell(entry.Key)); entry.Value.SpellObject = null; } } } }
private void CompareSpellLocation2(Spell spell) { var pos1 = spell.CurrentSpellPosition; var timeNow = Environment.TickCount; if (spell.SpellObject != null) { ConsolePrinter.Print("start distance: " + spell.StartPos.Distance(pos1)); } DelayAction.Add(250, () => CompareSpellLocation(spell, pos1, timeNow)); }
private void Game_OnUpdate() { foreach (var entry in SpellDetector.DetectedSpells.Where(x => x.Value.Info.SpellName.Contains("_trap"))) { var spell = entry.Value; if (spell.SpellObject == null) { continue; } if (spell.SpellObject.IsDead || !spell.SpellObject.IsValid) { DelayAction.Add(1, () => SpellDetector.DeleteSpell(entry.Key)); entry.Value.SpellObject = null; } } }
private void Game_OnWndProc(WndProcEventArgs e) { if (!ObjectCache.MenuCache.Cache["ClickRemove"].Enabled) { return; } if (e.Message != (uint)WindowsMessages.WM_LBUTTONDOWN) { return; } foreach (var entry in SpellDetector.DetectedSpells.Where(x => Game.CursorPos.To2D().InSkillShot(x.Value, 50 + x.Value.Info.Radius, false))) { var spell = entry.Value; if (spell.Info.Range > 9000 /*global*/ || spell.Info.SpellName.Contains("_trap")) { DelayAction.Add(1, () => SpellDetector.DeleteSpell(entry.Key)); } } }
private void Render_OnPresent() { foreach (var entry in SpellDetector.DrawSpells) { var spell = entry.Value; if (spell.SpellType != SpellType.Line) { continue; } var spellPos = spell.CurrentSpellPosition; Render.Circle(new Vector3(spellPos.X, spellPos.Y, MyHero.Position.Z), spell.Info.Radius, 50, Color.White); } if (TestMenu["(TestHeroPos)"].Enabled) { var path = MyHero.Path; if (path.Length > 0) { var heroPos2 = EvadeHelper.GetRealHeroPos(ObjectCache.GamePing + 50); var heroPos1 = ObjectCache.MyHeroCache.ServerPos2D; Render.Circle(new Vector3(heroPos2.X, heroPos2.Y, MyHero.ServerPosition.Z), ObjectCache.MyHeroCache.BoundingRadius, 50, Color.Red); Render.Circle(new Vector3(MyHero.ServerPosition.X, MyHero.ServerPosition.Y, MyHero.ServerPosition.Z), ObjectCache.MyHeroCache.BoundingRadius, 50, Color.White); Render.WorldToScreen(ObjectManager.GetLocalPlayer().Position, out var heroPos); Render.Text($" {(int) heroPos2.Distance(heroPos1)}", new Vector2(heroPos.X - 10, heroPos.Y), RenderTextFlags.Center, Color.Red); Render.Circle(new Vector3(_circleRenderPos.X, _circleRenderPos.Y, MyHero.ServerPosition.Z), 10, 50, Color.Red); } } if (TestMenu["(DrawHeroPos)"].Enabled) { Render.Circle(new Vector3(MyHero.ServerPosition.X, MyHero.ServerPosition.Y, MyHero.ServerPosition.Z), ObjectCache.MyHeroCache.BoundingRadius, 50, Color.White); } if (TestMenu["(TestMoveTo)"].As <MenuKeyBind>().Enabled) { TestMenu["(TestMoveTo)"].As <MenuKeyBind>().Value = false; MyHero.IssueOrder(OrderType.MoveTo, Game.CursorPos); var dir = (Game.CursorPos - MyHero.Position).Normalized(); var pos2 = Game.CursorPos.To2D() - dir.To2D() * 75; DelayAction.Add(20, () => MyHero.IssueOrder(OrderType.MoveTo, pos2.To3D())); } if (TestMenu["(TestPath)"].Enabled) { var tPath = MyHero.GetPath(Game.CursorPos); foreach (var point in tPath) { var point2D = point.To2D(); Render.Circle(new Vector3(point.X, point.Y, point.Z), ObjectCache.MyHeroCache.BoundingRadius, 50, Color.Violet); } } if (TestMenu["(TestPath)"].Enabled) { foreach (var entry in SpellDetector.Spells) { var spell = entry.Value; var to = Game.CursorPos.To2D(); var dir = (to - MyHero.Position.To2D()).Normalized(); var cpa = MathUtilsCpa.CPAPointsEx(MyHero.Position.To2D(), dir * ObjectCache.MyHeroCache.MoveSpeed, spell.EndPos, spell.Direction * spell.Info.ProjectileSpeed, to, spell.EndPos); if (cpa < ObjectCache.MyHeroCache.BoundingRadius + spell.Radius) { } } } if (TestMenu["(ShowBuffs)"].Enabled) { var target = MyHero; foreach (var hero in GameObjects.EnemyHeroes) { target = hero; } var buffs = target.Buffs; if (!target.IsTargetable) { ConsolePrinter.Print("invul" + Environment.TickCount); } var height = 20; foreach (var buff in buffs) { if (!buff.IsValid) { continue; } Render.Text(buff.Name, new Vector2(10, height), RenderTextFlags.Center, Color.White); height += 20; ConsolePrinter.Print(buff.Name); } } if (TestMenu["(TestTracker)"].Enabled) { foreach (var entry in ObjectTracker.ObjTracker) { var info = entry.Value; var endPos2 = !info.UsePosition ? info.Obj.Position : info.Position; Render.Circle(new Vector3(endPos2.X, endPos2.Y, MyHero.Position.Z), 50, 50, Color.Green); } } if (!TestMenu["(TestWall)"].Enabled) { return; } var posChecked = 0; const int maxPosToCheck = 50; const int posRadius = 50; var radiusIndex = 0; var heroPoint = ObjectCache.MyHeroCache.ServerPos2D; while (posChecked < maxPosToCheck) { radiusIndex++; var curRadius = radiusIndex * 2 * posRadius; var curCircleChecks = (int)Math.Ceiling(2 * Math.PI * curRadius / (2 * (double)posRadius)); for (var i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = 2 * Math.PI / (curCircleChecks - 1) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); if (!EvadeHelper.CheckPathCollision(MyHero, pos)) { Render.Circle(new Vector3(pos.X, pos.Y, MyHero.Position.Z), 25, 50, Color.White); } } } }
private void SpellMissile_OnCreate(GameObject obj) { if (obj.IsValid && obj.Type == GameObjectType.MissileClient) { var mis = (MissileClient)obj; if (mis.SpellCaster is Obj_AI_Hero && mis.SpellData.ConsideredAsAutoAttack) { ConsolePrinter.Print("[" + mis.SpellData.Name + "]: Missile Speed " + mis.SpellData.MissileSpeed); ConsolePrinter.Print("[" + mis.SpellData.Name + "]: LineWidth " + mis.SpellData.LineWidth); ConsolePrinter.Print("[" + mis.SpellData.Name + "]: Range " + mis.SpellData.CastRange); ConsolePrinter.Print("[" + mis.SpellData.Name + "]: Accel " + mis.SpellData.MissileAccel); } } if (!obj.IsValid || obj.Type != GameObjectType.MissileClient) { return; } if (!TestMenu["ShowMissileInfo"].Enabled) { return; } var missile = (MissileClient)obj; if (!(missile.SpellCaster is Obj_AI_Hero)) { return; } var testMissileSpeedStartTime = Environment.TickCount; var testMissileSpeedStartPos = missile.Position.To2D(); DelayAction.Add(250, () => { if (!missile.IsValid || missile.IsDead) { return; } testMissileSpeedStartTime = Environment.TickCount; testMissileSpeedStartPos = missile.Position.To2D(); }); _testMissile = missile; _testMissileStartTime = Environment.TickCount; ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Est.CastTime: " + (Environment.TickCount - _lastHeroSpellCastTime)); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Missile Name " + missile.SpellData.Name); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Missile Speed " + missile.SpellData.MissileSpeed); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Accel " + missile.SpellData.MissileAccel); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Max Speed " + missile.SpellData.MissileMaxSpeed); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: LineWidth " + missile.SpellData.LineWidth); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Range " + missile.SpellData.CastRange); RenderObjects.Add(new RenderCircle(missile.StartPosition.To2D(), 500)); RenderObjects.Add(new RenderCircle(missile.EndPosition.To2D(), 500)); DelayAction.Add(750, () => { if (!missile.IsValid || missile.IsDead) { return; } var dist = missile.Position.To2D().Distance(testMissileSpeedStartPos); ConsolePrinter.Print("[" + missile.SpellData.Name + "]: Est.Missile speed: " + 1000 * (dist / (Environment.TickCount - testMissileSpeedStartTime))); }); if (missile.SpellCaster == null || missile.SpellCaster.Team == MyHero.Team || missile.SpellData.Name == null || !SpellDetector.OnMissileSpells.TryGetValue(missile.SpellData.Name, out var spellData) || missile.StartPosition == null || missile.EndPosition == null) { return; } if (!(missile.StartPosition.Distance(MyHero.Position) < spellData.Range + 1000)) { return; } var hero = missile.SpellCaster; if (!hero.IsVisible) { return; } foreach (var entry in SpellDetector.Spells) { var spell = entry.Value; if (spell.Info.MissileName != missile.SpellData.Name || spell.HeroId != missile.SpellCaster.NetworkId) { continue; } if (spell.Info.IsThreeWay == false && spell.Info.IsSpecial == false) { ConsolePrinter.Print("Acquired: " + (Environment.TickCount - spell.StartTime)); } } }