public void Follow(Player player, Player followedPlayer) { var targetPosition = MovementController.ActualPosition(followedPlayer); Packet.Builder.HeroMoveCommand(player.GetGameSession(), targetPosition); MovementController.Move(player, targetPosition); }
private async void HangarSwitchLoop() { var map = Player.Spacemap; Vector startVector = MovementController.ActualPosition(Player); GameSession session = null; var endTime = DateTime.Now.AddSeconds(10); Player.Visuals.TryAdd(ShipVisuals.SHIP_WARP, new VisualEffect(Player, ShipVisuals.SHIP_WARP, endTime)); while (Player.Controller.Active && !Player.Controller.StopController) { session = Player.GetGameSession(); if (session == null || Player.Position != startVector || Player.Moving || Player.Controller.Attack.Attacking || Player.Controller.Attack.GetActiveAttackers().Count > 0) { Packet.Builder.ShipWarpCanceledCommand(session); return; // cancel } if (DateTime.Now >= endTime) { break; } Packet.Builder.LegacyModule(session, "0|A|STM|msg_swcountdown_p|%SECONDS%|" + -(DateTime.Now - endTime).Seconds); await Task.Delay(1000); } Packet.Builder.ShipWarpCompletedCommand(session); TargetHangar.Spacemap = map; TargetHangar.Position = startVector; Player.Equipment.ChangeHangar(TargetHangar); }
public virtual void SetPosition(Vector targetPosition) { Destination = targetPosition; Position = targetPosition; OldPosition = targetPosition; Direction = targetPosition; Moving = false; MovementController.Move(this, MovementController.ActualPosition(this)); }
public void MoveOut(Player player) { if (player?.GetGameSession() == null) { return; } var tuple = player.GetClosestStation(true); MovementController.Move(player, MovementController.ActualPosition(player)); player.VirtualWorldId = 0; player.MoveToMap(tuple.Item2, tuple.Item1, 0); }
private void CheckCollection() { lock (this) { if (Collector == null || LastCollectionCheck.AddMilliseconds(500) > DateTime.Now) { return; } var player = Collector as Player; MovementController.ActualPosition(Collector); if (player == null || Collector.Moving || Collector.EntityState != EntityStates.ALIVE || player.Information.BootyKeys[0] < 0 || (player.Position.Y - 50 == player.Position.Y && player.Position.X == Position.X)) { var session = player?.GetGameSession(); if (session != null) { player.State.CollectingLoot = false; Packet.Builder.LegacyModule(session, "0|A|SLC|0|" + player.Id); } Collector = null; return; } if (CollectionTimeStart.AddSeconds(COLLECTION_TIME) > DateTime.Now || Disposed) { return; } player.Information.UpdateExtraData(); player.Information.BootyKeys[0] -= 1; World.DatabaseManager.UpdateBootyKeys(player); player.Information.DisplayBootyKeys(); RandomiseReward(); BoxReward.ParseRewards(player); Dispose(); Collector = null; player.State.CollectingLoot = false; } LastCollectionCheck = DateTime.Now; }
public override void SetPosition(Vector targetPosition) { ChangePosition(targetPosition); Refresh(); MovementController.Move(this, MovementController.ActualPosition(this)); }
public void Active() { if (Npc.MMOHitDamage > Npc.EICHitDamage && Npc.MMOHitDamage > Npc.VRUHitDamage) { //speed = 1 Npc.LeadingFaction = Faction.MMO; Npc.MovingSpeed = Npc.MMOHitDamage >= 500000 ? 2 : 1; } else if (Npc.EICHitDamage > Npc.MMOHitDamage && Npc.EICHitDamage > Npc.VRUHitDamage) { //speed = 1 Npc.LeadingFaction = Faction.EIC; Npc.MovingSpeed = Npc.EICHitDamage >= 500000 ? 2 : 1; } else if (Npc.VRUHitDamage > Npc.MMOHitDamage && Npc.VRUHitDamage > Npc.EICHitDamage) { Npc.LeadingFaction = Faction.VRU; Npc.MovingSpeed = Npc.VRUHitDamage >= 500000 ? 2 : 1; } else { Npc.MovingSpeed = 0; Npc.LeadingFaction = Faction.NONE; } switch (Npc.LeadingFaction) { case Faction.MMO: if (!Npc.Moving) { MovementController.Move(Npc, MmoPortal.Position); } break; case Faction.EIC: if (!Npc.Moving) { MovementController.Move(Npc, EicPortal.Position); } break; case Faction.VRU: if (!Npc.Moving) { MovementController.Move(Npc, VruPortal.Position); } break; default: if (Npc.Moving) { MovementController.Move(Npc, MovementController.ActualPosition(Npc)); } break; } if (Npc.LastCombatTime.AddSeconds(3) < DateTime.Now) { Npc.MMOHitDamage = 0; Npc.EICHitDamage = 0; Npc.VRUHitDamage = 0; Npc.LeadingFaction = Faction.NONE; Npc.MovingSpeed = 0; } }
public void Active() { var npc = Controller.Npc; if (npc.Selected == null || Controller.Attack.MainAttacker != null && Controller.Attack.MainAttacker != npc.Selected || npc.Selected.EntityState == EntityStates.DEAD) { if (Controller.Attack.GetActiveAttackers().Count == 0) { var firstOrDefalt = npc.Spacemap.Entities.Values.FirstOrDefault(x => x is Player); npc.Selected = firstOrDefalt; } else { npc.Selected = Controller.Attack.MainAttacker; } } else { if (SelectedDestination != null && Vector.IsPositionInCircle(SelectedDestination, MovementController.ActualPosition(npc.SelectedCharacter), 350)) { MovementController.Move(npc, SelectedDestination); } else { if (SelectedDestination == null || !Vector.IsPositionInCircle(SelectedDestination, npc.Selected.Position, 350)) { SelectedDestination = Vector.GetPosOnCircle(npc.Selected.Position, 350); } } } // Circle & attack the player }