Full Version : Need Help A Crash
xmlspawner >>Scripting Support >>Need Help A Crash


<< Prev | Next >>

Erica- 10-15-2006
Hi have any idea what needs to be fixed here was at work and had a crash heres the crash report
CODE
Server Crash Report
===================

RunUO Version 2.0, Build 2469.756
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 10/15/2006 12:27:44 PM
Mobiles: 4615
Items: 229499
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.ClientPatchWarning.World_Login(LoginEventArgs args)
  at Server.LoginEventHandler.Invoke(LoginEventArgs e)
  at Server.EventSink.InvokeLogin(LoginEventArgs e)
  at Server.Network.PacketHandlers.DoLogin(NetState state, Mobile m)
  at Server.Network.PacketHandlers.PlayCharacter(NetState state, PacketReader pvSrc)
  at Server.Network.MessagePump.HandleReceive(NetState ns)
  at Server.Network.MessagePump.Slice()
  at Server.Core.Main(String[] args)

i think it has to do with the clientpatcher script heres the script
CODE
/****************************************
*       Client Patch Warning v1.3       *
*             Plug and Play             *
*                                       *
*         Originally Created by         *
*          Joeku AKA Demortris          *
*               2/13/2006               *
*                                       *
* You may modify/redistribute this code *
*    but only with the header intact    *
*****************************************
* Version 1.60: XxSP1DERxX & Joeku      *
* Date: 3/29/2006                       *
****************************************/

using System;
using Server.Network;
using Server.Gumps;
using Server.Mobiles;

namespace Server
{
public class ClientPatchWarning
{
 //Settings
 public static bool EnforceClientVerification = true;
 public static ClientVersion Required = new ClientVersion( "5.0.4b" );
 public static ClientVersion Suggested = new ClientVersion( "5.0.4c" );
 public static string WebsiteURL = "http://www.angelsofheavensite.org/";
 public static TimeSpan Delay = TimeSpan.FromSeconds( 1.0 );
 public static TimeSpan KickDelay = TimeSpan.FromSeconds( 30.0 );
 public static int InvulProtection = 15; //seconds of invulnerability protection
 // used for enforcing the Requirement using ClientVerification
 //Do not touch
 public static ClientVersion NoVersion = new ClientVersion( "0.0.0" );

 public static void Configure()
 {
  EventSink.Login += new LoginEventHandler( World_Login );
  EventSink.ServerStarted += new ServerStartedEventHandler( ServerStarted );
 }

 public static void ServerStarted()
 {
  if ( EnforceClientVerification )
  {
   ClientVersion.Required = Required;
   ClientVersion.KickDelay = KickDelay;
  }
  else
   ClientVersion.Required = null;
 }

 private static void World_Login( LoginEventArgs args )
 {
  Mobile m = args.Mobile;
  m.NetState.Send( new ClientVersionReq() );
  bool b = false;
  if( m.Blessed && m.AccessLevel > AccessLevel.Player )
   b = true;
  else if( m.Blessed && m.AccessLevel == AccessLevel.Player )
   m.Blessed = false;
  new ClientPatchTimer( m, Required, Suggested, WebsiteURL, b ).Start();
 }
}

public class ClientPatchTimer: Timer
{
 private Mobile m_From;
 private ClientVersion m_Required;
 private ClientVersion m_Suggested;
 private string m_WebsiteURL;
 private bool m_BadVersion;
 private bool m_b;

 public ClientPatchTimer( Mobile mobile, ClientVersion required, ClientVersion suggested, string url, bool b ): base( ClientPatchWarning.Delay, ClientPatchWarning.Delay )
 {
  m_From = mobile;
  m_Required = required;
  m_Suggested = suggested;
  m_WebsiteURL = url;
  m_b = b;
  Priority = TimerPriority.TwoFiftyMS;
 }

 protected override void OnTick()
 {
  if ( m_From == null )
   Stop();
  else if ( m_From.NetState != null )
  {
   ClientVersion currentversion = m_From.NetState.Version;
   if ( currentversion == null || currentversion == ClientPatchWarning.NoVersion )
    m_From.NetState.Send( new ClientVersionReq() );
   else if ( m_From.HasGump( typeof( ClientPatchGump ) ) && m_Suggested > m_Required && currentversion > m_Required )
    Stop();
   else if ( m_Required > currentversion || m_Suggested > currentversion )
   {
    ClientPatchGump gump = new ClientPatchGump( m_Required, currentversion, m_Suggested, m_WebsiteURL );
    if ( m_Required > m_Suggested || !m_BadVersion )
    {
     m_BadVersion = true;
     Console.WriteLine( "Client: {0}: Warning, bad version {1}", m_From.NetState, m_From.NetState.Version.ToString() );
     m_From.SendGump( gump );
     if( !m_b && ClientPatchWarning.InvulProtection > 0)
     {
      new InvulTimer( m_From ).Start();
      m_From.Blessed = true;
      m_b = true;
     }
    }
   }
   else
    Stop();
  }
 }
}

public class InvulTimer: Timer
{
 private Mobile m_From;
 private int m_Ticker;

