PreparedStatementinvalidateAccounts=connection.prepareStatement("INSERT IGNORE INTO login_cachelist (`UID`) SELECT `UID` from `obj_account` WHERE `discordAccount` = ?")){
StringqueryString="INSERT IGNORE INTO login_cachelist (`UID`) SELECT `UID` from `obj_account` WHERE `discordAccount` = ?";
PreparedStatementstatement=localConnection.prepareStatement(queryString,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);// Make this an updatable result set as we'll reset the dirty flag as we go along
PreparedStatementstatement=localConnection.prepareStatement(queryString,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);// Make this an updatable result set as we'll reset the dirty flag as we go along
ResultSetrs=statement.executeQuery()){
ResultSetrs=statement.executeQuery()){
while(rs.next()){
while(rs.next()){
@ -338,13 +339,13 @@ public class BaneRecord extends DataRecord {
PreparedStatementstatement=localConnection.prepareStatement(queryString,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);// Make this an updatable result set as we'll reset the dirty flag as we go along
PreparedStatementstatement=localConnection.prepareStatement(queryString,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);// Make this an updatable result set as we'll reset the dirty flag as we go along
ResultSetrs=statement.executeQuery()){
ResultSetrs=statement.executeQuery()){
@ -263,13 +264,13 @@ public class CharacterRecord extends DataRecord {
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT b.* FROM `static_rune_baseclass` b, `static_rune_racebaseclass` r WHERE b.`ID` = r.`BaseClassID` && r.`RaceID` = ?")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `accountID`, `characterID`, `machineID` FROM `dyn_session` WHERE `secretKey`=?")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `dyn_character_power` SET `PowersBaseToken`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `dyn_character_skill` SET `skillsBaseID`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?")){
prepareCallable("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`parent`=?;");
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`parent`=?;")){
prepareCallable("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`UID`=?;");
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`UID`=?;")){
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`item_container`='equip';");
setLong(1,(long)targetId);
returngetObjectList();
}
publicItemGET_ITEM(finalintid){
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`UID`=?;");
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? AND `obj_item`.`item_itembaseID`=?;");
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?;");
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?");
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?");
prepareCallable("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE (`object`.`parent`=? OR `object`.`parent`=?)");
prepareCallable("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`item_container`='none' WHERE `object`.`UID`=?;");
prepareCallable("SELECT `obj_item`.*, `object`.`parent` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? AND `obj_item`.`item_container` =?");
prepareCallable("UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityCurrent`=?");
setInt(1,value);
setLong(2,(long)item.getObjectUUID());
setInt(3,(int)item.getDurabilityCurrent());
return(executeUpdate()!=0);
}
//Update an item except ownership
publicbooleanUPDATE_DATABASE(finalItemitem){
prepareCallable("UPDATE `obj_item` SET `item_itembaseID`=?, `item_chargesRemaining`=?, `item_durabilityCurrent`=?, `item_durabilityMax`=?, `item_numberOfItems`=? WHERE `UID`=?");
setInt(1,item.getItemBaseID());
setInt(2,item.getChargesRemaining());
setInt(3,item.getDurabilityCurrent());
setInt(4,item.getDurabilityMax());
setInt(5,item.getNumOfItems());
setLong(6,(long)item.getObjectUUID());
return(executeUpdate()!=0);
}
publicbooleanUPDATE_ROLL_COMPLETE(finalItemitem){
prepareCallable("UPDATE `obj_item` SET `item_container` = ?, `item_dateToUpgrade` = ? WHERE `UID` = ?");
prepareCallable("UPDATE `obj_item` SET `item_numberOfItems` = CASE WHEN `UID`=? AND `item_numberOfItems`=? THEN ? WHEN `UID`=? AND `item_numberOfItems`=? THEN ? END WHERE `UID` IN (?, ?);");
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`UID`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=?")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`item_container`='none' WHERE `object`.`UID`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityCurrent`=?")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_item` SET `item_container` = ? WHERE `UID` = ? AND `item_container` = 'forge';")){
prepareCallable("SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `obj_character`.`char_isActive`='1';");
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `obj_character`.`char_isActive`='1';")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `char_firstname` FROM `obj_character` WHERE `char_isActive`=1 && `char_firstname`=?")){
prepareCallable("UPDATE `obj_character` SET `char_firstname`=?, `char_lastname`=? WHERE `char_firstname`=? AND `char_isActive`='1'");
setString(1,newFirstName);
preparedStatement.setString(1,firstName);
setString(2,newLastName);
setString(3,oldFirstName);
ResultSetrs=preparedStatement.executeQuery();
return(executeUpdate()!=0);
}
if(rs.next())
unique=false;
publicbooleanSET_DELETED(finalPlayerCharacterpc){
prepareCallable("UPDATE `obj_character` SET `char_isActive`=? WHERE `UID` = ?");
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_character` SET `char_firstname`=?, `char_lastname`=? WHERE `char_firstname`=? AND `char_isActive`='1'")){
PreparedStatementpreparedStatement=connection.prepareStatement("UPDATE `obj_character` SET `char_strMod`=?, `char_dexMod`=?, `char_conMod`=?, `char_intMod`=?, `char_spiMod`=? WHERE `UID`=?")){
publicbooleanREMOVE_FRIEND(intsource,intfriend){
preparedStatement.setInt(1,pc.getStrMod());
prepareCallable("DELETE FROM `dyn_character_friends` WHERE (`playerUID`=?) AND (`friendUID`=?)");
preparedStatement.setInt(2,pc.getDexMod());
setLong(1,(long)source);
preparedStatement.setInt(3,pc.getConMod());
setLong(2,(long)friend);
preparedStatement.setInt(4,pc.getIntMod());
return(executeUpdate()!=0);
preparedStatement.setInt(5,pc.getSpiMod());
}
preparedStatement.setLong(6,pc.getObjectUUID());
publicvoidLOAD_PLAYER_FRIENDS(){
return(preparedStatement.executeUpdate()>0);
PlayerFriendsplayerFriend;
}catch(SQLExceptione){
Logger.error(e);
}
prepareCallable("SELECT * FROM dyn_character_friends");
prepareCallable("SELECT `obj_shrine`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_shrine` ON `object`.`UID` = `obj_shrine`.`UID` WHERE `object`.`type` = 'shrine';");
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_shrine`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_shrine` ON `object`.`UID` = `obj_shrine`.`UID` WHERE `object`.`type` = 'shrine';")){
try{
ResultSetrs=preparedStatement.executeQuery();
ResultSetrs=executeQuery();
//shrines cached in rs for easy cache on creation.
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT IDString, type FROM static_power_failcondition where powerOrEffect = 'Power'")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")){
prepareCallable("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';");
Logger.warn("Warning! WorldServerMap with ID "+zone.getObjectUUID()+" has a loadnum of 0 (player city) and no city linked. This will probably crash the client!");
Logger.warn("Warning! WorldServerMap with ID "+zone.getObjectUUID()+" has a loadnum of 0 (player city) and no city linked. This will probably crash the client!");
PreparedStatementstatement=connection.prepareStatement("SELECT * from `object` where `type` = 'item' AND `parent` IS NULL",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
PreparedStatementstatement=connection.prepareStatement("SELECT * from `object` where `type` = 'item' AND `parent` IS NULL",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);