Sync with L2jServer HighFive Jul 25th 2015.
This commit is contained in:
+5
@@ -52,6 +52,11 @@ Login = root
|
||||
# Database connection password
|
||||
Password =
|
||||
|
||||
# Database Connection Pool
|
||||
# Default: C3P0
|
||||
# Available: C3P0, HikariCP, BoneCP
|
||||
ConnectionPool = C3P0
|
||||
|
||||
# Default: 100
|
||||
MaximumDbConnections = 500
|
||||
|
||||
|
||||
Vendored
+32
-36
@@ -21,6 +21,7 @@ package conquerablehalls.RainbowSpringsChateau;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
@@ -31,7 +32,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
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.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
@@ -395,7 +396,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
long count = warDecrees.getCount();
|
||||
_warDecreesCount.put(clan.getId(), count);
|
||||
player.destroyItem("Rainbow Springs Registration", warDecrees, npc, true);
|
||||
updateAttacker(clan.getId(), count, false);
|
||||
addAttacker(clan.getId(), count);
|
||||
html = "messenger_yetti009.htm";
|
||||
}
|
||||
}
|
||||
@@ -415,7 +416,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
}
|
||||
else
|
||||
{
|
||||
updateAttacker(clan.getId(), 0, true);
|
||||
removeAttacker(clan.getId());
|
||||
html = "messenger_yetti018.htm";
|
||||
}
|
||||
break;
|
||||
@@ -830,34 +831,31 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
|
||||
private static boolean isYetiTarget(int npcId)
|
||||
{
|
||||
for (int yeti : YETIS)
|
||||
{
|
||||
if (yeti == npcId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return Util.contains(YETIS, npcId);
|
||||
}
|
||||
|
||||
private static void updateAttacker(int clanId, long count, boolean remove)
|
||||
private static void removeAttacker(int clanId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM rainbowsprings_attacker_list WHERE clanId = ?"))
|
||||
{
|
||||
PreparedStatement statement;
|
||||
if (remove)
|
||||
{
|
||||
statement = con.prepareStatement("DELETE FROM rainbowsprings_attacker_list WHERE clanId = ?");
|
||||
statement.setInt(1, clanId);
|
||||
}
|
||||
else
|
||||
{
|
||||
statement = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)");
|
||||
statement.setInt(1, clanId);
|
||||
statement.setLong(2, count);
|
||||
}
|
||||
statement.execute();
|
||||
statement.close();
|
||||
ps.setInt(1, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void addAttacker(int clanId, long count)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO rainbowsprings_attacker_list VALUES (?,?)"))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
ps.setLong(2, count);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -868,18 +866,16 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
@Override
|
||||
public void loadAttackers()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM rainbowsprings_attacker_list");
|
||||
ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
try (ResultSet rset = s.executeQuery("SELECT * FROM rainbowsprings_attacker_list"))
|
||||
{
|
||||
int clanId = rset.getInt("clan_id");
|
||||
long count = rset.getLong("decrees_count");
|
||||
_warDecreesCount.put(clanId, count);
|
||||
while (rset.next())
|
||||
{
|
||||
_warDecreesCount.put(rset.getInt("clan_id"), rset.getLong("decrees_count"));
|
||||
}
|
||||
}
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.ai.L2SpecialSiegeGuardAI;
|
||||
@@ -764,135 +764,123 @@ public abstract class FlagWar extends ClanHallSiegeEngine
|
||||
@Override
|
||||
public final void loadAttackers()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SQL_LOAD_ATTACKERS);
|
||||
statement.setInt(1, _hall.getId());
|
||||
ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
ps.setInt(1, _hall.getId());
|
||||
try (ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
final int clanId = rset.getInt("clan_id");
|
||||
|
||||
if (ClanTable.getInstance().getClan(clanId) == null)
|
||||
while (rset.next())
|
||||
{
|
||||
_log.warning(getName() + ": Loaded an unexistent clan as attacker! Clan ID: " + clanId);
|
||||
continue;
|
||||
final int clanId = rset.getInt("clan_id");
|
||||
|
||||
if (ClanTable.getInstance().getClan(clanId) == null)
|
||||
{
|
||||
_log.warning(getName() + ": Loaded an unexistent clan as attacker! Clan ID: " + clanId);
|
||||
continue;
|
||||
}
|
||||
|
||||
ClanData data = new ClanData();
|
||||
data.flag = rset.getInt("flag");
|
||||
data.npc = rset.getInt("npc");
|
||||
|
||||
_data.put(clanId, data);
|
||||
loadAttackerMembers(clanId);
|
||||
}
|
||||
|
||||
ClanData data = new ClanData();
|
||||
data.flag = rset.getInt("flag");
|
||||
data.npc = rset.getInt("npc");
|
||||
|
||||
_data.put(clanId, data);
|
||||
loadAttackerMembers(clanId);
|
||||
}
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".loadAttackers()->" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final void loadAttackerMembers(int clanId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
final List<Integer> listInstance = _data.get(clanId).players;
|
||||
if (listInstance == null)
|
||||
{
|
||||
ArrayList<Integer> listInstance = _data.get(clanId).players;
|
||||
|
||||
if (listInstance == null)
|
||||
_log.warning(getName() + ": Tried to load unregistered clan with ID " + clanId);
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_MEMEBERS))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
try (ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
_log.warning(getName() + ": Tried to load unregistered clan with ID " + clanId);
|
||||
return;
|
||||
while (rset.next())
|
||||
{
|
||||
listInstance.add(rset.getInt("object_id"));
|
||||
}
|
||||
}
|
||||
|
||||
PreparedStatement statement = con.prepareStatement(SQL_LOAD_MEMEBERS);
|
||||
statement.setInt(1, clanId);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
{
|
||||
listInstance.add(rset.getInt("object_id"));
|
||||
|
||||
}
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".loadAttackerMembers()->" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveClan(int clanId, int flag)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_CLAN))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SQL_SAVE_CLAN);
|
||||
statement.setInt(1, _hall.getId());
|
||||
statement.setInt(2, flag);
|
||||
statement.setInt(3, 0);
|
||||
statement.setInt(4, clanId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
ps.setInt(1, _hall.getId());
|
||||
ps.setInt(2, flag);
|
||||
ps.setInt(3, 0);
|
||||
ps.setInt(4, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveClan()->" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveNpc(int npc, int clanId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_NPC))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SQL_SAVE_NPC);
|
||||
statement.setInt(1, npc);
|
||||
statement.setInt(2, clanId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
ps.setInt(1, npc);
|
||||
ps.setInt(2, clanId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveNpc()->" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final void saveMember(int clanId, int objectId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE_ATTACKER))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SQL_SAVE_ATTACKER);
|
||||
statement.setInt(1, _hall.getId());
|
||||
statement.setInt(2, clanId);
|
||||
statement.setInt(3, objectId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
ps.setInt(1, _hall.getId());
|
||||
ps.setInt(2, clanId);
|
||||
ps.setInt(3, objectId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning(getName() + ".saveMember()->" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearTables()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(SQL_CLEAR_CLAN);
|
||||
PreparedStatement ps2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS))
|
||||
{
|
||||
PreparedStatement stat1 = con.prepareStatement(SQL_CLEAR_CLAN);
|
||||
stat1.setInt(1, _hall.getId());
|
||||
stat1.execute();
|
||||
stat1.close();
|
||||
ps1.setInt(1, _hall.getId());
|
||||
ps1.execute();
|
||||
|
||||
PreparedStatement stat2 = con.prepareStatement(SQL_CLEAR_CLAN_ATTACKERS);
|
||||
stat2.setInt(1, _hall.getId());
|
||||
stat2.execute();
|
||||
stat2.close();
|
||||
ps2.setInt(1, _hall.getId());
|
||||
ps2.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -904,8 +892,8 @@ public abstract class FlagWar extends ClanHallSiegeEngine
|
||||
{
|
||||
int flag = 0;
|
||||
int npc = 0;
|
||||
ArrayList<Integer> players = new ArrayList<>(18);
|
||||
ArrayList<L2PcInstance> playersInstance = new ArrayList<>(18);
|
||||
List<Integer> players = new ArrayList<>(18);
|
||||
List<L2PcInstance> playersInstance = new ArrayList<>(18);
|
||||
L2Spawn warrior = null;
|
||||
L2Spawn flagInstance = null;
|
||||
}
|
||||
|
||||
+8
-9
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2AccessLevel;
|
||||
@@ -75,15 +75,14 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?"))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
|
||||
statement.setInt(1, lvl);
|
||||
statement.setString(2, name);
|
||||
statement.execute();
|
||||
int count = statement.getUpdateCount();
|
||||
statement.close();
|
||||
if (count == 0)
|
||||
ps.setInt(1, lvl);
|
||||
ps.setString(2, name);
|
||||
ps.execute();
|
||||
|
||||
if (ps.getUpdateCount() == 0)
|
||||
{
|
||||
activeChar.sendMessage("Character not found or access level unaltered.");
|
||||
}
|
||||
|
||||
+8
-6
@@ -30,7 +30,7 @@ import java.util.StringTokenizer;
|
||||
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.data.sql.impl.CharNameTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.ClassListData;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
@@ -557,11 +557,13 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
|
||||
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
final String updateQuery = "UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(updateQuery))
|
||||
{
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+22
-33
@@ -20,11 +20,11 @@ package handlers.admincommandhandlers;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@@ -63,47 +63,36 @@ public class AdminRepairChar implements IAdminCommandHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final String playerName = parts[1];
|
||||
String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(cmd);
|
||||
statement.setString(1, parts[1]);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
||||
statement = con.prepareStatement("SELECT charId FROM characters where char_name=?");
|
||||
statement.setString(1, parts[1]);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
int objId = 0;
|
||||
if (rset.next())
|
||||
try (PreparedStatement ps = con.prepareStatement(cmd))
|
||||
{
|
||||
objId = rset.getInt(1);
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
rset.close();
|
||||
statement.close();
|
||||
|
||||
if (objId == 0)
|
||||
final int objId = CharNameTable.getInstance().getIdByName(playerName);
|
||||
if (objId != 0)
|
||||
{
|
||||
con.close();
|
||||
return;
|
||||
// Delete player's shortcuts.
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, objId);
|
||||
ps.execute();
|
||||
}
|
||||
// Move all items to the inventory.
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"))
|
||||
{
|
||||
ps.setInt(1, objId);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
|
||||
// connection = L2DatabaseFactory.getInstance().getConnection();
|
||||
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
|
||||
statement.setInt(1, objId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
||||
// connection = L2DatabaseFactory.getInstance().getConnection();
|
||||
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
|
||||
statement.setInt(1, objId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "could not repair char:", e);
|
||||
_log.log(Level.WARNING, "Could not repair char:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@@ -174,7 +174,8 @@ public class AdminShowQuests implements IAdminCommandHandler
|
||||
|
||||
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
// TODO(Zoey76): Refactor this into smaller methods and separate database access logic from HTML creation.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
ResultSet rs;
|
||||
PreparedStatement req;
|
||||
|
||||
+10
-10
@@ -26,7 +26,7 @@ import java.util.StringTokenizer;
|
||||
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.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
@@ -510,16 +510,16 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
final int x = activeChar.getX();
|
||||
final int y = activeChar.getY();
|
||||
final int z = activeChar.getZ();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?"))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
|
||||
statement.setInt(1, x);
|
||||
statement.setInt(2, y);
|
||||
statement.setInt(3, z);
|
||||
statement.setString(4, name);
|
||||
statement.execute();
|
||||
int count = statement.getUpdateCount();
|
||||
statement.close();
|
||||
ps.setInt(1, x);
|
||||
ps.setInt(2, y);
|
||||
ps.setInt(3, z);
|
||||
ps.setString(4, name);
|
||||
ps.execute();
|
||||
int count = ps.getUpdateCount();
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
activeChar.sendMessage("Character not found or position unaltered.");
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jserver.gameserver.handler.IParseBoardHandler;
|
||||
@@ -63,7 +63,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
// Load Favorite links
|
||||
final String list = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/favorite_list.html");
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -100,7 +100,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -125,7 +125,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.BuyListData;
|
||||
@@ -178,7 +178,7 @@ public final class HomeBoard implements IParseBoardHandler
|
||||
private static int getFavoriteCount(L2PcInstance player)
|
||||
{
|
||||
int count = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
|
||||
{
|
||||
ps.setInt(1, player.getObjectId());
|
||||
|
||||
+42
-46
@@ -24,7 +24,7 @@ import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
@@ -64,57 +64,53 @@ public class ClanWarsList implements IUserCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
String query;
|
||||
// Attack List
|
||||
if (id == 88)
|
||||
{
|
||||
String query;
|
||||
// Attack List
|
||||
if (id == 88)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_YOU_VE_DECLARED_WAR_ON);
|
||||
query = ATTACK_LIST;
|
||||
}
|
||||
// Under Attack List
|
||||
else if (id == 89)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
|
||||
query = UNDER_ATTACK_LIST;
|
||||
}
|
||||
// War List
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLAN_WAR_LIST);
|
||||
query = WAR_LIST;
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_YOU_VE_DECLARED_WAR_ON);
|
||||
query = ATTACK_LIST;
|
||||
}
|
||||
// Under Attack List
|
||||
else if (id == 89)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
|
||||
query = UNDER_ATTACK_LIST;
|
||||
}
|
||||
// War List
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLAN_WAR_LIST);
|
||||
query = WAR_LIST;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, clan.getId());
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement(query))
|
||||
SystemMessage sm;
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, clan.getId());
|
||||
|
||||
SystemMessage sm;
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
while (rs.next())
|
||||
{
|
||||
String clanName;
|
||||
int ally_id;
|
||||
while (rs.next())
|
||||
String clanName = rs.getString("clan_name");
|
||||
int allyId = rs.getInt("ally_id");
|
||||
if (allyId > 0)
|
||||
{
|
||||
clanName = rs.getString("clan_name");
|
||||
ally_id = rs.getInt("ally_id");
|
||||
if (ally_id > 0)
|
||||
{
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rs.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLIANCE_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rs.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLIANCE_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.EMPTY3);
|
||||
|
||||
@@ -25,7 +25,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.GameTimeController;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
@@ -209,30 +209,29 @@ public class Wedding implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if target has player on friendlist
|
||||
boolean FoundOnFriendList = false;
|
||||
int objectId;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
// Check if target has player on friend list
|
||||
boolean foundOnFriendList = false;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?"))
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
|
||||
statement.setInt(1, ptarget.getObjectId());
|
||||
final ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
objectId = rset.getInt("friendId");
|
||||
if (objectId == activeChar.getObjectId())
|
||||
while (rset.next())
|
||||
{
|
||||
FoundOnFriendList = true;
|
||||
if (rset.getInt("friendId") == activeChar.getObjectId())
|
||||
{
|
||||
foundOnFriendList = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("could not read friend data:" + e);
|
||||
}
|
||||
|
||||
if (!FoundOnFriendList)
|
||||
if (!foundOnFriendList)
|
||||
{
|
||||
activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage.");
|
||||
return false;
|
||||
|
||||
Vendored
+8
-9
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2AccessLevel;
|
||||
@@ -75,15 +75,14 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?"))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
|
||||
statement.setInt(1, lvl);
|
||||
statement.setString(2, name);
|
||||
statement.execute();
|
||||
int count = statement.getUpdateCount();
|
||||
statement.close();
|
||||
if (count == 0)
|
||||
ps.setInt(1, lvl);
|
||||
ps.setString(2, name);
|
||||
ps.execute();
|
||||
|
||||
if (ps.getUpdateCount() == 0)
|
||||
{
|
||||
activeChar.sendMessage("Character not found or access level unaltered.");
|
||||
}
|
||||
|
||||
+8
-6
@@ -30,7 +30,7 @@ import java.util.StringTokenizer;
|
||||
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.data.sql.impl.CharNameTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.ClassListData;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
@@ -557,11 +557,13 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
|
||||
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
final String updateQuery = "UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(updateQuery))
|
||||
{
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+22
-33
@@ -20,11 +20,11 @@ package handlers.admincommandhandlers;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@@ -63,47 +63,36 @@ public class AdminRepairChar implements IAdminCommandHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final String playerName = parts[1];
|
||||
String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(cmd);
|
||||
statement.setString(1, parts[1]);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
||||
statement = con.prepareStatement("SELECT charId FROM characters where char_name=?");
|
||||
statement.setString(1, parts[1]);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
int objId = 0;
|
||||
if (rset.next())
|
||||
try (PreparedStatement ps = con.prepareStatement(cmd))
|
||||
{
|
||||
objId = rset.getInt(1);
|
||||
ps.setString(1, playerName);
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
rset.close();
|
||||
statement.close();
|
||||
|
||||
if (objId == 0)
|
||||
final int objId = CharNameTable.getInstance().getIdByName(playerName);
|
||||
if (objId != 0)
|
||||
{
|
||||
con.close();
|
||||
return;
|
||||
// Delete player's shortcuts.
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, objId);
|
||||
ps.execute();
|
||||
}
|
||||
// Move all items to the inventory.
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?"))
|
||||
{
|
||||
ps.setInt(1, objId);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
|
||||
// connection = L2DatabaseFactory.getInstance().getConnection();
|
||||
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
|
||||
statement.setInt(1, objId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
|
||||
// connection = L2DatabaseFactory.getInstance().getConnection();
|
||||
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
|
||||
statement.setInt(1, objId);
|
||||
statement.execute();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "could not repair char:", e);
|
||||
_log.log(Level.WARNING, "Could not repair char:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.QuestManager;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@@ -174,7 +174,8 @@ public class AdminShowQuests implements IAdminCommandHandler
|
||||
|
||||
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
// TODO(Zoey76): Refactor this into smaller methods and separate database access logic from HTML creation.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
ResultSet rs;
|
||||
PreparedStatement req;
|
||||
|
||||
+10
-10
@@ -26,7 +26,7 @@ import java.util.StringTokenizer;
|
||||
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.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
@@ -510,16 +510,16 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
final int x = activeChar.getX();
|
||||
final int y = activeChar.getY();
|
||||
final int z = activeChar.getZ();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?"))
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
|
||||
statement.setInt(1, x);
|
||||
statement.setInt(2, y);
|
||||
statement.setInt(3, z);
|
||||
statement.setString(4, name);
|
||||
statement.execute();
|
||||
int count = statement.getUpdateCount();
|
||||
statement.close();
|
||||
ps.setInt(1, x);
|
||||
ps.setInt(2, y);
|
||||
ps.setInt(3, z);
|
||||
ps.setString(4, name);
|
||||
ps.execute();
|
||||
int count = ps.getUpdateCount();
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
activeChar.sendMessage("Character not found or position unaltered.");
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jserver.gameserver.handler.IParseBoardHandler;
|
||||
@@ -63,7 +63,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
// Load Favorite links
|
||||
final String list = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "html/CommunityBoard/favorite_list.html");
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -100,7 +100,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -125,7 +125,7 @@ public class FavoriteBoard implements IParseBoardHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.BuyListData;
|
||||
@@ -178,7 +178,7 @@ public final class HomeBoard implements IParseBoardHandler
|
||||
private static int getFavoriteCount(L2PcInstance player)
|
||||
{
|
||||
int count = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
|
||||
{
|
||||
ps.setInt(1, player.getObjectId());
|
||||
|
||||
+42
-46
@@ -24,7 +24,7 @@ import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
@@ -64,57 +64,53 @@ public class ClanWarsList implements IUserCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
String query;
|
||||
// Attack List
|
||||
if (id == 88)
|
||||
{
|
||||
String query;
|
||||
// Attack List
|
||||
if (id == 88)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_YOU_VE_DECLARED_WAR_ON);
|
||||
query = ATTACK_LIST;
|
||||
}
|
||||
// Under Attack List
|
||||
else if (id == 89)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
|
||||
query = UNDER_ATTACK_LIST;
|
||||
}
|
||||
// War List
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLAN_WAR_LIST);
|
||||
query = WAR_LIST;
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_YOU_VE_DECLARED_WAR_ON);
|
||||
query = ATTACK_LIST;
|
||||
}
|
||||
// Under Attack List
|
||||
else if (id == 89)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
|
||||
query = UNDER_ATTACK_LIST;
|
||||
}
|
||||
// War List
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLAN_WAR_LIST);
|
||||
query = WAR_LIST;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, clan.getId());
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement(query))
|
||||
SystemMessage sm;
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, clan.getId());
|
||||
|
||||
SystemMessage sm;
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
while (rs.next())
|
||||
{
|
||||
String clanName;
|
||||
int ally_id;
|
||||
while (rs.next())
|
||||
String clanName = rs.getString("clan_name");
|
||||
int allyId = rs.getInt("ally_id");
|
||||
if (allyId > 0)
|
||||
{
|
||||
clanName = rs.getString("clan_name");
|
||||
ally_id = rs.getInt("ally_id");
|
||||
if (ally_id > 0)
|
||||
{
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rs.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLIANCE_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rs.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLIANCE_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.EMPTY3);
|
||||
|
||||
+12
-13
@@ -25,7 +25,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.GameTimeController;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
@@ -209,30 +209,29 @@ public class Wedding implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if target has player on friendlist
|
||||
boolean FoundOnFriendList = false;
|
||||
int objectId;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
// Check if target has player on friend list
|
||||
boolean foundOnFriendList = false;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?"))
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
|
||||
statement.setInt(1, ptarget.getObjectId());
|
||||
final ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
objectId = rset.getInt("friendId");
|
||||
if (objectId == activeChar.getObjectId())
|
||||
while (rset.next())
|
||||
{
|
||||
FoundOnFriendList = true;
|
||||
if (rset.getInt("friendId") == activeChar.getObjectId())
|
||||
{
|
||||
foundOnFriendList = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("could not read friend data:" + e);
|
||||
}
|
||||
|
||||
if (!FoundOnFriendList)
|
||||
if (!foundOnFriendList)
|
||||
{
|
||||
activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage.");
|
||||
return false;
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -82,6 +82,11 @@ Login = root
|
||||
# Database connection password
|
||||
Password =
|
||||
|
||||
# Database Connection Pool
|
||||
# Default: C3P0
|
||||
# Available: C3P0, HikariCP, BoneCP
|
||||
ConnectionPool = C3P0
|
||||
|
||||
# Default: 10
|
||||
MaximumDbConnections = 50
|
||||
|
||||
|
||||
Reference in New Issue
Block a user