@LabelIndex 393442
@StringIndex 58495
class 0 grandmaste_piane : guild_master_kamael {
handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,61) == 0 && myself::GetOneTimeQuestFlag(talker,61) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Law Enforcement");
			}
			if( myself::GetOneTimeQuestFlag(talker,61) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Law Enforcement (Done)");
			}
			if( gg::HaveMemo(talker,61) == 1 && gg::GetMemoState(talker,61) == 1 && myself::GetOneTimeQuestFlag(talker,61) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Law Enforcement (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,61) == 0 && myself::GetOneTimeQuestFlag(talker,61) == 0 ) ) {
						myself::SetCurrentQuestID(61);
						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( talker.level >= 76 ) {
							if( talker.occupation == 135 ) {
								myself::FHTML_SetFileName(fhtml0,"grandmaste_piane_q0061_01.htm");
								myself::FHTML_SetStr(fhtml0,"name",talker.name);
								myself::ShowQuestFHTML(talker,fhtml0,61);
							} else {
								myself::ShowQuestPage(talker,"grandmaste_piane_q0061_03.htm",61);
							}
						} else {
							myself::ShowQuestPage(talker,"grandmaste_piane_q0061_02.htm",61);
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || myself::GetOneTimeQuestFlag(talker,61) == 1 ) {
						myself::SetCurrentQuestID(61);
						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,"finishedquest.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,61) == 1 && gg::GetMemoState(talker,61) == 1 && myself::GetOneTimeQuestFlag(talker,61) == 0 ) ) {
						myself::SetCurrentQuestID(61);
						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,"grandmaste_piane_q0061_06.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker) {
		if( quest_id == 61 ) {
			myself::SetCurrentQuestID(61);
			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();
				if( gg::HaveMemo(talker,61) == 0 && myself::GetOneTimeQuestFlag(talker,61) == 0 && talker.level >= 76 && talker.occupation == 135 ) {
					myself::SetMemoState(talker,61,1);
					myself::SetMemo(talker,61);
					myself::ShowQuestPage(talker,"grandmaste_piane_q0061_05.htm",61);
					myself::SetFlagJournal(talker,61,1);
					myself::ShowQuestMark(talker,61);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					gg::AddLog(1,talker,quest_id);
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker) {
		if( ask == 61 ) {
			myself::SetCurrentQuestID(61);
			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( ask == 61 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,61) == 0 && myself::GetOneTimeQuestFlag(talker,61) == 0 && talker.level >= 75 && talker.occupation == 135 ) {
					myself::FHTML_SetFileName(fhtml0,"grandmaste_piane_q0061_04.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",61);
					myself::ShowQuestFHTML(talker,fhtml0,61);
				}
			}
		}
		super;
	}

}
