Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2017, 09:13 PM
The_Beast's Avatar
The_Beast
Discordant
 
Join Date: May 2016
Location: Under a rock
Posts: 290
Default Prevent Merchant From Buying

This is an old snippet of code I copied from somewhere on these forums, long ago. (I don't remember where)
I never got around to trying it out until now, but I just tested it out and it works awesome. I simply set the
(vendor->GetSTA() == 999) which I set the STA to 999 on the custom merchant NPC. This comes in real
handy for a custom vendor that you don't want players selling all their vendor trash to and making it hard for
others to shop. A client will still get that infamous message "I will give you xxx plat....", but also get a msg,
"I am not interested in that....." So whoever wrote this, Thank YOU !!!

In client_packet.cpp
Code:
// EDIT NOTE: add the parts inbetween //CUSTOM Will STOP a merchant from buying (with GetSTA value)
 
 
 void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
 {
 	if (app->size != sizeof(Merchant_Purchase_Struct)) {
@@ -12373,9 +12374,24 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
 
 	Mob* vendor = entity_list.GetMob(mp->npcid);
 

 	if (vendor == 0 || !vendor->IsNPC() || vendor->GetClass() != MERCHANT)
 		return;
 
+	//CUSTOM - Prevent merchant from buying any items from players
+	if (vendor->GetSTA() == 999){ //Can change to this to whatever
+		EQApplicationPacket* outapp = new EQApplicationPacket(OP_ShopPlayerSell, sizeof(Merchant_Purchase_Struct));
+		Merchant_Purchase_Struct* mco = (Merchant_Purchase_Struct*)outapp->pBuffer;
+		mco->npcid = vendor->GetID();
+		mco->itemslot = -1;
+		mco->quantity = 0;
+		mco->price = 0;
+		QueuePacket(outapp);
+		safe_delete(outapp);
+		return;
+	}
+	//CUSTOM - End
+
 	//you have to be somewhat close to them to be properly using them
 	if (DistanceSquared(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2)
 		return;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:43 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3