public bool Invoke(AbilityInfo info) { if (!InvokeAbility.CanBeCasted() || _invokeSleeper.Sleeping) { Log.Info($"can't invoke (cd) {(int)InvokeAbility.Cooldown + 1}"); return(false); } if (!CheckSpheresForLevel(info)) { return(false); } info.One.UseAbility(); info.Two.UseAbility(); info.Three.UseAbility(); /*if (!Check(info)) * { * Log.Error("wrong spheres -> " + SpCounter + " let's recast"); * return false; * }*/ InvokeAbility.UseAbility(); _invokeSleeper.Sleep(250); Log.Info($"invoke: [{info.Ability.Name}]"); return(true); }
public void AddToCombo(AbilityInfo ability) { var index = AbilityInfos.FindIndex(x => x.Ability.Id == AbilityId.invoker_deafening_blast); var after3 = Math.Min(index == -1 ? 3 : index + 1, AbilityInfos.Count); AbilityInfos.Insert(after3, ability); AbilityCount++; }
private bool CheckSpheresForLevel(AbilityInfo info) { if (info.One.Level == 0 || info.Two.Level == 0 || info.Three.Level == 0) { Log.Info("can\'t invoke (not all spheres are learned)"); return(false); } return(true); }
private bool Check(AbilityInfo info) { var q = 0; var w = 0; var e = 0; GetNumber(info.One, ref q, ref w, ref e); GetNumber(info.Two, ref q, ref w, ref e); GetNumber(info.Three, ref q, ref w, ref e); Log.Warn($"Spheres for {info.Ability.Name} -> [{q}] [{w}] [{e}] "); return(SpCounter.Q == q && SpCounter.W == w && SpCounter.E == e); }
public async Task <bool> InvokeAsync(AbilityInfo info) { Log.Info($"Try to invoke -> {info.Ability.GetAbilityId()} ({info.Name})"); if (!InvokeAbility.CanBeCasted()) { Log.Info($"can't invoke (cd) {InvokeAbility.Cooldown + 1}"); return(false); } if (!CheckSpheresForLevel(info)) { return(false); } //BlockActions = true; if (Config.SmartInvoke) { var sphereDelay = Config.InvokeTime; info.One.UseAbility(); await Task.Delay(sphereDelay); info.Two.UseAbility(); await Task.Delay(sphereDelay); info.Three.UseAbility(); await Task.Delay(sphereDelay); if (!Check(info)) { Log.Error("wrong spheres -> " + SpCounter + " let's recast"); await Task.Delay(sphereDelay); return(false); } } else if (Config.ExpInvoke) { Owner.Stop(); info.One.UseAbility(true); info.Two.UseAbility(true); info.Three.UseAbility(true); } else { info.One.UseAbility(); info.Two.UseAbility(); info.Three.UseAbility(); } InvokeAbility.UseAbility(); Log.Info($"invoke: [{info.Ability.Name}]"); await Task.Delay(Config.AfterInvokeDelay); //BlockActions = false; return(true); }
public async Task <bool> InvokeAsync(AbilityInfo info) { if (!InvokeAbility.CanBeCasted()) { Log.Info($"can't invoke (cd) {(int)InvokeAbility.Cooldown + 1}"); return(false); } if (!CheckSpheresForLevel(info)) { return(false); } if (Config.SmartInvoke) { var sphereDelay = Config.InvokeTime; info.One.UseAbility(); await Task.Delay(sphereDelay); info.Two.UseAbility(); await Task.Delay(sphereDelay); info.Three.UseAbility(); await Task.Delay(sphereDelay); if (!Check(info)) { Log.Error("wrong spheres -> " + SpCounter + " let's recast"); await Task.Delay(sphereDelay); return(false); } } else { info.One.UseAbility(); info.Two.UseAbility(); info.Three.UseAbility(); } InvokeAbility.UseAbility(); Log.Info($"invoke: [{info.Ability.Name}]"); await Task.Delay(Config.AfterInvokeDelay); return(true); }
private void ValueOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) { switch (args.Action) { case NotifyCollectionChangedAction.Add: foreach (InventoryItem argsNewItem in args.NewItems) { var id = argsNewItem.Id; if (id == AbilityId.item_cyclone) { _eulCombo1 = new Combo(this, new[] { new AbilityInfo(Eul.Ability), SunStrike, Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit }); _eulCombo2 = new Combo(this, new[] { new AbilityInfo(Eul.Ability), Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit }); _eulCombo3 = new Combo(this, new[] { new AbilityInfo(Eul.Ability), SunStrike, IceWall, ColdSnap, Alacrity, ForgeSpirit }); Config.ComboPanel.Combos.Add(_eulCombo1); Config.ComboPanel.Combos.Add(_eulCombo2); Config.ComboPanel.Combos.Add(_eulCombo3); var refr = Owner.Inventory.Items.FirstOrDefault(x => x.Id == AbilityId.item_refresher); if (refr != null) { var list = new List <Combo> { _eulCombo1, _eulCombo2, _eulCombo3 }; var refresher = new AbilityInfo(refr); foreach (var combo in list) { combo.AddToCombo(refresher); } } //TODO: check for eul } else if (id == AbilityId.item_refresher) { var refresher = new AbilityInfo(argsNewItem.Item); foreach (var combo in Config.ComboPanel.Combos) { combo.AddToCombo(refresher); } } } break; case NotifyCollectionChangedAction.Remove: try { foreach (InventoryItem argsNewItem in args.OldItems) { Log.Debug("REMOVE -> " + argsNewItem.Id); var id = argsNewItem.Id; if (Config.ComboPanel.Combos != null) { if (id == AbilityId.item_cyclone) { if (_eulCombo1 != null) { Config.ComboPanel.Combos.Remove(_eulCombo1.Dispose()); Config.ComboPanel.Combos.Remove(_eulCombo2.Dispose()); Config.ComboPanel.Combos.Remove(_eulCombo3.Dispose()); } else { Log.Debug("null ex (2)"); } } else if (id == AbilityId.item_refresher) { foreach (var combo in Config.ComboPanel.Combos) { var finder = combo.AbilityInfos.Find(x => x.Name == AbilityId.item_refresher.ToString()); if (finder != null) { combo.RemoveFromCombo(finder); } } } } else { Log.Debug("null ex"); } } } catch (Exception e) { Console.WriteLine(e); } break; } }
protected override void OnActivate() { Log.Debug("pre init"); Mode = new InvokerMode( Key.G, Context.Value, this); Quas = Owner.GetAbilityById(AbilityId.invoker_quas); Wex = Owner.GetAbilityById(AbilityId.invoker_wex); Exort = Owner.GetAbilityById(AbilityId.invoker_exort); BlockerSleeper = new Sleeper(); SunStrike = new AbilityInfo(Exort, Exort, Exort, Owner.GetAbilityById(AbilityId.invoker_sun_strike)); ColdSnap = new AbilityInfo(Quas, Quas, Quas, Owner.GetAbilityById(AbilityId.invoker_cold_snap)); Alacrity = new AbilityInfo(Wex, Wex, Exort, Owner.GetAbilityById(AbilityId.invoker_alacrity)); Meteor = new AbilityInfo(Exort, Exort, Wex, Owner.GetAbilityById(AbilityId.invoker_chaos_meteor)); Blast = new AbilityInfo(Quas, Exort, Wex, Owner.GetAbilityById(AbilityId.invoker_deafening_blast)); ForgeSpirit = new AbilityInfo(Exort, Exort, Quas, Owner.GetAbilityById(AbilityId.invoker_forge_spirit)); GhostWalk = new AbilityInfo(Quas, Quas, Wex, Owner.GetAbilityById(AbilityId.invoker_ghost_walk)); IceWall = new AbilityInfo(Quas, Quas, Exort, Owner.GetAbilityById(AbilityId.invoker_ice_wall)); Tornado = new AbilityInfo(Wex, Wex, Quas, Owner.GetAbilityById(AbilityId.invoker_tornado)); Emp = new AbilityInfo(Wex, Wex, Wex, Owner.GetAbilityById(AbilityId.invoker_emp)); _invokeSleeper = new Sleeper(); GlobalGhostWalkSleeper = new Sleeper(); AbilityInfos = new List <AbilityInfo> { SunStrike, ColdSnap, Alacrity, Meteor, Blast, ForgeSpirit, GhostWalk, IceWall, Tornado, Emp }; //retards re coming foreach (var ability in AbilityInfos) { ability.LoadInvoker(this); } Empty1 = Owner.GetAbilityById(AbilityId.invoker_empty1); Empty2 = Owner.GetAbilityById(AbilityId.invoker_empty2); InvokeAbility = Owner.GetAbilityById(AbilityId.invoker_invoke); Log.Debug("post init"); Config = new Config(this); Log.Debug("new config"); Config.ComboKey.Item.ValueChanged += HotkeyChanged; Log.Debug("event to config"); OrbwalkerManager.Value.Activate(); Log.Debug("activate OrbwalkerManager"); TargetManager.Value.Activate(); Log.Debug("activate TargetManager"); Mode.UpdateConfig(Config); Log.Debug("load config"); OrbwalkerManager.Value.RegisterMode(Mode); Log.Debug("RegisterMode"); foreach (var valueOrbwalkingMode in OrbwalkerManager.Value.OrbwalkingModes) { Log.Warn($"Mode: {valueOrbwalkingMode.Value}"); } foreach (var valueOrbwalkingMode in OrbwalkerManager.Value.CustomOrbwalkingModes) { Log.Warn($"Custom Mode: {valueOrbwalkingMode}"); } Mode.Load(); var key = KeyInterop.KeyFromVirtualKey((int)Config.ComboKey.Item.GetValue <KeyBind>().Key); Mode.Key = key; Log.Debug($"_mode loaded. Key for combo -> {Mode.Key}"); InventoryManager.Value.Attach(this); Log.Debug("InventoryManager Attach"); SelectedCombo = 0; InventoryManager.Value.CollectionChanged += ValueOnCollectionChanged; //if (InventoryManager.Value.Inventory.Items.Any(x => x.Id == AbilityId.item_cyclone)) /*if (Eul!=null) * { * _eulCombo1 = new Combo(this, new[] * { * new AbilityInfo(Eul.Ability), SunStrike, Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit * }); * _eulCombo2 = new Combo(this, new[] * { * new AbilityInfo(Eul.Ability), Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit * }); * _eulCombo3 = new Combo(this, new[] * { * new AbilityInfo(Eul.Ability), SunStrike, IceWall, ColdSnap, Alacrity, ForgeSpirit * }); * Config.ComboPanel.Combos.Add(_eulCombo1); * Config.ComboPanel.Combos.Add(_eulCombo2); * Config.ComboPanel.Combos.Add(_eulCombo3); * }*/ Unit.OnModifierAdded += HeroOnOnModifierAdded; Unit.OnModifierRemoved += HeroOnOnModifierRemoved; SpCounter = new SphereCounter(); }
public void RemoveFromCombo(AbilityInfo ability) { AbilityInfos.Remove(ability); AbilityCount--; }