コード例 #1
0
ファイル: TangibleObject.java プロジェクト: Nazath/NGECore2
  public void showFlyText(
      String stfFile,
      String stfString,
      String customText,
      int xp,
      float scale,
      RGB color,
      int displayType) {
    Set<Client> observers = getObservers();

    if (getClient() != null) {
      getClient()
          .getSession()
          .write(
              (new ObjControllerMessage(
                      0x0000000B,
                      new ShowFlyText(
                          getObjectID(),
                          getObjectID(),
                          56,
                          1,
                          1,
                          -1,
                          stfFile,
                          stfString,
                          customText,
                          xp,
                          scale,
                          color,
                          displayType)))
                  .serialize());
    }

    for (Client client : observers) {
      client
          .getSession()
          .write(
              (new ObjControllerMessage(
                      0x0000000B,
                      new ShowFlyText(
                          client.getParent().getObjectID(),
                          getObjectID(),
                          56,
                          1,
                          1,
                          -1,
                          stfFile,
                          stfString,
                          customText,
                          xp,
                          scale,
                          color,
                          displayType)))
                  .serialize());
    }
  }
コード例 #2
0
ファイル: TradeService.java プロジェクト: 411waytoo/NGECore2
  public void cleanTradeSession(Client actorClient, Client targetTradeClient) {

    TradeCompleteMessage partnerCompleteTrade = new TradeCompleteMessage();
    targetTradeClient.getSession().write(partnerCompleteTrade.serialize());

    TradeCompleteMessage clientCompleteTrade = new TradeCompleteMessage();
    actorClient.getSession().write(clientCompleteTrade.serialize());

    actorClient.getSession().removeAttribute("tradeSession");
    actorClient.getSession().removeAttribute("tradeSessionIsVerified");
    targetTradeClient.getSession().removeAttribute("tradeSession");
    targetTradeClient.getSession().removeAttribute("tradeSessionIsVerified");
  }
コード例 #3
0
  public void showFlyText(
      String stf,
      OutOfBand outOfBand,
      float scale,
      RGB color,
      int displayType,
      boolean notifyObservers) {
    if (outOfBand == null) {
      outOfBand = new OutOfBand();
    }

    if (color == null) {
      color = new RGB(255, 255, 255);
    }

    if (getClient() != null) {
      getClient()
          .getSession()
          .write(
              (new ObjControllerMessage(
                      0x0000000B,
                      new ShowFlyText(
                          getObjectID(), getObjectID(), stf, outOfBand, scale, color, displayType)))
                  .serialize());
    }

    if (notifyObservers) {
      Set<Client> observers = getObservers();

      for (Client client : observers) {
        client
            .getSession()
            .write(
                (new ObjControllerMessage(
                        0x0000000B,
                        new ShowFlyText(
                            client.getParent().getObjectID(),
                            getObjectID(),
                            stf,
                            outOfBand,
                            scale,
                            color,
                            displayType)))
                    .serialize());
      }
    }
  }
コード例 #4
0
ファイル: TangibleObject.java プロジェクト: Nazath/NGECore2
  @Override
  public void sendBaselines(Client destination) {

    if (destination == null || destination.getSession() == null) {
      System.out.println("NULL destination");
      return;
    }

    destination.getSession().write(messageBuilder.buildBaseline3());
    destination.getSession().write(messageBuilder.buildBaseline6());
    destination.getSession().write(messageBuilder.buildBaseline8());
    destination.getSession().write(messageBuilder.buildBaseline9());

    UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
    upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
    upvpm.setStatus(getPvPBitmask());
    destination.getSession().write(upvpm.serialize());
  }
