diff --git a/src/strategy/actions/TradeStatusAction.cpp b/src/strategy/actions/TradeStatusAction.cpp index ad421367..d46b842d 100644 --- a/src/strategy/actions/TradeStatusAction.cpp +++ b/src/strategy/actions/TradeStatusAction.cpp @@ -49,7 +49,7 @@ bool TradeStatusAction::Execute(Event event) uint32 status; p >> status; - if (status == TRADE_STATUS_TRADE_ACCEPT) + if (status == TRADE_STATUS_TRADE_ACCEPT || (status == TRADE_STATUS_BACK_TO_TRADE && trader->GetTradeData() && trader->GetTradeData()->IsAccepted())) { WorldPacket p; uint32 status = 0; @@ -122,12 +122,13 @@ bool TradeStatusAction::Execute(Event event) void TradeStatusAction::BeginTrade() { + Player* trader = bot->GetTrader(); + if (!trader || GET_PLAYERBOT_AI(bot->GetTrader())) + return; + WorldPacket p; bot->GetSession()->HandleBeginTradeOpcode(p); - if (GET_PLAYERBOT_AI(bot->GetTrader())) - return; - ListItemsVisitor visitor; IterateItems(&visitor); @@ -149,7 +150,7 @@ void TradeStatusAction::BeginTrade() bool TradeStatusAction::CheckTrade() { Player* trader = bot->GetTrader(); - if (!bot->GetTradeData() || !trader->GetTradeData()) + if (!bot->GetTradeData() || !trader || !trader->GetTradeData()) return false; if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader()))