Package l2p.gameserver.templates

Examples of l2p.gameserver.templates.StatsSet


      statement = con.prepareStatement("SELECT char_obj_id, cabal, seal, dawn_red_stones, dawn_green_stones, dawn_blue_stones, dawn_ancient_adena_amount, dawn_contribution_score, dusk_red_stones, dusk_green_stones, dusk_blue_stones, dusk_ancient_adena_amount, dusk_contribution_score FROM seven_signs");
      rset = statement.executeQuery();
      while(rset.next())
      {
        int charObjId = rset.getInt("char_obj_id");
        StatsSet sevenDat = new StatsSet();
        sevenDat.set("char_obj_id", charObjId);
        sevenDat.set("cabal", getCabalNumber(rset.getString("cabal")));
        sevenDat.set("seal", rset.getInt("seal"));
        sevenDat.set("dawn_red_stones", rset.getInt("dawn_red_stones"));
        sevenDat.set("dawn_green_stones", rset.getInt("dawn_green_stones"));
        sevenDat.set("dawn_blue_stones", rset.getInt("dawn_blue_stones"));
        sevenDat.set("dawn_ancient_adena_amount", rset.getInt("dawn_ancient_adena_amount"));
        sevenDat.set("dawn_contribution_score", rset.getInt("dawn_contribution_score"));
        sevenDat.set("dusk_red_stones", rset.getInt("dusk_red_stones"));
        sevenDat.set("dusk_green_stones", rset.getInt("dusk_green_stones"));
        sevenDat.set("dusk_blue_stones", rset.getInt("dusk_blue_stones"));
        sevenDat.set("dusk_ancient_adena_amount", rset.getInt("dusk_ancient_adena_amount"));
        sevenDat.set("dusk_contribution_score", rset.getInt("dusk_contribution_score"));
        _signsPlayerData.put(charObjId, sevenDat);
      }
      DatabaseUtils.closeDatabaseSR(statement, rset);
      statement = con.prepareStatement("SELECT * FROM seven_signs_status");
      rset = statement.executeQuery();
View Full Code Here


    if(oracle == SevenSigns.CABAL_DAWN)
    {
      offsetId += 5;
    }
    // Attempt to retrieve existing score data (if found), otherwise create a new blank data set and display a console warning.
    StatsSet currData = null;
    try
    {
      currData = _festivalData.get(_signsInstance.getCurrentCycle()).get(offsetId);
    }
    catch(Exception e)
    {
      _log.warning("SSF: Error while getting scores");
      _log.warning("oracle=" + oracle + " festivalId=" + festivalId + " offsetId" + offsetId + " _signsCycle" + _signsInstance.getCurrentCycle());
      _log.warning("_festivalData=" + _festivalData.toString());
      e.printStackTrace();
    }
    if(currData == null)
    {
      currData = new StatsSet();
      currData.set("score", 0);
      currData.set("members", "");
      _log.warning("SevenSignsFestival: Data missing for " + SevenSigns.getCabalName(oracle) + ", FestivalID = " + festivalId + " (Current Cycle " + _signsInstance.getCurrentCycle() + ")");
    }
    return currData;
  }
