Eluna implementation (#847)

* azerothcore + eluna done.

* Remove the Eluna single thread limit.

* Read Eluna Settings file.

* submodule change.

* fix(test)  Ubuntu - Cant Link Library after Compile

* The ELUNA is disabled by default.

* remove submodule luaEngine.

* some change

* fix a error

* change cmake

* fix: some onplayerchat does not have hooks.

* Eluna: Add BG event Hooks.

* fix:cmake hook AFTER_LOAD_CONF not work.

* Remove the eluna switch.

* Remove some define in the core.

* fix conf file not read in the linux.

* eluna : change bg hook parameter type

* Remove TC log function call

* change bg hook OnBGEnd parameter type.


Note: to enable Eluna, the module is required
This commit is contained in:
ayase
2018-05-23 02:22:11 +08:00
committed by Barbz
parent 0da1f8c706
commit 00777a80ae
38 changed files with 854 additions and 62 deletions

View File

@@ -24,6 +24,9 @@
#include "VMapFactory.h"
#include "LFGMgr.h"
#include "Chat.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
union u_map_magic
{
@@ -2695,18 +2698,35 @@ void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 compl
{
if (instance_script != NULL)
return;
#ifdef ELUNA
bool isElunaAI = false;
instance_script = sEluna->GetInstanceData(this);
if (instance_script)
isElunaAI = true;
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
if (mInstance)
// if Eluna AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID
if (!isElunaAI)
{
i_script_id = mInstance->ScriptId;
instance_script = sScriptMgr->CreateInstanceScript(this);
#endif
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
if (mInstance)
{
i_script_id = mInstance->ScriptId;
instance_script = sScriptMgr->CreateInstanceScript(this);
}
#ifdef ELUNA
}
#endif
if (!instance_script)
return;
instance_script->Initialize();
#ifdef ELUNA
// use mangos behavior if we are dealing with Eluna AI
// initialize should then be called only if load is false
if (!isElunaAI || !load)
#endif
instance_script->Initialize();
if (load)
{

View File

@@ -15,6 +15,10 @@
#include "Group.h"
#include "Player.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
MapInstanced::MapInstanced(uint32 id) : Map(id, 0, DUNGEON_DIFFICULTY_NORMAL)
{
// initialize instanced maps list
@@ -254,6 +258,11 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
//if (itr->second->IsBattlegroundOrArena())
// sMapMgr->FreeInstanceId(itr->second->GetInstanceId());
#ifdef ELUNA
//todo:[ELUNA] I'm not sure this is right.
sEluna->FreeInstanceId(itr->second->GetInstanceId());
#endif
// erase map
delete itr->second;
m_InstancedMaps.erase(itr++);
@@ -265,4 +274,4 @@ bool MapInstanced::CanEnter(Player* /*player*/, bool /*loginCheck*/)
{
//ASSERT(false);
return true;
}
}

View File

@@ -27,6 +27,9 @@
#include "LFGMgr.h"
#include "Chat.h"
#include "AvgDiffTracker.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
MapManager::MapManager()
{
@@ -42,6 +45,7 @@ MapManager::~MapManager()
void MapManager::Initialize()
{
int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS));
// Start mtmaps if needed.
if (num_threads > 0 && m_updater.activate(num_threads) == -1)
abort();