Newer
Older
Import / projects / Gameloft / core / Network / ServerConfig.cpp
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "Network/ServerConfig.h"

JSON_SERIALIZE_BASE_CLASS(ServerConfig)
JSON_AREA_BEGIN("credentials")
JSON_SERIALIZE(m_username, "username");
JSON_SERIALIZE(m_password, "password");
JSON_SERIALIZE(m_scope, "scope");
JSON_SERIALIZE(m_clientId, "clientId");
JSON_SERIALIZE(m_dataCenterName, "dataCenterName");
JSON_AREA_END()

JSON_AREA_BEGIN("baserates")
JSON_SERIALIZE(m_expectedLongestFedRequestTime, "expectedLongestFedRequestTime");
JSON_SERIALIZE(m_opponentUpdateInterval, "opponentUpdateInterval");
JSON_SERIALIZE(m_maxFinalSetInventoryValuesTime, "maxFinalSetInventoryValuesTime");
JSON_SERIALIZE(m_maxFinalSyncInventoryRetries, "maxFinalSyncInventoryRetries");
JSON_AREA_END()

JSON_AREA_BEGIN("clientrates")
JSON_SERIALIZE(m_clientPingInterval, "clientPingInterval");
JSON_AREA_END()

JSON_AREA_BEGIN("rates")
JSON_SERIALIZE(m_serverPingInterval, "serverPingInterval");
JSON_SERIALIZE(m_adbandonConnectionThreshold, "abandonConnectionThreshold");
JSON_SERIALIZE(m_inDangerThreshold, "inDangerThreshold");
JSON_SERIALIZE(m_saveInterval, "saveInterval");
JSON_SERIALIZE(m_forceSaveInterval, "forceSaveInterval");
JSON_SERIALIZE(m_forceSaveCount,  "forceSaveCount");
JSON_SERIALIZE(m_matchmakingInterval, "matchmakingInterval");
JSON_SERIALIZE(m_profileLockedRetryInterval, "profileLockedRetryInterval");
JSON_SERIALIZE(m_maxFinalProfileFlushTime, "maxFinalProfileFlushTime");
JSON_SERIALIZE(m_levelUpCrmRefreshTimeArray, "levelUpCrmRefreshTimeArray");
JSON_AREA_END()

JSON_AREA_BEGIN("internals")
JSON_SERIALIZE(m_recvTimeout, "recvTimeout");
JSON_SERIALIZE(m_updateFrequencyHz, "updateFrequency");
JSON_SERIALIZE(m_svnRevision, "svnRev");
JSON_SERIALIZE(m_targetSendBuffer, "targetSendBuf");
JSON_SERIALIZE(m_targetRecvBuffer, "targetRecvBuf");
JSON_SERIALIZE(m_resizeThreshold, "resizeThreshold");
JSON_SERIALIZE(m_threadPoolSize, "threadPoolSize");
JSON_SERIALIZE(m_crmCfgIntervalCheck, "crmCfgIntervalCheck");
JSON_SERIALIZE(m_version, "ver");
JSON_AREA_END()

