class 1 ssq_npc_preacher_of_doom : default_npc
{
parameter:
	int	DeBuff1 = 1116417;
	int	DeBuff2 = 1116418;
	int	DeBuff3 = 1116673;
	int	DeBuff4 = 1116674;
	int	PosX1 = 0;
	int	PosY1 = 0;
	int	PosZ1 = 0;
	int	PosX2 = 0;
	int	PosY2 = 0;
	int	PosZ2 = 0;
	int	PosX3 = 0;
	int	PosY3 = 0;
	int	PosZ3 = 0;
	int	PosX4 = 0;
	int	PosY4 = 0;
	int	PosZ4 = 0;
	int	PosX5 = 0;
	int	PosY5 = 0;
	int	PosZ5 = 0;

handler:
	EventHandler CREATED()
	{
		myself::AddTimerEx(5097,( 600 * 1000 ));
		myself::AddTimerEx(5099,1000);
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0)
	{
		if( timer_id == 5097 )
		{
			switch(gg::Rand(4))
			{
				case 0:
				{
					myself::Say(myself::MakeFString(1000303,"","","","",""));
					break;
				}
				case 1:
				{
					myself::Say(myself::MakeFString(1000415,"","","","",""));
					break;
				}
				case 2:
				{
					myself::Say(myself::MakeFString(1000416,"","","","",""));
					break;
				}
				case 3:
				{
					myself::Say(myself::MakeFString(1000417,"","","","",""));
					break;
				}
			}
			if( myself::InMyTerritory(myself.sm) )
			{
			}
			myself::AddTimerEx(5097,( 600 * 1000 ));
		}
		else if( timer_id == 5098 )
		{
			i0 = gg::Rand(50);
			if( i0 < 10 && PosX1 != 0 )
			{
				myself::InstantTeleport(myself.sm,PosX1,PosY1,PosZ1);
			}
			else if( i0 > 10 && i0 <= 20 && PosX2 != 0 )
			{
				myself::InstantTeleport(myself.sm,PosX2,PosY2,PosZ2);
			}
			else if( i0 > 20 && i0 < 30 && PosX3 != 0 )
			{
				myself::InstantTeleport(myself.sm,PosX3,PosY3,PosZ3);
			}
			else if( i0 > 30 && i0 < 40 && PosX4 != 0 )
			{
				myself::InstantTeleport(myself.sm,PosX4,PosY4,PosZ4);
			}
			else if( PosX5 != 0 )
			{
				myself::InstantTeleport(myself.sm,PosX5,PosY5,PosZ5);
			}
			myself::AddTimerEx(5098,( ( 30 * 60 ) * 1000 ));
		}
		else if( timer_id == 5099 )
		{
			myself::LookNeighbor(300);
			myself::AddTimerEx(5099,1000);
		}
	}

	EventHandler SEE_CREATURE(creature,i0,i1)
	{
		if( myself::GetSSQStatus() == 3 )
		{
			if( creature.is_pc == 1 && myself::GetSSQPart(creature) != 0 && myself::GetSSQPart(creature) != myself::GetSSQWinner() )
			{
				i0 = gg::Rand(100);
				i1 = gg::Rand(10000);
				if( myself::IsInCategory(0,creature.occupation) )
				{
					if( myself::GetAbnormalLevel(creature,myself::Skill_GetAbnormalType(DeBuff1)) <= 0 )
					{
						if( i1 < 1 )
						{
							myself::Say(myself::MakeFString(1000420,"","","","",""));
						}
						if( myself::Skill_GetConsumeMP(DeBuff1) < myself.sm.mp && myself::Skill_GetConsumeHP(DeBuff1) < myself.sm.hp && myself::Skill_InReuseDelay(DeBuff1) == 0 )
						{
							myself::AddUseSkillDesire(creature,DeBuff1,0,0,1000000);
						}
					}
					else if( i0 < 5 )
					{
						if( i1 < 500 )
						{
							myself::Say(myself::MakeFString(1000304,"","","","",""));
						}
						if( myself::Skill_GetConsumeMP(DeBuff2) < myself.sm.mp && myself::Skill_GetConsumeHP(DeBuff2) < myself.sm.hp && myself::Skill_InReuseDelay(DeBuff2) == 0 )
						{
							myself::AddUseSkillDesire(creature,DeBuff2,0,0,1000000);
						}
					}
				}
				else if( myself::IsInCategory(1,creature.occupation) )
				{
					if( myself::GetAbnormalLevel(creature,myself::Skill_GetAbnormalType(DeBuff3)) <= 0 )
					{
						if( i1 < 1 )
						{
							myself::Say(myself::MakeFString(1000418,creature.name,"","","",""));
						}
						if( myself::Skill_GetConsumeMP(DeBuff3) < myself.sm.mp && myself::Skill_GetConsumeHP(DeBuff3) < myself.sm.hp && myself::Skill_InReuseDelay(DeBuff3) == 0 )
						{
							myself::AddUseSkillDesire(creature,DeBuff3,0,0,1000000);
						}
					}
					else if( i0 < 5 )
					{
						if( i1 < 500 )
						{
							myself::Say(myself::MakeFString(1000419,creature.name,"","","",""));
						}
						if( myself::Skill_GetConsumeMP(DeBuff4) < myself.sm.mp && myself::Skill_GetConsumeHP(DeBuff4) < myself.sm.hp && myself::Skill_InReuseDelay(DeBuff4) == 0 )
						{
							myself::AddUseSkillDesire(creature,DeBuff4,0,0,1000000);
						}
					}
				}
			}
		}
	}

}
