Esempio n. 1
0
  public IoBuffer buildRemoveBuffDelta(Buff buff) {

    CreatureObject creature = (CreatureObject) object;

    IoBuffer buffer = bufferPool.allocate(37, false).order(ByteOrder.LITTLE_ENDIAN);
    buffer.putInt(1);
    buffer.putInt(creature.getBuffListCounter());
    buffer.put((byte) 1);
    buffer.put(buff.getBytes());
    int size = buffer.position();
    buffer.flip();
    buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1A, buffer, size + 4);

    return buffer;
  }
Esempio n. 2
0
  public IoBuffer buildUpdateBuffDelta(Buff buff) {

    CreatureObject creature = (CreatureObject) object;
    PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost");

    IoBuffer buffer = bufferPool.allocate(37, false).order(ByteOrder.LITTLE_ENDIAN);
    buffer.putInt(1);
    buffer.putInt(creature.getBuffListCounter());
    if (player != null)
      buff.setTotalPlayTime(
          (int)
              (player.getTotalPlayTime()
                  + (System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000));
    else buff.setTotalPlayTime(0);
    buffer.put((byte) 2);
    buffer.put(buff.getBytes());
    int size = buffer.position();
    buffer.flip();
    buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1A, buffer, size + 4);

    return buffer;
  }