Package com.l2jfrozen.gameserver.templates

Examples of com.l2jfrozen.gameserver.templates.StatsSet


      statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
      rset = statement.executeQuery();
     
      while (rset.next())
      {
        StatsSet statData = new StatsSet();
        int charId = rset.getInt(CHAR_ID);
        statData.set(CLASS_ID, rset.getInt(CLASS_ID));
        statData.set(CHAR_NAME, rset.getString(CHAR_NAME));
        statData.set(POINTS, rset.getInt(POINTS));
        statData.set(COMP_DONE, rset.getInt(COMP_DONE));
        statData.set(COMP_WON, rset.getInt(COMP_WON));
        statData.set(COMP_LOST, rset.getInt(COMP_LOST));
        statData.set(COMP_DRAWN, rset.getInt(COMP_DRAWN));
        statData.set("to_save", false);
       
        _nobles.put(charId, statData);
      }
    }
    catch (Exception e)
    {
      _log.info( "Olympiad System: Error loading noblesse data from database: ");
    }
    finally
    {
      DatabaseUtils.closeDatabaseCSR(con, statement, rset);
    }

    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(OLYMPIAD_LOAD_OLD_NOBLES);
      rset = statement.executeQuery();

      while (rset.next())
      {
        StatsSet statData = new StatsSet();
        int charId = rset.getInt(CHAR_ID);
        statData.set(CLASS_ID, rset.getInt(CLASS_ID));
        statData.set(CHAR_NAME, rset.getString(CHAR_NAME));
        statData.set(POINTS, rset.getInt(POINTS));
        statData.set(COMP_DONE, rset.getInt(COMP_DONE));
        statData.set(COMP_WON, rset.getInt(COMP_WON));
        statData.set(COMP_LOST, rset.getInt(COMP_LOST));
        statData.set(COMP_DRAWN, rset.getInt(COMP_DRAWN));
        statData.set("to_save", false);

        _oldnobles.put(charId, statData);
      }
    }
    catch (Exception e)
View Full Code Here


        long respawnTime = (long) (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
        startQuestTimer("zaken_unlock", respawnTime, null, null);
        cancelQuestTimer("1001", npc, null);
        cancelQuestTimer("1003", npc, null);
        // also save the respawn time so that the info is maintained past reboots
        StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
        info.set("respawn_time", System.currentTimeMillis() + respawnTime);
        GrandBossManager.getInstance().setStatsSet(ZAKEN, info);     
     
    }
    else if (status == ALIVE)
    {
View Full Code Here

        addStartNpc(STONE_BAIUM);
        addStartNpc(ANGELIC_VORTEX);
        addTalkId(STONE_BAIUM);
        addTalkId(ANGELIC_VORTEX);
        _Zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
        StatsSet info = GrandBossManager.getInstance().getStatsSet(LIVE_BAIUM);

        Integer status = GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM);

        if (status == DEAD) {
            // load the unlock date and time for baium from DB
            long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
            if (temp > 0) {
                // the unlock time has not yet expired.  Mark Baium as currently locked (dead).  Setup a timer
                // to fire at the correct time (calculate the time between now and the unlock time,
                // setup a timer to fire after that many msec)
                startQuestTimer("baium_unlock", temp, null, null);
            } else {
                // the time has already expired while the server was offline.  Delete the saved time and
                // immediately spawn the stone-baium.  Also the state need not be changed from ASLEEP
                addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);

                if (Config.ANNOUNCE_TO_ALL_SPAWN_RB) {
                    Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
                }
                GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP);
            }
        } else if (status == AWAKE) {
            int loc_x = info.getInteger("loc_x");
            int loc_y = info.getInteger("loc_y");
            int loc_z = info.getInteger("loc_z");
            int heading = info.getInteger("heading");
            final int hp = info.getInteger("currentHP");
            final int mp = info.getInteger("currentMP");
            L2GrandBossInstance baium = (L2GrandBossInstance) addSpawn(LIVE_BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
            if (Config.ANNOUNCE_TO_ALL_SPAWN_RB) {
                Announcements.getInstance().announceToAll("Raid boss " + baium.getName() + " spawned in world.");
            }
            GrandBossManager.getInstance().addBoss(baium);
View Full Code Here

            // "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 +  1*3,600,000 + random-less-than(8*3,600,000) millisecs]
            long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
            GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
            startQuestTimer("baium_unlock", respawnTime, null, null);
            // also save the respawn time so that the info is maintained past reboots
            StatsSet info = GrandBossManager.getInstance().getStatsSet(LIVE_BAIUM);
            info.set("respawn_time", System.currentTimeMillis() + respawnTime);
            GrandBossManager.getInstance().setStatsSet(LIVE_BAIUM, info);
        }

        for (L2NpcInstance minion : _Minions)
            if (minion != null) {
View Full Code Here

      addEventId(mob, Quest.QuestEventType.ON_KILL);
      addEventId(mob, Quest.QuestEventType.ON_ATTACK);
    }

    _FirstAttacked = false;
    StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE);
   
    Integer status = GrandBossManager.getInstance().getBossStatus(CORE);
   
    if(status == DEAD)
    {
      // load the unlock date and time for Core from DB
      long temp = info.getLong("respawn_time") - System.currentTimeMillis();
      if(temp > 0)
      {
        startQuestTimer("core_unlock", temp, null, null);
      }
      else
View Full Code Here

        GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
        //time is 60hour  +/- 23hour
        long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
        startQuestTimer("core_unlock", respawnTime, null, null);
        // also save the respawn time so that the info is maintained past reboots
        StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE);
        info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
        GrandBossManager.getInstance().setStatsSet(CORE, info);
        startQuestTimer("despawn_minions", 20000, null, null);
       
      }
     
