mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix crash in trade status action (#1123)
* Fix crash in trade status action
This commit is contained in:
@@ -49,7 +49,7 @@ bool TradeStatusAction::Execute(Event event)
|
|||||||
uint32 status;
|
uint32 status;
|
||||||
p >> 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;
|
WorldPacket p;
|
||||||
uint32 status = 0;
|
uint32 status = 0;
|
||||||
@@ -122,12 +122,13 @@ bool TradeStatusAction::Execute(Event event)
|
|||||||
|
|
||||||
void TradeStatusAction::BeginTrade()
|
void TradeStatusAction::BeginTrade()
|
||||||
{
|
{
|
||||||
|
Player* trader = bot->GetTrader();
|
||||||
|
if (!trader || GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||||
|
return;
|
||||||
|
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleBeginTradeOpcode(p);
|
bot->GetSession()->HandleBeginTradeOpcode(p);
|
||||||
|
|
||||||
if (GET_PLAYERBOT_AI(bot->GetTrader()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ListItemsVisitor visitor;
|
ListItemsVisitor visitor;
|
||||||
IterateItems(&visitor);
|
IterateItems(&visitor);
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ void TradeStatusAction::BeginTrade()
|
|||||||
bool TradeStatusAction::CheckTrade()
|
bool TradeStatusAction::CheckTrade()
|
||||||
{
|
{
|
||||||
Player* trader = bot->GetTrader();
|
Player* trader = bot->GetTrader();
|
||||||
if (!bot->GetTradeData() || !trader->GetTradeData())
|
if (!bot->GetTradeData() || !trader || !trader->GetTradeData())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader()))
|
if (!botAI->HasActivePlayerMaster() && GET_PLAYERBOT_AI(bot->GetTrader()))
|
||||||
|
|||||||
Reference in New Issue
Block a user