Core/Players: Use PlayerData::VirtualPlayerRealm instead of global GetVirtualRealmAddress() where possible

Port From (https://github.com/TrinityCore/TrinityCore/commit/88fea990ff1408b94076fb9dbd0c974908d6a731)
This commit is contained in:
Hondacrx
2024-09-08 15:23:43 -04:00
parent 92472c20aa
commit 8341244e4d
7 changed files with 23 additions and 13 deletions
+4 -4
View File
@@ -438,10 +438,10 @@ namespace Game.Entities
if (type != DuelCompleteType.Interrupted)
{
DuelWinner duelWinner = new();
duelWinner.BeatenName = (type == DuelCompleteType.Won ? opponent.GetName() : GetName());
duelWinner.WinnerName = (type == DuelCompleteType.Won ? GetName() : opponent.GetName());
duelWinner.BeatenVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
duelWinner.WinnerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
duelWinner.BeatenName = (type == DuelCompleteType.Won ? opponent : this).GetName();
duelWinner.WinnerName = (type == DuelCompleteType.Won ? this : opponent).GetName();
duelWinner.BeatenVirtualRealmAddress = (type == DuelCompleteType.Won ? opponent : this).m_playerData.VirtualPlayerRealm;
duelWinner.WinnerVirtualRealmAddress = (type == DuelCompleteType.Won ? this : opponent).m_playerData.VirtualPlayerRealm;
duelWinner.Fled = type != DuelCompleteType.Won;
SendMessageToSet(duelWinner, true);
+6 -1
View File
@@ -2446,7 +2446,12 @@ namespace Game.Entities
SummonRequest summonRequest = new();
summonRequest.SummonerGUID = summoner.GetGUID();
summonRequest.SummonerVirtualRealmAddress = WorldMgr.GetVirtualRealmAddress();
Player playerSummoner = summoner.ToPlayer();
if (playerSummoner != null)
summonRequest.SummonerVirtualRealmAddress = playerSummoner.m_playerData.VirtualPlayerRealm;
else
summonRequest.SummonerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
summonRequest.AreaID = (int)summoner.GetZoneId();
SendPacket(summonRequest);