PDA

View Full Version : Mob/Pet Logic


Zuesrooster
08-13-2006, 04:34 PM
Had a friend of mine complain that his fire pet wasn't working on my server, I looked into the code and I found some lines of code I had to change to make it work. Just wanted to see if these where real bugs or if there are repercussions to the changes I made, also to let anyone who runs into this problem know how to possible fix it.

MobAI.cpp Line 145
It use to be:

&& !(tar->IsPet() && tar->GetOwner()->IsClient()) //no buffing PC's pets

this doesn't seem to account for when a pet is trying to buff itself. so i changed it to:

&& !(tar->IsPet() && tar->GetOwner()->IsClient() && tar != this)

this seamed to fix it but then the next problem was it was casting it nonstop.

spells_effect.cpp line 67:

if(spell.buffdurationformula != 0 && spell.buffduration > 0)
The pets spell has a duration = 0 (spell_id = 927) so i changed it to >=, this is the change that worries me the most because I don't know if that assumption is made anywhere else in code and the mismatch might cause a problem.

Finally on the mob::CanBuffStack method I added

if(curbuf.spellid == spellid)
return(-1);

I didn't think NPC's had to worry about refreshing their buff's since they cast so often. This seemed to fix the problem with the fire pets. It might also fix the problem with airpets casting invis on owners nonstop (they shouldn't even be casting it on anything but themselves but I'll look into that later). I haven't played EQ live in a really long time so maybe the mechanics ahve changed and my changes are outdated. Unkown if this address the problem with NPC's casting frequently.

fathernitwit
08-14-2006, 12:30 PM
hey,

thanks for the changes, looks relatively good, I changed the buff duration stuff to:
if((spell.buffdurationformula != 0 && spell.buffduration > 0) || spell.buffdurationformula == 50) {