//ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\\
//||----------------------------------------------||\\
//|| Blacksmith NPC                               ||\\
//||----------------------------------------------||\\
//|| Written By: Izkuru                           ||\\
//||             teh_face_x_o@yahoo.com           ||\\
//|| Test With: OmniAthena 962                    ||\\
//||----------------------------------------------||\\
//|| Refinery/Ore script all in one. Since I am   ||\\
//|| lazy, it doesn't have any fails, but it does ||\\
//|| increase the cost [item wise] to upgrade.    ||\\
//|| Uses some global vars for setting prices.    ||\\
//|| Also, specifies accessories and Quest items  ||\\
//|| as different upgrade types. [In order for    ||\\
//|| this to work, you need to set the wlv of the ||\\
//|| accessories to 5 in item_db, and wlv to 6    ||\\
//|| whatever you want to be defined as Quest     ||\\
//|| items.                                       ||\\
//||----------------------------------------------||\\
//|| To install: Place this TXT file anywhere in  ||\\
//|| your Athena scripts folder, and include it   ||\\
//|| in scripts.conf. Then add the following to   ||\\
//|| save/mapreg.txt.                             ||\\
//||----------------------------------------------||\\
//|| $MaxRefine	50                                ||\\
//|| $RefArCost	2000                              ||\\
//|| $RefW1Cost	4000                              ||\\
//|| $RefW2Cost	8000                              ||\\
//|| $RefW3Cost	16000                             ||\\
//|| $RefW4Cost	32000                             ||\\
//|| $RefAccCost	64000                     ||\\
//|| $RefQCost	128000                            ||\\
//||----------------------------------------------||\\
//|| [Those are tabs, btw]                        ||\\
//|| Then, set those values to whatever you want, ||\\
//|| and set the wlv field for any accessories    ||\\
//|| that you want to be upgraded as such to 5.   ||\\
//|| Then, add an item 10500, or change the item  ||\\
//|| id in the script. [10500 is Quest Emperium.. ||\\
//|| Well, it is for me :P]                       ||\\
//||----------------------------------------------||\\
//|| Started on: Jun 23 2004                      ||\\
//|| Last Modified: Jun 23 2004                   ||\\
//||----------------------------------------------||\\
//__________________________________________________\\

prontera.gat,145,198,7	script	Blacksmith	63,{
	mes "[Blacksmith]";
	mes "I am a Blacksmith who has trained in the art of Blacksmithery for almost 50 years.";
	next;
	mes "Over these 50 years, I have aquired the skills it takes to flawlessly [mostly ^_^;] upgrade any piece of armor.";
	next;
	mes "Unlike Hollgrehenn and his associates, I can even upgrade such things as accessories.";
	next;
	mes "So, what do you say? Do you want to upgrade your equipment?";
	mes "I can also refine raw ores.";
	next;
	menu "Refine equipment",L_Ref,"Refine ore",L_Ore,"No",-;
	L_No:
		mes "Well, if that is what you have decided, then so be it.";
		next;
		mes "Come back if you ever want to upgrade your equipment.";
	close;
	L_Yes:
		mes "Well then, what do you want me to take a look at?";
	next;
	menu getequipname(1),L_Slot1,
	     getequipname(2),L_Slot2,
	     getequipname(3),L_Slot3,
	     getequipname(4),L_Slot4,
	     getequipname(5),L_Slot5,
	     getequipname(6),L_Slot6,
	     getequipname(7),L_Slot7,
	     getequipname(8),L_Slot8,
	     getequipname(9),L_Slot9,
	     getequipname(10),L_Slot10,
	     "Cancel",L_No;
L_Slot1:
	set @slot,1;
	if(getequipisequiped(1)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "Pounding your head with my hammer won't make it any better.";
	close;
L_Slot2:
	set @slot,2;
	if(getequipisequiped(2)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "Bashing your body with my hammer will only harm it, not make it stronger.";
	close;
L_Slot3:
	set @slot,3;
	if(getequipisequiped(3)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "I can't make your left hand any stronger than it already is.";
	close;
L_Slot4:
	set @slot,4;
	if(getequipisequiped(4)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "No matter how many times I could try, your right hand will just become more and more useless.";
	close;
L_Slot5:
	set @slot,5;
	if(getequipisequiped(5)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "You don't seem to be wearing a garmet, so why are you asking me to upgrade it?";
	close;
L_Slot6:
	set @slot,6;
	if(getequipisequiped(6)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "If I do that you'll have to rely on a PecoPeco to get around for a while.";
	close;
L_Slot7:
	set @slot,7;
	if(getequipisequiped(7)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "Accessory? What accessory?";
	close;
L_Slot8:
	set @slot,8;
	if(getequipisequiped(8)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "I don't see what you are talking about.";
	close;
L_Slot9:
	set @slot,9;
	if(getequipisequiped(9)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "So you want me to bash in your face?";
	close;
L_Slot10:
	set @slot,10;
	if(getequipisequiped(10)) goto L_Chk1;
		mes "[Blacksmith]";
		mes "So you want me to bust your jaw?";
	close;

L_Chk1:
	if(getequipisidentify(@slot)) goto L_Chk2;
		mes "[Blacksmith]";
		mes "This item isn't even identified. Why do you even have it equiped?";
	close;

L_Chk2:
	set @reflv2,Getequiprefinerycnt(@slot) + 1;
	if(getequiprefinerycnt(@slot) < $MaxRefine) goto L_TypeChk;
		mes "[Blacksmith]";
		mes "I can't refine that item any more.";
	close;

L_TypeChk:
	if(getequipweaponlv(@slot) == 1) goto L_RefW1;
	if(getequipweaponlv(@slot) == 2) goto L_RefW2;
	if(getequipweaponlv(@slot) == 3) goto L_RefW3;
	if(getequipweaponlv(@slot) == 4) goto L_RefW4;
	if(getequipweaponlv(@slot) == 5) goto L_RefAcc;
	if(getequipweaponlv(@slot) == 6) goto L_RefQuest;
		mes "[Blacksmith]";
		mes "You want me to refine a piece of your armor to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Elunium^000000";
		mes "and a service fee of " + $RefArCost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(985) < @reflv2) || (Zeny < $RefArCost)) goto L_Err;
	delitem 985,@reflv2;
	set Zeny,zeny - $RefArCost;		
		goto L_Do_Ref;

L_RefW1:
		mes "[Blacksmith]";
		mes "You want me to upgrade your level 1 weapon to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Phracon^000000";
		mes "and a service fee of " + $RefW1Cost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(1010) < @reflv2) || (Zeny < $RefW1Cost)) goto L_Err;
	delitem 1010,@reflv2;
	set Zeny,zeny - $RefW1Cost;
		goto L_Do_Ref;

L_RefW2:
		mes "[Blacksmith]";
		mes "You want me to upgrade your level 2 weapon to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Emveretarcon^000000";
		mes "and a service fee of " + $RefW2Cost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(1011) < @reflv2) || (Zeny < $RefW2Cost)) goto L_Err;
	delitem 1011,@reflv2;
	set Zeny,zeny - $RefW2Cost;
		goto L_Do_Ref;

L_RefW3:
		mes "[Blacksmith]";
		mes "You want me to upgrade your level 3 weapon to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Oridecon^000000";
		mes "and a service fee of " + $RefW3Cost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(984) < @reflv2) || (Zeny < $RefW3Cost)) goto L_Err;
	delitem 984,@reflv2;
	set Zeny,zeny - $RefW3Cost;
		goto L_Do_Ref;

L_RefW4:
		mes "[Blacksmith]";
		mes "You want me to upgrade your level 4 weapon to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Oridecon^000000";
		mes "and a service fee of " + $RefW4Cost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(984) < @reflv2) || (Zeny < $RefW4Cost)) goto L_Err;
	delitem 984,@reflv2;
	set Zeny,zeny - $RefW4Cost;
		goto L_Do_Ref;

