예제 #1
0
 public static void KickPlayer(ClientInfo _cInfo)
 {
     try
     {
         SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Auto kicked at end of hardcore session\"", _cInfo.playerId), (ClientInfo)null);
         EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfo.entityId);
         PersistentOperations.SavePersistentPlayerDataXML();
         PersistentOperations.RemoveAllClaims(_cInfo.playerId);
         PersistentOperations.RemovePersistentPlayerData(_cInfo.playerId);
         PersistentOperations.RemoveAllACL(_cInfo.playerId);
         Hardcore.ResetHardcoreProfile(_cInfo);
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.KickPlayer: {0}", e.Message));
     }
 }
예제 #2
0
 public static void DisconnectHardcorePlayer(ClientInfo _cInfo)
 {
     try
     {
         EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfo.entityId);
         if (entityPlayer != null)
         {
             if (_cInfo.entityId != -1)
             {
                 Log.Out("Player {0} disconnected after {1} minutes", new object[]
                 {
                     GameUtils.SafeStringFormat(entityPlayer.EntityName),
                     ((Time.timeSinceLevelLoad - entityPlayer.CreationTimeSinceLevelLoad) / 60f).ToCultureInvariantString("0.0")
                 });
             }
         }
         GC.Collect();
         MemoryPools.Cleanup();
         PersistentPlayerData persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_cInfo.playerId);
         if (persistentPlayerData != null)
         {
             persistentPlayerData.LastLogin = DateTime.Now;
             persistentPlayerData.EntityId  = -1;
         }
         PersistentOperations.SavePersistentPlayerDataXML();
         ConnectionManager.Instance.DisconnectClient(_cInfo, false);
         GameManager.Instance.World.aiDirector.RemoveEntity(entityPlayer);
         PersistentOperations.RemoveAllClaims(_cInfo.playerId);
         PersistentOperations.RemovePersistentPlayerData(_cInfo.playerId);
         PersistentOperations.RemoveAllACL(_cInfo.playerId);
         Hardcore.ResetHardcoreProfile(_cInfo);
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.DisconnectHardcorePlayer: {0}.", e.Message));
     }
 }