Package l2p.database

Examples of l2p.database.ThreadConnection


      return false;
    }
    // check if target has player on friendlist
    boolean FoundOnFriendList = false;
    int objectId;
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=?");
      statement.setInt(1, ptarget.getObjectId());
      rset = statement.executeQuery();
      while(rset.next())
      {
        objectId = rset.getInt("friend_id");
View Full Code Here


  }

  private static int loadSpawn(FastMap<Integer, GArray<Location>> table, int type)
  {
    int count = 0;
    ThreadConnection con = null;
    FiltredPreparedStatement statement1 = null;
    ResultSet rset1 = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement1 = con.prepareStatement("SELECT DISTINCT key_npc_id FROM four_sepulchers_spawnlist WHERE spawntype = ? ORDER BY key_npc_id");
      statement1.setInt(1, type);
      rset1 = statement1.executeQuery();
      while(rset1.next())
      {
        int keyNpcId = rset1.getInt("key_npc_id");
        FiltredPreparedStatement statement2 = null;
        ResultSet rset2 = null;
        try
        {
          statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist WHERE key_npc_id = ? AND spawntype = ? ORDER BY id");
          statement2.setInt(1, keyNpcId);
          statement2.setInt(2, type);
          rset2 = statement2.executeQuery();
          GArray<Location> locations = new GArray<Location>();
          while(rset2.next())
View Full Code Here

  }

  private static void loadMysteriousBox()
  {
    _mysteriousBoxSpawns.clear();
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist WHERE spawntype = 0 ORDER BY id");
      rset = statement.executeQuery();
      while(rset.next())
      {
        _mysteriousBoxSpawns.put(rset.getInt("key_npc_id"), new Location(rset.getInt("locx"), rset.getInt("locy"), rset.getInt("locz"), rset.getInt("heading"), rset.getInt("npc_templateid")));
      }
View Full Code Here

  }

  public static void ItemHandler_13015(L2Player player, Boolean ctrl) // Teleport Book
  {
    String msg = "Свободный телепорт активирован."; // Пишите в UTF-8
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      removeItem(player, 13015, 1);
      player.logout(false, false, false, true);
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("UPDATE characters SET bookmarks = bookmarks+3 WHERE obj_Id=?");
      statement.setInt(1, player.getObjectId());
      statement.execute();
      DatabaseUtils.closeStatement(statement);
      //player.updateStats();
      //player.sendChanges();
View Full Code Here

      {
        player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
      }
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement offline = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      offline = con.prepareStatement("UPDATE characters SET sex = ? WHERE obj_Id = ?");
      offline.setInt(1, player.getSex() == 1 ? 0 : 1);
      offline.setInt(2, player.getObjectId());
      offline.executeUpdate();
    }
    catch(Exception e)
View Full Code Here

  protected static Logger _log = Logger.getLogger(L2PetInstance.class.getName());

  private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2Player owner)
  {
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT objId, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?");
      statement.setInt(1, control.getObjectId());
      rset = statement.executeQuery();
      L2PetInstance pet;
      if(!rset.next())
      {
View Full Code Here

    if(getControlItemObjId() == 0)
    {
      return;
    }
    // pet control item no longer exists, delete the pet from the db
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?");
      statement.setInt(1, getControlItemObjId());
      statement.execute();
    }
    catch(Exception e)
    {
View Full Code Here

    }
    else
    {
      req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,objId=? WHERE item_obj_id = ?";
    }
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(req);
      statement.setString(1, getName().equalsIgnoreCase(getTemplate().name) ? "" : getName());
      statement.setInt(2, _level);
      statement.setDouble(3, getCurrentHp());
      statement.setDouble(4, getCurrentMp());
      statement.setLong(5, _exp);
View Full Code Here

  public static void init()
  {
    _taxSum = ServerVariables.getLong("taxsum", 0);
    _rouletteSum = ServerVariables.getLong("rouletteSum", 0);
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT (SELECT SUM(count) FROM items WHERE item_id=57) + (SELECT SUM(treasury) FROM castle) AS `count`");
      rset = statement.executeQuery();
      if(rset.next())
      {
        _adenaSum = rset.getLong("count");
      }
View Full Code Here

    }
  }

  private void restore()
  {
    ThreadConnection con = null;
    FiltredStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      rset = statement.executeQuery("SELECT bonus_name,bonus_value from bonus where obj_id='" + _owner.getObjectId() + "' and (bonus_expire_time='-1' or bonus_expire_time > " + System.currentTimeMillis() / 1000 + ")");
      while(rset.next())
      {
        String bonus_name = rset.getString("bonus_name");
        float bonus_value = rset.getFloat("bonus_value");
View Full Code Here

TOP

Related Classes of l2p.database.ThreadConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.