Server will automatically restart, do not know in what circumstances, prompt the following error:

RunUO Version 0.5, Build 5758.41976
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 4.0.30319.1
Time: 2015-10-13 9:09:41
Mobiles: 39646
Items: 205796
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Network.PacketHandlers.DropReq6017(NetState state, PacketReader pvSrc) in e:\ServUO\Server\Network\PacketHandlers.cs:line 1241
at Server.Network.MessagePump.HandleReceive(NetState ns) in e:\ServUO\Server\Network\MessagePump.cs:line 198
at Server.Network.MessagePump.Slice() in e:\ServUO\Server\Network\MessagePump.cs:line 121
at Server.Core.Main(String[] args) in e:\ServUO\Server\Main.cs:line 571
 
I provided the wrong file, hope I can get help, if you also need to ask him to file, tell me, please, thank you.
 

Attachments

  • MessagePump.cs
    7.5 KB · Views: 4
  • NetState.cs
    30.9 KB · Views: 3
  • PacketHandlers.cs
    82.7 KB · Views: 7
  • Main.cs
    21 KB · Views: 3
Hello there !

Personally, I use this DropReq6017 :
Code:
#region GeNova: KR Support
public static void DropReq6017(NetState state, PacketReader pvSrc)
{
   if (state.IsKRClient)
   {
      Serial m_item = pvSrc.ReadInt32();
      int x = pvSrc.ReadInt16();
      int y = pvSrc.ReadInt16();
      int z = pvSrc.ReadSByte();
      int GridLocation = pvSrc.ReadByte();
      Serial dest = pvSrc.ReadInt32();

      var loc = new Point3D(x, y, z);

      var from = state.Mobile;

      if (dest.IsMobile)
      {
          from.Drop(World.FindMobile(dest), loc);
      }
      else if (dest.IsItem)
      {
      var item = World.FindItem(dest);

      if (item is BaseMulti && ((BaseMulti) item).AllowsRelativeDrop)
      {
          loc.m_X += item.X;
          loc.m_Y += item.Y;
          from.Drop(loc);
      }
      else if (item is Container)
      {
          var m_container = item as Container;
          var items = m_container.FindItemsByType(typeof (Item));
          var canDropGrid = true;
          foreach (var itemDropOn in items)
          {
              if (itemDropOn.GridLocation == GridLocation && itemDropOn.Parent != null && itemDropOn.Parent == m_container)
              {
                    canDropGrid = false;
                    break;
              }
          }
          if (canDropGrid && m_item != null && World.FindItem(m_item) != null)
          {
              World.FindItem(m_item).GridLocation = GridLocation;
          }
          else
         {
              var m_sadd = true;
              for (var i = 0; i <= items.Length; i++)
              {
                  foreach (var itemDropOn in items)
                  {
                       if (itemDropOn.GridLocation == i && itemDropOn.Parent != null && itemDropOn.Parent == m_container)
                       {
                            m_sadd = false;
                        }
                   }
             if (m_sadd && m_item != null && World.FindItem(m_item) != null)
             {
                    World.FindItem(m_item).GridLocation = i;
                     break;
              }
             if (i != items.Length)
             {
                  m_sadd = true;
              }
        }
        if (!m_sadd && (items.Length < 125) && m_item != null && World.FindItem(m_item) != null)
       {
               World.FindItem(m_item).GridLocation = items.Length;
        }
     }
  }
  from.Drop(item, loc);
  }
  else
  {
         from.Drop(loc);
  }

  if (state != null)
  {
         state.Send(new KRDropConfirm());
  }
  }
  else
  {
          pvSrc.ReadInt32(); // serial, ignored
           int x = pvSrc.ReadInt16();
           int y = pvSrc.ReadInt16();
           int z = pvSrc.ReadSByte();
           pvSrc.ReadByte(); // Grid Location?
           Serial dest = pvSrc.ReadInt32();

           var loc = new Point3D(x, y, z);

           var from = state.Mobile;

  if (dest.IsMobile)
  {
         from.Drop(World.FindMobile(dest), loc);
  }
  else if (dest.IsItem)
  {
         var item = World.FindItem(dest);

  if (item is BaseMulti && ((BaseMulti) item).AllowsRelativeDrop)
  {
         loc.m_X += item.X;
         loc.m_Y += item.Y;
         from.Drop(loc);
  }
  else
  {
         from.Drop(item, loc);
  }
  }
  else
  {
         from.Drop(loc);
  }
  }
  }

  #endregion

