unsigned long loopexit=0;
void do_lsd(UOXSOCKET s){	P_CHAR pc_currchar = MAKE_CHAR_REF(currchar[s]);	if (rand()%15==0)	{		int c1,c2,color,ctr=0,b,xx,yy,di,icnt=0;		signed char zz;		int StartGrid=mapRegions->StartGrid(pc_currchar->pos.x,pc_currchar->pos.y);		unsigned int increment=0;		unsigned long loopexit=0;		for (unsigned int checkgrid=StartGrid+(increment*mapRegions->GetColSize());increment<3;increment++, checkgrid=StartGrid+(increment*mapRegions->GetColSize()))		{			for (int a=0;a<3;a++)			{				vector<SERIAL> vecEntries = mapRegions->GetCellEntries(checkgrid + a);				for ( unsigned int k = 0; k < vecEntries.size(); k++)				{					P_ITEM pi = FindItemBySerial(vecEntries[k]);					P_CHAR mapchar = FindCharBySerial(vecEntries[k]);					if (pi != NULL)					{						 color=(pi->color1<<8)+pi->color2; // fetch item's color and covert to 16 bit						 if (rand()%44==0) color+=pi->pos.x-pi->pos.y; else						 color+=pc_currchar->pos.x+pc_currchar->pos.y;						 color+=rand()%3; // add random "noise"						 ctr++;						 // lots of color consistancy checks						 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;						 }							 if (rand()%10==0) zz=pi->pos.z+rand()%33; else zz=pi->pos.z;						 if (rand()%10==0) xx=pi->pos.x+rand()%3; else xx=pi->pos.x;						 if (rand()%10==0) yy=pi->pos.y+rand()%3; else yy=pi->pos.y;						 di = itemdist(DEREF_P_CHAR(pc_currchar), pi);						 if (di<13) if (rand()%7==0)						 {							icnt++;							if (icnt%10==0 || icnt<10) 								senditem_lsd(s, pi, c1, c2, xx, yy, zz); // attempt to cut packet-bombing by this thing						 }						}// end of if item					else if (mapchar != NULL)// character					{						di = chardist(DEREF_P_CHAR(pc_currchar), DEREF_P_CHAR(mapchar));						if (di<10) if (rand()%10==0)						{							icnt++;							if (icnt%10==0 || icnt<10) 								sendperson_lsd(s, DEREF_P_CHAR(mapchar),c1,c2); // attempt to cut packet-bombing by this thing						}					}				}			}		}			if (rand()%33==0)		{			if (rand()%10>3) soundeffect5(s, 0x00, 0xF8); // lsd sound :)			else			{				int snd=rand()%19;				if (snd>9) soundeffect5(s,0x01,snd-10);				else soundeffect5(s,0,246+snd);			}			}	}}