DATAPATH
Исходный код
using System;
using System.IO;
using Microsoft.Win32;
using Server;
namespace Server.Misc
{
public class DataPath
{
/* If you have not installed Ultima Online,
* or wish the server to use a separate set of datafiles,
* change the 'CustomPath' value, example:
*
* private const string CustomPath = @"C:\Program Files\Ultima Online";
*/
private static string CustomPath = @"D:\UO";
/* The following is a list of files which a required for proper execution:
*
* Multi.idx
* Multi.mul
* VerData.mul
* TileData.mul
* Map*.mul
* StaIdx*.mul
* Statics*.mul
* MapDif*.mul
* MapDifL*.mul
* StaDif*.mul
* StaDifL*.mul
* StaDifI*.mul
*/
public static void Configure()
{
string pathReg = GetExePath( "Ultima Online" );
string pathTD = GetExePath( "Ultima Online Third Dawn" ); //These refer to 2D & 3D, not the Third Dawn expansion
if ( CustomPath != null )
Core.DataDirectories.Add( CustomPath );
if ( pathReg != null )
Core.DataDirectories.Add( pathReg );
if ( pathTD != null )
Core.DataDirectories.Add( pathTD );
if ( Core.DataDirectories.Count == 0 && !Core.Service )
{
Console.WriteLine( "Enter the Ultima Online directory:" );
Console.Write( "> " );
Core.DataDirectories.Add( Console.ReadLine() );
}
}
private static string GetExePath( string subName )
{
try
{
String keyString;
if( Core.Is64Bit )
keyString = @"SOFTWARE\Wow6432Node\Origin Worlds Online\{0}\1.0";
else
keyString = @"SOFTWARE\Origin Worlds Online\{0}\1.0";
using( RegistryKey key = Registry.LocalMachine.OpenSubKey( String.Format( keyString, subName ) ) )
{
if( key == null )
return null;
string v = key.GetValue( "ExePath" ) as string;
if( v == null || v.Length <= 0 )
return null;
if( !File.Exists( v ) )
return null;
v = Path.GetDirectoryName( v );
if( v == null )
return null;
return v;
}
}
catch
{
return null;
}
}
}
}
MAPDEFINITIONS
Исходный код
using System;
using Server;
namespace Server.Misc
{
public class MapDefinitions
{
public static void Configure()
{
/* Here we configure all maps. Some notes:
*
* 1) The first 32 maps are reserved for core use.
* 2) Map 0x7F is reserved for core use.
* 3) Map 0xFF is reserved for core use.
* 4) Changing or removing any predefined maps may cause server instability.
*/
RegisterMap( 0, 0, 0, 7168, 4096, 4, "Felucca", MapRules.FeluccaRules );
RegisterMap( 1, 1, 1, 7168, 4096, 0, "Trammel", MapRules.TrammelRules );
RegisterMap( 2, 2, 2, 2304, 1600, 1, "Ilshenar", MapRules.TrammelRules );
RegisterMap( 3, 3, 3, 2560, 2048, 1, "Malas", MapRules.TrammelRules );
RegisterMap( 4, 4, 4, 1448, 1448, 1, "Tokuno", MapRules.TrammelRules );
RegisterMap( 0x7F, 0x7F, 0x7F, Map.SectorSize, Map.SectorSize, 1, "Internal", MapRules.Internal );
/* Example of registering a custom map:
* RegisterMap( 32, 0, 0, 6144, 4096, 3, "Iceland", MapRules.FeluccaRules );
*
* Defined:
* RegisterMap( <index>, <mapID>, <fileIndex>, <width>, <height>, <season>, <name>, <rules> );
* - <index> : An unreserved unique index for this map
* - <mapID> : An identification number used in client communications. For any visible maps, this value must be from 0-3
* - <fileIndex> : A file identification number. For any visible maps, this value must be 0, 2, 3, or 4
* - <width>, <height> : Size of the map (in tiles)
* - <name> : Reference name for the map, used in props gump, get/set commands, region loading, etc
* - <rules> : Rules and restrictions associated with the map. See documentation for details
*/
TileMatrixPatch.Enabled = true; //OSI client patch 6.0.0.0
}
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules )
{
Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules );
Map.Maps[mapIndex] = newMap;
Map.AllMaps.Add( newMap );
}
}
}
Цитата
StaticZ
тегами [ code ] [ /code ] надо пользоватся
Сообщение отредактировал Juzzver - 10.1.2011, 1:03