Esempio n. 1
0
  @Override
  protected void writeImpl() {
    writeOpcode();
    writeInt(actor.getObjectId());
    writeInt(actor.getSubId());
    writeFloat(actor.getX());
    writeFloat(actor.getY());
    writeFloat(actor.getZ());
    writeShort(actor.getHeading());
    writeInt(actor.getModelId());

    writeInt(actor.getOwerturnId());

    writeInt(0);
    writeInt(0);
  }
Esempio n. 2
0
  /**
   * Спавн в мир ловушку.
   *
   * @param owner владелец.
   * @param skill скил ловушки.
   * @param lifeTime время жизни.
   * @param radius радиус активации.
   */
  public void spawnMe(Character owner, Skill skill, int range, int lifeTime, int radius) {
    this.owner = owner;
    this.skill = skill;
    this.radius = radius;

    spawnMe(
        Coords.calcX(owner.getX(), range, owner.getHeading()),
        Coords.calcY(owner.getY(), range, owner.getHeading()),
        owner.getZ(),
        0);

    LocalObjects local = LocalObjects.get();

    Array<Character> chars =
        World.getAround(Character.class, local.getNextCharList(), this, radius);

    ExecutorManager executor = ExecutorManager.getInstance();

    if (chars.isEmpty()) this.lifeTask = executor.scheduleGeneral(this, lifeTime * 1000);
    else {

      Character[] array = chars.array();

      for (int i = 0, length = chars.size(); i < length; i++) {

        Character target = array[i];

        if (owner.checkTarget(target)) {
          executor.scheduleGeneral(this, 100);
          return;
        }
      }

      this.lifeTask = executor.scheduleGeneral(this, lifeTime * 1000);
    }
  }