@LabelIndex 7279
@StringIndex 1400
class 0 merchant_for_clan : merchant {
parameter:
	int	item_oath = 9911;
	int	num_oath = 1;
	int	fame_oath = 500;
	int	item_proof = 9910;
	int	num_proof = 10;
	int	fame_proof = 100;
	int	item_strap = 9912;
	int	num_strap = 100;
	int	fame_strap = 12;
	string	fnHi1 = "";
	string	fnNoPledge = "";
	string	fnPledgeFameValue = "";
	string	fnUpdateFameSuccess = "";
	string	fnNotEnoughItem = "";
	int	pledge_lv_req = 5;
	string	fnLowerPledgeLvReq = "clan_merchant_hullia007.htm";

handler:
	EventHandler TALKED(talker) {
		if( talker.pledge_id > 0 && ( talker.is_pledge_master == 1 || myself::HavePledgePower(talker,9) ) ) {
			myself::ShowPage(talker,fnHi);
		} else {
			myself::ShowPage(talker,myself.sm.name + "002.htm");
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,i0,i1,i2,fhtml0,pledge0) {
		if( ask == -303 && reply == 551 ) {
			myself::ShowMultisell(551,talker);
		} else if( ask == -303 && reply == 628 ) {
			myself::ShowMultisell(628,talker);
		} else if( ask == -302 ) {
			if( myself::GetPledgeSkillLevel(talker) < pledge_lv_req ) {
				myself::ShowPage(talker,fnLowerPledgeLvReq);
				return;
			}
			if( reply == -1 ) {
				pledge0 = myself::GetPledge(talker);
				if( gg::IsNull(pledge0) == 0 ) {
					myself::FHTML_SetFileName(fhtml0,fnPledgeFameValue);
					myself::FHTML_SetStr(fhtml0,"pledge_name",pledge0.name);
					myself::FHTML_SetStr(fhtml0,"fame_value",gg::IntToStr(myself::OwnPledgeNameValue(talker)));
					myself::ShowFHTML(talker,fhtml0);
				}
				return;
			} else if( reply == 0 ) {
				myself::ShowPage(talker,fnHi1);
				return;
			} else if( reply == 1 ) {
				i0 = item_oath;
				i1 = num_oath;
				i2 = fame_oath;
			} else if( reply == 2 ) {
				i0 = item_proof;
				i1 = num_proof;
				i2 = fame_proof;
			} else if( reply == 3 ) {
				i0 = item_strap;
				i1 = num_strap;
				i2 = fame_strap;
			}
			if( gg::OwnItemCount(talker,i0) >= i1 ) {
				if( talker.pledge_id <= 0 ) {
					myself::ShowPage(talker,fnNoPledge);
					return;
				}
				myself::DeleteItem1(talker,i0,i1);
				myself::UpdatePledgeNameValue(talker,i2);
				myself::ShowPage(talker,fnUpdateFameSuccess);
				return;
			} else {
				myself::ShowPage(talker,fnNotEnoughItem);
				return;
			}
		}
		super;
	}

}
