if( Magic->requireTarget( pc->spell ) ) { target(s, 0, 1, 0, 100, spells[pc->spell].strToSay ); } else { Magic->NewCastSpell( s ); } pc->casting=0; pc->spelltime=0; pc->priv2 &= 0xfd; } else if (pc->nextact<=0)
Magic->AfterSpellDelay( s, pc ); } else if (pc->nextact<=0)
void checkPC(P_CHAR pc, unsigned int currenttime)//Char mapRegions{	int y,x, timer;//, valid=0;	char t[120];	if ( pc == NULL ) return;	UOXSOCKET s = calcSocketFromChar(pc);//Only calc socket once!	Magic->CheckFieldEffects2(currenttime, pc, 1);//Lag fix	if (!pc->dead && pc->swingtarg==-1 )		Combat->DoCombat(pc, currenttime);	else if(!pc->dead && (pc->swingtarg>=0 && pc->timeout<=currenttime))		Combat->CombatHitCheckLoS(pc, currenttime);/*	if (wtype==1 && raindroptime<=currenttime && !noweather[s]) // implment. of xuri's raindrop idea, LB	{		switch(rand()%3)		{		case 0:soundeffect2(i,0x00,0x24); // fall-throughs intentional !!		case 1:soundeffect2(i,0x00,0x23);		 case 2:soundeffect2(i,0x00,0x22);		}	} */	if (pc->smoketimer>currenttime)	{		if (pc->smokedisplaytimer<=currenttime)		{			pc->smokedisplaytimer=currenttime+5*MY_CLOCKS_PER_SEC;			staticeffect(pc, 0x37, 0x35, 0, 30);			soundeffect2(pc, 0x002B);			switch( RandomNum(0, 6) )			{			 case 0:	npcemote(s, pc, "*Drags in deep*",1 );				break;			 case 1:	npcemote(s, pc, "*Coughs*",1 );						break;			 case 2:	npcemote(s, pc, "*Retches*",1 );					break;			 case 3:	npcemote(s, pc, "*Hacking cough*",1 );				break;			 case 4:	npcemote(s, pc, "*Sighs in contentment*",1 );		break;			 case 5:	npcemote(s, pc, "*Puff puff*",1 );					break;			 case 6:	npcemote(s, pc, "Wheeeee!!! Xuri's smoking!",1 );	break;			 default:	break;			}		}	}	if (LSD[s]) do_lsd(s); //LB's LSD potion-stuff	if (pc->isPlayer() && online(pc) && pc->squelched==2)	{		if (pc->mutetime!=-1)		{			if (pc->mutetime<=currenttime||overflow)			{				pc->squelched=0;				pc->mutetime=-1;				sysmessage(s, "You are no longer squelched!");			}		}	}	if (pc->isPlayer() && online(pc))	{		if ( pc->crimflag > 0 && ( pc->crimflag <= currenttime || overflow ) &&  pc->isCriminal() )//AntiChrist		{			sysmessage(s,"You are no longer a criminal.");			pc->crimflag=-1;			pc->setInnocent();		}		if (pc->murderrate<currenttime)//AntiChrist		{			if (pc->kills>0)				pc->kills--;			if ((pc->kills==repsys.maxkills)&&(repsys.maxkills>0))				sysmessage(s, "You are no longer a murderer.");			pc->murderrate=(repsys.murderdecay*MY_CLOCKS_PER_SEC)+currenttime;//AntiChrist		}		setcharflag(pc);//AntiChrist	}	if (pc->isPlayer() && pc->casting)//PC casting a spell	{		pc->nextact--;		if (pc->spelltime<=currenttime||overflow)//Spell is complete target it.		{			//currentSpellType[s]=0;//Normal Spell			if( Magic->requireTarget( pc->spell ) )			{				target(s, 0, 1, 0, 100, spells[pc->spell].strToSay );			}			else			{				Magic->NewCastSpell( s );			}			pc->casting=0;			pc->spelltime=0;			pc->priv2 &= 0xfd; // unfreeze, bugfix LB		} else if (pc->nextact<=0)//redo the spell action		{			pc->nextact=75;			impaction(s, pc->spellaction);		}	}	if(SrvParms->bg_sounds>=1)	{		if(SrvParms->bg_sounds>10) SrvParms->bg_sounds=10;		timer=SrvParms->bg_sounds*100;		if (timer==0) timer=1;		if( online(pc) && pc->isPlayer() && !pc->dead && ((rand()%(timer))==(timer/2))) bgsound(pc); //lb, bgsound uses array positions not sockets !	}	if( pc->spiritspeaktimer > 0 && pc->spiritspeaktimer <= uiCurrentTime)		pc->spiritspeaktimer = 0;		// Blackwinds Jail stuff.	if (pc->cell>0)	{		if ((pc->jailtimer>0) && (pc->jailtimer <= uiCurrentTime))		{			sysmessage(s,"Your jail time is over!");						if (pc != NULL)			{				if(pc->cell==0)				{								sysmessage(s,"You're not in jail already ? Please report to GM");					pc->jailtimer=0;					sprintf((char*)temp,"%i cause bug in jail system.",pc->account);					savelog((char*)temp,"server.log");				}				else				{					jails[pc->cell].occupied = false;					pc->moveTo(jails[pc->cell].oldpos);					pc->cell=0;					pc->jailsecs=0;					pc->jailtimer=0;					pc->priv2=0;					teleport(pc);										sprintf((char*)temp,"%s is auto-released from jail \n",pc->name.c_str());					savelog((char*)temp,"server.log");										sysmessage(s, "You are released.");				}			}					}	}			// LB, changed to seconds instead of crappy #of checks, 21/9/99	if(pc->trackingtimer > currenttime && online(pc))	{		if(pc->trackingdisplaytimer<=currenttime)		{			pc->trackingdisplaytimer=currenttime+tracking_data.redisplaytime*MY_CLOCKS_PER_SEC;			Skills->Track(pc);		}	} else	{		if (pc->trackingtimer>(currenttime/10)) // dont send arrow-away packet all the time		{			pc->trackingtimer=0;			unsigned char arrow[7] = {0xBA, 0,};			P_CHAR pc_trackingTarget = FindCharBySerial(pc->trackingtarget);			arrow[0]='\xBA';			arrow[1]=0;			arrow[2]=(pc_trackingTarget->pos.x-1)>>8;			arrow[3]=(pc_trackingTarget->pos.x-1)%256;			arrow[4]=pc_trackingTarget->pos.y>>8;			arrow[5]=pc_trackingTarget->pos.y%256;			Xsend(s,arrow,6);		}	}	if (SrvParms->hungerrate>1 && (pc->hungertime<=currenttime || overflow))	{		if (!pc->isGMorCounselor() && pc->hunger) pc->hunger--; //Morrolan GMs and Counselors don't get hungry		switch(pc->hunger)		{		case 6: break; //Morrolan		case 5: sysmessage(s,"You are still stuffed from your last meal");	break;		case 4:	sysmessage(s,"You are not very hungry but could eat more");	break;		case 3:	sysmessage(s,"You are feeling fairly hungry");				break;		case 2:	sysmessage(s,"You are extremely hungry");					break;		case 1:	sysmessage(s,"You are very weak from starvation");			break;		case 0:			if (!pc->isGMorCounselor())				sysmessage(s,"You must eat very soon or you will die!");			break;		}		pc->hungertime = currenttime+(SrvParms->hungerrate*MY_CLOCKS_PER_SEC); // Bookmark	}	if (((hungerdamagetimer<=currenttime)||(overflow))&&(SrvParms->hungerdamage>0)) // Damage them if they are very hungry	{		hungerdamagetimer=currenttime+(SrvParms->hungerdamagerate*MY_CLOCKS_PER_SEC); /** set new hungertime **/		if (pc->hp > 0 && pc->hunger<2 && !pc->isGMorCounselor() && !pc->dead)		{			sysmessage(s,"You are starving !");			pc->hp -= SrvParms->hungerdamage;			updatestats(pc, 0);			if(pc->hp<=0)			{				sysmessage(s,"You have died of starvation");				deathstuff(pc);			}		}	}	// new math + poison wear off timer added by lord binary !	if ( pc->poisoned && (online(pc) || pc->isNpc()) && !pc->isInvul() )	{		if (pc->poisontime<=currenttime || (overflow))		{			if (pc->poisonwearofftime>currenttime) // lb, makes poison wear off pc's			{				switch (pc->poisoned)				{				case 1:					pc->poisontime=currenttime+(5*MY_CLOCKS_PER_SEC);					if ( pc->poisontxt<=currenttime || (overflow))					{						pc->poisontxt=currenttime+(10*MY_CLOCKS_PER_SEC);						sprintf(t,"* %s looks a bit nauseous *", pc->name.c_str());						pc->emotecolor = 0x0026;//buffer[s][4];						npcemoteall(pc,t,1);					}				 					pc->hp -= max(((pc->hp)*RandomNum(5,15))/100, RandomNum(0,1) ); // between 0% and 10% of player's hp  					updatestats(pc, 0);					break;				case 2:					pc->poisontime=currenttime+(4*MY_CLOCKS_PER_SEC);					if ((pc->poisontxt<=currenttime)||(overflow))					{						pc->poisontxt=currenttime+(10*MY_CLOCKS_PER_SEC);						sprintf(t,"* %s looks disoriented and nauseous! *",pc->name.c_str());						pc->emotecolor = 0x0026;//buffer[s][4];						npcemoteall(pc,t,1);					}										pc->hp -= max(((pc->hp)*RandomNum(10,20))/100, RandomNum(0,1)); //between 10% and 20% of player's hp 					updatestats(pc, 0);					break;				case 3:					pc->poisontime=currenttime+(3*MY_CLOCKS_PER_SEC);					if ( pc->poisontxt <= currenttime ||(overflow))					{						pc->poisontxt = currenttime+(10*MY_CLOCKS_PER_SEC);						sprintf(t,"* %s is in severe pain! *", pc->name.c_str());						pc->emotecolor = 0x0026;//buffer[s][4];						npcemoteall(pc,t,1);					}					x=RandomNum(1,3);					y=RandomNum(5,10);					y=10;										pc->hp -= max(((pc->hp)*RandomNum(20,30))/100, RandomNum(0,1)); //between 20% and 30% of player's hp 					updatestats(pc, 0);					break; // lb !!!				case 4:					pc->poisontime = currenttime+(3*MY_CLOCKS_PER_SEC);					if ( pc->poisontxt <= currenttime || (overflow))					{						pc->poisontxt=currenttime+(10*MY_CLOCKS_PER_SEC);						sprintf(t,"* %s looks extremely weak and is wrecked in pain! *", pc->name.c_str());						pc->emotecolor = 0x0026;//buffer[s][4];						npcemoteall(pc,t,1);					}					x = RandomNum(3,6);					y = 20;									pc->hp -= max(((pc->hp)*RandomNum(30,40))/100, 1); //between 30% and 40% of player's hp 					updatestats(pc, 0);					break;				default:					clConsole.send("ERROR: Fallout of switch statement without default. wolfpack.cpp, checkPC()\n"); //Morrolan					pc->poisoned=0;					return;				}				if (pc->hp<1)				{					deathstuff(pc);					sysmessage(s, "The poison has killed you.");				}			} // end switch		} // end if poison-wear off-timer	} // end if poison-damage timer	if ( pc->poisoned && pc->poisonwearofftime<=currenttime && online(pc) )	{		pc->poisoned = 0;		impowncreate(s, pc, 1); // updating to blue stats-bar ...		sysmessage(s, "The poison has worn off.");	}	if( pc->onhorse )	{		P_ITEM pHorse = pc->GetItemOnLayer(0x19);		if(!pHorse)		{			pc->onhorse = false;	// turn it off, we aren't on one because there's no item!			return;		}		else		{			if( pHorse->decaytime != 0 && ( pHorse->decaytime <= uiCurrentTime || overflow ) )			{				pc->onhorse = false;				Items->DeleItem( pHorse );			}		}	}}