mirror of
https://github.com/SWG-Source/src.git
synced 2026-09-11 23:45:01 -04:00
check GM on the gameserver based on station id because it is most readily available to us. see corresponding change to the datatable
This commit is contained in:
@@ -2227,14 +2227,23 @@ float Client::computeDeltaTimeInSeconds(uint32 const syncStampLong) const
|
||||
|
||||
bool Client::setGodMode(bool value)
|
||||
{
|
||||
// (re?) check god permissions
|
||||
m_godLevel = AdminAccountManager::isAdminAccount(getStationId());
|
||||
|
||||
if (ConfigServerGame::getAdminGodToAll() || (m_godLevel > 0))
|
||||
{
|
||||
m_godValidated = true;
|
||||
if (ConfigServerGame::getAdminGodToAll())
|
||||
m_godLevel = ConfigServerGame::getAdminGodToAllGodLevel();
|
||||
}
|
||||
|
||||
bool wasInGodMode = m_godMode;
|
||||
m_godMode = value;
|
||||
|
||||
|
||||
if (value && !m_godValidated)
|
||||
{
|
||||
LOG("CustomerService", ("Avatar:%s denied god mode because it wasn't validated.", PlayerObject::getAccountDescription(getCharacterObjectId()).c_str() ));
|
||||
m_godMode = false;
|
||||
LOG("CustomerService", ("Avatar:%s denied god mode because it wasn't validated.", PlayerObject::getAccountDescription(getCharacterObjectId()).c_str() ));
|
||||
m_godMode = false;
|
||||
}
|
||||
|
||||
CreatureObject *primaryControlledObject = safe_cast<CreatureObject*>(m_primaryControlledObject.getObject());
|
||||
|
||||
@@ -64,6 +64,20 @@ const std::string & AdminAccountManager::getAdminTagName()
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
// if they are in the iff and have a level set, return it
|
||||
int AdminAccountManager::isAdminAccount(int suid)
|
||||
{
|
||||
DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed"));
|
||||
|
||||
int columnNumber = ms_adminTable->findColumnNumber("AdminSuid");
|
||||
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(int suid);
|
||||
static bool isAdminAccount(const std::string & account, int& level);
|
||||
static bool isInternalIp(const std::string & addr);
|
||||
static void reload();
|
||||
|
||||
Reference in New Issue
Block a user