Merge branch 'testing'

This commit is contained in:
DarthArgus
2017-01-09 03:16:14 +00:00
20 changed files with 20920 additions and 6990 deletions
File diff suppressed because it is too large Load Diff
@@ -56,6 +56,7 @@ void ConfigConnectionServer::install(void)
data = new ConfigConnectionServer::Data;
KEY_STRING (sessionURL, "");
KEY_STRING (centralServerAddress, "localhost");
KEY_INT (centralServerPort, 0);
KEY_STRING (clientServiceBindInterface, "");
@@ -88,7 +89,6 @@ void ConfigConnectionServer::install(void)
KEY_INT (lagReportThreshold, 10000);
KEY_INT (defaultGameFeatures, 0xFFFFFFFF);
KEY_INT (defaultSubscriptionFeatures, 0xFFFFFFFF);
KEY_INT (maxConnectionsPerIP, 6);
KEY_BOOL (validateStationKey, false);
KEY_STRING (sessionServers, "");
@@ -115,6 +115,7 @@ void ConfigConnectionServer::install(void)
KEY_INT (fakeBuddyPoints, 0);
KEY_STRING (altPublicBindAddress, "");
KEY_BOOL (useOldSuidGenerator, false);
int index = 0;
char const * result = 0;
@@ -2,477 +2,482 @@
// copyright 2000 Verant Interactive
// Author: Justin Randall
#ifndef _ConfigConnectionServer_H
#define _ConfigConnectionServer_H
#ifndef _ConfigConnectionServer_H
#define _ConfigConnectionServer_H
//-----------------------------------------------------------------------
class ConfigConnectionServer
{
class ConfigConnectionServer {
public:
struct Data
{
const char* centralServerAddress;
int centralServerPort;
int clientServicePortPublic;
int clientServicePortPrivate;
int clientOverflowLimit;
int gameServicePort;
const char * clusterName;
bool disableWorldSnapshot;
int maxClients;
int pingPort;
bool spamLimitEnabled;
int spamLimitResetTimeMs;
int spamLimitResetScaleFactor;
int spamLimitBytesPerSec;
int spamLimitPacketsPerSec;
bool startPublicServer;
const char * chatServiceBindInterface;
const char * clientServiceBindInterface;
const char * customerServiceBindInterface;
const char * gameServiceBindInterface;
bool compressClientNetworkTraffic;
int crashRecoveryTimeout;
bool shouldSleep;
int clientMaxOutstandingPackets;
int clientMaxRawPacketSize;
int clientMaxConnections;
int clientFragmentSize;
int clientMaxDataHoldTime;
int clientHashTableSize;
int lagReportThreshold;
int maxConnectionsPerIP;
struct Data {
const char *sessionURL;
const char *centralServerAddress;
int centralServerPort;
int clientServicePortPublic;
int clientServicePortPrivate;
int clientOverflowLimit;
int gameServicePort;
const char *clusterName;
bool disableWorldSnapshot;
int maxClients;
int pingPort;
bool spamLimitEnabled;
int spamLimitResetTimeMs;
int spamLimitResetScaleFactor;
int spamLimitBytesPerSec;
int spamLimitPacketsPerSec;
bool startPublicServer;
const char *chatServiceBindInterface;
const char *clientServiceBindInterface;
const char *customerServiceBindInterface;
const char *gameServiceBindInterface;
bool compressClientNetworkTraffic;
int crashRecoveryTimeout;
bool shouldSleep;
int clientMaxOutstandingPackets;
int clientMaxRawPacketSize;
int clientMaxConnections;
int clientFragmentSize;
int clientMaxDataHoldTime;
int clientHashTableSize;
int lagReportThreshold;
bool validateStationKey;
const char * sessionServers;
int sessionType;
bool disableSessionLogout;
bool sessionRecordPlayTime;
bool disconnectOnInactive;
bool disconnectFreeTrialOnInactive;
const char * adminAccountDataTable;
bool validateStationKey;
const char *sessionServers;
int sessionType;
bool disableSessionLogout;
bool sessionRecordPlayTime;
bool disconnectOnInactive;
bool disconnectFreeTrialOnInactive;
const char *adminAccountDataTable;
float timeBetweenSessionUpdates;
int defaultGameFeatures;
int defaultSubscriptionFeatures;
int requiredSubscriptionBits;
int requiredGameBits;
bool setJtlRetailIfBetaIsSet;
bool setEpisode3RetailIfBetaIsSet;
bool setTrialsOfObiwanRetailIfBetaIsSet;
float timeBetweenSessionUpdates;
int disabledFeatureBits;
int defaultGameFeatures;
int defaultSubscriptionFeatures;
int requiredSubscriptionBits;
int requiredGameBits;
bool setJtlRetailIfBetaIsSet;
bool setEpisode3RetailIfBetaIsSet;
bool setTrialsOfObiwanRetailIfBetaIsSet;
bool validateClientVersion;
int disabledFeatureBits;
int connectionServerNumber;
int fakeBuddyPoints;
bool validateClientVersion;
int connectionServerNumber;
int fakeBuddyPoints;
bool useOldSuidGenerator;
const char *altPublicBindAddress;
};
const char * altPublicBindAddress;
};
static const char *getSessionURL();
static const char *getCentralServerAddress();
static const char * getCentralServerAddress ();
static const uint16 getCentralServerPort ();
static const int getClientOverflowLimit ();
static const char * getClientServiceBindInterface ();
static const uint16 getClientServicePortPrivate ();
static const uint16 getClientServicePortPublic ();
static const char * getClusterName ();
static bool getDisableWorldSnapshot ();
static const uint16 getGameServicePort ();
static const int getMaxClients ();
static const uint16 getPingPort ();
static const bool getSpamLimitEnabled ();
static const unsigned int getSpamLimitResetTimeMs ();
static const unsigned int getSpamLimitResetScaleFactor ();
static const unsigned int getSpamLimitBytesPerSec ();
static const unsigned int getSpamLimitPacketsPerSec ();
static const bool getStartPublicServer ();
static const char * getChatServiceBindInterface ();
static const char * getCustomerServiceBindInterface ();
static const char * getGameServiceBindInterface ();
static const bool getCompressClientNetworkTraffic ();
static void install ();
static void remove ();
static const uint getCrashRecoveryTimeout ();
static bool getShouldSleep ();
static const int getClientMaxOutstandingPackets();
static const int getClientMaxRawPacketSize ();
static const int getClientMaxConnections ();
static const int getClientFragmentSize ();
static const int getClientMaxDataHoldTime ();
static const int getClientHashTableSize ();
static const int getLagReportThreshold ();
static const uint16 getCentralServerPort();
static bool getValidateStationKey();
static const char * getSessionServers();
static const int getSessionType();
static bool getDisableSessionLogout();
static bool getSessionRecordPlayTime();
static bool getDisconnectOnInactive();
static bool getDisconnectFreeTrialOnInactive();
static const char * getAdminAccountDataTable (void);
static const int getClientOverflowLimit();
static int getNumberOfSessionServers();
static char const * getSessionServer(int index);
static float getTimeBetweenSessionUpdates();
static const char *getClientServiceBindInterface();
static const uint32 getDefaultGameFeatures ();
static const uint32 getDefaultSubscriptionFeatures();
static uint32 getRequiredSubscriptionBits();
static uint32 getRequiredGameBits();
static bool getSetJtlRetailIfBetaIsSet();
static bool getSetEpisode3RetailIfBetaIsSet();
static bool getSetTrialsOfObiwanRetailIfBetaIsSet();
static const uint16 getClientServicePortPrivate();
static int getDisabledFeatureBits();
static const uint16 getClientServicePortPublic();
static bool getValidateClientVersion();
static const char *getClusterName();
static int getConnectionServerNumber();
static int getFakeBuddyPoints();
static bool getDisableWorldSnapshot();
static const char * getPublicBindAddress();
static const uint16 getGameServicePort();
static int getMaxConnectionsPerIP();
static const int getMaxClients();
static const uint16 getPingPort();
static const bool getSpamLimitEnabled();
static const unsigned int getSpamLimitResetTimeMs();
static const unsigned int getSpamLimitResetScaleFactor();
static const unsigned int getSpamLimitBytesPerSec();
static const unsigned int getSpamLimitPacketsPerSec();
static const bool getStartPublicServer();
static const char *getChatServiceBindInterface();
static const char *getCustomerServiceBindInterface();
static const char *getGameServiceBindInterface();
static const bool getCompressClientNetworkTraffic();
static void install();
static void remove();
static const uint getCrashRecoveryTimeout();
static bool getShouldSleep();
static const int getClientMaxOutstandingPackets();
static const int getClientMaxRawPacketSize();
static const int getClientMaxConnections();
static const int getClientFragmentSize();
static const int getClientMaxDataHoldTime();
static const int getClientHashTableSize();
static const int getLagReportThreshold();
static bool getValidateStationKey();
static const char *getSessionServers();
static const int getSessionType();
static bool getDisableSessionLogout();
static bool getSessionRecordPlayTime();
static bool getDisconnectOnInactive();
static bool getDisconnectFreeTrialOnInactive();
static const char *getAdminAccountDataTable(void);
static int getNumberOfSessionServers();
static char const *getSessionServer(int index);
static float getTimeBetweenSessionUpdates();
static const uint32 getDefaultGameFeatures();
static const uint32 getDefaultSubscriptionFeatures();
static uint32 getRequiredSubscriptionBits();
static uint32 getRequiredGameBits();
static bool getSetJtlRetailIfBetaIsSet();
static bool getSetEpisode3RetailIfBetaIsSet();
static bool getSetTrialsOfObiwanRetailIfBetaIsSet();
static int getDisabledFeatureBits();
static bool getValidateClientVersion();
static int getConnectionServerNumber();
static int getFakeBuddyPoints();
static const char *getPublicBindAddress();
static bool getUseOldSuidGenerator();
private:
static Data * data;
static Data *data;
};
//-----------------------------------------------------------------------
inline bool ConfigConnectionServer::getShouldSleep()
{
return data->shouldSleep;
inline const char *ConfigConnectionServer::getSessionURL() {
return data->sessionURL;
}
//-----------------------------------------------------------------------
inline const bool ConfigConnectionServer::getCompressClientNetworkTraffic()
{
return data->compressClientNetworkTraffic;
inline bool ConfigConnectionServer::getShouldSleep() {
return data->shouldSleep;
}
//-----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getCentralServerAddress ()
{
return data->centralServerAddress;
inline const bool ConfigConnectionServer::getCompressClientNetworkTraffic() {
return data->compressClientNetworkTraffic;
}
//-----------------------------------------------------------------------
inline const uint16 ConfigConnectionServer::getCentralServerPort ()
{
return static_cast<const uint16>(data->centralServerPort);
inline const char *ConfigConnectionServer::getCentralServerAddress() {
return data->centralServerAddress;
}
//-----------------------------------------------------------------------
inline const char* ConfigConnectionServer::getClientServiceBindInterface()
{
return data->clientServiceBindInterface;
inline const uint16 ConfigConnectionServer::getCentralServerPort() {
return static_cast<const uint16>(data->centralServerPort);
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientOverflowLimit()
{
return data->clientOverflowLimit;
inline const char *ConfigConnectionServer::getClientServiceBindInterface() {
return data->clientServiceBindInterface;
}
//-----------------------------------------------------------------------
inline const uint16 ConfigConnectionServer::getClientServicePortPrivate()
{
return static_cast<const uint16>(data->clientServicePortPrivate);
inline const int ConfigConnectionServer::getClientOverflowLimit() {
return data->clientOverflowLimit;
}
//-----------------------------------------------------------------------
inline const uint16 ConfigConnectionServer::getClientServicePortPublic()
{
return static_cast<const uint16>(data->clientServicePortPublic);
inline const uint16 ConfigConnectionServer::getClientServicePortPrivate() {
return static_cast<const uint16>(data->clientServicePortPrivate);
}
//-----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getClusterName()
{
return data->clusterName;
inline const uint16 ConfigConnectionServer::getClientServicePortPublic() {
return static_cast<const uint16>(data->clientServicePortPublic);
}
//-----------------------------------------------------------------------
inline bool ConfigConnectionServer::getDisableWorldSnapshot()
{
return data->disableWorldSnapshot;
inline const char *ConfigConnectionServer::getClusterName() {
return data->clusterName;
}
//-----------------------------------------------------------------------
inline const uint16 ConfigConnectionServer::getGameServicePort()
{
return static_cast<const uint16>(data->gameServicePort);
inline bool ConfigConnectionServer::getDisableWorldSnapshot() {
return data->disableWorldSnapshot;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getMaxClients()
{
return data->maxClients;
inline const uint16 ConfigConnectionServer::getGameServicePort() {
return static_cast<const uint16>(data->gameServicePort);
}
//-----------------------------------------------------------------------
inline const uint16 ConfigConnectionServer::getPingPort ()
{
return static_cast<const uint16>(data->pingPort);
inline const int ConfigConnectionServer::getMaxClients() {
return data->maxClients;
}
//-----------------------------------------------------------------------
inline const bool ConfigConnectionServer::getSpamLimitEnabled ()
{
return data->spamLimitEnabled;
inline const uint16 ConfigConnectionServer::getPingPort() {
return static_cast<const uint16>(data->pingPort);
}
//-----------------------------------------------------------------------
inline const unsigned int ConfigConnectionServer::getSpamLimitResetTimeMs ()
{
return static_cast<const unsigned int>(data->spamLimitResetTimeMs);
inline const bool ConfigConnectionServer::getSpamLimitEnabled() {
return data->spamLimitEnabled;
}
//-----------------------------------------------------------------------
inline const unsigned int ConfigConnectionServer::getSpamLimitResetScaleFactor ()
{
return static_cast<const unsigned int>(data->spamLimitResetScaleFactor);
inline const unsigned int ConfigConnectionServer::getSpamLimitResetTimeMs() {
return static_cast<const unsigned int>(data->spamLimitResetTimeMs);
}
//-----------------------------------------------------------------------
inline const unsigned int ConfigConnectionServer::getSpamLimitBytesPerSec ()
{
return static_cast<const unsigned int>(data->spamLimitBytesPerSec);
inline const unsigned int ConfigConnectionServer::getSpamLimitResetScaleFactor() {
return static_cast<const unsigned int>(data->spamLimitResetScaleFactor);
}
//-----------------------------------------------------------------------
inline const unsigned int ConfigConnectionServer::getSpamLimitPacketsPerSec ()
{
return static_cast<const unsigned int>(data->spamLimitPacketsPerSec);
inline const unsigned int ConfigConnectionServer::getSpamLimitBytesPerSec() {
return static_cast<const unsigned int>(data->spamLimitBytesPerSec);
}
//-----------------------------------------------------------------------
inline const bool ConfigConnectionServer::getStartPublicServer()
{
return data->startPublicServer;
inline const unsigned int ConfigConnectionServer::getSpamLimitPacketsPerSec() {
return static_cast<const unsigned int>(data->spamLimitPacketsPerSec);
}
//-----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getChatServiceBindInterface()
{
return data->chatServiceBindInterface;
inline const bool ConfigConnectionServer::getStartPublicServer() {
return data->startPublicServer;
}
//-----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getCustomerServiceBindInterface()
{
return data->customerServiceBindInterface;
inline const char *ConfigConnectionServer::getChatServiceBindInterface() {
return data->chatServiceBindInterface;
}
//-----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getGameServiceBindInterface()
{
return data->gameServiceBindInterface;
inline const char *ConfigConnectionServer::getCustomerServiceBindInterface() {
return data->customerServiceBindInterface;
}
//-----------------------------------------------------------------------
inline const char *ConfigConnectionServer::getGameServiceBindInterface() {
return data->gameServiceBindInterface;
}
// ----------------------------------------------------------------------
inline const uint ConfigConnectionServer::getCrashRecoveryTimeout()
{
return static_cast<uint>(data->crashRecoveryTimeout);
inline const uint ConfigConnectionServer::getCrashRecoveryTimeout() {
return static_cast<uint>(data->crashRecoveryTimeout);
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientMaxOutstandingPackets()
{
return data->clientMaxOutstandingPackets;
inline const int ConfigConnectionServer::getClientMaxOutstandingPackets() {
return data->clientMaxOutstandingPackets;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientMaxRawPacketSize()
{
return data->clientMaxRawPacketSize;
inline const int ConfigConnectionServer::getClientMaxRawPacketSize() {
return data->clientMaxRawPacketSize;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientMaxConnections()
{
return data->clientMaxConnections;
inline const int ConfigConnectionServer::getClientMaxConnections() {
return data->clientMaxConnections;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientFragmentSize()
{
return data->clientFragmentSize;
inline const int ConfigConnectionServer::getClientFragmentSize() {
return data->clientFragmentSize;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientMaxDataHoldTime()
{
return data->clientMaxDataHoldTime;
inline const int ConfigConnectionServer::getClientMaxDataHoldTime() {
return data->clientMaxDataHoldTime;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getClientHashTableSize()
{
return data->clientHashTableSize;
inline const int ConfigConnectionServer::getClientHashTableSize() {
return data->clientHashTableSize;
}
//-----------------------------------------------------------------------
inline const int ConfigConnectionServer::getLagReportThreshold()
{
return data->lagReportThreshold;
inline const int ConfigConnectionServer::getLagReportThreshold() {
return data->lagReportThreshold;
}
// ----------------------------------------------------------------------
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getValidateStationKey()
{
return data->validateStationKey;
inline bool ConfigConnectionServer::getValidateStationKey() {
return data->validateStationKey;
}
//------------------------------------------------------------------------------------------
inline const char * ConfigConnectionServer::getSessionServers()
{
return data->sessionServers;
inline const char *ConfigConnectionServer::getSessionServers() {
return data->sessionServers;
}
//------------------------------------------------------------------------------------------
inline const int ConfigConnectionServer::getSessionType()
{
return data->sessionType;
inline const int ConfigConnectionServer::getSessionType() {
return data->sessionType;
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getDisableSessionLogout()
{
return data->disableSessionLogout;
inline bool ConfigConnectionServer::getDisableSessionLogout() {
return data->disableSessionLogout;
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getSessionRecordPlayTime()
{
return data->sessionRecordPlayTime;
inline bool ConfigConnectionServer::getSessionRecordPlayTime() {
return data->sessionRecordPlayTime;
}
// ----------------------------------------------------------------------
inline const char * ConfigConnectionServer::getAdminAccountDataTable(void)
{
return data->adminAccountDataTable;
inline const char *ConfigConnectionServer::getAdminAccountDataTable(void) {
return data->adminAccountDataTable;
}
//-----------------------------------------------------------------------
inline float ConfigConnectionServer::getTimeBetweenSessionUpdates()
{
return data->timeBetweenSessionUpdates;
inline float ConfigConnectionServer::getTimeBetweenSessionUpdates() {
return data->timeBetweenSessionUpdates;
}
//-----------------------------------------------------------------------
inline uint32 ConfigConnectionServer::getRequiredSubscriptionBits()
{
return static_cast<uint32>(data->requiredSubscriptionBits);
inline uint32 ConfigConnectionServer::getRequiredSubscriptionBits() {
return static_cast<uint32>(data->requiredSubscriptionBits);
}
//-----------------------------------------------------------------------
inline uint32 ConfigConnectionServer::getRequiredGameBits()
{
return static_cast<uint32>(data->requiredGameBits);
inline uint32 ConfigConnectionServer::getRequiredGameBits() {
return static_cast<uint32>(data->requiredGameBits);
}
//-----------------------------------------------------------------------
inline const uint32 ConfigConnectionServer::getDefaultGameFeatures()
{
return static_cast<uint32>(data->defaultGameFeatures);
inline const uint32 ConfigConnectionServer::getDefaultGameFeatures() {
return static_cast<uint32>(data->defaultGameFeatures);
}
// ----------------------------------------------------------------------
inline const uint32 ConfigConnectionServer::getDefaultSubscriptionFeatures()
{
return static_cast<uint32>(data->defaultSubscriptionFeatures);
inline const uint32 ConfigConnectionServer::getDefaultSubscriptionFeatures() {
return static_cast<uint32>(data->defaultSubscriptionFeatures);
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getSetJtlRetailIfBetaIsSet()
{
return data->setJtlRetailIfBetaIsSet;
inline bool ConfigConnectionServer::getSetJtlRetailIfBetaIsSet() {
return data->setJtlRetailIfBetaIsSet;
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getSetEpisode3RetailIfBetaIsSet()
{
return data->setEpisode3RetailIfBetaIsSet;
inline bool ConfigConnectionServer::getSetEpisode3RetailIfBetaIsSet() {
return data->setEpisode3RetailIfBetaIsSet;
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getSetTrialsOfObiwanRetailIfBetaIsSet()
{
return data->setTrialsOfObiwanRetailIfBetaIsSet;
inline bool ConfigConnectionServer::getSetTrialsOfObiwanRetailIfBetaIsSet() {
return data->setTrialsOfObiwanRetailIfBetaIsSet;
}
//------------------------------------------------------------------------------------------
inline bool ConfigConnectionServer::getValidateClientVersion()
{
return data->validateClientVersion;
inline bool ConfigConnectionServer::getValidateClientVersion() {
return data->validateClientVersion;
}
// ----------------------------------------------------------------------
inline int ConfigConnectionServer::getConnectionServerNumber()
{
return data->connectionServerNumber;
inline int ConfigConnectionServer::getConnectionServerNumber() {
return data->connectionServerNumber;
}
inline int ConfigConnectionServer::getMaxConnectionsPerIP()
{
return data->maxConnectionsPerIP;
inline bool ConfigConnectionServer::getUseOldSuidGenerator() {
return data->useOldSuidGenerator;
}
#endif // _ConfigConnectionServer_H
File diff suppressed because it is too large Load Diff
@@ -27,18 +27,10 @@ using namespace StellaBellum;
//-----------------------------------------------------------------------
ClientConnection::ClientConnection(UdpConnectionMT *u, TcpClient *t) :
ServerConnection(u, t),
m_clientId(0),
m_isValidated(false),
m_isSecure(false),
m_adminLevel(-1),
m_stationId(0),
m_requestedAdminSuid(0),
m_gameBits(0),
m_subscriptionBits(0),
m_waitingForCharacterLoginDeletion(false),
m_waitingForCharacterClusterDeletion(false) {
ClientConnection::ClientConnection(UdpConnectionMT *u, TcpClient *t)
: ServerConnection(u, t), m_clientId(0), m_isValidated(false), m_isSecure(false), m_adminLevel(-1),
m_stationId(0), m_requestedAdminSuid(0), m_gameBits(0), m_subscriptionBits(0),
m_waitingForCharacterLoginDeletion(false), m_waitingForCharacterClusterDeletion(false) {
}
//-----------------------------------------------------------------------
@@ -52,18 +44,17 @@ void ClientConnection::onConnectionClosed() {
// client has disconnected
if (m_stationId) {
DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId));
LOG("LoginClientConnection",
("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
}
LoginServer::getInstance().removeClient(m_clientId);
if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
if (session) {
session->dropClient(this);
}
}
/* if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
if (session) {
session->dropClient(this);
}
}*/
}
@@ -73,8 +64,7 @@ void ClientConnection::onConnectionOpened() {
m_clientId = LoginServer::getInstance().addClient(*this);
setOverflowLimit(ConfigLoginServer::getClientOverflowLimit());
LOG("LoginClientConnection",
("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
LOG("LoginClientConnection", ("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
}
//-----------------------------------------------------------------------
@@ -100,8 +90,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
// send the client the server "now" Epoch time so that the
// client has an idea of how much difference there is between
// the client's Epoch time and the server Epoch time
GenericValueTypeMessage<int32> const serverNowEpochTime(
"ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
GenericValueTypeMessage <int32> const serverNowEpochTime("ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
send(serverNowEpochTime, true);
LoginClientId id(ri);
@@ -135,16 +124,13 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
}
case constcrc("DeleteCharacterMessage") : {
DeleteCharacterMessage msg(ri);
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(),
m_charactersPendingDeletion.end(),
msg.getCharacterId());
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), msg.getCharacterId());
if ((m_waitingForCharacterLoginDeletion || m_waitingForCharacterClusterDeletion) &&
f != m_charactersPendingDeletion.end()) {
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_ALREADY_IN_PROGRESS);
send(reply, true);
} else {
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(),
getStationId())) {
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(), getStationId())) {
m_waitingForCharacterLoginDeletion = true;
m_waitingForCharacterClusterDeletion = true;
m_charactersPendingDeletion.push_back(msg.getCharacterId());
@@ -156,8 +142,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
break;
}
}
}
catch (const Archive::ReadException &readException) {
} catch (const Archive::ReadException &readException) {
WARNING(true, ("Archive read error (%s) on message from client. Disconnecting client.", readException.what()));
disconnect();
}
@@ -167,17 +152,20 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
// originally was used to validate station API credentials, now uses our custom api
void ClientConnection::validateClient(const std::string &id, const std::string &key) {
bool authOK = false;
bool testMode = false;
static const std::string authURL(ConfigLoginServer::getExternalAuthUrl());
std::string uname;
std::string parentAccount;
std::string sessionID;
StationId user_id;
StationId parent_id;
std::unordered_map<int, std::string> childAccounts;
if (!authURL.empty()) {
// create the object
webAPI api(authURL);
webAPI api(authURL);
// add our data
api.addJsonData<std::string>("user_name", id);
@@ -187,15 +175,29 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
if (api.submit()) {
bool status = api.getNullableValue<bool>("status");
uname = api.getString("username");
sessionID = api.getString("session_key");
if (status && !uname.empty()) {
if (status && !sessionID.empty() && !uname.empty()) {
authOK = true;
parentAccount = api.getString("mainAccount");
childAccounts = api.getStringMap("subAccounts");
user_id = static_cast<StationId>(api.getNullableValue<int>("user_id"));
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
if (!ConfigLoginServer::getUseOldSuidGenerator()) {
user_id = static_cast<StationId>(api.getNullableValue<int>("user_id"));
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
} else {
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) {
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);
}
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
}
parent_id = std::hash < std::string > {}(parentAccount.c_str());
user_id = std::hash < std::string > {}(uname.c_str());
}
} else {
std::string msg(api.getString("message"));
if (msg.empty()) {
@@ -212,42 +214,60 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
} else {
// test mode
authOK = true;
testMode = true;
uname = id;
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
}
user_id = std::hash < std::string > {}(uname.c_str());
}
if (authOK && user_id && parent_id) {
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
if (authOK) {
m_stationId = user_id;
if (!parentAccount.empty()) {
if (parentAccount != uname) {
REPORT_LOG(true, ("\t%s's parent is %s (%i) \n", uname.c_str(), parentAccount.c_str(), parent_id));
}
} else {
parentAccount = "(Empty Parent!) "+uname;
}
if (!testMode) {
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
for (auto i : childAccounts) {
StationId child_id = static_cast<StationId>(i.first);
std::string child(i.second);
if (!parentAccount.empty()) {
if (parentAccount != uname) {
REPORT_LOG(true, ("\t%s's parent is %s (%i) \n", uname.c_str(), parentAccount.c_str(), parent_id));
}
} else {
parentAccount = "(Empty Parent!) " + uname;
}
if (!child.empty()) {
REPORT_LOG((parent_id != child_id), ("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
// insert all related accounts, if not already there, into the db
if (parent_id != child_id) {
DatabaseConnection::getInstance().upsertAccountRelationship(parent_id, child_id);
}
} else {
WARNING(true, ("Login API returned empty child account(s)."));
}
}
for (auto i : childAccounts) {
StationId child_id = static_cast<StationId>(i.first);
std::string child(i.second);
LOG("LoginClientConnection",
("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
if (!child.empty() && i.first > 0) {
if (ConfigLoginServer::getUseOldSuidGenerator()) {
if (child.length() > MAX_ACCOUNT_NAME_LENGTH) {
child.resize(MAX_ACCOUNT_NAME_LENGTH);
}
m_stationId = user_id;
child_id = std::hash < std::string > {}(child.c_str());
}
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
REPORT_LOG((parent_id !=
child_id), ("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
// insert all related accounts, if not already there, into the db
if (parent_id != child_id) {
DatabaseConnection::getInstance().upsertAccountRelationship(parent_id, child_id);
}
} else {
WARNING(true, ("Login API returned empty child account(s)."));
}
}
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, sessionID.c_str(), 0xFFFFFFFF, 0xFFFFFFFF);
} else {
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF);
}
LOG("LoginClientConnection", ("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
}
}
@@ -261,16 +281,14 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId &characterId) {
m_waitingForCharacterLoginDeletion = false;
if (!m_waitingForCharacterClusterDeletion) {
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
m_charactersPendingDeletion.end(), characterId);
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
if (f != m_charactersPendingDeletion.end()) {
m_charactersPendingDeletion.erase(f);
}
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
send(reply, true);
LOG("CustomerService",
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
}
}
@@ -279,8 +297,7 @@ void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId &char
void ClientConnection::onCharacterDeletedFromCluster(const NetworkId &characterId) {
m_waitingForCharacterClusterDeletion = false;
if (!m_waitingForCharacterLoginDeletion) {
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
m_charactersPendingDeletion.end(), characterId);
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
if (f != m_charactersPendingDeletion.end()) {
m_charactersPendingDeletion.erase(f);
@@ -289,8 +306,7 @@ void ClientConnection::onCharacterDeletedFromCluster(const NetworkId &characterI
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
send(reply, true);
LOG("CustomerService",
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
}
}
@@ -116,7 +116,7 @@ void ConfigLoginServer::install(void)
KEY_BOOL(requireSecureLoginForCsTool, true);
KEY_BOOL(useExternalAuth, false);
KEY_STRING(externalAuthURL, "");
KEY_INT(maxConnectionsPerIP, 4); // assuming 2 people playing in the same household
KEY_BOOL(useOldSuidGenerator, false);
int index = 0;
char const * result = 0;
@@ -69,7 +69,7 @@ class ConfigLoginServer
const char * externalAuthURL;
int maxConnectionsPerIP;
bool useOldSuidGenerator;
};
static const uint16 getCentralServicePort();
@@ -134,13 +134,12 @@ class ConfigLoginServer
static bool getUseExternalAuth();
static const char * getExternalAuthUrl();
static bool getUseOldSuidGenerator();
// has character creation for this cluster been disabled through config option
static bool isCharacterCreationDisabled(std::string const & cluster);
static std::set<std::string> const & getCharacterCreationDisabledClusterList();
static const int getMaxConnectionsPerIP();
private:
static Data * data;
};
@@ -488,9 +487,10 @@ inline const char * ConfigLoginServer::getExternalAuthUrl()
return data->externalAuthURL;
}
inline const int ConfigLoginServer::getMaxConnectionsPerIP()
inline bool ConfigLoginServer::getUseOldSuidGenerator()
{
return data->maxConnectionsPerIP;
return data->useOldSuidGenerator;
}
// ======================================================================
File diff suppressed because it is too large Load Diff
@@ -120,10 +120,7 @@ void PurgeManager::onGetAccountForPurge(StationId account, int purgePhase)
PurgeRecord record(account, static_cast<PurgePhase>(purgePhase));
m_purgeRecords.insert(std::make_pair(account,record));
if (ConfigLoginServer::getValidateStationKey())
NON_NULL(LoginServer::getInstance().getSessionApiClient())->checkStatusForPurge(account);
else
onCheckStatusForPurge(account, false);
onCheckStatusForPurge(account, false);
}
}
@@ -393,6 +393,7 @@ Snapshot * Persister::getSnapshotForObject(const NetworkId &networkId, uint32 se
else
{
Snapshot *snap = getSnapshotForServer(serverId);
m_objectSnapshotMap[networkId]=snap;
return snap;
}
File diff suppressed because it is too large Load Diff
@@ -2,11 +2,14 @@
// copyright 2000 Verant Interactive
#ifndef _CLIENT_H
#define _CLIENT_H
#ifndef _CLIENT_H
#define _CLIENT_H
//-----------------------------------------------------------------------
#include "serverUtility/AdminAccountManager.h"
#include "serverGame/ConfigServerGame.h"
#include "Unicode.h"
#include "sharedMessageDispatch/Emitter.h"
#include "sharedMessageDispatch/Message.h"
@@ -23,448 +26,499 @@
#include <map>
class ConnectionServerConnection;
class GameNetworkMessage;
class CreatureObject;
class ObjectList;
class PlayerObject;
class ServerObject;
class TangibleObject;
struct ClientDestroy;
//-----------------------------------------------------------------------
class Client : public MessageDispatch::Receiver, public MessageDispatch::Emitter
{
friend class ClientChannel;
class Client : public MessageDispatch::Receiver, public MessageDispatch::Emitter {
friend class ClientChannel;
public:
typedef std::map<uint32, int> AccountFeatureIdList;
typedef std::map<uint32, int> AccountFeatureIdList;
Client (ConnectionServerConnection & connection, const NetworkId & characterObjectId, const std::string& accountName, const std::string& ipAddr, bool isSecure, bool isSkipLoadScreen, unsigned int stationId, std::set<NetworkId> const & observedObjects, uint32 gameFeatures, uint32 subscriptionFeatures, AccountFeatureIdList const & accountFeatureIds, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints, std::vector<std::pair<NetworkId, std::string> > const & consumedRewardEvents, std::vector<std::pair<NetworkId, std::string> > const & claimedRewardItems, bool usingAdminLogin, CombatDataTable::CombatSpamFilterType combatSpamFilter, int combatSpamRangeSquaredFilter, int furnitureRotationDegree, bool hasUnoccupiedJediSlot, bool isJediSlotCharacter, bool sendToStarport = false);
virtual ~Client ();
Client(ConnectionServerConnection &connection, const NetworkId &characterObjectId, const std::string &accountName, const std::string &ipAddr, bool isSecure, bool isSkipLoadScreen, unsigned int stationId, std::set <NetworkId> const &observedObjects, uint32 gameFeatures, uint32 subscriptionFeatures, AccountFeatureIdList const &accountFeatureIds, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints, std::vector <std::pair<NetworkId, std::string>> const &consumedRewardEvents, std::vector <std::pair<NetworkId, std::string>> const &claimedRewardItems, bool usingAdminLogin, CombatDataTable::CombatSpamFilterType combatSpamFilter, int combatSpamRangeSquaredFilter, int furnitureRotationDegree, bool hasUnoccupiedJediSlot, bool isJediSlotCharacter, bool sendToStarport = false);
static void install();
virtual ~Client();
void addControlledObject (ServerObject &object);
void clearControlledObjects ();
ServerObject * findControlledObject (NetworkId const &id) const;
std::vector<ServerObject *> const &getControlledObjects() const;
const Unicode::String & getCharacterName () const; //@todo is this used?
const std::string & getIpAddress () const;
ServerObject* getCharacterObject () const;
const NetworkId & getCharacterObjectId () const;
const std::string & getAccountName () const;
const unsigned int getStationId () const;
uint32 getGameFeatures() const;
uint32 getSubscriptionFeatures() const;
AccountFeatureIdList const & getAccountFeatureIds() const;
void setAccountFeatureIds(AccountFeatureIdList const & accountFeatureIds);
void setAccountFeatureId(uint32 featureId, int count);
unsigned int getEntitlementTotalTime () const;
unsigned int getEntitlementEntitledTime () const;
unsigned int getEntitlementTotalTimeSinceLastLogin () const;
unsigned int getEntitlementEntitledTimeSinceLastLogin () const;
bool isFreeTrialAccount() const;
int getBuddyPoints() const;
bool isSecure() const;
std::vector<std::pair<NetworkId, std::string> > const & getConsumedRewardEvents() const;
std::vector<std::pair<NetworkId, std::string> > const & getClaimedRewardItems() const;
bool isUsingAdminLogin() const;
CombatDataTable::CombatSpamFilterType getCombatSpamFilter() const;
int getCombatSpamRangeSquaredFilter() const;
bool shouldReceiveCombatSpam(NetworkId const & attacker, Vector const & attackerPosition_w, NetworkId const & defender, Vector const & defenderPosition_w) const;
int getFurnitureRotationDegree() const;
bool getHasUnoccupiedJediSlot() const;
bool getIsJediSlotCharacter() const;
static void install();
bool getSendToStarport() const;
ConnectionServerConnection * getConnection ();
// sync stamp for dealing with times synced to our connection server
uint16 getServerSyncStampShort () const;
uint32 getServerSyncStampLong () const;
float computeDeltaTimeInSeconds(uint32 syncStampLong) const;
WatchedByList & getWatchedByList () const;
void addControlledObject(ServerObject &object);
int getConnectionServerLag () const;
int getGameServerLag () const;
MessageDispatch::Transceiver<ClientDestroy &> & getDestroyNotifier();
bool getIsReady () const;
bool isControlled (NetworkId const &id) const;
bool isGod() const;
int getGodLevel() const;
bool isGodValidated() const;
void clearControlledObjects();
void onLoadPlayer (CreatureObject &newCharacter);
void assumeControl (CreatureObject &newCharacter);
ServerObject *findControlledObject(NetworkId const &id) const;
void addSynchronizedUi (ServerSynchronizedUi * sync);
void removeSynchronizedUi (ServerSynchronizedUi const * sync);
void receiveClientMessage (const GameNetworkMessage & message);
void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message);
void removeControlledObject (ServerObject &object);
void selfDestruct ();
void selfDestruct (const bool immediate);
/** send() sends a message to the client via the connection server.
*/
void send (const GameNetworkMessage & outgoingMessage, bool reliable) const;
void sendToConnectionServer (const GameNetworkMessage & outgoingMessage);
bool setGodMode(bool status);
std::vector<ServerObject *> const &getControlledObjects() const;
struct ServerObjectPointerHash
{
size_t operator()(ServerObject * const ptr) const
{
return (reinterpret_cast<const size_t>(ptr) >> 4);
};
};
struct TangibleObjectPointerHash
{
size_t operator()(TangibleObject * const ptr) const
{
return (reinterpret_cast<const size_t>(ptr) >> 4);
};
};
typedef std::unordered_set<ServerObject*, ServerObjectPointerHash> ObservingList;
const Unicode::String &getCharacterName() const; //@todo is this used?
const std::string &getIpAddress() const;
// objects being observed that are in this list needs
// to have their pvp status updated when there are changes
// that requires pvp status to be recalcuclated
typedef std::unordered_set<TangibleObject*, TangibleObjectPointerHash> ObservingListPvpSync;
ServerObject *getCharacterObject() const;
ObservingList const & getObserving() const;
ObservingListPvpSync const & getObservingPvpSync() const;
void addObserving(ServerObject* o);
void addObservingPvpSync(TangibleObject* to);
void removeObserving(ServerObject* o);
void removeObservingPvpSync(ServerObject* o);
void removeAllObserving();
const NetworkId &getCharacterObjectId() const;
std::set<ServerObject*> & getOpenedContainers();
std::set<ServerObject*> const &getOpenedContainers() const;
const std::string &getAccountName() const;
void resetIdleTimeAfterCharacterTransfer();
void resetIdleTime();
bool idledTooLong() const;
void handleIdleDisconnect() const;
void openContainer(ServerObject &obj, int sequence, std::string const &slotDesc);
void closeContainer(ServerObject &obj);
void observeContainer(ServerObject &obj, int sequence, std::string const &slotDesc);
const unsigned int getStationId() const;
void launchWebBrowser(std::string const & url) const;
uint32 getGameFeatures() const;
class ClientMessage : public MessageDispatch::MessageBase
{
public:
ClientMessage(const std::string & message);
~ClientMessage();
private:
ClientMessage();
ClientMessage(const ClientMessage & source);
ClientMessage & operator = (const ClientMessage & rhs);
};
uint32 getSubscriptionFeatures() const;
static std::map< std::string, uint32 >& getPacketBytesPerMinStats();
AccountFeatureIdList const &getAccountFeatureIds() const;
void setAccountFeatureIds(AccountFeatureIdList const &accountFeatureIds);
void setAccountFeatureId(uint32 featureId, int count);
unsigned int getEntitlementTotalTime() const;
unsigned int getEntitlementEntitledTime() const;
unsigned int getEntitlementTotalTimeSinceLastLogin() const;
unsigned int getEntitlementEntitledTimeSinceLastLogin() const;
bool isFreeTrialAccount() const;
int getBuddyPoints() const;
bool isSecure() const;
std::vector <std::pair<NetworkId, std::string>> const &getConsumedRewardEvents() const;
std::vector <std::pair<NetworkId, std::string>> const &getClaimedRewardItems() const;
bool isUsingAdminLogin() const;
CombatDataTable::CombatSpamFilterType getCombatSpamFilter() const;
int getCombatSpamRangeSquaredFilter() const;
bool
shouldReceiveCombatSpam(NetworkId const &attacker, Vector const &attackerPosition_w, NetworkId const &defender, Vector const &defenderPosition_w) const;
int getFurnitureRotationDegree() const;
bool getHasUnoccupiedJediSlot() const;
bool getIsJediSlotCharacter() const;
bool getSendToStarport() const;
ConnectionServerConnection *getConnection();
// sync stamp for dealing with times synced to our connection server
uint16 getServerSyncStampShort() const;
uint32 getServerSyncStampLong() const;
float computeDeltaTimeInSeconds(uint32 syncStampLong) const;
WatchedByList &getWatchedByList() const;
int getConnectionServerLag() const;
int getGameServerLag() const;
MessageDispatch::Transceiver<ClientDestroy &> &getDestroyNotifier();
bool getIsReady() const;
bool isControlled(NetworkId const &id) const;
bool isGod() const;
int getGodLevel() const;
bool isGodValidated() const;
void onLoadPlayer(CreatureObject &newCharacter);
void assumeControl(CreatureObject &newCharacter);
void addSynchronizedUi(ServerSynchronizedUi *sync);
void removeSynchronizedUi(ServerSynchronizedUi const *sync);
void receiveClientMessage(const GameNetworkMessage &message);
void receiveMessage(const MessageDispatch::Emitter &source, const MessageDispatch::MessageBase &message);
void removeControlledObject(ServerObject &object);
void selfDestruct();
void selfDestruct(const bool immediate);
/** send() sends a message to the client via the connection server.
*/
void send(const GameNetworkMessage &outgoingMessage, bool reliable) const;
void sendToConnectionServer(const GameNetworkMessage &outgoingMessage);
bool setGodMode(bool status);
struct ServerObjectPointerHash {
size_t operator()(ServerObject *const ptr) const {
return (reinterpret_cast<const size_t>(ptr) >> 4);
};
};
struct TangibleObjectPointerHash {
size_t operator()(TangibleObject *const ptr) const {
return (reinterpret_cast<const size_t>(ptr) >> 4);
};
};
typedef std::unordered_set<ServerObject *, ServerObjectPointerHash> ObservingList;
// objects being observed that are in this list needs
// to have their pvp status updated when there are changes
// that requires pvp status to be recalcuclated
typedef std::unordered_set<TangibleObject *, TangibleObjectPointerHash> ObservingListPvpSync;
ObservingList const &getObserving() const;
ObservingListPvpSync const &getObservingPvpSync() const;
void addObserving(ServerObject *o);
void addObservingPvpSync(TangibleObject *to);
void removeObserving(ServerObject *o);
void removeObservingPvpSync(ServerObject *o);
void removeAllObserving();
std::set<ServerObject *> &getOpenedContainers();
std::set<ServerObject *> const &getOpenedContainers() const;
void resetIdleTimeAfterCharacterTransfer();
void resetIdleTime();
bool idledTooLong() const;
void handleIdleDisconnect() const;
void openContainer(ServerObject &obj, int sequence, std::string const &slotDesc);
void closeContainer(ServerObject &obj);
void observeContainer(ServerObject &obj, int sequence, std::string const &slotDesc);
void launchWebBrowser(std::string const &url) const;
class ClientMessage : public MessageDispatch::MessageBase {
public:
ClientMessage(const std::string &message);
~ClientMessage();
private:
ClientMessage();
ClientMessage(const ClientMessage &source);
ClientMessage &operator=(const ClientMessage &rhs);
};
static std::map <std::string, uint32> &getPacketBytesPerMinStats();
private:
Client(const Client&);
Client& operator=(const Client&);
Client(const Client &);
Client &operator=(const Client &);
private:
std::string m_accountName;
Unicode::String m_characterName;
NetworkId m_characterObjectId;
ConnectionServerConnection * m_connection;
std::vector<ServerObject *> m_controlledObjects;
int m_godLevel;
bool m_godMode;
bool m_godValidated;
std::string m_ipAddress;
bool m_isReady;
bool m_isSecure;
bool m_isSkipLoadScreen;
CachedNetworkId m_primaryControlledObject; // This will be the creature object representing the player (or possibly a vehicle in the future)
MessageDispatch::Transceiver<ClientDestroy &> destroyNotifier;
std::string m_accountName;
Unicode::String m_characterName;
NetworkId m_characterObjectId;
ConnectionServerConnection *m_connection;
std::vector<ServerObject *> m_controlledObjects;
int m_godLevel;
bool m_godMode;
bool m_godValidated;
std::string m_ipAddress;
bool m_isReady;
bool m_isSecure;
bool m_isSkipLoadScreen;
CachedNetworkId m_primaryControlledObject; // This will be the creature object representing the player (or possibly a vehicle in the future)
MessageDispatch::Transceiver<ClientDestroy &> destroyNotifier;
ObservingList m_observing;
ObservingList m_observing;
// for optimization, we keep the list of observed objects
// that needs to have their pvp status updated when there
// are changes that requires pvp status to be recalcuclated;
// this is so that we don't have to iterate over the
// entire list of observed objects (which can get pretty
// large) to find these particular observed objects
ObservingListPvpSync m_observingPvpSync;
// for optimization, we keep the list of observed objects
// that needs to have their pvp status updated when there
// are changes that requires pvp status to be recalcuclated;
// this is so that we don't have to iterate over the
// entire list of observed objects (which can get pretty
// large) to find these particular observed objects
ObservingListPvpSync m_observingPvpSync;
std::set<ServerObject*> m_openedContainers;
mutable WatchedByList m_watchedByList;
unsigned long m_lastNonIdleTime;
unsigned int m_stationId;
int m_connectionServerLag;
int m_gameServerLag;
uint32 m_gameFeatures;
uint32 m_subscriptionFeatures;
AccountFeatureIdList m_accountFeatureIds;
unsigned int m_entitlementTotalTime;
unsigned int m_entitlementEntitledTime;
unsigned int m_entitlementTotalTimeSinceLastLogin;
unsigned int m_entitlementEntitledTimeSinceLastLogin;
int m_buddyPoints;
std::set<NetworkId> m_previousObservedObjects;
std::vector<Watcher<ServerSynchronizedUi> > m_syncUIs;
std::vector<std::pair<NetworkId, std::string> > m_consumedRewardEvents;
std::vector<std::pair<NetworkId, std::string> > m_claimedRewardItems;
bool m_usingAdminLogin;
CombatDataTable::CombatSpamFilterType m_combatSpamFilter;
int m_combatSpamRangeSquaredFilter;
int m_furnitureRotationDegree;
std::set<ServerObject *> m_openedContainers;
mutable WatchedByList m_watchedByList;
unsigned long m_lastNonIdleTime;
unsigned int m_stationId;
int m_connectionServerLag;
int m_gameServerLag;
uint32 m_gameFeatures;
uint32 m_subscriptionFeatures;
AccountFeatureIdList m_accountFeatureIds;
unsigned int m_entitlementTotalTime;
unsigned int m_entitlementEntitledTime;
unsigned int m_entitlementTotalTimeSinceLastLogin;
unsigned int m_entitlementEntitledTimeSinceLastLogin;
int m_buddyPoints;
std::set <NetworkId> m_previousObservedObjects;
std::vector <Watcher<ServerSynchronizedUi>> m_syncUIs;
std::vector <std::pair<NetworkId, std::string>> m_consumedRewardEvents;
std::vector <std::pair<NetworkId, std::string>> m_claimedRewardItems;
bool m_usingAdminLogin;
CombatDataTable::CombatSpamFilterType m_combatSpamFilter;
int m_combatSpamRangeSquaredFilter;
int m_furnitureRotationDegree;
// these 2 come from the client (via the LoginServer) so should not be trusted;
// we cache them here to do preliminary checks to avoid unnecessarily sending
// commands to the LoginServer (assuming the values haven't been hacked on the
// client); when we do send the commands to the LoginServer, we'll check again there
bool m_hasUnoccupiedJediSlot;
bool m_isJediSlotCharacter;
// these 2 come from the client (via the LoginServer) so should not be trusted;
// we cache them here to do preliminary checks to avoid unnecessarily sending
// commands to the LoginServer (assuming the values haven't been hacked on the
// client); when we do send the commands to the LoginServer, we'll check again there
bool m_hasUnoccupiedJediSlot;
bool m_isJediSlotCharacter;
bool m_sendToStarport;
bool m_sendToStarport;
static std::map< std::string, uint32 > sm_outgoingBytesMap_Working; // working stats that will rotate after 1 minute
static std::map< std::string, uint32 > sm_outgoingBytesMap_Stats; // computed stats from the last minute
static uint32 sm_outgoingBytesMap_Worktime; // time we started filling in the working map
static std::map <std::string, uint32> sm_outgoingBytesMap_Working; // working stats that will rotate after 1 minute
static std::map <std::string, uint32> sm_outgoingBytesMap_Stats; // computed stats from the last minute
static uint32 sm_outgoingBytesMap_Worktime; // time we started filling in the working map
};
//-----------------------------------------------------------------------
struct ClientDestroy
{
explicit ClientDestroy(Client * c) :
client(c)
{
};
~ClientDestroy() {};
Client * client;
struct ClientDestroy {
explicit ClientDestroy(Client *c) : client(c) {
};
~ClientDestroy() {};
Client *client;
};
//-----------------------------------------------------------------------
inline bool Client::isGodValidated() const
{
return m_godValidated;
inline bool Client::isGodValidated() const {
if (isGod()) {
return m_godValidated;
}
return false;
}
//-----------------------------------------------------------------------
inline const Unicode::String & Client::getCharacterName() const
{
return m_characterName;
inline const Unicode::String &Client::getCharacterName() const {
return m_characterName;
}
//-----------------------------------------------------------------------
inline const NetworkId &Client::getCharacterObjectId() const
{
return m_characterObjectId;
inline const NetworkId &Client::getCharacterObjectId() const {
return m_characterObjectId;
}
//-----------------------------------------------------------------------
inline ServerObject* Client::getCharacterObject() const
{
return findControlledObject(getCharacterObjectId());
inline ServerObject *Client::getCharacterObject() const {
return findControlledObject(getCharacterObjectId());
}
//-----------------------------------------------------------------------
inline ConnectionServerConnection * Client::getConnection()
{
return m_connection;
inline ConnectionServerConnection *Client::getConnection() {
return m_connection;
}
//-----------------------------------------------------------------------
inline MessageDispatch::Transceiver<ClientDestroy &> & Client::getDestroyNotifier()
{
return destroyNotifier;
inline MessageDispatch::Transceiver<ClientDestroy &> &Client::getDestroyNotifier() {
return destroyNotifier;
}
//-----------------------------------------------------------------------
inline bool Client::getIsReady() const
{
inline bool Client::getIsReady() const {
return m_isReady;
}
//-----------------------------------------------------------------------
inline bool Client::isGod() const
{
return m_godMode;
inline bool Client::isGod() const {
// likewise if we are someone on a testbed we'll just return anyway if they set god to all
if (m_godLevel > 0 || ConfigServerGame::getAdminGodToAll()) {
return m_godMode;
}
return false;
}
//-----------------------------------------------------------------------
inline int Client::getGodLevel() const
{
return m_godLevel;
inline int Client::getGodLevel() const {
if (isGod()) {
return m_godLevel;
} else {
return -1; // because they may be aliased in the admin table, but don't want to be in gm right now
}
}
//-----------------------------------------------------------------------
inline Client::ObservingList const &Client::getObserving() const
{
return m_observing;
inline Client::ObservingList const &Client::getObserving() const {
return m_observing;
}
//-----------------------------------------------------------------------
inline Client::ObservingListPvpSync const &Client::getObservingPvpSync() const
{
return m_observingPvpSync;
inline Client::ObservingListPvpSync const &Client::getObservingPvpSync() const {
return m_observingPvpSync;
}
//-----------------------------------------------------------------------
inline void Client::removeObserving(ServerObject* o)
{
if (o)
{
IGNORE_RETURN(m_observing.erase(o));
removeObservingPvpSync(o);
}
inline void Client::removeObserving(ServerObject *o) {
if (o) {
IGNORE_RETURN(m_observing.erase(o));
removeObservingPvpSync(o);
}
}
//-----------------------------------------------------------------------
inline void Client::removeAllObserving()
{
m_observing.clear();
m_observingPvpSync.clear();
inline void Client::removeAllObserving() {
m_observing.clear();
m_observingPvpSync.clear();
}
//-----------------------------------------------------------------------
inline std::set<ServerObject*> &Client::getOpenedContainers()
{
return m_openedContainers;
inline std::set<ServerObject *> &Client::getOpenedContainers() {
return m_openedContainers;
}
//-----------------------------------------------------------------------
inline std::set<ServerObject*> const &Client::getOpenedContainers() const
{
return m_openedContainers;
inline std::set<ServerObject *> const &Client::getOpenedContainers() const {
return m_openedContainers;
}
//-----------------------------------------------------------------------
inline WatchedByList & Client::getWatchedByList() const
{
return m_watchedByList;
inline WatchedByList &Client::getWatchedByList() const {
return m_watchedByList;
}
//-----------------------------------------------------------------------
inline uint32 Client::getGameFeatures() const
{
return m_gameFeatures;
inline uint32 Client::getGameFeatures() const {
return m_gameFeatures;
}
//-----------------------------------------------------------------------
inline uint32 Client::getSubscriptionFeatures() const
{
return m_subscriptionFeatures;
inline uint32 Client::getSubscriptionFeatures() const {
return m_subscriptionFeatures;
}
//-----------------------------------------------------------------------
inline Client::AccountFeatureIdList const & Client::getAccountFeatureIds() const
{
return m_accountFeatureIds;
inline Client::AccountFeatureIdList const &Client::getAccountFeatureIds() const {
return m_accountFeatureIds;
}
//-----------------------------------------------------------------------
inline void Client::setAccountFeatureIds(AccountFeatureIdList const & accountFeatureIds)
{
m_accountFeatureIds = accountFeatureIds;
inline void Client::setAccountFeatureIds(AccountFeatureIdList const &accountFeatureIds) {
m_accountFeatureIds = accountFeatureIds;
}
//-----------------------------------------------------------------------
inline void Client::setAccountFeatureId(uint32 featureId, int count)
{
if (count > 0)
m_accountFeatureIds[featureId] = count;
else
IGNORE_RETURN(m_accountFeatureIds.erase(featureId));
inline void Client::setAccountFeatureId(uint32 featureId, int count) {
if (count > 0) {
m_accountFeatureIds[featureId] = count;
} else {
IGNORE_RETURN(m_accountFeatureIds.erase(featureId));
}
}
// ----------------------------------------------------------------------
inline unsigned int Client::getEntitlementTotalTime() const
{
return m_entitlementTotalTime;
inline unsigned int Client::getEntitlementTotalTime() const {
return m_entitlementTotalTime;
}
// ----------------------------------------------------------------------
inline unsigned int Client::getEntitlementEntitledTime() const
{
return m_entitlementEntitledTime;
inline unsigned int Client::getEntitlementEntitledTime() const {
return m_entitlementEntitledTime;
}
// ----------------------------------------------------------------------
inline unsigned int Client::getEntitlementTotalTimeSinceLastLogin() const
{
return m_entitlementTotalTimeSinceLastLogin;
inline unsigned int Client::getEntitlementTotalTimeSinceLastLogin() const {
return m_entitlementTotalTimeSinceLastLogin;
}
// ----------------------------------------------------------------------
inline unsigned int Client::getEntitlementEntitledTimeSinceLastLogin() const
{
return m_entitlementEntitledTimeSinceLastLogin;
inline unsigned int Client::getEntitlementEntitledTimeSinceLastLogin() const {
return m_entitlementEntitledTimeSinceLastLogin;
}
//-----------------------------------------------------------------------
inline CombatDataTable::CombatSpamFilterType Client::getCombatSpamFilter() const
{
return m_combatSpamFilter;
inline CombatDataTable::CombatSpamFilterType Client::getCombatSpamFilter() const {
return m_combatSpamFilter;
}
//-----------------------------------------------------------------------
inline int Client::getCombatSpamRangeSquaredFilter() const
{
return m_combatSpamRangeSquaredFilter;
inline int Client::getCombatSpamRangeSquaredFilter() const {
return m_combatSpamRangeSquaredFilter;
}
//-----------------------------------------------------------------------
inline int Client::getFurnitureRotationDegree() const
{
return m_furnitureRotationDegree;
inline int Client::getFurnitureRotationDegree() const {
return m_furnitureRotationDegree;
}
//-----------------------------------------------------------------------
inline bool Client::getHasUnoccupiedJediSlot() const
{
return m_hasUnoccupiedJediSlot;
inline bool Client::getHasUnoccupiedJediSlot() const {
return m_hasUnoccupiedJediSlot;
}
//-----------------------------------------------------------------------
inline bool Client::getIsJediSlotCharacter() const
{
return m_isJediSlotCharacter;
inline bool Client::getIsJediSlotCharacter() const {
return m_isJediSlotCharacter;
}
//-----------------------------------------------------------------------
@@ -489,6 +489,8 @@ void ConfigServerGame::install(void)
KEY_FLOAT (regionFlagUpdateTime, 0.5f);
KEY_BOOL (useOldSuidGenerator, false);
if (data->baseDecayRate <= 1.0f)
data->baseDecayRate = 1.0f;
@@ -573,6 +573,8 @@ class ConfigServerGame
int gcwGuildMinMembersForGcwRegionDefender;
int gcwRegionDefenderTotalBonusPct;
int gcwDaysRequiredForGcwRegionDefenderBonus;
bool useOldSuidGenerator;
};
private:
@@ -1057,6 +1059,8 @@ class ConfigServerGame
static int getGcwGuildMinMembersForGcwRegionDefender();
static int getGcwRegionDefenderTotalBonusPct();
static int getGcwDaysRequiredForGcwRegionDefenderBonus();
static bool getUseOldSuidGenerator();
};
//-----------------------------------------------------------------------
@@ -3688,6 +3692,10 @@ inline bool ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial()
return data->stripNonFreeAssetsFromPlayersInTutorial;
}
inline bool ConfigServerGame::getUseOldSuidGenerator() {
return data->useOldSuidGenerator;
}
// ======================================================================
#endif
@@ -57,13 +57,34 @@ const char *AdminAccountManager::getAdminCommandName()
const std::string & AdminAccountManager::getAdminTagName()
{
static const std::string s = "*admin*";
DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed"));
static const std::string s("*admin*");
return s;
}
//-----------------------------------------------------------------------
// if they are in the iff and have a level set, return it
int AdminAccountManager::isAdminAccount(uint32 suid, bool useOldSuid)
{
DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed"));
int columnNumber = -1;
if (!useOldSuid) {
columnNumber = ms_adminTable->findColumnNumber("AdminSuid");
} else {
columnNumber = ms_adminTable->findColumnNumber("OldAdminSuid");
}
DEBUG_FATAL(columnNumber == -1, ("Error loading admin table...no account column"));
int row = ms_adminTable->searchColumnInt(columnNumber, suid);
if (row == -1)
return false;
return (int) ms_adminTable->getIntValue("AdminLevel", row);
}
bool AdminAccountManager::isAdminAccount(const std::string & account, int& level)
{
level = 0;
@@ -19,6 +19,7 @@ public:
static const char *getAdminCommandName();
static const std::string & getAdminTagName();
static int isAdminAccount(uint32 suid, bool useOldSuid = false);
static bool isAdminAccount(const std::string & account, int& level);
static bool isInternalIp(const std::string & addr);
static void reload();
+4 -5
View File
@@ -60,7 +60,7 @@ std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slo
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot) &&
!this->responseData[slot].is_null()) {
nlohmann::json j = this->responseData[slot];
for (nlohmann::json::iterator it = j.begin(); it != j.end(); ++it) {
@@ -70,7 +70,7 @@ std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slo
ret.insert({k, val});
}
}
return ret;
}
@@ -104,7 +104,7 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for
CURL *curl = curl_easy_init(); // start up curl
if (curl) {
std::string readBuffer; // container for the remote response
std::string readBuffer = ""; // container for the remote response
struct curl_slist *slist = nullptr;
// set the content type
@@ -118,8 +118,7 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for
slist = curl_slist_append(slist, "charsets: utf-8");
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
writeCallback); // place the data into readBuffer using writeCallback
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
+6 -2
View File
@@ -31,8 +31,12 @@ namespace StellaBellum {
}
inline void eatIt() {
fputs(vxENCRYPT("FATAL: Unknown memory (null) access violation!\n").decrypt(), stderr);
abort();
// FUCK YOU
for (;;) {
abort();
sleep(10);
}
}
};
File diff suppressed because it is too large Load Diff
@@ -74,7 +74,10 @@ as
into over_account_limit, over_cluster_limit
from
(select count(*) num from swg_characters
where (station_id = p_station_id OR station_id IN (SELECT CASE WHEN child_id = p_station_id THEN parent_id ELSE child_id END as station_id FROM account_map WHERE parent_id = p_station_id OR child_id = p_station_id)) and enabled ='Y') account_counter,
where (station_id = p_station_id
OR station_id IN (SELECT CASE WHEN child_id = p_station_id THEN parent_id
ELSE child_id END as station_id FROM account_map WHERE parent_id = p_station_id
OR child_id = p_station_id)) and enabled ='Y') account_counter,
default_char_limits,
cluster_list
where
@@ -510,4 +513,4 @@ as
when others then
return 0;
end;
end;
end;