Thread: Inspect code
View Single Post
  #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