Wondering if anyone can think of an efficient way of exporting teleporters from one server and importing them into another. I attempted to use xmlfind but cannot save them to a file because they aren't spawners.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Server;
using Server.Items;
using Server.Mobiles;
using System.IO;
namespace Server.Scripts
{
class exportspawns
{
public static void Initialize()
{
Spawner s;
Type t;
int count = 0;
string title = Console.Title;
List<String> types;
TextWriter sx = File.CreateText( "spawns.txt" );
TextWriter tx = File.CreateText( "teleporters.txt" );
foreach ( IEntity i in World.Items.Values )
{
Console.Title = String.Format( "{0} of {1}", count++, World.Items.Count );
if ( i is Spawner )
{
s = i as Spawner; //x,y,z,tmin,tmax,range,amount
types = new List<string>();
for ( int fi = 0; fi < s.SpawnNamesCount; fi++ )
{
t = ScriptCompiler.FindTypeByName( s.SpawnNames[fi] );
if ( t != null && !( typeof( BaseVendor ).IsAssignableFrom( t ) ) )
{
types.Add( s.SpawnNames[fi] );
}
}
if ( types.Count > 0 )
{
sx.Write( "{0},{1},{2},{3},{4},{5},{6},", s.X, s.Y, s.Z, s.MinDelay.TotalMinutes, s.MaxDelay.TotalMinutes, s.HomeRange, s.Count );
sx.WriteLine( string.Join( ",", types ) );
}
}
else if ( i is Teleporter )
{
Teleporter tel = i as Teleporter;
Region r = Region.Find( tel.Location, tel.Map );
if ( !tel.Active ) continue;
tx.WriteLine( "{0},{1},{2},{3}={4},{5},{6},{7}={8}",
tel.GetWorldLocation().X,
tel.GetWorldLocation().Y,
tel.GetWorldLocation().Z,
0,
tel.PointDest.X,
tel.PointDest.Y,
tel.PointDest.Z,
0,
( r != null ? r.Name + "_" + tel.Serial.ToString() : tel.Serial.ToString() ) );
}
}
sx.Flush();
tx.Flush();
sx.Close();
tx.Close();
Console.Title = title;
}
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.