View Single Post
  #18  
Old 05-13-2009, 12:07 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

Changes needed to implement face changing in SoF:

Code:
// eq_packet_structs.h
struct FaceChange_Struct {
/*000*/	int8	haircolor;
/*001*/	int8	beardcolor;
/*002*/	int8	eyecolor1;
/*003*/	int8	eyecolor2;
/*004*/	int8	hairstyle;
/*005*/	int8	beard;
/*006*/	int8	face;
/*007*/ int8	unknown07;
/*008*/ int32	heritage;
/*012*/ int32	tattoo;
/*016*/ int32	details;
/*020*/ int32	unknown;
};
Code:
// client_packet.cpp - Client::Handle_OP_FaceChange()
void Client::Handle_OP_FaceChange(const EQApplicationPacket *app)
{
  // [snip] ...
	
	// FaceChange sends 0xFF as code for "Field Not Applicable For This Race"
	// Except Drakkin fields, which are always 0 for non-Drakkin.
	// Better to store 0 in DB than 0xFF in case race changes,
	//   because then field may become applicable again!
	m_pp.hair = (fc->hair == 0xFF) ? 0 : fc->hair;
	m_pp.haircolor = (fc->haircolor == 0xFF) ? 0 : fc->haircolor;
	m_pp.beard = (fc->beard == 0xFF) ? 0 : fc->beard;
	m_pp.beardcolor = (fc->beardcolor == 0xFF) ? 0 : fc->beard;

	switch (m_pp.race)
	{
		case BARBARIAN:
			m_pp.tattoo = (fc->face / 10);
			m_pp.face = (fc->face % 10);
			break;
		case ERUDITE:
			m_pp.hair = (fc->face / 10);
			m_pp.face = (fc->face % 10);
			break;
		case HIGHELF:
		case DARKELF:
		case HALFELF:
			m_pp.beard = (fc->face / 10);
			m_pp.face = (fc->face % 10);
			break;
		case 
	}
}
Code:
// SoF.cpp - ENCODE(OP_ZoneSpawns)
ENCODE(OP_ZoneSpawns)
{
  // [snip] ...
	
	eq->tattoo = emu->tattoo; // Assuming Tattoo field is added to DB for Draks & Barbs
	eq->details = emu->details; // Assuming Details field is added to DB for Draks
	eq->heritage = emu->heritage; // Assuming heritage field is added to DB for Draks
	eq->face = emu->face;

	// Now adjust Face field to account for features encoded into it by client for rendering
	switch (emu->race)
	{
	  case BARBARIAN:
			eq->face += (emu->tattoo * 10); // Tattoo will be ignored by client for Barbs, Tattoo maps to Face field.
			break;
		case ERUDITE:
			eq->face += (emu->hair * 10); // Hair will be ignored by client for Eruds, Hair maps to Face field
			break;
		case HIGHELF:
		case DARKELF:
		case HALFELF:
			eq->face += (emu->beard * 10); // Beard will be ignored by client for elves, Beard maps to Face field
			break;
	}

	// ... [snip]
}
Reply With Quote