From 741e6bd65fe1b66c670e41f1dc7a46b83a2caae6 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 29 May 2018 09:25:06 -0300 Subject: Rewrite how Jhedia craft ingots --- npc/003-8/jhedia.txt | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'npc/003-8/jhedia.txt') diff --git a/npc/003-8/jhedia.txt b/npc/003-8/jhedia.txt index 03864ea6c..c1280e368 100644 --- a/npc/003-8/jhedia.txt +++ b/npc/003-8/jhedia.txt @@ -2,30 +2,38 @@ // Author: // Crazyfefe // Saulc -// Note: script works, but one may argue it is not complete +// Jesusalva +// Description: +// Jhedia takes care of Tulimshar forge and makes ingots 003-8,28,30,0 script Jhedia NPC_ELVEN_FEMALE,{ - .Item1 = IronOre; //7 - .Item2 = Coal; //11 - .GP = 8500; - .ItemCreate = IronIngot; - - function iron_create { + // ingot_create( BaseItem, PrizeItem, Amount, Amount_Coal, Price ) + function ingot_create { + .@basei=getarg(0); + .@prize=getarg(1); + .@amoun=getarg(2); + .@coalm=getarg(3); + .@price=getarg(4); speech S_FIRST_BLANK_LINE | S_LAST_NEXT, l("How many ingots do you want to make?"); - input @amount; + input .@amount; + + if (countitem(.@basei) >= .@amount * .@amoun && countitem(Coal) >= .@amount * .@coalm && Zeny >= .@price * .@amount) { + inventoryplace .@prize, .@amount; + delitem .@basei, .@amount * .@amoun; + delitem Coal, .@amount * .@coalm; + Zeny = Zeny - .@amount * .@price; + getitem .@prize, .@amount; - if (countitem("Iron Ore") >= @amount * 7 && countitem("Coal") >= @amount * 11 && Zeny >= 8500 * @amount) - { - delitem .Item1, @amount * 7; - delitem .Item2, @amount * 11; - Zeny = Zeny - @amount * .GP; - getitem .ItemCreate, @amount; + mes ""; + mesn; + mesq l("Many thanks! Come back soon."); close; } + speech S_FIRST_BLANK_LINE,// | S_LAST_NEXT, - l("You don't have enough material."); + l("You don't have enough material, sorry."); close; } @@ -38,8 +46,9 @@ l("Nothing, thanks."), L_Close; L_Iron: + .@price=8500; // Bad, duplicate speech S_FIRST_BLANK_LINE | S_LAST_NEXT, - l("Hello! Do you want to craft @@? For that I will need 7 @@, 11 @@ and @@ gp.", getitemlink(.ItemCreate),getitemlink(.Item1),getitemlink(.Item2),.GP); + l("Hello! Do you want to craft @@? For that I will need 7 @@, 11 @@ and @@ gp.", getitemlink(IronIngot),getitemlink(IronOre),getitemlink(Coal),.@price); //.@karim = getq(Karim_Quest); select @@ -48,7 +57,7 @@ L_Iron: switch (@menu) { case 1: - iron_create; + ingot_create(IronOre, IronIngot, 7, 11, 8500); break; default: goto L_Close; -- cgit v1.2.3-60-g2f50