if (((hungerdamagetimer<=currenttime)||(overflow))&&(SrvParams->hungerDamage()>0))
if( ( hungerdamagetimer <= currenttime ) && SrvParams->hungerDamage() )
void checkPC( P_CHAR pc, unsigned int currenttime ) //Char mapRegions{	cUOSocket *socket = pc->socket();	// We are not logged in so dont check anything at all.	if( !socket )		return;	int y,x, timer;//, valid=0;	char t[120];	if ( pc == NULL ) return;	// Check if the character is in a field which affects him	Magic->CheckFieldEffects2( currenttime, pc, 1 ); 		if( !pc->dead && pc->swingtarg() == -1 )		Combat->DoCombat( pc, currenttime );	else if( !pc->dead && ( pc->swingtarg() >= 0 && pc->timeout <= currenttime ) )		Combat->CombatHitCheckLoS( pc, currenttime );	// Guess it was taken out because of traffic-concerns ?/*	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->isPlayer() && pc->squelched() == 2 )	{		if( pc->mutetime() > 0 )		{			if (pc->mutetime()<=currenttime||overflow)			{				pc->setSquelched(0);				pc->setMutetime(0);				socket->sysMessage( tr( "You are no longer muted." ) );			}		}	}	if( pc->isPlayer() )	{		if ( pc->crimflag() > 0 && ( pc->crimflag() <= currenttime || overflow ) &&  pc->isCriminal() )//AntiChrist		{			socket->sysMessage( tr( "You are no longer criminal" ) );			pc->setCrimflag(0);			pc->setInnocent();		}		if( pc->murderrate() < currenttime )		{			if (pc->kills>0)				pc->kills--;			if ((pc->kills==SrvParams->maxkills())&&(SrvParams->maxkills()>0))				socket->sysMessage( tr( "You are no longer a murderer." ) );			pc->setMurderrate( ( SrvParams->murderdecay() * MY_CLOCKS_PER_SEC ) + currenttime );		}		setcharflag( pc );	}	if( pc->isPlayer() && pc->casting() )//PC casting a spell	{		pc->setNextact( pc->nextact() - 1 );		if( pc->spelltime() <= currenttime || overflow )//Spell is complete target it		{			// TODO: Reactivate when spellcasting is redone			//Magic->AfterSpellDelay( s, pc );		}		else if( pc->nextact() <= 0 )//redo the spell action		{			pc->setNextact( 75 );			pc->action( pc->spellaction() );		}	}	if( SrvParams->bgSound() >= 1 )	{		timer = SrvParams->bgSound() * 100;		if( timer == 0 )			timer = 1;		if( socket && !pc->dead && ( (rand()%(timer) ) == (timer/2))) 			bgsound( pc );	}	// Reset spirit-speak	if( pc->spiritspeaktimer > 0 && pc->spiritspeaktimer <= uiCurrentTime )		pc->spiritspeaktimer = 0;		// Jail stuff	if( pc->cell > 0 )	{		if( ( pc->jailtimer > 0 ) && ( pc->jailtimer <= uiCurrentTime ) )		{			socket->sysMessage( tr( "Your jail time is over!" ) );						if( pc )			{				if( pc->cell == 0 )				{								socket->sysMessage( tr( "You're not in jail already ? Please report to a GM. This has been logged." ) );					pc->jailtimer = 0;					savelog( tr( "%1 [0x%2] caused bug in jail system." ).arg( pc->name.c_str() ).arg( pc->serial, 8, 16 ), "server.log" );				}				else				{					jails[ pc->cell ].occupied = false;					pc->removeFromView( false );					pc->moveTo( jails[ pc->cell ].oldpos );					pc->resend( false );										pc->cell = 0;					pc->jailsecs = 0;					pc->jailtimer = 0;					pc->priv2 = 0;															savelog( tr( "%1 [0x%2] is automatically released from jail." ).arg( pc->name.c_str() ).arg( pc->serial, 8, 16 ), "server.log" );					socket->sysMessage( tr( "You have been released." ) );				}			}				}	}		// changed to seconds instead of crappy #of checks	// This is totally broken	/*if( pc->trackingtimer > currenttime )	{		// TODO: Disable quest-arrow here		if( pc->trackingdisplaytimer() <= currenttime )		{			pc->setTrackingdisplaytimer( currenttime + SrvParams->redisplaytime() * MY_CLOCKS_PER_SEC );			Skills->Track( pc );		}	}	else	{		// dont send arrow-away packet all the time		// NOTE: This should be send every 5 seconds (!)		if( pc->trackingtimer > ( currenttime / 10 ) )		{			pc->trackingtimer = 0;			unsigned char arrow[7] = {0xBA, 0,};			P_CHAR pc_trackingTarget = FindCharBySerial( pc->trackingtarget );		}	}*/	if( SrvParams->hungerRate() > 1 && ( pc->hungertime() <= currenttime || overflow ) )	{		if( !pc->isGMorCounselor() && pc->hunger() ) 			pc->setHunger( pc->hunger() - 1 ); // GMs and Counselors don't get hungry		switch( pc->hunger() )		{		case 6: break; //Morrolan		case 5: socket->sysMessage( tr("You are still stuffed from your last meal") );	break;		case 4:	socket->sysMessage( tr("You are not very hungry but could eat more") );	break;		case 3:	socket->sysMessage( tr("You are feeling fairly hungry") );				break;		case 2:	socket->sysMessage( tr("You are extremely hungry") );						break;		case 1:	socket->sysMessage( tr("You are very weak from starvation") );			break;		case 0:			if (!pc->isGMorCounselor())				socket->sysMessage( tr( "You must eat very soon or you will die!" ) );			break;		}		pc->setHungerTime( currenttime + ( SrvParams->hungerRate() * MY_CLOCKS_PER_SEC ) );	}	if (((hungerdamagetimer<=currenttime)||(overflow))&&(SrvParams->hungerDamage()>0)) // Damage them if they are very hungry	{		hungerdamagetimer=currenttime+(SrvParams->hungerDamageRate()*MY_CLOCKS_PER_SEC); /** set new hungertime **/		if( pc->hp > 0 && pc->hunger()<2 && !pc->isGMorCounselor() && !pc->dead )		{			socket->sysMessage( tr( "You are starving." ) );			pc->hp -= SrvParams->hungerDamage();						if( pc->hp <=0 )			{				socket->sysMessage( tr( "You have died of starvation." ) );				pc->kill();			}		}	}	// new math + poison wear off timer added by lord binary !	if( pc->poisoned() && !pc->isInvul() )	{		if( pc->poisontime() <= currenttime || ( overflow ) )		{			if( pc->poisonwearofftime() > currenttime ) // lb, makes poison wear off pc's			{				// We only support 4 levels of poison here.				switch( pc->poisoned() )				{				case 1:					pc->setPoisontime(currenttime+(5*MY_CLOCKS_PER_SEC));					if ( pc->poisontxt()<=currenttime || (overflow))					{						pc->setPoisontxt(currenttime+(10*MY_CLOCKS_PER_SEC));						pc->emote( tr( "*%1 looks a bit nauseous!*" ).arg( pc->name.c_str() ), 0x26 );					}				 					pc->hp -= QMAX(((pc->hp)*RandomNum(5,15))/100, RandomNum(0,1) ); // between 0% and 10% of player's hp  					updatestats(pc, 0);					break;				case 2:					pc->setPoisontime(currenttime+(4*MY_CLOCKS_PER_SEC));					if ((pc->poisontxt()<=currenttime)||(overflow))					{						pc->setPoisontxt(currenttime+(10*MY_CLOCKS_PER_SEC));						pc->emote( tr( "*%1 looks disoriented and nauseous!*" ).arg( pc->name.c_str() ), 0x26 );					}										pc->hp -= QMAX(((pc->hp)*RandomNum(10,20))/100, RandomNum(0,1)); //between 10% and 20% of player's hp					pc->updateHealth();					break;				case 3:					pc->setPoisontime(currenttime+(3*MY_CLOCKS_PER_SEC));										if( pc->poisontxt() <= currenttime ||(overflow))					{						pc->setPoisontxt(currenttime+(10*MY_CLOCKS_PER_SEC));						pc->emote( tr( "*%1 is in severe pain!*" ).arg( pc->name.c_str() ), 0x26 );					}										pc->hp -= QMAX( ( pc->hp * RandomNum( 20, 30 ) ) / 100, RandomNum( 0, 1 ) ); // between 20% and 30% of player's hp 					pc->updateHealth();					break;				case 4:					pc->setPoisontime( currenttime+(3*MY_CLOCKS_PER_SEC) );					if( pc->poisontxt() <= currenttime || (overflow) )					{						pc->setPoisontxt(currenttime+(10*MY_CLOCKS_PER_SEC));						pc->emote( tr( "*%1 looks extremely sick*" ).arg( pc->name.c_str() ), 0x26 );					}									pc->hp -= QMAX( ( pc->hp * RandomNum( 30, 40 ) ) / 100, 1 ); //between 30% and 40% of player's hp 					updatestats(pc, 0);					break;				default:					clConsole.send( tr( "Unknown poison type for Character %1 [0x%2]\n" ).arg( pc->name.c_str() ).arg( pc->serial, 8, 16 ) );					pc->setPoisoned( 0 );					return;				}				if( pc->hp < 1 )				{					socket->sysMessage( tr( "The poison killed you.") );					pc->kill();				}			} // end switch		} // end if poison-wear off-timer	} // end if poison-damage timer	if( pc->poisoned() && pc->poisonwearofftime() <= currenttime )	{		pc->setPoisoned( 0 );		pc->update(); // a simple status-update should be enough here		socket->sysMessage( tr( "The poison has worn off." ) );	}	// Horse checks ( Todo: move to DELEITEM + SETCONTSERIAL + SETLAYER )	if( pc->onHorse() )	{		P_ITEM pHorse = pc->GetItemOnLayer( 0x19 );		if( !pHorse )		{			pc->setOnHorse( 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->setOnHorse( false );				Items->DeleItem( pHorse );			}		}	}}