Jump to content
  • 0

Status points lost after relog


Seraph Sephiroth

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  06/12/12
  • Last Seen:  

I've been digging throughout the source for hours, searching the internet for possible hints on how to solve it

but all to no avail. The points get reset to a measily 32767 as soon as a character logs out, and that just won't do.

Is this problem related to packets? Or has the source been changed after all, to disallow a higher value being stored?

All I do know for sure, is that this problem was not always there and I have used an older revision myself that had no

issues with this whatsoever.

Perhaps I am not looking close enough, but I have the sincere feeling looking further in the code won't do me any good either.

I've tried looking up terms using text finders, I've looked at every file that included "status_point", "status point", "ushrt", "unsigned short" and several other variations, tried several adjustments, recompiled, realized it did nothing, and set it all back to the previous values to recompile again.

I am using rAthena Revision 16243.

If anyone can give me a solution on this revision, or commend a higher revision where this problem does not occur

please share your knowledge. It will be greatly appreciated.

Edited by Seraph Sephiroth
Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

In src/common/mmo.h The is a struct called mmo_charstatus which hold the stats of a character.

The variables are signed short, so a maximum of 32767 is just fine.

I did a SVN blame from revision 15000 up to head revision. Those variables weren't touched....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  06/12/12
  • Last Seen:  

I did find that earlier on and tried to alter the code, but that didn't do anything at all.

My current code in mmo.h is the following:

struct mmo_charstatus {

int char_id;

int account_id;

int partner_id;

int father;

int mother;

int child;

unsigned int base_exp,job_exp;

int zeny;

short class_;

unsigned int status_point,skill_point;

int hp,max_hp,sp,max_sp;

unsigned int option;

short manner;

unsigned char karma;

short hair,hair_color,clothes_color;

int party_id,guild_id,pet_id,hom_id,mer_id,ele_id;

int fame;

I am not certain how to read the "short class_;" part,

does this indicate a group altogether? Or is this an individual object?

If the latter is true, my current code seems to assign an unsigned int to the status_point property

yet it is not being read by my server.

My SQL database had the value set to unsigned int as well, by default.

I have tried to change my current code to this:

struct mmo_charstatus {

int char_id;

int account_id;

int partner_id;

int father;

int mother;

int child;

unsigned int status_point;

unsigned int base_exp,job_exp;

int zeny;

short class_;

unsigned int skill_point;

int hp,max_hp,sp,max_sp;

unsigned int option;

short manner;

unsigned char karma;

short hair,hair_color,clothes_color;

int party_id,guild_id,pet_id,hom_id,mer_id,ele_id;

int fame;

And ofcourse, recompiled. But that didn't seem to do anything either.

What's also pretty odd, is that HP and SP values are also stored in that same list but I am able

to push those values very high up. I have no issues concerning integers with my current max

HP setting (75.000.000), although I did have to alter the assigned integer for that as well, it

does obey my custom setting there.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

I am not certain how to read the "short class_;" part,

does this indicate a group altogether? Or is this an individual object?

short class_; declares a variable calles class_ with data type short.

short is alike int but with a smaller range. (CLICK)

And about the problem itself:

Maybe I misunderstood you. Are you talking about the stat points that are used to raise stats or about the amount of STR/AGI/VIT/etc?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  06/12/12
  • Last Seen:  

I am talking about the variable "status_point".

This is used to store points used in upgrading your character stats (str,agi,dex,vit,luk).

I was able to find an influencing factor in clif.c on this.

When you go to the line "WBUFW(buf,2)=min(sd->status.status_point, INT16_MAX);"

you can affect the method status_point is stored to the server, however..

No matter what I try to replace it with, it either stores the value as "-1" or in the range of "-28000 / -29000"

with a test character leveled to 1000. Unless I use a smaller integer to store the value, such as UINT8_MAX

I believe it will then obey neatly and store a maximum value of "255".

It appears as if I am simply not permitted somehow to store a value exceeding UINT16_MAX,

anything higher then that will just act as if the integer is not unsigned.

My SQL database stores the correct value, but it won't load back up.

What does send the stat_point value back to what it really should be for a character, is gain/lose one or more base levels.

That made me ponder on a possible fix through a script that would automatically de-level and re-level any character

that logs on, to "fix" this value with a workaround.

But ofcourse I'd much rather have this issue fixed the normal and clean way.

Edited by Seraph Sephiroth
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  06/12/12
  • Last Seen:  

*knock knock*

Hello? /whisp

Is there no one that knows why the integer is not functioning correctly when set to anything higher then UINT16_MAX?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...