public void DoIteration(Unit me, Unit target) { if (me.CombatState == CombatState.Stunned) { // TODO: check for un-stun abilities return; } CastSpellEventArgs argsCast = new CastSpellEventArgs { Spell = SpellStrategy.DoRoutine(me, target) }; if (argsCast.Spell != null) { OnCastSpell.Invoke(this, argsCast); } if (me.CombatState == CombatState.Rooted) { // TODO: check for un-root abilities return; } MoveCharacterEventArgs argsMove = new MoveCharacterEventArgs { PositionToGoTo = MovementStrategy.CalculatePosition(me, target) }; if (!argsMove.PositionToGoTo.Equals(new Vector3(0.0, 0.0, 0.0))) { OnMoveCharacter?.Invoke(this, argsMove); } }
public EntityEventsFragment() { Game.OnNotify += args => { this.Notify(new NotifyEventArgs(args.NetworkId, (SDK.League.GameEventId)args.EventId)); }; AIBaseClient.OnPlayAnimation += (o, args) => { var arg = new PlayAnimationEventArgs(o.NetworkId, args.Animation); this.PlayAnimation(arg); if (arg.IsBlocked) { args.Process = false; } }; AIBaseClient.OnProcessSpellCast += (o, args) => this.ProcessSpellCast(new ProcessSpellCastEventArgs(o.NetworkId, Con.Convert(args.SData), args.Level, args.Start, args.To, args.End, Con.T(args.Target?.NetworkId), args.MissileNetworkId, args.CastTime, args.TotalTime, (SDK.Entities.SpellSlot)args.Slot)); AIBaseClient.OnDoCast += (o, args) => this.DoCast(new ProcessSpellCastEventArgs(o.NetworkId, Con.Convert(args.SData), args.Level, args.Start, args.To, args.End, Con.T(args.Target?.NetworkId), args.MissileNetworkId, args.CastTime, args.TotalTime, (SDK.Entities.SpellSlot)args.Slot)); AIBaseClient.OnNewPath += (o, args) => this.NewPath(new NewPathEventArgs(o.NetworkId, args.Path, args.IsDash, args.Speed)); AIBaseClient.OnIssueOrder += (o, args) => { var arg = new IssueOrderEventArgs(o.NetworkId, (SDK.Entities.GameObjectOrder)args.Order, args.TargetPosition, Con.T(args.Target?.NetworkId), args.IsAttackMove, args.IsPetCommand); this.IssueOrder(arg); if (arg.IsBlocked) { args.Process = false; } ; }; AttackableUnit.OnTeleport += (o, args) => this.Teleport(new TeleportEventArgs(o.NetworkId, args.RecallType, args.RecallName)); AIBaseClient.OnAggro += (o, args) => this.Aggro(new AggroEventArgs(o.NetworkId, args.NetworkId)); AIBaseClient.OnBuffAdd += (o, args) => this.BuffAdd(new BuffUpdateEventArgs(o.NetworkId, Con.Convert(args.Buff))); AIBaseClient.OnBuffRemove += (o, args) => this.BuffRemove(new BuffUpdateEventArgs(o.NetworkId, Con.Convert(args.Buff))); AIHeroClient.OnLevelUp += (o, args) => this.LevelUp(new LevelUpEventArgs(o.NetworkId, args.Level)); Spellbook.OnCastSpell += (o, args) => { var arg = new CastSpellEventArgs(Con.Convert(o), args.StartPosition, args.EndPosition, Con.T(args.Target?.NetworkId), (SDK.Entities.SpellSlot)args.Slot); this.SpellbookCastSpell(arg); if (arg.IsBlocked) { args.Process = false; } ; }; Spellbook.OnStopCast += (o, args) => this.SpellbookStopCast(new StopCastEventArgs(Con.Convert(o), args.MissileNetworkId, args.KeepAnimationPlaying, args.HasBeenCast, args.SpellStopCancelled, args.DestroyMissile, args.SpellCastId)); Spellbook.OnUpdateChargedSpell += (o, args) => { var arg = new UpdateChargedSpellEventArgs(Con.Convert(o), (SDK.Entities.SpellSlot)args.Slot, args.Position, args.ReleaseCast); this.SpellbookUpdateChargedSpell(arg); if (arg.IsBlocked) { args.Process = false; } ; }; GameObject.OnIntegerPropertyChange += (o, args) => this.OnIntegerPropertyChange(new PropertyChangeEventArgs <int>(o.NetworkId, args.Property, args.OldValue, args.NewValue)); GameObject.OnFloatPropertyChange += (o, args) => this.OnFloatPropertyChange(new PropertyChangeEventArgs <float>(o.NetworkId, args.Property, args.OldValue, args.NewValue)); }