You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
5.7 KiB
Plaintext

//===== rAthena Script =======================================
//= Shadow Blacksmith
//===== Description: =========================================
//= [Official Conversion]
//= Shadow equipments refining NPC.
//===== Changelog: ===========================================
//= 1.0 First version [Aleos]
//= 1.1 Removed re-roll behavior and fetch materials from db
//= [Secret]
//= 1.2 Added Refine UI [Atemo, Lemongrass]
//= 1.3 Moved to Cash Mall [Lemongrass]
//============================================================
- script ::ShadowBlacksmith -1,{
if( getbattleflag( "feature.refineui" ) ){
mes "[Shadow Blacksmith]";
mes "Now Basta is in charge of refinement for shadow items.";
mes "If you'd like to refine a shadow item, please visit him.";
close;
}
.@zeny_cost = 200000; // Zeny cost is 200,000 according to official script [Secret]
disable_items;
mes "[Shadow Blacksmith]";
mes "Do you want to refine a shadow item? Pick yer poison!";
next;
setarray .@indices[1], EQI_SHADOW_ARMOR, EQI_SHADOW_WEAPON, EQI_SHADOW_SHIELD, EQI_SHADOW_SHOES, EQI_SHADOW_ACC_R, EQI_SHADOW_ACC_L;
.@indlen = getarraysize(.@indices) - 1;
for(.@i = 1; .@i <= .@indlen; .@i++)
.@menu$ = .@menu$ + (getequipisequiped(.@indices[.@i]) ? getequipname(.@indices[.@i]) : F_getpositionname(.@indices[.@i]) +"-[Not equipped]") +":";
.@menu$ = .@menu$ + "Refine info";
.@choice = select(.@menu$);
if (.@choice == .@indlen + 1) { // Refine info
mes "[Shadow Blacksmith]";
mes "When a shadow item is refined, it gains extra bonuses very much like normal items.";
next;
mes "[Shadow Blacksmith]";
mes "Weapon: ATK, MATK + 1 increase for each +1 refine success.";
mes "Etc: HP + 10 increase for each +1 refine success.";
next;
mes "[Shadow Blacksmith]";
mes "All types of Oridecon and Elunium can be used to refine shadow items. Each attempt will also cost 20,000 zeny.";
next;
mes "[Shadow Blacksmith]";
mes "HD ores can be used for gear that is at least refine level +7 and will prevent breaking as long as you stay talking to me.";
close;
}
.@part = .@indices[.@choice];
if (!getequipisequiped(.@part)) {
mes "[Shadow Blacksmith]";
mes "There's nothing here!";
close;
}
.@equip_id = getequipid(.@part);
setarray .@card[0], getequipcardid(.@part,0), getequipcardid(.@part,1), getequipcardid(.@part,2), getequipcardid(.@part,3);
while(1) {
.@equip_refine = getequiprefinerycnt(.@part);
mes "[Shadow Blacksmith]";
mes "I require " + callfunc("F_InsertComma", .@zeny_cost) + " zeny as a fee for EACH refine attempt.";
mes "Choose your Ore and start refining.";
next;
.@material[0] = getequiprefinecost(.@part, REFINE_COST_NORMAL, REFINE_MATERIAL_ID);
.@material[1] = getequiprefinecost(.@part, REFINE_COST_ENRICHED, REFINE_MATERIAL_ID);
.@material[2] = getequiprefinecost(.@part, REFINE_COST_HD, REFINE_MATERIAL_ID);
.@is_enriched = false;
if (countitem(.@material[0]))
.@mate$[0] = getitemname(.@material[0]);
else
.@mate$[0] = "^8C8C8C"+ getitemname(.@material[0]) +"^000000";
if (countitem(.@material[1]))
.@mate$[1] = getitemname(.@material[1]);
else
.@mate$[1] = "^8C8C8C"+ getitemname(.@material[1]) +"^000000";
if (.@equip_refine > 6 && countitem(.@material[2]))
.@mate$[2] = getitemname(.@material[2]);
else
.@mate$[2] = "^8C8C8C"+ getitemname(.@material[2]) +"^000000";
switch( select( .@mate$[0], .@mate$[1], .@mate$[2], "Cancel" ) ) {
case 1:// NORMAL
.@choose = .@material[0];
break;
case 2:// ENRICHED
.@is_enriched = true;
.@choose = .@material[1];
break;
case 3:// HD
if (.@equip_refine < 7) {
mes "[Shadow Blacksmith]";
mes "HD Ore can only used for +7 or higher refine level items.";
close;
}
.@hoihoi = 1;
.@choose = .@material[2];
break;
case 4:
mes "[Shadow Blacksmith]";
mes "You've cancelled refining.";
close;
}
if (!countitem(.@choose)) {
mes "[Shadow Blacksmith]";
mes "You do not have enough "+ getitemname(.@choose) +".";
close;
}
if (Zeny < .@zeny_cost) {
mes "[Shadow Blacksmith]";
mes "You do not have enough zeny.";
close;
}
if (.@equip_refine > 9) {
mes "[Shadow Blacksmith]";
mes "Shadow Equipment can be refined to the maximum of 10...";
close;
}
if (!getequipisenableref(.@part)) {
mes "[Shadow Blacksmith]";
mes "This item cannot be refined.";
close;
}
if (getequippercentrefinery(.@part) < 100) {
mes "[Shadow Blacksmith]";
mes "The safety refine level for Shadow Equipment is +4.";
if (!.@hoihoi)
mes "Shadow equipment may be destroyed in subsequent refinements. Want to get started?";
else
mes "The next refinement, if it fails, will degrade the refinement. Do you want to refine?";
next;
if (select("Proceed","Cancel") == 2) {
mes "[Shadow Blacksmith]";
mes "Heh, I knew it!";
close;
}
}
mes "[Shadow Blacksmith]";
mes "Well then.. here goes nothing!";
next;
delitem .@choose,1;
Zeny -= .@zeny_cost;
// anti-hack
if (callfunc("F_IsEquipIDHack", .@part, .@equip_id) || callfunc("F_IsEquipCardHack", .@part, .@card[0], .@card[1], .@card[2], .@card[3]) || callfunc("F_IsEquipRefineHack", .@part, .@equip_refine))
close;
if (getequippercentrefinery(.@part, .@is_enriched) > rand(100)) {
successrefitem .@part;
mes "[Shadow Blacksmith]";
mes "It worked! It worked!";
next;
} else {
if (.@hoihoi)
downrefitem .@part;
else
failedrefitem .@part;
mes "[Shadow Blacksmith]";
mes "Oh Odin No!";
close;
}
}
}
//moc_paraup,45,185,5 duplicate(ShadowBlacksmith) Shadow Blacksmith#eden1 4_F_JOB_BLACKSMITH // Commented out until it's added to the map index
//prt_in,61,54,3 duplicate(ShadowBlacksmith) Shadow Blacksmith#itemmall 4_F_JOB_BLACKSMITH
itemmall,31,76,3 duplicate(ShadowBlacksmith) Shadow Blacksmith#itemmall 4_F_JOB_BLACKSMITH