コード例 #5
0
  public boolean checkName(String name, Client client, boolean allowSpaces) {
    // TODO: check for dev names, profane names, iconic names etc
    try {
      if (checkForDuplicateName(name, client.getAccountId())
          || (!allowSpaces && !name.matches(allowedCharsRegex))
          || (allowSpaces && !name.matches(allowedCharsRegexWithSpace))) return false;
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return true;
  }
コード例 #6
0
ファイル: CreatureObject.java プロジェクト: Chadenn/NGECore2
  @Override
  public void sendBaselines(Client destination) {

    if (destination == null || destination.getSession() == null) {
      System.out.println("NULL session");
      return;
    }

    destination.getSession().write(messageBuilder.buildBaseline3());
    destination.getSession().write(messageBuilder.buildBaseline6());
    if (destination == getClient()) {
      destination.getSession().write(messageBuilder.buildBaseline1());
      destination.getSession().write(messageBuilder.buildBaseline4());
    }
    // destination.getSession().write(messageBuilder.buildBaseline8());
    // destination.getSession().write(messageBuilder.buildBaseline9());

    if (destination != getClient()) {
      UpdatePVPStatusMessage upvpm =
          new UpdatePVPStatusMessage(
              getObjectID(),
              NGECore.getInstance()
                  .factionService
                  .calculatePvpStatus((CreatureObject) destination.getParent(), this),
              getFaction());
      destination.getSession().write(upvpm.serialize());
      UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), getPosture());
      destination.getSession().write(upm.serialize());
    }
  }
コード例 #7
0
ファイル: GCWService.java プロジェクト: ultgamer21/NGECore2
  public List<SWGObject> getSFPlayers() {
    List<SWGObject> flagged = new ArrayList<SWGObject>();

    synchronized (core.getActiveConnectionsMap()) {
      for (Client client : core.getActiveConnectionsMap().values()) {
        if (client.getParent() != null && client.getParent() instanceof CreatureObject) {
          flagged.add(client.getParent());
        }
      }
    }

    Iterator<SWGObject> it = flagged.iterator();

    while (it.hasNext()) {
      SWGObject obj = it.next();
      if (((CreatureObject) obj).getFactionStatus() != 2) {
        it.remove();
      }
    }

    return flagged;
  }
コード例 #8
0
  public void updatePvpStatus() {
    HashSet<Client> observers = new HashSet<Client>(getObservers());

    for (Iterator<Client> it = observers.iterator(); it.hasNext(); ) {
      Client observer = it.next();

      if (observer.getParent() != null) {
        observer
            .getSession()
            .write(
                new UpdatePVPStatusMessage(
                        this.getObjectID(),
                        NGECore.getInstance()
                            .factionService
                            .calculatePvpStatus((CreatureObject) observer.getParent(), this),
                        getFaction())
                    .serialize());
        if (getClient() != null) {
          getClient()
              .getSession()
              .write(
                  new UpdatePVPStatusMessage(
                          observer.getParent().getObjectID(),
                          NGECore.getInstance()
                              .factionService
                              .calculatePvpStatus(
                                  (CreatureObject) this, (CreatureObject) observer.getParent()),
                          getFaction())
                      .serialize());
        }
      }
    }

    if (getClient() != null) {
      CreatureObject companion =
          NGECore.getInstance().mountService.getCompanion((CreatureObject) this);

      if (companion != null) {
        companion.updatePvpStatus();
      }
    }
  }
コード例 #9
0
  public void sendBaselines(Client destination) {
    if (destination != null && destination.getSession() != null) {
      destination.getSession().write(getBaseline(3).getBaseline());
      destination.getSession().write(getBaseline(6).getBaseline());

      Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient());

      if (parent != null && destination == parent) {
        destination.getSession().write(getBaseline(8).getBaseline());
        destination.getSession().write(getBaseline(9).getBaseline());
      }

      if (destination.getParent() != this) {
        UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
        upvpm.setFaction(CRC.StringtoCRC(getFaction()));
        upvpm.setStatus(
            NGECore.getInstance()
                .factionService
                .calculatePvpStatus((CreatureObject) destination.getParent(), this));
        destination.getSession().write(upvpm.serialize());
      }
    }
  }
コード例 #10
0
ファイル: TradeService.java プロジェクト: 411waytoo/NGECore2
 public long getTradeAttribute(Client client) {
   long tradeSessionValue;
   tradeSessionValue = (long) client.getSession().getAttribute("tradeSession");
   return tradeSessionValue;
 }