/** get the hit position and return true if we hit something otherwise the result pos will be the dest pos */ bool VMapManager::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 result = false; rx=x2; ry=y2; rz=z2; if( m_maps[pMapId] != NULL ) { Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); Vector3 resultPos; MapTree* mapTree = m_maps[pMapId]; result = mapTree->getObjectHitPos(pos1, pos2, resultPos, pModifyDist); resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z); rx = resultPos.x; ry = resultPos.y; rz = resultPos.z; } return result; }
bool VMapManager2::isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) { if (!isLineOfSightCalcEnabled()) return true; bool result = true; InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { // Don't calculate hit position, if wrong src/dest points provided! if (!VMAP::CheckPosition(x1, y1, z1) || !VMAP::CheckPosition(x2, y2, z2)) return false; Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); if (pos1 != pos2) { result = instanceTree->second->isInLineOfSight(pos1, pos2); } } return result; }
bool VMapManager::isOutDoors(unsigned int mapid, float x, float y, float z) { bool result = false; if( m_maps[mapid] != NULL ) { Vector3 pos = convertPositionToInternalRep(x,y,z); MapTree* mapTree = m_maps[mapid]; result = mapTree->isOutDoors(pos); } return(result); }
bool VMapManager::isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) { bool result = true; if(isLineOfSightCalcEnabled() && iInstanceMapTrees.containsKey(pMapId)) { Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); if(pos1 != pos2) { MapTree* mapTree = iInstanceMapTrees.get(pMapId); result = mapTree->isInLineOfSight(pos1, pos2); #ifdef _VMAP_LOG_DEBUG Command c = Command(); // save the orig vectors c.fillTestVisCmd(pMapId,Vector3(x1,y1,z1),Vector3(x2,y2,z2),result); iCommandLogger.appendCmd(c); #endif } } return(result); }
bool VMapManager2::getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const { bool result=false; InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x, y, z); result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); // z is not touched by convertPositionToMangosRep(), so just copy z = pos.z; } return(result); }
/** get the hit position and return true if we hit something 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 result = false; rx=x2; ry=y2; rz=z2; if (isLineOfSightCalcEnabled()) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); Vector3 resultPos; result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, pModifyDist); resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z); rx = resultPos.x; ry = resultPos.y; rz = resultPos.z; } } return result; }
//int gGetHeightCounter = 0; float VMapManager::getHeight(unsigned int pMapId, float x, float y, float z) { float height = VMAP_INVALID_HEIGHT; //no height if( m_maps[pMapId] != NULL ) { Vector3 pos = convertPositionToInternalRep(x,y,z); height = m_maps[pMapId]->getHeight(pos); if(!(height < inf())) { return VMAP_INVALID_HEIGHT; } } return(height); }
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const { if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x, y, z); bool result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); // z is not touched by convertPositionToMangosRep(), so just copy z = pos.z; return result; } } return false; }
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const { if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG)) { auto instanceTree = GetMapTree(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x, y, z); bool result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); // z is not touched by convertPositionToInternalRep(), so just copy z = pos.z; return result; } } return false; }
float VMapManager2::getHeight(unsigned int pMapId, float x, float y, float z, float maxSearchDist) { float height = VMAP_INVALID_HEIGHT_VALUE; //no height if (isHeightCalcEnabled()) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x,y,z); height = instanceTree->second->getHeight(pos, maxSearchDist); if (!(height < G3D::inf())) { height = VMAP_INVALID_HEIGHT_VALUE; //no height } } } return height; }
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) { if (isHeightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x, y, z); float height = instanceTree->second->getHeight(pos, maxSearchDist); if (!(height < G3D::inf())) return height = VMAP_INVALID_HEIGHT_VALUE; // No height return height; } } return VMAP_INVALID_HEIGHT_VALUE; }
//int gGetHeightCounter = 0; float VMapManager::getHeight(unsigned int pMapId, float x, float y, float z) { float height = VMAP_INVALID_HEIGHT; //no height if(isHeightCalcEnabled() && iInstanceMapTrees.containsKey(pMapId)) { Vector3 pos = convertPositionToInternalRep(x,y,z); MapTree* mapTree = iInstanceMapTrees.get(pMapId); height = mapTree->getHeight(pos); if(!(height < inf())) { height = VMAP_INVALID_HEIGHT; //no height } Command c = Command(); c.fillTestHeightCmd(pMapId,Vector3(x,y,z),height); iCommandLogger.appendCmd(c); } return(height); }
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) { if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT)) { auto instanceTree = GetMapTree(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos = convertPositionToInternalRep(x, y, z); float height = instanceTree->second->getHeight(pos, maxSearchDist); if (!(height < G3D::finf())) return height = VMAP_INVALID_HEIGHT_VALUE; // No height return height; } } return VMAP_INVALID_HEIGHT_VALUE; }
bool VMapManager2::GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { LocationInfo info; Vector3 pos = convertPositionToInternalRep(x, y, z); if (instanceTree->second->GetLocationInfo(pos, info)) { floor = info.ground_Z; type = info.hitModel->GetLiquidType(); if (ReqLiquidType && !(type & ReqLiquidType)) return false; if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; } } return false; }
bool VMapManager2::GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId); if (instanceTree != iInstanceMapTrees.end()) { // Don't calculate hit position, if wrong src/dest points provided! if (!VMAP::CheckPosition(x, y, z)) return false; LocationInfo info; Vector3 pos = convertPositionToInternalRep(x, y, z); if (instanceTree->second->GetLocationInfo(pos, info)) { floor = info.ground_Z; type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc if (ReqLiquidType && !(type & ReqLiquidType)) return false; if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; } } return false; }
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const { if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) { LocationInfo info; Vector3 pos = convertPositionToInternalRep(x, y, z); if (instanceTree->second->GetLocationInfo(pos, info)) { floor = info.ground_Z; ASSERT(floor < std::numeric_limits<float>::max()); type = info.hitModel->GetLiquidType(); if (reqLiquidType && !(type & reqLiquidType)) return false; if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; } } } return false; }