Hi,

I have been trying to allow members of the same guild to loot each other's kills without getting criminal flagged. It works with this mod, but every now and then the server crashes and I'm not sure why. At first it was caused when a monster rummaged a corpse so I added a check for PlayerMobile but it still crashes.

I modified IsCriminalAction in Corpse.cs as follows:

Code:
 public bool IsCriminalAction( Mobile from )
 {
 if ( from is PlayerMobile )
 {
 if ( from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster )
 return false;

// David: Test if looter and corpse owner are in the same guild
 Guild g = from.Guild as Guild;
 Guild cg = m_Killer.Guild as Guild;
 if ( g != null && cg != null && g == cg )
 return false;
//return ( NotorietyHandlers.CorpseNotoriety( from, this ) == Notoriety.Ally );

 Party p = Party.Get( m_Owner );

 if ( p != null && p.Contains( from ) )
 {
 PartyMemberInfo pmi = p[m_Owner];
 
 if ( pmi != null && pmi.CanLoot )
 return false;
 }

 return ( NotorietyHandlers.CorpseNotoriety( from, this ) == Notoriety.Innocent );
 }
 else
 return false; 
 }

And here is my error log:

Code:
RunUO Version 2.4, Build 6039.25627
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.42000
Time: 08/07/2017 19:59:59
Mobiles: 20595
Items: 270762
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.Items.Corpse.IsCriminalAction(Mobile from)
  at Server.Items.Corpse.CanLoot(Mobile from, Item item)
  at Server.Items.Corpse.CheckLoot(Mobile from, Item item)
  at Server.Items.Corpse.Open(Mobile from, Boolean checkSelfLoot)
  at Server.Mobile.Use(Item item)
  at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
  at Server.Network.MessagePump.HandleReceive(NetState ns)
  at Server.Network.MessagePump.Slice()
  at Server.Core.Main(String[] args)

Thanks

David
 
Ahh I wonder. But it's a corpse so something must have killed it! Perhaps m_Killer only relates to something killed by a player. Thanks. I will investigate that.
 
Yea, but if a GM kills something using a command, or a trap kill something, the killer is null. There is not always a killer.
 
I know that one of the crashes was caused when my co-GM killed something so you may be onto something

And I bet razor opened the corpse...
 
That fixed the crash, however I have got the logic wrong. If the killer is not in a guild, the corpse is lootable by all. I think I need to re-work the whole thing.
 
Back