Fix level calcualtion function
This commit is contained in:
parent
75958ee7d2
commit
9638288381
@ -60,17 +60,18 @@ export class PlayerService
|
|||||||
*/
|
*/
|
||||||
public calculateLevel(pmcData: IPmcData): number
|
public calculateLevel(pmcData: IPmcData): number
|
||||||
{
|
{
|
||||||
let exp = 0;
|
let accExp = 0;
|
||||||
|
|
||||||
for (const level in this.databaseServer.getTables().globals.config.exp.level.exp_table)
|
for (const [level, { exp }] of this.databaseServer.getTables().globals.config.exp.level.exp_table.entries())
|
||||||
{
|
{
|
||||||
if (pmcData.Info.Experience < exp)
|
accExp += exp;
|
||||||
|
|
||||||
|
if (pmcData.Info.Experience < accExp)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmcData.Info.Level = parseInt(level);
|
pmcData.Info.Level = level + 1;
|
||||||
exp += this.databaseServer.getTables().globals.config.exp.level.exp_table[level].exp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pmcData.Info.Level;
|
return pmcData.Info.Level;
|
||||||
|
Loading…
Reference in New Issue
Block a user