//==============================================
// edit by ɻ 2005-7-21
// д& by FPE (2006.6.27)
// Jathena++ ̳http://www.foxofice.net/bbs
//----------------------------------------------

function	script	airportIn	{
	mes "[ ְԱ]";
	mes "Ǻʱṩ˿ͱʵз񣬻ᾡܣҪæ";
	next;
	if(getarg(0)==1)
	{
		menu	"Ҫڲ",A01,
			"ȡ",-;

		mes "[ ]";
		mes "´ðɣлл";
		close;
		end;

A01:
		mes "[ ְԱ]";
		mes "÷ɿͧķΪ1200ңзͧѴ˾Ļѽ룬Ҫڲ";
		next;
		switch(select("ǵ","Ҫ"))
		{
		case 1:	
			if(countitem(7311)<1)
			{
				if(zeny<1200)
				{
					mes "[ ְԱ]";
					mes "㹻ֽ";
					close;
					end;
				}
				set zeny,zeny-1200;
				warp "airport.gat",142,49;
				end;
			}
			delitem 7311,1;
			warp "airport.gat",142,49;
			end;
			break;
		case 2:
			mes "[ ]";
			mes "´ðɣлл";
			close;
			end;
			break;
		}
	}

	if(getarg(0)==2)
	{
		mes "[ ְԱ]";
		mes "Ҫӻڲ뿪ĻҪڻһηรҪ뿪";
		next;
		switch(select("ǵ","Ҫ"))
		{
		case 1:
			warp "airport.gat",143,42;
			close;
			end;
			break;
		case 2:
			mes "[ ]";
			mes "´ð,лл";
			close;
			end;
			break;
		}
	}
}

airport.gat,158,43,4	script	 	90,{ callfunc "airportIn",1; }						
airport.gat,144,43,4	script	 	90,{ callfunc "airportIn",1; }
airport.gat,130,43,4	script	 	90,{ callfunc "airportIn",1; }
airport.gat,158,50,4	script	 	90,{ callfunc "airportIn",2; }
airport.gat,144,50,4	script	 	90,{ callfunc "airportIn",2; }
airport.gat,130,50,4	script	 	90,{ callfunc "airportIn",2; }

airport.gat,143,62,0	warp	einairport01	3,2,einbroch.gat,64,242
einbroch.gat,64,234,0	warp	einairport02	3,2,airport.gat,142,55
einbroch.gat,92,280,0	warp	einairport03	2,3,airplane.gat,227,60

airplane.gat,243,29,0	script	rand_Airplane_1	45,2,3,{
	if($@airwarp==1) warp "einbroch",92,276;
	if($@airwarp==0) warp "yuno",157,168;
	end;
}

airplane.gat,243,74,0	script	rand_Airplane_2	45,2,3,{
	if($@airwarp==1) warp "einbroch",92,276;
	if($@airwarp==0) warp "yuno",157,168;
	end;
}

airplane.gat,101,65,1	script	airplane	-1,{
	end;
OnInit:
	initnpctimer;
	end;
OnTimer15000:
	switch($@airplane)
	{
	case 0:
		mapannounce "airplane.gat","Ŀǰͣŵһ¼",16;
		set $@airplane,$@airplane+1;
		break;
	case 1:
		mapannounce "airplane.gat","ɿͧɣһĿǰ޿",16;
		set $@airplane,$@airplane+1;
		break;
	case 2:
		mapannounce "airplane.gat","Ŀǰɿͧڷ޿;",16;
		mapannounce "yuno.gat","ɿͧ뱾УҪ˷ɿͧĳ˿͵ȴ°ɿͧ",16;
		set $@airwarp,2;
		disablenpc "rand_Airplane_1";
		disablenpc "rand_Airplane_2";
		set $@airplane,$@airplane+1;
		break;
	case 3:
		mapannounce "airplane.gat","һ·ɴҪڰ޿",16;
		set $@airplane,$@airplane+1;
		break;
	case 4:
		mapannounce "airplane.gat","Ѿﰬ޿ˣ»ÿٻ",16;
		mapannounce "einbroch.gat","ɿִͧﱾУҪ˷ɿͧĳ˿ץʱϷɿͧ",16;
		set $@airwarp,1;
		enablenpc "einplane";
		enablenpc "rand_Airplane_1";
		enablenpc "rand_Airplane_2";
		set $@airplane,$@airplane+1;
		break;
	case 5:
		mapannounce "airplane.gat","Ŀǰͣڰ޿ˣһ¼",16;
		set $@airplane,$@airplane+1;
		break;
	case 6:
		mapannounce "airplane.gat","ɿͧɣһĿŵ",16;
		set $@airplane,$@airplane+1;
		break;
	case 7:
		mapannounce "airplane.gat","Ŀǰɿͧڷŵ;",16;
		mapannounce "einbroch.gat","ɿͧ뱾УҪ˷ɿͧĳ˿͵ȴ°ɿͧ",16;
		set $@airwarp,2;
		disablenpc "rand_Airplane_1";
		disablenpc "rand_Airplane_2";
		disablenpc "einplane";
		set $@airplane,$@airplane+1;
		break;
	case 8:
		mapannounce "airplane.gat","һ·ɴҪŵ",16;
		set $@airplane,$@airplane+1;
		break;
	case 9:
		mapannounce "airplane.gat","Ѿŵˣ»ÿٻ",16;
		mapannounce "yuno.gat","ɿִͧﱾУҪ˷ɿͧĳ˿ץʱϷɿͧ",16;
		set $@airwarp,0;
		enablenpc "rand_Airplane_1";
		enablenpc "rand_Airplane_2";
		set $@airplane,0;
		break;
	}
	setnpctimer 0;
	end;
}

