
Originally Posted by
Fraysa
I suppose. I suggest iterating over all the skills that the character has, because going through all the available skills is just waste of time.
you mean check for job and use changeSkillLevel for each skill invidually?
uhh i'm getting the "Something went wrong" so.. what could be the problem?x:
- - - Updated - - -
Hello again,
I'm getting a weird problem now.
PHP Code:
public void spReset() {
try { // sums up all the skill points
int cnt = 0;
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT sum(skilllevel) FROM skills WHERE characterid = " + getId() + "");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
cnt = rs.getInt(1);
cnt += cnt;
}
gainRemainingSp(cnt); // adds the sum to the remaining sp
rs.close();
ps.close();
} catch (Exception e) {
dropMessage(6,"Something went wrong, please alert a GM.");
return;
}
for (MapleData skill_ : MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")).getData("Skill.img").getChildren()) { //sets the sp to 0
try {
Skill skill = SkillFactory.getSkill(Integer.parseInt(skill_.getName()));
changeSkillLevel(skill, (byte) 0, skill.getMaxLevel(), -1);
} catch (NumberFormatException nfe) {
break;
} catch (NullPointerException npe) {
continue;
}
}
}
This semi-works because when it should have brought me back 77 sp it only brought me back 37 sp, any ideas?x: