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 01-28-2002, 05:04 PM
darvik
Fire Beetle
 
Join Date: Jan 2002
Posts: 21
Default Alternate Version of Quest Code..

OK, this is something I thought might be neat to try to fix up.. but it's going to be much more complicated than it would look like at face value. The problem is that when a client gives an item to an NPC, the client destroys the item, calling the OP_MoveItem to the destroy button .. so, a flag needs to be set on the player that they are in an NPC trade, and itercept the move on the server side, and send it to the NPC's inventory. This is probably what allows MultiQuesting - since it stays on the NPC's inventory for 8 minutes. Quest database also needs to be implemented in a way that is more realistic to the way EQ is.. such as text spoken when an item is turned in, etc..
Currently you can give any item to any NPC and you get 1000 xp.. dont hold your breath for this in the real EQ :P

This is just raw stuff currently - but it's a start in the right direction of how Quests *should* work

code for client_process.cpp (overwriting the current OP_GiveItem case) - the struct that was being used here is not quite right.. while I can't claim that I know what is right, I know that it's not 4 int16's.
Code:
case OP_GiveItem: 
{
	cout << name << " is trying to give an item to an npc. " << endl;
	DumpPacketHex(app);

	NPC_Identity_Struct* nis=(NPC_Identity_Struct*)app->pBuffer;

	// not sure what this is..
	APPLAYER* outapp = new APPLAYER;
	outapp->opcode = 0x1020;
	outapp->pBuffer = new uchar[2];
	outapp->size = 2;
	outapp->pBuffer[0] = 0x67;
	outapp->pBuffer[1] = 0x13;
	QueuePacket(outapp);
	delete outapp;

	// This tells client to open the npc trade window.
	outapp = new APPLAYER;
	outapp->opcode = 0xe620;
	outapp->size = sizeof(NPC_Identity_Struct);
	outapp->pBuffer = new uchar[outapp->size];
	NPC_Identity_Struct* nis_out=(NPC_Identity_Struct*)outapp->pBuffer;
	nis_out->unknown001 = nis->npcid;  // these two values get swapped on return
	nis_out->npcid = nis->unknown001;  // from the server - dunno why.
	QueuePacket(outapp);
	delete outapp;
	break;
}

case 0xda20:
{
	cout << name << " gave some crap to an NPC." << endl;
	DumpPacketHex(app);
					
	// TODO: check quest table..
		
	// message from NPC - again, dont know c well enough :(
	// single null terminated string.
	APPLAYER* outapp = new APPLAYER;
	outapp->opcode = OP_ShopWelcome;	// This opCode should be a general NPC speaking.
	outapp->pBuffer = new uchar[7];
	outapp->size = 7;
	outapp->pBuffer[0] = 0x74;
	outapp->pBuffer[1] = 0x68;
	outapp->pBuffer[2] = 0x61;
	outapp->pBuffer[3] = 0x6e;
	outapp->pBuffer[4] = 0x6b;
	outapp->pBuffer[5] = 0x73;
	outapp->pBuffer[6] = 0x00;
	QueuePacket(outapp);
	delete outapp;

	// Not sure what these next 2 opCodes are for.. neither of them have CRC checks.
	// but are definetly required to close the NPC trade window.
	outapp = new APPLAYER;
	outapp->opcode = 0x1020;
	outapp->pBuffer = new uchar[4];
	outapp->size = 4;
	outapp->pBuffer[0] = 0xa0;
	outapp->pBuffer[1] = 0x1c;
	outapp->pBuffer[2] = 0x48;
	outapp->pBuffer[3] = 0x4d;
	cout << "sending end NPC-Trade Packet 1 to: " << name << endl;
	QueuePacket(outapp);
	delete outapp;

	outapp = new APPLAYER;
	outapp->opcode = 0xdc20;
	outapp->pBuffer = new uchar[4];
	outapp->size = 4;
	outapp->pBuffer[0] = 0x5d;
	outapp->pBuffer[1] = 0x86;
	outapp->pBuffer[2] = 0x98;
	outapp->pBuffer[3] = 0x3c;
	cout << "sending end NPC-Trade Packet 2 to: " << name << endl;
	QueuePacket(outapp);
	delete outapp;

	AddEXP(1000);

	break;
}

case 0xdb20:
{
	// This occurs when client walks away from trade or hits cancel..
	// when walking away, box is automaticly closed.

	cout << name << " ending trade.." << endl;
	DumpPacketHex(app);

	// TODO: give items / cash back..

	// Not sure what these next 2 opCodes are for.. neither of them have CRC checks.
	// but are definetly required to close the NPC trade window.
	APPLAYER* outapp = new APPLAYER;
	outapp->opcode = 0x1020;
	outapp->pBuffer = new uchar[4];
	outapp->size = 4;
	outapp->pBuffer[0] = 0xa0;
	outapp->pBuffer[1] = 0x1c;
	outapp->pBuffer[2] = 0x48;
	outapp->pBuffer[3] = 0x4d;
	cout << "sending end NPC Trade Packet 1 to: " << name << endl;
	QueuePacket(outapp);
	delete outapp;

	outapp = new APPLAYER;
	outapp->opcode = 0xdc20;
	outapp->pBuffer = new uchar[4];
	outapp->size = 4;
	outapp->pBuffer[0] = 0x5d;
	outapp->pBuffer[1] = 0x86;
	outapp->pBuffer[2] = 0x98;
	outapp->pBuffer[3] = 0x3c;
	cout << "sending end NPC Trade Packet 2 to: " << name << endl;
	QueuePacket(outapp);
	delete outapp;

	Message(0, "The trade was canceled. Giving back items is NYI.");
	break;
}

case 0x2d21:
{
	cout << name << " is moving cash.." << endl;
	DumpPacketHex(app);
	break;
}
Code for eq_packet_structs.h - this struct seems to be a general identity struct for all NPC interaction - including merchant interaction - I'll be updating my previous merchant code to work with this struct.
Code:
// Darvik: this is used with most NPC interaction.
struct NPC_Identity_Struct {
	uint32 unknown001;	// this may have something to do with zone.
	uint32 npcid;
};
Reply With Quote
  #2  
Old 01-28-2002, 11:08 PM
Gunder
Fire Beetle
 
Join Date: Jan 2002
Posts: 2
Default Great job

Great darvik!!!

I try to mix our code ( when can patch my eq client and can test it ) with my news, now i can talk with the npc, and ask for a quest.

Reply With Quote
  #3  
Old 01-30-2002, 07:53 AM
Mr Bitterness
Fire Beetle
 
Join Date: Jan 2002
Posts: 10
Default Nice

nice code =) i noticed you say turning in an item gives you 1000 exp, it might be nice to implement in the EMU a way to display your exp in numbers, that would be crazy nice... just for future reference, i am not the brightest tool in the knife shop so if this is undoable please disregard
__________________
______________________________

Bitter is Better
______________________________
Reply With Quote
Reply


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 12:45 PM.


 

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