Example #1
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;
  }
 /**
  * @param visibleObject
  * @param spawn
  * @param instanceIndex
  */
 private static void bringIntoWorld(
     VisibleObject visibleObject, SpawnTemplate spawn, int instanceIndex) {
   World world = World.getInstance();
   world.storeObject(visibleObject);
   world.setPosition(
       visibleObject,
       spawn.getWorldId(),
       instanceIndex,
       spawn.getX(),
       spawn.getY(),
       spawn.getZ(),
       spawn.getHeading());
   world.spawn(visibleObject);
 }