L_RefAcc:
		mes "[Blacksmith]";
		mes "You want me to upgrade your accessory to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Emperium^000000";
		mes "and a service fee of " + $RefAccCost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(714) < @reflv2) || (Zeny < $RefAccCost)) goto L_Err;
	delitem 714,@reflv2;
	set Zeny,zeny - $RefAccCost;
		goto L_Do_Ref;

L_RefQ:
		mes "[Blacksmith]";
		mes "You want me to upgrade your Quest Equipment to level " + @reflv2 + "?";
		mes "To refine that, I'll need:";
		mes @reflv2 + " ^ff9999Emperium^000000 [Will Change later]";
		mes "and a service fee of " + $RefQCost + "z.";
		mes "Do you wish to procede with upgrading your item?";
	next;
	menu "Yes",-,"No",L_No;
	if((countitem(714) < @reflv2) || (Zeny < $RefQCost)) goto L_Err;
	delitem 714,@reflv2;
	set Zeny,zeny - $RefQCost;
		goto L_Do_Ref;

L_Err:
		mes "[Blacksmith]";
		mes "I can't upgrade your equipment for free. Come back when you have what you need.";
	close;

L_Ore_Err:
		mes "[Blacksmith]";
		mes "You don't have enough " + @oreItem$ + " for me to refine into a " + @oreItem2$ + ".";
	close;	
L_Do_Ref:
		mes "[Blacksmith]";
		mes "*Clang! Clang! Clang!!*";
	next;
		mes "[Blacksmith]";
		mes "*Bash!! Smash!! Bash!!*";
	next;
	successrefitem @slot;
		mes "[Blacksmith]";
		mes "Here you are. Come back anytime you need something upgraded.";
	close;

L_Ore:
		mes "[Blacksmith]";
		mes "Here is what I refine:";
		mes "5 ^ff9999Rough Oridecon^000000 to 1 ^ff9999Oridecon^000000";
		mes "5 ^ff9999Rough Elunium^000000 to 1 ^ff9999Elunium^000000";
		mes "5 ^ff9999Emperium^000000 to 1 ^ff9999Quest Emperium^000000";
	next;
		mes "[Blacksmith]";
		mes "So, what do you want me to refine for you?";
		mes "I do this free of charge, after all.";
	next;
	menu "Oridecon",L_Orid,"Elunium",L_Elun,"Quest Emperium",L_QEmp,"Cancel",L_No;

L_Orid:
	set @oreItem$,"Rough Oridecon";
	set @oreItem2$,"Oridecon";
	if((countitem(756) < 5)) goto L_Ore_Err;
	delitem 756,5;
	getitem 984,1;
	goto L_Ore_End;

L_Elun:
	set @oreItem$,"Rough Elunium";
	set @oreItem2$,"Elunium";
	if((countitem(757) < 5)) goto L_Ore_Err;
	delitem 757,5;
	getitem 985,1;
	goto L_Ore_End;

L_QEmp:
	set @oreItem$,"Emperium";
	set @oreItem2$,"Quest Emperium";
	if((countitem(714) < 5)) goto L_Ore_Err;
	delitem 714,5;
	getitem 10500,1;
	goto L_Ore_End;

L_Ore_End:
		mes "[Blacksmith]";
		mes "Here is your " + $oreItem2$ + ". Come back if you need anything else refined.";
	close;	
}

    Source: geocities.com/teh_face_x_o