The only thing I do not know, is whether or not you can retrieve the item attribute... I could not find a function for that.. so I left it at 0...
prt_in,281,138,5 script Suhnbi#cash 85,{
mes "[^ff0000Suhnbi^000000]";
mes "I am the Armsmith";
mes "I can refine all kinds of weapons,";
mes "armor and equipment, so let me";
mes "know what you want to refine.";
next;
setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
set .@menu$,"";
for( set .@i,1; .@i <= 10; set .@i,.@i+1 )
{
if( getequipisequiped(.@i) )
set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
set .@menu$, .@menu$ + ":";
}
set .@part,select(.@menu$);
if( !getequipisequiped(.@part) )
close;
if( !getequipisenableref(.@part) )
{
mes "[^ff0000Suhnbi^000000]";
mes "I don't think I can refine this item at all.";
close;
}
if( !getequipisidentify(.@part) )
{
mes "[^ff0000Suhnbi^000000]";
mes "This has not been identified. So, it can't be refined...";
close;
}
if( getequiprefinerycnt(.@part) >= 10 )
{
mes "[^ff0000Suhnbi^000000]";
mes "This item cannot be refined because it has already reached its maximum level...";
close;
}
// Make sure you have the neccessary items and Zeny to refine your items
// Determines chance of failure and verifies that you want to continue.
switch( getequipweaponlv(.@part) )
{
case 1: callsub S_RefineValidate,1,7620,50,.@part; break;
case 2: callsub S_RefineValidate,2,7620,200,.@part; break;
case 3: callsub S_RefineValidate,3,7620,5000,.@part; break;
case 4: callsub S_RefineValidate,4,7620,20000,.@part; break;
default: callsub S_RefineValidate,0,7619,2000,.@part; break;
}
if( getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100) )
{
mes "[^ff0000Suhnbi^000000]";
mes "Clink! Clank! Clunk!";
SuccessRefItem .@part;
next;
Emotion e_no1;
mes "[^ff0000Suhnbi^000000]";
mes "Here you are! It's done.";
mes "It's been a while since I've made such a fine equipment. You must be happy because it has become stronger!";
close;
}
else
{
// [Z3R0] - Added Item Check and Equipment Malfunctions
// Armor Check & Safeguard from Deletion, -1 From Refine Count (Retain All Cards)
if (.@part <= 2 && .@part >= 5) { // Armor Body Parts (Non Weapons)
if (getequiprefinerycnt(.@part) >= 7) { // Current Refine is 7 or Higher
//FailedRefItem .@part;
// Do Not know if there is an attribute function to get attribute
set .@card[0] = getequipcardid(.@part, 0);
set .@card[1] = getequipcardid(.@part, 1);
set .@card[2] = getequipcardid(.@part, 2);
set .@card[3] = getequipcardid(.@part, 3);
getitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,.@card[0],.@card[1],.@card[2],.@card[3];
}
}
// Weapon Check & Safeguard from Deletion, -1 From Deletion, -1 From Refine Count (Retain All Cards)
if (.@part <= 4 && .@part >= 3) { // Weapons (Right and Left Hand)
if (getequiprefinerycnt(.@part) >= 8) { // Current Refine is 8 or Higher
//FailedRefItem .@part;
// Do Not know if there is an attribute function to get attribute
set .@card[0] = getequipcardid(.@part, 0);
set .@card[1] = getequipcardid(.@part, 1);
set .@card[2] = getequipcardid(.@part, 2);
set .@card[3] = getequipcardid(.@part, 3);
getitem2 getequipid(.@part),1,1,getequiprefinerycnt(.@part) - 1,0,.@card[0],.@card[1],.@card[2],.@card[3];
}
}
mes "[^ff0000Suhnbi^000000]";
mes "Clink! Clank! Clunk!";
//FailedRefItem .@part;
next;
if (rand(5) == 1)
Emotion e_cash;
else
Emotion e_omg;
mes "[^ff0000Suhnbi^000000]";
mes "Cough!!!!";
next;
mes "[^ff0000Suhnbi^000000]";
mes "Cough...Cough..";
mes "What a shame...";
mes "The refining process failed. I had told you earlier this might happen!";
close;
}
S_RefineValidate:
mes "[^ff0000Suhnbi^000000]";
if (getarg(0))
mes "A level " + getarg(0) + " weapon...";
mes "To refine this I need one ^ff9999" + getitemname(getarg(1)) + "^000000 and a service fee of " + getarg(2) + " Zeny.";
mes "Do you wish to continue?";
next;
if( select("Yes:No") == 1 )
{
if( getequippercentrefinery(getarg(3)) < 100 )
{
mes "[^ff0000Suhnbi^000000]";
mes "Wow!!";
mes "This weapon, probably";
mes "looks like it's been refined...";
mes "many times...";
mes "It may break if";
mes "you refine it again.";
next;
mes "[^ff0000Suhnbi^000000]";
mes "But don't worry this is a special case so i will only take the stone if it fails.";
mes " ";
mes "I think we have a fair trade do you still want to continue?";
next;
if( select("Yes:No") == 2 )
{
mes "[^ff0000Suhnbi^000000]";
mes "I completely agree...";
mes "I might be a great refiner, but sometimes even I make mistakes.";
close;
}
}
if( countitem(getarg(1)) > 0 && Zeny > getarg(2) )
{
delitem getarg(1), 1;
set Zeny, Zeny - getarg(2);
return;
}
else
{
mes "[^ff0000Suhnbi^000000]";
mes "You don't seem to have enough Zeny or " + getitemname(getarg(1)) + "...";
mes "Go get some more. I'll be here all day if you need me.";
close;
}
}
else
{
mes "[^ff0000Suhnbi^000000]";
mes "Yeah... There's no need to rush.";
mes "Take your time.";
close;
}
}