Skip to content

Commit

Permalink
Add custom code to disable selling for vendors meeting specific criteria
Browse files Browse the repository at this point in the history
In our case, we are keying off of stamina having a value of 789
Big thanks to Kayen for the code!
  • Loading branch information
N0ctrnl committed Feb 13, 2016
1 parent fd4e032 commit cae9cb1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zone/client_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12361,6 +12361,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
std::cout << "At 1: " << t1.getDuration() << std::endl;
return;
}

void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
{
if (app->size != sizeof(Merchant_Purchase_Struct)) {
Expand All @@ -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() == 789){ //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;
Expand Down

0 comments on commit cae9cb1

Please sign in to comment.