// Use this for initialization void Start() { animator = GetComponent<Animator>(); objectManager = ObjectManager.GetInstance(); objectManager.AudioManager.Talking += Talk; objectManager.gameState.Damaged += FeelPain; }
public void Init() { FileInfo logFile = new System.IO.FileInfo("Log4Net.config"); if (logFile.Exists) { // Log4Net is configured using a DOMConfigurator. log4net.Config.XmlConfigurator.Configure(logFile); } else { // Set up a simple configuration that logs on the console. log4net.Config.BasicConfigurator.Configure(); } // Log an baseInfo level message if (log.IsDebugEnabled) { if (string.IsNullOrEmpty(System.Threading.Thread.CurrentThread.Name)) System.Threading.Thread.CurrentThread.Name = "Main(" + System.Threading.Thread.CurrentThread.ManagedThreadId + ")"; log.Debug("Interaction Tests Start"); } ObjectManager objectManager = new ObjectManager(); Sxta.Rti1516.HLAAttributes.HLAobjectRoot.AddIHLAobjectRootCreationListener(objectManager); }
void Start() { _gameManager = GameManager.Instance; _objectManager = _gameManager.getObjectManager(); _audioManager = _gameManager.getAudioManager(); Random.seed = (int)System.DateTime.Now.Ticks; }
public override void DriverSetup() { _mngObject = gobSystemManager.GetComponent<ObjectManager>(); transMyTransform = gameObject.transform; _mngObject.RegisterObject(gameObject, this); AdditionalSetup(); }
/// <summary>Creates a mirrored copy of the prototype object (Animated objects)</summary> /// <param name="Prototype">The prototype</param> /// <returns>The mirrored copy</returns> private static ObjectManager.UnifiedObject GetMirroredObject(ObjectManager.UnifiedObject Prototype) { if (Prototype is ObjectManager.StaticObject) { ObjectManager.StaticObject s = (ObjectManager.StaticObject)Prototype; return GetMirroredStaticObject(s); } else if (Prototype is ObjectManager.AnimatedObjectCollection) { ObjectManager.AnimatedObjectCollection a = (ObjectManager.AnimatedObjectCollection)Prototype; ObjectManager.AnimatedObjectCollection Result = new ObjectManager.AnimatedObjectCollection(); Result.Objects = new ObjectManager.AnimatedObject[a.Objects.Length]; for (int i = 0; i < a.Objects.Length; i++) { Result.Objects[i] = a.Objects[i].Clone(); for (int j = 0; j < a.Objects[i].States.Length; j++) { Result.Objects[i].States[j].Object = GetMirroredStaticObject(a.Objects[i].States[j].Object); } Result.Objects[i].TranslateXDirection.X *= -1.0; Result.Objects[i].TranslateYDirection.X *= -1.0; Result.Objects[i].TranslateZDirection.X *= -1.0; Result.Objects[i].RotateXDirection.X *= -1.0; Result.Objects[i].RotateYDirection.X *= -1.0; Result.Objects[i].RotateZDirection.X *= -1.0; } return Result; } else { return null; } }
private static bool Bug() { ObjectManager objmgr1; StreamingContext sc1; ObjectIDGenerator objid1; TestFixup tstfxp1; Int64 iRootID; Int64 iChildID; String strValue; MemberInfo[] members; Boolean fFirstTime; sc1 = new StreamingContext(StreamingContextStates.All); tstfxp1 = new TestFixup(); strValue = "Hello World"; objid1 = new ObjectIDGenerator(); iRootID = objid1.GetId(tstfxp1, out fFirstTime); iChildID = objid1.GetId(strValue, out fFirstTime); members = FormatterServices.GetSerializableMembers(tstfxp1.GetType()); objmgr1 = new ObjectManager(null, sc1); objmgr1.RecordFixup(iRootID, members[0], iChildID); try { objmgr1.RegisterObject(strValue, iChildID); return true; } catch(Exception ex){ Console.WriteLine("Bug:Exception thrown, " + ex); return false; } }
public void OnDestroy(){ if(ProceduralObjectsEditor.instance != null){ ProceduralObjectsEditor.instance.Close(); } ODOCDDOOCC.newObjectFlag = false; ODOCDDOOCC.duplicateObjectFlag = false; instance = null; }
void Start() { _ObjectManager = ObjectManager.GetInstance(); destinationNode = GetNodeFromLocation(destinationTransform.position); enemySpawnNode = GetNodeFromLocation(enemySpawnTransform.position); CreateEnemies(); }
public SpawnManager(Game game, SpriteBatch batch) { this.game = game; spriteBatch = batch; objectManager = (ObjectManager) game.Services.GetService((typeof(ObjectManager))); collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService))); nextTime = random.Next(0, 10); }
public static void InitializeManager() { CharacterMgr = CharacterStore.GetInstance(); ObjectMgr = ObjectManager.GetInstance(); SkillMgr = SkillManager.GetInstance(); SpellMgr = SpellManager.GetInstance(); WorldMgr = WorldManager.GetInstance(); }
public void TableDelete() { var result = new ObjectManager<Favorite>( new[] { new Favorite() } ); result.Delete( result.First() ); Assert.AreEqual( 0, result.Count() ); Assert.AreEqual( 0, result.Inserted.Count() ); Assert.AreEqual( 0, result.Updated.Count() ); Assert.AreEqual( 1, result.Deleted.Count() ); }
public void Init() { objectHistory = InfiniteObjectHistory.instance; objectManager = ObjectManager.instance; moveDirection = Vector3.up; slotCount = objectManager.slotCount; spawnDirection = Vector3.up; activeSlots = GetStartingSlot(); }
public static void InitializeManager() { DataMgr = DataManager.GetInstance(); ObjectMgr = ObjectManager.GetInstance(); SkillMgr = SkillManager.GetInstance(); SpawnMgr = SpawnManager.GetInstance(); SpellMgr = SpellManager.GetInstance(); WorldMgr = WorldManager.GetInstance(); }
public void LoadContent() { Art = game.Content.Load<Texture2D>(@"Pictures/beam_wall"); collisionBox.Width = (int)_size.X; collisionBox.Height = (int)_size.Y; _sourceRectangle = new Rectangle(0, 0, 80, 1024); objectManager = (ObjectManager)game.Services.GetService(typeof(ObjectManager)); collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService))); }
public static ObjectManager Get(Game aGame) { if (null == Instance) { Instance = new ObjectManager(aGame); } return Instance; }
void Start() { if (instance == null){ instance = this; }else { Destroy(this.gameObject); Debug.Error("core", "Second ObjectManager detected. Deleting gameOject."); return; } }
void Start() { ladderLayer = LayerMask.NameToLayer("Ladder"); gameManager = GameManager.instance ; objectGenerator = ObjectGenerator.instance; objectManager = ObjectManager.instance; targetSlot = objectManager.GetStartingSlot(); targetPosition = new Vector2(objectGenerator.IndexToGlobalPosition(targetSlot).x, -objectGenerator.horizon/2); transform.position = targetPosition; }
public void Init(Game game, SpriteBatch spriteBatchToUse) { TheSpriteBatch = spriteBatchToUse; TheGame = game; objectManager = (ObjectManager)TheGame.Services.GetService(typeof(ObjectManager)); collisionManager = (IManageCollisionsService)game.Services.GetService((typeof(IManageCollisionsService))); objectManager.RemoveAllObjects(); collisionManager.RemoveAllObjects(); levelLoaded = false; }
public void TableUpdate() { var result = new ObjectManager<Favorite>( new[] { new Favorite{ Name ="zhang san" }} ); result.First().Url = "AAA"; var updated = result.Updated.ToArray(); Assert.AreEqual( 1, result.Count() ); Assert.AreEqual( 0, result.Inserted.Count() ); Assert.AreEqual( 1, updated.Length ); Assert.AreEqual( 1, updated[0].Length ); Assert.AreEqual( 0, result.Deleted.Count() ); }
public ObjectManager() { _Map = GameObject.Find("Map").GetComponent<Map>(); _EventHandler = GameObject.Find("Map").GetComponent<_EventHandler>(); _ObjectManager = this; _Map.nodeSize = new LinkedListNode[_Map.size_x, _Map.size_z]; SetPositions(); BuildNodes(); ConnectNodes(); }
public void ObjectManagerShouldCreateObject() { var objectManager = new ObjectManager<Guid, NonSharedObject>(); var key = Guid.NewGuid(); var obj = objectManager.GetObject(key); Assert.IsNotNull(obj); obj = objectManager.TryGetObject(key); Assert.IsNotNull(obj); }
//Level Level1; public Game() { Graphics = new GraphicsDeviceManager(this); Graphics.PreferredBackBufferWidth = 1280; Graphics.PreferredBackBufferHeight = 720; Camera = new Point(0, 0); ObjectManager = new Engine.ObjectManager(this); Content.RootDirectory = "Content"; }
public ObjectManager() { if( instance != null ){ } instance = this; titleContent = new GUIContent("EasyRoads3D Object Manager"); position = new Rect((Screen.width - 550.0f) / 2.0f, (Screen.height - 400.0f) / 2.0f, 550.0f, 400.0f); minSize = new Vector2(550.0f, 400.0f); maxSize = new Vector2(550.0f, 400.0f); ODOCDDOOCC.OOCCOCCDCD(); }
// Use this for initialization void Start() { objectHistory = InfiniteObjectHistory.instance; objectManager = ObjectManager.instance; objectGenerator = ObjectGenerator.instance; inputController = InputController.instance; objectManager.Init(); objectHistory.Init(); objectGenerator.Init(); objectGenerator.StartGame(); inputController.StartGame(); }
public InformationBox(UserInformation u, PlayerUser pu) { Players = u.DefaultPlayers; Bombs = u.DefaultBombs; defb = Bombs; BackColor = CommonObjects.Colors.DimGray; FontColor = CommonObjects.Colors.White; Manager = new ObjectManager(2); user = pu; Y = 432; NumberScore = new NumberSprite(CommonObjects.ImageNumber32, 16, 32, 8) { X = 16 + 128, Y = 8, FillWithZero = true }; NumberFrames = new NumberSprite(CommonObjects.ImageNumber24, 12, 24, 4) { X = 572, Y = 20, }; NumberFps = new NumberSprite(CommonObjects.ImageNumber12White, 6, 12, 2) { X = 640 - 12, Y = 36, }; NumberPlayers = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 3) { X = 384, Y = 4, FillWithZero = true }; NumberBombs = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 3) { X = 524, Y = 4, FillWithZero = true }; NumberDestroy = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 4) { X = 376, Y = 28, FillWithZero = true }; NumberGraze = new NumberSprite(CommonObjects.ImageNumber16, 8, 16, 5) { X = 508, Y = 28, FillWithZero = true }; }
public ObjectManager() { if( instance != null ){ } instance = this; title = "EasyRoads3D Object Manager"; position = new Rect((Screen.width - 550.0f) / 2.0f, (Screen.height - 400.0f) / 2.0f, 550.0f, 400.0f); minSize = new Vector2(550.0f, 400.0f); maxSize = new Vector2(550.0f, 400.0f); ODQDQQOODQ.OOQDOCDQOD(); }
void Awake() { if (!Instance) { Instance = this; DontDestroyOnLoad(this); } else { Destroy(this); //Not sure if this will work } }
/// <summary> /// Initializes a new instance of the <see cref="FreezingArcher.Content.Game"/> class. /// </summary> /// <param name="name">Name.</param> /// <param name="objmnr">Object Manager.</param> /// <param name="messageProvider">Message Manager.</param> public Game (string name, ObjectManager objmnr, MessageProvider messageProvider, CompositorNodeScene scenenode, RendererContext rendererContext) { Logger.Log.AddLogEntry (LogLevel.Info, ClassName, "Creating new game '{0}'", name); Name = name; MessageProvider = messageProvider; RendererContext = rendererContext; SceneNode = scenenode; GameStateGraph = objmnr.CreateOrRecycle<DirectedWeightedGraph<GameState, GameStateTransition>>(); GameStateGraph.Init(); }
public Boolean runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; ObjectManager manager; ISurrogateSelector selector = null; StreamingContext context = new StreamingContext(StreamingContextStates.All); ClsType1 cls1; ClsType2 cls2; Int32 iValue; MemberInfo[] classMembers1; MemberInfo[] classMembers2; try { strLoc = "Loc_734rgt"; iCountTestcases++; cls1 = new ClsType1(); cls2 = new ClsType2(); iValue = 10; classMembers1 = FormatterServices.GetSerializableMembers(typeof(ClsType1), context); classMembers2 = FormatterServices.GetSerializableMembers(typeof(ClsType2), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, classMembers2[0], 3); manager.RecordFixup(1, classMembers1[0], 2); manager.RegisterObject(cls1, 1); manager.RegisterObject(cls2, 2); manager.RegisterObject(iValue, 3); manager.DoFixups(); if(cls1.ClsTp2.I != 10){ iCountErrors++; Console.WriteLine("Err_374sdg! Change of behavioue, unexpected value returned, " + cls1.ClsTp2.I); } manager.RaiseDeserializationEvent(); if(cls1.ClsTp2.I != 15){ iCountErrors++; Console.WriteLine("Err_987345sg! Change of behavioue, unexpected value returned, " + cls1.ClsTp2.I); } } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums ); return false; } }
public void Init() { if(objectManager == null) objectManager = ObjectManager.instance; int slotCount = objectManager.slotCount; topObject = new InfiniteObject2D[slotCount]; bottomObject = new InfiniteObject2D[slotCount]; lastObjectSpawnDistance = new float[slotCount]; totalDistance = new float[slotCount]; centerSlot = slotCount / 2; }
/// <summary> /// Returns true if hero is in shop range. /// </summary> /// <returns></returns> public static bool InShop(this Obj_AI_Hero hero) { return(hero.IsVisible && ObjectManager.Get <Obj_Shop>() .Any(s => s.Team == hero.Team && hero.Distance(s.Position, true) < 1562500)); // 1250² }
public static bool UnderTurret(this Vector3 position, bool enemyTurretsOnly) { return (ObjectManager.Get <Obj_AI_Turret>().Any(turret => turret.IsValidTarget(950, enemyTurretsOnly, position))); }
public static List <T> GetObjects <T>(this Vector3 position, float range) where T : GameObject, new() { return(ObjectManager.Get <T>().Where(x => position.Distance(x.Position, true) < range * range).ToList()); }
void Combo() { var comboQ = _menu.Item("comboQ" + Player.ChampionName).GetValue <StringList>().SelectedIndex; var comboW = _menu.Item("comboW" + Player.ChampionName).GetValue <bool>(); var comboE = _menu.Item("comboE" + Player.ChampionName).GetValue <bool>(); var comboR = _menu.Item("comboR" + Player.ChampionName).GetValue <Slider>().Value; if (comboQ > 0 && _spellQ.IsReady()) { if (_spellR.IsReady() && comboR > 0) //search unit that provides most targets hit by ult. prioritize hero target unit { int maxTargetsHit = 0; Obj_AI_Base unitMostTargetsHit = null; foreach (Obj_AI_Base unit in ObjectManager.Get <Obj_AI_Base>().Where(x => x.IsValidTarget(_spellQ.Range) && _spellQ.GetPrediction(x).Hitchance >= HitChance.High)) //causes troubles? { int targetsHit = unit.CountEnemiesInRange((int)_spellR.Range); //unitposition might not reflect where you land with Q if (targetsHit > maxTargetsHit || (unitMostTargetsHit != null && targetsHit >= maxTargetsHit && unit.Type == GameObjectType.obj_AI_Hero)) { maxTargetsHit = targetsHit; unitMostTargetsHit = unit; } } if (maxTargetsHit >= comboR) { CastQ(unitMostTargetsHit); } } Obj_AI_Base target = TargetSelector.GetTarget(_spellQ.Range, TargetSelector.DamageType.Magical); if (target != null) { if (comboQ == 1 || (comboQ == 2 && !Orbwalking.InAutoAttackRange(target))) { CastQ(target); } } } if (comboW && _spellW.IsReady()) { var target = TargetSelector.GetTarget(_spellW.Range, TargetSelector.DamageType.Magical); if (target != null) { var enoughMana = GetManaPercent() >= _menu.Item("comboWPercent" + Player.ChampionName).GetValue <Slider>().Value; if (Player.Spellbook.GetSpell(SpellSlot.W).ToggleState == 1) { if (Player.Distance(target.ServerPosition) <= _spellW.Range && enoughMana) { _comboW = true; _spellW.Cast(); } } else if (!enoughMana) { RegulateWState(true); } } else { RegulateWState(); } } if (comboE && _spellE.IsReady()) { CastE(Program.Helper.EnemyTeam.OrderBy(x => x.Distance(Player)).FirstOrDefault()); } }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { // Input variables string name = "default_tool"; List <Mesh> meshes = new List <Mesh>(); Plane attachmentPlane = Plane.Unset; double x = 0.0; double y = 0.0; double z = 0.0; double quat1 = 0.0; double quat2 = 0.0; double quat3 = 0.0; double quat4 = 0.0; // Catch the input data if (!DA.GetData(0, ref name)) { return; } if (!DA.GetDataList(1, meshes)) { meshes = new List <Mesh>() { new Mesh() }; } if (!DA.GetData(2, ref attachmentPlane)) { return; } if (!DA.GetData(3, ref x)) { return; } if (!DA.GetData(4, ref y)) { return; } if (!DA.GetData(5, ref z)) { return; } if (!DA.GetData(6, ref quat1)) { return; } if (!DA.GetData(7, ref quat2)) { return; } if (!DA.GetData(8, ref quat3)) { return; } if (!DA.GetData(9, ref quat4)) { return; } // Replace spaces and new lines name = HelperMethods.ReplaceSpacesAndRemoveNewLines(name); // Create the robot tool _robotTool = new RobotTool(name, meshes, attachmentPlane, x, y, z, quat1, quat2, quat3, quat4); // Outputs DA.SetData(0, _robotTool); #region Object manager // Gets ObjectManager of this document _objectManager = DocumentManager.GetDocumentObjectManager(this.OnPingDocument()); // Clears toolNames _objectManager.ToolNames.Remove(_toolName); _toolName = String.Empty; // Removes lastName from toolNameList if (_objectManager.ToolNames.Contains(_lastName)) { _objectManager.ToolNames.Remove(_lastName); } // Adds Component to ToolsByGuid Dictionary if (!_objectManager.ToolsQuaternionByGuid.ContainsKey(this.InstanceGuid)) { _objectManager.ToolsQuaternionByGuid.Add(this.InstanceGuid, this); } // Checks if tool name is already in use and counts duplicates #region Check name in object manager if (_objectManager.ToolNames.Contains(_robotTool.Name)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Tool Name already in use."); _nameUnique = false; _lastName = ""; } else { // Adds Robot Tool Name to list _toolName = _robotTool.Name; _objectManager.ToolNames.Add(_robotTool.Name); // Run SolveInstance on other Tools with no unique Name to check if their name is now available _objectManager.UpdateRobotTools(); _lastName = _robotTool.Name; _nameUnique = true; } // Checks if variable name exceeds max character limit for RAPID Code if (HelperMethods.VariableExeedsCharacterLimit32(name)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Robot Tool Name exceeds character limit of 32 characters."); } // Checks if variable name starts with a number if (HelperMethods.VariableStartsWithNumber(name)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Robot Tool Name starts with a number which is not allowed in RAPID Code."); } #endregion // Recognizes if Component is Deleted and removes it from Object Managers tool and name list GH_Document doc = this.OnPingDocument(); if (doc != null) { doc.ObjectsDeleted += DocumentObjectsDeleted; } #endregion }
private static void Game_OnGameUpdate(EventArgs args) { ManaMenager(); PotionMenager(); if (Q.IsReady()) { var t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var qDmg = Q.GetDamage(t) * 1.9; if (Orbwalking.InAutoAttackRange(t)) { qDmg = qDmg + ObjectManager.Player.GetAutoAttackDamage(t) * 3; } if (qDmg > t.Health) { Q.Cast(t, true); } else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + QMANA) { CastSpell(Q, t, Config.Item("Hit").GetValue <Slider>().Value); } else if (((Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear")) && Config.Item("haras" + t.BaseSkinName).GetValue <bool>()) { if (ObjectManager.Player.Mana > RMANA + WMANA + QMANA + QMANA && t.Path.Count() > 1) { CastSpell(Q, t, Config.Item("Hit").GetValue <Slider>().Value); } else if (ObjectManager.Player.Mana > ObjectManager.Player.MaxMana * 0.9) { CastSpell(Q, t, Config.Item("Hit").GetValue <Slider>().Value); } else if (ObjectManager.Player.Mana > RMANA + WMANA + QMANA + QMANA) { Q.CastIfWillHit(t, 2, true); } } if (ObjectManager.Player.Mana > RMANA + QMANA + WMANA && Q.IsReady()) { foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(Q.Range))) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall")) { Q.Cast(enemy, true); } else { Q.CastIfHitchanceEquals(enemy, HitChance.Immobile, true); } } } } } if (R.IsReady() && Orbwalker.ActiveMode.ToString() == "Combo" && Config.Item("autoR").GetValue <bool>()) { var t = TargetSelector.GetTarget(800, TargetSelector.DamageType.Physical); if (ObjectManager.Player.CountEnemiesInRange(800f) > 2) { R.Cast(); } else if (t.IsValidTarget() && Orbwalker.GetTarget() == null && Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.GetAutoAttackDamage(t) * 2 > t.Health && !Q.IsReady() && t.CountEnemiesInRange(800) < 3) { R.Cast(); } } }
protected override async Task <bool> Killsteal() { if (await base.Killsteal()) { return(true); } if (MyHero.IsSilenced()) { return(false); } if (_ultAbility.CanBeCasted() && !IsEnemyNear()) { var hasAgha = MyHero.HasItem(ClassID.CDOTA_Item_UltimateScepter); if (hasAgha) { var critBonus = _ultAbility.GetAbilityData("scepter_crit_bonus"); // 280 var damage = critBonus / 100.0f * (MyHero.MinimumDamage + MyHero.BonusDamage); var enemy = ObjectManager.GetEntitiesParallel <Hero>() .FirstOrDefault( x => x.IsAlive && x.Team != MyHero.Team && !x.IsIllusion && _ultAbility.CanBeCasted(x) && _ultAbility.CanHit(x) && x.Health < damage * (1 - x.PhysicalResistance()) && !x.CantBeAttacked() && !x.CantBeKilled()); if (enemy != null) { Log.Debug( $"use killsteal agha ult because enough damage {enemy.Health} <= {damage * (1 - enemy.PhysicalResistance())} "); _ultAbility.UseAbility(enemy.NetworkPosition); await Await.Delay(GetAbilityDelay(enemy.NetworkPosition, _ultAbility)); return(true); } } else { var damage = (float)_ultAbility.GetDamage(_ultAbility.Level - 1); damage *= GetSpellAmp(); var enemy = ObjectManager.GetEntitiesParallel <Hero>() .FirstOrDefault( x => x.IsAlive && x.Team != MyHero.Team && !x.IsIllusion && _ultAbility.CanBeCasted(x) && _ultAbility.CanHit(x) && !x.IsMagicImmune() && !x.IsLinkensProtected() && x.Health < damage * (1 - x.MagicResistance()) && !x.CantBeAttacked() && !x.CantBeKilled()); if (enemy != null) { Log.Debug( $"use killsteal ult because enough damage {enemy.Health} <= {damage * (1 - enemy.MagicResistance())} "); _ultAbility.UseAbility(enemy); await Await.Delay(GetAbilityDelay(enemy, _ultAbility)); return(true); } } } return(false); }
/// <summary> /// Called when the game draws itself. /// </summary> /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param> private void Drawing_OnDraw(EventArgs args) { if (!Menu.Item("enable").GetValue <bool>()) { return; } foreach (var PlayingCharacter in ObjectManager.Get <Obj_AI_Hero>() .Where(pg => pg.IsValid && !pg.IsMe && pg.IsHPBarRendered && (pg.IsEnemy && Menu.Item("display.enemies").GetValue <bool>() || pg.IsAlly && Menu.Item("display.allies").GetValue <bool>()))) { for (int Spell = 0; Spell < SpellSlots.Count(); Spell++) { int X = (int)PlayingCharacter.HPBarPosition.X + 10 + (Spell * 25); int Y = (int)PlayingCharacter.HPBarPosition.Y + 35; var GetSpell = PlayingCharacter.Spellbook.GetSpell(SpellSlots[Spell]); var GetSpellCD = GetSpell.CooldownExpires - Game.Time; var SpellCDString = string.Format("{0:0}", GetSpellCD); DisplayTextFont.DrawText( null, GetSpellCD > 0 ? SpellCDString : SpellSlots[Spell].ToString(), X, Y, // Show Grey color if the spell is not learned. GetSpell.Level <1 ? SharpDX.Color.Gray : // Blue color if the target has not enough mana to use the spell. GetSpell.SData.ManaCostArray.MaxOrDefault((value) => value)> PlayingCharacter.Mana ? SharpDX.Color.Cyan : // Red color if the Spell CD is <= 4 (almost up), GetSpellCD > 0 && GetSpellCD <= 4 ? SharpDX.Color.Red : // Yellow color if the Spell is on CD, else show Green. GetSpellCD > 0 ? SharpDX.Color.Yellow : SharpDX.Color.LightGreen ); if (Menu.Item("display.spell_levels").GetValue <bool>()) { for (int DrawSpellLevel = 0; DrawSpellLevel <= GetSpell.Level - 1; DrawSpellLevel++) { int SpellLevelX = X + (DrawSpellLevel * 3) - 4; int SpellLevelY = Y; DisplayLevelFont.DrawText( null, ".", SpellLevelX, SpellLevelY, SharpDX.Color.White ); } } } for (int SummonerSpell = 0; SummonerSpell < SummonerSpellSlots.Count(); SummonerSpell++) { int SummonerSpellX = (int)PlayingCharacter.HPBarPosition.X + 10 + (SummonerSpell * 88); int SummonerSpellY = (int)PlayingCharacter.HPBarPosition.Y + 4; var GetSummonerSpell = PlayingCharacter.Spellbook.GetSpell(SummonerSpellSlots[SummonerSpell]); var GetSummonerSpellCD = GetSummonerSpell.CooldownExpires - Game.Time; var SummonerSpellCDString = string.Format("{0:0}", GetSummonerSpellCD); switch (GetSummonerSpell.Name.ToLower()) { case "summonerflash": GetSummonerSpellName = "Flash"; break; case "summonerdot": GetSummonerSpellName = "Ignite"; break; case "summonerheal": GetSummonerSpellName = "Heal"; break; case "summonerteleport": GetSummonerSpellName = "Teleport"; break; case "summonerexhaust": GetSummonerSpellName = "Exhaust"; break; case "summonerhaste": GetSummonerSpellName = "Ghost"; break; case "summonerbarrier": GetSummonerSpellName = "Barrier"; break; case "summonerboost": GetSummonerSpellName = "Cleanse"; break; case "summonermana": GetSummonerSpellName = "Clarity"; break; case "summonerclairvoyance": GetSummonerSpellName = "Clairvoyance"; break; case "summonerodingarrison": GetSummonerSpellName = "Garrison"; break; case "summonersnowball": GetSummonerSpellName = "Mark"; break; default: GetSummonerSpellName = "Smite"; break ; } DisplayTextFont.DrawText( null, GetSummonerSpellCD > 0 ? GetSummonerSpellName + ":" + SummonerSpellCDString : GetSummonerSpellName + ": UP ", SummonerSpellX, SummonerSpellY, GetSummonerSpellCD > 0 ? SharpDX.Color.Red : SharpDX.Color.Yellow ); } } }
static bool HandleCharacterRenameCommand(StringArguments args, CommandHandler handler) { Player target; ObjectGuid targetGuid; string targetName; if (!handler.extractPlayerTarget(args, out target, out targetGuid, out targetName)) { return(false); } string newNameStr = args.NextString(); if (!string.IsNullOrEmpty(newNameStr)) { string playerOldName; string newName = newNameStr; if (target) { // check online security if (handler.HasLowerSecurity(target, ObjectGuid.Empty)) { return(false); } playerOldName = target.GetName(); } else { // check offline security if (handler.HasLowerSecurity(null, targetGuid)) { return(false); } ObjectManager.GetPlayerNameByGUID(targetGuid, out playerOldName); } if (!ObjectManager.NormalizePlayerName(ref newName)) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } if (ObjectManager.CheckPlayerName(newName, target ? target.GetSession().GetSessionDbcLocale() : Global.WorldMgr.GetDefaultDbcLocale(), true) != ResponseCodes.CharNameSuccess) { handler.SendSysMessage(CypherStrings.BadValue); return(false); } WorldSession session = handler.GetSession(); if (session != null) { if (!session.HasPermission(RBACPermissions.SkipCheckCharacterCreationReservedname) && Global.ObjectMgr.IsReservedName(newName)) { handler.SendSysMessage(CypherStrings.ReservedName); return(false); } } PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); stmt.AddValue(0, newName); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { handler.SendSysMessage(CypherStrings.RenamePlayerAlreadyExists, newName); return(false); } // Remove declined name from db stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, targetGuid.GetCounter()); DB.Characters.Execute(stmt); if (target) { target.SetName(newName); session = target.GetSession(); if (session != null) { session.KickPlayer(); } } else { stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_NAME_BY_GUID); stmt.AddValue(0, newName); stmt.AddValue(1, targetGuid.GetCounter()); DB.Characters.Execute(stmt); } Global.WorldMgr.UpdateCharacterInfo(targetGuid, newName); handler.SendSysMessage(CypherStrings.RenamePlayerWithNewName, playerOldName, newName); Player player = handler.GetPlayer(); if (player) { Log.outCommand(session.GetAccountId(), "GM {0} (Account: {1}) forced rename {2} to player {3} (Account: {4})", player.GetName(), session.GetAccountId(), newName, playerOldName, ObjectManager.GetPlayerAccountIdByGUID(targetGuid)); } else { Log.outCommand(0, "CONSOLE forced rename '{0}' to '{1}' ({2})", playerOldName, newName, targetGuid.ToString()); } } else { if (target) { // check online security if (handler.HasLowerSecurity(target, ObjectGuid.Empty)) { return(false); } handler.SendSysMessage(CypherStrings.RenamePlayer, handler.GetNameLink(target)); target.SetAtLoginFlag(AtLoginFlags.Rename); } else { // check offline security if (handler.HasLowerSecurity(null, targetGuid)) { return(false); } string oldNameLink = handler.playerLink(targetName); handler.SendSysMessage(CypherStrings.RenamePlayerGuid, oldNameLink, targetGuid.ToString()); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, AtLoginFlags.Rename); stmt.AddValue(1, targetGuid.GetCounter()); DB.Characters.Execute(stmt); } } return(true); }
private static void OnDetectSkillshotProcessing(Skillshot skillshot) { try { var hero = (AIHeroClient)skillshot.Caster; //Check if the skillshot is already added. var alreadyAdded = false; if (!DrawHelper.damagePredEnabled(hero.ChampionName, skillshot.SkillshotData.Slot)) { return; } // Integration disabled foreach (var item in ActiveSkillshots) { if (item.SkillshotData.SpellName == skillshot.SkillshotData.SpellName && (item.Caster.NetworkId == skillshot.Caster.NetworkId && (skillshot.Direction).AngleBetween(item.Direction) < 5 && (skillshot.StartPosition.Distance(item.StartPosition) < 100 || skillshot.SkillshotData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Add the skillshot to the detected skillshot list. if (!alreadyAdded) { //Multiple skillshots like twisted fate Q. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SkillshotData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SkillshotData.MultipleNumber - 1) / 2; i <= (skillshot.SkillshotData.MultipleNumber - 1) / 2; i++) { var end = skillshot.StartPosition + skillshot.SkillshotData.Range * originalDirection.Rotated(skillshot.SkillshotData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SkillshotData, skillshot.StartTick, skillshot.StartPosition, end, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SkillshotData.SpellName == "UFSlash") { skillshot.SkillshotData.MissileSpeed = 1600 + (int)skillshot.Caster.MoveSpeed; } if (skillshot.SkillshotData.Invert) { var newDirection = -(skillshot.EndPosition - skillshot.StartPosition).Normalized(); var end = skillshot.StartPosition + newDirection * skillshot.StartPosition.Distance(skillshot.EndPosition); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SkillshotData, skillshot.StartTick, skillshot.StartPosition, end, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); return; } if (skillshot.SkillshotData.Centered) { var start = skillshot.StartPosition - skillshot.Direction * skillshot.SkillshotData.Range; var end = skillshot.StartPosition + skillshot.Direction * skillshot.SkillshotData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SkillshotData, skillshot.StartTick, start, end, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); return; } if (skillshot.SkillshotData.SpellName == "SyndraE" || skillshot.SkillshotData.SpellName == "syndrae5") { var angle = 60; var edge1 = (skillshot.EndPosition - skillshot.Caster.ServerPosition.To2D()).Rotated( -angle / 2 * (float)Math.PI / 180); var edge2 = edge1.Rotated(angle * (float)Math.PI / 180); foreach (var minion in ObjectManager.Get <Obj_AI_Minion>()) { var v = minion.ServerPosition.To2D() - skillshot.Caster.ServerPosition.To2D(); if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 && minion.Distance(skillshot.Caster) < 800 && (minion.Team != ObjectManager.Player.Team)) { var start = minion.ServerPosition.To2D(); var end = skillshot.Caster.ServerPosition.To2D() .Extend( minion.ServerPosition.To2D(), skillshot.Caster.Distance(minion) > 200 ? 1300 : 1000); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SkillshotData, skillshot.StartTick, start, end, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SkillshotData.SpellName == "AlZaharCalloftheVoid") { var start = skillshot.EndPosition - skillshot.Direction.Perpendicular() * 400; var end = skillshot.EndPosition + skillshot.Direction.Perpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SkillshotData, skillshot.StartTick, start, end, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); return; } if (skillshot.SkillshotData.SpellName == "ZiggsQ") { var d1 = skillshot.StartPosition.Distance(skillshot.EndPosition); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.EndPosition + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int) (skillshot.SkillshotData.Delay + d1 * 1000f / skillshot.SkillshotData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.EndPosition, bounce1Pos, skillshot.Caster); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Caster); ActiveSkillshots.Add(bounce1); ActiveSkillshots.Add(bounce2); } if (skillshot.SkillshotData.SpellName == "ZiggsR") { skillshot.SkillshotData.Delay = (int) (1500 + 1500 * skillshot.EndPosition.Distance(skillshot.StartPosition) / skillshot.SkillshotData.Range); } if (skillshot.SkillshotData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in ActiveSkillshots) { if (s.Caster.NetworkId == skillshot.Caster.NetworkId && s.SkillshotData.Slot == SpellSlot.E) { endPos = s.EndPosition; } } foreach (var m in ObjectManager.Get <Obj_AI_Minion>()) { if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Caster.Team && skillshot.IsDanger(m.Position.To2D())) { endPos = m.Position.To2D(); } } if (!endPos.IsValid()) { return; } skillshot.EndPosition = endPos + 200 * (endPos - skillshot.StartPosition).Normalized(); skillshot.Direction = (skillshot.EndPosition - skillshot.StartPosition).Normalized(); } } if (skillshot.SkillshotData.SpellName == "OriannasQ") { var endCSpellData = SpellDatabase.GetByName("OriannaQend"); var skillshotToAdd = new Skillshot( skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.StartPosition, skillshot.EndPosition, skillshot.Caster); ActiveSkillshots.Add(skillshotToAdd); } /* * //Dont allow fow detection. * if (skillshot.SkillshotData.DisableFowDetection && * skillshot.DetectionType == DetectionType.RecvPacket) * { * return; * }*/ ActiveSkillshots.Add(skillshot); } } catch (Exception e) { Console.WriteLine(e); } }
public override void GameOnUpdate(EventArgs args) { if (GetValue <KeyBind>("CastR").Active) { Vector3 searchPos; if (ObjectManager.Player.Distance(Game.CursorPos) < R.Range - 300f) { searchPos = Game.CursorPos; } else { searchPos = ObjectManager.Player.Position + Vector3.Normalize(Game.CursorPos - ObjectManager.Player.Position) * (R.Range - 300f); } var rTarget = ObjectManager.Get <Obj_AI_Hero>() .Where(hero => hero.IsValidTarget(R.Range) && hero.Distance(searchPos) < 300f) .OrderByDescending(TargetSelector.GetPriority) .First(); if (rTarget != null && R.IsReady()) { R.Cast(rTarget); } } if (GetValue <KeyBind>("UseQ2C").Active) { ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); CastSpellQ(); } Obj_AI_Hero t; if (E.IsReady() && GetValue <KeyBind>("UseETH").Active) { if (ObjectManager.Player.HasBuff("Recall")) { return; } t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); if (t != null) { E.Cast(t, false, true); } } if (!ComboActive && !HarassActive) { return; } var useQ = GetValue <StringList>("UseQ" + (ComboActive ? "C" : "H")); var useE = GetValue <bool>("UseE" + (ComboActive ? "C" : "H")); var useR = GetValue <bool>("UseRC"); t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget(Q.Range) && t.Health <= CalcQDamage + CalcWDamage) { CastSpellQ(); } switch (useQ.SelectedIndex) { case 1: { CastSpellQ(); break; } case 2: { if (EnemyWStackCount(t) > 2 || W.Level == 0) { CastSpellQ(); } break; } } if (useE && E.IsReady()) { t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget(E.Range)) { E.Cast(t, false, true); } } if (useR && R.IsReady()) { t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget(R.Range) && t.Health <= ObjectManager.Player.GetSpellDamage(t, SpellSlot.R) - 30f) { R.Cast(t); } } }
/// <summary> /// Gets triggered when a unit casts a spell and the unit is visible. /// </summary> private static void HeroOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (args.SData.Name == "dravenrdoublecast") { ActiveSkillshots.RemoveAll( s => s.Caster.NetworkId == sender.NetworkId && s.SkillshotData.SpellName == "DravenRCast"); } if (!sender.IsValid <AIHeroClient>()) { return; // only valid hero } var spellData = SpellDatabase.GetByName(args.SData.Name); if (spellData == null) { return; // only if database contains skillshot } var startPos = new Vector2(); if (spellData.FromObject != "") { foreach (var obj in ObjectManager.Get <GameObject>()) { if (obj.Name.Contains(spellData.FromObject)) { startPos = obj.Position.To2D(); } } } else { startPos = sender.ServerPosition.To2D(); } //For now only zed support. if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in ObjectManager.Get <GameObject>().Where(o => o.IsEnemy)) { if (spellData.FromObjects.Contains(obj.Name)) { var start = obj.Position.To2D(); var end = start + spellData.Range * (args.End.To2D() - obj.Position.To2D()).Normalized(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, System.Environment.TickCount - Game.Ping / 2, start, end, sender); } } } if (!startPos.IsValid()) { return; } var endPos = args.End.To2D(); //Calculate the real end Point: var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos = endPos + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } //Trigger the skillshot detection callbacks. TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, System.Environment.TickCount - Game.Ping / 2, startPos, endPos, sender); }
public void Combo() { Active = Game.IsKeyDown(menu.Item("keyBind").GetValue <KeyBind>().Key); Q = me.Spellbook.SpellQ; W = me.Spellbook.SpellW; R = me.Spellbook.SpellR; mom = me.FindItem("item_mask_of_madness"); glimmer = me.FindItem("item_glimmer_cape"); manta = me.FindItem("item_manta"); pipe = me.FindItem("item_pipe"); guardian = me.FindItem("item_guardian_greaves") ?? me.FindItem("item_mekansm"); sphere = me.FindItem("item_sphere"); dagon = me.Inventory.Items.FirstOrDefault(x => x.Name.Contains("item_dagon")); ethereal = me.FindItem("item_ethereal_blade"); halberd = me.FindItem("item_heavens_halberd"); mjollnir = me.FindItem("item_mjollnir"); orchid = me.FindItem("item_orchid") ?? me.FindItem("item_bloodthorn"); abyssal = me.FindItem("item_abyssal_blade"); mail = me.FindItem("item_blade_mail"); bkb = me.FindItem("item_black_king_bar"); satanic = me.FindItem("item_satanic"); medall = me.FindItem("item_medallion_of_courage") ?? me.FindItem("item_solar_crest"); Shiva = me.FindItem("item_shivas_guard"); var v = ObjectManager.GetEntities <Hero>() .Where(x => x.Team != me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion) .ToList(); e = me.ClosestToMouseTarget(1800); if (e == null) { return; } if (Active && me.Distance2D(e) <= 1400 && e.IsAlive && !me.IsInvisible()) { if ( me.Distance2D(e) <= me.AttackRange + 100 && (!me.IsAttackImmune() || !e.IsAttackImmune()) && me.NetworkActivity != NetworkActivity.Attack && me.CanAttack() && Utils.SleepCheck("attack") ) { me.Attack(e); Utils.Sleep(150, "attack"); } else if ( (!me.CanAttack() || me.Distance2D(e) >= 0) && me.NetworkActivity != NetworkActivity.Attack && me.Distance2D(e) <= 600 && Utils.SleepCheck("Move") ) { me.Move(e.Predict(300)); Utils.Sleep(390, "Move"); } if ( // MOM mom != null && mom.CanBeCasted() && me.CanCast() && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mom.Name) && Utils.SleepCheck("mom") && me.Distance2D(e) <= 700 ) { mom.UseAbility(); Utils.Sleep(250, "mom"); } if ( // Mjollnir mjollnir != null && mjollnir.CanBeCasted() && me.CanCast() && !e.IsMagicImmune() && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mjollnir.Name) && Utils.SleepCheck("mjollnir") && me.Distance2D(e) <= 900 ) { mjollnir.UseAbility(me); Utils.Sleep(250, "mjollnir"); } // Mjollnir Item end if ( // Medall medall != null && medall.CanBeCasted() && Utils.SleepCheck("Medall") && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(medall.Name) && me.Distance2D(e) <= 700 ) { medall.UseAbility(e); Utils.Sleep(250, "Medall"); } // Medall Item end if (orchid != null && orchid.CanBeCasted() && me.Distance2D(e) <= 900 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(orchid.Name) && Utils.SleepCheck("orchid")) { orchid.UseAbility(e); Utils.Sleep(100, "orchid"); } if (Shiva != null && Shiva.CanBeCasted() && me.Distance2D(e) <= 600 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(Shiva.Name) && !e.IsMagicImmune() && Utils.SleepCheck("Shiva")) { Shiva.UseAbility(); Utils.Sleep(100, "Shiva"); } if (ethereal != null && ethereal.CanBeCasted() && me.Distance2D(e) <= 700 && me.Distance2D(e) <= 400 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(ethereal.Name) && Utils.SleepCheck("ethereal")) { ethereal.UseAbility(e); Utils.Sleep(100, "ethereal"); } if (dagon != null && dagon.CanBeCasted() && me.Distance2D(e) <= 700 && Utils.SleepCheck("dagon")) { dagon.UseAbility(e); Utils.Sleep(100, "dagon"); } if ( // Abyssal Blade abyssal != null && abyssal.CanBeCasted() && me.CanCast() && !e.IsStunned() && !e.IsHexed() && Utils.SleepCheck("abyssal") && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(abyssal.Name) && me.Distance2D(e) <= 400 ) { abyssal.UseAbility(e); Utils.Sleep(250, "abyssal"); } // Abyssal Item end if (urn != null && urn.CanBeCasted() && urn.CurrentCharges > 0 && me.Distance2D(e) <= 400 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(urn.Name) && Utils.SleepCheck("urn")) { urn.UseAbility(e); Utils.Sleep(240, "urn"); } if ( // Hellbard halberd != null && halberd.CanBeCasted() && me.CanCast() && !e.IsMagicImmune() && (e.NetworkActivity == NetworkActivity.Attack || e.NetworkActivity == NetworkActivity.Crit || e.NetworkActivity == NetworkActivity.Attack2) && Utils.SleepCheck("halberd") && me.Distance2D(e) <= 700 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(halberd.Name) ) { halberd.UseAbility(e); Utils.Sleep(250, "halberd"); } if ( // Satanic satanic != null && me.Health <= (me.MaximumHealth * 0.3) && satanic.CanBeCasted() && me.Distance2D(e) <= me.AttackRange + 50 && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(satanic.Name) && Utils.SleepCheck("satanic") ) { satanic.UseAbility(); Utils.Sleep(240, "satanic"); } // Satanic Item end if (mail != null && mail.CanBeCasted() && (v.Count(x => x.Distance2D(me) <= 650) >= (menu.Item("Heelm").GetValue <Slider>().Value)) && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(mail.Name) && Utils.SleepCheck("mail")) { mail.UseAbility(); Utils.Sleep(100, "mail"); } if (bkb != null && bkb.CanBeCasted() && (v.Count(x => x.Distance2D(me) <= 650) >= (menu.Item("Heel").GetValue <Slider>().Value)) && menu.Item("Items").GetValue <AbilityToggler>().IsEnabled(bkb.Name) && Utils.SleepCheck("bkb")) { bkb.UseAbility(); Utils.Sleep(100, "bkb"); } var Ally = ObjectManager.GetEntities <Hero>() .Where(x => x.Team == me.Team && x.IsAlive && x.IsVisible && !x.IsIllusion).ToList(); var countAlly = Ally.Count(); var countV = v.Count(); for (int i = 0; i < countAlly; ++i) { if ( Q != null && Q.CanBeCasted() && !me.IsMagicImmune() && me.Health <= (me.MaximumHealth * 0.6) && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(Q.Name) && Utils.SleepCheck("Q") ) { Q.UseAbility(me); Utils.Sleep(200, "Q"); } if ( Q != null && Q.CanBeCasted() && me.Distance2D(e) <= 255 && !me.IsMagicImmune() && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(Q.Name) && Utils.SleepCheck("Q") ) { Q.UseAbility(me); Utils.Sleep(200, "Q"); } if ( W != null && W.CanBeCasted() && me.Distance2D(e) <= 400 && !Q.CanBeCasted() && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(W.Name) && Utils.SleepCheck("W") ) { W.UseAbility(me); Utils.Sleep(200, "W"); } for (int z = 0; z < countV; ++z) { if ( Q != null && Q.CanBeCasted() && me.Distance2D(Ally[i]) <= Q.CastRange + 50 && !Ally[i].IsMagicImmune() && Ally[i].Health <= (Ally[i].MaximumHealth * 0.6) && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(Q.Name) && Utils.SleepCheck("Q") ) { Q.UseAbility(Ally[i]); Utils.Sleep(200, "Q"); } else if ( W != null && W.CanBeCasted() && !Q.CanBeCasted() && me.Distance2D(Ally[i]) <= W.CastRange + 50 && Ally[i].Health <= (Ally[i].MaximumHealth * 0.6) && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(W.Name) && Utils.SleepCheck("Wq") ) { W.UseAbility(Ally[i]); Utils.Sleep(200, "Wq"); } if ( W != null && W.CanBeCasted() && me.Distance2D(Ally[i]) <= W.CastRange + 50 && !Ally[i].IsMagicImmune() && ((Ally[i].Distance2D(v[z]) <= Ally[i].AttackRange + Ally[i].HullRadius + 10) || (Ally[i].Distance2D(v[z]) <= v[i].AttackRange + Ally[i].HullRadius + 10)) && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(W.Name) && Utils.SleepCheck("Ww") ) { W.UseAbility(Ally[i]); Utils.Sleep(200, "Ww"); } if ( Q != null && Q.CanBeCasted() && me.Distance2D(Ally[i]) <= Q.CastRange + 50 && !Ally[i].IsMagicImmune() && Ally[i].Distance2D(v[z]) <= 250 + Ally[i].HullRadius - 10 && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(Q.Name) && Utils.SleepCheck("Q") ) { Q.UseAbility(Ally[i]); Utils.Sleep(200, "Q"); } if ( R != null && R.CanBeCasted() && me.Distance2D(Ally[i]) <= R.CastRange + 50 && (v.Count(x => x.Distance2D(me) <= R.CastRange) >= (menu.Item("UltCountTarget").GetValue <Slider>().Value)) && (Ally.Count(x => x.Distance2D(me) <= R.CastRange) >= (menu.Item("UltCountAlly").GetValue <Slider>().Value)) && Ally[i].Health <= (Ally[i].MaximumHealth / 100 * (menu.Item("HealhUlt").GetValue <Slider>().Value)) && menu.Item("Skills").GetValue <AbilityToggler>().IsEnabled(R.Name) && Utils.SleepCheck("R") ) { R.UseAbility(); Utils.Sleep(200, "R"); } if ( guardian != null && guardian.CanBeCasted() && me.Distance2D(Ally[i]) <= guardian.CastRange && (v.Count(x => x.Distance2D(me) <= guardian.CastRange) >= (menu.Item("healsetTarget").GetValue <Slider>().Value)) && (Ally.Count(x => x.Distance2D(me) <= guardian.CastRange) >= (menu.Item("healsetAlly").GetValue <Slider>().Value)) && Ally[i].Health <= (Ally[i].MaximumHealth / 100 * (menu.Item("HealhHeal").GetValue <Slider>().Value)) && menu.Item("ItemsS").GetValue <AbilityToggler>().IsEnabled(guardian.Name) && Utils.SleepCheck("guardian") ) { guardian.UseAbility(); Utils.Sleep(200, "guardian"); } if ( pipe != null && pipe.CanBeCasted() && me.Distance2D(Ally[i]) <= pipe.CastRange && (v.Count(x => x.Distance2D(me) <= pipe.CastRange) >= (menu.Item("pipesetTarget").GetValue <Slider>().Value)) && (Ally.Count(x => x.Distance2D(me) <= pipe.CastRange) >= (menu.Item("pipesetAlly").GetValue <Slider>().Value)) && menu.Item("ItemsS").GetValue <AbilityToggler>().IsEnabled(pipe.Name) && Utils.SleepCheck("pipe") ) { pipe.UseAbility(); Utils.Sleep(200, "pipe"); } if ( sphere != null && sphere.CanBeCasted() && me.Distance2D(Ally[i]) <= sphere.CastRange + 50 && !Ally[i].IsMagicImmune() && ((Ally[i].Distance2D(v[z]) <= Ally[i].AttackRange + Ally[i].HullRadius + 10) || (Ally[i].Distance2D(v[z]) <= v[i].AttackRange + Ally[i].HullRadius + 10) || Ally[i].Health <= (me.MaximumHealth * 0.5)) && menu.Item("ItemsS").GetValue <AbilityToggler>().IsEnabled(sphere.Name) && Utils.SleepCheck("sphere") ) { sphere.UseAbility(Ally[i]); Utils.Sleep(200, "sphere"); } if ( glimmer != null && glimmer.CanBeCasted() && me.Distance2D(Ally[i]) <= glimmer.CastRange + 50 && Ally[i].Health <= (me.MaximumHealth * 0.5) && menu.Item("ItemsS").GetValue <AbilityToggler>().IsEnabled(glimmer.Name) && Utils.SleepCheck("glimmer") ) { glimmer.UseAbility(Ally[i]); Utils.Sleep(200, "glimmer"); } if ( manta != null && manta.CanBeCasted() && (me.Distance2D(v[z]) <= me.AttackRange + me.HullRadius + 10) || (me.Distance2D(v[z]) <= v[i].AttackRange + me.HullRadius + 10) && menu.Item("ItemsS").GetValue <AbilityToggler>().IsEnabled(manta.Name) && Utils.SleepCheck("manta") ) { manta.UseAbility(); Utils.Sleep(200, "manta"); } } } } }
protected override async Task <bool> Killsteal() { if (await base.Killsteal()) { return(true); } if (MyHero.IsSilenced()) { return(false); } float _qAutoDamage = this._qAbility.GetAbilityData("static_remnant_damage") + this._eAbility.GetDamage(_eAbility.Level - 1); _qAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage); _qAutoDamage *= GetSpellAmp(); float _eAutoDamage = this._eAbility.GetDamage(_eAbility.Level - 1); _eAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage); _eAutoDamage *= GetSpellAmp(); var qAutokillableTar = ObjectManager.GetEntitiesParallel <Hero>() .FirstOrDefault( x => x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion && this._qAbility.CanBeCasted() && this._qAbility.CanHit(x) && x.Health < (_qAutoDamage * (1 - x.MagicResistance())) && !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() && x.Distance2D(this.MyHero) <= 235); var AutokillableTar = ObjectManager.GetEntitiesParallel <Hero>() .FirstOrDefault( x => x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion && x.Health < _eAutoDamage * (1 - x.MagicResistance()) && !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() && x.Distance2D(this.MyHero) <= 480); if (this.MyHero.HasModifier("modifier_storm_spirit_overload") && AutokillableTar != null) { MyHero.Attack(AutokillableTar); Await.Block("zaioAutoAttack", StormAuto); } if (this._qAbility.IsKillstealAbilityEnabled() && this._qAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload")) { if (AutokillableTar != null && _qAbility.CanBeCasted()) { Log.Debug($"Killing with auto {MyHero.HasModifier("modifier_storm_spirit_overload")}"); _qAbility.UseAbility(); await Await.Delay(300); MyHero.Attack(AutokillableTar); Await.Block("zaioAutoAttack", StormAuto); } if (qAutokillableTar != null && _qAbility.CanBeCasted()) { Log.Debug($"Killing with q and auto"); _qAbility.UseAbility(); await Await.Delay(300); MyHero.Attack(qAutokillableTar); Await.Block("zaioAutoAttack", StormAuto); } } if (this._ultAbility.IsKillstealAbilityEnabled() && this._ultAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload")) { if (AutokillableTar != null && _ultAbility.CanBeCasted() && !_qAbility.CanBeCasted()) { var moves = C**k.InFront(AutokillableTar, 100); Log.Debug($"Killable with auto, q not available"); _ultAbility.UseAbility(moves); await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(moves)) * 2500 + Game.Ping)); MyHero.Attack(AutokillableTar); Await.Block("zaioAutoAttack", StormAuto); } } return(false); }
public override void Game_OnGameUpdate(EventArgs args) { if (R1.IsReady() && GetValue <bool>("UseRM")) { var bigRocket = HasBigRocket(); foreach ( var hero in ObjectManager.Get <Obj_AI_Hero>() .Where( hero => hero.IsValidTarget(bigRocket ? R2.Range : R1.Range) && R1.GetDamage(hero) * (bigRocket ? 1.5f : 1f) > hero.Health)) { if (bigRocket) { R2.Cast(hero, false, true); } else { R1.Cast(hero, false, true); } } } if ((!ComboActive && !HarassActive) || !Orbwalking.CanMove(100)) { return; } var useQ = GetValue <bool>("UseQ" + (ComboActive ? "C" : "H")); var useE = GetValue <bool>("UseE" + (ComboActive ? "C" : "H")); var useR = GetValue <bool>("UseR" + (ComboActive ? "C" : "H")); var rLim = GetValue <Slider>("Rlim" + (ComboActive ? "C" : "H")).Value; if (useQ && Q.IsReady()) { var t = SimpleTs.GetTarget(Q.Range, SimpleTs.DamageType.Physical); if (t != null) { if (Q.Cast(t, false, true) == Spell.CastStates.SuccessfullyCasted) { return; } } } if (useE && E.IsReady()) { var t = SimpleTs.GetTarget(E.Range, SimpleTs.DamageType.Physical); if (t != null) { if (E.Cast(t, false, true) == Spell.CastStates.SuccessfullyCasted) { return; } } } if (useR && R1.IsReady() && ObjectManager.Player.Spellbook.GetSpell(SpellSlot.R).Ammo > rLim) { var bigRocket = HasBigRocket(); var t = SimpleTs.GetTarget(bigRocket ? R2.Range : R1.Range, SimpleTs.DamageType.Physical); if (t != null) { if (bigRocket) { R2.Cast(t, false, true); } else { R1.Cast(t, false, true); } } } }
public static Composite CreateMageFrostInstancePullAndCombat() { return(new PrioritySelector( Safers.EnsureTarget(), Movement.CreateMoveToLosBehavior(), Movement.CreateFaceTargetBehavior(), Helpers.Common.CreateAutoAttack(true), Spell.WaitForCast(true), // We want our pet alive ! new Decorator( ret => !StyxWoW.Me.GotAlivePet && PetManager.PetTimer.IsFinished && SpellManager.CanCast("Summon Water Elemental"), new Sequence( new Action(ret => PetManager.CallPet("Summon Water Elemental")), Helpers.Common.CreateWaitForLagDuration())), // Defensive stuff new Decorator( ret => StyxWoW.Me.ActiveAuras.ContainsKey("Ice Block"), new ActionIdle()), Spell.BuffSelf("Ice Block", ret => StyxWoW.Me.HealthPercent < 20 && !StyxWoW.Me.ActiveAuras.ContainsKey("Hypothermia")), // Cooldowns Spell.BuffSelf("Evocation", ret => StyxWoW.Me.ManaPercent < 30), Spell.BuffSelf("Mirror Image"), Spell.BuffSelf("Mage Ward", ret => StyxWoW.Me.HealthPercent <= 75), Spell.BuffSelf("Icy Veins"), Common.CreateUseManaGemBehavior(ret => StyxWoW.Me.ManaPercent < 80), // AoE comes first new Decorator( ret => Unit.UnfriendlyUnitsNearTarget(10f).Count() >= 3, new PrioritySelector( Spell.CastOnGround("Flamestrike", ret => Clusters.GetBestUnitForCluster(Unit.NearbyUnitsInCombatWithMe, ClusterType.Radius, 8f).Location, ret => !ObjectManager.GetObjectsOfType <WoWDynamicObject>().Any(o => o.CasterGuid == StyxWoW.Me.Guid && o.Spell.Name == "Flamestrike" && o.Location.Distance( Clusters.GetBestUnitForCluster(Unit.NearbyUnitsInCombatWithMe, ClusterType.Radius, 8f).Location) < o.Radius)), Spell.Cast("Cone of Cold", ret => Clusters.GetClusterCount(StyxWoW.Me, Unit.NearbyUnfriendlyUnits, ClusterType.Cone, 15f) >= 3), Spell.CastOnGround("Blizzard", ret => StyxWoW.Me.CurrentTarget.Location), Spell.Cast("Arcane Explosion", ret => Clusters.GetClusterCount(StyxWoW.Me, Unit.NearbyUnfriendlyUnits, ClusterType.Radius, 10f) >= 3), Movement.CreateMoveToTargetBehavior(true, 35f) )), Spell.BuffSelf("Time Warp", ret => !StyxWoW.Me.GroupInfo.IsInRaid && StyxWoW.Me.CurrentTarget.HealthPercent > 20 && StyxWoW.Me.CurrentTarget.IsBoss() && !StyxWoW.Me.HasAura("Temporal Displacement")), // Rotation Spell.Cast("Frost Bomb", ret => Unit.UnfriendlyUnitsNearTarget(10f).Count() >= 3), Spell.Cast("Deep Freeze", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Fingers of Frost") || StyxWoW.Me.CurrentTarget.HasAura("Freeze") || StyxWoW.Me.CurrentTarget.HasAura("Frost Nova")), Pet.CreateCastPetActionOnLocation("Freeze"), Spell.Cast("Arcane Missiles", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Arcane Missiles!")), new Decorator( ret => StyxWoW.Me.ActiveAuras.ContainsKey("Brain Freeze"), new PrioritySelector( Spell.Cast("Frostfire Bolt"), Spell.Cast("Fireball") )), Spell.Cast("Ice Lance", ret => StyxWoW.Me.ActiveAuras.ContainsKey("Fingers of Frost") || StyxWoW.Me.CurrentTarget.HasAura("Freeze") || StyxWoW.Me.CurrentTarget.HasAura("Frost Nova") || StyxWoW.Me.IsMoving), Spell.Cast("Frostbolt", ret => !StyxWoW.Me.CurrentTarget.IsImmune(WoWSpellSchool.Frost)), Spell.Cast("Frostfire Bolt"), Movement.CreateMoveToTargetBehavior(true, 39f) )); }
private static void Drawing_OnEndScene(EventArgs args) { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } try { if (Sprite.IsDisposed) { return; } foreach (var hero in ObjectManager.Get <Obj_AI_Hero>() .Where( hero => hero != null && hero.IsValid && (!hero.IsMe || Config.Item("TrackMe").GetValue <bool>()) && hero.IsHPBarRendered && (hero.IsEnemy && Config.Item("TrackEnemies").GetValue <bool>() || hero.IsAlly && Config.Item("TrackAllies").GetValue <bool>()))) { Sprite.Begin(); var indicator = new HpBarIndicator { Unit = hero }; X = (int)indicator.Position.X; Y = (int)indicator.Position.Y; var k = 0; foreach (var sSlot in SummonerSpellSlots) { var spell = hero.Spellbook.GetSpell(sSlot); Texture texture; if (SummonerTextures.ContainsKey(spell.Name)) { texture = SummonerTextures[spell.Name]; } else if (SmiteNames.Contains(spell.Name)) { texture = SummonerTextures["SummonerSmite"]; } else { texture = SummonerTextures["SummonerBarrier"]; } var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; var ts = TimeSpan.FromSeconds((int)t); var s = t > 60 ? string.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds) : String.Format("{0:0}", t); if (t > 0) { Text.DrawText( null, s, X - 5 - s.Length * 5, Y + 1 + 13 * k, new ColorBGRA(255, 255, 255, 255)); } Sprite.Draw( texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 12 * n, 12, 12), new Vector3(-X - 3, -Y - 1 - 13 * k, 0)); k++; } Sprite.Draw(CdFrameTexture, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-X, -Y, 0)); Sprite.End(); var startX = X + 19; var startY = Y + 20; ReadyLine.Begin(); foreach (var slot in SpellSlots) { var spell = hero.Spellbook.GetSpell(slot); var t = spell.CooldownExpires - Game.Time; var percent = (t > 0 && Math.Abs(spell.Cooldown) > float.Epsilon) ? 1f - (t / spell.Cooldown) : 1f; if (t > 0 && t < 100) { var s = string.Format(t < 1f ? "{0:0.0}" : "{0:0}", t); Text.DrawText( null, s, startX + (23 - s.Length * 4) / 2, startY + 6, new ColorBGRA(255, 255, 255, 255)); } var darkColor = (t > 0) ? new ColorBGRA(168, 98, 0, 255) : new ColorBGRA(0, 130, 15, 255); var lightColor = (t > 0) ? new ColorBGRA(235, 137, 0, 255) : new ColorBGRA(0, 168, 25, 255); if (hero.Spellbook.CanUseSpell(slot) != SpellState.NotLearned) { for (var i = 0; i < 2; i++) { ReadyLine.Draw( new[] { new Vector2(startX, startY + i * 2), new Vector2(startX + percent * 23, startY + i * 2) }, i == 0 ? lightColor : darkColor); } } startX = startX + 27; } ReadyLine.End(); } } catch (Exception e) { Console.WriteLine(@"/ff can't draw sprites: " + e); } }
/// <summary> /// Returns the safe targets to cast escape spells. /// </summary> public static List <Obj_AI_Base> GetEvadeTargets(SpellValidTargets[] validTargets, int speed, int delay, float range, bool isBlink = false, bool onlyGood = false, bool DontCheckForSafety = false) { var badTargets = new List <Obj_AI_Base>(); var goodTargets = new List <Obj_AI_Base>(); var allTargets = new List <Obj_AI_Base>(); foreach (var targetType in validTargets) { switch (targetType) { case SpellValidTargets.AllyChampions: foreach (var ally in ObjectManager.Get <AIHeroClient>()) { if (ally.IsValidTarget(range, false) && !ally.IsMe && ally.IsAlly) { allTargets.Add(ally); } } break; case SpellValidTargets.AllyMinions: allTargets.AddRange( MinionManager.GetMinions( ObjectManager.Player.Position, range, MinionTypes.All, MinionTeam.Ally)); break; case SpellValidTargets.AllyWards: foreach (var gameObject in ObjectManager.Get <Obj_AI_Minion>()) { if (gameObject.Name.ToLower().Contains("ward") && gameObject.IsValidTarget(range, false) && gameObject.Team == ObjectManager.Player.Team) { allTargets.Add(gameObject); } } break; case SpellValidTargets.EnemyChampions: foreach (var enemy in ObjectManager.Get <AIHeroClient>()) { if (enemy.IsValidTarget(range)) { allTargets.Add(enemy); } } break; case SpellValidTargets.EnemyMinions: allTargets.AddRange( MinionManager.GetMinions( ObjectManager.Player.Position, range, MinionTypes.All, MinionTeam.NotAlly)); break; case SpellValidTargets.EnemyWards: foreach (var gameObject in ObjectManager.Get <Obj_AI_Minion>()) { if (gameObject.Name.ToLower().Contains("ward") && gameObject.IsValidTarget(range)) { allTargets.Add(gameObject); } } break; } } foreach (var target in allTargets) { if (DontCheckForSafety || Program.IsSafe(target.ServerPosition.To2D()).IsSafe) { if (isBlink) { if (Utils.TickCount - Program.LastWardJumpAttempt < 250 || Program.IsSafeToBlink(target.ServerPosition.To2D(), Config.EvadingFirstTimeOffset, delay)) { goodTargets.Add(target); } if (Utils.TickCount - Program.LastWardJumpAttempt < 250 || Program.IsSafeToBlink(target.ServerPosition.To2D(), Config.EvadingSecondTimeOffset, delay)) { badTargets.Add(target); } } else { var pathToTarget = new List <Vector2>(); pathToTarget.Add(Program.PlayerPosition); pathToTarget.Add(target.ServerPosition.To2D()); if (Utils.TickCount - Program.LastWardJumpAttempt < 250 || Program.IsSafePath(pathToTarget, Config.EvadingFirstTimeOffset, speed, delay).IsSafe) { goodTargets.Add(target); } if (Utils.TickCount - Program.LastWardJumpAttempt < 250 || Program.IsSafePath(pathToTarget, Config.EvadingSecondTimeOffset, speed, delay).IsSafe) { badTargets.Add(target); } } } } return((goodTargets.Count > 0) ? goodTargets : (onlyGood ? new List <Obj_AI_Base>() : badTargets)); }
private static void OnDetectSkillshot(Skillshot skillshot) { //Check if the skillshot is already added. var alreadyAdded = false; if (Config.Menu.Item("DisableFow").GetValue <bool>() && !skillshot.Unit.IsVisible) { return; } foreach (var item in DetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Unit.NetworkId == skillshot.Unit.NetworkId && (skillshot.Direction).AngleBetween(item.Direction) < 5 && (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Unit.Team == ObjectManager.Player.Team && !Config.TestOnAllies) { return; } //Check if the skillshot is too far away. if (skillshot.Start.Distance(PlayerPosition) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded || skillshot.SpellData.DontCheckForDuplicates) { //Multiple skillshots like twisted fate Q. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).Normalized(); var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { int angle = 60; Vector2 edge1 = (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated( -angle / 2 * (float)Math.PI / 180); var edge2 = edge1.Rotated(angle * (float)Math.PI / 180); foreach (var minion in ObjectManager.Get <Obj_AI_Minion>()) { var v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D(); if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 && minion.Distance(skillshot.Unit) < 800 && (minion.Team != ObjectManager.Player.Team || Config.TestOnAllies)) { var start = minion.ServerPosition.To2D(); var end = skillshot.Unit.ServerPosition.To2D() .Extend( minion.ServerPosition.To2D(), skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { var start = skillshot.End - skillshot.Direction.Perpendicular() * 400; var end = skillshot.End + skillshot.Direction.Perpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "DianaArc") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.Distance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit); DetectedSkillshots.Add(bounce1); DetectedSkillshots.Add(bounce2); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in DetectedSkillshots) { if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(s.End)) { endPos = s.End; } break; } } foreach (var m in ObjectManager.Get <Obj_AI_Minion>()) { if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(m.Position.To2D())) { endPos = m.Position.To2D(); } break; } } if (endPos.IsValid()) { skillshot = new Skillshot(DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Utils.TickCount, skillshot.Start, endPos, skillshot.Unit); skillshot.End = endPos + 200 * (endPos - skillshot.Start).Normalized(); skillshot.Direction = (skillshot.End - skillshot.Start).Normalized(); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } //Dont allow fow detection. if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } #if DEBUG Console.WriteLine(Utils.TickCount + "Adding new skillshot: " + skillshot.SpellData.SpellName); #endif DetectedSkillshots.Add(skillshot); } }
public static Vector2 GetCollisionPoint(Skillshot skillshot) { var collisions = new List <DetectedCollision>(); var from = skillshot.GetMissilePosition(0); skillshot.ForceDisabled = false; foreach (var cObject in skillshot.SkillshotData.CollisionObjects) { switch (cObject) { case CollisionObjectTypes.Minion: foreach (var minion in MinionManager.GetMinions( from.To3D(), 1200, MinionTypes.All, skillshot.Caster.Team == ObjectManager.Player.Team ? MinionTeam.NotAlly : MinionTeam.NotAllyForEnemy)) { var pred = FastPrediction( from, minion, Math.Max( 0, skillshot.SkillshotData.Delay - (System.Environment.TickCount - skillshot.StartTick)), skillshot.SkillshotData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SkillshotData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) - pos.Distance(from, skillshot.EndPosition, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.EndPosition, skillshot.StartPosition).LinePoint + skillshot.Direction * 30, Unit = minion, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.Champions: foreach (var hero in ObjectManager.Get <AIHeroClient>() .Where( h => (h.IsValidTarget(1200, false) && h.Team == ObjectManager.Player.Team && !h.IsMe || h.Team != ObjectManager.Player.Team))) { var pred = FastPrediction( from, hero, Math.Max( 0, skillshot.SkillshotData.Delay - (System.Environment.TickCount - skillshot.StartTick)), skillshot.SkillshotData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SkillshotData.RawRadius + 30 - pos.Distance(from, skillshot.EndPosition, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.EndPosition, skillshot.StartPosition).LinePoint + skillshot.Direction * 30, Unit = hero, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.YasuoWall: if ( !ObjectManager.Get <AIHeroClient>() .Any( hero => hero.IsValidTarget(float.MaxValue, false) && hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo")) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get <GameObject>()) { if (gameObject.IsValid && Regex.IsMatch(gameObject.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase)) { wall = gameObject; } } if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new SkillshotGeometry.Rectangle(wallStart, wallEnd, 75).ToPolygon(); var intersection = new Vector2(); var intersections = new List <Vector2>(); for (var i = 0; i < wallPolygon.Points.Count; i++) { var inter = wallPolygon.Points[i].Intersection( wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from, skillshot.EndPosition); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0]; var collisionT = System.Environment.TickCount + Math.Max( 0, skillshot.SkillshotData.Delay - (System.Environment.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(from)) / skillshot.SkillshotData.MissileSpeed; if (collisionT - _wallCastT < 4000) { if (skillshot.SkillshotData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return(intersection); } } break; } } Vector2 result; if (collisions.Count > 0) { result = collisions.OrderBy(c => c.Distance).ToList()[0].Position; } else { result = new Vector2(); } return(result); }
public override void Pulse() { try { ObjectManager.Update(); #region Plugin deactivated if ... if (Rarekiller.ToonInvalid) { return; } if (Battlegrounds.IsInsideBattleground || Me.IsInInstance) { return; } #endregion #region Init if (!hasItBeenInitialized) { Initialize(); hasItBeenInitialized = true; } #endregion #region Timer if (Settings.Keyer && !Checktimer.IsRunning && !Me.IsMoving) { Checktimer.Start(); } if (Settings.Keyer && Checktimer.IsRunning && Me.IsMoving) { Checktimer.Reset(); } if (Settings.Shadowmeld && !Shadowmeldtimer.IsRunning && !Me.IsMoving && !Me.HasAura("Shadowmeld")) { Shadowmeldtimer.Start(); } if (Settings.Shadowmeld && Shadowmeldtimer.IsRunning && Me.IsMoving) { Shadowmeldtimer.Reset(); } // Developer Thing (ToDo Remove) if (!DumpAuraTimer.IsRunning && Rarekiller.Settings.MoPRaresDeveloper) { DumpAuraTimer.Reset(); DumpAuraTimer.Start(); } #endregion #region Slowfall if (Me.IsFalling && Settings.UseSlowfall && !FallTimer.IsRunning) { FallTimer.Start(); } if (!Me.IsFalling && Settings.UseSlowfall && FallTimer.IsRunning) { FallTimer.Reset(); } if (Me.IsFalling && Settings.UseSlowfall && FallTimer.ElapsedMilliseconds > Convert.ToInt32(Rarekiller.Settings.Falltimer)) { FallTimer.Reset(); Slowfall.HelpFalling(); } //if (Me.IsFalling && Settings.UseSlowfall) //{ // Thread.Sleep(Convert.ToInt32(Rarekiller.Settings.Falltimer)); // if (Me.IsFalling && !Me.IsDead && !Me.IsGhost) // Slowfall.HelpFalling(); //} #endregion #region Aeonaxx Function if (Settings.Aeonaxx && (AeonaxxCatcher.AeonaxxFriendly != null || AeonaxxCatcher.AeonaxxHostile != null || AeonaxxCatcher.youngStoneDrake != null)) { AeonaxxCatcher.catchAeonaxx(); return; } #endregion if (!Me.Combat) { #region Pulse Camel Figurine and NPC Interactor if (Camel.InteractableNPC != null) { Camel.findAndInteractNPC(Camel.InteractableNPC); } // --> Dormus' Rage = 93269 if (Me.HasAura(93269) || Camel.Dormus != null) { Camel.findAndKillDormus(); } #endregion #region Pulse Object Interactor if (Collector.InteractableObject != null) { Collector.findAndPickupObject(Collector.InteractableObject); } #endregion #region Pulse Tamer if ((Me.Class == WoWClass.Hunter || Rarekiller.Settings.TestcaseTamer) && Tamer.tameablePet != null) { if (Me.HealthPercent > 30) { Tamer.findAndTameMob(Tamer.tameablePet); } } if ((Me.Class == WoWClass.Hunter && Rarekiller.Settings.Footprints) || Rarekiller.Settings.TestcaseTamer) { Tamer.findandfollowFootsteps(); } #endregion #region Pulse Rarekiller if (Killer.killableEnemy != null) { Killer.findAndKillMob(Killer.killableEnemy); } #endregion #region Pulse Security if (Settings.Keyer && !Me.IsMoving) { if (Checktimer.Elapsed.TotalSeconds > MoveTimer) { Checktimer.Reset(); MoveTimer = rnd.Next(360, 540); Security.Movearound(); } } if (Settings.Shadowmeld && !Me.IsMoving) { if (Shadowmeldtimer.Elapsed.TotalSeconds > 5) { Shadowmeldtimer.Reset(); if (SpellManager.HasSpell("Shadowmeld") && SpellManager.CanCast("Shadowmeld") && !Me.HasAura("Shadowmeld")) { bool SpellSuccess = RarekillerSpells.CastSafe("Shadowmeld", Me, false); //bool SpellSuccess = SpellManager.Cast("Shadowmeld"); Logging.Write(Colors.MediumPurple, "Rarekiller: Shadowmeld activated - {0}", SpellSuccess); } } } #endregion } else // In Combat with MoPRares / Dormus { #region Hozen - working - but needs some luck if (MoPRares.Hozen != null) { // Bananarang if (MoPRares.Hozen.CastingSpellId == 125311) { MoPRares.AvoidEnemyCast(MoPRares.Hozen, 0, 50); } // Going Bananas else if (MoPRares.Hozen.CastingSpellId == 125363) { while (MoPRares.Hozen.CastingSpellId == 125363 && MoPRares.Hozen.Location.Distance(Me.Location) > 5) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.Hozen.Location); } else { Navigator.MoveTo(MoPRares.Hozen.Location); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } } } } #endregion #region Mogu Sorcerer - working if (MoPRares.MoguSorcerer != null) { //Voidcloud if (Me.HasAura("Voidcloud") && MoPRares.getVoidcloudList != null) { if (MoPRares.getVoidcloudList[0].Distance < (MoPRares.getVoidcloudList[0].Radius * 1.6f)) { MoPRares.AvoidEnemyAOE(MoPRares.MoguSorcerer, "Voidcloud", 10, MoPRares.getVoidcloudList, 10, 3); } } } #endregion #region Saurok - working if (MoPRares.Saurok != null) { if (MoPRares.Saurok.Combat && MoPRares.Saurok.Location.Distance(Me.Location) > 15) { while (MoPRares.Saurok.Location.Distance(Me.Location) > 5) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.Saurok.Location); } else { Navigator.MoveTo(MoPRares.Saurok.Location); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } } } if (Me.CurrentTarget != null && Me.CurrentTarget != MoPRares.Saurok && !MoPRares.Saurok.IsDead) { MoPRares.Saurok.Target(); } } #endregion #region Jinyu - working - but needs some luck if (MoPRares.Jinyu != null) { // Rain Dance if (MoPRares.Jinyu.CastingSpellId == 124860 && SpellManager.CanCast(Spells.Stun)) { RarekillerSpells.CastSafe(Spells.Stun, MoPRares.Jinyu, false); Logging.Write(Colors.MediumPurple, "Rarekiller: * {0}. - Stun", Spells.Stun); } else if (MoPRares.Jinyu.CastingSpellId == 124860) { MoPRares.AvoidEnemyMissiles(MoPRares.Jinyu, 0, 7, true, 10, 5); Logging.Write(Colors.MediumPurple, "Rarekiller: Avoid Missiles"); } // Torrent - interrupt else if (MoPRares.Jinyu.CastingSpellId == 124935 && SpellManager.CanCast(Spells.Interrupt)) { RarekillerSpells.CastSafe(Spells.Interrupt, MoPRares.Jinyu, false); Logging.Write(Colors.MediumPurple, "Rarekiller: * {0}. - Interrupt", Spells.Interrupt); } } #endregion #region Mogu Warrior - working if (MoPRares.MoguWarrior != null) { while (MoPRares.MoguWarrior.Distance2D <= 15 && MoPRares.MoguWarrior.IsCasting && MoPRares.MoguWarrior.CastingSpellId == 124946 && !Me.IsSafelyBehind(MoPRares.MoguWarrior)) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.getLocationBehindUnit(MoPRares.MoguWarrior)); } else { Navigator.MoveTo(MoPRares.getLocationBehindUnit(MoPRares.MoguWarrior)); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } } } #endregion #region Mantid - working but Index Fehler if (MoPRares.Mantid != null) { // Blade Flurry while (MoPRares.Mantid.Location.Distance(Me.Location) <= 20 && MoPRares.Mantid.IsCasting && MoPRares.Mantid.CastingSpellId == 125370 && !Me.IsSafelyBehind(MoPRares.Mantid)) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.getLocationBehindUnit(MoPRares.Mantid)); } else { Navigator.MoveTo(MoPRares.getLocationBehindUnit(MoPRares.Mantid)); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } } // Tornados if (MoPRares.getTornadoList != null) { if (MoPRares.getTornadoList[0].Distance < 7) { MoPRares.AvoidEnemyAOE(MoPRares.Mantid, 27, MoPRares.getTornadoList, 10, 5); } } } #endregion #region Pandaren - don't work good if (MoPRares.Pandaren != null) { // Spinning Crane Kick if (MoPRares.Pandaren.CastingSpellId == 125799 && SpellManager.CanCast(Spells.Stun)) { RarekillerSpells.CastSafe(Spells.Stun, MoPRares.Pandaren, false); Logging.Write(Colors.MediumPurple, "Rarekiller: * {0}. - Stun", Spells.Stun); } else if (MoPRares.Pandaren.CastingSpellId == 125799 && MoPRares.Pandaren.Location.Distance(Me.Location) < 25) { WoWMovement.Move(WoWMovement.MovementDirection.Backwards); MoPRares.FleeingFromEnemy(MoPRares.Pandaren, 125799, 40, 10, 5); } // Healing Mists else if (MoPRares.Pandaren.CastingSpellId == 125802 && SpellManager.CanCast(Spells.Interrupt)) { RarekillerSpells.CastSafe(Spells.Interrupt, MoPRares.Pandaren, false); Logging.Write(Colors.MediumPurple, "Rarekiller: * {0}. - Interrupt", Spells.Interrupt); } // Chi Burst else if (MoPRares.Pandaren.Combat && MoPRares.Pandaren.Location.Distance(Me.Location) > 15) { Logging.Write(Colors.MediumPurple, "Rarekiller: Run to Pandaren because of Chistoß"); while (MoPRares.Pandaren.Location.Distance(Me.Location) > 5) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.Pandaren.Location); } else { Navigator.MoveTo(MoPRares.Pandaren.Location); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } // Healing Mists else if (MoPRares.Pandaren.CastingSpellId == 125802 && SpellManager.CanCast(Spells.Interrupt) && MoPRares.Pandaren.Location.Distance(Me.Location) < 30) { RarekillerSpells.CastSafe(Spells.Interrupt, MoPRares.Pandaren, false); Logging.Write(Colors.MediumPurple, "Rarekiller: * {0}. - Interrupt", Spells.Interrupt); } } WoWMovement.MoveStop(); } } #endregion #region Yaungol - working if (MoPRares.Yaungol != null) { // Yaungol Stomp if (MoPRares.Yaungol.CastingSpellId == 124289 && MoPRares.Yaungol.Location.Distance(Me.Location) < 15) { MoPRares.FleeingFromEnemy(MoPRares.Yaungol, 124289, 17, 10, 5); } // Bellowing Rage else if (MoPRares.Yaungol.HasAura("Bellowing Rage") && MoPRares.Yaungol.Location.Distance(Me.Location) < 25) { MoPRares.FleeingFromEnemy(MoPRares.Yaungol, 0, 30, 10, 5); } // Rushing Charge else if (MoPRares.Yaungol.Combat && Me.Location.Distance(MoPRares.Yaungol.Location) > 20) { while (Me.Location.Distance(MoPRares.Yaungol.Location) > 10) { if (Me.IsSwimming) { WoWMovement.ClickToMove(MoPRares.Yaungol.Location); } else { Navigator.MoveTo(MoPRares.Yaungol.Location); } Thread.Sleep(80); if (Rarekiller.ToonInvalid) { return; } } } } #endregion #region Dormus Avoid Spit - working if (Camel.Dormus != null) { // Developer Thing (ToDo Remove) if (DumpAuraTimer.Elapsed.TotalSeconds > 5 && Rarekiller.Settings.MoPRaresDeveloper) { DumpAuraTimer.Reset(); MoPRares.DumpAOEEffect(); } //94967 = Aura Spit if (Me.HasAura(94967)) { Camel.AvoidSpit(Camel.Dormus); } //if (Me.HasAura(94967) && Camel.getSpitList != null && Camel.getSpitList[0].Distance < (Camel.getSpitList[0].Radius * 1.6f)) // MoPRares.AvoidEnemyAOE(Camel.Dormus, 0, 2, 20, Camel.getSpitList, 15, 3); } #endregion } } catch (ThreadAbortException) { } catch (Exception e) { Logging.WriteDiagnostic(Colors.Red, e.Message); } }
internal static void AtoB(this Spell spell, Obj_AI_Base T, float Drag = 700f) //Coded By RL244 AtoB Drag 기본값 700f는 빅토르를 위한 것임. { if (T != null) { var TH = T as Obj_AI_Hero; var TM = T as Obj_AI_Minion; if (TH != null) { var TH2 = HeroManager.Enemies.Where(x => x != TH && AIO_Func.CanHit(spell, x, Drag)).FirstOrDefault(); var THdelay = (Player.Distance(TH.ServerPosition) > spell.Range ? (Player.Distance(TH.ServerPosition) - spell.Range) / spell.Speed : 100f / spell.Speed); var pred = Prediction.GetPrediction(TH, THdelay + spell.Delay); var TH2delay = (TH2 != null ? (Player.Distance(TH.ServerPosition) > spell.Range ? (Player.Distance(TH2.ServerPosition) - spell.Range) / spell.Speed : TH2.ServerPosition.Distance(TH.ServerPosition) / spell.Speed) : 0f); var TH2pred = (TH2 != null ? Prediction.GetPrediction(TH2, TH2delay + spell.Delay) : null); SharpDX.Vector2 castVec = (pred.UnitPosition.To2D() + TH.ServerPosition.To2D()) / 2; SharpDX.Vector2 castVec2 = Player.ServerPosition.To2D() + SharpDX.Vector2.Normalize(pred.UnitPosition.To2D() - Player.Position.To2D()) * (spell.Range); SharpDX.Vector2 castVec3 = TH.ServerPosition.To2D() - SharpDX.Vector2.Normalize(pred.UnitPosition.To2D() - Player.Position.To2D()) * (100f); SharpDX.Vector2 EditedVec = pred.UnitPosition.To2D() - SharpDX.Vector2.Normalize(pred.UnitPosition.To2D() - TH.ServerPosition.To2D()) * (spell.Width * 2 / 5); SharpDX.Vector2 EditedCV2Vec = Player.ServerPosition.To2D() + SharpDX.Vector2.Normalize(EditedVec - Player.Position.To2D()) * (spell.Range); if (pred.Hitchance >= AIO_Menu.Champion.Misc.SelectedHitchance) { if (TH.Distance(Player.ServerPosition) >= spell.Range) { if (AIO_Func.CanHit(spell, TH, Drag) && (pred.UnitPosition.Distance(TH.ServerPosition) <= spell.Width / 2 || TH.MoveSpeed * THdelay <= spell.Width / 2)) //if(AIO_Func.CanHit(spell,TH,Drag) && TH2 != null && TH2pred.Hitchance >= AIO_Menu.Champion.Misc.SelectedHitchance)//별로 좋은 생각이 더 안나고 피곤해서 걍관둠. { spell.Cast(EditedCV2Vec, TH.ServerPosition.To2D()); //별로 좋은 생각이 더 안나고 피곤해서 걍관둠. } else if (AIO_Func.CanHit(spell, TH, Drag) && pred.UnitPosition.Distance(TH.ServerPosition) < 350) { if (pred.UnitPosition.Distance(Player.ServerPosition) > spell.Range) { spell.Cast(castVec2, EditedVec);//pred.UnitPosition.To2D()); } } } else { if (TH2 == null || !AIO_Func.CanHit(spell, TH2, Drag)) { if (castVec3.Distance(Player.ServerPosition) < TH.ServerPosition.Distance(Player.ServerPosition)) { spell.Cast(castVec3, TH.ServerPosition.To2D()); } else { spell.Cast(TH.ServerPosition.To2D(), castVec3); } } else if (TH2 != null && AIO_Func.CanHit(spell, TH2, Drag) && TH2pred.Hitchance >= AIO_Menu.Champion.Misc.SelectedHitchance) { SharpDX.Vector2 castVec4 = TH.ServerPosition.To2D() - SharpDX.Vector2.Normalize(TH2pred.UnitPosition.To2D() - TH.ServerPosition.To2D()) * (80f); if (castVec4.Distance(Player.ServerPosition) < TH2pred.UnitPosition.Distance(Player.ServerPosition)) { spell.Cast(castVec4, TH2pred.UnitPosition.To2D()); } else { spell.Cast(TH2pred.UnitPosition.To2D(), castVec4); } } } } } if (TM != null) { var Minions = ObjectManager.Get <Obj_AI_Minion>().Where(m => m.IsValidTarget(spell.Range + Drag) && m.Team != ObjectManager.Player.Team).Cast <Obj_AI_Base>().ToList(); if (Minions.Count > 0) { //으.... //MinionManager.GetMinions(spell.Range+Drag, MinionTypes.All, MinionTeam.NotAlly); var FM = Minions.OrderBy(o => o.Distance(Player.ServerPosition)).FirstOrDefault().ServerPosition; var FFM = Minions.OrderBy(o => o.Distance(Player.ServerPosition)).Reverse().FirstOrDefault().ServerPosition; var P = MinionManager.GetMinionsPredictedPositions(Minions, spell.Delay, spell.Width, spell.Speed, FM, Drag, true, SkillshotType.SkillshotLine); var PP = MinionManager.GetBestLineFarmLocation(P, spell.Width, spell.Range + Drag); if (FM != null && FM.Distance(Player.ServerPosition) <= spell.Range) // && PP.MinionsHit >= Math.Min(Minions.Count,6)) //spell.Cast(FM.To2D(),PP.Position); { spell.Cast(FM.To2D(), FFM.To2D()); } } } } if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear) { var Minions = ObjectManager.Get <Obj_AI_Minion>().Where(m => m.IsValidTarget(spell.Range + Drag) && m.Team != ObjectManager.Player.Team).Cast <Obj_AI_Base>().ToList(); if (Minions.Count > 0) { //MinionManager.GetMinions(spell.Range+Drag, MinionTypes.All, MinionTeam.NotAlly); var FM = Minions.OrderBy(o => o.Distance(Player.ServerPosition)).FirstOrDefault().ServerPosition; var FFM = Minions.OrderBy(o => o.Distance(Player.ServerPosition)).Reverse().FirstOrDefault().ServerPosition; var P = MinionManager.GetMinionsPredictedPositions(Minions, spell.Delay, spell.Width, spell.Speed, FM, Drag, true, SkillshotType.SkillshotLine); var PP = MinionManager.GetBestLineFarmLocation(P, spell.Width, spell.Range + Drag); if (FM != null && FM.Distance(Player.ServerPosition) <= spell.Range)// && PP.MinionsHit >= Math.Min(Minions.Count,6)) //spell.Cast(FM.To2D(),PP.Position); { spell.Cast(FM.To2D(), FFM.To2D()); } } } }
public override void Game_OnGameUpdate(EventArgs args) { if (Q.IsReady()) { var activeQ = ObjectManager.Player.Spellbook.GetSpell(SpellSlot.Q).Level *25 + 650; var t = TargetSelector.GetTarget(activeQ, TargetSelector.DamageType.Physical); if (t.IsValidTarget() && ObjectManager.Player.Distance(t) > Orbwalking.GetRealAutoAttackRange(null) + 65) { if (!FishBoneActive) { Q.Cast(); Orbwalker.ForceTarget(t); return; } } if (!t.IsValidTarget() || ObjectManager.Player.Distance(t) < Orbwalking.GetRealAutoAttackRange(null) + 65) { if (FishBoneActive) { Q.Cast(); return; } } } var autoEi = GetValue <bool>("AutoEI"); var autoEs = GetValue <bool>("AutoES"); var autoEd = GetValue <bool>("AutoED"); if (autoEs || autoEi || autoEd) { foreach ( var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(E.Range - 150))) { if (autoEs && E.IsReady() && enemy.HasBuffOfType(BuffType.Slow)) { var castPosition = Prediction.GetPrediction( new PredictionInput { Unit = enemy, Delay = 0.7f, Radius = 120f, Speed = 1750f, Range = 900f, Type = SkillshotType.SkillshotCircle, }).CastPosition; if (GetSlowEndTime(enemy) >= (Game.Time + E.Delay + 0.5f)) { E.Cast(castPosition); } } if (autoEi && E.IsReady() && (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuff("zhonyasringshield") || enemy.HasBuff("Recall"))) { E.CastIfHitchanceEquals(enemy, HitChance.High); } if (autoEd && E.IsReady() && enemy.IsDashing()) { E.CastIfHitchanceEquals(enemy, HitChance.Dashing); } } } if (GetValue <KeyBind>("CastR").Active&& R.IsReady()) { var t = TargetSelector.GetTarget(1500, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { if (ObjectManager.Player.GetSpellDamage(t, SpellSlot.R) > t.Health) { //R.Cast(target); R.CastIfHitchanceEquals(t, HitChance.High, false); } } } /* * if (GetValue<bool>("SwapQ") && FishBoneActive && * (LaneClearActive || * (HarassActive && TargetSelector.GetTarget(675f + QAddRange, TargetSelector.DamageType.Physical) == null))) * { * Q.Cast(); * } */ if ((!ComboActive && !HarassActive) || !Orbwalking.CanMove(100)) { return; } var useQ = GetValue <bool>("UseQ" + (ComboActive ? "C" : "H")); var useW = GetValue <bool>("UseW" + (ComboActive ? "C" : "H")); var useR = GetValue <bool>("UseRC"); if (useW && W.IsReady()) { var t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical); var minW = GetValue <Slider>("MinWRange").Value; if (t.IsValidTarget() && GetRealDistance(t) >= minW) { if (W.Cast(t) == Spell.CastStates.SuccessfullyCasted) { return; } } } /* * if (useQ) * { * foreach (var t in * ObjectManager.Get<Obj_AI_Hero>() * .Where(t => t.IsValidTarget(GetRealPowPowRange(t) + QAddRange + 20f))) * { * var swapDistance = GetValue<bool>("SwapDistance"); * var swapAoe = GetValue<bool>("SwapAOE"); * var distance = GetRealDistance(t); * var powPowRange = GetRealPowPowRange(t); * * if (swapDistance && Q.IsReady()) * { * if (distance > powPowRange && !FishBoneActive) * { * if (Q.Cast()) * { * return; * } * } * else if (distance < powPowRange && FishBoneActive) * { * if (Q.Cast()) * { * return; * } * } * } * * if (swapAoe && Q.IsReady()) * { * if (distance > powPowRange && PowPowStacks > 2 && !FishBoneActive && CountEnemies(t, 150) > 1) * { * if (Q.Cast()) * { * return; * } * } * } * } * } * */ if (useR && R.IsReady()) { var checkRok = GetValue <bool>("ROverKill"); var minR = GetValue <Slider>("MinRRange").Value; var maxR = GetValue <Slider>("MaxRRange").Value; var t = TargetSelector.GetTarget(maxR, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var distance = GetRealDistance(t); if (!checkRok) { if (ObjectManager.Player.GetSpellDamage(t, SpellSlot.R, 1) > t.Health) { R.CastIfHitchanceEquals(t, HitChance.High, false); //if (R.Cast(t) == Spell.CastStates.SuccessfullyCasted) { } } } else if (distance > minR) { var aDamage = ObjectManager.Player.GetAutoAttackDamage(t); var wDamage = ObjectManager.Player.GetSpellDamage(t, SpellSlot.W); var rDamage = ObjectManager.Player.GetSpellDamage(t, SpellSlot.R); var powPowRange = GetRealPowPowRange(t); if (distance < (powPowRange + QAddRange) && !(aDamage * 3.5 > t.Health)) { if (!W.IsReady() || !(wDamage > t.Health) || W.GetPrediction(t).CollisionObjects.Count > 0) { if (CountAlliesNearTarget(t, 500) <= 3) { if (rDamage > t.Health /*&& !ObjectManager.Player.IsAutoAttacking && * !ObjectManager.Player.IsChanneling*/) { R.CastIfHitchanceEquals(t, HitChance.High, false); //if (R.Cast(t) == Spell.CastStates.SuccessfullyCasted) { } } } } } else if (distance > (powPowRange + QAddRange)) { if (!W.IsReady() || !(wDamage > t.Health) || distance > W.Range || W.GetPrediction(t).CollisionObjects.Count > 0) { if (CountAlliesNearTarget(t, 500) <= 3) { if (rDamage > t.Health /*&& !ObjectManager.Player.IsAutoAttacking && * !ObjectManager.Player.IsChanneling*/) { R.CastIfHitchanceEquals(t, HitChance.High, false); //if (R.Cast(t) == Spell.CastStates.SuccessfullyCasted) { } } } } } } } } }
public static void EnglishMenu() { comboMenu = config.AddSubMenu("Combo Settings", "Combo Settings"); comboMenu.Add("q.combo.style", new ComboBox("(Q) Combo Style", 1, "Cursor", "100% Hit", "Safe Position")); comboMenu.Add("q.combo", new CheckBox("Use (Q)")); comboMenu.Add("w.combo", new CheckBox("Use (W)")); comboMenu.Add("e.combo", new CheckBox("Use (E)")); eMenu = config.AddSubMenu("(E) Settings", "(E) Settings"); eMenu.AddGroupLabel("(E) Whitelist"); foreach (var enemy in ObjectManager.Get <AIHeroClient>().Where(o => o.IsEnemy)) { eMenu.Add("enemy." + enemy.CharData.BaseSkinName, new CheckBox(string.Format("E: {0}", enemy.CharData.BaseSkinName), Program.HighChamps.Contains(enemy.CharData.BaseSkinName))); } harassMenu = config.AddSubMenu("Harass Settings", "Harass Settings"); harassMenu.Add("q.harass", new CheckBox("Use Q")); harassMenu.Add("w.harass", new CheckBox("Use W")); harassMenu.Add("e.harass", new CheckBox("Use E")); harassMenu.Add("harass.mana", new Slider("Mana Manager", 20, 1, 99)); laneClearMenu = config.AddSubMenu("Clear Settings", "Clear Settings"); laneClearMenu.Add("q.clear", new CheckBox("Use Q")); laneClearMenu.Add("q.minion.count", new Slider("Q Minion Count", 4, 1, 5)); laneClearMenu.Add("clear.mana", new Slider("Mana Manager", 20, 1, 99)); jungleClearMenu = config.AddSubMenu("Jungle Settings", "Jungle Settings"); jungleClearMenu.Add("q.jungle", new CheckBox("Use Q")); jungleClearMenu.Add("w.jungle", new CheckBox("Use W")); jungleClearMenu.Add("e.jungle", new CheckBox("Use E")); jungleClearMenu.Add("jungle.mana", new Slider("Mana Manager", 20, 1, 99)); ksMenu = config.AddSubMenu("KillSteal Settings", "KillSteal Settings"); ksMenu.Add("q.ks", new CheckBox("Use Q")); ksMenu.Add("q.ks.count", new Slider("Basic Attack Count", 2, 1, 5)); miscMenu = config.AddSubMenu("Miscellaneous", "Miscellaneous"); miscMenu.Add("q.antigapcloser", new CheckBox("Anti-Gapcloser Q!")); miscMenu.AddSeparator(); miscMenu.AddGroupLabel("Anti Rengar"); miscMenu.Add("anti.rengar", new CheckBox("Anti Rengar!")); miscMenu.Add("hp.percent.for.rengar", new Slider("Min. HP Percent", 30, 1, 99)); miscMenu.AddSeparator(); miscMenu.AddGroupLabel("Spell Breaker"); miscMenu.Add("spell.broker", new CheckBox("Spell Breaker!")); miscMenu.Add("katarina.r", new CheckBox("Katarina (R)")); miscMenu.Add("missfortune.r", new CheckBox("Miss Fortune (R)")); miscMenu.Add("lucian.r", new CheckBox("Lucian (R)")); miscMenu.Add("hp.percent.for.broke", new Slider("Min. HP Percent", 20, 1, 99)); miscMenu.AddSeparator(); miscMenu.AddGroupLabel("(R) Protector"); miscMenu.Add("protector", new CheckBox("Disable Protector?")); foreach (var enemy in ObjectManager.Get <AIHeroClient>().Where(o => o.IsEnemy)) { foreach (var skillshot in SpellDatabase.Spells.Where(x => x.charName == enemy.ChampionName)) { miscMenu.Add("hero." + skillshot.spellName, new CheckBox("" + skillshot.charName + "(" + skillshot.spellKey + ")")); } } miscMenu.AddSeparator(); miscMenu.AddGroupLabel("Misc"); miscMenu.Add("e.method", new ComboBox("E Method", 0, "Cursor Position")); miscMenu.Add("use.r", new CheckBox("Use R")); miscMenu.AddSeparator(); miscMenu.AddGroupLabel("R Whitelist"); foreach (var ally in ObjectManager.Get <AIHeroClient>().Where(o => o.IsAlly)) { miscMenu.Add("respite." + ally.CharData.BaseSkinName, new CheckBox(string.Format("Ult: {0}", ally.CharData.BaseSkinName), Program.HighChamps.Contains(ally.CharData.BaseSkinName))); } miscMenu.Add("min.hp.for.r", new Slider("Min. HP Percent for R", 20, 1, 99)); drawMenu = config.AddSubMenu("Draw Settings", "Draw Settings"); drawMenu.Add("aa.indicator", new CheckBox("AA Indicator")); drawMenu.Add("q.drawx", new CheckBox("Q Range")); drawMenu.Add("w.draw", new CheckBox("W Range")); drawMenu.Add("e.draw", new CheckBox("E Range")); drawMenu.Add("r.draw", new CheckBox("R Range")); }
private static void OnDetectSkillshot(Skillshot skillshot) { var alreadyAdded = false; foreach (Skillshot item in EvadeDetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Caster.NetworkId == skillshot.Caster.NetworkId && (skillshot.Direction).AngleBetween(item.Direction) < 5 && (skillshot.Start.LSDistance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Caster.Team == ObjectManager.Player.Team) { return; } //Check if the skillshot is too far away. if (skillshot.Start.LSDistance(ObjectManager.Player.ServerPosition.LSTo2D()) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded) { //Multiple skillshots like twisted fate _spells[Spells.Q]. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Caster.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).Normalized(); var end = skillshot.Start + newDirection * skillshot.Start.LSDistance(skillshot.End); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { const int angle = 60; const int fraction = -angle / 2; var edge1 = (skillshot.End - skillshot.Caster.ServerPosition.LSTo2D()).Rotated( fraction * (float)Math.PI / 180); var edge2 = edge1.Rotated(angle * (float)Math.PI / 180); foreach (var minion in ObjectManager.Get<Obj_AI_Minion>()) { var v = minion.ServerPosition.LSTo2D() - skillshot.Caster.ServerPosition.LSTo2D(); if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 && minion.LSDistance(skillshot.Caster) < 800 && (minion.Team != ObjectManager.Player.Team)) { var start = minion.ServerPosition.LSTo2D(); var end = skillshot.Caster.ServerPosition.LSTo2D() .LSExtend( minion.ServerPosition.LSTo2D(), skillshot.Caster.LSDistance(minion) > 200 ? 1300 : 1000); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { var start = skillshot.End - skillshot.Direction.Perpendicular() * 400; var end = skillshot.End + skillshot.Direction.Perpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.LSDistance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = Evade.SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = Evade.SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Caster); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Caster); EvadeDetectedSkillshots.Add(bounce1); EvadeDetectedSkillshots.Add(bounce2); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.LSDistance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in EvadeDetectedSkillshots) { if (s.Caster.NetworkId == skillshot.Caster.NetworkId && s.SpellData.Slot == SpellSlot.E) { endPos = s.End; } } foreach (var m in ObjectManager.Get<Obj_AI_Minion>()) { if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Caster.Team && skillshot.IsDanger(m.Position.LSTo2D())) { endPos = m.Position.LSTo2D(); } } if (!endPos.IsValid()) { return; } skillshot.End = endPos + 200 * (endPos - skillshot.Start).Normalized(); skillshot.Direction = (skillshot.End - skillshot.Start).Normalized(); } } if (skillshot.SpellData.SpellName == "OriannasQ") { var endCSpellData = Evade.SpellDatabase.GetByName("OriannaQend"); var skillshotToAdd = new Skillshot( skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Caster); EvadeDetectedSkillshots.Add(skillshotToAdd); } //Dont allow fow detection. if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } EvadeDetectedSkillshots.Add(skillshot); } }
public static int HostileUnitsInRange(float range) { int hostileUnitsInRange = ObjectManager.GetUnitAttackPlayer().Count(u => u.GetDistance <= range); return(hostileUnitsInRange); }
public static void Game_OnGameLoad() { Player = ObjectManager.Player; if (Player.CharData.BaseSkinName != ChampionName) return; //Create the spells Q = new LeagueSharp.Common.Spell(SpellSlot.Q, 790); W = new LeagueSharp.Common.Spell(SpellSlot.W, 925); E = new LeagueSharp.Common.Spell(SpellSlot.E, 700); R = new LeagueSharp.Common.Spell(SpellSlot.R, 675); Eq = new LeagueSharp.Common.Spell(SpellSlot.Q, Q.Range + 500); IgniteSlot = Player.GetSpellSlot("SummonerDot"); Q.SetSkillshot(0.6f, 125f, float.MaxValue, false, SkillshotType.SkillshotCircle); W.SetSkillshot(0.25f, 140f, 1600f, false, SkillshotType.SkillshotCircle); E.SetSkillshot(0.25f, (float)(45 * 0.5), 2500f, false, SkillshotType.SkillshotCircle); Eq.SetSkillshot(float.MaxValue, 55f, 2000f, false, SkillshotType.SkillshotCircle); SpellList.Add(Q); SpellList.Add(W); SpellList.Add(E); SpellList.Add(R); //Create the menu Config = MainMenu.AddMenu(ChampionName, ChampionName); menuKeys = Config.AddSubMenu("Keys", "Keys"); { menuKeys.Add("Key.HarassT", new KeyBind("Harass (toggle)!", false, KeyBind.BindTypes.PressToggle, 'Y')); menuKeys.Add("Key.InstantQE", new KeyBind("Instant Q-E to Enemy", false, KeyBind.BindTypes.HoldActive, 'T')); } menuCombo = Config.AddSubMenu("Combo", "Combo"); { menuCombo.Add("UseQCombo", new CheckBox("Use Q")); menuCombo.Add("UseWCombo", new CheckBox("Use W")); menuCombo.Add("UseECombo", new CheckBox("Use E")); menuCombo.Add("UseQECombo", new CheckBox("Use QE")); menuCombo.Add("UseRCombo", new CheckBox("Use R")); menuCombo.Add("UseIgniteCombo", new CheckBox("Use Ignite")); } menuHarass = Config.AddSubMenu("Harass", "Harass"); { menuHarass.Add("UseQHarass", new CheckBox("Use Q")); menuHarass.Add("UseWHarass", new CheckBox("Use W", false)); menuHarass.Add("UseEHarass", new CheckBox("Use E", false)); menuHarass.Add("UseQEHarass", new CheckBox("Use QE", false)); menuHarass.Add("Harass.Mana", new Slider("Don't harass if mana < %", 0)); } menuFarm = Config.AddSubMenu("Lane Farm", "Farm"); { menuFarm.Add("EnabledFarm", new CheckBox("Enable! (On/Off: Mouse Scroll)")); menuFarm.Add("UseQFarm", new ComboBox("Use Q", 2, "Last Hit", "LaneClear", "Both", "No")); menuFarm.Add("UseWFarm", new ComboBox("Use W", 1, "Last Hit", "LaneClear", "Both", "No")); menuFarm.Add("Lane.Mana", new Slider("Don't harass if mana < %", 0)); } menuJungle = Config.AddSubMenu("Jungle Farm", "JungleFarm"); { menuJungle.Add("UseQJFarm", new CheckBox("Use Q")); menuJungle.Add("UseWJFarm", new CheckBox("Use W")); menuJungle.Add("UseEJFarm", new CheckBox("Use E")); } menuMisc = Config.AddSubMenu("Misc", "Misc"); { menuMisc.Add("InterruptSpells", new CheckBox("Interrupt spells")); menuMisc.Add("CastQE", new KeyBind("QE closest to cursor", false, KeyBind.BindTypes.HoldActive, 'T')); foreach (var enemy in ObjectManager.Get<AIHeroClient>().Where(enemy => enemy.Team != Player.Team)) menuMisc.Add("DontUlt" + enemy.CharData.BaseSkinName, new CheckBox("Don't Ult : " + enemy.CharData.BaseSkinName, false)); } DrawMenu = Config.AddSubMenu("Drawings", "Drawings"); { DrawMenu.Add("QRange", new CheckBox("Q range", false));//.SetValue(new Circle(false, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); DrawMenu.Add("WRange", new CheckBox("W range"));//.SetValue(new Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); DrawMenu.Add("ERange", new CheckBox("E range", false));//.SetValue(new Circle(false, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); DrawMenu.Add("RRange", new CheckBox("R range", false));//.SetValue(new Circle(false, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); DrawMenu.Add("QERange", new CheckBox("QE range"));//.SetValue(new Circle(true, System.Drawing.Color.FromArgb(100, 255, 0, 255)))); ManaBarIndicator.Initialize(); } //Add the events we are going to use: Game.OnUpdate += Game_OnGameUpdate; Game.OnWndProc += Game_OnWndProc; Orbwalker.OnPreAttack += Orbwalking_BeforeAttack; Obj_AI_Base.OnProcessSpellCast += AIHeroClient_OnProcessSpellCast; Interrupter2.OnInterruptableTarget += Interrupter2_OnInterruptableTarget; Drawing.OnDraw += Drawing_OnDraw; }
/// <summary> /// Gets triggered when a unit casts a spell and the unit is visible. /// </summary> private static void ObjAiHeroOnOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (Config.PrintSpellData && sender is Obj_AI_Hero) { Game.PrintChat(Environment.TickCount + " ProcessSpellCast: " + args.SData.Name); Console.WriteLine(Environment.TickCount + " ProcessSpellCast: " + args.SData.Name); } if (args.SData.Name == "dravenrdoublecast") { Program.DetectedSkillshots.RemoveAll( s => s.Unit.NetworkId == sender.NetworkId && s.SpellData.SpellName == "DravenRCast"); } if (!sender.IsValid || sender.Team == ObjectManager.Player.Team && !Config.TestOnAllies) { return; } //Get the skillshot data. var spellData = SpellDatabase.GetByName(args.SData.Name); //Skillshot not added in the database. if (spellData == null) { return; } var startPos = new Vector2(); if (spellData.FromObject != "") { foreach (var o in ObjectManager.Get <GameObject>()) { if (o.Name.Contains(spellData.FromObject)) { startPos = o.Position.To2D(); } } } else { startPos = sender.ServerPosition.To2D(); } //For now only zed support. if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in ObjectManager.Get <GameObject>()) { if (obj.IsEnemy && spellData.FromObjects.Contains(obj.Name)) { var start = obj.Position.To2D(); var end = start + spellData.Range * (args.End.To2D() - obj.Position.To2D()).Normalized(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Environment.TickCount - Game.Ping / 2, start, end, sender); } } } if (!startPos.IsValid()) { return; } var endPos = args.End.To2D(); if (spellData.SpellName == "LucianQ" && args.Target != null && args.Target.NetworkId == ObjectManager.Player.NetworkId) { return; } //Calculate the real end Point: var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos = endPos + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } //Trigger the skillshot detection callbacks. TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Environment.TickCount - Game.Ping / 2, startPos, endPos, sender); }
public NodeScanModule(CMD cmd, ObjectManager objectManager, Skills skills) { CMD = cmd; ObjectManager = objectManager; Skills = skills; }
public static void MenuInit() { var comboMenu = new Menu(":: Combo Settings", ":: Combo Settings"); { comboMenu.AddItem(new MenuItem("lucian.q.combo", "Use Q").SetValue(true)).SetTooltip("Uses Q in Combo", SharpDX.Color.GreenYellow); comboMenu.AddItem(new MenuItem("lucian.e.combo", "Use E").SetValue(true)).SetTooltip("Uses E in Combo", SharpDX.Color.GreenYellow); comboMenu.AddItem(new MenuItem("lucian.w.combo", "Use W").SetValue(true)).SetTooltip("Uses W in Combo", SharpDX.Color.GreenYellow); comboMenu.AddItem(new MenuItem("lucian.r.combo", "Use R").SetValue(true)).SetTooltip("Uses R in Combo (Only Casting If Enemy Killable)", SharpDX.Color.GreenYellow); comboMenu.AddItem(new MenuItem("lucian.combo.start.e", "Start Combo With E").SetValue(true)).SetTooltip("Starting Combo With E", SharpDX.Color.GreenYellow); Config.AddSubMenu(comboMenu); } var harassMenu = new Menu(":: Harass Settings", ":: Harass Settings"); { harassMenu.AddItem(new MenuItem("lucian.q.harass", "Use Q").SetValue(true)).SetTooltip("Uses Q in Harass", SharpDX.Color.GreenYellow); harassMenu.AddItem(new MenuItem("lucian.q.type", "Harass Type").SetValue(new StringList(new[] { "Extended", "Normal" }))); harassMenu.AddItem(new MenuItem("lucian.w.harass", "Use W").SetValue(true)).SetTooltip("Uses W in Harass", SharpDX.Color.GreenYellow); harassMenu.AddItem(new MenuItem("lucian.harass.mana", "Min. Mana").SetValue(new Slider(50, 1, 99))).SetTooltip("Manage your Mana!", SharpDX.Color.GreenYellow); var qToggleMenu = new Menu(":: Q Whitelist (Extended)", ":: Q Whitelist (Extended)"); { foreach (var enemy in HeroManager.Enemies.Where(x => x.IsValid)) { qToggleMenu.AddItem(new MenuItem("lucian.white" + enemy.ChampionName, "(Q) " + enemy.ChampionName).SetValue(true)); } harassMenu.AddSubMenu(qToggleMenu); } Config.AddSubMenu(harassMenu); } var clearMenu = new Menu(":: Clear Settings", ":: Clear Settings"); { clearMenu.AddItem(new MenuItem("lucian.q.clear", "Use Q").SetValue(true)).SetTooltip("Uses Q in Clear", SharpDX.Color.GreenYellow); clearMenu.AddItem(new MenuItem("lucian.w.clear", "Use W").SetValue(true)).SetTooltip("Uses W in Clear", SharpDX.Color.GreenYellow); clearMenu.AddItem(new MenuItem("lucian.q.minion.hit.count", "(Q) Min. Minion Hit").SetValue(new Slider(3, 1, 5))).SetTooltip("Minimum minion count for Q", SharpDX.Color.GreenYellow); clearMenu.AddItem(new MenuItem("lucian.w.minion.hit.count", "(W) Min. Minion Hit").SetValue(new Slider(3, 1, 5))).SetTooltip("Minimum minion count for W", SharpDX.Color.GreenYellow); clearMenu.AddItem(new MenuItem("lucian.clear.mana", "Min. Mana").SetValue(new Slider(50, 1, 99))).SetTooltip("Manage your Mana!", SharpDX.Color.GreenYellow); Config.AddSubMenu(clearMenu); } var jungleMenu = new Menu(":: Jungle Settings", ":: Jungle Settings"); { jungleMenu.AddItem(new MenuItem("lucian.q.jungle", "Use Q").SetValue(true)).SetTooltip("Uses Q in Jungle", SharpDX.Color.GreenYellow); jungleMenu.AddItem(new MenuItem("lucian.w.jungle", "Use W").SetValue(true)).SetTooltip("Uses W in Jungle", SharpDX.Color.GreenYellow); jungleMenu.AddItem(new MenuItem("lucian.e.jungle", "Use E").SetValue(true)).SetTooltip("Uses E in Jungle (Using Mouse Position)", SharpDX.Color.GreenYellow); jungleMenu.AddItem(new MenuItem("lucian.jungle.mana", "Min. Mana").SetValue(new Slider(50, 1, 99))).SetTooltip("Manage your Mana!", SharpDX.Color.GreenYellow); Config.AddSubMenu(jungleMenu); } var killStealMenu = new Menu(":: KillSteal Settings", ":: KillSteal Settings"); { killStealMenu.AddItem(new MenuItem("lucian.q.ks", "Use Q").SetValue(true)).SetTooltip("Uses Q if Enemy Killable", SharpDX.Color.GreenYellow); killStealMenu.AddItem(new MenuItem("lucian.w.ks", "Use W").SetValue(true)).SetTooltip("Uses W if Enemy Killable", SharpDX.Color.GreenYellow); Config.AddSubMenu(killStealMenu); } var miscMenu = new Menu(":: Miscellaneous", ":: Miscellaneous"); { var gapcloseSet = new Menu("Anti-Gapclose Settings", "Anti-Gapclose Settings"); { gapcloseSet.AddItem(new MenuItem("lucian.e.gapclosex", "(E) Anti-Gapclose").SetValue(new StringList(new[] { "On", "Off" }, 1))); gapcloseSet.AddItem(new MenuItem("masterracec0mb0X", " Custom Anti-Gapcloser")).SetFontStyle(FontStyle.Bold, SharpDX.Color.LightBlue); foreach (var gapclose in AntiGapcloseSpell.GapcloseableSpells.Where(x => ObjectManager.Get <Obj_AI_Hero>().Any(y => y.ChampionName == x.ChampionName && y.IsEnemy))) { gapcloseSet.AddItem(new MenuItem("gapclose." + gapclose.ChampionName, "Anti-Gapclose: " + gapclose.ChampionName + " - Spell: " + gapclose.Slot).SetValue(true)); gapcloseSet.AddItem(new MenuItem("gapclose.slider." + gapclose.SpellName, "" + gapclose.ChampionName + " - Spell: " + gapclose.Slot + " Priorty").SetValue(new Slider(gapclose.DangerLevel, 1, 5))); } miscMenu.AddSubMenu(gapcloseSet); } Config.AddSubMenu(miscMenu); } var drawMenu = new Menu(":: Draw Settings", ":: Draw Settings"); { var skillDraw = new Menu(":: Skill Draws", ":: Skill Draws"); { skillDraw.AddItem(new MenuItem("lucian.q.draw", "Q Range").SetValue(new Circle(false, Color.Gold))); skillDraw.AddItem(new MenuItem("lucian.q2.draw", "Q (Extended) Range").SetValue(new Circle(false, Color.Gold))); skillDraw.AddItem(new MenuItem("lucian.w.draw", "W Range").SetValue(new Circle(false, Color.Gold))); skillDraw.AddItem(new MenuItem("lucian.e.draw", "E Range").SetValue(new Circle(false, Color.Gold))); skillDraw.AddItem(new MenuItem("lucian.r.draw", "R Range").SetValue(new Circle(false, Color.Gold))); drawMenu.AddSubMenu(skillDraw); } Config.AddSubMenu(drawMenu); } Config.AddItem(new MenuItem("lucian.semi.manual.ult", "Semi-Manual (R)!").SetValue(new KeyBind("A".ToCharArray()[0], KeyBindType.Press))); var drawDamageMenu = new MenuItem("RushDrawEDamage", "Combo Damage").SetValue(true); var drawFill = new MenuItem("RushDrawEDamageFill", "Combo Damage Fill").SetValue(new Circle(true, Color.Gold)); drawMenu.SubMenu("Damage Draws").AddItem(drawDamageMenu); drawMenu.SubMenu("Damage Draws").AddItem(drawFill); DamageIndicator.DamageToUnit = LucianCalculator.LucianTotalDamage; DamageIndicator.Enabled = drawDamageMenu.GetValue <bool>(); DamageIndicator.Fill = drawFill.GetValue <Circle>().Active; DamageIndicator.FillColor = drawFill.GetValue <Circle>().Color; drawDamageMenu.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { DamageIndicator.Enabled = eventArgs.GetNewValue <bool>(); }; drawFill.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { DamageIndicator.Fill = eventArgs.GetNewValue <Circle>().Active; DamageIndicator.FillColor = eventArgs.GetNewValue <Circle>().Color; }; Config.AddToMainMenu(); }