Пример #1
0
  /**
   * Used in SM_PRICES
   *
   * @return buyingPrice
   */
  public static final int getGlobalPrices(Race playerRace) {
    int defaultPrices = PricesConfig.DEFAULT_PRICES;

    if (!SiegeConfig.SIEGE_ENABLED) return defaultPrices;

    float influenceValue = 0;
    switch (playerRace) {
      case ASMODIANS:
        influenceValue = Influence.getInstance().getAsmos();
        break;
      case ELYOS:
        influenceValue = Influence.getInstance().getElyos();
        break;
      default:
        influenceValue = 0.5f;
        break;
    }
    if (influenceValue == 0.5f) {
      return defaultPrices;
    } else if (influenceValue > 0.5f) {
      float diff = influenceValue - 0.5f;
      return Math.round(defaultPrices - ((diff / 2) * 100));
    } else {
      float diff = 0.5f - influenceValue;
      return Math.round(defaultPrices + ((diff / 2) * 100));
    }
  }
Пример #2
0
  @Override
  public String handleRequest(String... args) {
    String xml = "<AbyssStatus time=\"" + String.valueOf(System.currentTimeMillis() / 1000) + "\">";

    xml += "<InfluenceRatio Elyos=\"" + String.valueOf(Influence.getInstance().getElyos() * 100);
    xml += "\" Asmodians=\"" + String.valueOf(Influence.getInstance().getAsmos() * 100);
    xml += "\" Balaur=\"" + String.valueOf(Influence.getInstance().getBalaur() * 100);
    xml += "\" />";

    xml +=
        "<AbyssTimer Remains=\""
            + String.valueOf(SiegeService.getInstance().getSiegeTime())
            + "\" />";

    xml += "<Locations>";

    for (SiegeLocation loc : SiegeService.getInstance().getSiegeLocations().values()) {
      if (loc.getSiegeType() == SiegeType.ARTIFACT || loc.getSiegeType() == SiegeType.FORTRESS) {
        xml +=
            "<SiegeLocation id=\""
                + String.valueOf(loc.getLocationId())
                + "\" type=\""
                + loc.getSiegeType().name()
                + "\">";

        xml += "<HoldingRace>" + loc.getRace().name() + "</HoldingRace>";
        xml += "<HoldingLegion>" + String.valueOf(loc.getLegionId()) + "</HoldingLegion>";
        if (loc.getSiegeType() == SiegeType.FORTRESS) {
          xml += "<CurrentStatus>";
          xml += (loc.isVulnerable()) ? "VULNERABLE" : "INVULNERABLE";
          xml += "</CurrentStatus>";
          xml += "<NextStatus>";
          xml += (loc.getNextState() == 0) ? "INVULNERABLE" : "VULNERABLE";
          xml += "</NextStatus>";
        }

        xml += "</SiegeLocation>";
      }
    }

    xml += "</Locations>";

    xml += "</AbyssStatus>";
    return xml;
  }
Пример #3
0
  /**
   * Used in SM_PRICES
   *
   * @return taxes
   */
  public static final int getTaxes(Race playerRace) {
    int defaultTax = PricesConfig.DEFAULT_TAXES;

    if (!SiegeConfig.SIEGE_ENABLED) return defaultTax;

    float influenceValue = 0;
    switch (playerRace) {
      case ASMODIANS:
        influenceValue = Influence.getInstance().getAsmos();
        break;
      case ELYOS:
        influenceValue = Influence.getInstance().getElyos();
        break;
      default:
        influenceValue = 0.5f;
        break;
    }
    if (influenceValue >= 0.5f) {
      return defaultTax;
    }
    float diff = 0.5f - influenceValue;
    return Math.round(defaultTax + ((diff / 4) * 100));
  }