private void Game_ProcessSpell(Obj_AI_Base hero, Obj_AI_BaseMissileClientDataEventArgs args) { try { SpellData spellData; if (hero.CheckTeam() && onProcessSpells.TryGetValue(args.SpellData.Name.ToLower(), out spellData)) { if (spellData.usePackets == false) { var specialSpellArgs = new SpecialSpellEventArgs { spellData = spellData }; OnProcessSpecialSpell?.Invoke(hero, args, spellData, specialSpellArgs); // optional update from specialSpellArgs spellData = specialSpellArgs.spellData; if (specialSpellArgs.noProcess == false && spellData.noProcess == false) { var foundMissile = false; if (spellData.isThreeWay == false && spellData.isSpecial == false) { foreach (var entry in detectedSpells) { var spell = entry.Value; var dir = (args.End.To2D() - args.Start.To2D()).Normalized(); if (spell.spellObject != null) { if (spell.info.spellName.ToLower() == args.SpellData.Name.ToLower()) // todo: fix urf spells { if (spell.heroID == hero.NetworkId && dir.AngleBetween(spell.direction) < 10) { foundMissile = true; break; } } } } } if (foundMissile == false) { CreateSpellData(hero, hero.ServerPosition, args.End, spellData); } } } } } catch (Exception e) { Console.WriteLine(e); } }
private void Game_ProcessSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args) { try { SpellData spellData; if (hero.Team != myHero.Team && onProcessSpells.TryGetValue(args.SData.Name.ToLower(), out spellData)) { if (spellData.usePackets == false) { var specialSpellArgs = new SpecialSpellEventArgs(); OnProcessSpecialSpell?.Invoke(hero, args, spellData, specialSpellArgs); if (specialSpellArgs.noProcess == false && spellData.noProcess == false) { bool foundMissile = false; if (spellData.isThreeWay == false && spellData.isSpecial == false) { foreach (KeyValuePair <int, Spell> entry in detectedSpells) { Spell spell = entry.Value; var dir = (args.End.To2D() - args.Start.To2D()).Normalized(); if (spell.spellObject != null) { if (spell.info.spellName.ToLower() == args.SData.Name.ToLower()) // todo: fix urf spells { if (spell.heroID == hero.NetworkId && dir.AngleBetween(spell.direction) < 10) { foundMissile = true; break; } } } } } if (foundMissile == false || spellData.dontcheckDuplicates) { CreateSpellData(hero, hero.ServerPosition, args.End, spellData, null); } } } } } catch (Exception e) { Console.WriteLine(e); } }
private void Game_ProcessSpell(Obj_AI_Base hero, Obj_AI_BaseMissileClientDataEventArgs args) { try { if (!hero.CheckTeam() || !OnProcessSpells.TryGetValue(args.SpellData.Name.ToLower(), out var spellData)) { return; } if (spellData.UsePackets) { return; } var specialSpellArgs = new SpecialSpellEventArgs {SpellData = spellData}; OnProcessSpecialSpell?.Invoke(hero, args, spellData, specialSpellArgs); spellData = specialSpellArgs.SpellData; if (specialSpellArgs.NoProcess || spellData.NoProcess) { return; } var foundMissile = false; if (!spellData.IsThreeWay && !spellData.IsSpecial) { if ((from entry in DetectedSpells select entry.Value into spell let dir = (args.End.To2D() - args.Start.To2D()).Normalized() where spell.SpellObject != null where string.Equals(spell.Info.SpellName, args.SpellData.Name, StringComparison.CurrentCultureIgnoreCase) where spell.HeroId == hero.NetworkId && dir.AngleBetween(spell.Direction) < 10 select spell).Any()) { foundMissile = true; } } if (foundMissile == false) { CreateSpellData(hero, hero.ServerPosition, args.End, spellData); } } catch (Exception e) { Console.WriteLine(e); } }