It's a bit modified, but it used to work ;)

The important parts are the null checks, like : if (m_sadd && m_item != null && World.FindItem(m_item) != null)

Hopefully this helps you out !
I can't test it out on real live servers anymore, but as I said, it used to work ^^


Edit : sorry for the bad indentation, it seems not to get fixed in here :p
 
Last edited:
Hello there !

Personally, I use this DropReq6017 :
Code:
#region GeNova: KR Support
public static void DropReq6017(NetState state, PacketReader pvSrc)
{
   if (state.IsKRClient)
   {
      Serial m_item = pvSrc.ReadInt32();
      int x = pvSrc.ReadInt16();
      int y = pvSrc.ReadInt16();
      int z = pvSrc.ReadSByte();
      int GridLocation = pvSrc.ReadByte();
      Serial dest = pvSrc.ReadInt32();

      var loc = new Point3D(x, y, z);

      var from = state.Mobile;

      if (dest.IsMobile)
      {
          from.Drop(World.FindMobile(dest), loc);
      }
      else if (dest.IsItem)
      {
      var item = World.FindItem(dest);

      if (item is BaseMulti && ((BaseMulti) item).AllowsRelativeDrop)
      {
          loc.m_X += item.X;
          loc.m_Y += item.Y;
          from.Drop(loc);
      }
      else if (item is Container)
      {
          var m_container = item as Container;
          var items = m_container.FindItemsByType(typeof (Item));
          var canDropGrid = true;
          foreach (var itemDropOn in items)
          {
              if (itemDropOn.GridLocation == GridLocation && itemDropOn.Parent != null && itemDropOn.Parent == m_container)
              {
                    canDropGrid = false;
                    break;
              }
          }
          if (canDropGrid && m_item != null && World.FindItem(m_item) != null)
          {
              World.FindItem(m_item).GridLocation = GridLocation;
          }
          else
         {
              var m_sadd = true;
              for (var i = 0; i <= items.Length; i++)
              {
                  foreach (var itemDropOn in items)
                  {
                       if (itemDropOn.GridLocation == i && itemDropOn.Parent != null && itemDropOn.Parent == m_container)
                       {
                            m_sadd = false;
                        }
                   }
             if (m_sadd && m_item != null && World.FindItem(m_item) != null)
             {
                    World.FindItem(m_item).GridLocation = i;
                     break;
              }
             if (i != items.Length)
             {
                  m_sadd = true;
              }
        }
        if (!m_sadd && (items.Length < 125) && m_item != null && World.FindItem(m_item) != null)
       {
               World.FindItem(m_item).GridLocation = items.Length;
        }
     }
  }
  from.Drop(item, loc);
  }
  else
  {
         from.Drop(loc);
  }

  if (state != null)
  {
         state.Send(new KRDropConfirm());
  }
  }
  else
  {
          pvSrc.ReadInt32(); // serial, ignored
           int x = pvSrc.ReadInt16();
           int y = pvSrc.ReadInt16();
           int z = pvSrc.ReadSByte();
           pvSrc.ReadByte(); // Grid Location?
           Serial dest = pvSrc.ReadInt32();

           var loc = new Point3D(x, y, z);

           var from = state.Mobile;

  if (dest.IsMobile)
  {
         from.Drop(World.FindMobile(dest), loc);
  }
  else if (dest.IsItem)
  {
         var item = World.FindItem(dest);

  if (item is BaseMulti && ((BaseMulti) item).AllowsRelativeDrop)
  {
         loc.m_X += item.X;
         loc.m_Y += item.Y;
         from.Drop(loc);
  }
  else
  {
         from.Drop(item, loc);
  }
  }
  else
  {
         from.Drop(loc);
  }
  }
  }

  #endregion

It's a bit modified, but it used to work ;)

The important parts are the null checks, like : if (m_sadd && m_item != null && World.FindItem(m_item) != null)

Hopefully this helps you out !
I can't test it out on real live servers anymore, but as I said, it used to work ^^


Edit : sorry for the bad indentation, it seems not to get fixed in here :p


Thanks, I will test it later.
 
Back