Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2002, 12:33 AM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default Merchant fix

Code:
// Edited Merkur  03/12
case OP_ShopPlayerBuy: {								
	cout << name << " is attempting to purchase an item..  " << endl;
	Merchant_Purchase_Struct* mp=(Merchant_Purchase_Struct*)app->pBuffer;
	int merchantid;
	Mob* tmp = entity_list.GetMob(mp->npcid);
	if (tmp != 0)
		merchantid=tmp->CastToNPC()->MerchantType;
	else 
		break;
	uint16 item_nr = database.GetMerchantData(merchantid, mp->itemslot+1);
	if (item_nr == 0)
		break;
	Item_Struct* item = database.GetItem(item_nr);				
	APPLAYER* outapp = new APPLAYER(OP_ShopPlayerBuy, sizeof(Merchant_Purchase_Struct));
	Merchant_Purchase_Struct* mpo=(Merchant_Purchase_Struct*)outapp->pBuffer;							
	mpo->quantity = mp->quantity;
	mpo->playerid = mp->playerid;
	mpo->npcid = mp->npcid;
	mpo->itemslot = mp->itemslot;													
	mpo->IsSold = 0x00;
	mpo->unknown001 = 0x00;
	mpo->unknown002 = 0x00;
	mpo->unknown003 = 0x00;
	mpo->unknown004 = 0x00; 
	mpo->unknown005 = 0x00;
	// well i don't know how to calculate merchant prices exact, but *12 seems pretty near so it will do for now -Merkur
	mpo->itemcost = item->cost*mp->quantity*12;					
	cout << "taking " << item->cost*mp->quantity*12 << " copper from " << name << "." << endl;
	//	DumpPacketHex(app);
	QueuePacket(outapp);
	delete outapp;						
	PutItemInInventory(FindFreeInventorySlot(0, (item->type==0x01), false), item, mp->quantity);
	Save();
	break;
					   }
case OP_ShopPlayerSell: {
	cout << name << " is trying to sell an item." << endl;
	Merchant_Purchase_Struct* mp=(Merchant_Purchase_Struct*)app->pBuffer;														
	pp.inventory[mp->itemslot] = 0xFFFF;
	cout << " Inv Slot: " << int(mp->itemslot) << endl;
	QueuePacket(app); // Just send it back to accept the deal
	Save();
	cout << "response from sell action.." << endl;
	break;
						}
struct:
Code:
struct Merchant_Purchase_Struct {
/*000*/	int16	npcid;			// Merchant NPC's entity id
/*004*/	int16	playerid;		// Player's entity id
/*008*/	int8	itemslot;
		int8	IsSold;		// Already sold
/*009*/	int8	unknown001;	// always 0x0b, 0x7c, 0x00 ??
/*009*/	int8	unknown002;
/*013*/	int8	quantity;		// Qty - when used in Merchant_Purchase_Struct
		int8	unknown003;
		int8	unknown004;
		int8	unknown005;
		sint32  itemcost;
};
Reply With Quote
  #2  
Old 03-13-2002, 07:17 AM
DeletedUser
Fire Beetle
 
Join Date: Sep 2002
Posts: 0
Default

Hey Merker, come to #eqemu on irc.trifocus.net, I wanna talk to you! (or PM me here).
Reply With Quote
  #3  
Old 03-13-2002, 07:18 AM
PaulieWalnutz
Fire Beetle
 
Join Date: Mar 2002
Posts: 3
Default Rock!

You rock Merkur!
Reply With Quote
  #4  
Old 03-13-2002, 07:42 AM
Lyenu X`Arie
Fire Beetle
 
Join Date: Mar 2002
Posts: 0
Default

Good job Merkur, you're a excellent coder =).
Reply With Quote
  #5  
Old 03-13-2002, 08:13 AM
Drawde
Dragon
 
Join Date: Jan 2002
Posts: 521
Default

Great job on fixing the merchant code!
Now I can finally use 2.4 (with the next beta at least)

Have you also fixed the bug with purchasing stackable items? (they default to 0 items in the stack no matter how many you choose)
Reply With Quote
  #6  
Old 03-13-2002, 09:04 AM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default

umm i just changed some minor things in this part, its not that big heh.

@ Hogie
i'm in this channel since 2 days

@Draw
yup should work
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 04:05 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3