@LabelIndex 32463
@StringIndex 6228
class 0 ssq_main_event_acolyte : citizen {
parameter:
	int	ShoutSysMsg = 0;
	int	RoomIndex = 0;
	int	part_type = 1;
	string	SibylName = "";
	int	SibylSilhouette = 1030956;
	int	SibylPosX = 0;
	int	SibylPosY = 0;
	int	SibylPosZ = 0;
	int	escape_x = 1;
	int	escape_y = 1;
	int	escape_z = 1;

handler:
	EventHandler CREATED() {
		myself.i_ai0 = 0;
		myself::InstantTeleportInMyTerritory(escape_x,escape_y,gg::FloatToInt(myself.sm.z),100);
		myself::AddTimerEx(3001,1000);
		super;
	}

	EventHandler TALKED(talker,fhtml0,i0,s0,i1) {
		myself::FHTML_SetFileName(fhtml0,fnHi);
		i0 = gg::GetDateTime(0,4);
		if( i0 == 58 || i0 == 18 || i0 == 38 || i0 == 59 || i0 == 19 || i0 == 39 ) {
			s0 = gg::MakeFString(1000441,"","","","","");
			myself::FHTML_SetStr(fhtml0,"minute",s0);
		} else if( i0 > 39 ) {
			i1 = ( 58 - i0 );
		} else if( i0 > 19 ) {
			i1 = ( 38 - i0 );
		} else {
			i1 = ( 18 - i0 );
		}
		s0 = gg::IntToStr(i1);
		s0 = s0 + gg::MakeFString(1000442,"","","","","");
		myself::FHTML_SetStr(fhtml0,"minute",s0);
		myself::ShowFHTML(talker,fhtml0);
	}

	EventHandler ATTACKED(attacker,party0) {
		if( gg::OwnItemCount(attacker,57) == 1980 ) {
			party0 = gg::GetParty(attacker);
			if( myself::IsNullParty(party0) ) {
				return;
			}
			myself::CreateOnePrivateEx(SibylSilhouette,SibylName,0,0,SibylPosX,SibylPosY,SibylPosZ,0,0,0,0);
			myself::TeleportParty(party0.id,SibylPosX,SibylPosY,SibylPosZ,300,( part_type * RoomIndex ));
			myself::Despawn();
		}
	}

