//===== rAthena Script ======================================= 
//= Dye Maker
//===== By: ================================================== 
//= rAthena Dev Team
//===== Current Version: ===================================== 
//= 1.4
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: ========================================= 
//= [Official Conversion]
//= Quests to create the eight colored Dyestuffs.
//===== Additional Comments: ================================= 
//= 1.0 Fully working [kobra_k88]
//= 1.1 Spell Checked [Nexon] 
//= 1.2 Rescripted to Aegis 10.3 standard. [L0ne_W0lf]
//= 1.2b Fixed typos in variable names [ultramage]
//= 1.3 Made the checks more dynamic [ultramage]
//= 1.3b Fixed incorrect checking loop structure [ultramage]
//= 1.4 Added a checkweight. [L0ne_W0lf]
//============================================================ 

morocc_in,146,99,3	script	߶	58,{
	if ((MaxWeight-Weight) < 200 || checkweight(1201,1) == 0) {
		mes "- ! -";
		mes "- ǰЯ̫ණ. -";
		mes "- һЩƷŽ -";
		mes "- ֿ, ٻ. -";
		mes "- һڴεȺ. -";
		close;
	}
	mes "[Ⱦʦ ߶]";
	mes "...";
	mes "һ찡. Ⱦϵʱ.";
	next;
	switch(select("̸:Ⱦ:ȡ")) {
	case 1:
		mes "[Ⱦʦ ߶]";
		mes ", һûʲô˵. , ϣҸ㽲ҵ, ǿ. ܳ, Ը?";
		next;
		if (select(":") == 1) {
			mes "[Ⱦʦ ߶]";
			mes "Ҽ, Ҹ׾ѾʼȾ. ͨҪȥСʱ첻ͬɫȾ. ʹĸȥʱ, ֹͣ.";
			next;
			mes "[Ⱦʦ ߶]";
			mes "ĳʱ, ұ沢ҳ. Ҳ뱻ҼͥҵǣסҪ.";
			next;
			mes "[Ⱦʦ ߶]";
			mes "...";
			mes "ǻصм̳˼ͥĴͳ, ѾȾ15 .ҲҵѪҺŵ. ";
			next;
			mes "[Ⱦʦ ߶]";
			mes "ʶһЩ, ܹ˽ҵĸ. ΪʲôҵĸжȾ...";
			next;
			mes "[Ⱦʦ ߶]";
			mes "ЩƺĹ, оǵĲɫεħ.";
			next;
			mes "[Ⱦʦ ߶]";
			mes "ҲΪЩζŬΪĿȾ...";
			next;
			mes "[Ⱦʦ ߶]";
			mes "... ô˽⵽? ð, Ҳ. , ҸоܹȾ˵...";
			next;
			mes "[Ⱦʦ ߶]";
			mes ". һ, ҽɹҸҪȾ, ܵòһĻ.";
			close;
		}
		mes "[Ⱦʦ ߶]";
		mes "...";
		mes "ð, Ҳ˭ȥһȾʦ. ....";
		close;

	case 2:
		mes "[Ⱦʦ ߶]";
		mes "ܺ! Ҫ, ҾΪ. ұ֤ҪȾ. ҪʲôȾ? ÿȡȾϵ.";
		next;
		mes "[Ⱦʦ ߶]";
		mes "Ϊʲô, ? Ҫ֪ȾǺ, ֻҪŬ͹. 벻ҪΪûܹ.";
		next;
		mes "[Ⱦʦ ߶]";
		mes "ȾϵɫǺر, һĺʵȥ.";
		next;
		switch(select("ɫȾ:ɫȾ:ɫȾ:īɫȾ:ٻɫȾ:ɫȾ:ɫȾ:ɫȾ:ȡ")) {
		case 1: callsub S_MakeDye,1,1; break;
		case 2: callsub S_MakeDye,2,1; break;
		case 3: callsub S_MakeDye,3,2; break;
		case 4: callsub S_MakeDye,4,3; break;
		case 5: callsub S_MakeDye,5,4; break;
		case 6: callsub S_MakeDye,6,4; break;
		case 7: callsub S_MakeDye,7,4; break;
		case 8: callsub S_MakeDye,8,4; break;
		case 9:
			mes "[Ⱦʦ ߶]";
			mes "!! ô? ڸı!? ɨ...";
			close;
		}

	case 3:
		mes "[Ⱦʦ ߶]";
		mes "ҲԿ䰡. ӵкܸ߳Ⱦϵļ. ҪȾ, . һԺܺļ۸ΪȾϵ.";
		close;
	}

S_MakeDye:
	mes "[Ⱦʦ ߶]";
	switch(getarg(0)) {
	case 1:
		mes "... Ҫ30Ƭɫҩ, 1ƿкͼ, 1ƿɫȾ. ֻ3000ZenyķþͿ.";
		setarray .@item[0], 507, 973, 713;
		setarray .@count[0], 30,   1,   1;
		set .@cost,3000;
		set .@dyestuff,975;
		break;
	case 2:
		mes "... Ҫ30Ƭɫҩ, 1ƿкͼ, 1ƿɫȾ. ֻ3000ZenyķþͿ.";
		setarray .@item[0], 508, 973, 713;
		setarray .@count[0], 30,   1,   1;
		set .@cost,3000;
		set .@dyestuff,976;
		break;
	case 3:
		mes "... Ҫ20Ƭɫҩ, 1ƿкͼ, 1ƿɫȾ. ɫҩܸ, ԷΪ3500Zeny.";
		setarray .@item[0], 510, 973, 713;
		setarray .@count[0], 20,   1,   1;
		set .@cost,3500;
		set .@dyestuff,978;
		break;
	case 4:
		mes "... Ҫ5Ƭɫҩ, 20Ƭɫҩ, 20Ƭɫҩ, 1ƿкͼ, 1ƿϼ, 1ƿīɫȾ. ŪҪĲ. ýΪ5000z.";
		setarray .@item[0], 510, 511, 508, 974, 973, 713;
		setarray .@count[0],  5,  20,  20,   1,   1,   1;
		set .@cost,5000;
		set .@dyestuff,979;
		break;
	case 5:
		mes "... Ҫ20Ƭɫҩ, 20Ƭɫҩ, 1ƿкͼ, 1ƿϼ, 1ƿٻɫȾ. Ϊ5000Zeny.";
		setarray .@item[0], 507, 508, 974, 973, 713;
		setarray .@count[0], 20,  20,   1,   1,   1;
		set .@cost,5000;
		set .@dyestuff,980;
		break;
	case 6:
		mes "... Ҫ10Ƭɫҩ, 30Ƭɫҩ, 1ƿкͼ, 1ƿϼ, 1ƿɫȾ. Ϊ5000Zeny.";
		setarray .@item[0], 510, 507, 974, 973, 713;
		setarray .@count[0], 10,  30,   1,   1,   1;
		set .@cost,5000;
		set .@dyestuff,981;
		break;
	case 7:
		mes "... Ҫ30Ƭɫҩ, 1ƿкͼ, 1ƿɫȾ. Ϊ3000Zeny.";
		setarray .@item[0], 509, 973, 713;
		setarray .@count[0], 30,   1,   1; 
		set .@cost,3000;
		set .@dyestuff,982;
		break;
	case 8:
		mes "... Ҫɫҩ, ɫҩ, ɫҩ30 Ƭ, 5Ƭɫҩ, 1ƿкͼ, 1ƿϼ, 1ƿ. Ҫʱ͸Ŭ, ԷΪ7000 Zeny.";
		setarray .@item[0], 507, 508, 511, 510, 974, 973, 713;
		setarray .@count[0], 30,  30,  30,   5,   1,   1,   1;
		set .@cost,7000;
		set .@dyestuff,983;
		break;
	}
	next;
	mes "[Ⱦʦ ߶]";
	switch(getarg(1)) {
	case 1: mes "! Ѿ׼еĶ. Ҫҿʼ?"; break;
	case 2: mes "ܺ! Ѿ׼еĶ. Ҫҿʼ?"; break;
	case 3: mes "ܺ! Ѿ׼еĶ. ҿԿʼ?"; break;
	case 4: mes "ܺ! Ѿ׼еĶ. Ҫҿʼ?"; break;
	}
	next;
	if (select("Ⱦ:ȡ") == 1) {
		set .@size, getarraysize(.@item);
		// 
		for( set .@i,0 ; .@i < .@size ; set .@i,.@i+1 )
			if( countitem(.@item[.@i]) < .@count[.@i] )
				break;
		if( .@i < .@size || Zeny < .@cost ) {
			mes "[Ⱦʦ ߶]";
			mes ". ...";
			mes "ҲĲҪȾ. Ϊβõ...?";
			close;
		}
		// ɾƷ
		for (set .@i, 0; .@i < .@size ; set .@i, .@i+1)
			delitem .@item[.@i], .@count[.@i];
		set zeny,zeny-.@cost;
		// õȾ
		getitem .@dyestuff,1;
		
		mes "[Ⱦʦ ߶]";
		mes "... ĲŶ. һǳɫ. Ȼһ᳢˵Ⱦ...";
		next;
		mes "[Ⱦʦ ߶]";
		mes "õ, . ҪȾʱ, .";
		close;
	}
	mes "[Ⱦʦ ߶]";
	mes "!! ô? ڸı";
	mes "!? ɨ...";
	return;
}
