Simplify sp saving
This commit is contained in:
@@ -39,7 +39,7 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapObject
|
||||
protected MapleMap map;
|
||||
protected int str, dex, luk, int_, hp, maxhp, mp, maxmp;
|
||||
protected int hpMpApUsed, remainingAp;
|
||||
protected int[] remainingSp = new int[10];
|
||||
protected int[] remainingSp = new int[10]; // TODO: change to a simple int. Evan is not in v83, so why support it?
|
||||
protected transient int clientmaxhp, clientmaxmp, localmaxhp = 50, localmaxmp = 5;
|
||||
protected float transienthp = Float.NEGATIVE_INFINITY, transientmp = Float.NEGATIVE_INFINITY;
|
||||
|
||||
|
||||
@@ -8451,7 +8451,7 @@ public class Character extends AbstractCharacterObject {
|
||||
ps.setInt(10, stats.mp());
|
||||
ps.setInt(11, stats.maxHp());
|
||||
ps.setInt(12, stats.maxMp());
|
||||
ps.setString(13, stats.sp());
|
||||
ps.setString(13, String.valueOf(stats.sp()));
|
||||
ps.setInt(14, stats.ap());
|
||||
ps.setInt(15, stats.gmLevel());
|
||||
ps.setInt(16, stats.skin());
|
||||
@@ -8566,15 +8566,8 @@ public class Character extends AbstractCharacterObject {
|
||||
.mp(mp)
|
||||
.maxHp(maxhp)
|
||||
.maxMp(maxmp)
|
||||
.ap(remainingAp);
|
||||
|
||||
StringBuilder sps = new StringBuilder();
|
||||
for (int j : remainingSp) {
|
||||
sps.append(j);
|
||||
sps.append(",");
|
||||
}
|
||||
String sp = sps.toString();
|
||||
builder.sp(sp.substring(0, sp.length() - 1));
|
||||
.ap(remainingAp)
|
||||
.sp(remainingSp[0]);
|
||||
} finally {
|
||||
statWlock.unlock();
|
||||
effLock.unlock();
|
||||
|
||||
@@ -20,7 +20,7 @@ public record CharacterStats(
|
||||
int mp,
|
||||
int maxHp,
|
||||
int maxMp,
|
||||
String sp,
|
||||
int sp,
|
||||
int ap,
|
||||
int gmLevel,
|
||||
int skin,
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CharacterRepository {
|
||||
.bind("max_hp", stats.maxHp())
|
||||
.bind("max_mp", stats.maxMp())
|
||||
.bind("ap", stats.ap())
|
||||
.bind("sp", parseSp(stats.sp()))
|
||||
.bind("sp", stats.sp())
|
||||
.bind("job", stats.job())
|
||||
.bind("fame", stats.fame())
|
||||
.bind("gender", stats.gender())
|
||||
@@ -88,7 +88,7 @@ public class CharacterRepository {
|
||||
.bind("max_hp", stats.maxHp())
|
||||
.bind("max_mp", stats.maxMp())
|
||||
.bind("ap", stats.ap())
|
||||
.bind("sp", parseSp(stats.sp()))
|
||||
.bind("sp", stats.sp())
|
||||
.bind("job", stats.job())
|
||||
.bind("fame", stats.fame())
|
||||
.bind("gender", stats.gender())
|
||||
@@ -136,17 +136,4 @@ public class CharacterRepository {
|
||||
|
||||
return updatedRows > 0;
|
||||
}
|
||||
|
||||
private int parseSp(String sp) {
|
||||
if (sp == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sp.contains(",")) {
|
||||
return Integer.parseInt(sp);
|
||||
}
|
||||
|
||||
// Old multi skillbook sp to support Evan skills. To be changed - sp will be simple integer in new db.
|
||||
return Integer.parseInt(sp.split(",")[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user