/** * @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(); }
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 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)); } }
public static void addRiftSpawnGroup(SpawnGroup spawnGroup) { spawnGroups.put(spawnGroup.getAnchor(), spawnGroup); }