bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const { if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS)) { InstanceTreeMap::const_iterator instanceTree = GetMapTree(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()); ASSERT(info.hitModel); type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc if (reqLiquidType && !(GetLiquidFlagsPtr(type) & reqLiquidType)) return false; ASSERT(info.hitInstance); if (info.hitInstance->GetLiquidLevel(pos, info, level)) return true; } } } return false; }
/** 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 mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist) { if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS)) { InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); Vector3 resultPos; bool result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, modifyDist); resultPos = convertPositionToInternalRep(resultPos.x, resultPos.y, resultPos.z); rx = resultPos.x; ry = resultPos.y; rz = resultPos.z; return result; } } rx = x2; ry = y2; rz = z2; return false; }
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) { if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS)) return true; auto instanceTree = GetMapTree(mapId); if (instanceTree != iInstanceMapTrees.end()) { Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); if (pos1 != pos2) return instanceTree->second->isInLineOfSight(pos1, pos2); } return true; }
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)) { InstanceTreeMap::const_iterator 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 mapId, float x, float y, float z, float maxSearchDist) { if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT)) { InstanceTreeMap::const_iterator 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; }