From 5b6b65083352e559dae4c10878df2aa1732030f5 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 16 Jan 2020 12:40:20 -0300 Subject: Rewrite Bracco mass meltdown --- npc/020-5/bracco.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/npc/020-5/bracco.txt b/npc/020-5/bracco.txt index 5d41dbb30..f9d960fc5 100644 --- a/npc/020-5/bracco.txt +++ b/npc/020-5/bracco.txt @@ -54,14 +54,16 @@ function MassMeltdown { if (getargcount() < 2 || getargcount() % 2 != 0) return Exception("Faulty learning Meltdown command invoked - error"); - if (@indexisbroken) { - mesc l("Wait, if you try to melt more than one item at login, manaplus will get buggy."), 1; - mesc l("Please try again later!"), 1; - close; - } .@id=getarg(0); .@price=getarg(1); + .@total=countitem(.@id); + if (!.@total) { + mesc l("You don't have any %s.", getitemlink(.@id)), 1; + mesc l("Please try again later!"), 1; + next; + return; + } .@price=POL_AdjustPrice(.@price); @@ -75,10 +77,12 @@ delinventorylist(); getinventorylist(); + delitem .@id, .@total; // Delete first, no refunds + for (.@index=0; .@index < @inventorylist_count; .@index++) { .@x=@inventorylist_id[.@index]; if (.@x == getarg(0) && Zeny >= .@price) { - delitemidx .@index, 1; + //delitemidx .@index, 1; POL_PlayerMoney(.@price); // Report it was done mesc l("@@ melt down your @@...", .name$, getitemlink(.@x)); -- cgit v1.2.3-70-g09d2