Flav
Posts: 24 Join date: 2008-08-16
 | Subject: Fix disapearing NX Cash, Maple Points and Gift Tokens Sat Aug 16, 2008 7:53 pm | |
| In this little guide I show you how to fix disapearing NX Cash, Maple Points and Gift Tokens after creating a new character. The reason why they disapear is that creating a new character sets their values to 0. What we need to do is to read out the old values and set them like they were before. Open MapleCharacter.java and change | Code: | ret.nxcash = 0; ret.maplepoints = 0; ret.gifttokens = 0; |
to
| Code: | try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps; ps = con.prepareStatement("SELECT * FROM accounts WHERE id = ?"); ps.setInt(1, ret.accountid); ResultSet rs = ps.executeQuery(); rs = ps.executeQuery(); while (rs.next()) { ret.getClient().setAccountName(rs.getString("name")); ret.nxcash = rs.getInt("nxCash"); ret.maplepoints = rs.getInt("mPoints"); ret.gifttokens = rs.getInt("gTokens"); } rs.close(); ps.close(); } catch (SQLException e) { log.error("ERROR", e); } |
Another possibility would be to remove it from saveToDB when creating a character, but what ever this works too. |
|
f1r3
Posts: 17 Join date: 2008-08-18
 | Subject: Re: Fix disapearing NX Cash, Maple Points and Gift Tokens Mon Aug 18, 2008 10:54 am | |
| ahaha now i know why my didnt work i missed the database connection |
|