@LabelIndex 405698
@StringIndex 60966
class 0 farm_messenger : ai_azit_farm_messenger {
handler:
	EventHandler TALK_SELECTED(fhtml0,i0,i1,pledge0,pledge1,quest_id,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,655) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Grand Operation to Tame Wild Beasts");
			}
			if( gg::HaveMemo(talker,655) == 1 && ( ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 3600 || ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 0 ) ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Grand Operation to tame Wild Beasts (In Progress)");
			}
			if( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) == 0 && gg::OwnItemCount(talker,8084) < 10 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Grand Operation to tame Wild Beasts (In Progress)");
			}
			if( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) >= 1 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Grand Operation to tame Wild Beasts (In Progress)");
			}
			if( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) == 0 && gg::OwnItemCount(talker,8084) >= 10 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Grand Operation to tame Wild Beasts (In Progress)");
			}
			if( _choiceN > 1 ) {
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 ) {
			switch(_code) {
				case 0: {
					if( _from_choice == 0 || gg::HaveMemo(talker,655) == 0 ) {
						myself::SetCurrentQuestID(655);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						if( myself::GetMemoCount(talker) < 26 ) {
							i1 = 0;
							pledge0 = myself::GetPledge(talker);
							if( gg::IsNull(pledge0) == 0 ) {
								if( i1 == 0 ) {
									if( ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) < 3600 && ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) > 0 ) {
										if( talker.is_pledge_master == 1 && pledge0.agit_id == 0 ) {
											if( pledge0.skill_level >= 4 ) {
												myself::FHTML_SetFileName(fhtml0,"farm_messenger_q0655_01.htm");
												myself::FHTML_SetInt(fhtml0,"quest_id",655);
												myself::ShowFHTML(talker,fhtml0);
											} else {
												myself::ShowPage(talker,"farm_messenger_q0655_03.htm");
											}
										} else if( talker.is_pledge_master == 1 && pledge0.agit_id != 0 ) {
											myself::ShowPage(talker,"farm_messenger_q0655_04.htm");
										} else if( talker.is_pledge_master == 0 ) {
											if( pledge0.agit_id == 63 && ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) < 3600 && ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) > 0 ) {
												myself::ShowPage(talker,"farm_kel_mahum_messenger_1.htm");
											} else if( pledge0.agit_id != 63 ) {
												myself::ShowPage(talker,"farm_messenger_q0655_05.htm");
											} else {
												myself::ShowPage(talker,"farm_messenger_q0655_05.htm");
											}
										}
									} else if( ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) >= 3600 || ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) < 0 ) {
										if( myself::Castle_GetSiegeTime() != "" ) {
											myself::FHTML_SetFileName(fhtml0,"farm_messenger_q0655_02.htm");
											myself::FHTML_SetStr(fhtml0,"next_siege",myself::Castle_GetSiegeTime());
											myself::ShowFHTML(talker,fhtml0);
										}
									}
								} else {
									myself::ShowPage(talker,"farm_kel_mahum_messenger_28.htm");
								}
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,655) == 1 && ( ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 3600 || ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 0 ) ) ) {
						myself::SetCurrentQuestID(655);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						if( gg::OwnItemCount(talker,8293) > 0 ) {
							myself::DeleteItem1(talker,8293,gg::OwnItemCount(talker,8293));
						}
						if( gg::OwnItemCount(talker,8084) > 0 ) {
							myself::DeleteItem1(talker,8084,gg::OwnItemCount(talker,8084));
						}
						myself::RemoveMemo(talker,655);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"farm_messenger_q0655_07.htm");
						gg::AddLog(2,talker,655);
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) == 0 && gg::OwnItemCount(talker,8084) < 10 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) ) {
						myself::SetCurrentQuestID(655);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"farm_messenger_q0655_08.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) >= 1 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) ) {
						myself::SetCurrentQuestID(655);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"farm_messenger_q0655_09.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,655) == 1 && gg::OwnItemCount(talker,8293) == 0 && gg::OwnItemCount(talker,8084) >= 10 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) < 3600 && ( myself::Castle_GetRawSiegeTime() - gg::GetMemoState(talker,655) ) > 0 ) ) {
						myself::SetCurrentQuestID(655);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::GiveItem1(talker,8293,1);
							myself::DeleteItem1(talker,8084,gg::OwnItemCount(talker,8084));
							myself::ShowPage(talker,"farm_messenger_q0655_10.htm");
							myself::ShowQuestMark(talker,655);
							myself::SoundEffect(talker,"ItemSound.quest_middle");
							myself::SetFlagJournal(talker,655,3);
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(pledge0,quest_id,talker) {
		if( quest_id == 655 ) {
			myself::SetCurrentQuestID(655);
			if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
				myself::ShowSystemMessage(talker,1118);
				return;
			}
			if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
				talker.quest_last_reward_time = myself::GetCurrentTick();
				pledge0 = myself::GetPledge(talker);
				if( gg::IsNull(pledge0) == 0 ) {
					if( gg::HaveMemo(talker,655) == 0 && pledge0.skill_level >= 4 && talker.is_pledge_master == 1 && pledge0.agit_id == 0 && ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) < 3600 && ( myself::Castle_GetRawSiegeTime() - myself::Castle_GetRawSystemTime() ) > 0 ) {
						myself::SetMemoState(talker,655,myself::Castle_GetRawSystemTime());
						myself::SetMemo(talker,quest_id);
						myself::ShowQuestMark(talker,655);
						myself::SoundEffect(talker,"ItemSound.quest_accept");
						myself::ShowPage(talker,"farm_messenger_q0655_06.htm");
						gg::AddLog(1,talker,quest_id);
						myself::SetFlagJournal(talker,655,1);
					}
				}
			}
			return;
		}
		super;
	}

}
