atomizer / muledump

all your mules are belong to you
84 stars 144 forks source link

Doesnt load multiple characters #120

Closed toddw123 closed 7 years ago

toddw123 commented 7 years ago

I know most mule accounts arent going to have more then 1 character, but i also like to have my main account in muledump so i can do 1 click login with it. I noticed that muledump wasnt showing more then 1 character at a time, i managed to get a fix for that in place pretty easily.

in the file lib/mule.js, change lines 375-377 to this:

if (d.Char) { // stupid array/object detection
        if (!d.Char.length) {
            carr[0] = [d.Char][0];
            var i = 0;
            while( typeof [d.Char][0][i] === 'object' ) {
                carr[(i+1)] = [d.Char][0][i];
                delete carr[0][i];
                i++;
            }
        } else {
            carr[0] = d.Char;
            var i = 0;
            while( typeof d.Char[i] === 'object' ) {
                carr[(i+1)] = d.Char[i];
                delete carr[0][i];
                i++;
            }
        }
    }

That will fix the way the array is set up and make it show all characters.

Nightfirecat commented 7 years ago

A bit of nitpick here, but it seems like the loop is duplicating code here? Why not write it as such:

if (d.Char) { // stupid array/object detection
    if (!d.Char.length) {
        carr[0] = [d.Char][0];
    } else {
        carr[0] = d.Char;
    }
    var i = 0;
    while( typeof carr[0][i] === 'object' ) {
        carr[(i+1)] = carr[0][i];
        delete carr[0][i];
        i++;
    }
}

Also, I'm not able to reproduce this issue with master's current code...

toddw123 commented 7 years ago

@Nightfirecat ah that is better to do it that way. Good eye. I just threw the code together real quick. What browser are you using by the way? For me, the way the code was structuring the carr array was like so:

Array[1]
   0:Object
      0:Object (second characters data)
      1:Object (3rd characters data)
      (rest of the 1st characters data)

So the length of carr was ALWAYS 1. And that is when the code is just:

        var carr = [];
    if (d.Char) { // stupid array/object detection
        if (!d.Char.length) carr = [d.Char]; else carr = d.Char;
    }

So it might just be my browser (chrome) that is causing the object/array to be formatted that way (maybe?), but yeah for me the way the master code is set up it doesnt show more then just 1 character per account.

Nightfirecat commented 7 years ago

Tested in Firefox originally and I'm seeing the same behavior in Chrome... What's the XML response for your character list when hitting it through the browser/CURL directly?

toddw123 commented 7 years ago

ops didnt meant to hit the "close and comment" button. But anyways, its the same xml as always. Dont really want to post it on here since its my main account. If you are able to see more the 1 character per account then oh well i cant explain why it doesnt for me unless i add the fix i posted.

Nightfirecat commented 7 years ago

Hm... I'll try to debug the code a bit later today and see if I can come up with a good explanation for that.

toddw123 commented 7 years ago

@Nightfirecat What is the array structure of carr for you? As i said the previous comment, the code is structuring everything into carr[0] for me for some reason. So the length is never going to be greater then 1 in that case. I have no idea why.

Nightfirecat commented 7 years ago

At the time of execution (at a line 378 breakpoint), it's an Array[13] for my 13 characters on my main account.