From 645955dc68ba01f89d31ee2b40d60074700b883c Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 7 Jun 2019 11:47:09 -0300 Subject: It's officially possible to craft now --- npc/024-16/craftsman.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'npc') 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; -- cgit v1.2.3-60-g2f50