Package lineage2.gameserver.templates

Examples of lineage2.gameserver.templates.StatsSet


      int classId = noble.getBaseClassId();
      if (classId < 139)
      {
        return;
      }
      StatsSet statDat = new StatsSet();
      statDat.set(CLASS_ID, classId);
      statDat.set(CHAR_NAME, noble.getName());
      statDat.set(POINTS, Config.OLYMPIAD_POINTS_DEFAULT);
      statDat.set(POINTS_PAST, 0);
      statDat.set(POINTS_PAST_STATIC, 0);
      statDat.set(COMP_DONE, 0);
      statDat.set(COMP_WIN, 0);
      statDat.set(COMP_LOOSE, 0);
      statDat.set(GAME_CLASSES_COUNT, 0);
      statDat.set(GAME_NOCLASSES_COUNT, 0);
      _nobles.put(noble.getObjectId(), statDat);
      OlympiadDatabase.saveNobleData(noble.getObjectId());
    }
  }
View Full Code Here


  /**
   * Method incGameCount.
   */
  public void incGameCount()
  {
    StatsSet set = getStat();
    switch (_type)
    {
      case CLASSED:
        set.set(Olympiad.GAME_CLASSES_COUNT, set.getInteger(Olympiad.GAME_CLASSES_COUNT) + 1);
        break;
      case NON_CLASSED:
        set.set(Olympiad.GAME_NOCLASSES_COUNT, set.getInteger(Olympiad.GAME_NOCLASSES_COUNT) + 1);
        break;
      default:
        break;
    }
  }
View Full Code Here

   */
  public void takePointsForCrash()
  {
    if (!checkPlayer())
    {
      StatsSet stat = getStat();
      int points = stat.getInteger(Olympiad.POINTS);
      int diff = Math.min(OlympiadGame.MAX_POINTS_LOOSE, points / _type.getLooseMult());
      stat.set(Olympiad.POINTS, points - diff);
      Log.add("Olympiad Result: " + _name + " lost " + diff + " points for crash", "olympiad");
      Player player = _player;
      if (player == null)
      {
        Log.add("Olympiad info: " + _name + " crashed coz player == null", "olympiad");
View Full Code Here

    {
      DbUtils.closeQuietly(con, statement);
    }
    for (Integer nobleId : Olympiad._nobles.keySet())
    {
      StatsSet nobleInfo = Olympiad._nobles.get(nobleId);
      int points = nobleInfo.getInteger(Olympiad.POINTS);
      int compDone = nobleInfo.getInteger(Olympiad.COMP_DONE);
      nobleInfo.set(Olympiad.POINTS, Config.OLYMPIAD_POINTS_DEFAULT);
      if (compDone >= Config.OLYMPIAD_BATTLES_FOR_REWARD)
      {
        nobleInfo.set(Olympiad.POINTS_PAST, points);
        nobleInfo.set(Olympiad.POINTS_PAST_STATIC, points);
      }
      else
      {
        nobleInfo.set(Olympiad.POINTS_PAST, 0);
        nobleInfo.set(Olympiad.POINTS_PAST_STATIC, 0);
      }
      nobleInfo.set(Olympiad.COMP_DONE, 0);
      nobleInfo.set(Olympiad.COMP_WIN, 0);
      nobleInfo.set(Olympiad.COMP_LOOSE, 0);
      nobleInfo.set(Olympiad.GAME_CLASSES_COUNT, 0);
      nobleInfo.set(Olympiad.GAME_NOCLASSES_COUNT, 0);
    }
  }
View Full Code Here

    PreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      StatsSet hero;
      for (ClassId id : ClassId.VALUES)
      {
        if (id.getId() > 138)
        {
          statement = con.prepareStatement(OlympiadNobleDAO.OLYMPIAD_GET_HEROS);
          statement.setInt(1, id.getId());
          statement.setInt(2, Config.OLYMPIAD_BATTLES_FOR_REWARD);
          rset = statement.executeQuery();
          if (rset.next())
          {
            hero = new StatsSet();
            hero.set(Olympiad.CLASS_ID, id.getId());
            hero.set(Olympiad.CHAR_ID, rset.getInt(Olympiad.CHAR_ID));
            hero.set(Olympiad.CHAR_NAME, rset.getString(Olympiad.CHAR_NAME));
            Olympiad._heroesToBe.add(hero);
          }
          DbUtils.close(statement, rset);
        }
      }
View Full Code Here

        TeamMember member1 = ArrayUtils.valid(teamMembers1, i);
        TeamMember member2 = ArrayUtils.valid(teamMembers2, i);
        if (member1 != null)
        {
          member1.incGameCount();
          StatsSet stat1 = member1.getStat();
          packet.addPlayer(0, member1, -2);
          stat1.set(Olympiad.POINTS, stat1.getInteger(Olympiad.POINTS) - 2);
        }
        if (member2 != null)
        {
          member2.incGameCount();
          StatsSet stat2 = member2.getStat();
          packet.addPlayer(1, member2, -2);
          stat2.set(Olympiad.POINTS, stat2.getInteger(Olympiad.POINTS) - 2);
        }
      }
      catch (Exception e)
      {
        _log.error("OlympiadGame.tie(): " + e, e);
View Full Code Here

      con = DatabaseFactory.getInstance().getConnection();
      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, Olympiad.getNobleName(charId));
        hero.set(Olympiad.CLASS_ID, Olympiad.getNobleClass(charId));
        hero.set(COUNT, rset.getInt(COUNT));
        hero.set(PLAYED, rset.getInt(PLAYED));
        hero.set(ACTIVE, rset.getInt(ACTIVE));
        HeroSetClanAndAlly(charId, hero);
        loadDiary(charId);
        loadMessage(charId);
        _heroes.put(charId, hero);
      }
      DbUtils.close(statement, rset);
      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, Olympiad.getNobleName(charId));
        hero.set(Olympiad.CLASS_ID, Olympiad.getNobleClass(charId));
        hero.set(COUNT, rset.getInt(COUNT));
        hero.set(PLAYED, rset.getInt(PLAYED));
        hero.set(ACTIVE, rset.getInt(ACTIVE));
        HeroSetClanAndAlly(charId, hero);
        _completeHeroes.put(charId, hero);
      }
    }
    catch (SQLException e)
