int getcell=mapRegions->GetCell(pi->pos.x, pi->pos.y);
void explodeitem(int s, P_ITEM pi){	unsigned int dmg=0,len=0,c;	unsigned int dx,dy,dz;	int cc=currchar[s];	if (pi == NULL)		return;	P_CHAR pc_currchar = MAKE_CHARREF_LR(currchar[s]);	// - send the effect (visual and sound)	if (!pi->isInWorld()) //bugfix LB	{		pi->pos.x=pc_currchar->pos.x;		pi->pos.y=pc_currchar->pos.y;		pi->pos.z=pc_currchar->pos.z;		npcaction(cc,0x15);		soundeffect2(cc, 0x02, 0x07);	}	else	{		staticeffect2(pi, (unsigned char)0x36, (unsigned char)0xB0, (unsigned char)0x10, (unsigned char)0x80, (unsigned char)0x00); 		soundeffect3(pi, 0x0207);	}	len=pi->morex/250; //4 square max damage at 100 alchemy	switch (pi->morez)	{	case 1:dmg=RandomNum( 5,10) ;break;	case 2:dmg=RandomNum(10,20) ;break;	case 3:dmg=RandomNum(20,40) ;break;	default:		clConsole.send("ERROR: Fallout of switch statement without default. wolfpack.cpp, explodeitem()\n"); //Morrolan		dmg=RandomNum(5,10);	}	if (dmg<5) dmg=RandomNum(5,10);	// 5 points minimum damage	if (len<2) len=2;	// 2 square min damage range	unsigned long loopexit=0;	cRegion::RegionIterator4Chars ri(pi->pos);	for (ri.Begin(); ri.GetData() != ri.End(); ri++)	{		P_CHAR pc = ri.GetData();		if (pc != NULL)		{			if (pc->isInvul() || pc->npcaitype==17)		// don't affect vendors				continue;			if(pc->isGM() || (pc->isPlayer() && !online(c)))				continue;			dx=abs(pc->pos.x-pi->pos.x);			dy=abs(pc->pos.y-pi->pos.y);			dz=abs(pc->pos.z-pi->pos.z);			if ((dx<=len)&&(dy<=len)&&(dz<=len))			{				c=DEREF_P_CHAR(pc);				pc->hp-=dmg+(2-min(dx,dy));				updatestats(c, 0);				if (pc->hp<=0)				{					deathstuff(c);				}				else				{					npcattacktarget(c, cc);					updatechar(c);				}			}		}	}	int chain=0;	P_ITEM piMap;	loopexit=0;	int StartGrid=mapRegions->StartGrid(pi->pos.x, pi->pos.y);	int getcell=mapRegions->GetCell(pi->pos.x, pi->pos.y);	int increment=0;	int checkgrid, a;	for (checkgrid=StartGrid+(increment*mapRegions->GetColSize());increment<3;increment++, checkgrid=StartGrid+(increment*mapRegions->GetColSize()))	{		for (a=0;a<3;a++)		{			vector<SERIAL> vecEntries = mapRegions->GetCellEntries(checkgrid+a);			for ( unsigned int k = 0; k < vecEntries.size(); k++)			{				piMap = FindItemBySerial(vecEntries[k]);				if (piMap != NULL)				{					if (piMap->id()==0x0F0D && piMap->type==19) // check for expl-potions					{						dx=abs(pi->pos.x - piMap->pos.x);						dy=abs(pi->pos.y - piMap->pos.y);						dz=abs(pi->pos.z - piMap->pos.z);						if (dx<=2 && dy<=2 && dz<=2 && chain==0) // only trigger if in 2*2*2 cube						{							if (!(dx==0 && dy==0 && dz==0))							{								//chain=1; // maximum: one additional trigerred per check ..								if (rand()%2==1) chain=1; // LB - more aggressive - :)								tempeffect2(cc, piMap, 17, 0, 1, 0); // trigger ...							}						}					}				}			}		}	}	Items->DeleItem(pi);}