Search in sources :

Example 1 with WorldMapDecoder

use of org.apollo.game.fs.decoder.WorldMapDecoder in project apollo by apollo-rsps.

the class World method init.

/**
 * Initialises the world by loading definitions from the specified file
 * system.
 *
 * @param release The release number.
 * @param fs The file system.
 * @param manager The plugin manager. TODO move this.
 * @throws Exception If there was a failure when loading plugins.
 */
public void init(int release, IndexedFileSystem fs, PluginManager manager) throws Exception {
    releaseNumber = release;
    SynchronousDecoder firstStageDecoder = new SynchronousDecoder(new NpcDefinitionDecoder(fs), new ItemDefinitionDecoder(fs), new ObjectDefinitionDecoder(fs), new MapIndexDecoder(fs), EquipmentDefinitionParser.fromFile("data/equipment-" + release + "" + ".dat"));
    firstStageDecoder.block();
    SynchronousDecoder secondStageDecoder = new SynchronousDecoder(new WorldObjectsDecoder(fs, this, regions), new WorldMapDecoder(fs, collisionManager));
    secondStageDecoder.block();
    // Build collision matrices for the first time
    collisionManager.build(false);
    regions.addRegionListener(new CollisionUpdateListener(collisionManager));
    // Must be exactly here because of ordering issues.
    npcMovement = new NpcMovementTask(collisionManager);
    scheduler.schedule(npcMovement);
    manager.start();
    commandDispatcher.init(manager.getAuthors());
    pluginManager = manager;
}
Also used : NpcMovementTask(org.apollo.game.scheduling.impl.NpcMovementTask) SynchronousDecoder(org.apollo.game.fs.decoder.SynchronousDecoder) NpcDefinitionDecoder(org.apollo.cache.decoder.NpcDefinitionDecoder) MapIndexDecoder(org.apollo.cache.map.MapIndexDecoder) WorldObjectsDecoder(org.apollo.game.fs.decoder.WorldObjectsDecoder) ItemDefinitionDecoder(org.apollo.cache.decoder.ItemDefinitionDecoder) WorldMapDecoder(org.apollo.game.fs.decoder.WorldMapDecoder) CollisionUpdateListener(org.apollo.game.model.area.collision.CollisionUpdateListener) ObjectDefinitionDecoder(org.apollo.cache.decoder.ObjectDefinitionDecoder)

Aggregations

ItemDefinitionDecoder (org.apollo.cache.decoder.ItemDefinitionDecoder)1 NpcDefinitionDecoder (org.apollo.cache.decoder.NpcDefinitionDecoder)1 ObjectDefinitionDecoder (org.apollo.cache.decoder.ObjectDefinitionDecoder)1 MapIndexDecoder (org.apollo.cache.map.MapIndexDecoder)1 SynchronousDecoder (org.apollo.game.fs.decoder.SynchronousDecoder)1 WorldMapDecoder (org.apollo.game.fs.decoder.WorldMapDecoder)1 WorldObjectsDecoder (org.apollo.game.fs.decoder.WorldObjectsDecoder)1 CollisionUpdateListener (org.apollo.game.model.area.collision.CollisionUpdateListener)1 NpcMovementTask (org.apollo.game.scheduling.impl.NpcMovementTask)1