JSON_AREA_BEGIN("logging")
JSON_SERIALIZE(m_logLevel, "logLevel");
JSON_SERIALIZE(m_messageStatsEnabled, "msgStats");
JSON_SERIALIZE(m_sendSeverSideTrackersEnabled, "serverTrackers");
JSON_SERIALIZE(m_serverSideGlotTrackingEventIDs, "glotEventIDs");
JSON_AREA_END()
JSON_AREA_BEGIN("gameplay")
JSON_SERIALIZE(m_autoReset, "shouldAutoReset");
JSON_SERIALIZE(m_cheatsEnabled, "cheatsEnabled");
JSON_AREA_END()
JSON_AREA_BEGIN("security")
JSON_SERIALIZE(m_canClientDisableInactivityCheck, "canClientDisableInactivityCheck");
JSON_SERIALIZE(m_allowedClientIds, "allowedClientIds");
JSON_SERIALIZE(m_batchProfileMigrationAllowed, "batchProfileMigrationAllowed");
JSON_AREA_END()
JSON_AREA_BEGIN("leaderboard")
JSON_SERIALIZE(m_leagueLeaderboardName, "leagueLeaderboardName");
JSON_SERIALIZE(m_globalLeaderboardName, "globalLeaderboardName");
JSON_SERIALIZE(m_localLeaderboardName, "localLeaderboardName");
JSON_SERIALIZE(m_geoLocationLeaderboardDistance, "geoLocationDistance");
JSON_SERIALIZE(m_geoLocationLeaderboardCenterOnUser, "geoLocationCenterOnUser");
JSON_SERIALIZE(m_leagueLeaderboardBaseTime, "leagueLeaderboardBaseTime");
JSON_SERIALIZE(m_leagueLeaderboardDuration, "leagueLeaderboardDuration");
JSON_SERIALIZE(m_leagueLeaderboardTierJson, "leagueLeaderboardTierJson");
JSON_AREA_END()
JSON_AREA_BEGIN("seshat")
JSON_SERIALIZE(m_matcherList, "matcherList");
JSON_SERIALIZE(m_matcherIncludes, "matcherIncludes");
JSON_SERIALIZE(m_bSortMatchesByDifficulty, "sortByDifficulty");
JSON_SERIALIZE(m_forcedCompatiblitySuffix, "forcedCompatibilitySuffix");
JSON_SERIALIZE(m_forcedCompatiblityHash, "forcedCompatibilityHash");
JSON_SERIALIZE(m_maxOpponentPlayerLevelsAbove, "maxOpponentPlayerLevelsAbove");
JSON_SERIALIZE(m_maxOpponentPlayerLevelsBelow, "maxOpponentPlayerLevelsBelow");
JSON_SERIALIZE(m_maxOpponentTrophiesAbove, "maxOpponentTrophiesAbove");
JSON_SERIALIZE(m_maxOpponentTrophiesBelow, "maxOpponentTrophiesBelow");
JSON_SERIALIZE(m_targetFreeOpponentSize, "targetFreeOpponentSize");
JSON_AREA_END()

JSON_AREA_BEGIN("tracking")
JSON_SERIALIZE(m_bSendServerSideTrackingEvents, "sendServerSideTrackingEvents");
JSON_SERIALIZE(m_targetUpdatePeriod, "updatePeriod");
JSON_SERIALIZE(m_targetInitEvePeriod, "initEvePollUpdatePeriod");
JSON_SERIALIZE(m_flushEventPeriod, "flushEventPeriod");
JSON_SERIALIZE(m_maxPendingPackages, "maxPendingQueueSize");
JSON_AREA_END()

JSON_AREA_BEGIN("notifications")
JSON_SERIALIZE(m_notificationType, "type");
JSON_SERIALIZE(m_notificationWnsType, "wnsType");
JSON_AREA_END()

JSON_AREA_BEGIN("db_cache")
JSON_SERIALIZE(m_cacheDB, "on");
JSON_SERIALIZE(m_cacheDBRefreshTimeout, "refresh");
JSON_AREA_END()

JSON_AREA_BEGIN("shields")
JSON_SERIALIZE(m_ShieldAttackThresholdCount, "thresholdCount")
JSON_SERIALIZE(m_ShieldAttackThresholdDuration, "thresholdDuration")
JSON_SERIALIZE(m_ShieldDuration, "duration")
JSON_AREA_END()

JSON_AREA_BEGIN("crew")
JSON_SERIALIZE(m_clanCategoryName, "clanCatNm");
JSON_SERIALIZE(m_clanLeaderboardName, "clanLdbNm");
JSON_SERIALIZE(m_clanStatusIntervalCheck, "clanStatusIntervalCheck");
JSON_SERIALIZE(m_clanWallPostLifeTime, "clanWallPostLifeTime");
JSON_AREA_END()

JSON_AREA_BEGIN("crm")
JSON_SERIALIZE(m_ageLimitationCountries, "ageLimitationCountries");
JSON_AREA_END()
JSON_SERIALIZE_END()

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ServerConfig::ApplySecurityLock(const ServerConfig& lock)
{
#ifndef OS_WIN32
  m_autoReset         = m_autoReset && lock.m_autoReset;
  m_cheatsEnabled     = m_cheatsEnabled && lock.m_cheatsEnabled;
#endif
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////