From a21ae2b9aaef0a692b5eaef6d798fd655d4423da Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 6 Jan 2023 15:51:30 -0500 Subject: [PATCH] Core/Gossip: Integrate banker guid checks into shared gossip interaction data Port From (https://github.com/TrinityCore/TrinityCore/commit/bde93b25d2b899c4623467a094c71333b2b54e8d) --- Source/Game/Handlers/BankHandler.cs | 10 ++++++---- Source/Game/Handlers/ItemHandler.cs | 12 ++++++------ Source/Game/Server/WorldSession.cs | 3 --- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Source/Game/Handlers/BankHandler.cs b/Source/Game/Handlers/BankHandler.cs index c85cf65f6..17ea1673d 100644 --- a/Source/Game/Handlers/BankHandler.cs +++ b/Source/Game/Handlers/BankHandler.cs @@ -31,7 +31,7 @@ namespace Game { 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; } @@ -79,7 +79,7 @@ namespace Game { 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; } @@ -216,7 +216,7 @@ namespace Game { 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; } @@ -253,7 +253,7 @@ namespace Game { 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; } @@ -297,6 +297,8 @@ namespace Game public void SendShowBank(ObjectGuid guid) { + _player.PlayerTalkClass.GetInteractionData().Reset(); + _player.PlayerTalkClass.GetInteractionData().SourceGuid = guid; NPCInteractionOpenResult npcInteraction = new(); npcInteraction.Npc = guid; npcInteraction.InteractionType = PlayerInteractionType.Banker; diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index 1f8bbf7b4..ae7ca0ad7 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -89,13 +89,13 @@ namespace Game 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; } 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; } @@ -155,13 +155,13 @@ namespace Game 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; } 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; } @@ -1039,9 +1039,9 @@ namespace Game { // bankerGUID parameter is optional, set to 0 by default. 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) { diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index c9fd724f5..786efe42b 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -56,7 +56,6 @@ namespace Game recruiterId = recruiter; isRecruiter = isARecruiter; expireTime = 60000; // 1 min after socket loss, session is deleted - m_currentBankerGUID = ObjectGuid.Empty; _battlePetMgr = new BattlePetMgr(this); _collectionMgr = new CollectionMgr(this); @@ -995,8 +994,6 @@ namespace Game ConcurrentQueue _recvQueue = new(); RBACData _RBACData; - ObjectGuid m_currentBankerGUID; - CircularBuffer> _timeSyncClockDeltaQueue = new(6); // first member: clockDelta. Second member: latency of the packet exchange that was used to compute that clockDelta. long _timeSyncClockDelta;