diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 6 | ||||
-rw-r--r-- | src/map/pc.c | 27 | ||||
-rw-r--r-- | src/map/pc.h | 1 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 459a6a734..e58f07880 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1751,8 +1751,8 @@ ACMD_FUNC(baselevelup) } // End Addition if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow level = pc_maxbaselv(sd) - sd->status.base_level; - for (i = 1; i <= level; i++) - status_point += (sd->status.base_level + i + 14) / 5; + for (i = 0; i < level; i++) + status_point += pc_gets_status_point(sd->status.base_level + i); sd->status.status_point += status_point; sd->status.base_level += (unsigned int)level; @@ -1768,7 +1768,7 @@ ACMD_FUNC(baselevelup) if ((unsigned int)level >= sd->status.base_level) level = sd->status.base_level-1; for (i = 0; i > -level; i--) - status_point += (sd->status.base_level + i + 14) / 5; + status_point += pc_gets_status_point(sd->status.base_level + i - 1); if (sd->status.status_point < status_point) pc_resetstate(sd); if (sd->status.status_point < status_point) diff --git a/src/map/pc.c b/src/map/pc.c index 359769833..976d1e488 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4857,13 +4857,8 @@ int pc_checkbaselevelup(struct map_session_data *sd) if(!battle_config.multi_level_up && sd->status.base_exp > next-1) sd->status.base_exp = next-1; + next = pc_gets_status_point(sd->status.base_level); sd->status.base_level ++; - - if (battle_config.use_statpoint_table) - next = statp[sd->status.base_level] - statp[sd->status.base_level-1]; - else //Estimated way. - next = (sd->status.base_level+14) / 5 ; - sd->status.status_point += next; } while ((next=pc_nextbaseexp(sd)) > 0 && sd->status.base_exp >= next); @@ -5134,6 +5129,15 @@ static int pc_setstat(struct map_session_data* sd, int type, int val) return val; } +// Calculates the number of status points PC gets when leveling up (from level to level+1) +int pc_gets_status_point(int level) +{ + if (battle_config.use_statpoint_table) //Use values from "db/statpoint.txt" + return (statp[level+1] - statp[level]); + else //Default increase + return ((level+15) / 5); +} + /// Returns the number of stat points needed to change the specified stat by val. /// If val is negative, returns the number of stat points that would be needed to /// raise the specified stat from (current value - val) to current value. @@ -6072,8 +6076,8 @@ int pc_setparam(struct map_session_data *sd,int type,int val) val = pc_maxbaselv(sd); if ((unsigned int)val > sd->status.base_level) { int stat=0; - for (i = 1; i <= (int)((unsigned int)val - sd->status.base_level); i++) - stat += (sd->status.base_level + i + 14) / 5 ; + for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++) + stat += pc_gets_status_point(sd->status.base_level + i); sd->status.status_point += stat; } sd->status.base_level = (unsigned int)val; @@ -8074,7 +8078,7 @@ int pc_readdb(void) sprintf(line, "%s/statpoint.txt", db_path); fp=fopen(line,"r"); if(fp == NULL){ - ShowStatus("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line); + ShowWarning("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line); //return 1; } else { while(fgets(line, sizeof(line), fp)) @@ -8093,9 +8097,12 @@ int pc_readdb(void) ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","statpoint.txt"); } // generate the remaining parts of the db if necessary + k = battle_config.use_statpoint_table; //save setting + battle_config.use_statpoint_table = 0; //temporarily disable to force pc_gets_status_point use default values statp[0] = 45; // seed value for (; i <= MAX_LEVEL; i++) - statp[i] = statp[i-1] + (i-1+15)/5; + statp[i] = statp[i-1] + pc_gets_status_point(i-1); + battle_config.use_statpoint_table = k; //restore setting return 0; } diff --git a/src/map/pc.h b/src/map/pc.h index e37e02e59..ca4f671a4 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -649,6 +649,7 @@ unsigned int pc_nextbaseexp(struct map_session_data *); unsigned int pc_thisbaseexp(struct map_session_data *); unsigned int pc_nextjobexp(struct map_session_data *); unsigned int pc_thisjobexp(struct map_session_data *); +int pc_gets_status_point(int); int pc_need_status_point(struct map_session_data *,int,int); int pc_statusup(struct map_session_data*,int); int pc_statusup2(struct map_session_data*,int,int); |