Eluna create workaround for SetReactState

This commit is contained in:
Rochet2
2014-04-29 22:56:02 +03:00
committed by Foereaper
parent 523e6d50e5
commit 6751208eb2
4 changed files with 20 additions and 25 deletions

View File

@@ -80,14 +80,15 @@ namespace LuaCreature
return 1;
}
int HasReactState(lua_State* L, Creature* creature)
int IsCombatAllowed(lua_State* L, Creature* creature)
{
int32 state = sEluna->CHECKVAL<int32>(L, 2);
#ifdef MANGOS
sEluna->Push(L, creature->GetCharmInfo()->HasReactState((ReactStates)state));
if (CreatureAI* ai = creature->AI())
sEluna->Push(L, ai->IsCombatMovement());
else
sEluna->Push(L, false);
#else
sEluna->Push(L, creature->HasReactState((ReactStates)state));
sEluna->Push(L, !creature->HasReactState(REACT_PASSIVE);
#endif
return 1;
}
@@ -270,16 +271,6 @@ namespace LuaCreature
return 1;
}
int GetReactState(lua_State* L, Creature* creature)
{
#ifdef MANGOS
sEluna->Push(L, creature->GetCharmInfo()->GetReactState());
#else
sEluna->Push(L, creature->GetReactState());
#endif
return 1;
}
int GetScriptName(lua_State* L, Creature* creature)
{
sEluna->Push(L, creature->GetScriptName());
@@ -480,14 +471,15 @@ namespace LuaCreature
return 0;
}
int SetReactState(lua_State* L, Creature* creature)
int SetAllowedCombat(lua_State* L, Creature* creature)
{
int32 state = sEluna->CHECKVAL<int32>(L, 2);
bool allow = sEluna->CHECKVAL<bool>(L, 2);
#ifdef MANGOS
creature->GetCharmInfo()->SetReactState((ReactStates)state);
if (CreatureAI* ai = creature->AI())
ai->SetCombatMovement(allow);
#else
creature->SetReactState((ReactStates)state);
creature->SetReactState(allow ? REACT_AGGRESSIVE : REACT_PASSIVE);
#endif
return 0;
}