pi->hp=10;
pi->setHp( 10 );
void charcreate( UOXSOCKET s ) // All the character creation stuff{	signed int ii;	int totalstats,totalskills;	P_CHAR pc = Npcs->MemCharFree();	if ( pc == NULL )		return;	pc->Init();	pc->name = (char*)buffer[s] + 10;	pc->setAccount(acctno[s]);	//	Code to support the new GuildType, and GuildTraitor members of the	//	character strcture.	pc->setGuildType(-1);				//	Default to no guild	pc->setGuildTraitor(false);	//	Also defauot to non trator, or no guild	pc->race=0; // Default human race	if (buffer[s][0x46]!='\x00')	{		pc->setId(0x0191);		pc->xid = 0x0191;	}	pc->setSkin( (buffer[s][0x50]|0x80 << 8) + buffer[s][0x51] );	if ( pc->skin() < 0x83EA || pc->skin() > 0x8422 )	{		pc->setSkin( 0x83EA );	}	pc->setXSkin(pc->skin());	pc->setPriv(defaultpriv1);	pc->priv2=defaultpriv2;	if (acctno[s]==0)	{		pc->setPriv(0xE7);		pc->priv3[0]=0xFFFFFFFF; // lb, meta gm		pc->priv3[1]=0xFFFFFFFF;		pc->priv3[2]=0xFFFFFFFF;		pc->priv3[3]=0xFFFFFFFF;		pc->priv3[4]=0xFFFFFFFF;		pc->priv3[5]=0xFFFFFFFF;		pc->priv3[6]=0xFFFFFFFF;		pc->setMenupriv(-1); // lb, menu priv	}	else	{		unsigned int i;		for (i = 0; i < 7; ++i) // this overwrites all previous settings !			pc->priv3[i] = metagm[2][i]; // player defaults is 2	}	pc->moveTo(SrvParams->startLocation()[buffer[s][0x5B]].pos);	pc->dir=4;	pc->hp=pc->st=buffer[s][0x47];	if (pc->st>45) pc->st=45;		// fix for hack exploit	if (pc->st<10) pc->st=10;	totalstats=pc->st;	short d=buffer[s][0x48];	if (d>45) d=45;		// fix for hack exploit	if (d<10) d=10;	if (d+totalstats>65) d=65-totalstats;	totalstats+=d;	pc->setDex(d);	pc->stm=d;	pc->mn=pc->in=buffer[s][0x49];	if (pc->in>45) pc->in=45;		// fix for hack exploit	if (pc->in<10) pc->in=10;	if (pc->in+totalstats>65) pc->in=65-totalstats;	if (buffer[s][0x4b]>50) buffer[s][0x4b]=50; // fixes for hack exploit	totalskills=buffer[s][0x4b];	if (buffer[s][0x4d]>50) buffer[s][0x4d]=50;	if (buffer[s][0x4d]+totalskills>100) buffer[s][0x4d]=100-totalskills;	totalskills+=buffer[s][0x4d];	if (buffer[s][0x4f]>50) buffer[s][0x4f]=50;	if (buffer[s][0x4f]+totalskills>100) buffer[s][0x4f]=100-totalskills;	for (ii=0;ii<TRUESKILLS;ii++)	{		pc->baseskill[ii]=0;		if (ii==buffer[s][0x4a]) pc->baseskill[buffer[s][0x4a]]=buffer[s][0x4b]*10;		if (ii==buffer[s][0x4c]) pc->baseskill[buffer[s][0x4c]]=buffer[s][0x4d]*10;		if (ii==buffer[s][0x4e]) pc->baseskill[buffer[s][0x4e]]=buffer[s][0x4f]*10;		Skills->updateSkillLevel(pc, ii);	}	if (validhair(buffer[s][0x52],buffer[s][0x53]))	{		const P_ITEM pi = Items->SpawnItem(s,pc,1, "#", 0, buffer[s][0x52], buffer[s][0x53], static_cast<unsigned short>(buffer[s][0x54]<<8)+buffer[s][0x55],0,0);		if(pi == NULL) return;		if ( pi->color() < 0x044E || pi->color() > 0x04AD )		{			pi->setColor( 0x044E );		}		pi->setContSerial(pc->serial);		pi->setLayer( 0x0B );	}	if ( (validbeard(buffer[s][0x56],buffer[s][0x57])) && (pc->id2==0x90) )	{		const P_ITEM pi = Items->SpawnItem(s,pc,1, "#", 0, buffer[s][0x56], buffer[s][0x57], static_cast<unsigned short>(buffer[s][0x58]<<8) + buffer[s][0x59],0,0);		if(pi == NULL) return;//AntiChrist to preview crashes		if ( pi->color() < 0x044E || pi->color() > 0x04AD )		{			pi->setColor( 0x044E );		}		pi->setContSerial(pc->serial);		pi->setLayer( 0x10 );	}	{	// just to limit the scope of pi	// - create the backpack	P_ITEM pi = Items->SpawnItem(s,pc,1, "#", 0, 0x0E, 0x75, 0, 0,0);	if (pi == NULL)		return;	pc->packitem = pi->serial;	pi->setContSerial(pc->serial);	pi->setLayer( 0x15 );	pi->setType( 1 );	pi->dye=1;	}	{	// limit the scope of pi	const P_ITEM pi = Items->SpawnItem(s,pc,1,"#",0,0x09,0x15,0,0,0);	if(pi == NULL) return;//AntiChrist to preview crashes	switch (RandomNum(0, 1))	{	case 0:		if ((pc->id() == 0x0190) && (pc->xid == 0x0190))		{			pi->setId( 0x1539 );			pi->setLayer( 0x04 ); // pant		} else		{			pi->setId( 0x1516 );			pi->setLayer( 23 ); //skirt		}		break;	case 1:		if ((pc->id() == 0x0190) && (pc->xid == 0x0190))		{			pi->setId(0x152E);			pi->setLayer( 0x04 );		} else		{			pi->setId(0x1537);			pi->setLayer( 23 );		}		break;	}	// pant/skirt color -> old client code, random color	pi->setColor( static_cast<unsigned short>(buffer[s][102]<<8) + buffer[s][103] );	pi->setContSerial(pc->serial);	pi->setType( 0 );	pi->dye=1;	pi->hp=10;	pi->priv |= 0x02; // Mark as a newbie item	}	{	// limit the scope of pi	const P_ITEM pi = Items->SpawnItem(s,pc,1,"#",0,0x09,0x15,0,0,0); // spawn pants	if(pi == NULL) return;//AntiChrist to preview crashes	if (!(rand()%2))	{		pi->setId(0x1EFD);	}	else	{		pi->setId(0x1517);	}	pi->setColor( static_cast<unsigned short>(buffer[s][100]<<8) + buffer[s][101] );	pi->setContSerial(pc->serial);	pi->setLayer( 0x05 );	pi->dye=1;	pi->hp=10;	pi->def=1;	pi->priv |= 0x02; // Mark as a newbie item	}	{	// limit the scope of pi	const P_ITEM pi = Items->SpawnItem(s,pc,1,"#",0,0x17,0x0F,0x0287,0,0); // shoes	if(pi == NULL) return;//AntiChrist to preview crashes	pi->setContSerial(pc->serial);	pi->setLayer( 0x03 );	pi->dye=1;	pi->hp=10;	pi->def=1;	pi->priv |= 0x02; // Mark as a newbie item	}	{	// limit the scope of pi	const P_ITEM pi = Items->SpawnItem(s,pc,1,"#",0,0x0F,0x51,0,0,0); // dagger	if(pi == NULL) return;	pi->setContSerial(pc->serial);	pi->setLayer( 0x01 );	//pi->att=5;	pi->hp=10;	pi->setSpeed( 50 );	pi->setLodamage( 3 );	pi->setHidamage( 15 );	pi->setItemhand( 1 );	pi->priv |= 0x02; // Mark as a newbie item	}	currchar[s] = pc;	newbieitems(s, pc);	perm[s]=1;	if(pc->st<10)		pc->st=10;	if(pc->in<10)		pc->in=10;	if(pc->effDex()<10)		pc->setDex(10);	Network->startchar(s);}