airplane.gat,100,69,4	script	Ա	852,{
	mes "[Ա]";
	mes "ҪڷɿͧĻõϲ¥ݣл˷ɿͧ,";
	mes "ףиһ죡";
	close;
	end;
}

yuno.gat,141,175,4	script	ɿͧ ְԱ	88,{
	mes "[ɿͧ ְԱ]";
	mes "ãǺʱṩ˿ͱʵз񣬻ᾡܣҪæ";
	next;
	if($@airwarp==0)
	{
		menu	"Ҫ˷ɿͧ",A01,
			"ȡ",-;

		mes "[ɿͧ ְԱ]";
		mes "´ðɣлл";
		close;
		end;
	A01:
			mes "[ɿͧ ְԱ]";
			mes "÷ɿͧķΪ1200ңзͧѴ˾ĻѴˣֻд˷ɿͧܵ'^FF0000޿^000000'Ҫ˷ɿͧ";
			next;
			switch(select("ǵ","Ҫ"))
			{
			case 1:	
				if(countitem(7311)<1)
				{
					if(zeny<1200)
					{
						mes "[ɿͧ ְԱ]";
						mes "㹻ֽ";
						close;
						end;
					}
					set zeny,zeny-1200;
					warp "airplane.gat",227,60;
					end;
				}
				delitem 7311,1;
				warp "airplane.gat",227,60;
				end;
				break;
			case 2:
				mes "[ɿͧ ְԱ]";
				mes "´ðɣлл";
				close;
				end;
				break;
			}
	}
	else
	{
		mes "[ɿͧ ְԱ]";
		mes "ĿǰɿͧδͣڱУԺ";
		close;
		end;
	}
}