View Full Code Here

        if(val.equalsIgnoreCase("$player_max_mp"))
          return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_MP);

        // try to find value out of item fields
        StatsSet set = getStatsSet();
        String field = set.getString(val.substring(1));
        if(field != null)
          return new LambdaConst(Double.parseDouble(getValue(field, template)));
        // failed
        throw new IllegalArgumentException("Unknown value " + val);
      }
View Full Code Here

   
    Integer status = GrandBossManager.getInstance().getBossStatus(ANTHARASOLDID);
   
    if (FWA_OLDANTHARAS || status == WAITING)
    {
      StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARASOLDID);
      Long respawnTime = info.getLong("respawn_time");
      if (status == DEAD && respawnTime <= System.currentTimeMillis())
      {
        // the time has already expired while the server was offline. Immediately spawn antharas in his cave.
        // also, the status needs to be changed to DORMANT
        GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID,DORMANT);
        status = DORMANT;
      }
      else if (status == FIGHTING)
      {
        int loc_x = info.getInteger("loc_x");
        int loc_y = info.getInteger("loc_y");
        int loc_z = info.getInteger("loc_z");
        int heading = info.getInteger("heading");
        int hp = info.getInteger("currentHP");
        int mp = info.getInteger("currentMP");
        _antharas = (L2GrandBossInstance) addSpawn(ANTHARASOLDID,loc_x,loc_y,loc_z,heading,false,0);
        GrandBossManager.getInstance().addBoss(_antharas);
        _antharas.setCurrentHpMp(hp,mp);
        _LastAction = System.currentTimeMillis();
        // Start repeating timer to check for inactivity
        _activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
      }
      else if (status == DEAD)
      {
        ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(ANTHARASOLDID), respawnTime - System.currentTimeMillis());
      }
      else
      {
        setAntharasSpawnTask();
      }
    }
    else
    {
      Integer statusWeak = GrandBossManager.getInstance().getBossStatus(ANTHARASWEAKID);
     
     
      Integer statusNormal = GrandBossManager.getInstance().getBossStatus(ANTHARASNORMALID);
     
     
      Integer statusStrong = GrandBossManager.getInstance().getBossStatus(ANTHARASSTRONGID);
     
      int antharasId = 0;
      if (statusWeak == FIGHTING || statusWeak == DEAD)
      {
        antharasId = ANTHARASWEAKID;
        status = statusWeak;
      }
      else if (statusNormal == FIGHTING || statusNormal == DEAD)
      {
        antharasId = ANTHARASNORMALID;
        status = statusNormal;
      }
      else if (statusStrong == FIGHTING || statusStrong == DEAD)
      {
        antharasId = ANTHARASSTRONGID;
        status = statusStrong;
      }
      if (antharasId != 0 && status == FIGHTING)
      {
        StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
        int loc_x = info.getInteger("loc_x");
        int loc_y = info.getInteger("loc_y");
        int loc_z = info.getInteger("loc_z");
        int heading = info.getInteger("heading");
        int hp = info.getInteger("currentHP");
        int mp = info.getInteger("currentMP");
        _antharas = (L2GrandBossInstance) addSpawn(antharasId,loc_x,loc_y,loc_z,heading,false,0);
        GrandBossManager.getInstance().addBoss(_antharas);
        _antharas.setCurrentHpMp(hp,mp);
        _LastAction = System.currentTimeMillis();
        // Start repeating timer to check for inactivity
        _activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
      }
      else if (antharasId != 0 && status == DEAD)
      {
        StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
        Long respawnTime = info.getLong("respawn_time");
        if (respawnTime <= System.currentTimeMillis())
        {
          // the time has already expired while the server was offline. Immediately spawn antharas in his cave.
          // also, the status needs to be changed to DORMANT
          GrandBossManager.getInstance().setBossStatus(antharasId,DORMANT);
View Full Code Here

        _cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(0), 10000);
        GrandBossManager.getInstance().setBossStatus(npc.getNpcId(),DEAD);
        long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
        ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(npc.getNpcId()), respawnTime);
        // also save the respawn time so that the info is maintained past reboots
        StatsSet info = GrandBossManager.getInstance().getStatsSet(npc.getNpcId());
        info.set("respawn_time",(System.currentTimeMillis() + respawnTime));
        GrandBossManager.getInstance().setStatsSet(npc.getNpcId(),info);
      }
     
    }
    else if (npc.getNpcId() == 29069)
