Examples of StatsSet


Examples of net.sf.l2j.gameserver.templates.StatsSet

            {
                PreparedStatement statement;

                for (Integer heroId : _heroes.keySet())
                {
                    StatsSet hero = _heroes.get(heroId);

                    if (_completeHeroes == null || !_completeHeroes.containsKey(heroId))
                    {
                        statement = con.prepareStatement(INSERT_HERO);
                        statement.setInt(1, heroId);
                        statement.setString(2, hero.getString(Olympiad.CHAR_NAME));
                        statement.setInt(3, hero.getInteger(Olympiad.CLASS_ID));
                        statement.setInt(4, hero.getInteger(COUNT));
                        statement.setInt(5, hero.getInteger(PLAYED));
                        statement.execute();

                        Connection con2 = L2DatabaseFactory.getInstance().getConnection();
                        PreparedStatement statement2 = con2.prepareStatement(GET_CLAN_ALLY);
                        statement2.setInt(1, heroId);
                        ResultSet 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();
                        con2.close();

                        _heroes.remove(hero);
                        _heroes.put(heroId, hero);

                        _completeHeroes.put(heroId, hero);
                    }
                    else
                    {
                        statement = con.prepareStatement(UPDATE_HERO);
                        statement.setInt(1, hero.getInteger(COUNT));
                        statement.setInt(2, hero.getInteger(PLAYED));
                        statement.setInt(3, heroId);
                        statement.execute();
                    }

                    statement.close();
View Full Code Here

Examples of net.sf.l2j.gameserver.templates.StatsSet

                if (val.equalsIgnoreCase("$player_max_hp"))
                    return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_HP);
                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
View Full Code Here

Examples of net.sf.l2j.gameserver.templates.StatsSet

        _currentSkill.enchsets1   = new StatsSet[enchantLevels1];
        _currentSkill.enchsets2   = new StatsSet[enchantLevels2];

    for (int i=0; i < lastLvl; i++)
    {
            _currentSkill.sets[i] = new StatsSet();
            _currentSkill.sets[i].set("skill_id", _currentSkill.id);
            _currentSkill.sets[i].set("level",    i+1);
            _currentSkill.sets[i].set("name",     _currentSkill.name);
    }

    if (_currentSkill.sets.length != lastLvl)
      throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+lastLvl+" levels expected");

    Node first = n.getFirstChild();
    for (n=first; n != null; n = n.getNextSibling())
    {
      if ("table".equalsIgnoreCase(n.getNodeName()))
        parseTable(n);
    }
    for (int i=1; i <= lastLvl; i++)
    {
      for (n=first; n != null; n = n.getNextSibling())
      {
        if ("set".equalsIgnoreCase(n.getNodeName()))
          parseBeanSet(n, _currentSkill.sets[i-1], i);
      }
    }
    for (int i=0; i < enchantLevels1; i++)
        {
            _currentSkill.enchsets1[i] = new StatsSet();
            _currentSkill.enchsets1[i].set("skill_id", _currentSkill.id);
            //currentSkill.enchsets1[i] = currentSkill.sets[currentSkill.sets.length-1];
            _currentSkill.enchsets1[i].set("level",    i+101);
            _currentSkill.enchsets1[i].set("name",     _currentSkill.name);
            //currentSkill.enchsets1[i].set("skillType",     "NOTDONE");

            for (n=first; n != null; n = n.getNextSibling())
            {
                if ("set".equalsIgnoreCase(n.getNodeName()))
                    parseBeanSet(n, _currentSkill.enchsets1[i], _currentSkill.sets.length);
            }

            for (n=first; n != null; n = n.getNextSibling())
            {
                if ("enchant1".equalsIgnoreCase(n.getNodeName()))
                    parseBeanSet(n, _currentSkill.enchsets1[i], i+1);
            }
        }

        if (_currentSkill.enchsets1.length != enchantLevels1)
            throw new RuntimeException("Skill id="+skillId+" number of levels missmatch, "+enchantLevels1+" levels expected");

        for (int i=0; i < enchantLevels2; i++)
        {
            _currentSkill.enchsets2[i] = new StatsSet();
            //currentSkill.enchsets2[i] = currentSkill.sets[currentSkill.sets.length-1];
            _currentSkill.enchsets2[i].set("skill_id", _currentSkill.id);
            _currentSkill.enchsets2[i].set("level",    i+141);
            _currentSkill.enchsets2[i].set("name",     _currentSkill.name);
            //currentSkill.enchsets2[i].set("skillType",     "NOTDONE");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.