Core/Disables: Allow to disable certain vMaps through Disables system. Wiki will be updated soon
This commit is contained in:
@@ -41,6 +41,7 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
|
${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic
|
||||||
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
|
${CMAKE_SOURCE_DIR}/src/server/shared/Logging
|
||||||
${CMAKE_SOURCE_DIR}/src/server/shared/Threading
|
${CMAKE_SOURCE_DIR}/src/server/shared/Threading
|
||||||
|
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Management
|
${CMAKE_CURRENT_SOURCE_DIR}/Management
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Maps
|
${CMAKE_CURRENT_SOURCE_DIR}/Maps
|
||||||
|
|||||||
@@ -26,20 +26,19 @@
|
|||||||
#include "WorldModel.h"
|
#include "WorldModel.h"
|
||||||
#include "VMapDefinitions.h"
|
#include "VMapDefinitions.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include <G3D/Vector3.h>
|
||||||
|
#include <ace/Null_Mutex.h>
|
||||||
|
#include <ace/Singleton.h>
|
||||||
|
#include "DisableMgr.h"
|
||||||
|
|
||||||
using G3D::Vector3;
|
using G3D::Vector3;
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
VMapManager2::VMapManager2()
|
VMapManager2::VMapManager2()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
VMapManager2::~VMapManager2(void)
|
VMapManager2::~VMapManager2(void)
|
||||||
{
|
{
|
||||||
for (InstanceTreeMap::iterator i = iInstanceMapTrees.begin(); i != iInstanceMapTrees.end(); ++i)
|
for (InstanceTreeMap::iterator i = iInstanceMapTrees.begin(); i != iInstanceMapTrees.end(); ++i)
|
||||||
@@ -52,8 +51,6 @@ namespace VMAP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
|
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
|
||||||
{
|
{
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
@@ -65,8 +62,6 @@ namespace VMAP
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const
|
Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const
|
||||||
{
|
{
|
||||||
Vector3 pos;
|
Vector3 pos;
|
||||||
@@ -77,171 +72,170 @@ namespace VMAP
|
|||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
// move to MapTree too?
|
// move to MapTree too?
|
||||||
std::string VMapManager2::getMapFileName(unsigned int pMapId)
|
std::string VMapManager2::getMapFileName(unsigned int mapId)
|
||||||
{
|
{
|
||||||
std::stringstream fname;
|
std::stringstream fname;
|
||||||
fname.width(3);
|
fname.width(3);
|
||||||
fname << std::setfill('0') << pMapId << std::string(MAP_FILENAME_EXTENSION2);
|
fname << std::setfill('0') << mapId << std::string(MAP_FILENAME_EXTENSION2);
|
||||||
|
|
||||||
return fname.str();
|
return fname.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
int VMapManager2::loadMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||||
|
|
||||||
int VMapManager2::loadMap(const char* pBasePath, unsigned int pMapId, int x, int y)
|
|
||||||
{
|
{
|
||||||
int result = VMAP_LOAD_RESULT_IGNORED;
|
int result = VMAP_LOAD_RESULT_IGNORED;
|
||||||
if (isMapLoadingEnabled())
|
if (isMapLoadingEnabled())
|
||||||
{
|
{
|
||||||
if (_loadMap(pMapId, pBasePath, x, y))
|
if (_loadMap(mapId, basePath, x, y))
|
||||||
result = VMAP_LOAD_RESULT_OK;
|
result = VMAP_LOAD_RESULT_OK;
|
||||||
else
|
else
|
||||||
result = VMAP_LOAD_RESULT_ERROR;
|
result = VMAP_LOAD_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
// load one tile (internal use only)
|
// load one tile (internal use only)
|
||||||
|
bool VMapManager2::_loadMap(unsigned int mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
|
||||||
bool VMapManager2::_loadMap(unsigned int pMapId, const std::string &basePath, uint32 tileX, uint32 tileY)
|
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree == iInstanceMapTrees.end())
|
if (instanceTree == iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
std::string mapFileName = getMapFileName(pMapId);
|
std::string mapFileName = getMapFileName(mapId);
|
||||||
StaticMapTree *newTree = new StaticMapTree(pMapId, basePath);
|
StaticMapTree* newTree = new StaticMapTree(mapId, basePath);
|
||||||
if (!newTree->InitMap(mapFileName, this))
|
if (!newTree->InitMap(mapFileName, this))
|
||||||
return false;
|
return false;
|
||||||
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(pMapId, newTree)).first;
|
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
return instanceTree->second->LoadMapTile(tileX, tileY, this);
|
return instanceTree->second->LoadMapTile(tileX, tileY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
void VMapManager2::unloadMap(unsigned int mapId)
|
||||||
|
|
||||||
void VMapManager2::unloadMap(unsigned int pMapId)
|
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
instanceTree->second->UnloadMap(this);
|
instanceTree->second->UnloadMap(this);
|
||||||
if (instanceTree->second->numLoadedTiles() == 0)
|
if (instanceTree->second->numLoadedTiles() == 0)
|
||||||
{
|
{
|
||||||
delete instanceTree->second;
|
delete instanceTree->second;
|
||||||
iInstanceMapTrees.erase(pMapId);
|
iInstanceMapTrees.erase(mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
void VMapManager2::unloadMap(unsigned int mapId, int x, int y)
|
||||||
|
|
||||||
void VMapManager2::unloadMap(unsigned int pMapId, int x, int y)
|
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
instanceTree->second->UnloadMapTile(x, y, this);
|
instanceTree->second->UnloadMapTile(x, y, this);
|
||||||
if (instanceTree->second->numLoadedTiles() == 0)
|
if (instanceTree->second->numLoadedTiles() == 0)
|
||||||
{
|
{
|
||||||
delete instanceTree->second;
|
delete instanceTree->second;
|
||||||
iInstanceMapTrees.erase(pMapId);
|
iInstanceMapTrees.erase(mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================
|
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
|
|
||||||
bool VMapManager2::isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2)
|
|
||||||
{
|
{
|
||||||
if (!isLineOfSightCalcEnabled()) return true;
|
if (!isLineOfSightCalcEnabled() || sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
|
||||||
bool result = true;
|
return true;
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
|
||||||
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
||||||
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
||||||
if (pos1 != pos2)
|
if (pos1 != pos2)
|
||||||
{
|
{
|
||||||
result = instanceTree->second->isInLineOfSight(pos1, pos2);
|
return instanceTree->second->isInLineOfSight(pos1, pos2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
//=========================================================
|
|
||||||
/**
|
/**
|
||||||
get the hit position and return true if we hit something
|
get the hit position and return true if we hit something
|
||||||
otherwise the result pos will be the dest pos
|
otherwise the result pos will be the dest pos
|
||||||
*/
|
*/
|
||||||
bool VMapManager2::getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist)
|
bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist)
|
||||||
{
|
{
|
||||||
bool result = false;
|
if (isLineOfSightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
|
||||||
rx=x2;
|
|
||||||
ry=y2;
|
|
||||||
rz=z2;
|
|
||||||
if (isLineOfSightCalcEnabled())
|
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
|
||||||
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
|
||||||
Vector3 resultPos;
|
Vector3 resultPos;
|
||||||
result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, pModifyDist);
|
bool result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, modifyDist);
|
||||||
resultPos = convertPositionToMangosRep(resultPos.x, resultPos.y, resultPos.z);
|
resultPos = convertPositionToMangosRep(resultPos.x, resultPos.y, resultPos.z);
|
||||||
rx = resultPos.x;
|
rx = resultPos.x;
|
||||||
ry = resultPos.y;
|
ry = resultPos.y;
|
||||||
rz = resultPos.z;
|
rz = resultPos.z;
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rx = x2;
|
||||||
|
ry = y2;
|
||||||
|
rz = z2;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=========================================================
|
|
||||||
/**
|
/**
|
||||||
get height or INVALID_HEIGHT if no height available
|
get height or INVALID_HEIGHT if no height available
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float VMapManager2::getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist)
|
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
|
||||||
{
|
{
|
||||||
float height = VMAP_INVALID_HEIGHT_VALUE; //no height
|
if (isHeightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT))
|
||||||
if (isHeightCalcEnabled())
|
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
||||||
height = instanceTree->second->getHeight(pos, maxSearchDist);
|
float height = instanceTree->second->getHeight(pos, maxSearchDist);
|
||||||
if (!(height < G3D::inf()))
|
if (!(height < G3D::inf()))
|
||||||
{
|
return height = VMAP_INVALID_HEIGHT_VALUE; // No height
|
||||||
height = VMAP_INVALID_HEIGHT_VALUE; //no height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=========================================================
|
return VMAP_INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool VMapManager2::getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
|
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
|
||||||
{
|
{
|
||||||
bool result=false;
|
if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG))
|
||||||
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
{
|
||||||
|
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
Vector3 pos = convertPositionToInternalRep(x, y, z);
|
||||||
result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId);
|
bool result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId);
|
||||||
// z is not touched by convertPositionToMangosRep(), so just copy
|
// z is not touched by convertPositionToMangosRep(), so just copy
|
||||||
z = pos.z;
|
z = pos.z;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VMapManager2::GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const
|
||||||
{
|
{
|
||||||
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId);
|
if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS))
|
||||||
|
{
|
||||||
|
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree != iInstanceMapTrees.end())
|
if (instanceTree != iInstanceMapTrees.end())
|
||||||
{
|
{
|
||||||
LocationInfo info;
|
LocationInfo info;
|
||||||
@@ -251,16 +245,16 @@ namespace VMAP
|
|||||||
floor = info.ground_Z;
|
floor = info.ground_Z;
|
||||||
ASSERT(floor < std::numeric_limits<float>::max());
|
ASSERT(floor < std::numeric_limits<float>::max());
|
||||||
type = info.hitModel->GetLiquidType();
|
type = info.hitModel->GetLiquidType();
|
||||||
if (ReqLiquidType && !(type & ReqLiquidType))
|
if (reqLiquidType && !(type & reqLiquidType))
|
||||||
return false;
|
return false;
|
||||||
if (info.hitInstance->GetLiquidLevel(pos, info, level))
|
if (info.hitInstance->GetLiquidLevel(pos, info, level))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================================================
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
|
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
|
||||||
{
|
{
|
||||||
@@ -297,11 +291,10 @@ namespace VMAP
|
|||||||
iLoadedModelFiles.erase(model);
|
iLoadedModelFiles.erase(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=========================================================
|
|
||||||
|
|
||||||
bool VMapManager2::existsMap(const char* pBasePath, unsigned int pMapId, int x, int y)
|
bool VMapManager2::existsMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||||
{
|
{
|
||||||
return StaticMapTree::CanLoadMap(std::string(pBasePath), pMapId, x, y);
|
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VMAP
|
} // namespace VMAP
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "IVMapManager.h"
|
#include "IVMapManager.h"
|
||||||
#include "Dynamic/UnorderedMap.h"
|
#include "Dynamic/UnorderedMap.h"
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include <G3D/Vector3.h>
|
|
||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
|
|
||||||
@@ -40,6 +39,11 @@ Additionally a table to match map ids and map names is used.
|
|||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
|
|
||||||
|
namespace G3D
|
||||||
|
{
|
||||||
|
class Vector3;
|
||||||
|
}
|
||||||
|
|
||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
class StaticMapTree;
|
class StaticMapTree;
|
||||||
@@ -68,44 +72,45 @@ namespace VMAP
|
|||||||
ModelFileMap iLoadedModelFiles;
|
ModelFileMap iLoadedModelFiles;
|
||||||
InstanceTreeMap iInstanceMapTrees;
|
InstanceTreeMap iInstanceMapTrees;
|
||||||
|
|
||||||
bool _loadMap(uint32 pMapId, const std::string &basePath, uint32 tileX, uint32 tileY);
|
bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
|
||||||
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
|
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// public for debug
|
// public for debug
|
||||||
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||||
G3D::Vector3 convertPositionToMangosRep(float x, float y, float z) const;
|
G3D::Vector3 convertPositionToMangosRep(float x, float y, float z) const;
|
||||||
static std::string getMapFileName(unsigned int pMapId);
|
static std::string getMapFileName(unsigned int mapId);
|
||||||
|
|
||||||
VMapManager2();
|
VMapManager2();
|
||||||
~VMapManager2(void);
|
~VMapManager2(void);
|
||||||
|
|
||||||
int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y);
|
int loadMap(const char* pBasePath, unsigned int mapId, int x, int y);
|
||||||
|
|
||||||
void unloadMap(unsigned int pMapId, int x, int y);
|
void unloadMap(unsigned int mapId, int x, int y);
|
||||||
void unloadMap(unsigned int pMapId);
|
void unloadMap(unsigned int mapId);
|
||||||
|
|
||||||
bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) ;
|
bool isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) ;
|
||||||
/**
|
/**
|
||||||
fill the hit pos and return true, if an object was hit
|
fill the hit pos and return true, if an object was hit
|
||||||
*/
|
*/
|
||||||
bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist);
|
bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist);
|
||||||
float getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist);
|
float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist);
|
||||||
|
|
||||||
bool processCommand(char * /*pCommand*/) { return false; } // for debug and extensions
|
bool processCommand(char* /*command*/) { return false; } // for debug and extensions
|
||||||
|
|
||||||
bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
|
bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||||
bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const;
|
bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const;
|
||||||
|
|
||||||
WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename);
|
WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename);
|
||||||
void releaseModelInstance(const std::string& filename);
|
void releaseModelInstance(const std::string& filename);
|
||||||
|
|
||||||
// what's the use of this? o.O
|
// what's the use of this? o.O
|
||||||
virtual std::string getDirFileName(unsigned int pMapId, int /*x*/, int /*y*/) const
|
virtual std::string getDirFileName(unsigned int mapId, int /*x*/, int /*y*/) const
|
||||||
{
|
{
|
||||||
return getMapFileName(pMapId);
|
return getMapFileName(mapId);
|
||||||
}
|
}
|
||||||
virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y);
|
virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "DisableMgr.h"
|
#include "DisableMgr.h"
|
||||||
#include "OutdoorPvP.h"
|
#include "OutdoorPvP.h"
|
||||||
|
#include "VMapManager2.h"
|
||||||
|
|
||||||
DisableMgr::DisableMgr()
|
DisableMgr::DisableMgr()
|
||||||
{
|
{
|
||||||
@@ -170,6 +171,48 @@ void DisableMgr::LoadDisables()
|
|||||||
if (flags)
|
if (flags)
|
||||||
sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
|
sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
|
||||||
break;
|
break;
|
||||||
|
case DISABLE_TYPE_VMAP:
|
||||||
|
{
|
||||||
|
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||||
|
if (!mapEntry)
|
||||||
|
{
|
||||||
|
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch (mapEntry->map_type)
|
||||||
|
{
|
||||||
|
case MAP_COMMON:
|
||||||
|
if (flags & VMAP_DISABLE_AREAFLAG)
|
||||||
|
sLog->outString("Areaflag disabled for world map %u.", entry);
|
||||||
|
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
|
||||||
|
sLog->outString("Liquid status disabled for world map %u.", entry);
|
||||||
|
break;
|
||||||
|
case MAP_INSTANCE:
|
||||||
|
case MAP_RAID:
|
||||||
|
if (flags & VMAP_DISABLE_HEIGHT)
|
||||||
|
sLog->outString("Height disabled for instance map %u.", entry);
|
||||||
|
if (flags & VMAP_DISABLE_LOS)
|
||||||
|
sLog->outString("LoS disabled for instance map %u.", entry);
|
||||||
|
break;
|
||||||
|
case MAP_BATTLEGROUND:
|
||||||
|
if (flags & VMAP_DISABLE_HEIGHT)
|
||||||
|
sLog->outString("Height disabled for battleground map %u.", entry);
|
||||||
|
if (flags & VMAP_DISABLE_LOS)
|
||||||
|
sLog->outString("LoS disabled for battleground map %u.", entry);
|
||||||
|
break;
|
||||||
|
case MAP_ARENA:
|
||||||
|
if (flags & VMAP_DISABLE_HEIGHT)
|
||||||
|
sLog->outString("Height disabled for arena map %u.", entry);
|
||||||
|
if (flags & VMAP_DISABLE_LOS)
|
||||||
|
sLog->outString("LoS disabled for arena map %u.", entry);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
|
m_DisableMap[type].insert(DisableTypeMap::value_type(entry, data));
|
||||||
@@ -212,7 +255,7 @@ void DisableMgr::CheckQuestDisables()
|
|||||||
sLog->outString();
|
sLog->outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit)
|
bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
|
||||||
{
|
{
|
||||||
ASSERT(type < MAX_DISABLE_TYPES);
|
ASSERT(type < MAX_DISABLE_TYPES);
|
||||||
if (m_DisableMap[type].empty())
|
if (m_DisableMap[type].empty())
|
||||||
@@ -227,17 +270,16 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit
|
|||||||
case DISABLE_TYPE_SPELL:
|
case DISABLE_TYPE_SPELL:
|
||||||
{
|
{
|
||||||
uint8 flags = itr->second.flags;
|
uint8 flags = itr->second.flags;
|
||||||
if (pUnit)
|
if (unit)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((flags & SPELL_DISABLE_PLAYER && pUnit->GetTypeId() == TYPEID_PLAYER) ||
|
if ((flags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
|
||||||
(pUnit->GetTypeId() == TYPEID_UNIT && ((pUnit->ToCreature()->isPet() && flags & SPELL_DISABLE_PET) || flags & SPELL_DISABLE_CREATURE)))
|
(unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && flags & SPELL_DISABLE_PET) || flags & SPELL_DISABLE_CREATURE)))
|
||||||
|
|
||||||
{
|
{
|
||||||
if (flags & SPELL_DISABLE_MAP)
|
if (flags & SPELL_DISABLE_MAP)
|
||||||
{
|
{
|
||||||
std::set<uint32> const& mapIds = itr->second.params[0];
|
std::set<uint32> const& mapIds = itr->second.params[0];
|
||||||
if (mapIds.find(pUnit->GetMapId()) != mapIds.end())
|
if (mapIds.find(unit->GetMapId()) != mapIds.end())
|
||||||
return true; // Spell is disabled on current map
|
return true; // Spell is disabled on current map
|
||||||
|
|
||||||
if (!(flags & SPELL_DISABLE_AREA))
|
if (!(flags & SPELL_DISABLE_AREA))
|
||||||
@@ -249,11 +291,10 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit
|
|||||||
if (flags & SPELL_DISABLE_AREA)
|
if (flags & SPELL_DISABLE_AREA)
|
||||||
{
|
{
|
||||||
std::set<uint32> const& areaIds = itr->second.params[1];
|
std::set<uint32> const& areaIds = itr->second.params[1];
|
||||||
if (areaIds.find(pUnit->GetAreaId()) != areaIds.end())
|
if (areaIds.find(unit->GetAreaId()) != areaIds.end())
|
||||||
return true; // Spell is disabled in this area
|
return true; // Spell is disabled in this area
|
||||||
return false; // Spell is disabled in another area, but not this one, return false
|
return false; // Spell is disabled in another area, but not this one, return false
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
return true; // Spell disabled for all maps
|
return true; // Spell disabled for all maps
|
||||||
}
|
}
|
||||||
@@ -264,13 +305,13 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case DISABLE_TYPE_MAP:
|
case DISABLE_TYPE_MAP:
|
||||||
if (Player const* pPlayer = pUnit->ToPlayer())
|
if (Player const* player = unit->ToPlayer())
|
||||||
{
|
{
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
|
||||||
if (mapEntry->IsDungeon())
|
if (mapEntry->IsDungeon())
|
||||||
{
|
{
|
||||||
uint8 disabledModes = itr->second.flags;
|
uint8 disabledModes = itr->second.flags;
|
||||||
Difficulty targetDifficulty = pPlayer->GetDifficulty(mapEntry->IsRaid());
|
Difficulty targetDifficulty = player->GetDifficulty(mapEntry->IsRaid());
|
||||||
GetDownscaledMapDifficultyData(entry, targetDifficulty);
|
GetDownscaledMapDifficultyData(entry, targetDifficulty);
|
||||||
switch(targetDifficulty)
|
switch(targetDifficulty)
|
||||||
{
|
{
|
||||||
@@ -289,16 +330,18 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case DISABLE_TYPE_QUEST:
|
case DISABLE_TYPE_QUEST:
|
||||||
if (!pUnit)
|
if (!unit)
|
||||||
return true;
|
return true;
|
||||||
if (Player const* pPlayer = pUnit->ToPlayer())
|
if (Player const* player = unit->ToPlayer())
|
||||||
if (pPlayer->isGameMaster())
|
if (player->isGameMaster())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case DISABLE_TYPE_BATTLEGROUND:
|
case DISABLE_TYPE_BATTLEGROUND:
|
||||||
case DISABLE_TYPE_OUTDOORPVP:
|
case DISABLE_TYPE_OUTDOORPVP:
|
||||||
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
|
||||||
return true;
|
return true;
|
||||||
|
case DISABLE_TYPE_VMAP:
|
||||||
|
return flags & itr->second.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ enum DisableType
|
|||||||
DISABLE_TYPE_BATTLEGROUND = 3,
|
DISABLE_TYPE_BATTLEGROUND = 3,
|
||||||
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
|
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
|
||||||
DISABLE_TYPE_OUTDOORPVP = 5,
|
DISABLE_TYPE_OUTDOORPVP = 5,
|
||||||
|
DISABLE_TYPE_VMAP = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SpellDisableTypes
|
enum SpellDisableTypes
|
||||||
@@ -45,7 +46,15 @@ enum SpellDisableTypes
|
|||||||
SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA),
|
SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_DISABLE_TYPES 6
|
enum VmapDisableTypes
|
||||||
|
{
|
||||||
|
VMAP_DISABLE_AREAFLAG = 0x1,
|
||||||
|
VMAP_DISABLE_HEIGHT = 0x2,
|
||||||
|
VMAP_DISABLE_LOS = 0x4,
|
||||||
|
VMAP_DISABLE_LIQUIDSTATUS = 0x8,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_DISABLE_TYPES 7
|
||||||
|
|
||||||
struct DisableData
|
struct DisableData
|
||||||
{
|
{
|
||||||
@@ -65,7 +74,7 @@ class DisableMgr
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void LoadDisables();
|
void LoadDisables();
|
||||||
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit);
|
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0);
|
||||||
void CheckQuestDisables();
|
void CheckQuestDisables();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user