root/trunk/AE-go_GameServer/data/scripts/system/database/mysql5/MySQL5PlayerDAO.java
| 1399 | 1503 | ||
|---|---|---|---|
90 | @Override | 90 | @Override |
91 | public void storePlayer(final Player player) | 91 | public void storePlayer(final Player player) |
92 | { | 92 | { |
93 | DB.insertUpdate("UPDATE players SET name=?, exp=?, recoverexp=?, x=?, y=?, z=?, heading=?, world_id=?, player_class=?, last_online=?, cube_size=?,
warehouse_size=?, note=?, bind_point=?, title_id=? WHERE id=?", new IUStH(){ | 93 | DB.insertUpdate("UPDATE players SET name=?, exp=?, recoverexp=?, x=?, y=?, z=?, heading=?, world_id=?, player_class=?, last_online=?, cube_size=?, warehouse_size=?, note=?, bind_point=?, title_id=?, mailboxLetters=? WHERE id=?", new IUStH(){ |
94 | @Override | 94 | @Override |
95 | public void handleInsertUpdate(PreparedStatement stmt) throws SQLException | 95 | public void handleInsertUpdate(PreparedStatement stmt) throws SQLException |
96 | { | 96 | { |
... | ... | ||
111 | stmt.setString(13,player.getCommonData().getNote()); | 111 | stmt.setString(13,player.getCommonData().getNote()); |
112 | stmt.setInt(14, player.getCommonData().getBindPoint()); | 112 | stmt.setInt(14, player.getCommonData().getBindPoint()); |
113 | stmt.setInt(15, player.getCommonData().getTitleId()); | 113 | stmt.setInt(15, player.getCommonData().getTitleId()); |
114 | stmt.setInt(16, player.getObjectId()); | 114 | stmt.setInt(16, player.getMailbox().getLettersCount()); |
115 | stmt.setInt(17, player.getObjectId()); | ||
115 | stmt.execute(); | 116 | stmt.execute(); |
116 | } | 117 | } |
117 | }); | 118 | }); |
... | ... | ||
157 | 158 | ||
158 | private Object pcdLock = new Object(); | 159 | private Object pcdLock = new Object(); |
159 | 160 | ||
161 | |||
162 | @Override | ||
163 | public PlayerCommonData loadPlayerCommonDataByName(final String name, final World world) | ||
164 | { | ||
165 | final List<Integer> playerObjId = new ArrayList<Integer>(); | ||
166 | |||
167 | DB.select("SELECT id FROM players WHERE name = ?", new ParamReadStH(){ | ||
168 | |||
169 | @Override | ||
170 | public void setParams(PreparedStatement stmt) throws SQLException | ||
171 | { | ||
172 | stmt.setString(1, name); | ||
173 | } | ||
174 | |||
175 | @Override | ||
176 | public void handleRead(ResultSet resultSet) throws SQLException | ||
177 | { | ||
178 | resultSet.next(); | ||
179 | |||
180 | playerObjId.add(resultSet.getInt("id")); | ||
181 | } | ||
182 | }); | ||
183 | |||
184 | if(playerObjId.size() == 0) | ||
185 | return null; | ||
186 | else | ||
187 | return loadPlayerCommonData(playerObjId.get(0), world, null); | ||
188 | } | ||
189 | |||
160 | /** | 190 | /** |
161 | * {@inheritDoc} | 191 | * {@inheritDoc} |
162 | */ | 192 | */ |
... | ... | ||
199 | cd.setBindPoint(resultSet.getInt("bind_point")); | 229 | cd.setBindPoint(resultSet.getInt("bind_point")); |
200 | cd.setTitleId(resultSet.getInt("title_id")); | 230 | cd.setTitleId(resultSet.getInt("title_id")); |
201 | cd.setWarehouseSize(resultSet.getInt("warehouse_size")); | 231 | cd.setWarehouseSize(resultSet.getInt("warehouse_size")); |
232 | cd.setOnline(resultSet.getBoolean("online")); | ||
233 | cd.setMailboxLetters(resultSet.getInt("mailboxLetters")); | ||
202 | 234 | ||
203 | float x = resultSet.getFloat("x"); | 235 | float x = resultSet.getFloat("x"); |
204 | float y = resultSet.getFloat("y"); | 236 | float y = resultSet.getFloat("y"); |
... | ... | ||
206 | byte heading = resultSet.getByte("heading"); | 238 | byte heading = resultSet.getByte("heading"); |
207 | int worldId = resultSet.getInt("world_id"); | 239 | int worldId = resultSet.getInt("world_id"); |
208 | 240 | ||
209 | if(z < -1000) | 241 | if(z < -1000 && playerInitialData != null) |
210 | { | 242 | { |
211 | //unstuck unlucky characters :) | 243 | //unstuck unlucky characters :) |
212 | LocationData ld = playerInitialData.getSpawnLocation(cd.getRace()); | 244 | LocationData ld = playerInitialData.getSpawnLocation(cd.getRace()); |
Download diff