//===== rAthena Script =======================================
//= Magazine Dealers
//===== By: ==================================================
//= rAthena Dev Team
//===== Current Version: =====================================
//= 1.2a
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Turns bullets into magazines/packs.
//===== Additional Comments: =================================
//= 1.0 First version. [SinSloth]
//= 1.1 Optimized version - Reduced to only one function [SinSloth]
//= 1.2 Optimized^2, corrected npc's name [ultramage]
//= 1.2a Optimized. Please, ommit extra NPC names [Lupus]
//============================================================

alberta,118,157,3	script	ҩ ::mdk	83,{

	mes "[]";	
	mes "ǵҩ !";
	if(BaseJob != Job_Gunslinger) {
		mes "ǹѹӵѹӵ쵯ϻ.";
		next;
		mes "[]";
		mes "㿴ɲǹ";
		mes "";
		mes "ұҪ뿪.";
		mes "ûҪĶ.";
		close;
	}
	mes "õҩ̫ʱ";
	mes "ǵʱҪ";
	next;
	mes "[]";
	mes "ĵҩ";
	mes "õҩЯ";
	mes "ַ㣬";
	mes "~ ôúù~";
	next;
	switch(select("ӵ :ӵ :ӵ :ӵ ˮ:ӵ :ҩͰ:ɫҩͰ:ɫҩͰ:ȡ")) {
	case 1: callfunc "Func_Casing",13204,12144; break;
	case 2: callfunc "Func_Casing",13206,12145; break;
	case 3: callfunc "Func_Casing",13205,12146; break;
	case 4: callfunc "Func_Casing",13207,12147; break;
	case 5: callfunc "Func_Casing",13203,12148; break;
	case 6: callfunc "Func_Casing",13200,12149; break;
	case 7: callfunc "Func_Casing",13202,12150; break;
	case 8: callfunc "Func_Casing",13201,12151; break;
	default:
		mes "[]";
		mes "ð";
		mes "ʲô";
		mes "ܰæĻ,.";
		close;
	}
	close;
}

function	script	Func_Casing	{

	mes "[]";
	mes "Ҫ.";
	next;
	mes "[]";
	mes "^0000FF" +getitemname(getarg(1))+ "^E40CAA ";
	if(getarg(0) == 13202) 
		mes "Ҫ500Ѫɫӵ";
	else
		mes "ÿҪ ^FF0000" +getitemname(getarg(0))+ "^000000 500";
	mes " 500 zeny.";
	next;
	mes "[]";
	mes "Խ50.";
	mes "ȡ0.";
	next;
	input .@amount;
	mes "[]";
	if(.@amount < 1) {
		mes "ð,";
		mes "ʲô";
		mes "ܰæ,.";
		close;
	}
	if(.@amount > 50)	{
		mes "㳬޶!";
		mes "´?";
		close;
	}
	//Weight checking
	if(checkweight(getarg(1), .@amount) != 1)	{
		mes "㳬.";
		mes "һƷ.";
		close;
	}
	
	//Materials checking
	if(countitem(getarg(0)) < .@amount * 500) {
		mes "......";
		mes "Ĳϲ";
		mes "뽻ƷŶ";
		mes "ȷĽ";
		close;
	}
	
	//Zeny checking
	if(Zeny < .@amount * 500) {
		mes "Ŷ,Ǯ.";
		mes "ȡķΪ 500 zeny";
		mes "Ǯ.";
		close;
	}

	mes "޷ǳ!";
	mes "Ѿȷ!";
	if(getarg(1) < 12149)
		mes "ϸЩ.";
	else
		mes "ϸЩ.";
	set Zeny, Zeny - .@amount * 500;
	delitem getarg(0), .@amount * 500;
	getitem getarg(1), .@amount;
	close;
}