View Full Code Here

      con = L2DatabaseFactory.getInstance().getConnection(false);
      statement = con.prepareStatement(GET_HEROES);
      rset = statement.executeQuery();
      while (rset.next())
      {
        StatsSet hero = new StatsSet();
        int charId = rset.getInt(Olympiad.CHAR_ID);
        hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME));
        hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID));
        hero.set(COUNT, rset.getInt(COUNT));
        hero.set(PLAYED, rset.getInt(PLAYED));
        statement2 = con.prepareStatement(GET_CLAN_ALLY);
        statement2.setInt(1, charId);
        rset2 = statement2.executeQuery();
        if (rset2.next())
        {
          int clanId = rset2.getInt("clanid");
          int allyId = rset2.getInt("allyId");
          String clanName = "";
          String allyName = "";
          int clanCrest = 0;
          int allyCrest = 0;
          if (clanId > 0)
          {
            clanName = ClanTable.getInstance().getClan(clanId).getName();
            clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId();
            if (allyId > 0)
            {
              allyName = ClanTable.getInstance().getClan(clanId).getAllyName();
              allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId();
            }
          }
          hero.set(CLAN_CREST, clanCrest);
          hero.set(CLAN_NAME, clanName);
          hero.set(ALLY_CREST, allyCrest);
          hero.set(ALLY_NAME, allyName);
        }
        rset2.close();
        statement2.close();
        _heroes.put(charId, hero);
      }
      rset.close();
      statement.close();
      statement = con.prepareStatement(GET_ALL_HEROES);
      rset = statement.executeQuery();
      while (rset.next())
      {
        StatsSet hero = new StatsSet();
        int charId = rset.getInt(Olympiad.CHAR_ID);
        hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME));
        hero.set(Olympiad.CLASS_ID, rset.getInt(Olympiad.CLASS_ID));
        hero.set(COUNT, rset.getInt(COUNT));
        hero.set(PLAYED, rset.getInt(PLAYED));
        statement2 = con.prepareStatement(GET_CLAN_ALLY);
        statement2.setInt(1, charId);
        rset2 = statement2.executeQuery();
        if (rset2.next())
        {
          int clanId = rset2.getInt("clanid");
          int allyId = rset2.getInt("allyId");
          String clanName = "";
          String allyName = "";
          int clanCrest = 0;
          int allyCrest = 0;
          if (clanId > 0)
          {
            clanName = ClanTable.getInstance().getClan(clanId).getName();
            clanCrest = ClanTable.getInstance().getClan(clanId).getCrestId();
            if (allyId > 0)
            {
              allyName = ClanTable.getInstance().getClan(clanId).getAllyName();
              allyCrest = ClanTable.getInstance().getClan(clanId).getAllyCrestId();
            }
          }
          hero.set(CLAN_CREST, clanCrest);
          hero.set(CLAN_NAME, clanName);
          hero.set(ALLY_CREST, allyCrest);
          hero.set(ALLY_NAME, allyName);
        }
        rset2.close();
        statement2.close();
        _completeHeroes.put(charId, hero);
      }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.templates.StatsSet

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.