Jump to content

[PATCH] realm specific GM permissions


Recommended Posts

  • 1 month later...

I manually added in the code, and this is where it died during compile:

g++ -DHAVE_CONFIG_H -I. -I../../../src/game -I../..  -I../../../dep/ACE_wrappers -I../../dep/ACE_wrappers  -I/usr/include/mysql    -I../../src/shared -I../../../src/game -I../../../src/game/../../dep/include -I../../../src/game/../framework -I../../../src/game/../shared -I../../../src/game/../shared/vmap -I../../../src/game/../realmd -DSYSCONFDIR=\\"/opt/evox/etc/\\"   -DDO_MYSQL -g -O2 -MT Level2.o -MD -MP -MF .deps/Level2.Tpo -c -o Level2.o ../../../src/game/Level2.cpp
../../../src/game/Level2.cpp: In member function ‘bool ChatHandler::HandlePInfoCommand(const char*)’:
../../../src/game/Level2.cpp:2173: warning: NULL used in arithmetic
../../../src/game/Level2.cpp:2175: warning: NULL used in arithmetic
../../../src/game/Level2.cpp:2176: error: invalid conversion from ‘uint16’ to ‘AccountTypes’
../../../src/game/Level2.cpp:2178: error: invalid conversion from ‘uint32’ to ‘AccountTypes’
../../../src/game/Level2.cpp:2181: error: invalid conversion from ‘uint32’ to ‘AccountTypes’
make[3]: *** [Level2.o] Error 1

Admittedly, I'm running evo-X, not MaNGOS, but evox synced with MaNGOS just a day or two ago, so I'm willing to bet the same compile error exists in both.

Thanks,

skinlayers

Link to comment
Share on other sites

  • 3 months later...

Here is an update. Works for rev. 10079 (patched manually).

Change this:

-    QueryResult* result = loginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'",accId);
+    QueryResult* result = loginDatabase.PQuery("SELECT a.username, a.gmlevel, a.last_ip, a.last_login, a_fp.accountid, a_fp.security, a_fp.realmid FROM account AS a LEFT JOIN account_forcepermission AS a_fp on a.id = a_fp.accountid WHERE a.id = '%u' ORDER BY FIELD(a_fp.realmid,'%u') DESC", accId, realmID);
    if(result)
    {
        Field* fields = result->Fetch();
        username = fields[0].GetCppString();
-        security = fields[1].GetUInt32();
+
+        if( fields[4].GetUInt32() != NULL && fields[4].GetUInt32() == accId )                // checking to see if account has forced perms
+        {
+            if( fields[6].GetUInt32() != NULL && fields[6].GetUInt32() == realmID )            // if it does, check to see if it has it on the realm
+                security = fields[5].GetUInt16();                                            // if it does, apply forced perm
+            else
+                security = fields[1].GetUInt32();                                            // if it doesn't for realm, apply regular perms
+        }
+        else
+            security = fields[1].GetUInt32();                                                // if it doesn't for account, apply regular perms

        if(!m_session || m_session->GetSecurity() >= security)
        {

To:

-    QueryResult* result = loginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'",accId);
+    QueryResult* result = loginDatabase.PQuery("SELECT a.username, a.gmlevel, a.last_ip, a.last_login, a_fp.accountid, a_fp.security, a_fp.realmid FROM account AS a LEFT JOIN account_forcepermission AS a_fp on a.id = a_fp.accountid WHERE a.id = '%u' ORDER BY FIELD(a_fp.realmid,'%u') DESC", accId, realmID);
    if(result)
    {
        Field* fields = result->Fetch();
        username = fields[0].GetCppString();
-        security = fields[1].GetUInt32();
+
+        if( fields[4].GetUInt32() != NULL && fields[4].GetUInt32() == accId )                // checking to see if account has forced perms
+        {
+            if( fields[6].GetUInt32() != NULL && fields[6].GetUInt32() == realmID )            // if it does, check to see if it has it on the realm
+                security = (AccountTypes)fields[5].GetUInt16();                                            // if it does, apply forced perm
+            else
+                security = (AccountTypes)fields[1].GetUInt32();                                            // if it doesn't for realm, apply regular perms
+        }
+        else
+            security = (AccountTypes)fields[1].GetUInt32();                                                // if it doesn't for account, apply regular perms

        if(!m_session || m_session->GetSecurity() >= security)
        {

Thanks to Putra for originally supplying the patch.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use