pc->tamed = 0;
void checkNPC(P_CHAR pc, unsigned int currenttime)//Char mapRegions{	if (pc == NULL)		return;	if (pc->stablemaster_serial != INVALID_SERIAL) return;	int pcalc;	char t[120];	Npcs->CheckAI(currenttime, pc);//Lag fix	Movement->NpcMovement(currenttime, pc);//Lag fix	setcharflag(pc);	if (!pc->dead && pc->swingtarg==-1 )		Combat->DoCombat(pc, currenttime);	else if(!pc->dead && (pc->swingtarg>=0 && pc->timeout<=currenttime))		Combat->CombatHitCheckLoS(pc,currenttime);	Magic->CheckFieldEffects2(currenttime, pc, 0);//Lag fix	restockNPC(currenttime, pc);	if (!pc->free) //bud	{		if ((pc->disabled>0)&&((pc->disabled<=currenttime)||(overflow)))		{			pc->disabled=0;		}		if (pc->summontimer<=currenttime||(overflow))		{			if(pc->summontimer>0)			{				// Dupois - Added Dec 20, 1999				// QUEST expire check - after an Escort quest is created a timer is set				// so that the NPC will be deleted and removed from the game if it hangs around				// too long without every having its quest accepted by a player so we have to remove				// its posting from the message board before icing the NPC				// Only need to remove the post if the NPC does not have a follow target set				if ( (pc->questType==ESCORTQUEST) && (pc->ftarg == INVALID_SERIAL) )				{					MsgBoardQuestEscortRemovePost( pc );					MsgBoardQuestEscortDelete( pc );					return;				}				// Dupois - End				soundeffect2(pc, 0x01FE);				pc->dead=true;				Npcs->DeleteChar(pc);				return;			}		}	}//	if ((pc->fleeat==0)) pc->fleeat=SrvParms->npc_base_fleeat;//	if ((pc->reattackat==0)) pc->reattackat=SrvParms->npc_base_reattackat;	if (pc->npcWander!=5 &&	pc->hp < pc->st*pc->fleeat/100)	{		pc->oldnpcWander = pc->npcWander;		pc->npcWander=5;		pc->setNextMoveTime();	}	if (pc->npcWander==5 &&	pc->hp > pc->st*pc->reattackat/100)	{		pc->npcWander = pc->oldnpcWander;		pc->setNextMoveTime();		pc->oldnpcWander=0; // so it won't save this at the wsc file	}	// end of flee code	// new poisoning code, Lord Binary	if (pc->poisoned && !(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 -= RandomNum(1,2);					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);					}					pcalc = ( ( pc->hp * RandomNum(2,5) ) / 100) + RandomNum(0,2); // damage: 1..2..5% of hp's+ 1..2 constant					pc->hp -= pcalc;					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);					}					pcalc=( ( pc->hp * RandomNum(5,10) ) / 100 ) + RandomNum(1,3); // damage: 5..10% of hp's+ 1..2 constant					pc->hp -= pcalc;					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);					}					pcalc=( (pc->hp * RandomNum(10,15) ) / 100 ) + RandomNum(3,6); // damage:10 to 15% of hp's+ 3..6 constant, quite deadly <g>					pc->hp -= pcalc;					updatestats(pc, 0);					break;				default:					clConsole.send("ERROR: Fallout of switch statement without default. wolfpack.cpp, checkNPC()\n"); //Morrolan					pc->poisoned=0;					return;				}				if (pc->hp<1)				{					deathstuff(pc);				}			} // end switch		} // end if poison-wear off-timer	} // end if poison-damage timer	if ((pc->poisonwearofftime<=currenttime))	{		if ((pc->poisoned))		{			pc->poisoned=0;			impowncreate(calcSocketFromChar(pc), pc, 1); // updating to blue stats-bar ...		}	}	//hunger code for npcs	if (SrvParms->hungerrate>1 && (pc->hungertime<=currenttime || overflow))	{		t[0] = '\0';		if (pc->hunger) pc->hunger--; //Morrolan GMs and Counselors don't get hungry		if(pc->tamed && pc->npcaitype!=17)		{//if tamed let's display his hungry status			switch(pc->hunger)			{			case 6:			case 5:	break;			case 4:	sprintf(t,"* %s looks a little hungry *",pc->name.c_str());			break;			case 3:	sprintf(t,"* %s looks fairly hungry *",pc->name.c_str());			break;			case 2:	sprintf(t,"* %s looks extremely hungry *",pc->name.c_str());		break;			case 1:	sprintf(t,"* %s looks weak from starvation *",pc->name.c_str());	break;			case 0:				//maximum hunger - untame code - AntiChrist				//pet release code here				if(pc->tamed)				{					pc->ftarg = INVALID_SERIAL;					pc->npcWander=2;					if(pc->ownserial!=-1) 						pc->SetOwnSerial(-1);					sprintf((char*)temp, "* %s appears to have decided that it is better off without a master *", pc->name.c_str());					npctalkall(pc, (char*)temp,0);					{						soundeffect2(pc, 0x01FE);						if(SrvParms->tamed_disappear==1)						Npcs->DeleteChar(pc);					}				}				//sprintf(t,"* %s must eat very soon or he will die! *",pc->name);				break;			}			if(strlen(t))			{//display message ( if there's one				pc->emotecolor = 0x0026;//buffer[s][4];				npcemoteall(pc,t,1);			}		}//if tamed		pc->hungertime=currenttime+(SrvParms->hungerrate*MY_CLOCKS_PER_SEC); // Bookmark	}//if hungerrate>1}