本文整理汇总了C++中Map::GetTerrain方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetTerrain方法的具体用法?C++ Map::GetTerrain怎么用?C++ Map::GetTerrain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetTerrain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RandomTeleport
void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector<WorldLocation> &locs)
{
if (bot->IsBeingTeleported())
return;
if (locs.empty())
{
sLog.outError("Cannot teleport bot %s - no locations available", bot->GetName());
return;
}
for (int attemtps = 0; attemtps < 10; ++attemtps)
{
int index = urand(0, locs.size() - 1);
WorldLocation loc = locs[index];
float x = loc.coord_x + urand(0, sPlayerbotAIConfig.grindDistance) - sPlayerbotAIConfig.grindDistance / 2;
float y = loc.coord_y + urand(0, sPlayerbotAIConfig.grindDistance) - sPlayerbotAIConfig.grindDistance / 2;
float z = loc.coord_z;
Map* map = sMapMgr.FindMap(loc.mapid);
if (!map)
continue;
const TerrainInfo * terrain = map->GetTerrain();
if (!terrain)
continue;
AreaTableEntry const* area = sAreaStore.LookupEntry(terrain->GetAreaId(x, y, z));
if (!area)
continue;
if (!terrain->IsOutdoors(x, y, z) ||
terrain->IsUnderWater(x, y, z) ||
terrain->IsInWater(x, y, z))
continue;
sLog.outDetail("Random teleporting bot %s to %s %f,%f,%f", bot->GetName(), area->area_name[0], x, y, z);
float height = map->GetTerrain()->GetHeightStatic(x, y, 0.5f + z, true, MAX_HEIGHT);
if (height <= INVALID_HEIGHT)
continue;
z = 0.05f + map->GetTerrain()->GetHeightStatic(x, y, 0.05f + z, true, MAX_HEIGHT);
bot->GetMotionMaster()->Clear();
bot->TeleportTo(loc.mapid, x, y, z, 0);
return;
}
sLog.outError("Cannot teleport bot %s - no locations available", bot->GetName());
}
示例2: HandleMovementOpcodes
//.........这里部分代码省略.........
static const float MaxDeltaXYT = sWorld.GetMvAnticheatMaxXYT();
if (delta_xyt > MaxDeltaXYT && delta<=100.0f && GetPlayer()->GetZoneId() != 2257)
{
if (sWorld.GetMvAnticheatSpeedCheck())
Anti__CheatOccurred(CurTime,"Speed hack",delta_xyt,LookupOpcodeName(opcode),
(float)(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()),
(float)(getMSTimeDiff(OldNextLenCheck-500,CurTime)));
}
}
if (delta > 100.0f && GetPlayer()->GetZoneId() != 2257)
{
if (sWorld.GetMvAnticheatTeleportCheck())
Anti__ReportCheat("Tele hack",delta,LookupOpcodeName(opcode));
}
// Check for waterwalking . Fix new way of checking for waterwalking by Darky88
if (movementInfo.HasMovementFlag(MOVEFLAG_WATERWALKING) &&
!(GetPlayer()->HasAuraType(SPELL_AURA_WATER_WALK) || GetPlayer()->HasAuraType(SPELL_AURA_GHOST)))
{
if(sWorld.GetMvAnticheatWaterCheck())
Anti__CheatOccurred(CurTime,"Water walking",0.0f,NULL,0.0f,(uint32)(movementInfo.GetMovementFlags()));
}
// Check for walking upwards a mountain while not beeing able to do that, New check by Darky88
if ((delta_z < -2.3f) && (tg_z > 2.37f))
{
if (sWorld.GetMvAnticheatMountainCheck())
Anti__CheatOccurred(CurTime,"Mountain hack",tg_z,NULL,delta,delta_z);
}
static const float DIFF_OVERGROUND = 10.0f;
float Anti__GroundZ = GetPlayer()->GetTerrain()->GetHeight(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),MAX_HEIGHT);
float Anti__FloorZ = GetPlayer()->GetTerrain()->GetHeight(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),GetPlayer()->GetPositionZ());
float Anti__MapZ = ((Anti__FloorZ <= (INVALID_HEIGHT+5.0f)) ? Anti__GroundZ : Anti__FloorZ) + DIFF_OVERGROUND;
if (!GetPlayer()->CanFly() &&
!GetPlayer()->GetTerrain()->IsUnderWater(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z-7.0f) &&
Anti__MapZ < GetPlayer()->GetPositionZ() && Anti__MapZ > (INVALID_HEIGHT+DIFF_OVERGROUND + 5.0f))
{
static const float DIFF_AIRJUMP=25.0f; // 25 is realy high, but to many false positives...
// Air-Jump-Detection definitively needs a better way to be detected...
if ((movementInfo.GetMovementFlags() & (MOVEFLAG_CAN_FLY | MOVEFLAG_FLYING | MOVEFLAG_ROOT)) != 0) // Fly Hack
{
// Fix Aura 55164
if (!GetPlayer()->HasAura(55164) || !GetPlayer()->HasAuraType(SPELL_AURA_FEATHER_FALL))
if (sWorld.GetMvAnticheatFlyCheck())
Anti__CheatOccurred(CurTime,"Fly hack",
((uint8)(GetPlayer()->HasAuraType(SPELL_AURA_FLY))) +
((uint8)(GetPlayer()->HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED))*2),
NULL,GetPlayer()->GetPositionZ()-Anti__MapZ);
}
// Need a better way to do that - currently a lot of fake alarms
else if ((Anti__MapZ+DIFF_AIRJUMP < GetPlayer()->GetPositionZ() &&
(movementInfo.GetMovementFlags() & (MOVEFLAG_FALLINGFAR | MOVEFLAG_PENDINGSTOP))==0) ||
(Anti__MapZ < GetPlayer()->GetPositionZ() && opcode==MSG_MOVE_JUMP) &&
!GetPlayer()->HasAuraType(SPELL_AURA_FEATHER_FALL))
{
if (sWorld.GetMvAnticheatJumpCheck())
Anti__CheatOccurred(CurTime,"Possible Air Jump Hack",0.0f,LookupOpcodeName(opcode),0.0f,movementInfo.GetMovementFlags());
}
}