feat(Core/RealmList): port TrinityCore realm api (#5626)

* feat(Core/RealmList): port TrinityCore realm api

* 1

* whitespace cleanup

* Update data/sql/updates/pending_db_auth/rev_1620114805872279900.sql

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* 1

* 2

* Update data/sql/updates/pending_db_auth/rev_1620114805872279900.sql

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* `

* 1

* small corrects

* finish maybe

* realm.Id.Realm

* ws

* 1

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Kargatum
2021-05-27 05:12:46 +07:00
committed by GitHub
parent 78e1719c80
commit ea5f5f2072
23 changed files with 536 additions and 305 deletions

View File

@@ -18,6 +18,7 @@ EndScriptData */
#include "CryptoGenerics.h"
#include "Language.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "SecretMgr.h"
#include "StringConvert.h"
@@ -796,7 +797,7 @@ public:
}
}
// Check if provided realmID has a negative value other than -1
// Check if provided realm.Id.Realm has a negative value other than -1
if (gmRealmID < -1)
{
handler->SendSysMessage(LANG_INVALID_REALMID);
@@ -804,7 +805,7 @@ public:
return false;
}
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realm.Id.Realm
PreparedStatement* stmt;
if (gmRealmID == -1)
@@ -818,7 +819,7 @@ public:
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM);
stmt->setUInt32(0, targetAccountId);
stmt->setUInt32(1, realmID);
stmt->setUInt32(1, realm.Id.Realm);
}
LoginDatabase.Execute(stmt);

View File

@@ -17,6 +17,7 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "World.h"
@@ -156,7 +157,7 @@ public:
///- Get the accounts with GM Level >0
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
stmt->setUInt8(0, uint8(SEC_MODERATOR));
stmt->setInt32(1, int32(realmID));
stmt->setInt32(1, int32(realm.Id.Realm));
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)

View File

@@ -24,6 +24,7 @@
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "TargetedMovementGenerator.h"
@@ -1909,7 +1910,7 @@ public:
// Query the prepared statement for login data
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
stmt->setInt32(0, int32(realmID));
stmt->setInt32(0, int32(realm.Id.Realm));
stmt->setUInt32(1, accId);
PreparedQueryResult accInfoResult = LoginDatabase.Query(stmt);

View File

@@ -17,6 +17,7 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "TicketMgr.h"
@@ -84,7 +85,7 @@ public:
// Get target information
ObjectGuid targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
uint32 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid.GetCounter());
uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID);
uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realm.Id.Realm);
// Target must exist and have administrative rights
if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
@@ -382,7 +383,7 @@ public:
{
ObjectGuid guid = ticket->GetAssignedToGUID();
uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid.GetCounter());
security = AccountMgr::GetSecurity(accountId, realmID);
security = AccountMgr::GetSecurity(accountId, realm.Id.Realm);
}
// Check security