for (ci=0;ci<contsp[pc->serial%HASHMAX].max;ci++) { j=contsp[pc->serial%HASHMAX].pointer[ci]; if (j!=-1) { const P_ITEM pi_j=MAKE_ITEMREF_LR(j);
vector<SERIAL> vecContainer = contsp.getData(pc->serial); for (ci = 0; ci < vecContainer.size(); ci++) { P_ITEM pi_j = FindItemBySerial(vecContainer[ci]); if (pi_j != NULL) {
void sendperson_lsd(UOXSOCKET s, CHARACTER c, char color1, char color2){	int j, k,ci,color,c1,c2,b,cc1=0,cc2=0;	unsigned char oc[1024];	CHARACTER i=c;	if ( (i < 0) || (i > cmem)) return;	P_CHAR pc = MAKE_CHARREF_LR(i)	if (s==-1) return;	int sendit;	P_CHAR pc_currchar = MAKE_CHARREF_LR(currchar[s]);	if (pc_currchar->isGM()) sendit=1; else // gm ? -> yes, send everything :)	{ // no, -> dont show hidden & logged out chars		if (pc->isHidden() && i!=currchar[s]) sendit=0; else sendit=1; // dont show hidden persons, even lsd'ed		if ( (pc->isPlayer()) && !online(i)) sendit=0;	}	if (!online(i) && (pc->isPlayer()) && (pc_currchar->isGM())==0 ) 	{		sendit=0;		removeitem[1]=pc->ser1;		removeitem[2]=pc->ser2;		removeitem[3]=pc->ser3;		removeitem[4]=pc->ser4;		Xsend(s, removeitem, 5);	}	if (!sendit) return;	oc[0]=0x78; // Message type 78	oc[3]=pc->ser1; // Character serial number	oc[4]=pc->ser2; // Character serial number	oc[5]=pc->ser3; // Character serial number	oc[6]=pc->ser4; // Character serial number	oc[7]=pc->id1; // Character art id	oc[8]=pc->id2; // Character art id	int x=pc->pos.x; /* | 0x8000;*/ // LB bugfix	oc[9]= (x>>8);	// Character x position	oc[10]=x%256; // Character x position	oc[11]=pc->pos.y>>8; // Character y position	oc[12]=pc->pos.y%256; // Character y position	oc[13]=pc->pos.z; // Character z position	oc[14]=pc->dir; // Character direction	ShortToCharPtr(pc->skin, &oc[15]);	// Character skin color	oc[17]=0; // Character flags	/*if (pc->hidden || !(online(i)||pc->npc)) oc[17]=oc[17]|0x80;	// Show hidden state correctly	if (pc->poisoned) oc[17]=oc[17]|0x04; //AntiChrist -- thnx to SpaceDog */	k=19;	oc[18]=3;	if (rand()%3==0) oc[18]=rand()%6;/*	cc1=pc->skin1;	cc2=pc->skin2;	if (1==1)	{		color=rand()%0x3e9;		color+=rand()%8;		color=color%0x03E9;		c1=color>>8;		c2=color%256;		if ((((c1<<8)+c2)<0x0002) || (((c1<<8)+c2)>0x03E9) )		{			c1=0x03;			c2=0xE9;		}		b=((((c1<<8)+c2)&0x4000)>>14)+((((c1<<8)+c2)&0x8000)>>15);		if (b)		{			c1=0x1;			c2=rand()%255;		}		oc[15]=c1;		oc[16]=c2;		cc1=c1;		cc2=c2;	}*/#pragma note("Hope this *translation* is correct")//	UI16 cc = pc->skin;	color = RandomNum(0, 0x03E9);	color += RandomNum(0, 8);	color %= 0x03E9;	if (color < 0x0002 || color > 0x03E9)		color = 0x03E9;	if (color & 0xC000)	{		color = 0x1000;		color |= RandomNum(0, 255);	}	ShortToCharPtr(color, &oc[15]);	for (j=0;j<MAXLAYERS;j++) layers[j] = 0;	for (ci=0;ci<contsp[pc->serial%HASHMAX].max;ci++)	{		j=contsp[pc->serial%HASHMAX].pointer[ci];		if (j!=-1)		{			const P_ITEM pi_j=MAKE_ITEMREF_LR(j);	// on error return			if (pc->Wears(pi_j) && (!pi_j->free))			{				if ( layers[pi_j->layer] == 0 )				{					LongToCharPtr(pi_j->serial,oc+k+0);					ShortToCharPtr(pi_j->id(),oc+k+4);					oc[k+6]=pi_j->layer;					k=k+7;					if /*(pi_j->color1!=0 || pi_j->color2!=0)*/ (1==1)					{						oc[k-3]=oc[k-3]|0x80;						if ( rand()%9<7 ) // send fake colors, 2/3 base color						{							oc[k+0]=color1;							oc[k+1]=color2;						}						else // 1/3 new color						{							color=rand()%0x3e9;							color+=rand()%8;							color=color%0x03E9;							c1=color>>8;							c2=color%256;							if ((((c1<<8)+c2)<0x0002) || (((c1<<8)+c2)>0x03E9) )							{								c1=0x03;								c2=0xE9;							}							b=((((c1<<8)+c2)&0x4000)>>14)+((((c1<<8)+c2)&0x8000)>>15);							if (b)							{								c1=0x1;								c2=rand()%255;							}								oc[k+0]=c1;								oc[k+1]=c2;						}						k=k+2;					}					layers[pi_j->layer] = 1;				}				else				{					;				}			}		}	}	oc[k+0]=0;// Not well understood. It's a serial number. I set this to my serial number,	oc[k+1]=0;// and all of my messages went to my paperdoll gump instead of my character's	oc[k+2]=0;// head, when I was a character with serial number 0 0 0 1.	oc[k+3]=0;	k=k+4;	oc[1]=k>>8;	oc[2]=k%256;	// without 0x1d client doesnt show 0x77 changes	removeitem[0]=0x1d;	removeitem[1]=pc->ser1;	removeitem[2]=pc->ser2;	removeitem[3]=pc->ser3;	removeitem[4]=pc->ser4;	Xsend(s, removeitem, 5);	if (currchar[s]==i)	{		goxyz[0]=0x20;		goxyz[1]=pc->ser1;		goxyz[2]=pc->ser2;		goxyz[3]=pc->ser3;		goxyz[4]=pc->ser4;		goxyz[5]=pc->id1;		goxyz[6]=pc->id2;		/*if (rand()%10==0)		{			goxyz[5]=0;			goxyz[6]=rand()%0xff;		}*/		goxyz[8]=cc1;		goxyz[9]=cc2;		/*if(pc->poisoned) goxyz[10]=0x04; else goxyz[10]=0x00;	//AntiChrist -- thnx to SpaceDog		if (pc->hidden) goxyz[10]=goxyz[10]|0x80;*/		goxyz[10]=0;		goxyz[11]=pc->pos.x>>8;		goxyz[12]=pc->pos.x%256;		goxyz[13]=pc->pos.y>>8;		goxyz[14]=pc->pos.y%256;		goxyz[17]=pc->dir|0x80;		goxyz[18]=pc->pos.z;		Xsend(s, goxyz, 19);		walksequence[s]=-1;	}	Xsend(s, oc, k);	extmove[0]=0x77;	extmove[1]=pc->ser1;	extmove[2]=pc->ser2;	extmove[3]=pc->ser3;	extmove[4]=pc->ser4;	extmove[5]=pc->id1;	extmove[6]=pc->id2;	extmove[7]=pc->pos.x>>8;	extmove[8]=pc->pos.x%256;	extmove[9]=pc->pos.y>>8;	extmove[10]=pc->pos.y%256;	extmove[11]=pc->pos.z;	extmove[12]=pc->dir|0x80;	extmove[13]=cc1;	extmove[14]=cc2;	extmove[15]=0;	extmove[16]=3;	Xsend(s,extmove,17);}