Beispiel #1
0
Map* MapManager::CreateBgMap(uint32 mapid, BattleGround* bg)
{
    TerrainInfo * pData = sTerrainMgr.LoadTerrain(mapid);

    Guard _guard(*this);
    return CreateBattleGroundMap(mapid, sMapMgr.GenerateInstanceId(), bg);
}
Map* MapManager::CreateBgMap(uint32 mapid, BattleGround* bg)
{
    sTerrainMgr.LoadTerrain(mapid);

    Guard _guard(*this);
    return CreateBattleGroundMap(mapid, sObjectMgr.GenerateInstanceLowGuid(), bg);
}
Map* MapManager::CreateBgMap(uint32 mapid, BattleGround* bg)
{
    TerrainInfo * pData = sTerrainMgr.LoadTerrain(mapid);

    Guard _guard(*this);
    return CreateBattleGroundMap(mapid, sObjectMgr.GenerateLowGuid(HIGHGUID_INSTANCE), bg);
}
Beispiel #4
0
Map* MapManager::CreateBgMap(uint32 mapid, uint32 instanceID, BattleGround* bg)
{
    TerrainInfo * pData = sTerrainMgr.LoadTerrain(mapid);

    ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
    return CreateBattleGroundMap(mapid, instanceID, bg);
}
Beispiel #5
0
Map* MapManager::CreateBgMap(uint32 mapid, BattleGround* bg)
{
    sTerrainMgr.LoadTerrain(mapid);

    ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL)
    return CreateBattleGroundMap(mapid, sMapMgr.GenerateInstanceId(), bg);
}
Beispiel #6
0
/// returns a new or existing Instance
/// in case of battlegrounds it will only return an existing map, those maps are created by bg-system
Map* MapInstanced::CreateInstance(Player * player)
{
    Map* map;
    uint32 NewInstanceId;                                   // instanceId of the resulting map

    if(IsBattleGroundOrArena())
    {
        // instantiate or find existing bg map for player
        // the instance id is set in battlegroundid
        NewInstanceId = player->GetBattleGroundId();
        MANGOS_ASSERT(NewInstanceId);
        map = _FindMap(NewInstanceId);
        if(!map)
            map = CreateBattleGroundMap(NewInstanceId, player->GetBattleGround());
    }
    else if (InstanceSave* pSave = player->GetBoundInstanceSaveForSelfOrGroup(GetId()))
    {
        // solo/perm/group
        NewInstanceId = pSave->GetInstanceId();
        map = _FindMap(NewInstanceId);
        // it is possible that the save exists but the map doesn't
        if (!map)
            map = CreateInstanceMap(NewInstanceId, pSave->GetDifficulty(), pSave);
    }
    else
    {
        // if no instanceId via group members or instance saves is found
        // the instance will be created for the first time
        NewInstanceId = sMapMgr.GenerateInstanceId();

        Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty() : player->GetDifficulty();
        map = CreateInstanceMap(NewInstanceId, diff);
    }

    return map;
}