	EventHandler USE_SKILL_FINISHED(target,skill_name_id,i0,party0) {
		party0 = gg::GetParty(target);
		if( myself::IsNullParty(party0) ) {
			return;
		} else {
			myself::TeleportParty(party0.id,SibylPosX,SibylPosY,SibylPosZ,300,( part_type * RoomIndex ));
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,fhtml0,s0,s1,i0,i1,i2,i3) {
		if( ask == 505 ) {
			if( reply == 3 ) {
				myself::FHTML_SetFileName(fhtml0,"ssq_main_event_acolyte_q0505_14.htm");
				for(i0 = 1; i0 < 4; i0++) {
					if( i0 == 1 ) {
						i1 = 2;
					} else if( i0 == 2 ) {
						i1 = 1;
					} else if( i0 == 3 ) {
						i1 = 0;
						s0 = gg::GetTimeAttackRecordInfo(RoomIndex,i1,1,0);
						if( gg::StrToInt(s0) == 1 ) {
							myself::FHTML_SetStr(fhtml0,"Winner",gg::MakeFString(1000310,"","","","",""));
						} else if( gg::StrToInt(s0) == 2 ) {
							myself::FHTML_SetStr(fhtml0,"Winner",gg::MakeFString(1000311,"","","","",""));
						} else {
							myself::FHTML_SetStr(fhtml0,"Winner","");
						}
					}
					s0 = gg::GetTimeAttackRecordInfo(RoomIndex,i1,5,0);
					i2 = gg::StrToInt(s0);
					if( i2 == 0 ) {
						myself::FHTML_SetStr(fhtml0,"date" + gg::IntToStr(i0),gg::MakeFString(1000322,"","","","",""));
					} else {
						s0 = gg::IntToStr(gg::GetDateTime(i2,0));
						s0 = s0 + "/" + gg::IntToStr(gg::GetDateTime(i2,1));
						s0 = s0 + "/" + gg::IntToStr(gg::GetDateTime(i2,2));
						myself::FHTML_SetStr(fhtml0,"date" + gg::IntToStr(i0),s0);
					}
					s0 = gg::GetTimeAttackRecordInfo(RoomIndex,i1,4,0);
					myself::FHTML_SetStr(fhtml0,"score" + gg::IntToStr(i0),s0);
					s0 = gg::GetTimeAttackRecordInfo(RoomIndex,i1,2,0);
					i2 = gg::StrToInt(s0);
					for(i3 = 1; i3 <= i2; i3++) {
						s0 = gg::GetTimeAttackRecordInfo(RoomIndex,i1,3,( i3 - 1 ));
						if( i3 > 1 ) {
							s0 = ", " + s0;
						}
						myself::FHTML_SetStr(fhtml0,"player" + gg::IntToStr(i0) + gg::IntToStr(i3),s0);
					}
				}
				myself::ShowFHTML(talker,fhtml0);
			} else if( reply == 4 ) {
				myself::FHTML_SetFileName(fhtml0,"ssq_main_event_acolyte_q0505_15.htm");
				for(i0 = 1; i0 < 6; i0++) {
					i1 = ( 1000311 + i0 );
					myself::FHTML_SetStr(fhtml0,"Room" + gg::IntToStr(i0),gg::MakeFString(i1,"","","","",""));
					s0 = gg::GetTimeAttackRecordInfo(i0,1,4,0);
					myself::FHTML_SetStr(fhtml0,"Score" + gg::IntToStr(i0) + "1",s0);
					s1 = gg::GetTimeAttackRecordInfo(i0,2,4,0);
					myself::FHTML_SetStr(fhtml0,"Score" + gg::IntToStr(i0) + "2",s1);
					i2 = gg::StrToInt(s0);
					i3 = gg::StrToInt(s1);
					if( i2 > i3 ) {
						myself::FHTML_SetStr(fhtml0,"Winner" + gg::IntToStr(i0),gg::MakeFString(1000310,"","","","",""));
					} else if( i2 < i3 ) {
						myself::FHTML_SetStr(fhtml0,"Winner" + gg::IntToStr(i0),gg::MakeFString(1000311,"","","","",""));
					} else {
						myself::FHTML_SetStr(fhtml0,"Winner" + gg::IntToStr(i0),gg::MakeFString(1000430,"","","","",""));
					}
				}
				myself::ShowFHTML(talker,fhtml0);
			} else if( reply == 10 ) {
				myself::FHTML_SetFileName(fhtml0,fnHi);
				i0 = gg::GetDateTime(0,4);
				if( i0 == 58 || i0 == 18 || i0 == 38 || i0 == 59 || i0 == 19 || i0 == 39 ) {
					s0 = gg::MakeFString(1000441,"","","","","");
					myself::FHTML_SetStr(fhtml0,"minute",s0);
				} else if( i0 > 39 ) {
					i1 = ( 58 - i0 );
				} else if( i0 > 19 ) {
					i1 = ( 38 - i0 );
				} else {
					i1 = ( 18 - i0 );
				}
				s0 = gg::IntToStr(i1);
				s0 = s0 + gg::MakeFString(1000442,"","","","","");
				myself::FHTML_SetStr(fhtml0,"minute",s0);
				myself::ShowFHTML(talker,fhtml0);
			} else if( reply == 11 ) {
				myself::FHTML_SetFileName(fhtml0,"ssq_main_event_acolyte_q0505_27.htm");
				for(i0 = 1; i0 < 6; i0++) {
					i1 = ( 1000311 + i0 );
					myself::FHTML_SetStr(fhtml0,"Room" + gg::IntToStr(i0),gg::MakeFString(i1,"","","","",""));
					i1 = myself::GetTimeAttackFee(i0);
					myself::FHTML_SetStr(fhtml0,"Money" + gg::IntToStr(i0),gg::IntToStr(i1));
				}
				myself::ShowFHTML(talker,fhtml0);
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1) {
		if( timer_id == 3001 ) {
			if( myself::GetSSQStatus() == 1 ) {
				i0 = gg::GetDateTime(0,4);
				i1 = ( myself::GetTimeOfSSQ(1) - gg::GetTimeOfDay() );
				if( ( i0 == 58 || i0 == 18 || i0 == 38 ) && i1 >= ( 18 * 60 ) ) {
					if( myself.i_ai0 < 1 ) {
						if( ShoutSysMsg == 1 ) {
							myself::Shout(gg::MakeFString(1000317,"","","","",""));
						}
						myself.i_ai0 = ( myself.i_ai0 + 1 );
					}
				} else if( ( i0 == 0 || i0 == 20 || i0 == 40 ) && i1 >= ( 18 * 60 ) ) {
					if( myself.i_ai0 < 1 ) {
						if( ShoutSysMsg == 1 ) {
							myself::Shout(gg::MakeFString(1000318,"","","","",""));
						}
						myself.i_ai0 = ( myself.i_ai0 + 1 );
						if( SibylName == "" ) {
							myself::Say(" AI  !");
						} else {
							myself::CreateOnePrivateEx(SibylSilhouette,SibylName,0,0,SibylPosX,SibylPosY,SibylPosZ,0,0,0,0);
						}
					}
				} else if( i0 == 13 || i0 == 33 || i0 == 53 ) {
					if( myself.i_ai0 < 1 ) {
						if( ShoutSysMsg == 1 ) {
							myself::Shout(gg::MakeFString(1000319,"","","","",""));
						}
						myself.i_ai0 = ( myself.i_ai0 + 1 );
					}
				} else if( i0 == 16 || i0 == 36 || i0 == 56 ) {
					if( myself.i_ai0 < 1 && ShoutSysMsg == 1 ) {
						if( i1 >= ( 20 * 60 ) ) {
							myself::Shout(gg::MakeFString(1000320,"","","","",""));
						} else {
							myself::Shout(gg::MakeFString(1000453,"","","","",""));
						}
						myself.i_ai0 = ( myself.i_ai0 + 1 );
					}
				} else {
					myself.i_ai0 = 0;
				}
			}
			myself::AddTimerEx(3001,7000);
		}
	}

}
