@LabelIndex 134761
@StringIndex 17226
class 0 npc_immo_lifeseed : default_npc {
parameter:
	int	tide = 0;
	int	zone = 0;
	string	type = "decoy";
	int	room = 0;
	string	dispatcher_maker = "";
	int	Skill_Branding = 542375937;
	int	Skill_dying_display = 395640833;
	int	NPC_Attack_Skill_C = 387252225;
	int	NPC_Attack_Skill_L = 387317761;
	string	fnHi = "";
	string	fnHi_working = "lifeseed_decoy002.htm";
	string	fnHi_notworking = "lifeseed_decoy099.htm";
	string	fnHi_keepworking = "lifeseed_decoy003.htm";
	int	reward_siege = 13797;
	int	reward_rate = 6;
	int	TM_RESPAWN_BLANK = 78001;
	int	TM_SEND_TAUNT = 78003;
	int	TM_REWARD_DROP = 78004;
	int	TM_TUMOR_CHECK = 78005;
	int	TM_HEALTH_REPORT = 78006;
	int	TIME_respawn_blank = 10;
	int	TIME_reward_drop = 60;
	int	TM_DECOY_TIME = 78009;
	int	TIME_DECOY_TIME = 300;
	int	TM_DECOY_RECHARGE = 78010;
	int	TIME_DECOY_RECHARGE = 60;
	int	TACT_AGGRESIVE = 0;
	int	TACT_INTERCEPT = 1;
	int	TACT_DEFENSIVE = 2;
	int	babble_mode = 0;

handler:
	EventHandler CREATED(i0) {
		myself.i_ai1 = 0;
		if( gg::IsSameString(type,"def") == 1 ) {
			myself.i_ai0 = 0;
			if( babble_mode == 1 ) {
				myself.i_ai2 = 3000000;
			} else {
				myself.i_ai2 = 300;
			}
			if( babble_mode == 1 ) {
				myself::Shout(" ˆ");
			}
			myself::AddTimerEx(TM_RESPAWN_BLANK,( TIME_respawn_blank * 1000 ));
		} else if( gg::IsSameString(type,"decoy") == 1 ) {
			myself.i_ai0 = 1;
			myself.i_ai2 = 100;
			myself.i_ai3 = ( gg::Rand(3) + 1 );
			myself::AddTimerEx(TM_DECOY_TIME,( TIME_DECOY_TIME * 1000 ));
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1,i2,i3,i4,i5,i6,maker0,party0) {
		if( timer_id == TM_RESPAWN_BLANK ) {
			if( babble_mode == 1 ) {
				myself::Shout("");
			}
			myself.i_ai0 = 1;
			myself::AddTimerEx(TM_SEND_TAUNT,( ( gg::Rand(15) + 1 ) * 1000 ));
			myself::AddTimerEx(TM_REWARD_DROP,( TIME_reward_drop * 1000 ));
		} else if( timer_id == TM_SEND_TAUNT ) {
			if( gg::IsSameString(type,"decoy") == 1 && myself.i_ai0 == 1 ) {
				myself::BroadcastScriptEventEx(78010052,myself.sm.id,911,( ( 500 + gg::Rand(200) ) - gg::Rand(200) ));
				myself::AddTimerEx(TM_SEND_TAUNT,( ( gg::Rand(10) + 1 ) * 1000 ));
			} else {
				myself::BroadcastScriptEventEx(78010052,myself.sm.id,room,( ( 1300 + gg::Rand(200) ) - gg::Rand(200) ));
				myself::AddTimerEx(TM_SEND_TAUNT,( ( gg::Rand(15) + 1 ) * 1000 ));
			}
		} else if( timer_id == TM_REWARD_DROP ) {
			if( gg::Rand(100) <= reward_rate ) {
				if( babble_mode == 1 ) {
					myself::Say("  ");
				}
				myself::DropItem1(myself.sm,reward_siege,1);
			}
			myself::AddTimerEx(TM_REWARD_DROP,( TIME_reward_drop * 1000 ));
		} else if( timer_id == TM_DECOY_TIME ) {
			if( babble_mode == 1 ) {
				myself::Say("  ˆ");
			}
			myself::Despawn();
		} else if( timer_id == TM_DECOY_RECHARGE ) {
			if( babble_mode == 1 ) {
				myself::Say("  ");
			}
			myself::Say(gg::MakeFString(1800272,"","","","",""));
			myself.i_ai0 = 1;
		}
	}

	EventHandler SPELLED(attacker,skill_name_id) {
		if( myself.i_ai1 == myself.i_ai2 ) {
			if( babble_mode == 1 ) {
				myself::Say("   ");
			}
			myself::AddUseSkillDesire(myself.sm,Skill_dying_display,1,1,10000000000);
		} else if( skill_name_id == NPC_Attack_Skill_C || skill_name_id == NPC_Attack_Skill_L ) {
			myself.i_ai1 = ( myself.i_ai1 + 1 );
			if( babble_mode == 1 ) {
				myself::Say("NPCˆ :" + gg::IntToStr(myself.i_ai1) + "/" + gg::IntToStr(myself.i_ai2));
			}
		}
	}

	EventHandler TALKED(talker) {
		if( myself.i_ai0 == 2 ) {
			myself::ShowPage(talker,fnHi_keepworking);
		} else {
			myself::ShowPage(talker,fnHi);
		}
	}

	EventHandler USE_SKILL_FINISHED(target,skill_name_id,success,s0) {
		if( skill_name_id == Skill_dying_display && success == 1 ) {
			if( babble_mode == 1 ) {
				s0 = gg::IntToStr(room) + "   !";
				gg::BroadcastOnScreenMsgStr(myself.sm,8000,5,0,1,2,1,1,5000,0,s0);
				myself::BroadcastSystemMessageStr(myself.sm,8000,s0);
			}
			myself::Suicide();
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,maker0,party0,i0,s0) {
		if( ask == -7801 ) {
			if( reply == 1 || reply == 2 || reply == 3 ) {
				if( ( myself.i_ai0 == 1 && myself::IsInCategory(11,talker.occupation) ) || reply == myself.i_ai3 ) {
					if( babble_mode == 1 ) {
						myself::Say("  ");
					}
					myself::ShowPage(talker,fnHi_working);
					myself::Say(gg::MakeFString(1800271,"","","","",""));
					myself.i_ai1 = ( myself.i_ai1 + 10 );
					myself.i_ai0 = 2;
					myself::AddTimerEx(TM_SEND_TAUNT,( 1 * 1000 ));
					myself::AddTimerEx(TM_DECOY_RECHARGE,( TIME_DECOY_RECHARGE * 1000 ));
				} else {
					myself.i_ai1 = ( myself.i_ai1 + 5 );
					myself::ShowPage(talker,fnHi_notworking);
				}
			}
		}
	}

}
