public void spawnSevenSignsNPCs()
{
final int compWinner = getCabalHighestScore();
ArrayList<int[]> spawnLocations = new ArrayList<int[]>();
L2NpcTemplate npcTemplate = null;
// Register the random spawns of the Mammon NPCs
RandomSpawnHandler.getInstance().registerSpawn(8113, merchantSpawns, RandomSpawnHandler.DEFAULT_RESPAWN, -1);
RandomSpawnHandler.getInstance().registerSpawn(8126, blacksmithSpawns, RandomSpawnHandler.DEFAULT_RESPAWN, -1);
/* Set up the spawning and required auto chats. */
// First, do this for the Preachers of Doom
AutoChatHandler.getInstance().registerChat(PREACHER_NPC_ID, SevenSigns.chatDoomPreacher);
npcTemplate = NpcTable.getInstance().getTemplate(PREACHER_NPC_ID);
// Add all the spawn locations for the Preachers of Doom
for (int[] spawnLoc : preacherSpawns)
spawnLocations.add(spawnLoc);
// If Dusk wins then we don't need to spawn the Orator of Revelations.
if (compWinner != CABAL_DUSK)
{
AutoChatHandler.getInstance().registerChat(ORATOR_NPC_ID, SevenSigns.chatOratorRevelations);
npcTemplate = NpcTable.getInstance().getTemplate(ORATOR_NPC_ID);
// If we do need the Orators, add them to the list of needed spawns.
for (int[] spawnLoc : oratorSpawns)
spawnLocations.add(spawnLoc);
}
// Spawn the needed NPCs in each of the various towns.
for (int i = 0; i < spawnLocations.size(); i++) {
try {
if (_initializedSpawns) {
L2NpcInstance npcInst = _signsNPCInsts.get(i);
npcInst.toggleVisible();
}
else {
L2Spawn npcSpawn = new L2Spawn(npcTemplate);
int[] currSpawn = spawnLocations.get(i);
npcSpawn.setLocx(currSpawn[0]);
npcSpawn.setLocy(currSpawn[1]);
npcSpawn.setLocz(currSpawn[2]);
npcSpawn.setAmount(1);
SpawnTable.getInstance().addNewSpawn(npcSpawn, false);
_signsNPCInsts.add(npcSpawn.doSpawn());
if (Config.DEBUG)
_log.info("SevenSigns: Spawned NPC ID " + npcSpawn.getNpcid()
+ " at " + currSpawn[0] + " " + currSpawn[1] + " " + currSpawn[2]);
}
}
catch (Exception e) {
_log.warning("SevenSigns: Error while spawning period NPCs: " + e);
}
}
_initializedSpawns = true;
}