Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 02-07-2010, 05:55 PM   #1 (permalink)
Forum Expert
 
Join Date: Oct 2002
Age: 47
Posts: 4,754
Default 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 )
__________________

Last edited by HellRazor; 02-20-2010 at 06:58 PM. Reason: Fixed a bug in the bug fix!
HellRazor is offline   Reply With Quote
Old 02-19-2010, 05:13 AM   #2 (permalink)
Bug Hunter
 
Join Date: Aug 2008
Location: Italia, near Britannia
Age: 24
Posts: 4,041
Send a message via MSN to osd_daedalus
Default 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?
__________________
If you guys want ML, you are going to have to create it, submit it, and if it is good enough it will more than likely be added to the repository - Jeff
osd_daedalus is online now   Reply With Quote
Old 02-20-2010, 06:54 PM   #3 (permalink)
Forum Expert
 
Join Date: Oct 2002
Age: 47
Posts: 4,754
Default

Quote:
Originally Posted by osd_daedalus View Post
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 is offline   Reply With Quote
Old 02-21-2010, 04:50 AM   #4 (permalink)
Bug Hunter
 
Join Date: Aug 2008
Location: Italia, near Britannia
Age: 24
Posts: 4,041
Send a message via MSN to osd_daedalus
Default

Quote:
Originally Posted by HellRazor View Post
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
__________________
If you guys want ML, you are going to have to create it, submit it, and if it is good enough it will more than likely be added to the repository - Jeff
osd_daedalus is online now   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5