Issue information

Issue ID
#2245
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 18, 2008 9:00
Last Post
Hercules Elf Bot
Mar 5, 2012 9:08
Confirmation
N/A

Hercules Elf Bot - Sep 18, 2008 9:00

Originally posted by [b]BrianL[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=2245

.../trunk/npc/merchants/refine.txt

The Repairman always thinks you have 1 more broken items than you actually have.
(If none of your equips are broken, the NPC says 1 is broken.
When you have one item broken, it says you have two items broken.)

I think it's because before the 'while' loop, set .@checkitem,1;
That's because getbrokenid() has to start with 1, not 0.
But then in the loop, the counter is also incremented. So since it started out at 1, it will always be 1 extra.


One way to fix: after the while loop, subtract 1 from .@checkitem

(add after line 945)
CODE
        set .@checkitem,1;
        while (1) {
            if (getbrokenid(.@checkitem) == 0) {
                break;
            }
            set .@checkitem,.@checkitem+1;
        }
+        set .@checkitem,.@checkitem-1;


(add after line 980)
CODE
            set .@checkitem2,1;
            while (1) {
                if (getbrokenid(.@checkitem2) == 0) {
                    break;
                }
                set .@checkitem2,.@checkitem2+1;
            }
+            set .@checkitem2,.@checkitem2-1;


This post has been edited by brianlew: Sep 18 2008, 02:12 AM