diff options
Diffstat (limited to 'npc/017-4')
-rw-r--r-- | npc/017-4/pihro.txt | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/npc/017-4/pihro.txt b/npc/017-4/pihro.txt index bc6f38999..ab9b29b51 100644 --- a/npc/017-4/pihro.txt +++ b/npc/017-4/pihro.txt @@ -5,6 +5,87 @@ // Description: // Forge bullets 017-4,35,35,0 script Pihro NPC_PLAYER,{ + // cond_check(ItemID, ItemAmount) + // Returns 1 if ID is zero + function cond_check { + if (getarg(0) == 0) + return 1; + else + return (countitem(getarg(0)) > getarg(1)); + } + + // craft_ammo( PrizeItem, Price, Lead Amount, {Elemental Item, Amount, {Elemental Item2, Amount2}} ) + function craft_ammo { + .@prize=getarg(0); + .@price=getarg(1); + .@base1=LeadIngot; + .@amon1=getarg(2); + .@base2=getarg(2,0); + .@amon2=getarg(3,0); + .@base3=getarg(4,0); + .@amon3=getarg(5,0); + + mesn; + mesq l("Do you want to craft @@? For that I will need:", getitemlink(.@prize)); + mesc l("@@/@@ @@", countitem(.@base1), .@amon1, getitemlink(.@base1)); + if (.@amon2 > 0) + mesc l("@@/@@ @@", countitem(.@base2), .@amon2, getitemlink(.@base2)); + if (.@amon3 > 0) + mesc l("@@/@@ @@", countitem(.@base3), .@amon3, getitemlink(.@base3)); + mesc l("@@/@@ GP", format_number(Zeny), .@price); + next; + + select + l("Yes"), + l("No"); + + if (@menu == 2) + return; + + if (countitem(.@base1) >= .@amon1 && + cond_check(.@base2, .@amon2) && + cond_check(.@base3, .@amon3) && + Zeny >= .@price) { + inventoryplace .@prize, 220; + delitem .@base1, .@amon1; + delitem .@base2, .@amon2; + delitem .@base3, .@amon3; + Zeny = Zeny - .@price; + getitem .@prize, rand(100,220); + + mes ""; + mesn; + mesq l("Many thanks! Come back soon."); + } else { + speech S_FIRST_BLANK_LINE,// | S_LAST_NEXT, + l("You don't have enough material, sorry."); + } + return; + } + mesn; + mesq l("Hello there! I make bullets for the weapons my friend Pyndragon makes."); + next; + +L_Craft: + mesn; + mesq l("Some bullets have Elemental Properties, by the way. Now, what will it be?"); + next; + select + l("Nothing, sorry."), + l("Normal Bullet"), + l("Sacred Bullet"); + + switch (@menu) { + case 2: + // craft_ammo( PrizeItem, Price, Lead Amount, {Elemental Item, Amount, {Elemental Item2, Amount2}} ) + craft_ammo(Bullet, 200, 1); + goto L_Craft; + case 3: + craft_ammo(SacredBullet, 200, 1, WhiteFur, 5); + goto L_Craft; + } + close; + OnInit: .@npcId = getnpcid(0, .name$); |