diff --git a/src/game/Entities/Player.cpp b/src/game/Entities/Player.cpp index 246ca60340..11039de8d4 100644 --- a/src/game/Entities/Player.cpp +++ b/src/game/Entities/Player.cpp @@ -6259,7 +6259,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE)) - GetSession()->SendCancelTrade(); // will close both side trade windows + TradeCancel(true, TRADE_STATUS_TARGET_TO_FAR); if (m_needsZoneUpdate) { @@ -11602,7 +11602,7 @@ void Player::SendSellError(SellResult msg, Creature* pCreature, ObjectGuid itemG GetSession()->SendPacket(data); } -void Player::TradeCancel(bool sendback) +void Player::TradeCancel(bool sendback, TradeStatus status /*= TRADE_STATUS_TRADE_CANCELED*/) { if (m_trade) { @@ -11610,9 +11610,9 @@ void Player::TradeCancel(bool sendback) // send yellow "Trade canceled" message to both traders if (sendback) - GetSession()->SendCancelTrade(); + GetSession()->SendCancelTrade(status); - trader->GetSession()->SendCancelTrade(); + trader->GetSession()->SendCancelTrade(status); // cleanup delete m_trade; diff --git a/src/game/Entities/Player.h b/src/game/Entities/Player.h index c6716a9833..2d9b1858c8 100644 --- a/src/game/Entities/Player.h +++ b/src/game/Entities/Player.h @@ -1251,7 +1251,7 @@ class Player : public Unit Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; } TradeData* GetTradeData() const { return m_trade; } - void TradeCancel(bool sendback); + void TradeCancel(bool sendback, TradeStatus status = TRADE_STATUS_TRADE_CANCELED); void UpdateEnchantTime(uint32 time); void UpdateItemDuration(uint32 time, bool realtimeonly = false); diff --git a/src/game/Server/WorldSession.h b/src/game/Server/WorldSession.h index 1d1da18f67..07af438dc4 100644 --- a/src/game/Server/WorldSession.h +++ b/src/game/Server/WorldSession.h @@ -349,7 +349,7 @@ class WorldSession void SendTradeStatus(const TradeStatusInfo& status) const; void SendUpdateTrade(bool trader_state = true) const; - void SendCancelTrade(); + void SendCancelTrade(TradeStatus status); void SendPetitionQueryOpcode(ObjectGuid petitionguid) const; diff --git a/src/game/Trade/TradeHandler.cpp b/src/game/Trade/TradeHandler.cpp index be7ee1e045..a3cc3fb1c5 100644 --- a/src/game/Trade/TradeHandler.cpp +++ b/src/game/Trade/TradeHandler.cpp @@ -61,13 +61,13 @@ void WorldSession::SendTradeStatus(TradeStatusInfo const& info) const void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/) { DEBUG_LOG("WORLD: Ignore Trade %u", _player->GetGUIDLow()); - // recvPacket.print_storage(); + _player->TradeCancel(true, TRADE_STATUS_IGNORE_YOU); } void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/) { DEBUG_LOG("WORLD: Busy Trade %u", _player->GetGUIDLow()); - // recvPacket.print_storage(); + _player->TradeCancel(true, TRADE_STATUS_BUSY); } void WorldSession::SendUpdateTrade(bool trader_state /*= true*/) const @@ -528,13 +528,13 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/) SendTradeStatus(info); } -void WorldSession::SendCancelTrade() +void WorldSession::SendCancelTrade(TradeStatus status) { if (m_playerRecentlyLogout) return; TradeStatusInfo info; - info.Status = TRADE_STATUS_TRADE_CANCELED; + info.Status = status; SendTradeStatus(info); } @@ -626,13 +626,6 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid())) - { - info.Status = TRADE_STATUS_IGNORE_YOU; - SendTradeStatus(info); - return; - } - // [XFACTION]: Reserve possibility to trade with each other for crossfaction group members (when no charms involved) if (!_player->CanCooperate(pOther) && (pOther->HasCharmer() || _player->HasCharmer() || !pOther->IsInGroup(_player))) {