		//------------------------------//
		//	ȫԶ쾫ʦ	//
		//	    By ˾ͽ		//
		//	   2004-05-20		//
		//------------------------------//
	//----------------------------------------------//
	//		    ʹ˵			//
	//	˾ʦΪƼƷ			//
	//	ΪһȫԶnpc		//
	//	һȫԶжҪװ	//
	//	ܶȫԶװһ+10		//
	//	صһֻһǾ""		//
	//	ɲװͷСͷ¡Ʒ1Ʒ2	//
	//	Ԥ費ȥжװûװһ	//
	//----------------------------------------------//

	//2004-05-20 AM:03:28 //
	//ȥnpcԻ
	//2004-05-20 PM:05:41 //
	//˵һ

//˵
//@max -- ֵ
//@part -- װλ (޸)
//@ngp -- ǷװûװԶ+1 (޸)
//@ygp -- ǷС@maxԶ+1 (޸)
//@ngpmx -- ǷװûװԶ+1ֵ (@part_maxĳ11ĻҲѴΪ11)
//@ygpmx -- ǷС@maxԶ+1ֵ (@part_maxĳ11ĻҲѴΪ11)
//@part_max -- װλֵ (Ԥֻܾסͷ1Ь硢)
//             Ҫͷ2ͷ3Ʒ1Ʒ2ܾĻĳ11 (δԹ) )
//             Ϊ11ĻҵвƳ
//             mes " ɲװͷСͷ¡Ʒ1Ʒ2npcȥжװûװһ";

prontera.gat,147,165,5	script	ȫԱ	878,{
	set @max,6;
	set @part,1;
	set @part_max,7;
	set @ngp,1;
	set @ygp,1;
	set @ngpmx,7;
	set @ygpmx,7;
	mes " [ȫԱ] ";
	mes " רŶߵ";
	mes " ҿ^ff0000^000000Ʒȫ"+@max+"";
	mes " ^ff0000һʹ^000000ǵÿ˵!!";
	next;
	menu	"Ҫһƭ˵",L_CANCEL,
		"Ҫ",L_Yes,
		"ʹ˵",L_dme;
L_dme:
	mes " [ȫԱ] ";
	mes " һʹüǵÿ˵ࡡ";
	mes " ˾ʦΪƼƷ";
	mes " ΪһȫԶnpc";
	mes " ^0000FFһ^000000ȫԶжҪװ";
	mes " ^0000FFصһ^000000ֻһǾ'^0000FF^000000'";
	next;
	mes " ɲװͷСͷ¡Ʒ1Ʒ2npcȥжװûװһ";
	goto L_CLOSE;

L_Yes:
	if (@ngp == @ngpmx) goto L_ERROR;
	if (@ygp == @ygpmx) goto L_ERROR1;
	if (@part == @part_max) goto L_CLOSE;
	if ( getequipisequiped(@part) > 0) goto L_Yes2;
	set @ngp,@ngp+1;
	set @part,@part+1;
	goto L_Yes;
L_Yes2:
	if ( getequiprefinerycnt(@part) < @max) goto L_Yes3;
	set @ygp,@ygp+1;
	set @part,@part+1;
	goto L_Yes;
L_Yes3:
	if ( getequipisenableref(@part) > 0 ) goto L_Yes4;
	set @part,@part+1;
	goto L_Yes;
L_Yes4:
	if ( getequiprefinerycnt(@part) >= @max) end;
	goto L_Yes5;
L_Yes5:
	successrefitem @part;
	goto L_Yes;

L_ERROR:
	mes " [ȫԱ] ";
	mes " Ҳ?";
	mes " ȫûװ!!";
	mes " 㣬Ҳ뿴㡣";
	goto L_CLOSE;
L_ERROR1:
	mes " [ȫԱ] ";
	mes " Բ!!ȫװ+"+@max+"";
	mes " ҲΪ㾫!!";
        mes " Ҫֻȥʦˡ";
	goto L_CLOSE;

L_CANCEL:
	mes " [ȫԱ] ";
	mes " ĵˣ";
	mes " 뿪ҵߣ";
	goto L_CLOSE;

L_CLOSE:
	close;
}
