View Single Post
  #2  
Old 07-21-2011, 11:04 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default

Quote:
Originally Posted by image View Post
Changes are in bold

client_packet.cpp

Code:
void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app)
{
	// Pass trade request on to recipient
	TradeRequest_Struct* msg = (TradeRequest_Struct*) app->pBuffer;

	if ( msg->from_mob_id != this->GetID() )
		return; // Kings & Bandits - bad!! Someone is trying to cheat! tradereq

	Mob* tradee = entity_list.GetMob(msg->to_mob_id);

	// Client requesting a trade session from an npc/client
	// Trade session not started until OP_TradeRequestAck is sent

	BreakInvis();

	if (tradee && tradee->IsClient()) {
		tradee->CastToClient()->QueuePacket(app);
	}
	else if (tradee) {

		EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeRequestAck, sizeof(TradeRequest_Struct));
		TradeRequest_Struct* acc = (TradeRequest_Struct*) outapp->pBuffer;
		// Kings & Bandits - BodyType fix for non-target trade
		switch(tradee->CastToNPC()->GetBodyType())
		{
		case BT_NoTarget:
		case BT_NoTarget2:
		case BT_Special:
			{
				acc->from_mob_id = 0;
				acc->to_mob_id = msg->from_mob_id;
				break;
			}
		default:
			{
				//npcs always accept
				trade->Start(msg->to_mob_id);
				acc->from_mob_id = msg->to_mob_id;
				acc->to_mob_id = msg->from_mob_id;
				break;
			}
		}

		FastQueuePacket(&outapp);
		safe_delete(outapp);
	}
	return;
}
Image, thanks for this and all your other fixes. I will be committing them soonish if no one else gets around to it.
Reply With Quote