Several Trading fixes (#169)

* FIX : HandleAdditemCommand (delete items in bank)

The .additem command was not deleting items in the bank

* FIX : HandleAdditemCommand (delete items in buyback tab)

The .additem command was not deleting items in the buyback vendor tab for npc vendors

* Enchance LANG_REMOVEITEM text

* Fix Tabs / spaces in Language.h

* Fix Language.h file generator

* Trade Fix : For GMs starting a trade session with an opposite faction player

Allow a GM to start a trading session with an opposite faction player even if CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE = false

* Trade Fix : Avoid hanging trade sessions for invisible GMs

Check visibility in order to avoid hanging trade sessions
This commit is contained in:
Elmsroth 2021-12-29 12:50:35 +01:00 committed by GitHub
parent 39381b1552
commit 7bc78be84c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -671,26 +671,39 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE) && pOther->GetTeam() != _player->GetTeam())
// Checking faction restrictions but allow a GM to start a trade even if not in same faction
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_TRADE) && pOther->GetTeam() != GetPlayer()->GetTeam() && GetSecurity() == SEC_PLAYER)
{
info.Status = TRADE_STATUS_WRONG_FACTION;
SendTradeStatus(info);
return;
}
if (!pOther->IsWithinDistInMap(_player, TRADE_DISTANCE, false))
if (!pOther->IsWithinDistInMap(GetPlayer(), TRADE_DISTANCE, false))
{
info.Status = TRADE_STATUS_TARGET_TO_FAR;
SendTradeStatus(info);
return;
}
// Check visibility in order to avoid hanging trade sessions
if (GetSecurity() > SEC_PLAYER && GetPlayer()->GetVisibility() == VISIBILITY_OFF &&
( pOther->GetSession()->GetSecurity() < GetSecurity()
|| (pOther->GetSession()->GetSecurity() > GetSecurity() && pOther->GetVisibility() == VISIBILITY_OFF)
)
)
{
info.Status = TRADE_STATUS_TRADE_CANCELED;
SendTradeStatus(info);
return;
}
// OK start trade
_player->m_trade = new TradeData(_player, pOther);
pOther->m_trade = new TradeData(pOther, _player);
GetPlayer()->m_trade = new TradeData(GetPlayer(), pOther);
pOther->m_trade = new TradeData(pOther, GetPlayer());
info.Status = TRADE_STATUS_BEGIN_TRADE;
info.TraderGuid = _player->GetObjectGuid();
info.TraderGuid = GetPlayer()->GetObjectGuid();
pOther->GetSession()->SendTradeStatus(info);
}