// NPC
// ༭Robert
// ıࣺ
// Уй Cathena Ŷ
// £2004115

// ----------
alberta_in.gat,21,63,5	script	ŵ		84,{	set @npcname$,"[ŵ]";	callfunc "ԭʯ";	}
alberta_in.gat,13,71,4	script	˹	86,{	set @npcname$,"[˹]";	callfunc "۽";	}
alberta_in.gat,28,58,4	script	׵	85,{	set @npcname$,"[׵]";	callfunc "װ";	}

// ----- ¡ -----
prt_in.gat,63,69,4	script		84,{	set @npcname$,"[]";	callfunc "ԭʯ";	}
prt_in.gat,56,68,4	script	Խ		86,{	set @npcname$,"[Խ]";	callfunc "۽";	}
prt_in.gat,63,60,4	script			85,{	set @npcname$,"[]";	callfunc "װ";	}

// ----- ޿ -----
morocc_in.gat,72,32,4	script	Ƕ		85,{	set @npcname$,"[Ƕ]";	callfunc "ԭʯ";	}
morocc_in.gat,63,32,4	script	ɳ		85,{	set @npcname$,"[ɳ]";		callfunc "۽";	}
morocc_in.gat,73,38,4	script			85,{	set @npcname$,"[]";	callfunc "װ";	}

// -----  -----
payon_in01.gat,6,47,4	script	Ľ		88,{	set @npcname$,"[Ľ]";		callfunc "ԭʯ";	}
payon_in01.gat,13,47,4	script	ɵ	88,{	set @npcname$,"[ɵ]";	callfunc "۽";	}
payon_in01.gat,6,50,4	script		88,{	set @npcname$,"[]";	callfunc "װ";	}

// ----- ŵ -----
yuno_in01.gat,164,27,4	script	˼		84,{	set @npcname$,"[˼]";	callfunc "ԭʯ";	}
yuno_in01.gat,171,27,4	script		86,{	set @npcname$,"[]";	callfunc "۽";	}
yuno_in01.gat,171,21,4	script	˼		85,{	set @npcname$,"[˼]";	callfunc "װ";	}

// װ
prt_in.gat,58,61,2	script	װ	63,{
	mes "[װ]";
	mes "ߡ޸κһֶ";
	mes "ʲôҪ";
	set @broken1,getbrokenid(1);
	set @broken2,getbrokenid(2);
	set @broken3,getbrokenid(3);
	set @broken4,getbrokenid(4);
	set @broken5,getbrokenid(5);
	set @broken6,getbrokenid(6);
	set @broken7,getbrokenid(7);
	set @broken8,getbrokenid(8);
	set @broken9,getbrokenid(9);
	set @broken10,getbrokenid(10);
	next;
	if(@broken1==NULL && @broken2==NULL && @broken3==NULL && @broken4==NULL && @broken5==NULL 
	&& @broken6==NULL && @broken7==NULL && @broken8==NULL && @broken9==NULL && @broken10==NULL) goto L_CANCEL_3;
	menu	getitemname(@broken1),REPAIR1,
		getitemname(@broken2),REPAIR2,
		getitemname(@broken3),REPAIR3,
		getitemname(@broken4),REPAIR4,
		getitemname(@broken5),REPAIR5,
		getitemname(@broken6),REPAIR6,
		getitemname(@broken7),REPAIR7,
		getitemname(@broken8),REPAIR8,
		getitemname(@broken9),REPAIR9,
		getitemname(@broken10),REPAIR10;
	REPAIR1:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken1) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(1);
			goto L_CLOSE;
	REPAIR2:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken2) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(2);
			goto L_CLOSE;
	REPAIR3:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken3) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(3);
			goto L_CLOSE;
	REPAIR4:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken4) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(4);
			goto L_CLOSE;
	REPAIR5:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken5) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(5);
			goto L_CLOSE;
	REPAIR6:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken6) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(6);
			goto L_CLOSE;
	REPAIR7:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken7) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(7);
			goto L_CLOSE;
	REPAIR8:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken8) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(8);
			goto L_CLOSE;
	REPAIR9:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken9) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(9);
			goto L_CLOSE;
	REPAIR10:
		mes "[װ]";
		mes "Ŷ" + getitemname(@broken10) + "ѽ.";
		mes "...Ҫһ ^ff9999^00000010000ҡ";
		mes "׼";
		next;
		menu "ǵ",-,"",L_CANCEL_2;
		if (countitem(999) < 1 || Zeny < 10000) goto L_CANCEL_1;
			delitem 999,1;
			set Zeny,Zeny-10000;
			repair(10);
			goto L_CLOSE;

	L_CANCEL_1:
		mes "[װ]";
		mes "㻹ûҪһ10000ҡ";
		mes "ҿɲ";
		goto L_CLOSE;
	L_CANCEL_2:
		mes "[װ]";
		mes "ðɣǾͱʹˡ";
		goto L_CLOSE;
	L_CANCEL_3:
		mes "[װ]";
		mes "㲢ûʲôҪģôɡ";
		goto L_CLOSE;
	L_CLOSE:
		close;
}