View Full Code Here

   * @param festivalId
   * @return StatsSet result
   */
  public StatsSet getOverallHighestScoreData(int festivalId)
  {
    StatsSet result = null;
    int highestScore = 0;
    for(Map<Integer, StatsSet> currCycleData : _festivalData.values())
    {
      for(StatsSet currFestData : currCycleData.values())
      {
View Full Code Here

    {
      thisCabalHighScore = currDuskHighScore;
      otherCabalHighScore = currDawnHighScore;
      _duskFestivalScores.put(festivalId, offeringScore);
    }
    StatsSet currFestData = getHighestScoreData(oracle, festivalId);
    // Check if this is the highest score for this level range so far for the player's cabal.
    if(offeringScore > thisCabalHighScore)
    {
      // If the current score is greater than that for the other cabal, then they already have the points from this festival.
      //if(thisCabalHighScore > otherCabalHighScore)
      //  return false;
      // Update the highest scores and party list.
      currFestData.set("date", String.valueOf(System.currentTimeMillis()));
      currFestData.set("score", offeringScore);
      currFestData.set("members", implodeString(partyMemberIds));
      currFestData.set("names", implodeString(partyMembers));
      // Only add the score to the cabal's overall if it's higher than the other cabal's score.
      if(offeringScore > otherCabalHighScore)
      {
        _signsInstance.updateFestivalScore();
      }
View Full Code Here

    }
    for(int i = 0; i < FESTIVAL_COUNT; i++)
    {
      if(result[i][0] != SevenSigns.CABAL_NULL)
      {
        StatsSet high = getHighestScoreData((int) result[i][0], i);
        String membersString = high.getString("members");
        long add = draw_count > 0 ? draw_score / draw_count : 0;
        String[] members = membersString.split(",");
        long count = (_accumulatedBonuses[i] + add) / members.length;
        for(String pIdStr : members)
        {
View Full Code Here

   */
  public int setPlayerInfo(int charObjId, int chosenCabal, int chosenSeal)
  {
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    StatsSet currPlayer = null;
    if(hasRegisteredBefore(charObjId))
    {
      // If the seal validation period has passed,
      // cabal information was removed and so "re-register" player
      currPlayer = _signsPlayerData.get(charObjId);
      currPlayer.set("cabal", chosenCabal);
      currPlayer.set("seal", chosenSeal);
      _signsPlayerData.put(charObjId, currPlayer);
    }
    else
    {
      currPlayer = new StatsSet();
      currPlayer.set("char_obj_id", charObjId);
      currPlayer.set("cabal", chosenCabal);
      currPlayer.set("seal", chosenSeal);
      currPlayer.set("dawn_red_stones", 0);
      currPlayer.set("dawn_green_stones", 0);
      currPlayer.set("dawn_blue_stones", 0);
      currPlayer.set("dawn_ancient_adena_amount", 0);
      currPlayer.set("dawn_contribution_score", 0);
      currPlayer.set("dusk_red_stones", 0);
      currPlayer.set("dusk_green_stones", 0);
      currPlayer.set("dusk_blue_stones", 0);
      currPlayer.set("dusk_ancient_adena_amount", 0);
      currPlayer.set("dusk_contribution_score", 0);
      _signsPlayerData.put(charObjId, currPlayer);
      // Update data in database, as we have a new player signing up.
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("INSERT INTO seven_signs (char_obj_id, cabal, seal) VALUES (?,?,?)");
        statement.setInt(1, charObjId);
        statement.setString(2, getCabalShortName(chosenCabal));
        statement.setInt(3, chosenSeal);
        statement.execute();
      }
      catch(SQLException e)
      {
        _log.severe("SevenSigns: Failed to save data: " + e);
      }
      finally
      {
        DatabaseUtils.closeDatabaseCS(con, statement);
      }
    }
    long contribScore = 0;
    switch(chosenCabal)
    {
      case CABAL_DAWN:
        contribScore = calcContributionScore(currPlayer.getInteger("dawn_blue_stones"), currPlayer.getInteger("dawn_green_stones"), currPlayer.getInteger("dawn_red_stones"));
        _dawnStoneScore += contribScore;
        break;
      case CABAL_DUSK:
        contribScore = calcContributionScore(currPlayer.getInteger("dusk_blue_stones"), currPlayer.getInteger("dusk_green_stones"), currPlayer.getInteger("dusk_red_stones"));
        _duskStoneScore += contribScore;
        break;
    }
    // Increasing Seal total score for the player chosen Seal.
    if(currPlayer.getInteger("cabal") == CABAL_DAWN)
    {
      _signsDawnSealTotals.put(chosenSeal, _signsDawnSealTotals.get(chosenSeal) + 1);
    }
    else
    {
View Full Code Here

   * @return int rewardAmount
   */
  public int getAncientAdenaReward(L2Player player, boolean removeReward)
  {
    int charObjId = player.getObjectId();
    StatsSet currPlayer = _signsPlayerData.get(charObjId);
    int rewardAmount = 0;
    if(currPlayer.getInteger("cabal") == CABAL_DAWN)
    {
      rewardAmount = currPlayer.getInteger("dawn_ancient_adena_amount");
      currPlayer.set("dawn_ancient_adena_amount", 0);
    }
    else
    {
      rewardAmount = currPlayer.getInteger("dusk_ancient_adena_amount");
      currPlayer.set("dusk_ancient_adena_amount", 0);
    }
    if(removeReward)
    {
      _signsPlayerData.put(charObjId, currPlayer);
      saveSevenSignsData(charObjId, false);
View Full Code Here

    return addPlayerStoneContrib(player.getObjectId(), blueCount, greenCount, redCount);
  }

  public long addPlayerStoneContrib(int charObjId, long blueCount, long greenCount, long redCount)
  {
    StatsSet currPlayer = _signsPlayerData.get(charObjId);
    long contribScore = calcContributionScore(blueCount, greenCount, redCount);
    long totalAncientAdena = 0;
    long totalContribScore = 0;
    if(currPlayer.getInteger("cabal") == CABAL_DAWN)
    {
      totalAncientAdena = currPlayer.getInteger("dawn_ancient_adena_amount") + calcAncientAdenaReward(blueCount, greenCount, redCount);
      totalContribScore = currPlayer.getInteger("dawn_contribution_score") + contribScore;
      if(totalContribScore > MAXIMUM_PLAYER_CONTRIB)
      {
        return -1;
      }
      currPlayer.set("dawn_red_stones", currPlayer.getInteger("dawn_red_stones") + redCount);
      currPlayer.set("dawn_green_stones", currPlayer.getInteger("dawn_green_stones") + greenCount);
      currPlayer.set("dawn_blue_stones", currPlayer.getInteger("dawn_blue_stones") + blueCount);
      currPlayer.set("dawn_ancient_adena_amount", totalAncientAdena);
      currPlayer.set("dawn_contribution_score", totalContribScore);
      _signsPlayerData.put(charObjId, currPlayer);
      _dawnStoneScore += contribScore;
    }
    else
    {
      totalAncientAdena = currPlayer.getInteger("dusk_ancient_adena_amount") + calcAncientAdenaReward(blueCount, greenCount, redCount);
      totalContribScore = currPlayer.getInteger("dusk_contribution_score") + contribScore;
      if(totalContribScore > MAXIMUM_PLAYER_CONTRIB)
      {
        return -1;
      }
      currPlayer.set("dusk_red_stones", currPlayer.getInteger("dusk_red_stones") + redCount);
      currPlayer.set("dusk_green_stones", currPlayer.getInteger("dusk_green_stones") + greenCount);
      currPlayer.set("dusk_blue_stones", currPlayer.getInteger("dusk_blue_stones") + blueCount);
      currPlayer.set("dusk_ancient_adena_amount", totalAncientAdena);
      currPlayer.set("dusk_contribution_score", totalContribScore);
      _signsPlayerData.put(charObjId, currPlayer);
      _duskStoneScore += contribScore;
    }
    saveSevenSignsData(charObjId, true);
    return contribScore;
View Full Code Here

    _speed2 = 2000;
    if(isClanAirShip())
    {
      _owner.setAirship(this);
      _fuel = owner.getAirshipFuel();
      StatsSet npcDat = L2NpcTemplate.getEmptyStatsSet();
      npcDat.set("npcId", 0);
      npcDat.set("name", "Helm");
      npcDat.set("type", "L2StaticObject");
      L2NpcTemplate template = new L2NpcTemplate(npcDat);
      L2StaticObjectInstance controlKey = new L2StaticObjectInstance(_owner.getClanId(), template);
      controlKey.setType(3);
      controlKey.setLoc(getLoc());
      _controlKey = controlKey;
View Full Code Here

    {
      DatabaseUtils.closeDatabaseCS(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, Olympiad.DEFAULT_POINTS);
      if(compDone >= 9)
      {
        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);
    }
  }
View Full Code Here

TOP

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