Using xmllevelitems trying to make summoned / controlled creatures give EXP to the master.
It works, just want to make sure if it is crash free or if thats even the right approach, thanks!


Code:
public static void CheckItems( Mobile killer, Mobile killed )
        {
            if ( killer != null )
            {
                for( int i = 0; i < 25; ++i )
                {
                    Item item = killer.FindItemOnLayer( (Layer)i );

                    XmlLevelItem levitem = XmlAttach.FindAttachment(item, typeof(XmlLevelItem)) as XmlLevelItem;

                    //if ( item != null && item is ILevelable )
                    if (item != null && levitem != null)
                        CheckLevelable(levitem, killer, killed);
                }
            }
           
            // EDIT  trying to give summons/controlled master  exp
            if ( killer != null && killer is BaseCreature )
            {
            BaseCreature bc = (BaseCreature)killer;
             if (bc.Controlled && bc.ControlMaster != null)
            {
            Console.WriteLine("this.Controlled && this.ControlMaster != null");
           LevelItemManager.CheckItems( bc.ControlMaster, killed );
           }
          
        if (bc.Summoned && bc.SummonMaster != null)
          {
          Console.WriteLine("this.Summoned && this.SummonMaster != null");
           LevelItemManager.CheckItems( bc.SummonMaster, killed );
          }
           
         }
           // EDIT  trying to give summons/controlled master  exp
        }
 
Back