Exemplo n.º 1
0
        public EffectActor SpawnEffect(int actorSNO, Vector3D position, Actor facingTarget, TickTimer timeout = null)
        {
            float angle = (facingTarget != null) ? MovementHelpers.GetFacingAngle(User.Position, facingTarget.Position) : -1f;

            return(SpawnEffect(actorSNO, position, angle, timeout));
        }
Exemplo n.º 2
0
        public override void Update(int tickCounter)
        {
            // if power executed, wait for attack/cooldown to finish.
            if (_powerRan)
            {
                if (_powerFinishTimer.TimedOut)
                {
                    this.Done = true;
                }

                return;
            }

            // try to get nearest target if no target yet acquired
            if (_target == null)
            {
                _target = this.Owner.GetPlayersInRange(MaxTargetRange).OrderBy(
                    (player) => PowerMath.Distance2D(player.Position, this.Owner.Position))
                          .FirstOrDefault();
                //.FirstOrDefault(x => x.Attributes[GameAttribute.Untargetable] == false);
                // If target is marked untargetable then we shouldnt consider him for targeting - DarkLotus
            }

            if (_target != null)
            {
                float targetDistance = PowerMath.Distance2D(_target.Position, this.Owner.Position);

                // if target has moved out of range, deselect it as the target
                if (targetDistance > MaxTargetRange)
                {
                    _target = null;
                }
                else if (targetDistance < _baseAttackRadius + _target.ActorData.Cylinder.Ax2)  // run power if within range
                {
                    // stop any movement
                    this.Owner.Move(this.Owner.Position, MovementHelpers.GetFacingAngle(this.Owner, _target));
                    //this.Owner.TranslateFacing(_target.Position, true);

                    this.Owner.World.PowerManager.RunPower(this.Owner, _power, _target, _target.Position);
                    _powerFinishTimer = new SecondsTickTimer(this.Owner.World.Game,
                                                             _power.EvalTag(PowerKeys.AttackSpeed) + _power.EvalTag(PowerKeys.CooldownTime));
                    _powerRan = true;
                }
                else
                {
                    if (_pathRequestTask == null)
                    {
                        _pathRequestTask = Owner.World.Game.Pathfinder.GetPath(Owner, Owner.Position, _target.Position); // called once to create task
                    }
                    if (!_pathRequestTask.PathFound)
                    {
                        return;
                    }

                    // No path found, so end Action.
                    if (_pathRequestTask.Path.Count < 1)
                    {
                        return;
                    }
                    if (_path == null)
                    {
                        _path = _pathRequestTask.Path;
                    }

                    if (_ownerMover.ArrivalTime == null || _ownerMover.Arrived)
                    {
                        //if (_ownerMover.Arrived)
                        //{
                        _pathUpdateTimer = new SecondsTickTimer(this.Owner.World.Game, PathUpdateDelay);
                        //_pathRequestTask = null;
                        Vector3D movePos = _path[0];// PowerMath.TranslateDirection2D(this.Owner.Position, _path[0], this.Owner.Position,
                        //this.Owner.WalkSpeed * (_pathUpdateTimer.TimeoutTick - this.Owner.World.Game.TickCounter));
                        this.Owner.TranslateFacing(movePos, false);
                        _ownerMover.Move(movePos, this.Owner.WalkSpeed, new Net.GS.Message.Definitions.ACD.ACDTranslateNormalMessage
                        {
                            TurnImmediately = false,
                            AnimationTag    = this.Owner.AnimationSet == null ? 0 : this.Owner.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk)
                        });
                        //if(PowerMath.Distance2D(movePos,_path[0]) < 5f)
                        _path.RemoveAt(0);
                        if (_path.Count == 0)
                        {
                            _pathRequestTask = null;
                            _path            = null;
                            return;
                        }
                        //}

                        //_path.Clear();
                    }



                    /*// update or create path movement
                     * if (_pathUpdateTimer == null || _pathUpdateTimer.TimedOut)
                     * {
                     *  _pathUpdateTimer = new SecondsTickTimer(this.Owner.World.Game, PathUpdateDelay);
                     *
                     *  // move the space between each path update
                     *  Vector3D movePos = PowerMath.TranslateDirection2D(this.Owner.Position, _target.Position, this.Owner.Position,
                     *      this.Owner.WalkSpeed * (_pathUpdateTimer.TimeoutTick - this.Owner.World.Game.TickCounter));
                     *  if (!this.Owner.World.CheckLocationForFlag(movePos, Mooege.Common.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
                     *  {
                     *      var xdiff = movePos.X - this.Owner.Position.X;
                     *      var ydiff = movePos.Y - this.Owner.Position.Y;
                     *      movePos.Y = Owner.Position.Y;
                     *      // make sure mesh is a non walking one...
                     *      // could use gridsquares if hit left move one south etc
                     *      movePos.X = Owner.Position.X + xdiff;
                     *      foreach (var mesh in this.Owner.CurrentScene.NavZone.NavCells)// need to check scenes prob
                     *      {
                     *          if ((mesh.Bounds.Contains(movePos.X - Owner.CurrentScene.Position.X, movePos.Y - Owner.CurrentScene.Position.Y)) && !mesh.Flags.HasFlag(Mooege.Common.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
                     *          {
                     *              movePos.X = Owner.Position.X;
                     *              ydiff *= 1.4f;
                     *              break;
                     *          }
                     *
                     *      }
                     *      movePos.Y += ydiff;
                     *      foreach (var mesh in this.Owner.CurrentScene.NavZone.NavCells)// need to check scenes prob
                     *      {
                     *          if ((mesh.Bounds.Contains(movePos.X - Owner.CurrentScene.Position.X, movePos.Y - Owner.CurrentScene.Position.Y)) && !mesh.Flags.HasFlag(Mooege.Common.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
                     *          {
                     *              movePos.Y = Owner.Position.Y;
                     *              movePos.X += (xdiff * 0.4f);
                     *              break;
                     *          }
                     *      }
                     *
                     *      //var localmovepos = new Vector3D(movePos);
                     *      System.Windows.Rect oldPosRectSceneLocal = new System.Windows.Rect(Owner.Position.X - Owner.CurrentScene.Position.X, Owner.Position.Y- Owner.CurrentScene.Position.Y, Owner.Bounds.Width, Owner.Bounds.Height);
                     *      System.Windows.Rect movePosSceneLocal = new System.Windows.Rect(movePos.X - Owner.CurrentScene.Position.X, movePos.Y - Owner.CurrentScene.Position.Y, Owner.Bounds.Width, Owner.Bounds.Height);
                     *      movePos.X -= (float)this.Owner.CurrentScene.Bounds.Location.X;
                     *      movePos.Y -= (float)this.Owner.CurrentScene.Bounds.Location.Y;
                     *      Circle mob = new Circle(movePos.X - (float)Owner.CurrentScene.Position.X, movePos.Y - (float)Owner.CurrentScene.Position.Y, (float)this.Owner.Bounds.Width);
                     *
                     *      foreach (var mesh in this.Owner.CurrentScene.NavZone.NavCells)// need to check scenes prob
                     *      {
                     *          /*if (mob.Intersects(mesh.Bounds))
                     *          {
                     *              if(PowerMath.CircleInBeam(mob,mesh.Bounds.TopLeft,mesh.Bounds.BottomLeft,1f))
                     *              {
                     *
                     *              }
                     *          }
                     *          if ((mesh.Bounds.Contains(movePos.X, movePos.Y)) && mesh.Flags.HasFlag(Mooege.Common.MPQ.FileFormats.Scene.NavCellFlags.AllowWalk))
                     *          {
                     *              if ((oldPosRectSceneLocal.Left >= mesh.Bounds.Right && movePosSceneLocal.Left < mesh.Bounds.Right)) // Right  collisions
                     *              {
                     *                  ydiff = 0;
                     *                  xdiff = xdiff * 1.5f;
                     *                  break;
                     *              }
                     *              if ((oldPosRectSceneLocal.Right < mesh.Bounds.Left && movePosSceneLocal.Right >= mesh.Bounds.Left))//Left
                     *              {
                     *                  ydiff = 0;
                     *                  xdiff = xdiff * 1.5f;
                     *                  break;
                     *              }
                     *              if ((oldPosRectSceneLocal.Top >= mesh.Bounds.Bottom && movePosSceneLocal.Top < mesh.Bounds.Bottom) || (oldPosRectSceneLocal.Bottom < mesh.Bounds.Top && movePosSceneLocal.Bottom >= mesh.Bounds.Top)) // Bottom then Top
                     *              {
                     *
                     *                  xdiff = 0;
                     *                  ydiff = ydiff * 1.5f;
                     *                  break;
                     *              }
                     *              /*if (movePos.X > mesh.Min.X || movePos.X < mesh.Max.X)
                     *              {
                     *                  xdiff = 0;
                     *                  break;
                     *              }
                     *              else if (movePos.Y > mesh.Min.Y || movePos.Y < mesh.Max.Y)
                     *              {
                     *                  ydiff = 0;
                     *                  break;
                     *              }
                     *          }
                     *
                     *      }
                     *      movePos.X = this.Owner.Position.X + xdiff;
                     *      movePos.Y = this.Owner.Position.Y + ydiff;
                     *  }
                     *
                     *
                     *
                     *  this.Owner.TranslateFacing(movePos,false);//_target.Position, false);
                     *
                     *  _ownerMover.Move(movePos, this.Owner.WalkSpeed, new Net.GS.Message.Definitions.ACD.ACDTranslateNormalMessage
                     *  {
                     *      TurnImmediately = false,
                     *      AnimationTag = this.Owner.AnimationSet == null ? 0 : this.Owner.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk)
                     *  });
                     * }*/
                    else
                    {
                        if (_ownerMover.Velocity != null)
                        {
                            _ownerMover.Update();
                        }
                        //if (_ownerMover.Arrived)
                        //  _ownerMover = new ActorMover(this.Owner);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public EffectActor SpawnEffect(int actorSNO, Vector3D position, float angle = 0, TickTimer timeout = null)
        {
            if (angle == -1)
            {
                angle = (float)(Rand.NextDouble() * (Math.PI * 2));
            }
            if (timeout == null)
            {
                if (_defaultEffectTimeout == null)
                {
                    _defaultEffectTimeout = new SecondsTickTimer(World.Game, 2f); // default timeout of 2 seconds for now
                }
                timeout = _defaultEffectTimeout;
            }

            var actor = new EffectActor(this, actorSNO, position);

            actor.Timeout = timeout;
            actor.Spawn(angle);
            return(actor);
        }
Exemplo n.º 4
0
 public AttackSpeedDeBuff(float percentage, TickTimer timeout)
 {
     Percentage = percentage;
     Timeout    = timeout;
 }
Exemplo n.º 5
0
        /// <summary>
        /// The Loaded event for the Window where we will execute code that should run when the Window
        /// is first put into place.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // The Conveyor will be passed around to other objects so that they can interact with the UI.  This Conveyor may have
            // state so it's important to re-use this object unless sandboxing is needed.
            Conveyor = new Conveyor();

            // The settings for the app load in the app startup, they will then try to load the last profile
            // that was used.
            Conveyor.EchoLog($"Settings Folder: {App.Settings.AppDataDirectory}", LogType.Information);
            Conveyor.EchoLog($"Settings File:   {App.Settings.AvalonSettingsFile}", LogType.Information);
            Conveyor.EchoLog($"Profiles Folder: {App.Settings.AvalonSettings.SaveDirectory}", LogType.Information);

            // Parse the command line arguments to see if a profile was specified.
            var args = Environment.GetCommandLineArgs();


            // Try to load the last profile loaded, if not found create a new profile.
            if (File.Exists(App.Settings.AvalonSettings.LastLoadedProfilePath))
            {
                App.Settings.LoadSettings(App.Settings.AvalonSettings.LastLoadedProfilePath);
                Conveyor.EchoLog($"Settings Loaded: {App.Settings.AvalonSettings.LastLoadedProfilePath}", LogType.Information);
            }
            else
            {
                if (string.IsNullOrWhiteSpace(App.Settings.AvalonSettings.LastLoadedProfilePath))
                {
                    Conveyor.EchoLog($"New Profile being created.", LogType.Information);
                }
                else
                {
                    Conveyor.EchoLog($"Last Profile Loaded Not Found: {App.Settings.AvalonSettings.LastLoadedProfilePath}", LogType.Warning);
                }
            }


            // TODO - Figure out a better way to inject a single Conveyor, maybe static in App?
            // Inject the Conveyor into the Triggers.
            foreach (var trigger in App.Settings.ProfileSettings.TriggerList)
            {
                trigger.Conveyor = Conveyor;
            }

            // Wire up any events that have to be wired up through code.
            TextInput.Editor.PreviewKeyDown += this.Editor_PreviewKeyDown;
            AddHandler(TabControlEx.NetworkButtonClickEvent, new RoutedEventHandler(NetworkButton_Click));
            AddHandler(TabControlEx.SettingsButtonClickEvent, new RoutedEventHandler(SettingsButton_Click));

            // Pass the necessary reference from this page to the Interpreter.
            Interp = new Interpreter(this.Conveyor);

            // Setup the handler so when it wants to write to the main window it can by raising the echo event.
            Interp.Echo += this.InterpreterEcho;

            // Setup Lua
            Lua = new Script();
            Lua.Options.CheckThreadAccess = false;
            UserData.RegisterType <LuaCommands>();

            // create a userdata, again, explicitly.
            var luaCmd = UserData.Create(new LuaCommands(Interp));

            Lua.Globals.Set("Cmd", luaCmd);
            LuaControl = new ExecutionControlToken();

            // Setup the tick timer.
            TickTimer = new TickTimer(Conveyor);

            // Setup the auto complete commands.  If they're found refresh them, if they're not
            // report it to the terminal window.  It should -always be found-.
            RefreshAutoCompleteEntries();

            // Auto connect to the game if the setting is set.
            if (App.Settings.ProfileSettings.AutoConnect)
            {
                NetworkButton_Click(null, null);
            }

            // Is there an auto execute command or set of commands to run?
            if (!string.IsNullOrWhiteSpace(App.Settings.ProfileSettings.AutoExecuteCommand))
            {
                Interp.Send(App.Settings.ProfileSettings.AutoExecuteCommand, true, false);
            }

            // Finally, all is done, set the focus to the command box.
            TextInput.Focus();
        }
Exemplo n.º 6
0
 public ShoutReduceDamage(TickTimer timeout)
 {
     Timeout = timeout;
 }
Exemplo n.º 7
0
 public MovementDeBuff(float percentage, TickTimer timeout)
 {
     Percentage = percentage;
     Timeout    = timeout;
 }
Exemplo n.º 8
0
 public EnergyArmorPowers(TickTimer timeout)
 {
     Timeout = timeout;
 }
Exemplo n.º 9
0
 public BlizzardPowers(TickTimer timeout)
 {
     Timeout = timeout;
 }
Exemplo n.º 10
0
 public SlowTimeDebuff(float percentage, TickTimer timeout)
     : base(GameAttribute.Slow, GameAttribute.Slowdown_Immune, FloatingNumberMessage.FloatType.Snared)
 {
     Percentage = percentage;
     Timeout    = timeout;
 }
Exemplo n.º 11
0
 public SpeedBuff(float percentage, TickTimer timeout)
 {
     Percentage = percentage;
     Timeout    = timeout;
 }
Exemplo n.º 12
0
 public DebuffFrozen(TickTimer timeout)
     : base(GameAttribute.Frozen, GameAttribute.Freeze_Immune, FloatingNumberMessage.FloatType.Frozen)
 {
     Timeout = timeout;
 }
Exemplo n.º 13
0
 public DebuffRooted(TickTimer timeout)
     : base(GameAttribute.IsRooted, GameAttribute.Root_Immune, FloatingNumberMessage.FloatType.Rooted)
 {
     Timeout = timeout;
 }
Exemplo n.º 14
0
 public DebuffStunned(TickTimer timeout)
     : base(GameAttribute.Stunned, GameAttribute.Stun_Immune, FloatingNumberMessage.FloatType.Stunned)
 {
     Timeout = timeout;
 }
Exemplo n.º 15
0
 public DebuffChilled(float percentage, TickTimer timeout)
     : base(GameAttribute.Chilled, null, null)
 {
     Percentage = percentage;
     Timeout    = timeout;
 }
Exemplo n.º 16
0
 public DebuffBlind(TickTimer timeout)
     : base(GameAttribute.Blind, GameAttribute.Immune_To_Blind, FloatingNumberMessage.FloatType.Blinded)
 {
     Timeout = timeout;
 }