diff options
-rw-r--r-- | npc/024-16/craftsman.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/npc/024-16/craftsman.txt b/npc/024-16/craftsman.txt index 3f8ba548a..d3e14ab81 100644 --- a/npc/024-16/craftsman.txt +++ b/npc/024-16/craftsman.txt @@ -7,6 +7,7 @@ 024-16,27,42,0 script Dwarf Craftsmaster NPC_DWARF_CRAFTMASTER,{ function calcRequisites; function calcPrices; + function calcUpgrade; if (.@q < 13) { hello; end; @@ -26,8 +27,25 @@ mesc l("Money: @@ GP", format_number(Zeny)), 3; mes ""; select + rif(!CRAFTING_SCORE, l("How can I complete a craft?")), rif(calcRequisites(), l("Learn crafting for @@ GP", format_number(calcPrices())) ), l("Nothing for now, thanks."); + mes ""; + switch (@menu) { + case 1: + mesn; + mesq l("I dunno."); + break; + case 2: + if (calcUpgrade()) { + mesn; + mesq l("There you go. Craft hard, mwhahahahaha!"); + } else { + mesn; + mesq l("You don't have met all requisites, like money and successful crafts."); + } + break; + } close; // Calc successful crafts required to learn crafting @@ -74,6 +92,21 @@ function calcPrices { return false; } +// calcUpgrade() returns true if skill +// can be leveled up. And levels it up. +function calcUpgrade { + .@gp=calcPrices(); + .@cf=calcRequisites(); + if (Zeny < .@gp) + return false; + if (CRAFTING_SCORE < .@cf) + return false; + + Zeny-=.@gp; + skill TMW2_CRAFT, getskilllv(TMW2_CRAFT)+1, 0; + return true; +} + OnInit: .distance=5; end; |