airplane.gat,50,67,4	script		86,{
	mes "[]";
	mes "ӭ٣зʵƻեƻ֭ķ~";
	next;
	menu	"Ҫƻ",A01,
		"Ҫƻեƻ֭",A02,
		"ƻ˰",A03,
		"ȡ",-;

	mes "[]";
	mes "ӭ´ݰ݆~";
	close;
	end;

A01:
	mes "[]";
	mes "Ҫƻƻÿ15ңһ500ţҪȡʱ0";
A01_1:
	next;
	input @temp;
	if(@temp==0)
	{
		mes "[]";
		mes "ӭ´ݰ݆~";
		close;
		end;
	}
	if(@temp<0 || @temp>500)
	{
		mes "[]";
		mes "ȷ";
		goto A01_1;
	}
	set @zenytemp,@temp*15;
	mes "[]";
	mes "Ҫƻ^FF0000"+@temp+"^000000Ҫ֧Ľ ^FF0000"+@zenytemp+"^000000 ңȷҪ";
	next;
	switch(select("Ҫ","Ҫ"))
	{
	case 1:
		if(zeny<@zenytemp)
		{
			mes "[]";
			mes "ϵĽǮ";
			close;
			end;
		}
		if((Weight+(@temp*20))>MaxWeight)
		{
			mes "[]";
			mes "ĸز";
			close;
			end;
		}
		set zeny,zeny-@zenytemp;
		getitem 512,@temp;
		mes "[]";
		mes "лл㣬㻹ҪƻĻӭ";
		close;
		end;
		break;
	case 2:
		mes "[]";
		mes "ӭ´ݰ݆~";
		close;
		end;
		break;
	}

A02:
	mes "[]";
	mes "ƻ֭Ҫ";
	mes "^FF0000ƻ3źͿƿһ^000000ЩϽҾˣҪեƻ֭";
	next;
	switch(select("ǵ","Ҫ"))
	{
	case 1:
		if(countitem(512)<3 || countitem(713)<1)
		{
			mes "[]";
			mes "ӵеĲϺ񲻹أٸһɣҪ^FF0000ƻ3źͿƿ1^000000ЩϽҾˣռԺҰ";
			close;
			end;
		}
		delitem 512,3;
		delitem 713,1;
		mes "[]";
		mes "лл㣬㻹Ҫƻ֭Ļӭ";
		close;
		end;
		break;
	case 2:
		mes "[]";
		mes "ӭ´ݰ݆~";
		close;
		end;
		break;
	}

A03:
	mes "[]";
	mes "ұǸĴҪؤֱһ˯ʱͻȻиͷ";
	next;
	mes "[]";
	mes "һԭμܹǿƻ˯ĵطǿƻ";
	next;
	mes "[]";
	mes "ҶӶˣҪƻʱһλڷɿͧϣ˵мҰæҽеɿͧȥæһ·ɿͧʱƻΪעϷ";
	next;
	mes "[]";
	mes "ĵģһأԾøղŵƻһѣ뵽̫ˣҵƻ1ű2ţ2ű4ţԽӮԽ";
	next;
	mes "[]";
	mes "ҾԾƻˣе";
	mes "û뵽ϵƻȴıҵˣԲ˵Ļ̫";
	next;
	mes "[]";
	mes "ƻ潡ҪһรϲϲҪȡɫƻ˵µĵʹ߸ƻĻװһӵģɼƻǺôˮ";
	close;
	end;
}

airplane.gat,47,61,2	script	Ա	833,{
	mes "[ ϣÿ]";
	mes "";
	mes "ܷɿͧĻԱҽ  ϣÿգ";
	mes "˷ɿͧκβ֮ʱҷӦ";
	next;
	switch(select("ѯйطɿͧ","Ҫ"))
	{
	case 1:
		mes "[ ϣÿ]";
		mes ",һδ˷ɿͧ";
		mes "Ǻ..";
		mes "˵Ҳǣҵһδ˷ɿͧʱ";
		mes "Ҳǳأû";
		next;
		mes "[ ϣÿ]";
		mes "ҵĿƼ";
		mes "һͻԵķչ";
		next;
		mes "[ ϣÿ]";
		mes "˵¬--׵¼İ,";
		mes "ǻʩչħ";
		mes "źǸĺǢ";
		next;
		mes "[ ϣÿ]";
		mes "㷢ȷ¹͹";
		mes "ӵѧ";
		mes "'ֵƬ',";
		mes "յĴ,";
		mes "߸";
		next;
		mes "[ ϣÿ]";
		mes "ͧٲȻΪ㷢ȷ";
		mes "дѧԺ豸";
		next;
		menu	"ɿͧĽͨ",-;
		mes "[ ϣÿ]";
		mes "";
		mes "պͰ޿֮лʻ,";
		mes "֮⣬ֻܿ㽡ģ";
		mes "˫ˡǺǣ";
		close;
		end;
		break;
	case 2:
		mes "[ ϣÿ]";
		mes "ԵĻԣ";
		mes "ҪȡԵĻ'0'";
		next;
		input @temp$;
		if(@temp$=="0")
		{
			mes "[ ϣÿ]";
			mes "ҪԵĻҰ";
			close;
			end;
		}
		mes "["+strcharinfo(0)+"]";
		mes @temp$;
		next;
		mes "[ ϣÿ]";
		mes ".. ˣ";
		mes "һ淴ӳ";
		close;
		end;
	}
}

