RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How do I change the name of my shard?

irro

Page
How do I change the name/IP of my shard?

Ok, tired of the name "Runuo Test Center?"
goto "runuo dir"/scripts/misc/
open "Serverlist.cs" and this is what it looks like. I will bold the part you need to change.

I also put italics on the line where you can change your servers public IP.

using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;

namespace Server.Misc
{
public class ServerList
{
/* Address:
*
* The default setting, a value of 'null', will attempt to detect your IP address automatically:
* private const string Address = null;
*
* This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP:
* private const string Address = "12.34.56.78";
*
* If you need to resolve a DNS host name, you can do that too:
* private const string Address = "shard.host.com";
*/

public const string Address = "Enter public IP here';

public const string ServerName = "RunUO Test Center";

public static void Initialize()
{
Listener.Port = 2593;

EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
}

public static void EventSink_ServerList( ServerListEventArgs e )
{
try
{
IPAddress ipAddr;

if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
else
e.Rejected = true;
}
catch
{
e.Rejected = true;
}
}

public static bool Resolve( string addr, out IPAddress outValue )
{
try
{
outValue = IPAddress.Parse( addr );
return true;
}
catch
{
try
{
IPHostEntry iphe = Dns.Resolve( addr );

if ( iphe.AddressList.Length > 0 )
{
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
return true;
}
}
catch
{
}
}

outValue = IPAddress.None;
return false;
}

private static bool IsLocalMachine( NetState state )
{
Socket sock = state.Socket;

IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;

if ( IPAddress.IsLoopback( theirAddress ) )
return true;

bool contains = false;
IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() );

for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i )
contains = theirAddress.Equals( iphe.AddressList );

return contains;
}
}
}
 

dilut3d

Wanderer
Not working for me.

I followed the instructions to the T to change the IP because I am behind a router. I am getting several errors. Help?

-Error: Scripts\Misc\ServerList.cs: CS1002: <line23, column 38>
<line25, column 48>
-Error: Scripts\Misc\ServerList.cs: CS1519 <line25, column 57>

Those are the errors, and here is what my Serverlist.cs looks like as of right now.

using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;

namespace Server.Misc
{
public class ServerList
{
/* Address:
*
* The default setting, a value of 'null', will attempt to detect your IP address automatically:
* private const string Address = null;
*
* This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP:
* private const string Address = "12.34.56.78";
*
* If you need to resolve a DNS host name, you can do that too:
* private const string Address = "shard.host.com";
*/

public const string Address = 12.38.240.252';

public const string ServerName = Everlasting Darkness';

public static void Initialize()
{
Listener.Port = 2593;

EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
}

public static void EventSink_ServerList( ServerListEventArgs e )
{
try
{
IPAddress ipAddr;

if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
else
e.Rejected = true;
}
catch
{
e.Rejected = true;
}
}

public static bool Resolve( string addr, out IPAddress outValue )
{
try
{
outValue = IPAddress.Parse( addr );
return true;
}
catch
{
try
{
IPHostEntry iphe = Dns.Resolve( addr );

if ( iphe.AddressList.Length > 0 )
{
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
return true;
}
}
catch
{
}
}

outValue = IPAddress.None;
return false;
}

private static bool IsLocalMachine( NetState state )
{
Socket sock = state.Socket;

IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;

if ( IPAddress.IsLoopback( theirAddress ) )
return true;

bool contains = false;
IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() );

for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i )
contains = theirAddress.Equals( iphe.AddressList );

return contains;
}
}
}

The areas that are in bold in the script is where the problem is coming from I think, but I dont know what is the problem.
 

Jeff

Lord
public const string ServerName = Everlasting Darkness';

is spose to be a string, a string is defined by putting the words in quotes.


public const string ServerName = "Everlasting Darkness";

See the difference?
 

dilut3d

Wanderer
Hmmm

Okay I did that now its still logging on with the lan IP which is 192.168.15.2, but it needs to be... 12.38.240.252
 
Top