mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
feat(Core/Modules): add separated lib for modules (#9281)
This commit is contained in:
@@ -40,10 +40,6 @@
|
||||
#include "VMapMgr2.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
union u_map_magic
|
||||
{
|
||||
char asChar[4];
|
||||
@@ -2999,37 +2995,38 @@ void InstanceMap::AfterPlayerUnlinkFromMap()
|
||||
|
||||
void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask)
|
||||
{
|
||||
if (instance_data != nullptr)
|
||||
return;
|
||||
#ifdef ELUNA
|
||||
bool isElunaAI = false;
|
||||
instance_data = sEluna->GetInstanceData(this);
|
||||
if (instance_data)
|
||||
isElunaAI = true;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isOtherAI = false;
|
||||
|
||||
sScriptMgr->OnBeforeCreateInstanceScript(this, instance_data, load, data, completedEncounterMask);
|
||||
|
||||
if (instance_data)
|
||||
isOtherAI = true;
|
||||
|
||||
// if Eluna AI was fetched succesfully we should not call CreateInstanceData nor set the unused scriptID
|
||||
if (!isElunaAI)
|
||||
if (!isOtherAI)
|
||||
{
|
||||
#endif
|
||||
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(GetId());
|
||||
if (mInstance)
|
||||
{
|
||||
i_script_id = mInstance->ScriptId;
|
||||
instance_data = sScriptMgr->CreateInstanceScript(this);
|
||||
}
|
||||
#ifdef ELUNA
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!instance_data)
|
||||
return;
|
||||
|
||||
#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
|
||||
if (!isOtherAI || !load)
|
||||
{
|
||||
instance_data->Initialize();
|
||||
}
|
||||
|
||||
if (load)
|
||||
{
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
#include "MapMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
MapInstanced::MapInstanced(uint32 id) : Map(id, 0, DUNGEON_DIFFICULTY_NORMAL)
|
||||
{
|
||||
// initialize instanced maps list
|
||||
@@ -253,23 +250,17 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun
|
||||
bool MapInstanced::DestroyInstance(InstancedMaps::iterator& itr)
|
||||
{
|
||||
itr->second->RemoveAllPlayers();
|
||||
|
||||
if (itr->second->HavePlayers())
|
||||
{
|
||||
++itr;
|
||||
return false;
|
||||
}
|
||||
|
||||
sScriptMgr->OnDestroyInstance(this, itr->second);
|
||||
|
||||
itr->second->UnloadAll();
|
||||
|
||||
// Free up the instance id and allow it to be reused for bgs and arenas (other instances are handled in the InstanceSaveMgr)
|
||||
//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++);
|
||||
|
||||
@@ -26,7 +26,7 @@ class MapInstanced : public Map
|
||||
{
|
||||
friend class MapMgr;
|
||||
public:
|
||||
typedef std::unordered_map< uint32, Map*> InstancedMaps;
|
||||
using InstancedMaps = std::unordered_map<uint32, Map*>;
|
||||
|
||||
MapInstanced(uint32 id);
|
||||
~MapInstanced() override {}
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
MapMgr::MapMgr()
|
||||
{
|
||||
i_timer[3].SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE));
|
||||
|
||||
Reference in New Issue
Block a user