RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Bug Fix in SVN - SpellHelper.cs

HellRazor

Knight
Bug Fix in SVN - SpellHelper.cs

While playing around with the XMLAttachments system I found a bug in SpellHelper.cs.

SpellHelper.cs has a method to call Damage where the source of the spell (from) is NULL.

Code:
public static void Damage( TimeSpan delay, Mobile target, double damage, int phys, int fire, int cold, int pois, int nrgy )
{
  Damage( delay, target, null, damage, phys, fire, cold, pois, nrgy );
}

XMLAttachments make use of this so you can add an attachment to say, a cannon, and make it fire spells at people who come into range.

The bug pops up later in SpellHelper.cs when DoLeech is called. DoLeech requires from to be a mobile, but has no error checking. This results in a crash if from is null.

To fix, right before:

Code:
DoLeech( damageGiven, from, target );

add:

Code:
 if (from != null )

Also, in the OnTick method, right before:

Code:
DoLeech( damageGiven, m_From, m_Target );

Add:

Code:
if( m_From != null )
 
Basecreature? And Playermobile?

Surely I'm dumb and noob - but BaseCreature? I mean, do BaseCreature contain PlayerMobile also? Wouldn't this break the leeching effect for players?

What if, instead, the if statement checks Mobile instead of BaseCreature?
 

HellRazor

Knight
osd_daedalus;829126 said:
Surely I'm dumb and noob - but BaseCreature? I mean, do BaseCreature contain PlayerMobile also? Wouldn't this break the leeching effect for players?

What if, instead, the if statement checks Mobile instead of BaseCreature?

Good catch, you're right.

Should have just inserted a check to ensure from != null. I'll update my post to correct the fix. Thanks!
 
HellRazor;829325 said:
Good catch, you're right.

Should have just inserted a check to ensure from != null. I'll update my post to correct the fix. Thanks!

enjoy :)

I have also reported it in Demise forums since, as I stated almost everywhere, the RunUO official development is moving from there: maybe you want to have a look here too
 
Top