-
Member
[Help][SL 9.2.7] SpellRec::GetCastTime
Hi, trying to get spell cast time call function from lua GetCastTime (4 arg output)
Seems it requres to call WowClientDB::GetRow with SpellRec arg wich i cant recognize both (due obfuscation)
There is a simpler method to get cast time from spellid?
-
Member
I can read addr+18B8, then (100/float)-100 to get % of haste, then do as in formula
Cast Time = Base Cast Time / ((Spell Haste Percentage / 100) + 1)
with 0 % haste Base Cast Time = 2300 as expected
addr+18B8 = 0,823559225
(100/ 0,823559225)-100 = 21,42417572
Cast Time = 2300/(1+21,42417572/100) = 1894,1862165107230426912878696707
Code:
Dump: value=GetHaste()
[1]=21.424049377441 //a little bit different but no affection
Dump: value=GetSpellInfo(194153)
[1]="Starfire",
[3]=135753,
[4]=1853,
[5]=0,
[6]=45,
[7]=194153
where is 41ms?
-
Contributor
I've kind of layed off a bit to give an answer, just due to let you figure out on your own, but are you checking the right table? SpellRec doesn't contain the cast time. It's the SpellCastTimes table that contains the base cast of a spell:
Wago Tools[ID]=259&page=1
Which, the index to that is from the SpellMisc table:
Wago Tools[SpellID]=194153&page=1
From there, you do the hasted calculation. Starfire base cast time should be 2250 also, not 2300 (per the tables)
Doing the math from there:
2250 / ((21.424049377441 / 100) + 1) = 1,853.010183350071
I feel like you're kind of brute forcing things here without actually reversing the code. Ideally you want to get the index to the SpellMisc -> Get the Index to the SpellCastTimes -> Get the value you want
Also, looking at the UnitSpellHaste function, you want to read from 0x18AC
Code:
if ( v16 )
{
v17 = *(float *)(v16 + 0x18AC);
if ( v17 != 0.0 )
v17 = (float)(100.0 / v17) - 100.0;
v18 = v17;
}
else
{
v18 = 0.0;
}
Last edited by scizzydo; 04-09-2024 at 05:58 PM.
-
Post Thanks / Like - 2 Thanks
Trogg,
hackerlol (2 members gave Thanks to scizzydo for this useful post)
-
Member
I was fooled by the game, the tooltip said 2.3, thanks
0x18B8 is from GetHaste
Code:
v5 = *(float*)(v4 + 6328); //18B8
if (v5 != 0.0)
v5 = (float)(100.0 / v5) - 100.0;
my assumptions were based on trying to study the instructions, because, Ida refuses to decompile these functions (including GetSpellInfo), it is clear that a table was used, but not the one that was in wotlk
therefore, as you said, I have to resort to brute force or simply look for changeable values in the fields in CE, things like virtual functions (VT) and unit fields in SL are not yet clear to me
-
Contributor
Originally Posted by
Trogg
I was fooled by the game, the tooltip said 2.3, thanks
0x18B8 is from GetHaste
Code:
v5 = *(float*)(v4 + 6328); //18B8
if (v5 != 0.0)
v5 = (float)(100.0 / v5) - 100.0;
my assumptions were based on trying to study the instructions, because, Ida refuses to decompile these functions (including GetSpellInfo), it is clear that a table was used, but not the one that was in wotlk
therefore, as you said, I have to resort to brute force or simply look for changeable values in the fields in CE, things like virtual functions (VT) and unit fields in SL are not yet clear to me
That haste is melee haste, which may be the same, but I use spell haste when calculating cast times. UnitSpellHaste - Wowpedia - Your wiki guide to the World of Warcraft
Also, if you spend some time learning assembly, wows obfuscation techniques aren't that complex at all. You just can patch their areas to unconditionall jumps where they are using the obfuscation, and clean up where it lands (making data then code again) and it'll all turn to pseudocode after. There's only like 3 or 4 techniques they do to obfuscate it, all of which can be easily reversed (just takes some studying)
Last edited by scizzydo; 04-10-2024 at 08:04 AM.
-
Post Thanks / Like - 2 Thanks
Trogg,
hackerlol (2 members gave Thanks to scizzydo for this useful post)