EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Linux Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=588)
-   -   Bad LDON bug (https://www.eqemulator.org/forums/showthread.php?t=33667)

KingMort 06-01-2011 02:47 AM

Bad LDON bug
 
Well had to sell stuff and zone over and over until I could basically figure out what was going on here but essentially LDON points are resetting to ZERO after it reaches between 65,450 and 65,604 the exact number would be 65535 where it breaks. Is that the Cap for LDOn points now or something..

Anyway I Sold items all the way up until i had 65,450, zoned around a few times, checked merchant everything was fine, then when i sold another item and my points jumped to 65,604 I then zoned and after I zoned and clicked the LDON merchant there was yellow text on the chat window that said.

"You have spent 65604 Adventure points." <----Exactly like that

After checking merchant I did confirm that I had ZERO points .. Anyway does anyone know about this or have a fix for this perhaps ? Not sure if it was a Linux Related issue or whatever that's why I posted it here.

Let me know and thank you folks in advance !

Morty

trevius 06-01-2011 04:10 AM

Sounds like an int16 issue, but all of the structs and stuff I just checked all showed as int32 which allows for much higher numbers than 65k. Maybe there is a function somewhere that uses int16 instead of int32, but I didn't see it in the brief review that I did. Either that, or maybe the client can't handle more than 65kish due to the same issue, but hard coded into the client. Have you tried checking the point value with a quest command to verify it matches the message you are seeing in the client?

Leere 06-01-2011 04:41 AM

zone\client_packet.cpp, starting line 8303 (part of Client::FinishConnState2(...))

Code:

    //validate adventure points, this cap is arbitrary
    if(m_pp.ldon_points_guk < 0 || m_pp.ldon_points_guk > 0xFFFF) m_pp.ldon_points_guk = 0;
    if(m_pp.ldon_points_mir < 0 || m_pp.ldon_points_mir > 0xFFFF) m_pp.ldon_points_mir = 0;
    if(m_pp.ldon_points_mmc < 0 || m_pp.ldon_points_mmc > 0xFFFF) m_pp.ldon_points_mmc = 0;
    if(m_pp.ldon_points_ruj < 0 || m_pp.ldon_points_ruj > 0xFFFF) m_pp.ldon_points_ruj = 0;
    if(m_pp.ldon_points_tak < 0 || m_pp.ldon_points_tak > 0xFFFF) m_pp.ldon_points_tak = 0;
    if(m_pp.ldon_points_available < 0 || m_pp.ldon_points_available > 0xFFFF) m_pp.ldon_points_available = 0;

Comment says arbitrary, and 0xffff is 65535.

As an aside, there's also an automatic skillup for swimming to 100 just below that.

KingMort 06-01-2011 04:57 AM

So like if i set it to 0XA0000 or 655,350 , would that work or ? btw does OXA0000= 655,350 or am I wrong ? lol

lerxst2112 06-01-2011 05:47 AM

It really depends on what you wish to achieve. Yes, you can set it to a larger arbitrary number, or you can just remove the second check completely and let it roll over to a negative number past 0x7FFFFFFF where it will get set to 0 by the first check.

If the reason for the original check was to keep it 5 digits so it will fit in the UI then setting it to 0 for negative numbers and 99999 for anything higher than 99999 seems like a better solution. You can use plain integer numbers for the check, you don't need to convert it to hex.

0xA0000 = 655360 btw.

KingMort 06-01-2011 06:05 AM

So this should work right? If so is this the only place I have to do this or is there other files I need to change :

Code:

        //validate adventure points, this cap is arbitrary
        if(m_pp.ldon_points_guk < 0 || m_pp.ldon_points_guk > 0xFFFFFFFF) m_pp.ldon_points_guk = 0;
        if(m_pp.ldon_points_mir < 0 || m_pp.ldon_points_mir > 0xFFFFFFFF) m_pp.ldon_points_mir = 0;
        if(m_pp.ldon_points_mmc < 0 || m_pp.ldon_points_mmc > 0xFFFFFFFF) m_pp.ldon_points_mmc = 0;
        if(m_pp.ldon_points_ruj < 0 || m_pp.ldon_points_ruj > 0xFFFFFFFF) m_pp.ldon_points_ruj = 0;
        if(m_pp.ldon_points_tak < 0 || m_pp.ldon_points_tak > 0xFFFFFFFF) m_pp.ldon_points_tak = 0;
        if(m_pp.ldon_points_available < 0 || m_pp.ldon_points_available > 0xFFFFFFFF) m_pp.ldon_points_available = 0;


lerxst2112 06-01-2011 06:49 AM

That may "work", but it isn't correct. The type of those variables is sint32, so they can never be larger than 0x7FFFFFFF and the second check is meaningless.

Do you really expect someone to accumulate over 2 billion points? If they somehow do that, do you want them to lose them all when they accumulate too many?

If it was me, I'd prefer capping the points rather than setting them to 0.

Something like this and adjusting the number to be the maximum you want them to have saved or to fit the UI:
Code:

if(m_pp.ldon_points_guk < 0) m_pp.ldon_points_guk = 0;
if(m_pp.ldon_points_guk > 999999) m_pp.ldon_points_guk = 999999;

That is the only place you would need to make this particular change as far as I can see, but you would need to test with numbers approaching and exceeding whatever limit you decide on to see if there are any other issues.

image 06-01-2011 07:22 AM

From the looks of things whoever coded this was afraid that the points would be skewed so bad (how?) that the numbers would go wack either in the negative or high positive... I think thats why these checks were there. Are they relevant anymore? I would hope not.

Caryatis 06-01-2011 01:06 PM

Another issue that had you searched your own posts or checked your old code ,would have been fixed(ie it was fixed by somebody else a long time ago, which you promptly forgot about).

ojamajoe 06-01-2011 05:15 PM

Quote:

As an aside, there's also an automatic skillup for swimming to 100 just below that.
Sweet! I've been looking for that for a while...

KingMort 06-02-2011 06:27 PM

Alright so yeah will set it up like this then..

Quote:

//validate adventure points, this cap is arbitrary
if(m_pp.ldon_points_guk < 0 || m_pp.ldon_points_guk > 9999999) m_pp.ldon_points_guk = 0;
if(m_pp.ldon_points_mir < 0 || m_pp.ldon_points_mir > 9999999) m_pp.ldon_points_mir = 0;
if(m_pp.ldon_points_mmc < 0 || m_pp.ldon_points_mmc > 9999999) m_pp.ldon_points_mmc = 0;
if(m_pp.ldon_points_ruj < 0 || m_pp.ldon_points_ruj > 9999999) m_pp.ldon_points_ruj = 0;
if(m_pp.ldon_points_tak < 0 || m_pp.ldon_points_tak > 9999999) m_pp.ldon_points_tak = 0;
if(m_pp.ldon_points_available < 0 || m_pp.ldon_points_available > 9999999) m_pp.ldon_points_available = 0;

PS: Carytalis , quit de-railing and trolling my posts, it's against the Geneva Convention


All times are GMT -4. The time now is 06:56 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.