Rewrite exit code, shutdown handlers etc
This commit is contained in:
parent
b1a05c68dd
commit
9e586bf2f3
6 changed files with 33 additions and 55 deletions
|
|
@ -207,7 +207,7 @@ namespace Server.Commands
|
|||
{
|
||||
List<IEntity> list = (List<IEntity>)state;
|
||||
|
||||
CommandLogging.WriteLine( from, "{0} {1} deleting {2} objects", from.AccessLevel, CommandLogging.Format( from ), list.Count );
|
||||
CommandLogging.WriteLine( from, "{0} {1} deleting {2} object{3}", from.AccessLevel, CommandLogging.Format( from ), list.Count, list.Count == 1 ? "" : "s" );
|
||||
|
||||
NetState.Pause();
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ namespace Server.Commands
|
|||
|
||||
if ( list.Count > 0 )
|
||||
{
|
||||
CommandLogging.WriteLine( e.Mobile, "{0} {1} starting facet clear of {2} ({3} objects)", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), map, list.Count );
|
||||
CommandLogging.WriteLine( e.Mobile, "{0} {1} starting facet clear of {2} ({3} object{4})", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), map, list.Count, list.Count == 1 ? "" : "s" );
|
||||
|
||||
e.Mobile.SendGump(
|
||||
new WarningGump( 1060635, 30720,
|
||||
|
|
@ -396,7 +396,7 @@ namespace Server.Commands
|
|||
{
|
||||
m_Mobile = m;
|
||||
|
||||
CommandLogging.WriteLine( from, "{0} {1} getting equip for {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m ) );
|
||||
CommandLogging.WriteLine( from, "{0} {1} viewing equipment of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m ) );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, int index )
|
||||
|
|
@ -429,17 +429,17 @@ namespace Server.Commands
|
|||
{
|
||||
if ( index == 0 )
|
||||
{
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} moving equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} moving equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
state.Mobile.Target = new MoveTarget( m_Item );
|
||||
}
|
||||
else if ( index == 1 )
|
||||
{
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} deleting equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} deleting equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
m_Item.Delete();
|
||||
}
|
||||
else if ( index == 2 )
|
||||
{
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} opening props for equip item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
CommandLogging.WriteLine( state.Mobile, "{0} {1} opening properties for equipment item {2} of {3}", state.Mobile.AccessLevel, CommandLogging.Format( state.Mobile ), CommandLogging.Format( m_Item ), CommandLogging.Format( m_Mobile ) );
|
||||
state.Mobile.SendGump( new PropertiesGump( state.Mobile, m_Item ) );
|
||||
}
|
||||
}
|
||||
|
|
@ -1278,34 +1278,6 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private class DeleteItemByLayerTarget : Target
|
||||
{
|
||||
private Layer m_Layer;
|
||||
|
||||
public DeleteItemByLayerTarget( Layer layer ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_Layer = layer;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Mobile )
|
||||
{
|
||||
Item item = ((Mobile)targeted).FindItemOnLayer( m_Layer );
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
CommandLogging.WriteLine( from, "{0} {1} deleting item on layer {2} of {3}", from.AccessLevel, CommandLogging.Format( from ), m_Layer, CommandLogging.Format( targeted ) );
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "Target a mobile." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Usage( "AutoPageNotify" )]
|
||||
[Aliases( "APN" )]
|
||||
[Description( "Toggles your auto-page-notify status." )]
|
||||
|
|
|
|||
|
|
@ -2727,20 +2727,17 @@ namespace Server.Gumps
|
|||
|
||||
private void Shutdown( bool restart, bool save )
|
||||
{
|
||||
CommandLogging.WriteLine( m_From, "{0} {1} shuting down server (Restart: {2}) (Save: {3})", m_From.AccessLevel, CommandLogging.Format( m_From ), restart, save );
|
||||
CommandLogging.WriteLine( m_From, "{0} {1} shutting down server (Restart: {2}) (Save: {3})", m_From.AccessLevel, CommandLogging.Format( m_From ), restart, save );
|
||||
|
||||
if ( save )
|
||||
InvokeCommand( "Save" );
|
||||
|
||||
if ( restart )
|
||||
Process.Start( Core.ExePath, Core.Arguments );
|
||||
|
||||
Core.Process.Kill();
|
||||
Core.Kill( restart );
|
||||
}
|
||||
|
||||
private void InvokeCommand( string ip )
|
||||
private void InvokeCommand( string c )
|
||||
{
|
||||
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, ip ) );
|
||||
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, c ) );
|
||||
}
|
||||
|
||||
public static void GetAccountInfo( Account a, out AccessLevel accessLevel, out bool online )
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ namespace Server.Misc
|
|||
|
||||
private void Restart_Callback()
|
||||
{
|
||||
Process.Start( Core.ExePath, Core.Arguments );
|
||||
Core.Process.Kill();
|
||||
Core.Kill( true );
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace Server.Misc
|
|||
{
|
||||
if( m.NetState != null && m.NetState.Version < Required )
|
||||
{
|
||||
Gump g = new WarningGump( 1060637, 30720, String.Format( "Your client is out of date. Please update your client.<br>This server reccomends that your client version be at least {0}.<br> <br>You are currently using version {1}.<br> <br>To patch, run UOPatch.exe inside your Ultima Online folder.", Required, m.NetState.Version ), 0xFFC000, 480, 360,
|
||||
Gump g = new WarningGump( 1060637, 30720, String.Format( "Your client is out of date. Please update your client.<br>This server recommends that your client version be at least {0}.<br> <br>You are currently using version {1}.<br> <br>To patch, run UOPatch.exe inside your Ultima Online folder.", Required, m.NetState.Version ), 0xFFC000, 480, 360,
|
||||
delegate( Mobile mob, bool selection, object o )
|
||||
{
|
||||
m.SendMessage( "You will be reminded of this again." );
|
||||
|
|
|
|||
|
|
@ -276,8 +276,10 @@ namespace Server
|
|||
{
|
||||
if( World.Saving )
|
||||
return true;
|
||||
|
||||
Kill();
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -287,8 +289,7 @@ namespace Server
|
|||
}
|
||||
|
||||
private static bool m_Closing;
|
||||
|
||||
public static bool Closing { get { return m_Closing; } set { m_Closing = value; } }
|
||||
public static bool Closing { get { return m_Closing; } }
|
||||
|
||||
private static uint m_CycleIndex;
|
||||
private static float[] m_CyclesPerSecond = new float[100];
|
||||
|
|
@ -315,6 +316,21 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void Kill()
|
||||
{
|
||||
Kill( false );
|
||||
}
|
||||
|
||||
public static void Kill( bool restart )
|
||||
{
|
||||
HandleClosed();
|
||||
|
||||
if ( restart )
|
||||
Process.Start( ExePath, Arguments );
|
||||
|
||||
m_Process.Kill();
|
||||
}
|
||||
|
||||
private static void HandleClosed()
|
||||
{
|
||||
if( m_Closing )
|
||||
|
|
@ -327,9 +343,6 @@ namespace Server
|
|||
if( !m_Crashed )
|
||||
EventSink.InvokeShutdown( new ShutdownEventArgs() );
|
||||
|
||||
if( timerThread.ThreadState != System.Threading.ThreadState.Unstarted )
|
||||
timerThread.Join();
|
||||
|
||||
if( SocketPool.Created )
|
||||
SocketPool.Destroy();
|
||||
|
||||
|
|
@ -448,7 +461,7 @@ namespace Server
|
|||
|
||||
int sample = 0;
|
||||
|
||||
while( !m_Closing )
|
||||
while( true )
|
||||
{
|
||||
m_Signal.WaitOne();
|
||||
|
||||
|
|
@ -477,9 +490,6 @@ namespace Server
|
|||
{
|
||||
CurrentDomain_UnhandledException( null, new UnhandledExceptionEventArgs( e, true ) );
|
||||
}
|
||||
|
||||
if( timerThread.IsAlive )
|
||||
timerThread.Abort();
|
||||
}
|
||||
|
||||
public static string Arguments
|
||||
|
|
|
|||
|
|
@ -7926,7 +7926,7 @@ namespace Server
|
|||
|
||||
return this == m || (
|
||||
m.m_Map == m_Map &&
|
||||
(!m.Hidden || (m_AccessLevel != AccessLevel.Player && (m_AccessLevel >= m.AccessLevel || m_AccessLevel >= AccessLevel.Administrator))) && //Admins/devs can still see/find eachother though admin gump, they should be able to see 'em too.
|
||||
(!m.Hidden || (m_AccessLevel != AccessLevel.Player && (m_AccessLevel >= m.AccessLevel || m_AccessLevel >= AccessLevel.Developer))) &&
|
||||
((m.Alive || (Core.SE && Skills.SpiritSpeak.Value >= 100.0)) || !Alive || m_AccessLevel > AccessLevel.Player || m.Warmode));
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue