コード例 #1
0
  @Override
  public void applyEffect(Effect effect) {
    Creature effector = effect.getEffector();
    SpawnEngine spawnEngine = SpawnEngine.getInstance();
    float x = effector.getX();
    float y = effector.getY();
    float z = effector.getZ();
    byte heading = effector.getHeading();
    int worldId = effector.getWorldId();
    int instanceId = effector.getInstanceId();

    SpawnTemplate spawn =
        spawnEngine.addNewSpawn(worldId, instanceId, npcId, x, y, z, heading, 0, 0, true, true);
    final Servant servant = spawnEngine.spawnServant(spawn, instanceId, effector, skillId, hpRatio);

    Future<?> task =
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {

                  @Override
                  public void run() {
                    servant.getController().onDespawn(true);
                  }
                },
                60 * 1000);
    servant.getController().addTask(TaskId.DESPAWN, task);
  }
コード例 #2
0
ファイル: DrakanPriestAI2.java プロジェクト: soulxj/aion-cn
 private SpawnTemplate rndSpawnInRange(int npcId) {
   float direction = Rnd.get(0, 199) / 100f;
   float x1 = (float) (Math.cos(Math.PI * direction) * 5);
   float y1 = (float) (Math.sin(Math.PI * direction) * 5);
   return SpawnEngine.addNewSingleTimeSpawn(
       getPosition().getMapId(),
       npcId,
       getPosition().getX() + x1,
       getPosition().getY() + y1,
       getPosition().getZ(),
       getPosition().getHeading());
 }
コード例 #3
0
  /**
   * @param worldId
   * @param destroyTime
   * @return
   */
  public static synchronized WorldMapInstance getNextAvailableInstance(int worldId) {
    WorldMap map = World.getInstance().getWorldMap(worldId);

    if (!map.isInstanceType())
      throw new UnsupportedOperationException(
          "Invalid call for next available instance  of " + worldId);

    int nextInstanceId = map.getNextInstanceId();

    log.info("Creating new instance: " + worldId + " " + nextInstanceId);

    WorldMapInstance worldMapInstance = new WorldMapInstance(map, nextInstanceId);
    startInstanceChecker(worldMapInstance);
    map.addInstance(nextInstanceId, worldMapInstance);
    SpawnEngine.getInstance().spawnInstance(worldId, worldMapInstance.getInstanceId());

    return worldMapInstance;
  }
コード例 #4
0
ファイル: GameServer.java プロジェクト: Avol/TestProject
  /** This method is basically responsible for triggering NPCs spawning with {@link SpawnEngine}. */
  private void spawnMonsters() {
    SpawnData spawnData = injector.getInstance(SpawnData.class);
    SpawnEngine spawnEngine = injector.getInstance(SpawnEngine.class);

    spawnEngine.spawnAll(spawnData);
  }