mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Realms: Realmlist refactors
* Removed global realm variable from World and use RealmList everywhere * Match auth build key with client version * Restored allowedSecurityLevel checks for realmlist packet building * Restored updating population field, mysteriously removed 15 years ago inf20b25d1c9(cherry picked from commitc4b710446d) # Conflicts: # sql/base/auth_database.sql
This commit is contained in:
@@ -30,7 +30,7 @@ EndScriptData */
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
///- Get the accounts with GM Level >0
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
|
||||
stmt->setUInt8(0, uint8(SEC_MODERATOR));
|
||||
stmt->setInt32(1, int32(realm.Id.Realm));
|
||||
stmt->setInt32(1, int32(sRealmList->GetCurrentRealmId().Realm));
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "PhasingHandler.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -1781,7 +1781,7 @@ public:
|
||||
|
||||
// Query the prepared statement for login data
|
||||
LoginDatabasePreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
|
||||
stmt2->setInt32(0, int32(realm.Id.Realm));
|
||||
stmt2->setInt32(0, int32(sRealmList->GetCurrentRealmId().Realm));
|
||||
stmt2->setUInt32(1, accId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt2);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ EndScriptData */
|
||||
#include "Config.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
@@ -83,7 +83,8 @@ public:
|
||||
if (account.IsConnected())
|
||||
return { account.GetConnectedSession()->GetRBACData(), false };
|
||||
|
||||
rbac::RBACData* rbac = new rbac::RBACData(account.GetID(), account.GetName(), realm.Id.Realm, AccountMgr::GetSecurity(account.GetID(), realm.Id.Realm));
|
||||
uint32 realmId = sRealmList->GetCurrentRealmId().Realm;
|
||||
rbac::RBACData* rbac = new rbac::RBACData(account.GetID(), account.GetName(), realmId, AccountMgr::GetSecurity(account.GetID(), realmId));
|
||||
rbac->LoadFromDB();
|
||||
|
||||
return { rbac, true };
|
||||
|
||||
@@ -34,7 +34,7 @@ EndScriptData */
|
||||
#include "Log.h"
|
||||
#include "MySQLThreading.h"
|
||||
#include "RBAC.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "UpdateTime.h"
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
@@ -124,14 +124,10 @@ public:
|
||||
{
|
||||
std::string dbPortOutput;
|
||||
|
||||
uint16 dbPort = 0;
|
||||
if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist WHERE id = {}", realm.Id.Realm))
|
||||
dbPort = (*res)[0].GetUInt16();
|
||||
|
||||
if (dbPort)
|
||||
dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: {}) configured in port {}", realm.Id.Realm, dbPort);
|
||||
if (std::shared_ptr<Realm const> currentRealm = sRealmList->GetCurrentRealm())
|
||||
dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: {}) configured in port {}", currentRealm->Id.Realm, currentRealm->Port);
|
||||
else
|
||||
dbPortOutput = Trinity::StringFormat("Realm Id: {} not found in `realmlist` table. Please check your setup", realm.Id.Realm);
|
||||
dbPortOutput = Trinity::StringFormat("Realm Id: {} not found in `realmlist` table. Please check your setup", sRealmList->GetCurrentRealmId().Realm);
|
||||
|
||||
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
|
||||
handler->PSendSysMessage("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
|
||||
@@ -30,7 +30,7 @@ EndScriptData */
|
||||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "SupportMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
@@ -132,7 +132,7 @@ bool ticket_commandscript::HandleTicketAssignToCommand(ChatHandler* handler, cha
|
||||
ObjectGuid targetGuid = sCharacterCache->GetCharacterGuidByName(target);
|
||||
uint32 accountId = sCharacterCache->GetCharacterAccountIdByGuid(targetGuid);
|
||||
// Target must exist and have administrative rights
|
||||
if (!AccountMgr::HasPermission(accountId, rbac::RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, realm.Id.Realm))
|
||||
if (!AccountMgr::HasPermission(accountId, rbac::RBAC_PERM_COMMANDS_BE_ASSIGNED_TICKET, sRealmList->GetCurrentRealmId().Realm))
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
|
||||
return true;
|
||||
@@ -328,7 +328,7 @@ bool ticket_commandscript::HandleTicketUnAssignCommand(ChatHandler* handler, cha
|
||||
{
|
||||
ObjectGuid guid = ticket->GetAssignedToGUID();
|
||||
uint32 accountId = sCharacterCache->GetCharacterAccountIdByGuid(guid);
|
||||
security = AccountMgr::GetSecurity(accountId, realm.Id.Realm);
|
||||
security = AccountMgr::GetSecurity(accountId, sRealmList->GetCurrentRealmId().Realm);
|
||||
}
|
||||
|
||||
// Check security
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "RealmList.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
@@ -97,7 +97,7 @@ class AccountActionIpLogger : public AccountScript
|
||||
|
||||
// We declare all the required variables
|
||||
uint32 playerGuid = accountId;
|
||||
uint32 realmId = realm.Id.Realm;
|
||||
uint32 realmId = sRealmList->GetCurrentRealmId().Realm;
|
||||
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
|
||||
|
||||
// With this switch, we change systemNote so that we have a more accurate phrasing of what type it is.
|
||||
@@ -204,7 +204,7 @@ class CharacterActionIpLogger : public PlayerScript
|
||||
|
||||
// We declare all the required variables
|
||||
uint32 playerGuid = player->GetSession()->GetAccountId();
|
||||
uint32 realmId = realm.Id.Realm;
|
||||
uint32 realmId = sRealmList->GetCurrentRealmId().Realm;
|
||||
const std::string currentIp = player->GetSession()->GetRemoteAddress();
|
||||
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it...
|
||||
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
// Action IP Logger is only intialized if config is set up
|
||||
// Else, this script isn't loaded in the first place: We require no config check.
|
||||
|
||||
uint32 realmId = realm.Id.Realm;
|
||||
uint32 realmId = sRealmList->GetCurrentRealmId().Realm;
|
||||
// Query playerGuid/accountId, as we only have characterGuid
|
||||
std::string systemNote = "ERROR"; // "ERROR" is a placeholder here. We change it later.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user