玩家经验修改

back_recharge
lvxinran 2021-05-26 16:23:24 +08:00
parent 66d10040d3
commit 1d7e46ee36
3 changed files with 13 additions and 4 deletions

View File

@ -125,6 +125,15 @@ public class MathUtils {
} }
return original; return original;
} }
public static long setBetweenWithMax(long original, long min, long max) {
if (original >= max) {
original = max;
}
if (original < min) {
original = min;
}
return original;
}
public static int getMaxNum(int a, int b) { public static int getMaxNum(int a, int b) {
if(a>=b){ if(a>=b){

View File

@ -42,7 +42,7 @@ public class PlayerManager extends MongoBase {
private int level; private int level;
private int exp; private long exp;
private int vipLevel; private int vipLevel;
@ -204,11 +204,11 @@ public class PlayerManager extends MongoBase {
this.level = level; this.level = level;
} }
public int getExp() { public long getExp() {
return exp; return exp;
} }
public void setExp(int exp) throws Exception { public void setExp(long exp) throws Exception {
updateString("exp", exp); updateString("exp", exp);
this.exp = exp; this.exp = exp;
} }

View File

@ -846,7 +846,7 @@ public class ItemUtil {
if (playerInfoManager.getExp() >= maxExp) { if (playerInfoManager.getExp() >= maxExp) {
return; return;
} }
int curExp = MathUtils.setBetweenWithMax((int)playerInfoManager.getExp() + (int)addExp, 0, maxExp); long curExp = MathUtils.setBetweenWithMax(playerInfoManager.getExp() + addExp, 0, maxExp);
int oldLevel = playerInfoManager.getLevel(); int oldLevel = playerInfoManager.getLevel();
// 当前等级表配置 // 当前等级表配置
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel); SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel);