for (ci=0;ci<contsp[serhash].max;ci++) { i2=contsp[serhash].pointer[ci];
vector<SERIAL> vecContainer = contsp.getData(serial); for (ci=0;ci<vecContainer.size();ci++) { i2=calcItemFromSer(vecContainer[ci]);
void wear_item(P_CLIENT ps) // Item is dropped on paperdoll{	int j, k;	tile_st tile;	int serial, serhash, ci, i2, letsbounce=0; // AntiChrist (5) - new ITEMHAND system	UOXSOCKET s=ps->GetSocket();	int cc=ps->GetCurrChar();	P_CHAR pc_currchar = MAKE_CHARREF_LR(cc);	int cserial=calcserial(buffer[s][6],buffer[s][7],buffer[s][8],buffer[s][9]);	if(cserial==-1) return;	k=calcCharFromSer( cserial );		if( chars[k].dead )  //Exploit fix: Dead ppl can't equip anything.		return;		P_ITEM pi=FindItemBySerPtr(buffer[s]+1);	if (!pi) return;//	if (clientDimension[s]==3)//	{	Map->SeekTile(pi->id(), &tile);			// sprintf(temp, "Tiledata: name: %s flag1: %i flag2: %i flag3: %i flag4: %i layer: %i\n", tile.name, tile.flag1, tile.flag2, tile.flag3, tile.flag4, tile.layer);	// clConsole.send(temp);			if (tile.layer==0)	{		sysmessage(s,"You can't wear that");		Sndbounce5(s);		if (ps->IsDragging())		{			ps->ResetDragging();			item_bounce4(s,pi);			UpdateStatusWindow(s,pi);		}		return;	}//	}	if (pi->id1>=0x40) return; // LB, client crashfix if multi-objects are moved to PD	if (k==cc || pc_currchar->isGM()) 	{		if (k!=-1) //lb			if (k==cc && pi->st>chars[k].st)			{				sysmessage(s,"You are not strong enough to use that.");				Sndbounce5(s);				if (ps->IsDragging())				{					ps->ResetDragging();					item_bounce4(s,pi);					UpdateStatusWindow(s,pi);				}				return;			}						if (pc_currchar->id1==0x01 && pc_currchar->id2==0x90) // Ripper...so males cant wear female armor			if (pi->id1==0x1c && ( pi->id2==0x00 || pi->id2==0x02 || pi->id2==0x04 ||                pi->id2==0x06 || pi->id2==0x08 || pi->id2==0x0a || pi->id2==0x0c))			{				sysmessage(s,"You cant wear female armor!");				Sndbounce5(s);				if (ps->IsDragging())                {					ps->ResetDragging();					item_bounce4(s,pi);				  					UpdateStatusWindow(s,pi);				}				return;			}//			if (clientDimension[s]==2) Map->SeekTile(pi->id(), &tile);			if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1)))&&((pc_currchar->priv2&1)==0)) ||				( (pi->magic==3|| pi->magic==4) && !pc_currchar->Owns(pi)))			{				item_bounce6(ps,pi);				return;			}				// - AntiChrist (4) - checks for new ITEMHAND system		// - now you can't equip 2 hnd weapons with 1hnd weapons nor shields!!		serial=pc_currchar->serial;		serhash=serial%HASHMAX;	  	for (ci=0;ci<contsp[serhash].max;ci++)		{			i2=contsp[serhash].pointer[ci];			if (i2!=-1 && items[i2].contserial==serial)			{				if (items[i2].itmhand==1 && pi->itmhand==1)				{					sysmessage(s,"You already have a weapon equipped!");					letsbounce=1;				}				else if (items[i2].itmhand==2 && pi->itmhand==1)				{					sysmessage(s,"Your hands are both occupied!");					letsbounce=1;				}				else if (items[i2].itmhand==1 && pi->itmhand==2)				{					sysmessage(s,"You cannot equip a two handed weapon with a weapon equipped!");					letsbounce=1;				}				else if (items[i2].itmhand==2 && pi->itmhand==2)				{					sysmessage(s,"You cannot equip a two handed weapon with a two handed weapon equipped!");					letsbounce=1;				}				else if (items[i2].itmhand==2 && pi->itmhand==3)				{					sysmessage(s,"You cannot equip a shield with a two handed weapon equipped!");					letsbounce=1;				}				else if (items[i2].itmhand==3 && pi->itmhand==2)				{					sysmessage(s,"You cannot equip a two handed weapon with a shield equipped!");					letsbounce=1;				}				else if (items[i2].layer == tile.layer) 				{ 					sysmessage(s, "You already have an armor equipped!");					letsbounce = 1;				}			}			if(letsbounce)//Let's bounce the item			{				Sndbounce5(s);				if (ps->IsDragging())				{					ps->ResetDragging();					item_bounce4(s,pi);					UpdateStatusWindow(s,pi);					itemsfx(s, pi->id());		// antichrist				}				return;			} 		}		// - AntiChrist (5) - ITEMHAND CHECKS END -		// probably these next checks could be removed with the ITEMHAND thing - AntiChrist		/*if ( pc_currchar->getShield() && (buffer[s][5]==2) ) //Morrolan test		{			sysmessage(s, "You already have a shield equiped! You must unequip it to use this.");			item_bounce6(ps,pi);			return;		}		if ( pc_currchar->getWeapon() && (buffer[s][5]==1) )//Morrolan test		{			sysmessage(s, "You already have a weapon equiped!");			item_bounce6(ps,pi);			return;		}*/		if (!(pc_currchar->isGM())) //Ripper..players cant equip items on other players or npc`s paperdolls.		{			if ((k != cc) && (!chars[k].isNpc()))			{				sysmessage(s, "You cant put items on other players!");				item_bounce6(ps,pi);				return;			}		}		pi->SetContSerial(LongFromCharPtr(buffer[s]+6));		pi->layer=buffer[s][5];		// AntiChrist - now the STAT BONUS works -		pc_currchar->st = (pc_currchar->st + pi->st2);		pc_currchar->chgDex(pi->dx2);		pc_currchar->in = (pc_currchar->in + pi->in2);		if (pi->trigtype==2) // -Frazurbluu- Trigger Type 2 is my new trigger type *-		{			triggerwitem(s, DEREF_P_ITEM(pi), 1); // trigger is fired		}			// AntiChrist -- for poisoned items		if(pi->poisoned)		{			if(pc_currchar->poisoned< (pi->poisoned))				pc_currchar->poisoned=pi->poisoned;		}		if (showlayer)	clConsole.send("Item equipped on layer %i.\n",pi->layer);				SndRemoveitem(pi->serial);				LongToCharPtr(pi->serial,wearitem+1);		ShortToCharPtr(pi->id(),wearitem+5);		wearitem[8]=pi->layer;		LongToCharPtr(pi->contserial,wearitem+9);		wearitem[13]=pi->color1;		wearitem[14]=pi->color2;		Xsend(s, wearitem, 15);		wornitems(s, k);//send update to current socket		// -Frazurbluu- Worn item triggers will need code here		// Trigger cod ewill also need the adjustments made for skill adding		// An apply/unapply type of variable must be added for skill gains		// Spell Item will have to be considered, like a necklace of reflection		for (j=0;j<now;j++)		{			if (perm[j] && inrange1p(k, currchar[j]) && (j!=s))//and to all inrange sockets (without re-sending to current socket)//AntiChrist				wornitems(j, k);		}				itemsfx(s, pi->id());	// Dupois - see itemsfx() for details	// Added Oct 09, 1998		Weight->NewCalc(cc);	// Ison 2-20-99		statwindow(s,cc);				if (pi->glow>0)		{			pc_currchar->removeHalo(pi); // if gm equips on differnt player it needs to be deleted out of the hashteble			chars[k].addHalo(pi);			chars[k].glowHalo(pi);		}    }}