Sync with L2jServer HighFive Jul 25th 2015.
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.CastleData;
|
||||
@@ -221,7 +221,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
public void dbSave()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -362,7 +362,7 @@ public final class Castle extends AbstractResidence
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setLong(1, getTreasury());
|
||||
@@ -624,7 +624,7 @@ public final class Castle extends AbstractResidence
|
||||
@Override
|
||||
protected void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
|
||||
{
|
||||
@@ -671,7 +671,7 @@ public final class Castle extends AbstractResidence
|
||||
/** Load All Functions */
|
||||
private void loadFunctions()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -696,7 +696,7 @@ public final class Castle extends AbstractResidence
|
||||
public void removeFunction(int functionType)
|
||||
{
|
||||
_function.remove(functionType);
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -771,7 +771,7 @@ public final class Castle extends AbstractResidence
|
||||
// This method loads castle door upgrade data from database
|
||||
private void loadDoorUpgrade()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -797,7 +797,7 @@ public final class Castle extends AbstractResidence
|
||||
door.setCurrentHp(door.getCurrentHp());
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -822,7 +822,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
if (save)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, doorId);
|
||||
@@ -849,7 +849,7 @@ public final class Castle extends AbstractResidence
|
||||
CastleManorManager.getInstance().resetManorData(getResidenceId());
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
// Need to remove has castle flag from clan_data, should be checked from castle table.
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
|
||||
@@ -1022,7 +1022,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
public void updateShowNpcCrest()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setString(1, String.valueOf(getShowNpcCrest()));
|
||||
@@ -1066,7 +1066,7 @@ public final class Castle extends AbstractResidence
|
||||
{
|
||||
_ticketBuyCount = count;
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, _ticketBuyCount);
|
||||
@@ -1089,7 +1089,7 @@ public final class Castle extends AbstractResidence
|
||||
{
|
||||
if (save)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -1116,7 +1116,7 @@ public final class Castle extends AbstractResidence
|
||||
ts.setUpgradeLevel(0);
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -1206,7 +1206,7 @@ public final class Castle extends AbstractResidence
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setString(1, side.toString());
|
||||
|
||||
Reference in New Issue
Block a user