|
|
@ -59,41 +59,40 @@ public class dbItemHandler extends dbHandlerBase { |
|
|
|
public Item PERSIST(Item toAdd) { |
|
|
|
public Item PERSIST(Item toAdd) { |
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) { |
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) { |
|
|
|
|
|
|
|
|
|
|
|
preparedStatement.setInt(1, toAdd.ownerID); |
|
|
|
preparedStatement.setInt(1, toAdd.ownerID); |
|
|
|
preparedStatement.setInt(2, toAdd.getTemplateID()); |
|
|
|
preparedStatement.setInt(2, toAdd.getTemplateID()); |
|
|
|
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); |
|
|
|
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining); |
|
|
|
preparedStatement.setInt(4, (short) toAdd.combat_health_current); |
|
|
|
preparedStatement.setInt(4, (short) toAdd.combat_health_current); |
|
|
|
preparedStatement.setInt(5, (int) toAdd.template.combat_health_full); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (toAdd.getNumOfItems() < 1) |
|
|
|
if (toAdd.getNumOfItems() < 1) |
|
|
|
preparedStatement.setInt(6, 1); |
|
|
|
preparedStatement.setInt(5, 1); |
|
|
|
else |
|
|
|
else |
|
|
|
preparedStatement.setInt(6, toAdd.getNumOfItems()); |
|
|
|
preparedStatement.setInt(5, toAdd.getNumOfItems()); |
|
|
|
|
|
|
|
|
|
|
|
switch (toAdd.containerType) { |
|
|
|
switch (toAdd.containerType) { |
|
|
|
case INVENTORY: |
|
|
|
case INVENTORY: |
|
|
|
preparedStatement.setString(7, "inventory"); |
|
|
|
preparedStatement.setString(6, "inventory"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case EQUIPPED: |
|
|
|
case EQUIPPED: |
|
|
|
preparedStatement.setString(7, "equip"); |
|
|
|
preparedStatement.setString(6, "equip"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BANK: |
|
|
|
case BANK: |
|
|
|
preparedStatement.setString(7, "bank"); |
|
|
|
preparedStatement.setString(6, "bank"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case VAULT: |
|
|
|
case VAULT: |
|
|
|
preparedStatement.setString(7, "vault"); |
|
|
|
preparedStatement.setString(6, "vault"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case FORGE: |
|
|
|
case FORGE: |
|
|
|
preparedStatement.setString(7, "forge"); |
|
|
|
preparedStatement.setString(6, "forge"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
preparedStatement.setString(7, "none"); //Shouldn't be here
|
|
|
|
preparedStatement.setString(6, "none"); //Shouldn't be here
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
preparedStatement.setByte(8, (byte) toAdd.equipSlot.ordinal()); |
|
|
|
preparedStatement.setByte(7, (byte) toAdd.equipSlot.ordinal()); |
|
|
|
|
|
|
|
|
|
|
|
String flagString = ""; |
|
|
|
String flagString = ""; |
|
|
|
|
|
|
|
|
|
|
@ -102,8 +101,8 @@ public class dbItemHandler extends dbHandlerBase { |
|
|
|
|
|
|
|
|
|
|
|
flagString = flagString.replaceAll(";$", ""); |
|
|
|
flagString = flagString.replaceAll(";$", ""); |
|
|
|
|
|
|
|
|
|
|
|
preparedStatement.setString(9, flagString); |
|
|
|
preparedStatement.setString(8, flagString); |
|
|
|
preparedStatement.setString(10, toAdd.name); |
|
|
|
preparedStatement.setString(9, toAdd.name); |
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
|
|
|
|