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:
@@ -25,7 +25,7 @@ namespace Game
|
||||
{
|
||||
public partial class WorldSession : IDisposable
|
||||
{
|
||||
public WorldSession(uint id, string name, uint battlenetAccountId, WorldSocket sock, AccountTypes sec, Expansion expansion, long mute_time, string os, TimeSpan timezoneOffset, Locale locale, uint recruiter, bool isARecruiter)
|
||||
public WorldSession(uint id, string name, uint battlenetAccountId, WorldSocket sock, AccountTypes sec, Expansion expansion, long mute_time, string os, TimeSpan timezoneOffset, uint build, Locale locale, uint recruiter, bool isARecruiter)
|
||||
{
|
||||
m_muteTime = mute_time;
|
||||
AntiDOS = new DosProtection(this);
|
||||
@@ -37,6 +37,7 @@ namespace Game
|
||||
m_accountExpansion = expansion;
|
||||
m_expansion = (Expansion)Math.Min((byte)expansion, WorldConfig.GetIntValue(WorldCfg.Expansion));
|
||||
_os = os;
|
||||
_clientBuild = build;
|
||||
m_sessionDbcLocale = Global.WorldMgr.GetAvailableDbcLocale(locale);
|
||||
m_sessionDbLocaleIndex = locale;
|
||||
_timezoneOffset = timezoneOffset;
|
||||
@@ -477,7 +478,10 @@ namespace Game
|
||||
|
||||
public void SendConnectToInstance(ConnectToSerial serial)
|
||||
{
|
||||
var instanceAddress = Global.WorldMgr.GetRealm().GetAddressForClient(System.Net.IPAddress.Parse(GetRemoteAddress()));
|
||||
System.Net.IPAddress instanceAddress = null;
|
||||
var currentRealm = Global.RealmMgr.GetCurrentRealm();
|
||||
if (currentRealm != null)
|
||||
instanceAddress = currentRealm.GetAddressForClient(System.Net.IPAddress.Parse(GetRemoteAddress()));
|
||||
|
||||
_instanceConnectKey.AccountId = GetAccountId();
|
||||
_instanceConnectKey.connectionType = ConnectionType.Instance;
|
||||
@@ -489,15 +493,18 @@ namespace Game
|
||||
connectTo.Payload.Port = (ushort)WorldConfig.GetIntValue(WorldCfg.PortInstance);
|
||||
connectTo.Con = (byte)ConnectionType.Instance;
|
||||
|
||||
if (instanceAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
if (instanceAddress != null)
|
||||
{
|
||||
connectTo.Payload.Where.IPv4 = instanceAddress.GetAddressBytes();
|
||||
connectTo.Payload.Where.Type = ConnectTo.AddressType.IPv4;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectTo.Payload.Where.IPv6 = instanceAddress.GetAddressBytes();
|
||||
connectTo.Payload.Where.Type = ConnectTo.AddressType.IPv6;
|
||||
if (instanceAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
connectTo.Payload.Where.IPv4 = instanceAddress.GetAddressBytes();
|
||||
connectTo.Payload.Where.Type = ConnectTo.AddressType.IPv4;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectTo.Payload.Where.IPv6 = instanceAddress.GetAddressBytes();
|
||||
connectTo.Payload.Where.Type = ConnectTo.AddressType.IPv6;
|
||||
}
|
||||
}
|
||||
|
||||
SendPacket(connectTo);
|
||||
@@ -678,6 +685,7 @@ namespace Game
|
||||
public Expansion GetAccountExpansion() { return m_accountExpansion; }
|
||||
public Expansion GetExpansion() { return m_expansion; }
|
||||
public string GetOS() { return _os; }
|
||||
public uint GetClientBuild() { return _clientBuild; }
|
||||
public void SetInQueue(bool state) { m_inQueue = state; }
|
||||
|
||||
public bool IsLogingOut() { return _logoutTime != 0 || m_playerLogout; }
|
||||
@@ -741,9 +749,9 @@ namespace Game
|
||||
AccountTypes secLevel = GetSecurity();
|
||||
|
||||
Log.outDebug(LogFilter.Rbac, "WorldSession.LoadPermissions [AccountId: {0}, Name: {1}, realmId: {2}, secLevel: {3}]",
|
||||
id, _accountName, Global.WorldMgr.GetRealm().Id.Index, secLevel);
|
||||
id, _accountName, Global.RealmMgr.GetCurrentRealmId().Index, secLevel);
|
||||
|
||||
_RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)secLevel);
|
||||
_RBACData = new RBACData(id, _accountName, (int)Global.RealmMgr.GetCurrentRealmId().Index, (byte)secLevel);
|
||||
_RBACData.LoadFromDB();
|
||||
}
|
||||
|
||||
@@ -753,9 +761,9 @@ namespace Game
|
||||
AccountTypes secLevel = GetSecurity();
|
||||
|
||||
Log.outDebug(LogFilter.Rbac, "WorldSession.LoadPermissions [AccountId: {0}, Name: {1}, realmId: {2}, secLevel: {3}]",
|
||||
id, _accountName, Global.WorldMgr.GetRealm().Id.Index, secLevel);
|
||||
id, _accountName, Global.RealmMgr.GetCurrentRealmId().Index, secLevel);
|
||||
|
||||
_RBACData = new RBACData(id, _accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)secLevel);
|
||||
_RBACData = new RBACData(id, _accountName, (int)Global.RealmMgr.GetCurrentRealmId().Index, (byte)secLevel);
|
||||
return _RBACData.LoadFromDBAsync();
|
||||
}
|
||||
|
||||
@@ -839,7 +847,7 @@ namespace Game
|
||||
|
||||
bool hasPermission = _RBACData.HasPermission(permission);
|
||||
Log.outDebug(LogFilter.Rbac, "WorldSession:HasPermission [AccountId: {0}, Name: {1}, realmId: {2}]",
|
||||
_RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Index);
|
||||
_RBACData.GetId(), _RBACData.GetName(), Global.RealmMgr.GetCurrentRealmId().Index);
|
||||
|
||||
return hasPermission;
|
||||
}
|
||||
@@ -847,7 +855,7 @@ namespace Game
|
||||
public void InvalidateRBACData()
|
||||
{
|
||||
Log.outDebug(LogFilter.Rbac, "WorldSession:Invalidaterbac:RBACData [AccountId: {0}, Name: {1}, realmId: {2}]",
|
||||
_RBACData.GetId(), _RBACData.GetName(), Global.WorldMgr.GetRealm().Id.Index);
|
||||
_RBACData.GetId(), _RBACData.GetName(), Global.RealmMgr.GetCurrentRealmId().Index);
|
||||
_RBACData = null;
|
||||
}
|
||||
|
||||
@@ -944,6 +952,7 @@ namespace Game
|
||||
Expansion m_accountExpansion;
|
||||
Expansion m_expansion;
|
||||
string _os;
|
||||
uint _clientBuild;
|
||||
|
||||
uint expireTime;
|
||||
bool forceExit;
|
||||
@@ -1130,7 +1139,7 @@ namespace Game
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BATTLE_PETS);
|
||||
stmt.AddValue(0, battlenetAccountId);
|
||||
stmt.AddValue(1, Global.WorldMgr.GetRealmId().Index);
|
||||
stmt.AddValue(1, Global.RealmMgr.GetCurrentRealmId().Index);
|
||||
SetQuery(AccountInfoQueryLoad.BattlePets, stmt);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BATTLE_PET_SLOTS);
|
||||
|
||||
Reference in New Issue
Block a user