private void InitializeAssemblies()
        {
            BoosterAssembly        = new BoosterAssembly(this);
            HangarAssembly         = new PlayerHangarAssembly(this);
            MovementAssembly       = new PlayerMovementAssembly(this);
            DroneFormationAssembly = new PlayerDroneFormationAssembly(this);
            AttackAssembly         = new PlayerAttackAssembly(this);
            SpecialItemsAssembly   = new PlayerSpecialItemsAssembly(this);
            EffectsAssembly        = new PlayerEffectsAssembly(this);
            AttackTraceAssembly    = new AttackTraceAssembly(this);
            ZoneAssembly           = new ZoneAssembly(this);
            PlayerTechAssembly     = new PlayerTechAssembly(this);
            PlayerAbilityAssembly  = new PlayerAbilityAssembly(this);
            PlayerGroupAssembly    = new PlayerGroupAssembly(this);
            PlayerItemsAssembly    = new PlayerItemsAssembly(this);

            BoosterAssembly.Multiply(BoosterType.DAMAGE, 1.6);
            BoosterAssembly.Multiply(BoosterType.DAMAGE, 2);

            BoosterAssembly.Multiply(BoosterType.SHIELD, 1.7);
            BoosterAssembly.Multiply(BoosterType.SPEED, 1.2);
            BoosterAssembly.Multiply(BoosterType.HITPOINTS, 1.2);
            BoosterAssembly.Multiply(BoosterType.HIT_RATE, 0.8);

            InitializeTimer();
        }
        private void CheckZonesInRange()
        {
            if (Spacemap == null)
            {
                return;
            }

            // bei einer Base bekommt man dann NAZ, wenn man selber 5sekunden nicht angreift
            // bei einem Portal bekommt man dann NAZ, wenn man selber 5sekunden nicht angreift und 3sekunden nicht angegriffen wurde.

            // Portal NAZ Radius: 500 (Durchmesser 1000)
            // Base NAZ Radius: 1793 (Durchmesser: 3586) (Die Türme bestimmen die NAZ)

            Position currentPosition = MovementAssembly.ActualPosition();

            lock (_checkZonesInRange) {
                bool isNaz    = false;
                bool canEquip = false;

                if (!Spacemap.MapInfo.IsBattleMap)
                {
                    foreach (PortalObject portal in Spacemap.MapInfo.Portals)
                    {
                        if (portal.OwnerFaction.ID == Faction.ID &&
                            portal.Position.DistanceTo(currentPosition) < 500 &&
                            AttackAssembly.LastAttack.FromNow(CurrentClock.ElapsedMilliseconds) > 5000 &&
                            AttackTraceAssembly.LastAttackTime.FromNow(CurrentClock.ElapsedMilliseconds) > 3000)
                        {
                            isNaz = true;
                            break;
                        }
                    }
                }

                foreach (BaseObject @base in Spacemap.MapInfo.Bases)
                {
                    if (@base.OwnerFaction.ID == Faction.ID &&
                        @base.Position.DistanceTo(currentPosition) < 1793 &&
                        AttackAssembly.LastAttack.FromNow(CurrentClock.ElapsedMilliseconds) > 5000)
                    {
                        isNaz    = true;
                        canEquip = true;
                        break;
                    }
                }


                ZoneAssembly.ChangeEquip(canEquip);

                if (isNaz)
                {
                    ZoneAssembly.ShowDMZ();
                }
                else
                {
                    ZoneAssembly.HideDMZ();
                }
            }
        }
        public NpcController(int id, string username, Faction faction) : base(id, username, faction)
        {
            BoosterAssembly     = new BoosterAssembly(this);
            HangarAssembly      = new NpcHangarAssembly(this, Ship.YAMATO, Map.MAP_R_ZONE, new Position(10000, 6000), 1_000_000, 1_000_000);
            MovementAssembly    = new MovementAssembly(this);
            AttackAssembly      = new NpcAttackAssembly(this);
            EffectsAssembly     = new EffectsAssembly(this);
            AttackTraceAssembly = new AttackTraceAssembly(this);
            ZoneAssembly        = new ZoneAssembly(this);

            BoosterAssembly.Set(BoosterType.SHIELD_REGNERATION, 0.05);
            BoosterAssembly.Set(BoosterType.SHIELD_ABSORBATION, 0.5);
            BoosterAssembly.Set(BoosterType.HITPOINTS_REGENERATION, 0.01);

            TimerStart();
            InitializeTimer();

            SpacemapController.For(HangarAssembly.Map.ID).Add(this);
        }
        public async void Refresh(bool wasKilled)
        {
            if (HangarAssembly.Hitpoints <= 0)
            {
                Die();
                return;
            }

            HangarAssembly.Refresh();

            Send(
                ClientConfiguration.UserSettings,
                PacketBuilder.UserKeyBindinsCommand(this),
                PacketBuilder.UIMenuBarsCommand(this),
                PacketBuilder.Slotbar.SlotBarsCommand(this)
                );

            Send(
                new class_884(new List <class_503>()
            {
                new class_571(false, 1)
            }),
                PacketBuilder.Legacy("0|A|BKBB|0"),
                PacketBuilder.Legacy("0|A|BKS|0"),
                PacketBuilder.Legacy("0|A|BKB|0"),
                PacketBuilder.Legacy("0|A|BKPR|0"),
                PacketBuilder.Legacy("0|A|BKR|0"),
                PacketBuilder.Legacy("0|A|BKM|0"),
                PacketBuilder.Legacy("0|A|BK|0"),
                PacketBuilder.Legacy("0|A|JV|0"),
                PacketBuilder.Legacy("0|TR")
                );

            Send(
                PacketBuilder.InitializeShipCommand(this),
                PacketBuilder.DroneCommand(this),
                PacketBuilder.ConfigurationCommand(this),
                PacketBuilder.SpeedChangeCommand(this),
                ZoneAssembly.ZoneCommand(),
                PacketBuilder.Legacy("0|8"), // login done
                PacketBuilder.Legacy("0|7|HS")
                );

            await Task.Delay(750);

            Send(EffectsAssembly.EffectsCommand()
                 .Concat(PlayerTechAssembly.EffectsCommand())
                 .Concat(PlayerAbilityAssembly.EffectsCommand()));

            TimerStart();

            if (wasKilled)
            {
                EffectsAssembly.MakeInvincible(10000);
            }

            lock (_checkMinesInRange) {
                _renderedMines.Clear();
            }

            lock (_checkPlayersInRange) {
                _renderedPlayers.Clear();
            }

            SpacemapController.For(Account.CurrentHangar.MapID).Remove(this);
            SpacemapController.For(Account.CurrentHangar.MapID).Add(this);

            if (Locked != null)   // just for the visuals
            {
                SendLockVisual(Locked);
            }
        }