function	script	ԭʯ	{
	mes @npcname$;
	mes "ֻҪ㽫^FF0000֮ԭʯ^000000^FF0000ԭʯ^000000ңϾͿΪ֮ԼҪ5ԭʯҲа취㡣";
	next;
	menu "֮",L_MENU_1,"",L_MENU_2,"ѯйʯ",L_MENU_3;
	L_MENU_1:
		if (countitem(756) < 5) goto L_SUB_1;
		set @nbm,countitem(756) / 5;
			delitem 756,(@nbm * 5);
			getitem 984,@nbm;
			mes @npcname$;
			mes "Ҫ֮ӭ´";
			close;
		L_SUB_1:
			mes @npcname$;
			mes "...氮ЦҲǸ˵Ҫû5֮ԭʯĻ޷֮";
			close;
	L_MENU_2:
		if (countitem(757) < 5) goto L_SUB_2;
		set @nbm,countitem(757) / 5;
			delitem 757,(@nbm * 5);
			getitem 985,@nbm;
			mes @npcname$;
	  		mes "Ҫӭ´";
			close;
		L_SUB_2:
		mes @npcname$;
		mes "...氮Ц";
		mes "ҲǸ˵Ҫû5ԭʯĻ޷?";
			close;
	L_MENU_3:
		mes @npcname$;
		mes "νʯ...";
		mes "ұѾ˶ʮ꣬ܶĴ˵...ûʵʼ!";
		mes "˵ӵˮء𡢷ԡ";
		next;
		mes @npcname$;
		mes "˵ڶұʱʱĻ...ӵʱĳǿ";
		mes "..˵һӵмߵĶұ";
		close;
}


function	script	۽	{
	mes @npcname$;
	mes "ǸƷʱҪĽ";
	mes "ȼ1^007777ǿý-ǿһ^000000";
	mes "...ȼ2^007777ǿý-ǿ^000000Ƚ";
	next;
L_START:
	menu "ǿý-ǿһ- 200",L_MENU_1,"ǿý-ǿ- 1000",L_MENU_2,"ѯû",L_MENU_3;
	L_MENU_1:
		set @itemid,1010;
		set @value,200;
		mes @npcname$;
		mes "ҪһҪ200ZENY";
		next;
		goto L_START_1;
	L_MENU_2:
		set @itemid,1011;
		set @value,1000;
		mes @npcname$;
		mes "ҪһҪ1000ZENY";
		next;
		goto L_START_1;
	L_MENU_3:
			mes @npcname$;
			mes "ʵȼ12ҪĽɣ";
			mes "ӦҲ֪֮...ԭͱȽȡ...";
		close;
	L_START_1:
		input @nbm;
		if (@nbm < 1) goto L_SUB_1;
		if (Zeny < (@nbm * @value)) goto L_SUB_1;
		if ((Weight + (@nbm * 200)) > MaxWeight) goto L_SUB_2;
		set Zeny,Zeny - (@nbm * @value);
		getitem @itemid,@nbm;
			mes @npcname$;
			mes "ˣҪǿýպá";
close;
		L_SUBMENU_5:
			mes @npcname$;
			mes "Ǻðɣӭ´";
			close;
		L_SUB_1:
			mes @npcname$;
			mes "ԲŶڵĽҲɲʵġ";
			close;
		L_SUB_2:
			mes @npcname$;
			mes "ԲŶ㲻ܴôˡ";
			close;
}

