From df6803fa128e0ca8bafb24ac6fc2ba668c4fe23b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Jul 2018 18:32:22 -0300 Subject: Repairman NPC, and bug fixes. --- npc/functions/refine.txt | 50 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'npc') diff --git a/npc/functions/refine.txt b/npc/functions/refine.txt index eefcc478f..a48c13e9c 100644 --- a/npc/functions/refine.txt +++ b/npc/functions/refine.txt @@ -4,7 +4,7 @@ // Pyndragon (inspiration) // Scall (inspiration) // Description: -// Refine functions +// Refine functions. Includes equipment repair. In future use getequippercentrefinery(.@it, REFINE_CHANCE_TYPE_ENRICHED) too // (No arguments) function script refineMaster { @@ -88,7 +88,7 @@ function script refineMaster { } mesn; mesq l("This @@ is a nice stuff. I can refine it for @@ GP and @@ @@.", getitemlink(.@item), .@price, .@amount, getitemlink(.@rg)); - mesc l("Success ratio is of aprox. @@ %%" % (100-(.@rlv*10))); + mesc l("Success ratio is of aprox. @@ %%", (100-(.@rlv*10))+rand(-6,6)); next; if (askyesno() != ASK_YES) close; @@ -174,3 +174,49 @@ function script refineMaster { return; } + +// (No arguments) +function script repairMaster { + mesn; + mesq l("I am a really good blacksmith. In fact, there is no stuff I can't fix."); + next; + mesn; + if (getbrokenid(1) == 0) { + mesq l("I don't think you have any broken item, but if a friend of mine break your stuff, come talk to me!"); + close; + } else { + // Print the name of the first broken item + mesq l("You seem to have @@ broken items and... Oh, I see you have a broken @@ here! I wanna repair it!", getbrokencount(), getitemname(getbrokenid(1))); + .@save=getbrokenid(1); + next; + } + .@price=getiteminfo(getbrokenid(1), ITEMINFO_SELLPRICE)+getiteminfo(getbrokenid(1), ITEMINFO_ELV)-(getbrokencount()*15); + if (.@price < 100) + .@price=100; + mesn; + mesq l("I can refine this for you. Just pay me @@ GP and a @@. It'll take no time at all!", .@price, getitemlink(IronIngot)); + next; + if (askyesno() != ASK_YES || Zeny < .@price) { + mes ""; + mesn; + mesq l("Ahh, that's a pity... Well, just talk to me with enough money and I'll gladly fix that for you! %%0"); + close; + } + // Cheating? Well, let's try to be innovative this time + if (.@save != getbrokenid(1)) { + mesn; + mesq l("Ah...! POLICE! POLICE! Quick, send this cheating thief to jail!!"); + atcommand "@jail "+strcharinfo(0); + close; + } + Zeny=Zeny-.@price; + repair(1); + mesn; + mesq l("Here, sparking new! Nice!!"); + if (getbrokencount() > 0) { + next; + return; + } else { + close; + } +} -- cgit v1.2.3-70-g09d2