StringqueryString="INSERT IGNORE INTO login_cachelist (`UID`) SELECT `UID` from `obj_account` WHERE `discordAccount` = ?";
ConfigManager.MB_DATABASE_PASS.getValue());
PreparedStatementinvalidateAccounts=connection.prepareStatement("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()){
while(rs.next()){
@ -338,13 +339,13 @@ public class BaneRecord extends DataRecord {
@@ -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
ResultSetrs=statement.executeQuery()){
@ -263,13 +264,13 @@ public class CharacterRecord extends DataRecord {
@@ -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`=?")){
@ -29,88 +28,146 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
@@ -29,88 +28,146 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
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`=?;");
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`.`parent`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT `obj_city`.*, `object`.`parent` FROM `obj_city` INNER JOIN `object` ON `object`.`UID` = `obj_city`.`UID` WHERE `object`.`UID`=?;")){
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT * FROM static_npc_runeSet")){
try{
ResultSetrs=executeQuery();
ResultSetrs=preparedStatement.executeQuery();
while(rs.next()){
@ -126,25 +116,23 @@ public class dbItemBaseHandler extends dbHandlerBase {
@@ -126,25 +116,23 @@ public class dbItemBaseHandler extends dbHandlerBase {
@ -152,14 +140,13 @@ public class dbItemBaseHandler extends dbHandlerBase {
@@ -152,14 +140,13 @@ public class dbItemBaseHandler extends dbHandlerBase {
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT * FROM static_npc_bootySet")){
try{
ResultSetrs=executeQuery();
ResultSetrs=preparedStatement.executeQuery();
while(rs.next()){
@ -168,25 +155,22 @@ public class dbItemBaseHandler extends dbHandlerBase {
@@ -168,25 +155,22 @@ public class dbItemBaseHandler extends dbHandlerBase {
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';")){
@ -23,206 +26,190 @@ public class dbLootTableHandler extends dbHandlerBase {
@@ -23,206 +26,190 @@ public class dbLootTableHandler extends dbHandlerBase {
}
publicvoidpopulateLootGroups(){
intrecordsRead=0;
prepareCallable("SELECT `groupID`, `minRoll`, `maxRoll`, `lootTableID`, `pModTableID`, `sModTableID` FROM `static_lootgroups`");
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`=?")){
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`=?")){
@ -24,31 +27,59 @@ public class dbPromotionClassHandler extends dbHandlerBase {
@@ -24,31 +27,59 @@ public class dbPromotionClassHandler extends dbHandlerBase {
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=executeQuery();
ResultSetrs=preparedStatement.executeQuery();
//shrines cached in rs for easy cache on creation.
PreparedStatementpreparedStatement=connection.prepareStatement("SELECT IDString, type FROM static_power_failcondition where powerOrEffect = 'Power'")){
@ -33,417 +34,523 @@ public class dbWarehouseHandler extends dbHandlerBase {
@@ -33,417 +34,523 @@ public class dbWarehouseHandler extends dbHandlerBase {
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';");
@ -156,8 +154,16 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
@@ -156,8 +154,16 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
@ -289,6 +295,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
@@ -289,6 +295,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
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!");
@ -449,9 +449,9 @@ public class LoginServerMsgHandler implements NetMsgHandler {
@@ -449,9 +449,9 @@ public class LoginServerMsgHandler implements NetMsgHandler {
PreparedStatementstatement=connection.prepareStatement("SELECT * from `object` where `type` = 'item' AND `parent` IS NULL",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
@ -417,14 +418,14 @@ public class WarehousePushThread implements Runnable {
@@ -417,14 +418,14 @@ public class WarehousePushThread implements Runnable {