Improved pushing so that a single userdata is used per object pushed.
Made everything use the singleton less, allowing more free code and easier to implement multithreading later.
Made macros for hookmgr and fixed the issue with hooks called inside hooks.
This commit is contained in:
Rochet2
2014-06-01 23:58:28 +03:00
committed by Foereaper
parent e131f36d39
commit b1f85bfc21
25 changed files with 3169 additions and 3666 deletions

View File

@@ -12,41 +12,41 @@ namespace LuaSpell
/* BOOLEAN */
int IsAutoRepeat(lua_State* L, Spell* spell)
{
sEluna->Push(L, spell->IsAutoRepeat());
Eluna::Push(L, spell->IsAutoRepeat());
return 1;
}
/* GETTERS */
int GetCaster(lua_State* L, Spell* spell)
{
sEluna->Push(L, spell->GetCaster());
Eluna::Push(L, spell->GetCaster());
return 1;
}
int GetCastTime(lua_State* L, Spell* spell)
{
sEluna->Push(L, spell->GetCastTime());
Eluna::Push(L, spell->GetCastTime());
return 1;
}
int GetId(lua_State* L, Spell* spell)
{
sEluna->Push(L, spell->m_spellInfo->Id);
Eluna::Push(L, spell->m_spellInfo->Id);
return 1;
}
int GetPowerCost(lua_State* L, Spell* spell)
{
sEluna->Push(L, spell->GetPowerCost());
Eluna::Push(L, spell->GetPowerCost());
return 1;
}
int GetDuration(lua_State* L, Spell* spell)
{
#ifdef MANGOS
sEluna->Push(L, GetSpellDuration(spell->m_spellInfo));
Eluna::Push(L, GetSpellDuration(spell->m_spellInfo));
#else
sEluna->Push(L, spell->GetSpellInfo()->GetDuration());
Eluna::Push(L, spell->GetSpellInfo()->GetDuration());
#endif
return 1;
}
@@ -64,9 +64,9 @@ namespace LuaSpell
float x, y, z;
spell->m_targets.GetDstPos()->GetPosition(x, y, z);
#endif
sEluna->Push(L, x);
sEluna->Push(L, y);
sEluna->Push(L, z);
Eluna::Push(L, x);
Eluna::Push(L, y);
Eluna::Push(L, z);
return 3;
}
@@ -74,24 +74,24 @@ namespace LuaSpell
{
#ifdef MANGOS
if (GameObject* target = spell->m_targets.getGOTarget())
sEluna->Push(sEluna->L, target);
Eluna::Push(L, target);
else if (Item* target = spell->m_targets.getItemTarget())
sEluna->Push(sEluna->L, target);
Eluna::Push(L, target);
else if (Corpse* target = spell->GetCaster()->GetMap()->GetCorpse(spell->m_targets.getCorpseTargetGuid()))
sEluna->Push(sEluna->L, target);
Eluna::Push(L, target);
else if (Unit* target = spell->m_targets.getUnitTarget())
sEluna->Push(sEluna->L, target);
Eluna::Push(L, target);
#else
if (GameObject* target = spell->m_targets.GetGOTarget())
sEluna->Push(L, target);
Eluna::Push(L, target);
else if (Item* target = spell->m_targets.GetItemTarget())
sEluna->Push(L, target);
Eluna::Push(L, target);
else if (Corpse* target = spell->m_targets.GetCorpseTarget())
sEluna->Push(L, target);
Eluna::Push(L, target);
else if (Unit* target = spell->m_targets.GetUnitTarget())
sEluna->Push(L, target);
Eluna::Push(L, target);
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
sEluna->Push(L, target);
Eluna::Push(L, target);
#endif
return 1;
}
@@ -99,7 +99,7 @@ namespace LuaSpell
/* SETTERS */
int SetAutoRepeat(lua_State* L, Spell* spell)
{
bool repeat = sEluna->CHECKVAL<bool>(L, 2);
bool repeat = Eluna::CHECKVAL<bool>(L, 2);
spell->SetAutoRepeat(repeat);
return 0;
}
@@ -107,7 +107,7 @@ namespace LuaSpell
/* OTHER */
int Cast(lua_State* L, Spell* spell)
{
bool skipCheck = sEluna->CHECKVAL<bool>(L, 2);
bool skipCheck = Eluna::CHECKVAL<bool>(L, 2);
spell->cast(skipCheck);
return 0;
}