@LabelIndex 12250
@StringIndex 3513
class 0 mseller : merchant {
parameter:
	string	fnHi = "mseller001.htm";
	string	fnHi_dawn = "mseller001_dawn.htm";
	string	fnHi_dusk = "mseller001_dusk.htm";
	string	fnNotMyLord = "mseller002.htm";
	string	fnSiegeMyLord = "mseller003.htm";
	string	fnBuy = "mseller004.htm";
	string	fnMercLimit = "msellerlimit.htm";
	string	fnSSDenial = "msellerdenial.htm";

property:
	BuySellList SellList0 = {{"mticket_gludio_sword_fix";20}};
	BuySellList SellList1 = {{"mticket_gludio_sword_fix";20}};
	BuySellList SellList2 = {{"mticket_gludio_sword_fix";20}};
	BuySellList SellList3 = {{"mticket_gludio_sword_fix";20}};
	BuySellList SellList4 = {{"mticket_gludio_sword_fix";20}};
	BuySellList SellList5 = {{"mticket_gludio_sword_fix";20}};

handler:
	EventHandler TALKED(talker) {
		if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,22) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
			if( myself::Castle_IsUnderSiege() ) {
				myself::ShowPage(talker,fnSiegeMyLord);
			} else if( myself::GetSSQSealOwner(3) == 1 ) {
				myself::ShowPage(talker,fnHi_dusk);
			} else if( myself::GetSSQSealOwner(3) == 2 ) {
				myself::ShowPage(talker,fnHi_dawn);
			} else {
				myself::ShowPage(talker,fnHi);
			}
		} else {
			myself::ShowPage(talker,fnNotMyLord);
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,fhtml0,s0) {
		if( ask == 0 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,22) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Castle_IsUnderSiege() ) {
					myself::ShowPage(talker,fnSiegeMyLord);
				} else if( myself::GetSSQSealOwner(3) == 1 ) {
					myself::ShowPage(talker,fnHi_dusk);
				} else if( myself::GetSSQSealOwner(3) == 2 ) {
					myself::ShowPage(talker,fnHi_dawn);
				} else {
					myself::ShowPage(talker,fnHi);
				}
			} else {
				myself::ShowPage(talker,fnNotMyLord);
			}
		}
		if( ask == -201 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,22) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::GetSSQStatus() == 1 || myself::GetSSQStatus() == 2 ) {
					myself::ShowPage(talker,fnSSDenial);
				} else {
					switch(reply) {
						case 1: {
							myself::Sell(talker,SellList0,ShopName,fnBuy,"","");
							break;
						}
						case 2: {
							myself::Sell(talker,SellList1,ShopName,fnBuy,"","");
							break;
						}
						case 3: {
							myself::Sell(talker,SellList2,ShopName,fnBuy,"","");
							break;
						}
						case 4: {
							myself::Sell(talker,SellList3,ShopName,fnBuy,"","");
							break;
						}
						case 5: {
							myself::Sell(talker,SellList4,ShopName,fnBuy,"","");
							break;
						}
						case 6: {
							myself::Sell(talker,SellList5,ShopName,fnBuy,"","");
							break;
						}
					}
				}
			}
		} else if( ask == -202 ) {
			if( myself.sm.residence_id == 5 ) {
				s0 = "aden_";
			} else if( myself.sm.residence_id == 8 ) {
				s0 = "rune_";
			} else {
				s0 = "";
			}
			myself::FHTML_SetFileName(fhtml0,s0 + fnMercLimit);
			myself::FHTML_SetStr(fhtml0,"feud_name",gg::MakeFString(( 1001000 + myself.sm.residence_id ),"","","","",""));
			myself::ShowFHTML(talker,fhtml0);
		}
	}

}
