⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worldgenerator.java

📁 Vyger offers a D & D and Rogue-like environment in a graphical online roleplay game.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * Light And Shadow. A Persistent Universe based on Robert Jordan's Wheel of Time Books.
 * Copyright (C) 2001-2002 WOTLAS Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package wotlas.server.setup;

import wotlas.common.*;
import wotlas.common.universe.*;
import wotlas.server.*;
import wotlas.libs.graphics2D.*;
import wotlas.libs.graphics2D.ImageIdentifier;
import wotlas.libs.graphics2D.drawable.DoorDrawable;
import wotlas.utils.*;
import wotlas.common.universe.*;
import wotlas.common.environment.*;

import java.util.Properties;


/** A small utility to generate <<Wotlas release 2>>'s default world.
 *
 * @author Aldiss, Diego
 */

public class WorldGenerator {

 /*------------------------------------------------------------------------------------*/

    /** Main method.
    *  @param argv not used
    */
    public static void main( String argv[] ) {

        /*  first of all Manage the Preloader for WorldGenerator*/
        WorldManager.PRELOADER_STATUS = PreloaderEnabled.LOAD_ALL;

        float halfPI = (float)(Math.PI/2);

        // STEP 2 - WORLD CREATION : RANDLAND
        WorldMap worldMaps[] = new WorldMap[1];

        WorldMap worldMap = new WorldMap();
        worldMaps[0] = worldMap;

        worldMap.setWorldMapID(0);
        worldMap.setFullName("RandLand");
        worldMap.setShortName("randland");
        worldMap.setInsertionPoint( new ScreenPoint(680,455) );
        worldMap.setWorldImage( new ImageIdentifier( "maps-1/universe-2/randland-0") );
        worldMap.setMusicName("stedding.mid");

        // new STEP 3a - MAPTILES
        TileMap tileMaps[] = new TileMap[2];
        worldMap.setTileMaps( tileMaps );

        // Mishra Creation   
        TileMap tileMap = new TileMap(700,247,17,17);
        tileMaps[0] = tileMap;

        tileMap.setTileMapID(0);
        tileMap.setAreaName("");
        tileMap.setFullName("Mishra");
        tileMap.setShortName("mishra");
        tileMap.setInsertionPoint( new ScreenPoint(10,10) );
        tileMap.setSmallTileMapImage( new ImageIdentifier( "maps-1/town-small-1/shayol-ghul-2" ) );
        tileMap.setMusicName("tar-valon.mid");
        tileMap.selectGraphicSet( EnvironmentManager.GRAPHICS_SET_ROGUE );

        TileManagerFlat manager = new TileManagerFlat(  tileMap );
        manager.setMap( 20, 20, TileMap.PIXEL_32, (byte)0, (byte)44 );
        manager.setMapPoint(3,2,1,4,TileMap.TILE_NOT_FREE);
        manager.setMapPoint(4,2,1,4,TileMap.TILE_NOT_FREE);
        manager.setMapPoint(5,2,1,4,TileMap.TILE_NOT_FREE);
        manager.setMapPoint(6,2,1,4,TileMap.TILE_NOT_FREE);
        manager.setMapPoint(5,3,1,4,TileMap.TILE_NOT_FREE);
        manager.setMapPoint(6,3,1,4,TileMap.TILE_NOT_FREE);
        tileMap.setManager( (TileMapManager)manager );

        MapExit mapExit1 = null;
        mapExit1 = manager.addMapExit( new ScreenRectangle(0*32,1*32,1*32,2*32), "to World Map" );
        mapExit1.setType( MapExit.TILEMAP_EXIT );
        mapExit1.setMapExitSide( MapExit.NONE );
        mapExit1.setTargetWotlasLocation( new WotlasLocation(0) );
        mapExit1.setTargetPosition( new ScreenPoint(745,280) );

        // Rak Timin Creation   
        tileMap = new TileMap(720,207,17,17);
        tileMaps[1] = tileMap;

        tileMap.setTileMapID(1);
        tileMap.setAreaName("");
        tileMap.setFullName("Rak Timin");
        tileMap.setShortName("raktimin");
        tileMap.setInsertionPoint( new ScreenPoint(10,10) );
        tileMap.setSmallTileMapImage( new ImageIdentifier( "maps-1/town-small-1/shayol-ghul-2" ) );
        tileMap.setMusicName("tar-valon.mid");
        tileMap.selectGraphicSet( EnvironmentManager.GRAPHICS_SET_FAKEISO );

        TileManagerFakeIso manager2 = new TileManagerFakeIso( tileMap );
        manager2.setMap( 10, 10, TileMap.PIXEL_50, (byte)0, (byte)0 );
        manager2.setMapPoint(5,2,1,0);
        manager2.setMapPoint(6,2,1,1);
        manager2.setMapPoint(5,3,1,11);
        manager2.setMapPoint(6,3,1,10);
        manager2.setMapPoint(5,1,1,12);
        manager2.setMapPoint(6,1,1,13);
        manager2.setMapPoint(7,4,2,14);
        // walls
        manager2.setFakeIsoLayers( 1 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)5, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 2 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)5, (byte)1, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)5, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 1 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)5, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 2 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)9, (byte)4, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)5, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);

        manager2.setFakeIsoLayers( 0 /* x */, 2 /* y */, (byte)0 /* floor/layer */, (byte)6, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 0 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)6, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 2 /* y */, (byte)0 /* floor/layer */, (byte)6, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)6, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);

        // another wall
        manager2.setFakeIsoLayers( 6 /* x */, 5 /* y */, (byte)0 /* floor/layer */, (byte)7, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
        manager2.setFakeIsoLayers( 7 /* x */, 5 /* y */, (byte)0 /* floor/layer */, (byte)7, (byte)0, FakeIsoLayers.PRIMARY_WALL_ANGLE_DIR);
           
        // floor
//           manager2.setFakeIsoLayers( 1 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 1 /* x */, 2 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 1 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
//           manager2.setFakeIsoLayers( 2 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 2 /* x */, 2 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 2 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
//           manager2.setFakeIsoLayers( 3 /* x */, 1 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 2 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        manager2.setFakeIsoLayers( 3 /* x */, 3 /* y */, (byte)0 /* floor/layer */, (byte)3, (byte)0, FakeIsoLayers.HOUSE_FLOOR_DIR);
        tileMap.setManager( (TileMapManager)manager2 );

        mapExit1 = manager2.addMapExit( new ScreenRectangle(0*32,1*32,1*32,2*32), "to World Map" );
        mapExit1.setType( MapExit.TILEMAP_EXIT );
        mapExit1.setMapExitSide( MapExit.NONE );
        mapExit1.setTargetWotlasLocation( new WotlasLocation(0) );
        mapExit1.setTargetPosition( new ScreenPoint(745,280) );

           // STEP 3b - TOWNS
           TownMap townMaps[] = new TownMap[5];
           worldMap.setTownMaps( townMaps );

        // Tar Valon Creation

           TownMap townMap = new TownMap(755,277,17,17);
           townMaps[0] = townMap;

           townMap.setTownMapID(0);
           townMap.setFullName("Tar Valon");
           townMap.setShortName("tarvalon");
           townMap.setInsertionPoint( new ScreenPoint(70,340) );

           townMap.setSmallTownImage( new ImageIdentifier( "maps-1/town-small-1/tar-valon-small-0" ) );

           townMap.setTownImage( new ImageIdentifier( "maps-1/universe-2/tar-valon-1" ) );
           townMap.setMusicName("tar-valon.mid");

           MapExit mapExit = null;

               mapExit = townMap.addMapExit( new ScreenRectangle(30,300,20,40) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.WEST );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(745,280) );

               mapExit = townMap.addMapExit( new ScreenRectangle(30,710,20,30) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(763,300) );

               mapExit = townMap.addMapExit( new ScreenRectangle(30,740,20,50) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.SOUTH );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(763,300) );

               mapExit = townMap.addMapExit( new ScreenRectangle(550,700,20,50) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.EAST );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(774,284) );

               mapExit = townMap.addMapExit( new ScreenRectangle(550,370, 20, 50) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(769,273) );

               mapExit = townMap.addMapExit( new ScreenRectangle(550, 170, 20, 50) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NORTH );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(758,264) );

             // border mapExits
               mapExit = townMap.addMapExit( new ScreenRectangle(30,130, 20, 170) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(745,280) );

               mapExit = townMap.addMapExit( new ScreenRectangle(30,340, 20, 370) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(763,300) );

               mapExit = townMap.addMapExit( new ScreenRectangle(30,790, 20, 120) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(763,300) );

               mapExit = townMap.addMapExit( new ScreenRectangle(550, 420, 20, 280) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(774,284) );

               mapExit = townMap.addMapExit( new ScreenRectangle(550, 220, 20, 150) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(769,273) );

               mapExit = townMap.addMapExit( new ScreenRectangle(0, 0, 600, 130) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(758,264) );

               mapExit = townMap.addMapExit( new ScreenRectangle(0, 920, 600, 80) );
               mapExit.setType( MapExit.TOWN_EXIT );
               mapExit.setMapExitSide( MapExit.NONE );
               mapExit.setTargetWotlasLocation( new WotlasLocation(0) );
               mapExit.setTargetPosition( new ScreenPoint(763,300) );

        // Blight Refuge 'Town'
           townMap = new TownMap(774,115,16,15);
           townMaps[1] = townMap;

           townMap.setTownMapID(1);
           townMap.setFullName("Blight Refuge");
           townMap.setShortName("blightrefuge");
           townMap.setInsertionPoint( new ScreenPoint(0,0) );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -