Simplify sp saving
This commit is contained in:
@@ -39,7 +39,7 @@ public abstract class AbstractCharacterObject extends AbstractAnimatedMapObject
|
|||||||
protected MapleMap map;
|
protected MapleMap map;
|
||||||
protected int str, dex, luk, int_, hp, maxhp, mp, maxmp;
|
protected int str, dex, luk, int_, hp, maxhp, mp, maxmp;
|
||||||
protected int hpMpApUsed, remainingAp;
|
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 transient int clientmaxhp, clientmaxmp, localmaxhp = 50, localmaxmp = 5;
|
||||||
protected float transienthp = Float.NEGATIVE_INFINITY, transientmp = Float.NEGATIVE_INFINITY;
|
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(10, stats.mp());
|
||||||
ps.setInt(11, stats.maxHp());
|
ps.setInt(11, stats.maxHp());
|
||||||
ps.setInt(12, stats.maxMp());
|
ps.setInt(12, stats.maxMp());
|
||||||
ps.setString(13, stats.sp());
|
ps.setString(13, String.valueOf(stats.sp()));
|
||||||
ps.setInt(14, stats.ap());
|
ps.setInt(14, stats.ap());
|
||||||
ps.setInt(15, stats.gmLevel());
|
ps.setInt(15, stats.gmLevel());
|
||||||
ps.setInt(16, stats.skin());
|
ps.setInt(16, stats.skin());
|
||||||
@@ -8566,15 +8566,8 @@ public class Character extends AbstractCharacterObject {
|
|||||||
.mp(mp)
|
.mp(mp)
|
||||||
.maxHp(maxhp)
|
.maxHp(maxhp)
|
||||||
.maxMp(maxmp)
|
.maxMp(maxmp)
|
||||||
.ap(remainingAp);
|
.ap(remainingAp)
|
||||||
|
.sp(remainingSp[0]);
|
||||||
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));
|
|
||||||
} finally {
|
} finally {
|
||||||
statWlock.unlock();
|
statWlock.unlock();
|
||||||
effLock.unlock();
|
effLock.unlock();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public record CharacterStats(
|
|||||||
int mp,
|
int mp,
|
||||||
int maxHp,
|
int maxHp,
|
||||||
int maxMp,
|
int maxMp,
|
||||||
String sp,
|
int sp,
|
||||||
int ap,
|
int ap,
|
||||||
int gmLevel,
|
int gmLevel,
|
||||||
int skin,
|
int skin,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class CharacterRepository {
|
|||||||
.bind("max_hp", stats.maxHp())
|
.bind("max_hp", stats.maxHp())
|
||||||
.bind("max_mp", stats.maxMp())
|
.bind("max_mp", stats.maxMp())
|
||||||
.bind("ap", stats.ap())
|
.bind("ap", stats.ap())
|
||||||
.bind("sp", parseSp(stats.sp()))
|
.bind("sp", stats.sp())
|
||||||
.bind("job", stats.job())
|
.bind("job", stats.job())
|
||||||
.bind("fame", stats.fame())
|
.bind("fame", stats.fame())
|
||||||
.bind("gender", stats.gender())
|
.bind("gender", stats.gender())
|
||||||
@@ -88,7 +88,7 @@ public class CharacterRepository {
|
|||||||
.bind("max_hp", stats.maxHp())
|
.bind("max_hp", stats.maxHp())
|
||||||
.bind("max_mp", stats.maxMp())
|
.bind("max_mp", stats.maxMp())
|
||||||
.bind("ap", stats.ap())
|
.bind("ap", stats.ap())
|
||||||
.bind("sp", parseSp(stats.sp()))
|
.bind("sp", stats.sp())
|
||||||
.bind("job", stats.job())
|
.bind("job", stats.job())
|
||||||
.bind("fame", stats.fame())
|
.bind("fame", stats.fame())
|
||||||
.bind("gender", stats.gender())
|
.bind("gender", stats.gender())
|
||||||
@@ -136,17 +136,4 @@ public class CharacterRepository {
|
|||||||
|
|
||||||
return updatedRows > 0;
|
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