Skip to content

Instantly share code, notes, and snippets.

@Warpten
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Warpten/fff346750b82be70ff0c to your computer and use it in GitHub Desktop.
Save Warpten/fff346750b82be70ff0c to your computer and use it in GitHub Desktop.
signed int __cdecl PH_SMSG_SUPERCEDED_SPELL(int a1) // Actually a ptr to struct that 6BD0A0 creates
{
int oldSpellId; // ebx@1
int newSpellId; // esi@1
__int64 v3; // qax@4
CGPlayer_C *currPlr; // edi@4
void *v5; // esi@7
int v7; // ecx@9
unsigned int v8; // eax@9
unsigned int v9; // edi@15
unsigned int v10; // ecx@16
char *v11; // eax@21
oldSpellId = *(a1 + 16);
newSpellId = *(a1 + 20);
if ( SFile::IsStreamingMode() && !__uncaught_exception() )
sub_90FBF0(newSpellId, 0);
v3 = ClntObjMgrGetActivePlayer();
currPlr = ClntObjMgrObjectPtr(
v3,
TYPEMASK_PLAYER,
"d:\\buildserver\\wow\\4\\work\\wow-code\\branches\\wow-patch-4_3_4-branch\\wow\\source\\object\\objectclient\\Player_C.h",
178);
if ( currPlr )
{
sub_958AD0(oldSpellId, newSpellId); // Does macro vodoo
sub_919860(oldSpellId, newSpellId);
CGPlayer_C::RemoveSpell(oldSpellId, 1);
CGPlayer_C::AddKnownSpell(newSpellId, 0, 0, 0);
sub_5C28E0(currPlr); // If old spell aura is active, update id with new
if ( newSpellId >= g_SpellDB.minIndex )
{
if ( newSpellId <= g_SpellDB.maxIndex )
{
v5 = g_SpellDB.Rows[newSpellId - g_SpellDB.minIndex];
if ( v5 )
{
sub_55AFE0(v5);
sub_9BA770(); // Triggers lua event #297 and does more black magic
return 1;
}
}
}
}
else
{
v7 = dword_DD50B0;
v8 = 0;
if ( dword_DD50B0 )
{
while ( *(dword_DD50B4 + 2 * v8) != oldSpellId )
{
++v8;
if ( v8 >= dword_DD50B0 )
goto LABEL_14;
}
*(dword_DD50B4 + 2 * v8) = newSpellId;
v7 = dword_DD50B0;
}
LABEL_14:
if ( v8 == v7 )
{
v9 = v7 + 1;
if ( v7 + 1 > dword_DD50AC )
{
v10 = dword_DD50B8;
if ( !dword_DD50B8 )
v10 = sub_76AAC0(v9);
if ( v9 % v10 )
v9 += v10 - v9 % v10;
sub_554E50(v9);
v7 = dword_DD50B0;
}
v11 = dword_DD50B4 + 8 * v7;
dword_DD50B0 = v7 + 1;
*v11 = newSpellId; // Interesting, call below means spell is stored as u16 even though it aint fitting
*(v11 + 2) = 0;
}
}
sub_9BA770();
return 1;
}
void *__thiscall sub_6BD0A0(void *this, int a2, int a3, int a4, int a5)
{
int v5; // edx@1
void *v6; // esi@1
int v7; // ecx@1
v5 = a5;
v6 = this;
v7 = a3;
*(v6 + 1) = a2;
*(v6 + 2) = v7;
*(v6 + 3) = v5;
*v6 = &off_BC1F98; // gets passed to function 56fdc0
a2 = 0;
CDataStore::GetInt32(&a2);
*(v6 + 5) = a2;
a2 = 0;
CDataStore::GetInt32(&a2);
*(v6 + 4) = a2;
return v6;
}
int __cdecl sub_919860(int a1, int a2)
{
sub_9143D0(a1, 1); // Vodoo
return sub_918680(a2, 1, a1); // GUI Vodoo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment