Originally Posted by
amadmonk
Okay, I've confirmed; 0x8163C0 seems to correctly get the min/max ranges for any spell against any target. This is important because, for instance, Corruption says that it has a 40yd range, but in reality its 40+/- about 5yds. I don't know where this +/- comes from, but it's definitely there, and can definitely f*ck up your bot's distance routines. 0x8163C0 seems to always return the *real* results that match up with a pos1->pos2 vector length calculation when compared w/IsSpellInRange.
AND it takes into account the different sized melee hit-boxes. So 0x8163C0 is basically your one-stop shop for spell ranges.
IsSpellInRange is mostly just a shim around 0x819900.
int __cdecl sub_819900(void *pCaster, struct SpellEntry *pSpellRow, WGUID guid, bool *bInRange, int, int)
The problem is that 0x819900 is a HUGE function with >100 switch cases. This is probably why nobody has reversed it; there's not (AFAIK) a simple "get the range of this spell" function; instead, the range is calculated in giant switch block, meaning that reversing it is a major pain in the ass.
I feel your pain because right now I don't have a good, deterministic way to find out the spell range for a given spell (the DBC's just give you base ranges, unadjusted for buffs/talents/etc., and of course IsSpellInRange just gives you a yes/no answer, not the ACTUAL range). So I end up hard-coding spell ranges in my bot, which sucks.
---------- Post added at 11:36 AM ---------- Previous post was at 10:16 AM ----------
Okay, I *think* this is it:
void *__cdecl sub_8163C0(void *pCaster, SpellEntry *pSpellEntry, float *pfMinRange, float *pfMaxRange, bool bIsHelpful, void *pTarget)
Not sure what (if anything) the return value is, yet, but it pokes a min range and max range into those float pointers.