Example #1
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;
  }
  @Override
  protected void writeImpl(AionConnection con, ByteBuffer buf) {
    if (!SiegeConfig.SIEGE_ENABLED) {
      // Siege is Disabled
      writeC(buf, 0);
      writeH(buf, 0);
      return;
    }

    writeC(buf, infoType);
    writeH(buf, locations.size());

    for (SiegeLocation sLoc : locations.values()) {
      writeD(buf, sLoc.getLocationId()); // Artifact ID

      writeD(buf, sLoc.getLegionId()); // Legion ID

      writeD(buf, 0);

      writeD(buf, 0); // unk

      writeC(buf, sLoc.getRace().getRaceId());

      // is vulnerable (0 - no, 2 - yes)
      writeC(buf, sLoc.isVulnerable() ? 2 : 0);

      // faction can teleport (0 - no, 1 - yes)
      writeC(buf, 1);

      // Next State (0 - invulnerable, 1 - vulnerable)
      writeC(buf, sLoc.getNextState());

      writeH(buf, 0); // unk
      writeH(buf, 1);
      switch (sLoc.getLocationId()) {
        case 2111:
          writeD(buf, sLoc.isVulnerable() ? 2 * 60 * 60 : 0); // mastarius & veille timer
          break;
        case 3111:
          writeD(buf, sLoc.isVulnerable() ? 2 * 60 * 60 : 0); // mastarius & veille timer
          break;
        default:
          writeD(buf, 0); // mastarius & veille timer
          break;
      }
    }
  }
 /** @param loc */
 public SM_SIEGE_LOCATION_INFO(SiegeLocation loc) {
   this.infoType = 1; // Update
   locations = new FastMap<Integer, SiegeLocation>();
   locations.put(loc.getLocationId(), loc);
 }