Normally after a night of tequila I can figure this out, but I'm still not sure.

In Baseweapon, I need this section
"public override void GetProperties(ObjectPropertyList list)"

to be able to reference Mobile. End goal, I need to be able to reference the weapon level against the mobile level and display a list based on if its greater or lesser then. That part is easy, it's just I'm not sure how to bring mobile into that section properly. Any suggestions or snippets would be appreciated.

If there is a better way of doing this of course I'm all ears. :)
 
Correct. So Lets say the weapon Has a Level on it of 10. The PlayerMobile has a level of about 14. Because of the higher level on the player the weapon list text should state something to the effect of "Will Gain EXP" , and with the values are reversed, as the weapon is of equal are greater level as the player mobile will display "Will not Gain EXP". And this should only be displayed while the weapon is being equipped... So now that I type all this out, I'm starting to think this actually belong to onequip or onadd.... lol
 
// ((Mobile)Parent).Level

if (Parent is Mobile)
{
if ( ((Mobile)Parent).Level > this.Level )
{
list.Add("Will Gain Exp");
}

}

edit: not tested but I think it should work
 
that was the second part I was missing. I got the
"if (Parent is Mobile)"
Now I just need to call the PM, the actual level data stored in the Playermobile, so that is where I need to reference it.
 
then do this?
Code:
if (Parent is PlayerMobile)
{
if ( ((PlayerMobile)Parent).Level > this.Level )
{
list.Add("Will Gain Exp");
}
 
Here is the finished code that compiles, have not tested it yet.

Code:
                if (Parent is Mobile)
                {
                    PlayerMobile pm = (PlayerMobile)Parent;
                    //Find Item on Layer and Name it
                    Item bwtwohanded = pm.FindItemOnLayer(Layer.TwoHanded);//two handed or shield
                    //Find XmlLevelItem on equipment and name it
                    XmlLevelItem bwtwohandedlevel = (XmlLevelItem)XmlAttach.FindAttachment(bwtwohanded, typeof(XmlLevelItem));
                    if (pm.Levell > bwtwohandedlevel.Level )
                    {
                        list.Add( "<BASEFONT COLOR=#7FCAE7>Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
                    }
                }
 
You would just need to change
if(Parent is Mobile)
to
if(Parent is PlayerMobile)
like I had in the post above your solution.
 
Sure enough It did crash. LOL. Handed it to myself and boom.

Yeah I missed your comment before trying it. =p

Code:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Items.BaseWeapon.GetProperties(ObjectPropertyList list)
   at Server.Item.get_PropertyList() in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2128
   at Server.Item.InvalidateProperties() in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2179
   at Server.Item.set_Map(Map value) in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2429
   at Server.Mobile.AddItem(Item item) in k:\AlfheimRebornServer\Ultima Server\Server\Mobile.cs:line 6673
   at Server.Mobile.EquipItem(Item item) in k:\AlfheimRebornServer\Ultima Server\Server\Mobile.cs:line 10770
   at Server.Network.PacketHandlers.EquipReq(NetState state, PacketReader pvSrc) in k:\AlfheimRebornServer\Ultima Server\Server\Network\PacketHandlers.cs:line 1110
   at Server.Network.MessagePump.HandleReceive(NetState ns) in k:\AlfheimRebornServer\Ultima Server\Server\Network\MessagePump.cs:line 187
   at Server.Network.MessagePump.Slice() in k:\AlfheimRebornServer\Ultima Server\Server\Network\MessagePump.cs:line 121
   at Server.Core.Main(String[] args) in k:\AlfheimRebornServer\Ultima Server\Server\Main.cs:line 577

I will implement your suggestion and take a look.
 
eeesh, still having that problem..
Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Items.BaseWeapon.GetProperties(ObjectPropertyList list)
   at Server.Item.get_PropertyList() in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2128
   at Server.Item.InvalidateProperties() in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2179
   at Server.Item.set_Map(Map value) in k:\AlfheimRebornServer\Ultima Server\Server\Item.cs:line 2429
   at Server.Mobile.AddItem(Item item) in k:\AlfheimRebornServer\Ultima Server\Server\Mobile.cs:line 6673
   at Server.Mobile.EquipItem(Item item) in k:\AlfheimRebornServer\Ultima Server\Server\Mobile.cs:line 10770
   at Server.Network.PacketHandlers.EquipReq(NetState state, PacketReader pvSrc) in k:\AlfheimRebornServer\Ultima Server\Server\Network\PacketHandlers.cs:line 1110
   at Server.Network.MessagePump.HandleReceive(NetState ns) in k:\AlfheimRebornServer\Ultima Server\Server\Network\MessagePump.cs:line 187
   at Server.Network.MessagePump.Slice() in k:\AlfheimRebornServer\Ultima Server\Server\Network\MessagePump.cs:line 121
   at Server.Core.Main(String[] args) in k:\AlfheimRebornServer\Ultima Server\Server\Main.cs:line 577

Here is the current code
Code:
            if ( validTypeHumanWeapon2 )    
            {
                if    (Parent != null && Parent is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)Parent;
                    //Find Item on Layer and Name it
                    Item bwtwohanded = pm.FindItemOnLayer(Layer.TwoHanded);//two handed or shield
                    //Find XmlLevelItem on equipment and name it
                    XmlLevelItem bwtwohandedlevel = (XmlLevelItem)XmlAttach.FindAttachment(bwtwohanded, typeof(XmlLevelItem));
                    if (pm.Levell > bwtwohandedlevel.Level )
                    {
                        list.Add( "<BASEFONT COLOR=#7FCAE7>Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
                    }
                }
                else
                    list.Add( "<BASEFONT COLOR=#7FCAE7>Not Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
            }
[doublepost=1495836917][/doublepost]Problem is likely happening Here.
Code:
if (pm.Levell > bwtwohandedlevel.Level )
                    {
                        list.Add( "<BASEFONT COLOR=#7FCAE7>Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
                    }
 
This should no longer crash
Code:
if ( validTypeHumanWeapon2 )   
{
	if (Parent != null && Parent is PlayerMobile)
	{
		PlayerMobile pm = (PlayerMobile)Parent;
		//Find Item on Layer and Name it
		Item bwtwohanded = pm.FindItemOnLayer(Layer.TwoHanded);//two handed or shield
		if(bwtwohanded != null)
		{
			//Find XmlLevelItem on equipment and name it
			XmlLevelItem bwtwohandedlevel = (XmlLevelItem)XmlAttach.FindAttachment(bwtwohanded, typeof(XmlLevelItem));
			if (bwtwohandedlevel != null && pm.Levell > bwtwohandedlevel.Level )
			{
				list.Add( "<BASEFONT COLOR=#7FCAE7>Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
			}
		}
	}
	else
		list.Add( "<BASEFONT COLOR=#7FCAE7>Not Able to Gain EXP" + "<BASEFONT COLOR=#FFFFFF>" );
}
 
Well that did the trick, man that was a lot of null points i missed. Thanks for the assistance. Now I get to replicate that process for ALL the layers... fun fun!
[doublepost=1495837497][/doublepost]The idea will be for the player mobiles levels to influence if they can or cannot gain exp on the equipment. And if the equipment is a higher level then the player mobile they will not be able to equip it.
 
Back