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-09-2002, 10:33 AM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default Inspect code

Just some lines for inspect. Hope you can need it.

client_process.cpp:

case OP_InspectRequest: { // 03/09 - Merkur
Inspect_Struct* ins = (Inspect_Struct*) app->pBuffer;
Mob* tmp = entity_list.GetMob(ins->TargetID);
tmp->CastToClient()->QueuePacket(app); // Send request to target
break;
}
// OP_InspectAnswer is 0xb620 (add to eq_opcodes.h)
case OP_InspectAnswer: {
Inspect_Struct* ins = (Inspect_Struct*) app->pBuffer;
Mob* tmp = entity_list.GetMob(ins->TargetID);
tmp->CastToClient()->QueuePacket(app); // Send answer to requester
break;
}


eq_packets_struct.h:
//Inspect
struct Inspect_Struct {
int16 TargetID;
int16 PlayerID;
};


Works fine ;)
Reply With Quote
  #2  
Old 03-09-2002, 02:58 PM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default

Some more lines :) Consider works pretty good this way - not 100% perfect but pretty close to EQ Live.

Code:
case OP_Consider:     //03/09   -Merkur
	{
		Consider_Struct* conin = (Consider_Struct*)app->pBuffer;
		if (conin->targetid == GetID())
			break;		// don't consider yourself
		
		APPLAYER* outapp = new APPLAYER(OP_Consider, sizeof(Consider_Struct));
		Consider_Struct* con = (Consider_Struct*)outapp->pBuffer;
		con->playerid = GetID();
		con->targetid = conin->targetid;
		con->faction = GetFactionLevel(character_id,entity_list.GetMob(conin->targetid)->GetNPCTypeID(), race, class_, DEITY_AGNOSTIC); // rembrant, Dec. 20, 2001; TODO: Send the players proper deity						
		sint8 tmp = entity_list.GetMob(conin->targetid)->GetLevel() - this->GetLevel();
		
		int32 conlevel;
		if (GetLevel() <= 12)
		{
			conlevel =  (tmp <= -4) ? 0x02:			//green
		(tmp >=-3 && tmp <= -1) ? 0x04://blue
		(tmp == 0) ? 0x00:				//white
		(tmp >= 1 && tmp <= 2) ?0x0F:    //yellow
		0x0D;							//red
		}
		else if (GetLevel() >= 13 && GetLevel() <= 24)
		{
			conlevel =  (tmp <= -6) ? 0x02:			//green
		(tmp >=-5 && tmp <= -4) ? 0x12: //blue2
		(tmp >=-3 && tmp <= -1) ? 0x04://blue
		(tmp == 0) ? 0x00:				//white
		(tmp >= 1 && tmp <= 2) ?0x0F:    //yellow
		0x0D;							//red
		}
		else if (GetLevel() >= 25 && GetLevel() <= 40)
		{
			conlevel =  (tmp <= -11) ? 0x02:			//green
		(tmp >=-10 && tmp <= -8) ? 0x04://blue
		(tmp == 0) ? 0x00:				//white
		(tmp >= 1 && tmp <= 2) ?0x0F:    //yellow
		0x0D;							//red
		}
		else if (GetLevel() >= 41 && GetLevel() <= 48)
		{
			conlevel =  (tmp <= -12) ? 0x02:			//green
		(tmp >=-11 && tmp <= -1) ? 0x04://blue
		(tmp == 0) ? 0x00:				//white
		(tmp >= 1 && tmp <= 2) ?0x0F:    //yellow
		0x0D;							//red
		}
		else if (GetLevel() >= 50)
		{
			conlevel =  (tmp <= -14) ? 0x02:			//green
		(tmp >=-13 && tmp <= -1) ? 0x04://blue
		(tmp == 0) ? 0x00:				//white
		(tmp >= 1 && tmp <= 2) ?0x0F:    //yellow
		0x0D;							//red
		};
		con->level = conlevel;
		//  These values are only used if you con PCs (i think), but i see no reason...
		//	con->cur_hp = target->GetHP(); // rembrant, Dec. 20, 2001
		//	con->max_hp = target->GetMaxHP(); // rembrant, Dec. 20, 2001
		QueuePacket(outapp);
		delete outapp;			
		break;
	}
edit: fixed a small error in this code (used wrong id for faction)
Reply With Quote
  #3  
Old 03-10-2002, 11:53 AM
DeletedUser
Fire Beetle
 
Join Date: Sep 2002
Posts: 0
Default

Currently our CVS is down, but I will merge this soon (tm). What source version did you use to create it?
Reply With Quote
  #4  
Old 03-10-2002, 12:06 PM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default

I used the current Version 0.2.4.5

btw: in my version, i put these conlevel thing in a newfunction because i needed it for other things (i.e. determinate npc aggroradius) too.
Reply With Quote
  #5  
Old 03-10-2002, 04:49 PM
theCoder
Sarnak
 
Join Date: Jan 2002
Posts: 90
Default function in Mob?

I'm still trying to learn how the EMU code works (mostly be looking at it when I can and lurking on the dev board ), so this may have implications I don't understand. But the OO side of me thinks that it would be easier to put the consider code into a function on the Mob class. Something like

int Mob::consider(Mob* target)
{
// Merkur's code here
}

Then in the processing function, replace most of the code with
con->level = this->consider(entity_list.GetMob(conin->targetid));

This wouldn't add any functionality, but it might make the code a little easier to manage (especially since the Client::Process function is over 2000 lines long already)
Reply With Quote
  #6  
Old 03-10-2002, 09:43 PM
Merkur
Sarnak
 
Join Date: Mar 2002
Posts: 53
Default

Yup, it would be better (and like i wrote i did it), but its easier to post this way
Reply With Quote
  #7  
Old 03-11-2002, 09:49 AM
T7g
Fire Beetle
 
Join Date: Jan 2002
Posts: 21
Default

/auction wtb good coders to work on emu, /tell one of the devs
Reply With Quote
  #8  
Old 03-11-2002, 10:52 AM
theCoder
Sarnak
 
Join Date: Jan 2002
Posts: 90
Default

Heh, I'd love to, but I barely have the time to keep up to date on the boards. I still haven't even extracted the 0.2.4-preX stuff yet...

but I can try to offer insight every once and a while
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 03:11 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