@LabelIndex 412431
@StringIndex 62253
class 0 oren_merc_cap : mercenary_captain {
handler:
	EventHandler TALK_SELECTED(fhtml0,i0,pledge0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to Becoming an Elite Mercenary");
			}
			if( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 1 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to Becoming an Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 11 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to Becoming an Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 101 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to Becoming an Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 111 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path to Becoming an Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Path to Becoming a Top Elite Mercenary");
			}
			if( myself::GetOneTimeQuestFlag(talker,148) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Path to Becoming a Top Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 1 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Path to Becoming a Top Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 11 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Path to Becoming a Top Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 101 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"Path to Becoming a Top Elite Mercenary (in progress)");
			}
			if( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 111 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 10;
				myself::AddChoice(10,"Path to Becoming a Top Elite Mercenary (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,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) ) {
						myself::SetCurrentQuestID(147);
						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;
						}
						pledge0 = myself::GetPledge(talker);
						if( gg::IsNull(pledge0) == 0 ) {
							i0 = pledge0.castle_id;
							if( i0 == myself.sm.residence_id ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_01.htm",147);
							} else if( i0 > 0 && i0 < 10 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_02.htm",147);
							} else if( talker.level >= 40 ) {
								if( gg::OwnItemCount(talker,13766) == 0 ) {
									myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_04.htm",147);
								} else if( myself::GetMemoCount(talker) < 26 ) {
									myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_05.htm",147);
								} else {
									myself::ShowPage(talker,"fullquest.htm");
								}
							} else {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_03.htm",147);
							}
						} else if( talker.level >= 40 ) {
							if( gg::OwnItemCount(talker,13766) == 0 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_04.htm",147);
							} else if( myself::GetMemoCount(talker) < 26 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_05.htm",147);
							} else {
								myself::ShowPage(talker,"fullquest.htm");
							}
						} else {
							myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_03.htm",147);
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 1 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) ) {
						myself::SetCurrentQuestID(147);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0147_09.htm",147);
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 11 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) ) {
						myself::SetCurrentQuestID(147);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0147_10.htm",147);
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 101 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) ) {
						myself::SetCurrentQuestID(147);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0147_11.htm",147);
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,147) == 1 && gg::GetMemoState(talker,147) == 111 && myself::GetOneTimeQuestFlag(talker,147) == 0 ) ) {
						myself::SetCurrentQuestID(147);
						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::GiveItem1(talker,13767,1);
						myself::DeleteItem1(talker,13766,gg::OwnItemCount(talker,13766));
						myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_12.htm",147);
						myself::RemoveMemo(talker,147);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						gg::AddLog(2,talker,147);
						myself::SetOneTimeQuestFlag(talker,147,1);
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 1 ) ) {
						myself::SetCurrentQuestID(148);
						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;
						}
						pledge0 = myself::GetPledge(talker);
						if( gg::IsNull(pledge0) == 0 ) {
							i0 = pledge0.castle_id;
							if( i0 == myself.sm.residence_id ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_01.htm",148);
							} else if( i0 > 0 && i0 < 10 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_02.htm",148);
							} else if( talker.level >= 40 ) {
								if( gg::OwnItemCount(talker,13767) == 0 ) {
									myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_06.htm",148);
								} else if( myself::GetMemoCount(talker) < 26 ) {
									myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_07.htm",148);
								} else {
									myself::ShowPage(talker,"fullquest.htm");
								}
							} else {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_05.htm",148);
							}
						} else if( talker.level >= 40 ) {
							if( gg::OwnItemCount(talker,13767) == 0 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_06.htm",148);
							} else if( myself::GetMemoCount(talker) < 26 ) {
								myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_07.htm",148);
							} else {
								myself::ShowPage(talker,"fullquest.htm");
							}
						} else {
							myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_05.htm",148);
						}
					}
					break;
				}
				case 6: {
					if( _from_choice == 0 || myself::GetOneTimeQuestFlag(talker,148) == 1 ) {
						myself::SetCurrentQuestID(148);
						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,13767) >= 1 ) {
							myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_03.htm",148);
						} else {
							myself::GiveItem1(talker,13768,1);
							myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_04.htm",148);
						}
					}
					break;
				}
				case 7: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 1 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) ) {
						myself::SetCurrentQuestID(148);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0148_11.htm",148);
					}
					break;
				}
				case 8: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 11 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) ) {
						myself::SetCurrentQuestID(148);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0148_12.htm",148);
					}
					break;
				}
				case 9: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 101 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) ) {
						myself::SetCurrentQuestID(148);
						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::ShowQuestPage(talker,"gludio_merc_cap_q0148_13.htm",148);
					}
					break;
				}
				case 10: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,148) == 1 && gg::GetMemoState(talker,148) == 111 && myself::GetOneTimeQuestFlag(talker,148) == 0 ) ) {
						myself::SetCurrentQuestID(148);
						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::GiveItem1(talker,13768,1);
						myself::DeleteItem1(talker,13767,gg::OwnItemCount(talker,13767));
						myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_14.htm",148);
						myself::RemoveMemo(talker,148);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						gg::AddLog(2,talker,148);
						myself::SetOneTimeQuestFlag(talker,148,1);
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(i0,quest_id,talker) {
		if( quest_id == 147 ) {
			myself::SetCurrentQuestID(147);
			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,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 && gg::OwnItemCount(talker,13766) >= 1 && talker.level >= 40 ) {
					myself::SetMemoState(talker,147,1);
					myself::SetMemo(talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_08.htm",147);
					myself::SetFlagJournal(talker,147,1);
					myself::ShowQuestMark(talker,147);
				}
				gg::AddLog(1,talker,quest_id);
			}
			return;
		}
		if( quest_id == 148 ) {
			myself::SetCurrentQuestID(148);
			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,148) == 0 && myself::GetOneTimeQuestFlag(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 1 && talker.level >= 40 ) {
					myself::SetMemoState(talker,148,1);
					myself::SetMemo(talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_10.htm",148);
					myself::SetFlagJournal(talker,148,1);
					myself::ShowQuestMark(talker,148);
				}
				gg::AddLog(1,talker,quest_id);
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,pledge0,reply,talker) {
		if( ask == 147 ) {
			myself::SetCurrentQuestID(147);
			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 == 147 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 && talker.level >= 40 && gg::OwnItemCount(talker,13766) >= 1 ) {
					myself::FHTML_SetFileName(fhtml0,"gludio_merc_cap_q0147_06.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",147);
					myself::ShowQuestFHTML(talker,fhtml0,147);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,147) == 0 && myself::GetOneTimeQuestFlag(talker,147) == 0 && talker.level >= 40 && gg::OwnItemCount(talker,13766) == 0 ) {
					myself::GiveItem1(talker,13766,1);
					myself::ShowQuestPage(talker,"gludio_merc_cap_q0147_07.htm",147);
				}
			}
		}
		if( ask == 148 ) {
			myself::SetCurrentQuestID(148);
			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 == 148 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,148) == 0 && talker.level >= 40 && gg::OwnItemCount(talker,13767) >= 1 ) {
					myself::FHTML_SetFileName(fhtml0,"gludio_merc_cap_q0148_08.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",148);
					myself::ShowQuestFHTML(talker,fhtml0,148);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,148) == 0 && myself::GetOneTimeQuestFlag(talker,148) == 0 && talker.level >= 40 && gg::OwnItemCount(talker,13767) == 0 ) {
					myself::GiveItem1(talker,13767,1);
					myself::ShowQuestPage(talker,"gludio_merc_cap_q0148_09.htm",148);
				}
			}
		}
		super;
	}

}
