Package l2p.database

Examples of l2p.database.FiltredPreparedStatement


  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())
          {
            locations.add(new Location(rset2.getInt("locx"), rset2.getInt("locy"), rset2.getInt("locz"), rset2.getInt("heading"), rset2.getInt("npc_templateid")));
            count++;
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")));
      }
      _log.warning("FourSepulchersManager: Loaded " + _mysteriousBoxSpawns.size() + " Mysterious-Box spawns.");
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();
      player.broadcastUserInfo(true);
      player.sendPacket(new SystemMessage(msg));
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)
    {
      e.printStackTrace();
      show(new CustomMessage("common.Error", player), player);
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())
      {
        if(PetDataTable.isBabyPet(template.getNpcId()) || PetDataTable.isImprovedBabyPet(template.getNpcId()))
        {
View Full Code Here

    {
      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)
    {
      _log.warning("could not delete pet:" + 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);
      statement.setLong(6, _sp);
      statement.setInt(7, _curFed);
      statement.setInt(8, _objectId);
      statement.setInt(9, _controlItemObjId);
      statement.executeUpdate();
      _respawned = true;
    }
    catch(Exception e)
    {
      _log.warning("could not store pet data: " + e);
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");
      }
      DatabaseUtils.closeDatabaseSR(statement, rset);
View Full Code Here

                        mysql.set("DELETE FROM character_variables WHERE `name` = 'offline' AND `value` < "
                                + min_offline_restore);
                    }
                    mysql.set("DELETE FROM character_variables WHERE `name` = 'offline' AND `obj_id` IN (SELECT `obj_id` FROM `characters` WHERE `accessLevel` < 0)");
                    ThreadConnection con = null;
                    FiltredPreparedStatement st = null;
                    ResultSet rs = null;
                    try {
                        GArray<Object> logins = mysql.get_array(L2DatabaseFactory.getInstanceLogin(),
                                "SELECT `login` FROM `accounts` WHERE `access_level` < 0");
                        if (logins.size() > 0) {
                            con = L2DatabaseFactory.getInstance().getConnection();
                            st = con.prepareStatement("DELETE FROM character_variables WHERE `name` = 'offline' AND `obj_id` IN (SELECT `obj_id` FROM `characters` WHERE `account_name`=?)");
                            for (Object login : logins) {
                                st.setString(1, (String) login);
                                st.executeUpdate();
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    } finally {
View Full Code Here

      sendMessage(new CustomMessage("scripts.services.Activation.InvalidNewMail", player), player);
      activation_page();
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstanceLogin().getConnection();
      statement = con.prepareStatement("SELECT * FROM `accounts` WHERE email=?");
      statement.setString(1, email1);
      rset = statement.executeQuery();
      if(rset.next())
      {
        sendMessage(new CustomMessage("scripts.services.Activation.EmailAlreadyExists", player), player);
        activation_page();
        return;
View Full Code Here

TOP

Related Classes of l2p.database.FiltredPreparedStatement

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.