예제 #1
0
        public override void Tick()
        {
            lock (ThreadLocker)
            {
                if (GetGameSession() == null)
                {
                    Invalidate();
                    return;
                }

                if (!Controller.Active || EntityState == EntityStates.DEAD)
                {
                    return;
                }

                base.Tick();

                LevelChecker();
                TickBoosters();
                AssembleEnemyWarn();
                TickEvents();
                TickTechs();
                TickAbilities();
                TickQuests();
                TickAnnouncements();
                Skylab.Tick();
                Gates.Tick();
                State.Tick();
                Information.Tick();
            }
        }
예제 #2
0
 public void ResetPlayer()
 {
     Unloaded = true;
     Storage.UnloadAll();
     Storage.Clean();
     State.Reset();
     Range.Clean();
     Unloaded = false;
 }
예제 #3
0
 public override void Invalidate()
 {
     lock (ThreadLocker)
     {
         Save();
         Unloaded = true;
         base.Invalidate();
         Pet?.Invalidate();
         Controller?.Exit();
         Storage.Clean();
         State.Reset();
     }
 }
예제 #4
0
 public void AssembleEnemyWarn()
 {
     if (GetGameSession() == null)
     {
         return;
     }
     if (Spacemap != null && State.IsOnHomeMap())
     {
         var count = Spacemap.Entities.Count(
             x => x.Value.FactionId != FactionId && x.Value.FactionId != Faction.NONE);
         if (EnemyWarningLevel != count)
         {
             Packet.Builder.LegacyModule(GetGameSession(),
                                         "0|n|w|" + count); //enemy warning
         }
         EnemyWarningLevel = count;
     }
 }
예제 #5
0
        private void InitializeClasses()
        {
            try
            {
                Equipment     = new Equipment(this);
                Statistics    = World.DatabaseManager.LoadStatistics(this);
                Information   = new Information(this);
                State         = new State(this);
                Storage       = new Storage(this);
                Boosters      = World.DatabaseManager.LoadBoosters(this);
                Abilities     = Hangar.Ship.Abilities(this);
                Settings      = new Settings(this);
                Skylab        = World.DatabaseManager.LoadSkylab(this);
                Pet           = World.DatabaseManager.LoadPet(this);
                QuestData     = new QuestPlayerData(this);
                Announcements = new Announcements(this);
                Gates         = new PlayerGates(this);
                World.DatabaseManager.SavePlayerHangar(this, Hangar);
            }
            catch (Exception exception)
            {
                // getting rid of user
                Console.WriteLine("Exception found.. Disconnecting user");
                Console.WriteLine("Exception: " + exception + ";" + exception.StackTrace + ";" + exception.Message);

                var session = GetGameSession();
                if (session != null)
                {
                    session.Kick();
                }
                else
                {
                    Invalidate();
                }
            }
        }