Core/Gossip: Integrate banker guid checks into shared gossip interaction data

Port From (https://github.com/TrinityCore/TrinityCore/commit/bde93b25d2b899c4623467a094c71333b2b54e8d)
This commit is contained in:
hondacrx
2023-01-06 15:51:30 -05:00
parent 5ee02ce4be
commit a21ae2b9aa
3 changed files with 12 additions and 13 deletions
+6 -4
View File
@@ -31,7 +31,7 @@ namespace Game
{ {
if (!CanUseBank()) if (!CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleAutoBankItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -79,7 +79,7 @@ namespace Game
{ {
if (!CanUseBank()) if (!CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleAutoBankItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -216,7 +216,7 @@ namespace Game
{ {
if (!CanUseBank()) if (!CanUseBank())
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankReagentOpcode - {m_currentBankerGUID} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankReagentOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -253,7 +253,7 @@ namespace Game
{ {
if (!CanUseBank()) if (!CanUseBank())
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankReagentOpcode - {m_currentBankerGUID} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAutoBankReagentOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -297,6 +297,8 @@ namespace Game
public void SendShowBank(ObjectGuid guid) public void SendShowBank(ObjectGuid guid)
{ {
_player.PlayerTalkClass.GetInteractionData().Reset();
_player.PlayerTalkClass.GetInteractionData().SourceGuid = guid;
NPCInteractionOpenResult npcInteraction = new(); NPCInteractionOpenResult npcInteraction = new();
npcInteraction.Npc = guid; npcInteraction.Npc = guid;
npcInteraction.InteractionType = PlayerInteractionType.Banker; npcInteraction.InteractionType = PlayerInteractionType.Banker;
+6 -6
View File
@@ -89,13 +89,13 @@ namespace Game
if (Player.IsBankPos(InventorySlots.Bag0, swapInvItem.Slot1) && !CanUseBank()) if (Player.IsBankPos(InventorySlots.Bag0, swapInvItem.Slot1) && !CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleSwapInvItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleSwapInvItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
if (Player.IsBankPos(InventorySlots.Bag0, swapInvItem.Slot2) && !CanUseBank()) if (Player.IsBankPos(InventorySlots.Bag0, swapInvItem.Slot2) && !CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleSwapInvItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleSwapInvItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -155,13 +155,13 @@ namespace Game
if (Player.IsBankPos(swapItem.ContainerSlotA, swapItem.SlotA) && !CanUseBank()) if (Player.IsBankPos(swapItem.ContainerSlotA, swapItem.SlotA) && !CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleSwapInvItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleSwapInvItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
if (Player.IsBankPos(swapItem.ContainerSlotB, swapItem.SlotB) && !CanUseBank()) if (Player.IsBankPos(swapItem.ContainerSlotB, swapItem.SlotB) && !CanUseBank())
{ {
Log.outDebug(LogFilter.Network, "WORLD: HandleSwapInvItemOpcode - {0} not found or you can't interact with him.", m_currentBankerGUID.ToString()); Log.outDebug(LogFilter.Network, $"WORLD: HandleSwapInvItemOpcode - {_player.PlayerTalkClass.GetInteractionData().SourceGuid} not found or you can't interact with him.");
return; return;
} }
@@ -1039,9 +1039,9 @@ namespace Game
{ {
// bankerGUID parameter is optional, set to 0 by default. // bankerGUID parameter is optional, set to 0 by default.
if (bankerGUID.IsEmpty()) if (bankerGUID.IsEmpty())
bankerGUID = m_currentBankerGUID; bankerGUID = _player.PlayerTalkClass.GetInteractionData().SourceGuid;
bool isUsingBankCommand = (bankerGUID == GetPlayer().GetGUID() && bankerGUID == m_currentBankerGUID); bool isUsingBankCommand = bankerGUID == GetPlayer().GetGUID() && bankerGUID == _player.PlayerTalkClass.GetInteractionData().SourceGuid;
if (!isUsingBankCommand) if (!isUsingBankCommand)
{ {
-3
View File
@@ -56,7 +56,6 @@ namespace Game
recruiterId = recruiter; recruiterId = recruiter;
isRecruiter = isARecruiter; isRecruiter = isARecruiter;
expireTime = 60000; // 1 min after socket loss, session is deleted expireTime = 60000; // 1 min after socket loss, session is deleted
m_currentBankerGUID = ObjectGuid.Empty;
_battlePetMgr = new BattlePetMgr(this); _battlePetMgr = new BattlePetMgr(this);
_collectionMgr = new CollectionMgr(this); _collectionMgr = new CollectionMgr(this);
@@ -995,8 +994,6 @@ namespace Game
ConcurrentQueue<WorldPacket> _recvQueue = new(); ConcurrentQueue<WorldPacket> _recvQueue = new();
RBACData _RBACData; RBACData _RBACData;
ObjectGuid m_currentBankerGUID;
CircularBuffer<Tuple<long, uint>> _timeSyncClockDeltaQueue = new(6); // first member: clockDelta. Second member: latency of the packet exchange that was used to compute that clockDelta. CircularBuffer<Tuple<long, uint>> _timeSyncClockDeltaQueue = new(6); // first member: clockDelta. Second member: latency of the packet exchange that was used to compute that clockDelta.
long _timeSyncClockDelta; long _timeSyncClockDelta;