Package l2p.util

Examples of l2p.util.SqlBatch


    StringBuilder sb;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      SqlBatch b = new SqlBatch("INSERT INTO `raidboss_points` (owner_id, boss_id, points) VALUES");
      for(Entry<Integer, FastMap<Integer, Integer>> pointEntry : _points.entrySet())
      {
        FastMap<Integer, Integer> tmpPoint = pointEntry.getValue();
        if(tmpPoint == null || tmpPoint.isEmpty())
        {
          continue;
        }
        for(Entry<Integer, Integer> pointListEntry : tmpPoint.entrySet())
        {
          if(KEY_RANK.equals(pointListEntry.getKey()) || KEY_TOTAL_POINTS.equals(pointListEntry.getKey()) || pointListEntry.getValue() == null || pointListEntry.getValue() == 0)
          {
            continue;
          }
          sb = new StringBuilder("(");
          sb.append(pointEntry.getKey()).append(","); // игрок
          sb.append(pointListEntry.getKey()).append(","); // босс
          sb.append(pointListEntry.getValue()).append(")"); // количество очков
          b.write(sb.toString());
        }
      }
      if(!b.isEmpty())
      {
        statement.executeUpdate(b.close());
      }
    }
    catch(SQLException e)
    {
      _log.warning("RaidBossSpawnManager: Couldnt update raidboss_points table");
View Full Code Here


      statement.executeUpdate("DELETE FROM character_skills_save WHERE char_obj_id = " + getObjectId() + " AND class_index=" + getActiveClassId() + " AND `end_time` < " + System.currentTimeMillis());
      if(skillReuseTimeStamps.isEmpty())
      {
        return;
      }
      SqlBatch b = new SqlBatch("REPLACE INTO `character_skills_save` (`char_obj_id`,`skill_id`,`class_index`,`end_time`,`reuse_delay_org`) VALUES");
      synchronized(skillReuseTimeStamps)
      {
        StringBuilder sb;
        for(Entry<Integer, SkillTimeStamp> tmp : getSkillReuseTimeStamps().entrySet())
        {
          if(tmp.getValue().hasNotPassed())
          {
            sb = new StringBuilder("(");
            sb.append(getObjectId()).append(",");
            sb.append(tmp.getKey()).append(",");
            sb.append(getActiveClassId()).append(",");
            sb.append(tmp.getValue().getEndTime()).append(",");
            sb.append(tmp.getValue().getReuseBasic()).append(")");
            b.write(sb.toString());
          }
        }
      }
      if(!b.isEmpty())
      {
        statement.executeUpdate(b.close());
      }
    }
    catch(final Exception e)
    {
      _log.warning("Could not store disable skills data: " + e);
View Full Code Here

      if(_effectList == null || _effectList.isEmpty())
      {
        return;
      }
      int order = 0;
      SqlBatch b = new SqlBatch("INSERT IGNORE INTO `character_effects_save` (`char_obj_id`,`skill_id`,`skill_level`,`effect_count`,`effect_cur_time`,`duration`,`order`,`class_index`) VALUES");
      synchronized(getEffectList())
      {
        StringBuilder sb;
        for(L2Effect effect : getEffectList().getAllEffects())
        {
          if(effect != null && effect.isInUse() && !effect.getSkill().isToggle() && effect.getEffectType() != EffectType.HealOverTime && effect.getEffectType() != EffectType.CombatPointHealOverTime)
          {
            if(effect.isSaveable())
            {
              sb = new StringBuilder("(");
              sb.append(getObjectId()).append(",");
              sb.append(effect.getSkill().getId()).append(",");
              sb.append(effect.getSkill().getLevel()).append(",");
              sb.append(effect.getCount()).append(",");
              sb.append(effect.getTime()).append(",");
              sb.append(effect.getPeriod()).append(",");
              sb.append(order).append(",");
              sb.append(getActiveClassId()).append(")");
              b.write(sb.toString());
            }
            while((effect = effect.getNext()) != null && effect.isSaveable())
            {
              sb = new StringBuilder("(");
              sb.append(getObjectId()).append(",");
              sb.append(effect.getSkill().getId()).append(",");
              sb.append(effect.getSkill().getLevel()).append(",");
              sb.append(effect.getCount()).append(",");
              sb.append(effect.getTime()).append(",");
              sb.append(effect.getPeriod()).append(",");
              sb.append(order).append(",");
              sb.append(getActiveClassId()).append(")");
              b.write(sb.toString());
            }
            order++;
          }
        }
        if(Config.ALT_SAVE_UNSAVEABLE && _cubics != null)
        {
          for(L2CubicInstance cubic : _cubics)
          {
            sb = new StringBuilder("(");
            sb.append(getObjectId()).append(",");
            sb.append(cubic.getId() + L2CubicInstance.CUBIC_STORE_OFFSET).append(",");
            sb.append(cubic.getLevel()).append(",1,");
            sb.append(cubic.lifeLeft()).append(",1,");
            sb.append(order++).append(",");
            sb.append(getActiveClassId()).append(")");
            b.write(sb.toString());
          }
        }
      }
      if(!b.isEmpty())
      {
        statement.executeUpdate(b.close());
      }
    }
    catch(final Exception e)
    {
      _log.warning("Could not store active effects data: " + e);
View Full Code Here

      statement.executeUpdate("DELETE FROM character_blocklist WHERE obj_Id=" + getObjectId());
      if(_blockList.isEmpty())
      {
        return;
      }
      SqlBatch b = new SqlBatch("INSERT IGNORE INTO `character_blocklist` (`obj_Id`,`target_Id`) VALUES");
      synchronized(_blockList)
      {
        StringBuilder sb;
        for(Entry<Integer, String> e : _blockList.entrySet())
        {
          sb = new StringBuilder("(");
          sb.append(getObjectId()).append(",");
          sb.append(e.getKey()).append(")");
          b.write(sb.toString());
        }
      }
      if(!b.isEmpty())
      {
        statement.executeUpdate(b.close());
      }
    }
    catch(Exception e)
    {
      _log.warning("Can't store player blocklist " + e);
View Full Code Here

TOP

Related Classes of l2p.util.SqlBatch

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.