mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna Removed mutex lock and forced only one map update thread to be used. Made returning more arguments than pushed to return the return amount of nils instead. Removed a few hooks
This commit is contained in:
@@ -324,15 +324,12 @@ namespace LuaCreature
|
|||||||
uint32 targetType = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 targetType = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
bool playerOnly = sEluna->CHECKVAL<bool>(L, 3, false);
|
bool playerOnly = sEluna->CHECKVAL<bool>(L, 3, false);
|
||||||
uint32 position = sEluna->CHECKVAL<uint32>(L, 4, 0);
|
uint32 position = sEluna->CHECKVAL<uint32>(L, 4, 0);
|
||||||
float dist = sEluna->CHECKVAL<float>(L, 5, 0.0f);
|
float dist = sEluna->CHECKVAL<float>(L, 5, -1.0f);
|
||||||
int32 aura = sEluna->CHECKVAL<int32>(L, 6, 0);
|
int32 aura = sEluna->CHECKVAL<int32>(L, 6, 0);
|
||||||
|
|
||||||
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
ThreatList const& threatlist = creature->getThreatManager().getThreatList();
|
||||||
if (position >= threatlist.size())
|
if (position >= threatlist.size())
|
||||||
{
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
std::list<Unit*> targetList;
|
std::list<Unit*> targetList;
|
||||||
for (ThreatList::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
for (ThreatList::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
|
||||||
@@ -352,10 +349,7 @@ namespace LuaCreature
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (position >= targetList.size())
|
if (position >= targetList.size())
|
||||||
{
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST)
|
||||||
targetList.sort(Eluna::ObjectDistanceOrderPred(creature));
|
targetList.sort(Eluna::ObjectDistanceOrderPred(creature));
|
||||||
@@ -368,7 +362,6 @@ namespace LuaCreature
|
|||||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||||
std::advance(itr, position);
|
std::advance(itr, position);
|
||||||
sEluna->Push(L, *itr);
|
sEluna->Push(L, *itr);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
case SELECT_TARGET_FARTHEST:
|
case SELECT_TARGET_FARTHEST:
|
||||||
case SELECT_TARGET_BOTTOMAGGRO:
|
case SELECT_TARGET_BOTTOMAGGRO:
|
||||||
@@ -376,20 +369,17 @@ namespace LuaCreature
|
|||||||
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
|
std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
|
||||||
std::advance(ritr, position);
|
std::advance(ritr, position);
|
||||||
sEluna->Push(L, *ritr);
|
sEluna->Push(L, *ritr);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
case SELECT_TARGET_RANDOM:
|
case SELECT_TARGET_RANDOM:
|
||||||
{
|
{
|
||||||
std::list<Unit*>::const_iterator itr = targetList.begin();
|
std::list<Unit*>::const_iterator itr = targetList.begin();
|
||||||
std::advance(itr, urand(position, targetList.size() - 1));
|
std::advance(itr, urand(position, targetList.size() - 1));
|
||||||
sEluna->Push(L, *itr);
|
sEluna->Push(L, *itr);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
luaL_argerror(L, 2, "SelectAggroTarget expected");
|
luaL_argerror(L, 2, "SelectAggroTarget expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,36 +24,24 @@ namespace LuaGameObject
|
|||||||
|
|
||||||
int IsSpawned(lua_State* L, GameObject* go)
|
int IsSpawned(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, go->isSpawned());
|
sEluna->Push(L, go->isSpawned());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IsTransport(lua_State* L, GameObject* go)
|
int IsTransport(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, go->IsTransport());
|
sEluna->Push(L, go->IsTransport());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IsActive(lua_State* L, GameObject* go)
|
int IsActive(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, go->isActiveObject());
|
sEluna->Push(L, go->isActiveObject());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*int IsDestructible(lua_State* L, GameObject* go) // TODO: Implementation core side
|
/*int IsDestructible(lua_State* L, GameObject* go) // TODO: Implementation core side
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, go->IsDestructibleBuilding());
|
sEluna->Push(L, go->IsDestructibleBuilding());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
@@ -61,27 +49,18 @@ namespace LuaGameObject
|
|||||||
/* GETTERS */
|
/* GETTERS */
|
||||||
int GetDisplayId(lua_State* L, GameObject* go)
|
int GetDisplayId(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sEluna->Push(L, go->GetDisplayId());
|
sEluna->Push(L, go->GetDisplayId());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetGoState(lua_State* L, GameObject* go)
|
int GetGoState(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sEluna->Push(L, go->GetGoState());
|
sEluna->Push(L, go->GetGoState());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLootState(lua_State* L, GameObject* go)
|
int GetLootState(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
sEluna->Push(L, go->getLootState());
|
sEluna->Push(L, go->getLootState());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -89,9 +68,6 @@ namespace LuaGameObject
|
|||||||
/* SETTERS */
|
/* SETTERS */
|
||||||
int SetGoState(lua_State* L, GameObject* go)
|
int SetGoState(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint32 state = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
uint32 state = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
||||||
|
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
@@ -106,9 +82,6 @@ namespace LuaGameObject
|
|||||||
|
|
||||||
int SetLootState(lua_State* L, GameObject* go)
|
int SetLootState(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint32 state = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
uint32 state = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
||||||
|
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
@@ -132,11 +105,8 @@ namespace LuaGameObject
|
|||||||
|
|
||||||
int RemoveFromWorld(lua_State* L, GameObject* go)
|
int RemoveFromWorld(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
bool deldb = sEluna->CHECKVAL<bool>(L, 2, false);
|
||||||
return 0;
|
if (deldb)
|
||||||
|
|
||||||
bool del = sEluna->CHECKVAL<bool>(L, 2, false);
|
|
||||||
if (del)
|
|
||||||
go->DeleteFromDB();
|
go->DeleteFromDB();
|
||||||
go->RemoveFromWorld();
|
go->RemoveFromWorld();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -153,8 +123,6 @@ namespace LuaGameObject
|
|||||||
functionRef = sEluna->m_EventMgr.AddEvent(&go->m_Events, functionRef, delay, repeats, go);
|
functionRef = sEluna->m_EventMgr.AddEvent(&go->m_Events, functionRef, delay, repeats, go);
|
||||||
if (functionRef)
|
if (functionRef)
|
||||||
sEluna->Push(L, functionRef);
|
sEluna->Push(L, functionRef);
|
||||||
else
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,9 +141,6 @@ namespace LuaGameObject
|
|||||||
|
|
||||||
int UseDoorOrButton(lua_State* L, GameObject* go)
|
int UseDoorOrButton(lua_State* L, GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !go->IsInWorld())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint32 delay = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
uint32 delay = sEluna->CHECKVAL<uint32>(L, 2, 0);
|
||||||
|
|
||||||
go->UseDoorOrButton(delay);
|
go->UseDoorOrButton(delay);
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ namespace LuaGlobalFunctions
|
|||||||
sEluna->Push(L, 2);
|
sEluna->Push(L, 2);
|
||||||
#elif defined(CATA)
|
#elif defined(CATA)
|
||||||
sEluna->Push(L, 3);
|
sEluna->Push(L, 3);
|
||||||
#else
|
|
||||||
sEluna->Push(L);
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -118,7 +116,7 @@ namespace LuaGlobalFunctions
|
|||||||
|
|
||||||
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
||||||
if (!map)
|
if (!map)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
int tbl = lua_gettop(L);
|
int tbl = lua_gettop(L);
|
||||||
@@ -439,7 +437,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
||||||
if (!query)
|
if (!query)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
QueryResult* result = NULL;
|
QueryResult* result = NULL;
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
@@ -450,7 +448,7 @@ namespace LuaGlobalFunctions
|
|||||||
result = new QueryResult(res);
|
result = new QueryResult(res);
|
||||||
#endif
|
#endif
|
||||||
if (!result)
|
if (!result)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
sEluna->Push(L, result);
|
sEluna->Push(L, result);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -459,6 +457,7 @@ namespace LuaGlobalFunctions
|
|||||||
int WorldDBExecute(lua_State* L)
|
int WorldDBExecute(lua_State* L)
|
||||||
{
|
{
|
||||||
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
||||||
|
if (query)
|
||||||
WorldDatabase.Execute(query);
|
WorldDatabase.Execute(query);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -466,6 +465,8 @@ namespace LuaGlobalFunctions
|
|||||||
int CharDBQuery(lua_State* L)
|
int CharDBQuery(lua_State* L)
|
||||||
{
|
{
|
||||||
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
||||||
|
if (!query)
|
||||||
|
return 1;
|
||||||
|
|
||||||
QueryResult* result = NULL;
|
QueryResult* result = NULL;
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
@@ -476,7 +477,7 @@ namespace LuaGlobalFunctions
|
|||||||
result = new QueryResult(res);
|
result = new QueryResult(res);
|
||||||
#endif
|
#endif
|
||||||
if (!result)
|
if (!result)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
sEluna->Push(L, result);
|
sEluna->Push(L, result);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -485,6 +486,7 @@ namespace LuaGlobalFunctions
|
|||||||
int CharDBExecute(lua_State* L)
|
int CharDBExecute(lua_State* L)
|
||||||
{
|
{
|
||||||
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
||||||
|
if (query)
|
||||||
CharacterDatabase.Execute(query);
|
CharacterDatabase.Execute(query);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -511,6 +513,7 @@ namespace LuaGlobalFunctions
|
|||||||
int AuthDBExecute(lua_State* L)
|
int AuthDBExecute(lua_State* L)
|
||||||
{
|
{
|
||||||
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
const char* query = sEluna->CHECKVAL<const char*>(L, 1);
|
||||||
|
if (query)
|
||||||
LoginDatabase.Execute(query);
|
LoginDatabase.Execute(query);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -526,8 +529,6 @@ namespace LuaGlobalFunctions
|
|||||||
functionRef = sEluna->m_EventMgr.AddEvent(&sEluna->m_EventMgr.GlobalEvents, functionRef, delay, repeats);
|
functionRef = sEluna->m_EventMgr.AddEvent(&sEluna->m_EventMgr.GlobalEvents, functionRef, delay, repeats);
|
||||||
if (functionRef)
|
if (functionRef)
|
||||||
sEluna->Push(L, functionRef);
|
sEluna->Push(L, functionRef);
|
||||||
else
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,13 +570,13 @@ namespace LuaGlobalFunctions
|
|||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
uint32 phase = sEluna->CHECKVAL<uint32>(L, 11, PHASEMASK_NORMAL);
|
uint32 phase = sEluna->CHECKVAL<uint32>(L, 11, PHASEMASK_NORMAL);
|
||||||
if (!phase)
|
if (!phase)
|
||||||
return 0;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
||||||
if (!map)
|
if (!map)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (spawntype == 1) // spawn creature
|
if (spawntype == 1) // spawn creature
|
||||||
{
|
{
|
||||||
@@ -583,7 +584,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
|
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
|
||||||
if (!cinfo)
|
if (!cinfo)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
#if (defined(TBC) || defined(CLASSIC))
|
#if (defined(TBC) || defined(CLASSIC))
|
||||||
CreatureCreatePos pos(map, x, y, z, o);
|
CreatureCreatePos pos(map, x, y, z, o);
|
||||||
@@ -594,12 +595,12 @@ namespace LuaGlobalFunctions
|
|||||||
// used guids from specially reserved range (can be 0 if no free values)
|
// used guids from specially reserved range (can be 0 if no free values)
|
||||||
uint32 lowguid = sObjectMgr->GenerateStaticCreatureLowGuid();
|
uint32 lowguid = sObjectMgr->GenerateStaticCreatureLowGuid();
|
||||||
if (!lowguid)
|
if (!lowguid)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (!pCreature->Create(lowguid, pos, cinfo))
|
if (!pCreature->Create(lowguid, pos, cinfo))
|
||||||
{
|
{
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TBC
|
#ifdef TBC
|
||||||
@@ -626,7 +627,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
|
CreatureInfo const* cinfo = ObjectMgr::GetCreatureTemplate(entry);
|
||||||
if (!cinfo)
|
if (!cinfo)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
TemporarySummon* pCreature = new TemporarySummon(ObjectGuid(uint64(0)));
|
TemporarySummon* pCreature = new TemporarySummon(ObjectGuid(uint64(0)));
|
||||||
#if (defined(TBC) || defined(CLASSIC))
|
#if (defined(TBC) || defined(CLASSIC))
|
||||||
@@ -638,7 +639,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, TEAM_NONE))
|
if (!pCreature->Create(map->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, TEAM_NONE))
|
||||||
{
|
{
|
||||||
delete pCreature;
|
delete pCreature;
|
||||||
return NULL;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCreature->SetRespawnCoord(pos);
|
pCreature->SetRespawnCoord(pos);
|
||||||
@@ -665,12 +666,12 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(entry);
|
const GameObjectInfo* gInfo = ObjectMgr::GetGameObjectInfo(entry);
|
||||||
if (!gInfo)
|
if (!gInfo)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
// used guids from specially reserved range (can be 0 if no free values)
|
// used guids from specially reserved range (can be 0 if no free values)
|
||||||
uint32 db_lowGUID = sObjectMgr->GenerateStaticGameObjectLowGuid();
|
uint32 db_lowGUID = sObjectMgr->GenerateStaticGameObjectLowGuid();
|
||||||
if (!db_lowGUID)
|
if (!db_lowGUID)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
GameObject* pGameObj = new GameObject;
|
GameObject* pGameObj = new GameObject;
|
||||||
#if (defined(TBC) || defined(CLASSIC))
|
#if (defined(TBC) || defined(CLASSIC))
|
||||||
@@ -680,7 +681,7 @@ namespace LuaGlobalFunctions
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
delete pGameObj;
|
delete pGameObj;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (durorresptime)
|
if (durorresptime)
|
||||||
@@ -699,7 +700,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!pGameObj->LoadFromDB(db_lowGUID, map))
|
if (!pGameObj->LoadFromDB(db_lowGUID, map))
|
||||||
{
|
{
|
||||||
delete pGameObj;
|
delete pGameObj;
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG_LOG(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o);
|
// DEBUG_LOG(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o);
|
||||||
@@ -721,7 +722,7 @@ namespace LuaGlobalFunctions
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
delete pGameObj;
|
delete pGameObj;
|
||||||
return NULL;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pGameObj->SetRespawnTime(durorresptime / IN_MILLISECONDS);
|
pGameObj->SetRespawnTime(durorresptime / IN_MILLISECONDS);
|
||||||
@@ -735,7 +736,7 @@ namespace LuaGlobalFunctions
|
|||||||
#else
|
#else
|
||||||
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
Map* map = sMapMgr->FindMap(mapID, instanceID);
|
||||||
if (!map)
|
if (!map)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
Position pos = { x, y, z, o };
|
Position pos = { x, y, z, o };
|
||||||
|
|
||||||
@@ -747,7 +748,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, x, y, z, o))
|
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, x, y, z, o))
|
||||||
{
|
{
|
||||||
delete creature;
|
delete creature;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), phase);
|
||||||
@@ -756,7 +757,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!creature->LoadCreatureFromDB(db_lowguid, map))
|
if (!creature->LoadCreatureFromDB(db_lowguid, map))
|
||||||
{
|
{
|
||||||
delete creature;
|
delete creature;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sObjectMgr->AddCreatureToGrid(db_lowguid, sObjectMgr->GetCreatureData(db_lowguid));
|
sObjectMgr->AddCreatureToGrid(db_lowguid, sObjectMgr->GetCreatureData(db_lowguid));
|
||||||
@@ -766,7 +767,7 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime);
|
TempSummon* creature = map->SummonCreature(entry, pos, NULL, durorresptime);
|
||||||
if (!creature)
|
if (!creature)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (durorresptime)
|
if (durorresptime)
|
||||||
creature->SetTempSummonType(TEMPSUMMON_TIMED_OR_DEAD_DESPAWN);
|
creature->SetTempSummonType(TEMPSUMMON_TIMED_OR_DEAD_DESPAWN);
|
||||||
@@ -783,10 +784,10 @@ namespace LuaGlobalFunctions
|
|||||||
{
|
{
|
||||||
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||||
if (!objectInfo)
|
if (!objectInfo)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
|
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
GameObject* object = new GameObject;
|
GameObject* object = new GameObject;
|
||||||
uint32 lowguid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
uint32 lowguid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
||||||
@@ -794,7 +795,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!object->Create(lowguid, objectInfo->entry, map, phase, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
if (!object->Create(lowguid, objectInfo->entry, map, phase, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||||
{
|
{
|
||||||
delete object;
|
delete object;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (durorresptime)
|
if (durorresptime)
|
||||||
@@ -809,7 +810,7 @@ namespace LuaGlobalFunctions
|
|||||||
if (!object->LoadGameObjectFromDB(lowguid, map))
|
if (!object->LoadGameObjectFromDB(lowguid, map))
|
||||||
{
|
{
|
||||||
delete object;
|
delete object;
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sObjectMgr->AddGameobjectToGrid(lowguid, sObjectMgr->GetGOData(lowguid));
|
sObjectMgr->AddGameobjectToGrid(lowguid, sObjectMgr->GetGOData(lowguid));
|
||||||
@@ -820,7 +821,7 @@ namespace LuaGlobalFunctions
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePacket(opcode, size)
|
// CreatePacket(opcode, size)
|
||||||
|
|||||||
63
HookMgr.cpp
63
HookMgr.cpp
@@ -257,17 +257,6 @@ public:
|
|||||||
sEluna->ServerEventBindings.EndCall();
|
sEluna->ServerEventBindings.EndCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMotdChange(std::string& newMotd) override
|
|
||||||
{
|
|
||||||
if (!sEluna->ServerEventBindings.HasEvents(WORLD_EVENT_ON_MOTD_CHANGE))
|
|
||||||
return;
|
|
||||||
ELUNA_GUARD();
|
|
||||||
sEluna->ServerEventBindings.BeginCall(WORLD_EVENT_ON_MOTD_CHANGE);
|
|
||||||
sEluna->Push(sEluna->L, newMotd);
|
|
||||||
sEluna->ServerEventBindings.ExecuteCall();
|
|
||||||
sEluna->ServerEventBindings.EndCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
|
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask) override
|
||||||
{
|
{
|
||||||
if (!sEluna->ServerEventBindings.HasEvents(WORLD_EVENT_ON_SHUTDOWN_INIT))
|
if (!sEluna->ServerEventBindings.HasEvents(WORLD_EVENT_ON_SHUTDOWN_INIT))
|
||||||
@@ -592,41 +581,6 @@ void HookMgr::OnQuestAbandon(Player* pPlayer, uint32 questId)
|
|||||||
sEluna->PlayerEventBindings.EndCall();
|
sEluna->PlayerEventBindings.EndCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HookMgr::OnGmTicketCreate(Player* pPlayer, std::string& ticketText)
|
|
||||||
{
|
|
||||||
if (!sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_GM_TICKET_CREATE))
|
|
||||||
return;
|
|
||||||
ELUNA_GUARD();
|
|
||||||
sEluna->PlayerEventBindings.BeginCall(PLAYER_EVENT_ON_GM_TICKET_CREATE);
|
|
||||||
sEluna->Push(sEluna->L, pPlayer);
|
|
||||||
sEluna->Push(sEluna->L, ticketText);
|
|
||||||
sEluna->PlayerEventBindings.ExecuteCall();
|
|
||||||
sEluna->PlayerEventBindings.EndCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HookMgr::OnGmTicketUpdate(Player* pPlayer, std::string& ticketText)
|
|
||||||
{
|
|
||||||
if (!sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_GM_TICKET_UPDATE))
|
|
||||||
return;
|
|
||||||
ELUNA_GUARD();
|
|
||||||
sEluna->PlayerEventBindings.BeginCall(PLAYER_EVENT_ON_GM_TICKET_UPDATE);
|
|
||||||
sEluna->Push(sEluna->L, pPlayer);
|
|
||||||
sEluna->Push(sEluna->L, ticketText);
|
|
||||||
sEluna->PlayerEventBindings.ExecuteCall();
|
|
||||||
sEluna->PlayerEventBindings.EndCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HookMgr::OnGmTicketDelete(Player* pPlayer)
|
|
||||||
{
|
|
||||||
if (!sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_GM_TICKET_DELETE))
|
|
||||||
return;
|
|
||||||
ELUNA_GUARD();
|
|
||||||
sEluna->PlayerEventBindings.BeginCall(PLAYER_EVENT_ON_GM_TICKET_DELETE);
|
|
||||||
sEluna->Push(sEluna->L, pPlayer);
|
|
||||||
sEluna->PlayerEventBindings.ExecuteCall();
|
|
||||||
sEluna->PlayerEventBindings.EndCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HookMgr::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot)
|
void HookMgr::OnEquip(Player* pPlayer, Item* pItem, uint8 bag, uint8 slot)
|
||||||
{
|
{
|
||||||
if (!sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_EQUIP))
|
if (!sEluna->PlayerEventBindings.HasEvents(PLAYER_EVENT_ON_EQUIP))
|
||||||
@@ -1565,21 +1519,6 @@ bool HookMgr::OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* p
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HookMgr::OnQuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
|
|
||||||
{
|
|
||||||
int bind = sEluna->CreatureEventBindings.GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_SELECT);
|
|
||||||
if (!bind)
|
|
||||||
return false;
|
|
||||||
ELUNA_GUARD();
|
|
||||||
sEluna->BeginCall(bind);
|
|
||||||
sEluna->Push(sEluna->L, CREATURE_EVENT_ON_QUEST_SELECT);
|
|
||||||
sEluna->Push(sEluna->L, pPlayer);
|
|
||||||
sEluna->Push(sEluna->L, pCreature);
|
|
||||||
sEluna->Push(sEluna->L, pQuest);
|
|
||||||
sEluna->ExecuteCall(4, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HookMgr::OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
|
bool HookMgr::OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
|
||||||
{
|
{
|
||||||
int bind = sEluna->CreatureEventBindings.GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_COMPLETE);
|
int bind = sEluna->CreatureEventBindings.GetBind(pCreature->GetEntry(), CREATURE_EVENT_ON_QUEST_COMPLETE);
|
||||||
@@ -1892,7 +1831,7 @@ struct ElunaCreatureAI : ScriptedAI
|
|||||||
// Enables use of MoveInLineOfSight
|
// Enables use of MoveInLineOfSight
|
||||||
bool IsVisible(Unit* who) const override
|
bool IsVisible(Unit* who) const override
|
||||||
{
|
{
|
||||||
return me->IsWithinLOSInMap(who);
|
return true
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
18
HookMgr.h
18
HookMgr.h
@@ -104,7 +104,7 @@ enum ServerEvents
|
|||||||
// World // Not implemented on mangos
|
// World // Not implemented on mangos
|
||||||
WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open)
|
WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open)
|
||||||
WORLD_EVENT_ON_CONFIG_LOAD = 9, // (event, reload)
|
WORLD_EVENT_ON_CONFIG_LOAD = 9, // (event, reload)
|
||||||
WORLD_EVENT_ON_MOTD_CHANGE = 10, // (event, newMOTD)
|
// UNUSED = 10, // (event)
|
||||||
WORLD_EVENT_ON_SHUTDOWN_INIT = 11, // (event, code, mask)
|
WORLD_EVENT_ON_SHUTDOWN_INIT = 11, // (event, code, mask)
|
||||||
WORLD_EVENT_ON_SHUTDOWN_CANCEL = 12, // (event)
|
WORLD_EVENT_ON_SHUTDOWN_CANCEL = 12, // (event)
|
||||||
WORLD_EVENT_ON_UPDATE = 13, // (event, diff)
|
WORLD_EVENT_ON_UPDATE = 13, // (event, diff)
|
||||||
@@ -183,10 +183,10 @@ enum PlayerEvents
|
|||||||
PLAYER_EVENT_ON_REPOP = 35, // (event, player)
|
PLAYER_EVENT_ON_REPOP = 35, // (event, player)
|
||||||
PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
|
PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
|
||||||
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
|
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
|
||||||
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId) // Not on TC
|
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
|
||||||
PLAYER_EVENT_ON_GM_TICKET_CREATE = 39, // (event, player, ticketText) // Not on TC
|
// UNUSED = 39, // (event, player)
|
||||||
PLAYER_EVENT_ON_GM_TICKET_UPDATE = 40, // (event, player, ticketText) // Not on TC
|
// UNUSED = 40, // (event, player)
|
||||||
PLAYER_EVENT_ON_GM_TICKET_DELETE = 41, // (event, player) // Not on TC
|
// UNUSED = 41, // (event, player)
|
||||||
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - Can return false
|
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - Can return false
|
||||||
|
|
||||||
PLAYER_EVENT_COUNT
|
PLAYER_EVENT_COUNT
|
||||||
@@ -267,12 +267,12 @@ enum CreatureEvents
|
|||||||
CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature)
|
CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature)
|
||||||
// UNUSED = 25, // (event, creature)
|
// UNUSED = 25, // (event, creature)
|
||||||
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay)
|
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay)
|
||||||
CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit)
|
CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) // Doesnt actually check LOS
|
||||||
// UNUSED = 28, // (event, creature)
|
// UNUSED = 28, // (event, creature)
|
||||||
// UNUSED = 29, // (event, creature)
|
// UNUSED = 29, // (event, creature)
|
||||||
CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature)
|
CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature)
|
||||||
CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest)
|
CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest)
|
||||||
CREATURE_EVENT_ON_QUEST_SELECT = 32, // (event, player, creature, quest)
|
// UNUSED = 32, // (event, creature)
|
||||||
CREATURE_EVENT_ON_QUEST_COMPLETE = 33, // (event, player, creature, quest)
|
CREATURE_EVENT_ON_QUEST_COMPLETE = 33, // (event, player, creature, quest)
|
||||||
CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt)
|
CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt)
|
||||||
CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
|
CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
|
||||||
@@ -339,9 +339,6 @@ public:
|
|||||||
void OnRepop(Player* pPlayer);
|
void OnRepop(Player* pPlayer);
|
||||||
void OnResurrect(Player* pPlayer);
|
void OnResurrect(Player* pPlayer);
|
||||||
void OnQuestAbandon(Player* pPlayer, uint32 questId);
|
void OnQuestAbandon(Player* pPlayer, uint32 questId);
|
||||||
void OnGmTicketCreate(Player* pPlayer, std::string& ticketText);
|
|
||||||
void OnGmTicketUpdate(Player* pPlayer, std::string& ticketText);
|
|
||||||
void OnGmTicketDelete(Player* pPlayer);
|
|
||||||
InventoryResult OnCanUseItem(const Player* pPlayer, uint32 itemEntry);
|
InventoryResult OnCanUseItem(const Player* pPlayer, uint32 itemEntry);
|
||||||
void OnEngineRestart();
|
void OnEngineRestart();
|
||||||
bool OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel);
|
bool OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel);
|
||||||
@@ -360,7 +357,6 @@ public:
|
|||||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action);
|
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action);
|
||||||
bool OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code);
|
bool OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code);
|
||||||
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||||
bool OnQuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
|
||||||
bool OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
bool OnQuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||||
bool OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
bool OnQuestReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest);
|
||||||
uint32 GetDialogStatus(Player* pPlayer, Creature* pCreature);
|
uint32 GetDialogStatus(Player* pPlayer, Creature* pCreature);
|
||||||
|
|||||||
@@ -136,12 +136,13 @@ namespace LuaItem
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support
|
int IsRefundExpired(lua_State* L, Item* item)// TODO: Implement core support
|
||||||
{
|
{
|
||||||
/*sEluna->Push(L, item->IsRefundExpired());
|
sEluna->Push(L, item->IsRefundExpired());
|
||||||
return 1;*/
|
return 1;
|
||||||
return 0; // Temp till supported
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* GETTERS */
|
/* GETTERS */
|
||||||
int GetItemLink(lua_State* L, Item* item)
|
int GetItemLink(lua_State* L, Item* item)
|
||||||
@@ -271,7 +272,7 @@ namespace LuaItem
|
|||||||
uint32 enchant_slot = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 enchant_slot = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
if (enchant_slot >= MAX_INSPECTED_ENCHANTMENT_SLOT)
|
if (enchant_slot >= MAX_INSPECTED_ENCHANTMENT_SLOT)
|
||||||
return 0;
|
return luaL_argerror(L, 2, "valid EnchantmentSlot expected");
|
||||||
|
|
||||||
sEluna->Push(L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
|
sEluna->Push(L, item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
62
LuaEngine.h
62
LuaEngine.h
@@ -122,6 +122,8 @@ enum SelectAggroTarget
|
|||||||
#define Opcodes OpcodesList
|
#define Opcodes OpcodesList
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
#undef UNORDERED_MAP
|
||||||
|
#define UNORDERED_MAP std::unordered_map
|
||||||
#ifndef CATA
|
#ifndef CATA
|
||||||
typedef uint64 ObjectGuid;
|
typedef uint64 ObjectGuid;
|
||||||
#endif
|
#endif
|
||||||
@@ -268,7 +270,18 @@ public:
|
|||||||
ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1)));
|
ElunaRegister<T>* l = static_cast<ElunaRegister<T>*>(lua_touserdata(L, lua_upvalueindex(1)));
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return 0;
|
return 0;
|
||||||
return l->mfunc(L, obj);
|
int args = lua_gettop(L);
|
||||||
|
int expected = l->mfunc(L, obj);
|
||||||
|
args = lua_gettop(L) - args;
|
||||||
|
if (args <= 0 || args > expected)
|
||||||
|
{
|
||||||
|
if (args < 0 || args > expected) // Assert instead?
|
||||||
|
ELUNA_LOG_ERROR("[Eluna]: %s returned unexpected amount of arguments %i out of %i. Report to devs", l->name, args, expected);
|
||||||
|
return expected;
|
||||||
|
}
|
||||||
|
for (; args < expected; ++args)
|
||||||
|
lua_pushnil(L);
|
||||||
|
return expected;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tostringT(lua_State* L)
|
static int tostringT(lua_State* L)
|
||||||
@@ -455,11 +468,11 @@ class Eluna
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class ScriptMgr;
|
friend class ScriptMgr;
|
||||||
friend class ACE_Singleton<Eluna, ACE_Null_Mutex>;
|
// friend class ACE_Singleton<Eluna, ACE_Null_Mutex>;
|
||||||
|
|
||||||
lua_State* L;
|
lua_State* L;
|
||||||
EventMgr m_EventMgr;
|
EventMgr m_EventMgr;
|
||||||
ACE_Recursive_Thread_Mutex lock;
|
// ACE_Recursive_Thread_Mutex lock;
|
||||||
|
|
||||||
Eluna()
|
Eluna()
|
||||||
{
|
{
|
||||||
@@ -511,7 +524,7 @@ public:
|
|||||||
struct EntryBind
|
struct EntryBind
|
||||||
{
|
{
|
||||||
typedef std::map<int, int> ElunaBindingMap;
|
typedef std::map<int, int> ElunaBindingMap;
|
||||||
typedef std::map<uint32, ElunaBindingMap> ElunaEntryMap;
|
typedef UNORDERED_MAP<uint32, ElunaBindingMap> ElunaEntryMap;
|
||||||
|
|
||||||
~EntryBind()
|
~EntryBind()
|
||||||
{
|
{
|
||||||
@@ -697,46 +710,7 @@ template<> Corpse* Eluna::CHECKOBJ<Corpse>(lua_State* L, int narg, bool error);
|
|||||||
#define sEluna ACE_Singleton<Eluna, ACE_Null_Mutex>::instance()
|
#define sEluna ACE_Singleton<Eluna, ACE_Null_Mutex>::instance()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#define ELUNA_GUARD() // ACE_Guard< ACE_Recursive_Thread_Mutex > ELUNA_GUARD_OBJECT(sEluna->lock);
|
||||||
class FakeLock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static bool locked;
|
|
||||||
FakeLock()
|
|
||||||
{
|
|
||||||
if (locked)
|
|
||||||
printf("ELUNA_GUARD CREATE\n");
|
|
||||||
locked = true;
|
|
||||||
}
|
|
||||||
~FakeLock()
|
|
||||||
{
|
|
||||||
if (!locked)
|
|
||||||
printf("ELUNA_GUARD DELETE\n");
|
|
||||||
locked = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
class FakeRecursiveLock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static uint32 locked;
|
|
||||||
FakeRecursiveLock()
|
|
||||||
{
|
|
||||||
++locked;
|
|
||||||
if (locked > 1)
|
|
||||||
printf("GUARD LOCK %u\n", locked);
|
|
||||||
}
|
|
||||||
~FakeRecursiveLock()
|
|
||||||
{
|
|
||||||
if (!locked)
|
|
||||||
printf("GUARD FAULTY\n");
|
|
||||||
else if (locked > 1)
|
|
||||||
printf("GUARD RELE %u\n", locked);
|
|
||||||
--locked;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
#define ELUNA_GUARD() \
|
|
||||||
ACE_Guard< ACE_Recursive_Thread_Mutex > ELUNA_GUARD_OBJECT(sEluna->lock);
|
|
||||||
|
|
||||||
class LuaTaxiMgr
|
class LuaTaxiMgr
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -956,9 +956,6 @@ ElunaRegister<Quest> QuestMethods[] =
|
|||||||
#endif
|
#endif
|
||||||
{ "IsRepeatable", &LuaQuest::IsRepeatable }, // :IsRepeatable() - Returns true or false if the quest is repeatable
|
{ "IsRepeatable", &LuaQuest::IsRepeatable }, // :IsRepeatable() - Returns true or false if the quest is repeatable
|
||||||
|
|
||||||
// Setters
|
|
||||||
{ "SetFlag", &LuaQuest::SetFlag }, // :SetFlag(flag) - Sets the flag of the quest by the specified flag
|
|
||||||
|
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ namespace LuaMap
|
|||||||
uint32 phasemask = sEluna->CHECKVAL<uint32>(L, 4, 1);
|
uint32 phasemask = sEluna->CHECKVAL<uint32>(L, 4, 1);
|
||||||
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
|
float z = map->GetHeight(phasemask, x, y, MAX_HEIGHT);
|
||||||
#endif
|
#endif
|
||||||
if (z == INVALID_HEIGHT)
|
if (z != INVALID_HEIGHT)
|
||||||
return 0;
|
|
||||||
sEluna->Push(L, z);
|
sEluna->Push(L, z);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,8 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
uint32 talentId = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 talentId = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
uint8 spec = sEluna->CHECKVAL<uint8>(L, 3);
|
uint8 spec = sEluna->CHECKVAL<uint8>(L, 3);
|
||||||
if (spec >= MAX_TALENT_SPECS)
|
if (spec < MAX_TALENT_SPECS)
|
||||||
sEluna->Push(L, false);
|
return 1;
|
||||||
else
|
|
||||||
sEluna->Push(L, player->HasTalent(talentId, spec));
|
sEluna->Push(L, player->HasTalent(talentId, spec));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -87,8 +86,6 @@ namespace LuaPlayer
|
|||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||||
if (titleInfo)
|
if (titleInfo)
|
||||||
sEluna->Push(L, player->HasTitle(titleInfo));
|
sEluna->Push(L, player->HasTitle(titleInfo));
|
||||||
else
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -724,7 +721,7 @@ namespace LuaPlayer
|
|||||||
int GetGuildName(lua_State* L, Player* player)
|
int GetGuildName(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
if (!player->GetGuildId())
|
if (!player->GetGuildId())
|
||||||
return 0;
|
return 1;
|
||||||
sEluna->Push(L, sGuildMgr->GetGuildNameById(player->GetGuildId()));
|
sEluna->Push(L, sGuildMgr->GetGuildNameById(player->GetGuildId()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -808,7 +805,7 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
uint8 slot = sEluna->CHECKVAL<uint8>(L, 2);
|
uint8 slot = sEluna->CHECKVAL<uint8>(L, 2);
|
||||||
if (slot >= EQUIPMENT_SLOT_END)
|
if (slot >= EQUIPMENT_SLOT_END)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
||||||
sEluna->Push(L, item);
|
sEluna->Push(L, item);
|
||||||
@@ -953,8 +950,6 @@ namespace LuaPlayer
|
|||||||
std::string accName;
|
std::string accName;
|
||||||
if (sAccountMgr->GetName(player->GetSession()->GetAccountId(), accName))
|
if (sAccountMgr->GetName(player->GetSession()->GetAccountId(), accName))
|
||||||
sEluna->Push(L, accName);
|
sEluna->Push(L, accName);
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1474,9 +1469,8 @@ namespace LuaPlayer
|
|||||||
int SendListInventory(lua_State* L, Player* player)
|
int SendListInventory(lua_State* L, Player* player)
|
||||||
{
|
{
|
||||||
WorldObject* obj = sEluna->CHECKOBJ<WorldObject>(L, 2);
|
WorldObject* obj = sEluna->CHECKOBJ<WorldObject>(L, 2);
|
||||||
uint32 entry = sEluna->CHECKVAL<uint32>(L, 3, 0);
|
|
||||||
|
|
||||||
player->GetSession()->SendListInventory(obj->GET_GUID()), entry;
|
player->GetSession()->SendListInventory(obj->GET_GUID());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,20 +1796,20 @@ namespace LuaPlayer
|
|||||||
uint32 slot = sEluna->CHECKVAL<uint32>(L, 3);
|
uint32 slot = sEluna->CHECKVAL<uint32>(L, 3);
|
||||||
|
|
||||||
if (slot >= INVENTORY_SLOT_BAG_END)
|
if (slot >= INVENTORY_SLOT_BAG_END)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
uint32 entry = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 entry = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
item = Item::CreateItem(entry, 1, player);
|
item = Item::CreateItem(entry, 1, player);
|
||||||
if (!item)
|
if (!item)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
InventoryResult result = player->CanEquipItem(slot, dest, item, false);
|
InventoryResult result = player->CanEquipItem(slot, dest, item, false);
|
||||||
if (result != EQUIP_ERR_OK)
|
if (result != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
delete item;
|
delete item;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
player->ItemAddedQuestCheck(entry, 1);
|
player->ItemAddedQuestCheck(entry, 1);
|
||||||
#if (!defined(TBC) && !defined(CLASSIC))
|
#if (!defined(TBC) && !defined(CLASSIC))
|
||||||
@@ -1826,7 +1820,7 @@ namespace LuaPlayer
|
|||||||
{
|
{
|
||||||
InventoryResult result = player->CanEquipItem(slot, dest, item, false);
|
InventoryResult result = player->CanEquipItem(slot, dest, item, false);
|
||||||
if (result != EQUIP_ERR_OK)
|
if (result != EQUIP_ERR_OK)
|
||||||
return 0;
|
return 1;
|
||||||
player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true);
|
player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1905,7 +1899,7 @@ namespace LuaPlayer
|
|||||||
};
|
};
|
||||||
static const uint32 skillsSize = sizeof(skillsArray) / sizeof(*skillsArray);
|
static const uint32 skillsSize = sizeof(skillsArray) / sizeof(*skillsArray);
|
||||||
|
|
||||||
for (int i = 0; i < skillsSize; ++i)
|
for (uint32 i = 0; i < skillsSize; ++i)
|
||||||
{
|
{
|
||||||
if (player->HasSkill(skillsArray[i]))
|
if (player->HasSkill(skillsArray[i]))
|
||||||
player->UpdateSkill(skillsArray[i], step);
|
player->UpdateSkill(skillsArray[i], step);
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ namespace LuaQuery
|
|||||||
int IsNull(lua_State* L, QueryResult* result)
|
int IsNull(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
|
||||||
sEluna->Push(L, true);
|
|
||||||
else
|
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].IsNULL());
|
sEluna->Push(L, RESULT->Fetch()[col].IsNULL());
|
||||||
#else
|
#else
|
||||||
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].IsNull());
|
sEluna->Push(L, RESULT->Fetch()[col].IsNull());
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
@@ -32,33 +31,23 @@ namespace LuaQuery
|
|||||||
/* GETTERS */
|
/* GETTERS */
|
||||||
int GetColumnCount(lua_State* L, QueryResult* result)
|
int GetColumnCount(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
if (!result)
|
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->GetFieldCount());
|
sEluna->Push(L, RESULT->GetFieldCount());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetRowCount(lua_State* L, QueryResult* result)
|
int GetRowCount(lua_State* L, QueryResult* result)
|
||||||
{
|
|
||||||
if (!result)
|
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (RESULT->GetRowCount() > (uint32)-1)
|
if (RESULT->GetRowCount() > (uint32)-1)
|
||||||
sEluna->Push(L, (uint32)-1);
|
sEluna->Push(L, (uint32)-1);
|
||||||
else
|
else
|
||||||
sEluna->Push(L, RESULT->GetRowCount());
|
sEluna->Push(L, RESULT->GetRowCount());
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetBool(lua_State* L, QueryResult* result)
|
int GetBool(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetBool());
|
sEluna->Push(L, RESULT->Fetch()[col].GetBool());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -66,9 +55,7 @@ namespace LuaQuery
|
|||||||
int GetUInt8(lua_State* L, QueryResult* result)
|
int GetUInt8(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetUInt8());
|
sEluna->Push(L, RESULT->Fetch()[col].GetUInt8());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -76,9 +63,7 @@ namespace LuaQuery
|
|||||||
int GetUInt16(lua_State* L, QueryResult* result)
|
int GetUInt16(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetUInt16());
|
sEluna->Push(L, RESULT->Fetch()[col].GetUInt16());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -86,9 +71,7 @@ namespace LuaQuery
|
|||||||
int GetUInt32(lua_State* L, QueryResult* result)
|
int GetUInt32(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetUInt32());
|
sEluna->Push(L, RESULT->Fetch()[col].GetUInt32());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -96,9 +79,7 @@ namespace LuaQuery
|
|||||||
int GetUInt64(lua_State* L, QueryResult* result)
|
int GetUInt64(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetUInt64());
|
sEluna->Push(L, RESULT->Fetch()[col].GetUInt64());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -106,9 +87,7 @@ namespace LuaQuery
|
|||||||
int GetInt8(lua_State* L, QueryResult* result)
|
int GetInt8(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetInt8());
|
sEluna->Push(L, RESULT->Fetch()[col].GetInt8());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -116,9 +95,7 @@ namespace LuaQuery
|
|||||||
int GetInt16(lua_State* L, QueryResult* result)
|
int GetInt16(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetInt16());
|
sEluna->Push(L, RESULT->Fetch()[col].GetInt16());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -126,9 +103,7 @@ namespace LuaQuery
|
|||||||
int GetInt32(lua_State* L, QueryResult* result)
|
int GetInt32(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetInt32());
|
sEluna->Push(L, RESULT->Fetch()[col].GetInt32());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -136,9 +111,7 @@ namespace LuaQuery
|
|||||||
int GetInt64(lua_State* L, QueryResult* result)
|
int GetInt64(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetInt64());
|
sEluna->Push(L, RESULT->Fetch()[col].GetInt64());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -146,9 +119,7 @@ namespace LuaQuery
|
|||||||
int GetFloat(lua_State* L, QueryResult* result)
|
int GetFloat(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0.0f);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetFloat());
|
sEluna->Push(L, RESULT->Fetch()[col].GetFloat());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -156,9 +127,7 @@ namespace LuaQuery
|
|||||||
int GetDouble(lua_State* L, QueryResult* result)
|
int GetDouble(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, 0.0);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetDouble());
|
sEluna->Push(L, RESULT->Fetch()[col].GetDouble());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -166,9 +135,7 @@ namespace LuaQuery
|
|||||||
int GetString(lua_State* L, QueryResult* result)
|
int GetString(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 col = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
if (!result || col >= RESULT->GetFieldCount())
|
if (col < RESULT->GetFieldCount())
|
||||||
sEluna->Push(L, "");
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->Fetch()[col].GetString());
|
sEluna->Push(L, RESULT->Fetch()[col].GetString());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -176,9 +143,6 @@ namespace LuaQuery
|
|||||||
/* OTHER */
|
/* OTHER */
|
||||||
int NextRow(lua_State* L, QueryResult* result)
|
int NextRow(lua_State* L, QueryResult* result)
|
||||||
{
|
{
|
||||||
if (!result)
|
|
||||||
sEluna->Push(L, false);
|
|
||||||
else
|
|
||||||
sEluna->Push(L, RESULT->NextRow());
|
sEluna->Push(L, RESULT->NextRow());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,13 +93,5 @@ namespace LuaQuest
|
|||||||
sEluna->Push(L, quest->GetMaxLevel());
|
sEluna->Push(L, quest->GetMaxLevel());
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* SETTERS */
|
|
||||||
int SetFlag(lua_State* L, Quest* quest)
|
|
||||||
{
|
|
||||||
uint32 flag = sEluna->CHECKVAL<uint32>(L, 2);
|
|
||||||
quest->SetSpecialFlag((QuestSpecialFlags)flag);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ namespace LuaSpell
|
|||||||
{
|
{
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
|
if (!(spell->m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
|
||||||
return 0;
|
return 3;
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
spell->m_targets.getDestination(x, y, z);
|
spell->m_targets.getDestination(x, y, z);
|
||||||
#else
|
#else
|
||||||
if (!spell->m_targets.HasDst())
|
if (!spell->m_targets.HasDst())
|
||||||
return 0;
|
return 3;
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
spell->m_targets.GetDstPos()->GetPosition(x, y, z);
|
spell->m_targets.GetDstPos()->GetPosition(x, y, z);
|
||||||
#endif
|
#endif
|
||||||
@@ -81,8 +81,6 @@ namespace LuaSpell
|
|||||||
sEluna->Push(sEluna->L, target);
|
sEluna->Push(sEluna->L, target);
|
||||||
else if (Unit* target = spell->m_targets.getUnitTarget())
|
else if (Unit* target = spell->m_targets.getUnitTarget())
|
||||||
sEluna->Push(sEluna->L, target);
|
sEluna->Push(sEluna->L, target);
|
||||||
else
|
|
||||||
sEluna->Push(sEluna->L);
|
|
||||||
#else
|
#else
|
||||||
if (GameObject* target = spell->m_targets.GetGOTarget())
|
if (GameObject* target = spell->m_targets.GetGOTarget())
|
||||||
sEluna->Push(L, target);
|
sEluna->Push(L, target);
|
||||||
@@ -94,8 +92,6 @@ namespace LuaSpell
|
|||||||
sEluna->Push(L, target);
|
sEluna->Push(L, target);
|
||||||
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
|
else if (WorldObject* target = spell->m_targets.GetObjectTarget())
|
||||||
sEluna->Push(L, target);
|
sEluna->Push(L, target);
|
||||||
else
|
|
||||||
sEluna->Push(L);
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ namespace LuaUnit
|
|||||||
uint32 stat = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 stat = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
if (stat >= MAX_STATS)
|
if (stat >= MAX_STATS)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
sEluna->Push(L, unit->GetStat((Stats)stat));
|
sEluna->Push(L, unit->GetStat((Stats)stat));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -514,7 +514,7 @@ namespace LuaUnit
|
|||||||
uint32 spellschool = sEluna->CHECKVAL<uint32>(L, 2);
|
uint32 spellschool = sEluna->CHECKVAL<uint32>(L, 2);
|
||||||
|
|
||||||
if (spellschool >= MAX_SPELL_SCHOOL)
|
if (spellschool >= MAX_SPELL_SCHOOL)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
sEluna->Push(L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool));
|
sEluna->Push(L, unit->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + spellschool));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1260,12 +1260,12 @@ namespace LuaUnit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrepareMove(Unit* unit)
|
// static void PrepareMove(Unit* unit)
|
||||||
{
|
// {
|
||||||
unit->GetMotionMaster()->MovementExpired(); // Chase
|
// unit->GetMotionMaster()->MovementExpired(); // Chase
|
||||||
unit->StopMoving(); // Some
|
// unit->StopMoving(); // Some
|
||||||
unit->GetMotionMaster()->Clear(); // all
|
// unit->GetMotionMaster()->Clear(); // all
|
||||||
}
|
// }
|
||||||
|
|
||||||
int MoveStop(lua_State* L, Unit* unit)
|
int MoveStop(lua_State* L, Unit* unit)
|
||||||
{
|
{
|
||||||
@@ -1479,11 +1479,11 @@ namespace LuaUnit
|
|||||||
Unit* target = sEluna->CHECKOBJ<Unit>(L, 3);
|
Unit* target = sEluna->CHECKOBJ<Unit>(L, 3);
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
#ifdef MANGOS
|
#ifdef MANGOS
|
||||||
if (!IsSpellAppliesAura(spellInfo) && !IsSpellHaveEffect(spellInfo, SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
if (!IsSpellAppliesAura(spellInfo) && !IsSpellHaveEffect(spellInfo, SPELL_EFFECT_PERSISTENT_AREA_AURA))
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
SpellAuraHolder* holder = CreateSpellAuraHolder(spellInfo, target, unit);
|
SpellAuraHolder* holder = CreateSpellAuraHolder(spellInfo, target, unit);
|
||||||
|
|
||||||
@@ -1559,8 +1559,6 @@ namespace LuaUnit
|
|||||||
functionRef = sEluna->m_EventMgr.AddEvent(&unit->m_Events, functionRef, delay, repeats, unit);
|
functionRef = sEluna->m_EventMgr.AddEvent(&unit->m_Events, functionRef, delay, repeats, unit);
|
||||||
if (functionRef)
|
if (functionRef)
|
||||||
sEluna->Push(L, functionRef);
|
sEluna->Push(L, functionRef);
|
||||||
else
|
|
||||||
sEluna->Push(L);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1675,13 +1673,13 @@ namespace LuaUnit
|
|||||||
|
|
||||||
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(61);
|
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(61);
|
||||||
if (!properties)
|
if (!properties)
|
||||||
return 0;
|
return 1;
|
||||||
Position pos;
|
Position pos;
|
||||||
pos.Relocate(x,y,z,o);
|
pos.Relocate(x,y,z,o);
|
||||||
TempSummon* summon = unit->GetMap()->SummonCreature(entry, pos, properties, desp, unit);
|
TempSummon* summon = unit->GetMap()->SummonCreature(entry, pos, properties, desp, unit);
|
||||||
|
|
||||||
if (!summon)
|
if (!summon)
|
||||||
return 0;
|
return 1;
|
||||||
|
|
||||||
if (summon->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
if (summon->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||||
((Guardian*)summon)->InitStatsForLevel(unit->getLevel());
|
((Guardian*)summon)->InitStatsForLevel(unit->getLevel());
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ namespace LuaWorldObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetWorldObject(lua_State* L, WorldObject* obj)
|
int GetWorldObject(lua_State* L, WorldObject* obj)
|
||||||
@@ -302,7 +302,6 @@ namespace LuaWorldObject
|
|||||||
#endif
|
#endif
|
||||||
case HIGHGUID_UNIT:
|
case HIGHGUID_UNIT:
|
||||||
case HIGHGUID_PET: sEluna->Push(L, obj->GetMap()->GetAnyTypeCreature(ObjectGuid(guid))); break;
|
case HIGHGUID_PET: sEluna->Push(L, obj->GetMap()->GetAnyTypeCreature(ObjectGuid(guid))); break;
|
||||||
default: return 0;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch (GUID_HIPART(guid))
|
switch (GUID_HIPART(guid))
|
||||||
@@ -314,7 +313,6 @@ namespace LuaWorldObject
|
|||||||
case HIGHGUID_VEHICLE:
|
case HIGHGUID_VEHICLE:
|
||||||
case HIGHGUID_UNIT: sEluna->Push(L, sObjectAccessor->GetCreature(*obj, ObjectGuid(guid))); break;
|
case HIGHGUID_UNIT: sEluna->Push(L, sObjectAccessor->GetCreature(*obj, ObjectGuid(guid))); break;
|
||||||
case HIGHGUID_PET: sEluna->Push(L, sObjectAccessor->GetPet(*obj, ObjectGuid(guid))); break;
|
case HIGHGUID_PET: sEluna->Push(L, sObjectAccessor->GetPet(*obj, ObjectGuid(guid))); break;
|
||||||
default: return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user