Example #1
0
  public String generateItemTemplateEffects(int id) {
    if (!itemsEffects.containsKey(id)) {
      ItemTemplate template = DAOFactory.item().getById(id);

      if (template == null) return "";

      StringBuilder strEffects = new StringBuilder();

      for (String effect : Utils.split(template.statsTemplate, ",")) {
        if (effect.isEmpty()) continue;

        try {
          short effectID = Short.parseShort(Utils.split(effect, "#")[0], 16);

          if (EffectsHandler.instance().getEffect(effectID) != null)
            strEffects.append(effect).append(',');
        } catch (Exception e) {
          Loggin.warning("cannot generate effects string %s for template %d", effect, id);
        }
      }

      itemsEffects.put(id, strEffects.toString());
    }

    return itemsEffects.get(id);
  }
Example #2
0
  public static Stats getBaseStats(String strStats) {
    Stats stats = new Stats();

    if (strStats == null || strStats.isEmpty()) return stats;

    for (String data : Utils.split(strStats, "|")) {
      if (data.isEmpty()) continue;
      String[] arr = Utils.split(data, ";");

      if (arr.length < 2) continue;

      try {
        int elemID = Integer.parseInt(arr[0]);
        int qu = Integer.parseInt(arr[1]);
        stats.add(elemID, qu);
      } catch (Exception e) {
        Loggin.error("Cannot parse stats '" + data + "'", e);
      }
    }

    return stats;
  }
  public long getWinExperience(PlayerFighter fighter, int winTeamLevel, int loseTeamLevel) {
    if (Config.RATE_DEFIANCE.getValue() <= 0) return 0;

    double fact = loseTeamLevel / winTeamLevel;
    fact *= Config.RATE_DEFIANCE.getValue();
    fact *= (10 / fighter.getLevel()) + 1;
    fact *=
        (double)
            (((double) fighter.getPlayer().getTotalStats().get(Stats.Element.SAGESSE) / 100)
                + (double) 1);

    Pair<Experience, Experience> xps = ExperienceHandler.instance().getLevel(fighter.getLevel());
    long inter = xps.getSecond().player - xps.getFirst().player;

    long ret = (long) (Utils.randLong((long) (0.01 * inter), (long) (0.1 * inter)) * fact);

    if (ret < 0) ret = 0;

    return ret;
  }
Example #4
0
 @Override
 public void displayValue() {
   Shell.println(
       Utils.getUptime(), Shell.GraphicRenditionEnum.YELLOW, Shell.GraphicRenditionEnum.BOLD);
 }