function	script	װ	{
	mes @npcname$;
	mes "רŶߵҿΪװĿеƷҪװĿеһƷأ";
	next;
	menu	getequipname(1),L_MENU_1,
		getequipname(2),L_MENU_2,
		getequipname(3),L_MENU_3,
		getequipname(4),L_MENU_4,
		getequipname(5),L_MENU_5,
		getequipname(6),L_MENU_6,
		getequipname(7),L_MENU_7,
		getequipname(8),L_MENU_8,
		getequipname(9),L_MENU_9,
		getequipname(10),L_MENU_10;
	L_MENU_1:
		set @part,1;
		if (getequipisequiped(1)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_2:
		set @part,2;
		if (getequipisequiped(2)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_3:
		set @part,3;
		if (getequipisequiped(3)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_4:
		set @part,4;
		if (getequipisequiped(4)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_5:
		set @part,5;
		if (getequipisequiped(5)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_6:
		set @part,6;
		if (getequipisequiped(6)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_7:
		set @part,7;
		if (getequipisequiped(7)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_8:
		set @part,8;
		if (getequipisequiped(8)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_9:
		set @part,9;
		if (getequipisequiped(9)) goto L_START_1;
			goto L_CLOSE;
	L_MENU_10:
		set @part,10;
		if (getequipisequiped(10)) goto L_START_1;
			goto L_CLOSE;
L_START_1:
	if (getequipisenableref(@part)) goto L_START_2;
		mes @npcname$;
		mes "װ޷";
		goto L_CLOSE;
L_START_2:
	if (getequipisidentify(@part)) goto L_START_3;
		mes @npcname$;
		mes "ΪδԲܾ";
		goto L_CLOSE;
L_START_3:
	if (getequiprefinerycnt(@part) < 10) goto L_REFINE_0;
		mes @npcname$;
		mes "װѾεߵȼ޷ٶ..";
		goto L_CLOSE;
L_REFINE_0:
	if (getequipweaponlv(@part) > 0) goto L_REFINE_1;
		mes @npcname$;
		mes "ҪѡװҪ^ff9999^000000Լ2000ҡ";
		mes "ȷҪ";
		next;
		menu "",-,"ȡ",L_CANCEL_3;
			if (getequippercentrefinery(@part) == 100) goto L_0_SUB;
				mes @npcname$;
				mes "װѾκܶ˵...ҪټεĻܻร";
				next;
				mes @npcname$;
				mes "Ҫ𻵵ĻɾͲܼʹˣĿƬҲ^ff0000ȫʧ^000000";
				next;
				mes @npcname$;
				mes "ңװҲʧŶȷҪ";
				next;
				menu "",-,"ȡ",L_CANCEL_1;
	L_0_SUB:
		if ((countitem(985) < 1) || (Zeny < 2000)) goto L_CANCEL_2;
			delitem 985,1;
			set Zeny,Zeny-2000;
			goto L_REFINE_5;
L_REFINE_1:
	if (getequipweaponlv(@part) > 1) goto L_REFINE_2;
		mes @npcname$;
		mes "Ҫȼ1";
		mes "ҪεĻҪ^ff9999ǿý-ǿһ^000000Լ500ҡ";
		mes "Ҫ";
		next;
		menu "",-,"ȡ",L_CANCEL_3;
			if (getequippercentrefinery(@part) == 100) goto L_1_SUB;
				mes @npcname$;
				mes "װѾκܶ˵...ҪټεĻܻร";
				next;
				mes @npcname$;
				mes "Ҫ𻵵ĻɾͲܼʹˣĿƬҲ^ff0000ȫʧ^000000";
				next;
				mes @npcname$;
				mes "ңװҲʧŶȷҪ";
				next;
				menu "",-,"ȡ",L_CANCEL_1;
	L_1_SUB:
		if ((countitem(1010) < 1) || (Zeny < 500)) goto L_CANCEL_2;
			delitem 1010,1;
			set Zeny,Zeny-500;
			goto L_REFINE_5;
L_REFINE_2:
	if (getequipweaponlv(@part) > 2) goto L_REFINE_3;
		mes @npcname$;
		mes "Ҫȼ2";
		mes "ҪεĻҪ^ff9999ǿý-ǿ^000000Լ2000ҡ";
		mes "Ҫ";
		next;
		menu "",-,"ȡ",L_CANCEL_3;
			if (getequippercentrefinery(@part) == 100) goto L_2_SUB;
				mes @npcname$;
				mes "װѾκܶ˵...ҪټεĻܻร";
				next;
				mes @npcname$;
				mes "Ҫ𻵵ĻɾͲܼʹˣĿƬҲ^ff0000ȫʧ^000000";
				next;
				mes @npcname$;
				mes "ңװҲʧŶȷҪ";
				next;
				menu "",-,"ȡ",L_CANCEL_1;
	L_2_SUB:
		if ((countitem(1011) < 1) || (Zeny < 2000)) goto L_CANCEL_2;
			delitem 1011,1;
			set Zeny,Zeny-2000;
			goto L_REFINE_5;
L_REFINE_3:
	if (getequipweaponlv(@part) > 3) goto L_REFINE_4;
		mes @npcname$;
		mes "Ҫȼ3";
		mes "ҪεĻҪ^ff9999֮^000000Լ2500ҡ";
		mes "Ҫ";
		next;
		menu "",-,"ȡ",L_CANCEL_3;
			if (getequippercentrefinery(@part) == 100) goto L_3_SUB;
				mes @npcname$;
				mes "ۣ";
				mes "Ѿκܶ˵...ҪټεĻܻร";
				next;
				mes @npcname$;
				mes "Ҫ𻵵ĻɾͲܼʹˣ";
				mes "ĿƬ^ff0000ȫʧ^000000";
				next;
				mes @npcname$;
				mes "ңװҲʧŶȷҪ";
				next;
				menu "",-,"ȡ",L_CANCEL_1;
	L_3_SUB:
		if ((countitem(984) < 1) || (Zeny < 2500)) goto L_CANCEL_2;
			delitem 984,1;
			set Zeny,Zeny-2500;
			goto L_REFINE_5;
L_REFINE_4:
		mes @npcname$;
		mes "Ҫȼ4";
		mes "ҪεĻҪ^ff9999֮^000000Լ5000ҡ";
		mes "Ҫ";
		next;
		menu "",-,"ȡ",L_CANCEL_3;
			if (getequippercentrefinery(@part) == 100) goto L_4_SUB;
				mes @npcname$;
				mes "ۣ";
				mes "Ѿκܶ˵...ҪټεĻܻร";
				next;
				mes @npcname$;
				mes "Ҫ𻵵ĻɾͲܼʹˣ";
				mes "ĿƬ^ff0000ȫʧ^000000";
				next;
				mes @npcname$;
				mes "ңװҲʧŶȷҪ";
				next;
				menu "",-,"ȡ",L_CANCEL_1;
	L_4_SUB:
		if ((countitem(984) < 1) || (Zeny < 5000)) goto L_CANCEL_2;
			delitem 984,1;
			set Zeny,Zeny-5000;
L_REFINE_5:
	if (getequippercentrefinery(@part)<=rand(100)) goto L_REFINE_6;
		mes @npcname$;
		mes "ϣϣϣ";
		successrefitem @part;
		next;
		emotion 18;
		mes @npcname$;
		mes "ȥɣѾˡþûγôʵˣǿһҲܸ˰ɣ";
		CLOSE;
L_REFINE_6:
	mes @npcname$;
	mes "ϣϣϣ";
	failedrefitem @part;
	next;
	emotion 4;
	mes @npcname$;
	mes "ȿȿȿȿȿȿȣ";
	next;
	mes @npcname$;
	mes "...";
	mes "ڶεĹˡ";
	mes "......͸߹";
	CLOSE;
L_CANCEL_1:
	mes @npcname$;
	mes "ܺá";
	mes "̫Ķ𻵣Ҳű仵ġ";
	CLOSE;
L_CANCEL_2:
	mes @npcname$;
	mes "ЩӵеƷ";
	mes "ȻܿϧĲϲ㣬ҲʵڰĪ˵ҸҲӦõҪջ";
	CLOSE;
L_CANCEL_3:
	mes @npcname$;
	mes "Ǻðɣӭ´";
L_CLOSE:
			mes @npcname$;
			mes "ҪҪҰͷԶεôһ㰡";
	close;
}