 public InvulTimer( Mobile mobile ): base(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1))
 {
  m_From = mobile;
  m_Ticker = ClientPatchWarning.InvulProtection;
  Priority = TimerPriority.EveryTick;
 }

 protected override void OnTick()
 {
  try
  {
   if( m_Ticker > 0 && m_From.HasGump(typeof(ClientPatchGump))){m_From.SendMessage(37, "{0} seconds left of invul protection...", m_Ticker);}
   else{m_From.SendMessage(37, "Your invul protection has worn out!"); this.Stop(); m_From.Blessed = false;}
  }
  catch{}
  m_Ticker--;
 }
}

public class ClientPatchGump : Gump
{
 public ClientVersion m_Required;
 public ClientVersion m_Suggested;
 public ClientVersion m_Current;
 public string m_WebsiteURL;

 public ClientPatchGump( ClientVersion required, ClientVersion current, ClientVersion suggested, string url ) : this( required, current, suggested, url, false )
 {
 }

 public ClientPatchGump( ClientVersion required, ClientVersion current, ClientVersion suggested, string url, bool help ) : base( 250, 150 )
 {
  m_Required = required;
  m_Suggested = suggested;
  m_Current = current;
  m_WebsiteURL = url;
  string message = String.Empty;

  Closable = false;
  Disposable = false;
  Dragable = false;
  Resizable = false;

  AddPage( 0 );
  AddBackground( 0, 0, 400, 300, 3600 );

  if ( help )
  {
   AddLabel( 149, 30, 2101, "Client Patch Help" );

   message = "To patch your UO client, close this instance of Ultima Online and execute the normal Ultima Online shortcut (UO.exe).  If you cannot locate the shortcut or the file UO.exe, go to \"My Computer\", click on \"Search\" and type \"UO.exe\" as your search query.  Once located, execute this file and allow the Auto Patch for Ultima Online to run.  Once completed close the client, and log back into this server.";
   AddButton( 168, 230, 2443, 2444, 0, GumpButtonType.Reply, 0 );
   AddLabel( 185, 231, 0, "Close" );
  }
  else
  {
   AddLabel( 171, 30, 36, "WARNING" );

   AddButton( 90, 230, 2443, 2444, 1, GumpButtonType.Reply, 0 );
   AddLabel( 110, 231, 0, "Help" );
   AddButton( 168, 230, 2443, 2444, 2, GumpButtonType.Reply, 0 );
   AddLabel( 180, 231, 0, "Forums" );
   if ( current < required )
    message = String.Format( "Your client patch version is currently {0}. You <u>MUST</u> have version {1} or higher to play. Please patch your client to version {1} or higher in order to play.", current, required );
   else if ( current < suggested )
   {
    message = String.Format( "Your client patch version is currently {0}. We <u>recommend</u> that you have version {1} or higher to play. Please patch your client to version {1} or higher so you can enjoy your experience to the fullest.", current, suggested );
    AddButton( 246, 230, 2443, 2444, 0, GumpButtonType.Reply, 0 );
    AddLabel( 254, 231, 0, "Continue" );
   }
  }

  AddHtml( 65, 65, 270, 134, message, true, true );
 }

 public override void OnResponse( NetState state, RelayInfo info )
        {
  Mobile from = state.Mobile;

  switch ( info.ButtonID )
            {
   default:
   {
    if ( m_Current < m_Required )
     from.SendGump( new ClientPatchGump( m_Required, m_Current, m_Suggested, m_WebsiteURL ) );
    else
     from.Blessed = false;
    break;
   }
   case 1: from.SendGump( new ClientPatchGump( m_Required, m_Current, m_Suggested, m_WebsiteURL, true ) ); break;
   case 2: from.LaunchBrowser( m_WebsiteURL );
    from.SendGump( new ClientPatchGump( m_Required, m_Current, m_Suggested, m_WebsiteURL ) ); break;
  }
 }
}
}
any idea if it is this and if so what would need fixxing Thank You.

ArteGordon- 10-15-2006
I would make the following change.

QUOTE

private static void World_Login( LoginEventArgs args )
{
if(args == null) return;

  Mobile m = args.Mobile;

if(m == null || m.NetState == null) return;

  m.NetState.Send( new ClientVersionReq() );
  bool b = false;
  if( m.Blessed && m.AccessLevel > AccessLevel.Player )
   b = true;
  else if( m.Blessed && m.AccessLevel == AccessLevel.Player )
   m.Blessed = false;
  new ClientPatchTimer( m, Required, Suggested, WebsiteURL, b ).Start();
}