Skip to content

Commit

Permalink
Core/Realms: Realmlist refactors
Browse files Browse the repository at this point in the history
* 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 in f20b25d
  • Loading branch information
Shauren committed Aug 18, 2024
1 parent 88fea99 commit c4b7104
Show file tree
Hide file tree
Showing 43 changed files with 834 additions and 496 deletions.
4 changes: 3 additions & 1 deletion sql/base/auth_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CREATE TABLE `account` (
`mutetime` bigint NOT NULL DEFAULT '0',
`mutereason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`muteby` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`client_build` int unsigned NOT NULL DEFAULT '0',
`locale` tinyint unsigned NOT NULL DEFAULT '0',
`os` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`timezone_offset` smallint NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -2869,7 +2870,8 @@ INSERT INTO `updates` VALUES
('2024_08_07_00_auth.sql','88070C3A95DE7242B3E3662D7B5B9648128DC187','RELEASED','2024-08-07 01:06:23',0),
('2024_08_09_00_auth.sql','854C24AAF0B3F673DAD8C0F3059DB266B0F34488','RELEASED','2024-08-09 15:40:42',0),
('2024_08_15_00_auth.sql','06E9AD907DC2B2CC0CF78414AB516BBA3ED0CE65','RELEASED','2024-08-15 19:40:50',0),
('2024_08_17_00_auth.sql','3584B5A910334447D6E948DBAA0EEC43C42FE631','RELEASED','2024-08-17 15:17:22',0);
('2024_08_17_00_auth.sql','3584B5A910334447D6E948DBAA0EEC43C42FE631','RELEASED','2024-08-17 15:17:22',0),
('2024_08_18_00_auth.sql','5C1D0A3FE0245F4030FE446288AE533556EC6C9E','RELEASED','2024-08-17 23:01:21',0);
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
1 change: 1 addition & 0 deletions sql/updates/auth/master/2024_08_18_00_auth.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `account` ADD `client_build` int unsigned NOT NULL DEFAULT '0' AFTER `muteby`;
6 changes: 3 additions & 3 deletions src/server/bnetserver/Server/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ uint32 Battlenet::Session::GetLastCharPlayed(std::unordered_map<std::string, Var
auto lastPlayerChar = _gameAccountInfo->LastPlayedCharacters.find(subRegion->string_value());
if (lastPlayerChar != _gameAccountInfo->LastPlayedCharacters.end())
{
std::vector<uint8> compressed = sRealmList->GetRealmEntryJSON(lastPlayerChar->second.RealmId, _build);
std::vector<uint8> compressed = sRealmList->GetRealmEntryJSON(lastPlayerChar->second.RealmId, _build, _gameAccountInfo->SecurityLevel);

if (compressed.empty())
return ERROR_UTIL_SERVER_FAILED_TO_SERIALIZE_RESPONSE;
Expand Down Expand Up @@ -662,7 +662,7 @@ uint32 Battlenet::Session::GetRealmList(std::unordered_map<std::string, Variant
if (Variant const* subRegion = GetParam(params, "Command_RealmListRequest_v1"))
subRegionId = subRegion->string_value();

std::vector<uint8> compressed = sRealmList->GetRealmList(_build, subRegionId);
std::vector<uint8> compressed = sRealmList->GetRealmList(_build, _gameAccountInfo->SecurityLevel, subRegionId);

if (compressed.empty())
return ERROR_UTIL_SERVER_FAILED_TO_SERIALIZE_RESPONSE;
Expand Down Expand Up @@ -698,7 +698,7 @@ uint32 Battlenet::Session::JoinRealm(std::unordered_map<std::string, Variant con
{
if (Variant const* realmAddress = GetParam(params, "Param_RealmAddress"))
return sRealmList->JoinRealm(realmAddress->uint_value(), _build, GetRemoteIpAddress(), _clientSecret, GetLocaleByName(_locale),
_os, _timezoneOffset, _gameAccountInfo->Name, response);
_os, _timezoneOffset, _gameAccountInfo->Name, _gameAccountInfo->SecurityLevel, response);

return ERROR_WOW_SERVICES_INVALID_JOIN_TICKET;
}
Expand Down
8 changes: 4 additions & 4 deletions src/server/database/Database/Implementation/LoginDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
m_stmts.resize(MAX_LOGINDATABASE_STATEMENTS);

PrepareStatement(LOGIN_SEL_REALMLIST, "SELECT id, name, address, localAddress, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild, Region, Battlegroup FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH);
PrepareStatement(LOGIN_UPD_REALM_POPULATION, "UPDATE realmlist SET population = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_IP_INFO, "SELECT unbandate > UNIX_TIMESTAMP() OR unbandate = bandate AS banned, NULL as country FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC);
Expand All @@ -39,7 +40,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_UPD_LOGON, "UPDATE account SET salt = ?, verifier = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, a.os, a.timezone_offset, ba.id, aa.SecurityLevel, "
PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.session_key_bnet, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, a.client_build, a.locale, a.recruiter, a.os, a.timezone_offset, ba.id, aa.SecurityLevel, "
"bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id "
"FROM account a LEFT JOIN account r ON a.id = r.recruiter LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id "
"LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?) LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 "
Expand Down Expand Up @@ -88,7 +89,6 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_LAST_ATTEMPT_IP, "SELECT last_attempt_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_LAST_IP, "SELECT last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_GET_EMAIL_BY_ID, "SELECT email FROM account WHERE id = ?", CONNECTION_SYNCH);
Expand Down Expand Up @@ -129,7 +129,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
" FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account a ON ba.id = a.battlenet_account"
" LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID = -1 WHERE ba.LoginTicket = ? ORDER BY a.id", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_BNET_LAST_LOGIN_INFO, "UPDATE battlenet_accounts SET last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, "UPDATE account SET session_key_bnet = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ?, timezone_offset = ? WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, "UPDATE account SET session_key_bnet = ?, last_ip = ?, last_login = NOW(), client_build = ?, locale = ?, failed_logins = 0, os = ?, timezone_offset = ? WHERE username = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS_BY_ACCOUNT_ID, "SELECT rc.acctid, rc.numchars, r.id, r.Region, r.Battlegroup FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id WHERE rc.acctid = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID, "SELECT rc.acctid, rc.numchars, r.id, r.Region, r.Battlegroup FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id LEFT JOIN account a ON rc.acctid = a.id WHERE a.battlenet_account = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_BNET_LAST_PLAYER_CHARACTERS, "SELECT lpc.accountId, lpc.region, lpc.battlegroup, lpc.realmId, lpc.characterName, lpc.characterGUID, lpc.lastPlayedTime FROM account_last_played_character lpc LEFT JOIN account a ON lpc.accountId = a.id WHERE a.battlenet_account = ?", CONNECTION_ASYNC);
Expand Down Expand Up @@ -162,7 +162,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_REP_ACCOUNT_TOYS, "REPLACE INTO battlenet_account_toys (accountId, itemId, isFavourite, hasFanfare) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);

// Battle Pets
PrepareStatement(LOGIN_SEL_BATTLE_PETS, "SELECT bp.guid, bp.species, bp.breed, bp.displayId, bp.level, bp.exp, bp.health, bp.quality, bp.flags, bp.name, bp.nameTimestamp, bp.owner, dn.genitive, dn.dative, dn.accusative, dn.instrumental, dn.prepositional FROM battle_pets bp LEFT JOIN battle_pet_declinedname dn ON bp.guid = dn.guid WHERE bp.battlenetAccountId = ? AND (bp.ownerRealmId IS NULL OR bp.ownerRealmId = ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_BATTLE_PETS, "SELECT bp.guid, bp.species, bp.breed, bp.displayId, bp.level, bp.exp, bp.health, bp.quality, bp.flags, bp.name, bp.nameTimestamp, bp.owner, bp.ownerRealmId, dn.genitive, dn.dative, dn.accusative, dn.instrumental, dn.prepositional FROM battle_pets bp LEFT JOIN battle_pet_declinedname dn ON bp.guid = dn.guid WHERE bp.battlenetAccountId = ? AND (bp.ownerRealmId IS NULL OR bp.ownerRealmId = ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_INS_BATTLE_PETS, "INSERT INTO battle_pets (guid, battlenetAccountId, species, breed, displayId, level, exp, health, quality, flags, name, nameTimestamp, owner, ownerRealmId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_BATTLE_PETS, "DELETE FROM battle_pets WHERE battlenetAccountId = ? AND guid = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_BATTLE_PETS_BY_OWNER, "DELETE FROM battle_pets WHERE owner = ? AND ownerRealmId = ?", CONNECTION_ASYNC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum LoginDatabaseStatements : uint32
*/

LOGIN_SEL_REALMLIST,
LOGIN_UPD_REALM_POPULATION,
LOGIN_DEL_EXPIRED_IP_BANS,
LOGIN_UPD_EXPIRED_ACCOUNT_BANS,
LOGIN_SEL_IP_INFO,
Expand Down Expand Up @@ -86,7 +87,6 @@ enum LoginDatabaseStatements : uint32
LOGIN_SEL_ACCOUNT_ACCESS_SECLEVEL_TEST,
LOGIN_SEL_ACCOUNT_ACCESS,
LOGIN_SEL_ACCOUNT_WHOIS,
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
LOGIN_DEL_ACCOUNT,
LOGIN_SEL_AUTOBROADCAST,
LOGIN_SEL_LAST_ATTEMPT_IP,
Expand Down
5 changes: 2 additions & 3 deletions src/server/game/Accounts/AccountMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Realm.h"
#include "RealmList.h"
#include "ScriptMgr.h"
#include "SRP6.h"
#include "Util.h"
#include "World.h"
#include "WorldSession.h"

using AccountSRP6 = Trinity::Crypto::SRP::GruntSRP6;
Expand Down Expand Up @@ -503,7 +502,7 @@ void AccountMgr::LoadRBAC()
while (result->NextRow());

TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading default permissions");
result = LoginDatabase.PQuery("SELECT secId, permissionId FROM rbac_default_permissions WHERE (realmId = {} OR realmId = -1) ORDER BY secId ASC", realm.Id.Realm);
result = LoginDatabase.PQuery("SELECT secId, permissionId FROM rbac_default_permissions WHERE (realmId = {} OR realmId = -1) ORDER BY secId ASC", sRealmList->GetCurrentRealmId().Realm);
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty.");
Expand Down
7 changes: 6 additions & 1 deletion src/server/game/Achievements/CriteriaHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,9 +1886,14 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6
return false;
break;
case ModifierTreeType::ClientVersionEqualOrLessThan: // 33
if (reqValue < sRealmList->GetMinorMajorBugfixVersionForBuild(realm.Build))
{
std::shared_ptr<Realm const> currentRealm = sRealmList->GetCurrentRealm();
if (!currentRealm)
return false;
if (reqValue < sRealmList->GetMinorMajorBugfixVersionForBuild(currentRealm->Build))
return false;
break;
}
case ModifierTreeType::BattlePetTeamLevel: // 34
for (WorldPackets::BattlePet::BattlePetSlot const& slot : referencePlayer->GetSession()->GetBattlePetMgr()->GetSlots())
if (slot.Pet.Level < reqValue)
Expand Down
11 changes: 6 additions & 5 deletions src/server/game/BattlePets/BattlePetMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Realm.h"
#include "RealmList.h"
#include "Util.h"
#include "World.h"
#include "WorldSession.h"
Expand Down Expand Up @@ -290,18 +290,19 @@ void BattlePetMgr::LoadFromDB(PreparedQueryResult pets, PreparedQueryResult slot
pet.NameTimestamp = fields[10].GetInt64();
pet.PacketInfo.CreatureID = speciesEntry->CreatureID;

if (!fields[12].IsNull())
if (!fields[13].IsNull())
{
pet.DeclinedName = std::make_unique<DeclinedName>();
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
pet.DeclinedName->name[i] = fields[12 + i].GetString();
pet.DeclinedName->name[i] = fields[13 + i].GetString();
}

if (!ownerGuid.IsEmpty())
{
pet.PacketInfo.OwnerInfo.emplace();
pet.PacketInfo.OwnerInfo->Guid = ownerGuid;
pet.PacketInfo.OwnerInfo->PlayerVirtualRealm = pet.PacketInfo.OwnerInfo->PlayerNativeRealm = GetVirtualRealmAddress();
if (std::shared_ptr<Realm const> ownerRealm = sRealmList->GetRealm(fields[12].GetInt32()))
pet.PacketInfo.OwnerInfo->PlayerVirtualRealm = pet.PacketInfo.OwnerInfo->PlayerNativeRealm = ownerRealm->Id.GetAddress();
}

pet.SaveInfo = BATTLE_PET_UNCHANGED;
Expand Down Expand Up @@ -353,7 +354,7 @@ void BattlePetMgr::SaveToDB(LoginDatabaseTransaction trans)
if (itr->second.PacketInfo.OwnerInfo)
{
stmt->setInt64(12, itr->second.PacketInfo.OwnerInfo->Guid.GetCounter());
stmt->setInt32(13, realm.Id.Realm);
stmt->setInt32(13, sRealmList->GetCurrentRealmId().Realm);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/BlackMarket/BlackMarketMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Realm.h"
#include "RealmList.h"
#include "StringConvert.h"
#include "World.h"
#include "WorldSession.h"
Expand Down Expand Up @@ -285,7 +285,7 @@ void BlackMarketMgr::SendAuctionWonMail(BlackMarketEntry* entry, CharacterDataba
if (!bidderAccId) // Account exists
return;

logGmTrade = AccountMgr::HasPermission(bidderAccId, rbac::RBAC_PERM_LOG_GM_TRADE, realm.Id.Realm);
logGmTrade = AccountMgr::HasPermission(bidderAccId, rbac::RBAC_PERM_LOG_GM_TRADE, sRealmList->GetCurrentRealmId().Realm);

if (logGmTrade && !sCharacterCache->GetCharacterNameByGuid(bidderGuid, bidderName))
bidderName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
Expand Down
9 changes: 5 additions & 4 deletions src/server/game/Chat/Channels/ChannelMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "DB2Stores.h"
#include "Log.h"
#include "Player.h"
#include "Realm.h"
#include "RealmList.h"
#include "World.h"
#include "WorldSession.h"

Expand Down Expand Up @@ -286,9 +286,10 @@ ObjectGuid ChannelMgr::CreateBuiltinChannelGuid(uint32 channelId, AreaTableEntry
zoneId = zoneEntry->ID;

if (channelEntry->GetFlags().HasFlag(ChatChannelFlags::GlobalForTournament))
if (Cfg_CategoriesEntry const* category = sCfgCategoriesStore.LookupEntry(realm.Timezone))
if (category->GetFlags().HasFlag(CfgCategoriesFlags::Tournament))
zoneId = 0;
if (std::shared_ptr<Realm const> currentRealm = sRealmList->GetCurrentRealm())
if (Cfg_CategoriesEntry const* category = sCfgCategoriesStore.LookupEntry(currentRealm->Timezone))
if (category->GetFlags().HasFlag(CfgCategoriesFlags::Tournament))
zoneId = 0;

return ObjectGuid::Create<HighGuid::ChatChannel>(true, channelEntry->GetFlags().HasFlag(ChatChannelFlags::LinkedChannel), zoneId, _team == ALLIANCE ? 3 : 5, channelId);
}
4 changes: 2 additions & 2 deletions src/server/game/Chat/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "ObjectMgr.h"
#include "Optional.h"
#include "Player.h"
#include "Realm.h"
#include "RealmList.h"
#include "StringConvert.h"
#include "World.h"
#include "WorldSession.h"
Expand Down Expand Up @@ -95,7 +95,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
if (target)
target_sec = target->GetSecurity();
else if (target_account)
target_sec = AccountMgr::GetSecurity(target_account, realm.Id.Realm);
target_sec = AccountMgr::GetSecurity(target_account, sRealmList->GetCurrentRealmId().Realm);
else
return true; // caller must report error for (target == nullptr && target_account == 0)

Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Conditions/ConditionMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "PhasingHandler.h"
#include "Player.h"
#include "RaceMask.h"
#include "Realm.h"
#include "RealmList.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "Spell.h"
Expand Down Expand Up @@ -3396,7 +3396,7 @@ static int32(* const WorldStateExpressionFunctions[WSE_FUNCTION_MAX])(Map const*
// WSE_FUNCTION_REGION
[](Map const* /*map*/, uint32 /*arg1*/, uint32 /*arg2*/) -> int32
{
return realm.Id.Region;
return sRealmList->GetCurrentRealmId().Region;
},

// WSE_FUNCTION_CLOCK_HOUR
Expand Down Expand Up @@ -3444,7 +3444,7 @@ static int32(* const WorldStateExpressionFunctions[WSE_FUNCTION_MAX])(Map const*
{
time_t now = GameTime::GetGameTime();
uint32 raidOrigin = 1135695600;
if (Cfg_RegionsEntry const* region = sCfgRegionsStore.LookupEntry(realm.Id.Region))
if (Cfg_RegionsEntry const* region = sCfgRegionsStore.LookupEntry(sRealmList->GetCurrentRealmId().Region))
raidOrigin = region->Raidorigin;

return (now - raidOrigin) / WEEK;
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Object/ObjectGuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "Errors.h"
#include "Hash.h"
#include "Log.h"
#include "Realm.h"
#include "RealmList.h"
#include "Util.h"
#include "World.h"
#include <charconv>
Expand Down Expand Up @@ -815,7 +815,7 @@ static inline uint32 GetRealmIdForObjectGuid(uint32 realmId)
if (realmId)
return realmId;

return realm.Id.Realm;
return sRealmList->GetCurrentRealmId().Realm;
}

ObjectGuid ObjectGuidFactory::CreateNull()
Expand Down
Loading

0 comments on commit c4b7104

Please sign in to comment.