@ -26,7 +26,6 @@ import java.sql.PreparedStatement;
@@ -26,7 +26,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet ;
import java.sql.SQLException ;
import java.util.ArrayList ;
import java.util.EnumSet ;
import java.util.HashSet ;
@ -161,7 +160,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -161,7 +160,7 @@ public class dbItemHandler extends dbHandlerBase {
ArrayList < Item > itemList ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "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';" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`container`='equip';" ) ) {
preparedStatement . setLong ( 1 , targetId ) ;
ResultSet rs = preparedStatement . executeQuery ( ) ;
@ -277,7 +276,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -277,7 +276,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean MOVE_GOLD ( final Item from , final Item to , final int amt ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);" ) ) {
int newFromAmt = from . getNumOfItems ( ) - amt ;
int newToAmt = to . getNumOfItems ( ) + amt ;
@ -307,7 +306,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -307,7 +306,7 @@ public class dbItemHandler extends dbHandlerBase {
continue ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = 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`=?;" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`container`='none' WHERE `object`.`UID`=?;" ) ) {
preparedStatement . setLong ( 1 , item . getObjectUUID ( ) ) ;
worked = ( preparedStatement . executeUpdate ( ) > 0 ) ;
@ -397,7 +396,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -397,7 +396,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean SET_DURABILITY ( final Item item , int value ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityC urrent`=?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `combat_health_current`=? WHERE `UID`=? AND `combat_health_c urrent`=?" ) ) {
preparedStatement . setInt ( 1 , value ) ;
preparedStatement . setLong ( 2 , item . getObjectUUID ( ) ) ;
@ -414,7 +413,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -414,7 +413,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_FORGE_TO_INVENTORY ( final Item item ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ container` = ? WHERE `UID` = ? AND `item_ container` = 'forge';" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `container` = ? WHERE `UID` = ? AND `container` = 'forge';" ) ) {
preparedStatement . setString ( 1 , "inventory" ) ;
preparedStatement . setLong ( 2 , item . getObjectUUID ( ) ) ;
@ -451,7 +450,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -451,7 +450,7 @@ public class dbItemHandler extends dbHandlerBase {
return false ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ numberOfItems`=? WHERE `UID`=?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `numberOfItems`=? WHERE `UID`=?" ) ) {
preparedStatement . setInt ( 1 , newValue ) ;
preparedStatement . setLong ( 2 , item . getObjectUUID ( ) ) ;
@ -468,7 +467,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -468,7 +467,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_REMAINING_CHARGES ( final Item item ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ chargesRemaining` = ? WHERE `UID` = ?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `chargesRemaining` = ? WHERE `UID` = ?" ) ) {
preparedStatement . setInt ( 1 , ( byte ) item . chargesRemaining ) ;
preparedStatement . setLong ( 2 , item . getObjectUUID ( ) ) ;
@ -488,7 +487,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -488,7 +487,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean ZERO_ITEM_STACK ( Item item ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ numberOfItems`=0 WHERE `UID` = ?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `numberOfItems`=0 WHERE `UID` = ?" ) ) {
preparedStatement . setLong ( 1 , item . getObjectUUID ( ) ) ;
@ -503,7 +502,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -503,7 +502,7 @@ public class dbItemHandler extends dbHandlerBase {
public boolean UPDATE_FLAGS ( Item item ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ flags`=? WHERE `UID` = ?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `flags`=? WHERE `UID` = ?" ) ) {
String flagString = "" ;
@ -523,29 +522,6 @@ public class dbItemHandler extends dbHandlerBase {
@@ -523,29 +522,6 @@ public class dbItemHandler extends dbHandlerBase {
}
}
public boolean UPDATE_FLAGS ( int itemUUID , EnumSet < Enum . ItemFlags > itemFlags ) {
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_flags`=? WHERE `UID` = ?" ) ) {
String flagString = "" ;
for ( Enum . ItemFlags itemflag : itemFlags )
flagString + = itemflag . toString ( ) + ";" ;
flagString = flagString . replaceAll ( ";$" , "" ) ;
preparedStatement . setString ( 1 , flagString ) ;
preparedStatement . setLong ( 2 , itemUUID ) ;
return ( preparedStatement . executeUpdate ( ) > 0 ) ;
} catch ( SQLException e ) {
Logger . error ( e ) ;
return false ;
}
}
public boolean UPDATE_VALUE ( Item item , int value ) {
// Write 0 if we will not modify the value from template
@ -554,7 +530,7 @@ public class dbItemHandler extends dbHandlerBase {
@@ -554,7 +530,7 @@ public class dbItemHandler extends dbHandlerBase {
value = 0 ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `item_ value`=? WHERE `UID` = ?" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "UPDATE `obj_item` SET `value`=? WHERE `UID` = ?" ) ) {
preparedStatement . setInt ( 1 , value ) ;
preparedStatement . setLong ( 2 , item . getObjectUUID ( ) ) ;