Exemplo n.º 1
0
  /**
   * @param spawnGroup
   * @param instanceIndex
   */
  public static void spawnGroup(SpawnGroup spawnGroup, int instanceIndex) {
    VisibleObjectTemplate objectTemplate = ItemService.getItemTemplate(spawnGroup.getNpcid());
    if (objectTemplate == null) return;

    int pool = spawnGroup.getPool();
    for (int i = 0; i < pool; i++) {
      SpawnTemplate spawn = spawnGroup.getNextAvailableTemplate(instanceIndex);
      int objectId = IDFactory.getInstance().nextId();
      StaticObject staticObject =
          new StaticObject(objectId, new StaticObjectController(), spawn, objectTemplate);
      staticObject.setKnownlist(new KnownList(staticObject));
      bringIntoWorld(staticObject, spawn, instanceIndex);
    }
    spawnGroup.clearLastSpawnedTemplate();
  }
Exemplo n.º 2
0
  private static Npc spawnInstance(
      int instanceIndex,
      SpawnGroup spawnGroup,
      SpawnTemplate spawnTemplate,
      RiftController riftController) {
    NpcTemplate masterObjectTemplate = DataManager.NPC_DATA.getNpcTemplate(spawnGroup.getNpcid());
    Npc npc =
        new Npc(
            IDFactory.getInstance().nextId(), riftController, spawnTemplate, masterObjectTemplate);

    npc.setKnownlist(new NpcKnownList(npc));
    npc.setEffectController(new EffectController(npc));
    npc.getController().onRespawn();

    World world = World.getInstance();
    world.storeObject(npc);
    world.setPosition(
        npc,
        spawnTemplate.getWorldId(),
        instanceIndex,
        spawnTemplate.getX(),
        spawnTemplate.getY(),
        spawnTemplate.getZ(),
        spawnTemplate.getHeading());
    world.spawn(npc);
    rifts.add(npc);

    scheduleDespawn(npc);
    riftController.sendAnnounce();

    return npc;
  }
Exemplo n.º 3
0
  /** @param rift */
  private static void spawnRift(RiftEnum rift) {
    log.info("Spawning rift : " + rift.name());
    SpawnGroup masterGroup = spawnGroups.get(rift.getMaster());
    SpawnGroup slaveGroup = spawnGroups.get(rift.getSlave());

    if (masterGroup == null || slaveGroup == null) return;

    int instanceCount = World.getInstance().getWorldMap(masterGroup.getMapid()).getInstanceCount();

    SpawnTemplate masterTemplate = masterGroup.getNextRandomTemplate();
    SpawnTemplate slaveTemplate = slaveGroup.getNextRandomTemplate();

    for (int i = 1; i <= instanceCount; i++) {
      Npc slave = spawnInstance(i, masterGroup, slaveTemplate, new RiftController(null, rift));
      spawnInstance(i, masterGroup, masterTemplate, new RiftController(slave, rift));
    }
  }
Exemplo n.º 4
0
 public static void addRiftSpawnGroup(SpawnGroup spawnGroup) {
   spawnGroups.put(spawnGroup.getAnchor(), spawnGroup);
 }