View Full Code Here

    for (StatsSet hero : newHeroes)
    {
      int charId = hero.getInteger(Olympiad.CHAR_ID);
      if ((_completeHeroes != null) && _completeHeroes.containsKey(charId))
      {
        StatsSet oldHero = _completeHeroes.get(charId);
        int count = oldHero.getInteger(COUNT);
        oldHero.set(COUNT, count + 1);
        oldHero.set(PLAYED, 1);
        oldHero.set(ACTIVE, 0);
        heroes.put(charId, oldHero);
      }
      else
      {
        StatsSet newHero = new StatsSet();
        newHero.set(Olympiad.CHAR_NAME, hero.getString(Olympiad.CHAR_NAME));
        newHero.set(Olympiad.CLASS_ID, hero.getInteger(Olympiad.CLASS_ID));
        newHero.set(COUNT, 1);
        newHero.set(PLAYED, 1);
        newHero.set(ACTIVE, 0);
        heroes.put(charId, newHero);
      }
      addHeroDiary(charId, HeroDiary.ACTION_HERO_GAINED, 0);
      loadDiary(charId);
    }
View Full Code Here

      {
        if ((id > 0) && (heroId != id))
        {
          continue;
        }
        StatsSet hero = _heroes.get(heroId);
        statement.setInt(1, heroId);
        statement.setInt(2, hero.getInteger(COUNT));
        statement.setInt(3, hero.getInteger(PLAYED));
        statement.setInt(4, hero.getInteger(ACTIVE));
        statement.execute();
        if ((_completeHeroes != null) && !_completeHeroes.containsKey(heroId))
        {
          HeroSetClanAndAlly(heroId, hero);
          _completeHeroes.put(heroId, hero);
View Full Code Here

   * Method activateHero.
   * @param player Player
   */
  public void activateHero(Player player)
  {
    StatsSet hero = _heroes.get(player.getObjectId());
    hero.set(ACTIVE, 1);
    _heroes.remove(player.getObjectId());
    _heroes.put(player.getObjectId(), hero);
    if (player.getBaseClassId() == player.getActiveClassId())
    {
      addSkills(player);
View Full Code Here

TOP

Related Classes of lineage2.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.