airplane.gat,31,77,5	script		853,{
	mes "[ ]";
	mes "õģõ...";
	mes "һҪƯģ";
	mes "ƻǿ..!!";
	next;
	mes "[ ]";
	mes "߰ɣ^0000ffֵ^000000!!ǣ!!!!!";
	next;
	mes "["+strcharinfo(0)+"]";
	mes "'ţղ˵ʲôˣ";
	mes "ղ˵...";
	next;
	mes "-";
	mes "˹¶¶.....ڹ..";
	mes "!-";
	next;
	mes "[]";
	mes "ζӵĵܹ^FF000011^000000,";
	mes " ^FF00005^000000";
	mes ",,ܿϧ´ս,ټ~?";
	next;
	mes "[ ]";
	mes "ŶŶŶŶŶŶŶ!!!!!!!";
	mes "۰!!!!!!!!!";
	next;
	mes "-ӿ˷ܵ-";
	close;
	end;
}

airplane.gat,32,68,5	script		73,{
	mes "[]";
	mes "ҵֽпһֱڷɿͧеİɣҪҪɵһϷ";
	next;
	menu	"ҪһϷ",L_Game,
		"˽ϷĹ",L_rule,
		"ȡ",-;

	mes "[]";
	mes "ϷĻʱҰɣ﷢Ҳĵģôټ";
	close;
	end;

L_Game:
	mes "[]";
	mes "ҪµĶע";
L_input:
	next;
	input @tempapple_N;

	if(@tempapple_N==0)
	{
		mes "[]";
		mes "ڷɿͧĵʱ~";
		close;
		end;
	}

	if(@tempapple_N>50 || @tempapple_N<0)
	{
		mes "[]";
		mes "Ķע̫࣬Ҳˣ";
		goto L_input;
	}

	if(@tempapple_N>countitem(512))
	{
		mes "[]";
		mes "ӵеƻأ";
		goto L_input;
	}

	mes "[]";
	mes "Ķע ^ff0000"+@tempapple_N+"^000000 أ";
	next;
	menu	"ǵ",L_GameStart,
		"",L_reinput;

L_GameStart:
	//----------------Ϸֿʼ--------------------------------------------------------
	mes "[]";
	mes "ðɣǾͿʼϷ";
	delitem 512,@tempapple_N;
	next;
	mes "^bbbbbbӣ^000000";
	mes "˹¶¶... ˹...";
	next;
	//NPCӵ
	set @NPC_point1,rand(1,6);
	set @NPC_point2,rand(1,6);
	set @NPC_pointall,@NPC_point1+@NPC_point2;

	mes "[]";
	mes "ӵ ^ff0000"+@NPC_point1+","+@NPC_point2+"^000000㣬ϼ ^ff0000"+@NPC_pointall+"^000000㣬 ^ff0000"+strcharinfo(0)+"^000000/Сӆ";
	next;
	menu	"",-;

	//ӵ
	set @My_point1,rand(1,6);
	set @My_point2,rand(1,6);
	set @My_pointall,@My_point1+@My_point2;

	mes "^bbbbbb"+strcharinfo(0)+"ӣ^000000";
	mes "˹¶¶... ˹...ͣ";
	next;
	mes "[]";
	mes "^ff0000"+strcharinfo(0)+"^000000/Сӵ";
	mes "^ff0000"+@My_point1+","+@My_point2+"^000000㣬ϼ^ff0000"+@My_pointall+"^000000";
	next;

	//жǷ
	//1.NPCҵ6,
	if(@NPC_pointall>(@My_pointall+6))
	{
		mes "[]";
		mes "ź^ff0000"+strcharinfo(0)+"^000000/С㣬ҵĵܶ࣬ʹҪҲܳҵĵʤˣӭ´";
		close;
		end;
	}

	//2.NPCڵҵ,ѯǷ
	if(@NPC_pointall>=@My_pointall)
	{
		mes "[]";
		if(@NPC_pointall>@My_pointall) mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ҵĵ࣬Ҫ";
		if(@NPC_pointall==@My_pointall) mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ǵĵͬҪ";
		next;
		if(@NPC_pointall>@My_pointall)
		{
			menu	"õģҲһ",L_Next,
				"ˣ",L_My_lost;
		}
		if(@NPC_pointall==@My_pointall)
		{
			menu	"õģҲһ",L_Next,
				"ˣҲ",L_NPC_Choose;
		}
L_Next:
		set @My_point3,rand(1,6);
		set @My_pointall,@My_pointall+@My_point3;
		mes "^bbbbbb"+strcharinfo(0)+"ӣ^000000";
		mes "˹¶¶... ˹...ͣ...";
		next;
		mes "[]";
		mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ӵ ^ff0000"+@My_point3+"^000000";
		mes "ϼ ^ff0000"+@My_pointall+"^000000.";
		if(@My_pointall>12)       
		{
			mes " ^0000ff12^000000Ӯˣӭ´";
			close;
			end;
		}
		goto L_NPC_Choose;
L_My_lost:
		mes "[]";
		mes "^ff0000"+strcharinfo(0)+"^000000/С㣬Ӯˣӭ´";
		close;
		end;
	}

//NPCжϲ
L_NPC_Choose:

	//3.NPCСҵ6,NPC
	if((@NPC_pointall+6)<@My_pointall) goto L_NPC_lost;

	//4.ѾNPCҵNPCʤ
	if(@NPC_pointall>@My_pointall && @My_point3>0)
	{
		mes "ź^ff0000"+strcharinfo(0)+"^000000/С㣬ҵĵǱ࣬ӭ´";
		close;
		end;
	}

	//5.NPCСڵҵûΣΣ䡣
	if(@NPC_pointall<=@My_pointall)
	{
		if(@NPC_point3>0) goto L_NPC_lost;
		if(@NPC_pointall==12 && @My_pointall==12) goto L_nowinner;
		if(@My_point3>0)
		{
			mes "ڵӆ";
			next;
		}
		set @NPC_point3,rand(1,6);
		set @NPC_pointall,@NPC_pointall+@NPC_point3;
		mes "^bbbbbbӣ^000000";
		mes "˹¶¶... ˹...ͣ";
		next;
		mes "[]";
		mes "ӵ ^0000ff"+@NPC_point3+"^000000";
		mes "ϼ ^0000ff"+@NPC_pointall+"^000000";

		//NPCκ󳬹㣬ʤ
		if(@NPC_pointall>12)       
		{
			mes " ^0000ff12^000000 ^ff0000"+strcharinfo(0)+"^000000/С Ӯˣƻ´һѰ";
			getitem 512,(@tempapple_N*2);
			close;
			end;
		}
		else if(@NPC_pointall<@My_pointall)
		{	//NPCκ󲻳㣬жʤ
			mes "ɺϼ ^ff0000"+@My_pointall+"^000000 ^ff0000"+strcharinfo(0)+"^000000/С Ӯˣƻ´һѰ";
			getitem 512,(@tempapple_N*2);
			close;
			end;
		}
		else if(@My_point3==0)
		{	//һûѡ
			if(@NPC_pointall>@My_pointall) mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ҵĵ࣬Ҫ";
			if(@NPC_pointall==@My_pointall) mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ǵĵͬҪ";
			next;
			menu	"õģҲһ",L_Next,
				"ˣ",L_My_lost;
		}
		else
		{
			if(@NPC_pointall==@My_pointall)
			{
L_nowinner:
				mes "^ff0000"+strcharinfo(0)+"^000000/С㣬ǵĵͬ;֣ȡע";
				getitem 512,@tempapple_N;
				close;
				end;
			}
			mes "ĳɼֻ ^ff0000"+@My_pointall+"^000000Ӯˣӭ´";
			close;
			end;
		}
	}

L_NPC_lost:
	if(@My_point3>0) next;
	mes "[]";
	mes "ˣ^ff0000"+strcharinfo(0)+"^000000/СӮˣƻ´һѰ";
	getitem 512,(@tempapple_N*2);
	close;
	end;
//----------------Ϸֽ--------------------------------------------------------

L_reinput:
	mes "[]";
	mes "";
	goto L_input;

//----------------Ϸ˵--------------------------------------------------------
L_rule:
	mes "[]";
	mes "ӵϷʵܼ򵥣ȿʼϷʱע^ff0000 50^000000 ƻȻûƻͲܲμϷ";
	next;
	mes "[]";
	mes "ƻע󣬱˴˸ӣĺϼƵһʤȻϷһζɽͲ̫棬߸һΣΣӵĻ";
	next;
	mes "[]";
	mes "ҪҪǸ˵ɣһһӺ󣬵^ff000012^000000ʱɳһΪ";
	next;
	mes "[]";
	mes "ѡʱĵ12㣬ʹҲҲʤ";
	next;
	mes "[]";
	mes "Ϸʤһȫӵ˫һעƻ˵Ѿ˰";
	close;
	end;
}