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 Port From (https://github.com/TrinityCore/TrinityCore/commit/c4b710446d62c95eb8124175203fa5f394912594)
This commit is contained in:
@@ -22,13 +22,15 @@ namespace Game
|
||||
response.SuccessInfo = new AuthResponse.AuthSuccessInfo();
|
||||
response.SuccessInfo.ActiveExpansionLevel = (byte)GetExpansion();
|
||||
response.SuccessInfo.AccountExpansionLevel = (byte)GetAccountExpansion();
|
||||
response.SuccessInfo.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
response.SuccessInfo.Time = (uint)GameTime.GetGameTime();
|
||||
|
||||
var realm = Global.WorldMgr.GetRealm();
|
||||
|
||||
// Send current home realm. Also there is no need to send it later in realm queries.
|
||||
response.SuccessInfo.VirtualRealms.Add(new VirtualRealmInfo(realm.Id.GetAddress(), true, false, realm.Name, realm.NormalizedName));
|
||||
var currentRealm = Global.RealmMgr.GetCurrentRealm();
|
||||
if(currentRealm != null)
|
||||
{
|
||||
response.SuccessInfo.VirtualRealmAddress = currentRealm.Id.GetAddress();
|
||||
response.SuccessInfo.VirtualRealms.Add(new VirtualRealmInfo(currentRealm.Id.GetAddress(), true, false, currentRealm.Name, currentRealm.NormalizedName));
|
||||
}
|
||||
|
||||
if (HasPermission(RBACPermissions.UseCharacterTemplates))
|
||||
foreach (var templ in Global.CharacterTemplateDataStorage.GetCharacterTemplates().Values)
|
||||
|
||||
@@ -608,7 +608,7 @@ namespace Game
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_REALM_CHARACTERS);
|
||||
stmt.AddValue(0, createInfo.CharCount);
|
||||
stmt.AddValue(1, GetAccountId());
|
||||
stmt.AddValue(2, Global.WorldMgr.GetRealm().Id.Index);
|
||||
stmt.AddValue(2, Global.RealmMgr.GetCurrentRealmId().Index);
|
||||
loginTransaction.Append(stmt);
|
||||
|
||||
DB.Login.CommitTransaction(loginTransaction);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Game
|
||||
void SendAvailableHotfixes()
|
||||
{
|
||||
AvailableHotfixes availableHotfixes = new();
|
||||
availableHotfixes.VirtualRealmAddress = Global.WorldMgr.GetRealmId().GetAddress();
|
||||
availableHotfixes.VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
|
||||
|
||||
foreach (var (_, push) in Global.DB2Mgr.GetHotfixData())
|
||||
{
|
||||
|
||||
@@ -330,12 +330,14 @@ namespace Game
|
||||
RealmQueryResponse realmQueryResponse = new();
|
||||
realmQueryResponse.VirtualRealmAddress = queryRealmName.VirtualRealmAddress;
|
||||
|
||||
RealmId realmHandle = new(queryRealmName.VirtualRealmAddress);
|
||||
if (Global.RealmMgr.GetRealmNames(realmHandle, out realmQueryResponse.NameInfo.RealmNameActual, out realmQueryResponse.NameInfo.RealmNameNormalized))
|
||||
var realm = Global.RealmMgr.GetRealm(new RealmId(queryRealmName.VirtualRealmAddress));
|
||||
if (realm != null)
|
||||
{
|
||||
realmQueryResponse.LookupState = (byte)ResponseCodes.Success;
|
||||
realmQueryResponse.NameInfo.IsInternalRealm = false;
|
||||
realmQueryResponse.NameInfo.IsLocal = queryRealmName.VirtualRealmAddress == Global.WorldMgr.GetVirtualRealmAddress();
|
||||
realmQueryResponse.NameInfo.RealmNameActual = realm.Name;
|
||||
realmQueryResponse.NameInfo.RealmNameNormalized = realm.NormalizedName;
|
||||
}
|
||||
else
|
||||
realmQueryResponse.LookupState = (byte)ResponseCodes.Failure;
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// When not found, consult database
|
||||
GetQueryProcessor().AddCallback(Global.AccountMgr.GetSecurityAsync(friendCharacterInfo.AccountId, (int)Global.WorldMgr.GetRealmId().Index, friendSecurity =>
|
||||
GetQueryProcessor().AddCallback(Global.AccountMgr.GetSecurityAsync(friendCharacterInfo.AccountId, (int)Global.RealmMgr.GetCurrentRealmId().Index, friendSecurity =>
|
||||
{
|
||||
if (!Global.AccountMgr.IsPlayerAccount((AccountTypes)friendSecurity))
|
||||
{
|
||||
@@ -280,16 +280,6 @@ namespace Game
|
||||
|
||||
processFriendRequest();
|
||||
}));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.DelFriend)]
|
||||
|
||||
Reference in New Issue
Block a user