Package be.demmel.jgws.packets

Examples of be.demmel.jgws.packets.Vector2


  public void handlePacket(ChannelHandlerContext ctx, P129_RequestSpawnPoint packet, GameServerSession serverData, List<QueueAction> actions) throws Exception {
    CharacterData character = serverData.getCurrentCharacter();

    P391_InstanceLoadSpawnPoint instanceLoadSpawnPoint = new P391_InstanceLoadSpawnPoint();
    instanceLoadSpawnPoint.setMapFile(character.getGameFileID());
    Vector2 spawn = new Vector2(character.getPosition().getX(), character.getPosition().getY());
    instanceLoadSpawnPoint.setPosition(spawn);
    instanceLoadSpawnPoint.setPlane(character.getPosition().getZ());
    ctx.write(instanceLoadSpawnPoint);
  }
View Full Code Here


        }

        if (moveType != MovementType.STOP && character.getMoveState() == MovementState.MOVE_CHANGE_DIR) {
            P026_MovementDirection movementDirection = new P026_MovementDirection();
            movementDirection.setAgentId(character.getAgentID());
            Vector2 direction = new Vector2(character.getDirection().getX(), character.getDirection().getY());
            movementDirection.setDirection(direction);
            movementDirection.setMoveType((short) moveType.getValue());
            recipient.write(movementDirection);
           
            // reset the moving state here
            character.setMoveState(MovementState.MOVE_KEEP_DIR);
        }

        P032_MovementSpeedModifier movementSpeedModifier = new P032_MovementSpeedModifier();
        movementSpeedModifier.setAgentId(character.getAgentID());
        movementSpeedModifier.setSpeed(character.getSpeedModifier());
        movementSpeedModifier.setMoveType((short) moveType.getValue());
        recipient.write(movementSpeedModifier);

        P030_MovementAim movementAim = new P030_MovementAim();
        movementAim.setAgentId(character.getAgentID());
        Vector2 position = new Vector2(character.getPosition().getX(), character.getPosition().getY());
        movementAim.setPosition(position);
        movementAim.setPlane(character.getPosition().getZ());
        recipient.write(movementAim);
    }
View Full Code Here

        P021_SpawnObject spawnObject = new P021_SpawnObject();
        spawnObject.setAgentId(newCharacter.getAgentID());
        spawnObject.setUnknown2((0x30000000) | newCharacter.getLocalID()); // assumption that this is localID
        spawnObject.setUnknown3((byte) 1);
        spawnObject.setUnknown4((byte) 5);
        Vector2 position = new Vector2(newCharacter.getPosition().getX(), newCharacter.getPosition().getY());
        spawnObject.setPosition(position);
        spawnObject.setPlane(newCharacter.getPosition().getZ());
        Vector2 rotation = new Vector2(Float.MAX_VALUE, newCharacter.getRotation());
        spawnObject.setRotation(rotation);
        spawnObject.setUnknown8((byte) 1);
        spawnObject.setSpeed(newCharacter.getSpeed());
        spawnObject.setUnknown10(Float.MAX_VALUE);
        spawnObject.setUnknown11(0x414000000L);
        spawnObject.setUnknown12(1886151033);
        Vector2 unknown19 = new Vector2(Float.MAX_VALUE, Float.MAX_VALUE);
        spawnObject.setUnknown19(unknown19);
        Vector2 unknown22 = new Vector2(Float.MAX_VALUE, Float.MAX_VALUE);
        spawnObject.setUnknown22(unknown22);
        recipient.write(spawnObject);

        P098_UpdateAgentFullEquipment updateAgentFullEquipment = new P098_UpdateAgentFullEquipment();
        updateAgentFullEquipment.setAgentId(newCharacter.getAgentID());
View Full Code Here

      } else if (type == Vector2.class) {
        readActions.add((packet, dataToDeserialize) -> {
          float x = dataToDeserialize.readFloat();
          float y = dataToDeserialize.readFloat();

          Vector2 vector = new Vector2(x, y);
          try {
            field.set(packet, vector);
          } catch (IllegalArgumentException | IllegalAccessException e) {
            // should never happen
            LOGGER.error("Unexpected error: ", e);
View Full Code Here

          throw new UnsupportedOperationException("NestedPacket serialization unsupported (aka TODO)");
        });
      } else if (type == Vector2.class) {
        writeActions.add((packet, buffer) -> {
          try {
            Vector2 vector = (Vector2) field.get(packet);

            if (vector != null) {
              buffer.writeFloat(vector.getX());
              buffer.writeFloat(vector.getY());
            } else {
              buffer.writeFloat(0);
              buffer.writeFloat(0);
            }
          } catch (IllegalArgumentException | IllegalAccessException e) {
            // should never happen
            LOGGER.error("Unexpected error: ", e);
            throw new RuntimeException(e);
          }
        });
      } else if (type == Vector3.class) {
        writeActions.add((packet, buffer) -> {
          try {
            Vector3 vector = (Vector3) field.get(packet);

            if (vector != null) {
              buffer.writeFloat(vector.getX());
              buffer.writeFloat(vector.getY());
              buffer.writeFloat(vector.getZ());
            } else {
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
            }
          } catch (IllegalArgumentException | IllegalAccessException e) {
            // should never happen
            LOGGER.error("Unexpected error: ", e);
            throw new RuntimeException(e);
          }
        });
      } else if (type == Vector4.class) {
        writeActions.add((packet, buffer) -> {
          try {
            Vector4 vector = (Vector4) field.get(packet);

            if (vector != null) {
              buffer.writeFloat(vector.getX());
              buffer.writeFloat(vector.getY());
              buffer.writeFloat(vector.getZ());
              buffer.writeFloat(vector.getA());
            } else {
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
              buffer.writeFloat(0);
View Full Code Here

TOP

Related Classes of be.demmel.jgws.packets.Vector2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.