本文整理汇总了C++中Position::GetPositionZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::GetPositionZ方法的具体用法?C++ Position::GetPositionZ怎么用?C++ Position::GetPositionZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::GetPositionZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClimbHackDetection
// basic detection
void AnticheatMgr::ClimbHackDetection(Player *player, MovementInfo movementInfo, uint32 opcode)
{
uint32 key = player->GetGUIDLow();
if (opcode != MSG_MOVE_HEARTBEAT ||
m_Players[key].GetLastOpcode() != MSG_MOVE_HEARTBEAT)
return;
// in this case we don't care if they are "legal" flags, they are handled in another parts of the Anticheat Manager.
if (player->IsInWater() ||
player->IsFlying() ||
player->IsFalling())
return;
Position playerPos;
float deltaZ = fabs(playerPos.GetPositionZ() - movementInfo.pos.GetPositionZ());
float deltaXY = movementInfo.pos.GetExactDist2d(&playerPos);
float angle = Position::NormalizeOrientation(tan(deltaZ/deltaXY));
if (angle > CLIMB_ANGLE)
{
Report(player, WALLCLIMB_HACK);
}
}
示例2: IsWithinBox
bool Position::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const
{
// rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
// is-in-cube check and we have to calculate only one point instead of 4
// 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
double rotation = 2 * M_PI - center.GetOrientation();
double sinVal = std::sin(rotation);
double cosVal = std::cos(rotation);
float BoxDistX = GetPositionX() - center.GetPositionX();
float BoxDistY = GetPositionY() - center.GetPositionY();
float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
float dz = GetPositionZ() - center.GetPositionZ();
float dx = rotX - center.GetPositionX();
float dy = rotY - center.GetPositionY();
if ((std::fabs(dx) > xradius) ||
(std::fabs(dy) > yradius) ||
(std::fabs(dz) > zradius))
return false;
return true;
}
示例3: Relocate
void Vehicle::Relocate(Position pos)
{
sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", _me->GetEntry());
std::set<Unit*> vehiclePlayers;
for (int8 i = 0; i < 8; i++)
vehiclePlayers.insert(GetPassenger(i));
// passengers should be removed or they will have movement stuck
RemoveAllPassengers();
for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
{
if (Unit* plr = (*itr))
{
// relocate/setposition doesn't work for player
plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
//plr->TeleportTo(pPlayer->GetMapId(), triggerPos.GetPositionX(), triggerPos.GetPositionY(), triggerPos.GetPositionZ(), triggerPos.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
}
}
_me->UpdatePosition(pos, true);
// problems, and impossible to do delayed enter
//pPlayer->EnterVehicle(veh);
}
示例4: RelocateOffset
void Position::RelocateOffset(const Position & offset)
{
m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
SetOrientation(GetOrientation() + offset.GetOrientation());
}
示例5: ClimbHackDetection
// basic detection
void AnticheatMgr::ClimbHackDetection(Player *player, MovementInfo movementInfo, uint32 opcode)
{
if ((sWorld->getIntConfig(CONFIG_ANTICHEAT_DETECTIONS_ENABLED) & CLIMB_HACK_DETECTION) == 0)
return;
uint32 key = player->GetGUIDLow();
if (opcode != MSG_MOVE_HEARTBEAT ||
m_Players[key].GetLastOpcode() != MSG_MOVE_HEARTBEAT)
return;
// in this case we don't care if they are "legal" flags, they are handled in another parts of the Anticheat Manager.
if (player->IsInWater() ||
player->IsFlying() ||
player->IsFalling())
return;
Position playerPos;
Position pos = player->GetPosition();
float deltaZ = fabs(playerPos.GetPositionZ() - movementInfo.pos.GetPositionZ());
float deltaXY = movementInfo.pos.GetExactDist2d(&playerPos);
float angle = Position::NormalizeOrientation(tan(deltaZ/deltaXY));
if (angle > CLIMB_ANGLE)
{
TC_LOG_DEBUG("entities.player.character", "AnticheatMgr:: Climb-Hack detected player GUID (low) %u", player->GetGUIDLow());
BuildReport(player,CLIMB_HACK_REPORT);
}
}
示例6: CreateAreaTrigger
bool AreaTrigger::CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos)
{
SetMap(caster->GetMap());
Relocate(pos);
if (!IsPositionValid())
{
TC_LOG_ERROR("misc", "AreaTrigger (spell %u) not created. Invalid coordinates (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
return false;
}
WorldObject::_Create(guidlow, HIGHGUID_AREATRIGGER, caster->GetPhaseMask());
SetEntry(triggerEntry);
SetDuration(spell->GetDuration());
SetObjectScale(1);
SetUInt32Value(AREATRIGGER_SPELLID, spell->Id);
SetUInt32Value(AREATRIGGER_SPELLVISUALID, spell->SpellVisual[0]);
SetUInt32Value(AREATRIGGER_DURATION, spell->GetDuration());
SetFloatValue(AREATRIGGER_FINAL_POS + 0, pos.GetPositionX());
SetFloatValue(AREATRIGGER_FINAL_POS + 1, pos.GetPositionY());
SetFloatValue(AREATRIGGER_FINAL_POS + 2, pos.GetPositionZ());
for (auto phase : caster->GetPhases())
SetInPhase(phase, false, true);
if (!GetMap()->AddToMap(this))
return false;
return true;
}
示例7: SummonKrikThik
TempSummon* SummonKrikThik(uint32 creatureId)
{
float angle = frand(0, 2*M_PI);
float x = CenterPos.GetPositionX() + (RADIUS_CIRCLE * std::cos(angle));
float y = CenterPos.GetPositionY() + (RADIUS_CIRCLE * std::sin(angle));
return me->SummonCreature(creatureId, x, y, CenterPos.GetPositionZ());
}
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
return;
if ((me->HealthBelowPct(69) && Phase == 0) || (me->HealthBelowPct(34) && Phase == 1))
{
Phase++;
// Switch Position with a random Shadow of Obsidius and empty Threat list
Creature* target = ShadowOfObsidiusList[urand(0,RAID_MODE(1,2))];
Position telePos;
me->GetPosition(&telePos);
// Switch Positions
me->NearTeleportTo(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0);
target->NearTeleportTo(telePos.GetPositionX(),telePos.GetPositionY(),telePos.GetPositionZ(),0);
// Resetts Aggro
me->getThreatManager().resetAllAggro();
me->MonsterYell("Your kind has no place in the master's world.", LANG_UNIVERSAL, NULL);
return;
}
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_THUNDERCLAP:
DoCastAOE(SPELL_THUNDERCLAP);
events.ScheduleEvent(EVENT_THUNDERCLAP, 7000);
break;
case EVENT_TWILIGHT_CORRUPTION:
if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true))
DoCast(pTarget,SPELL_TWILIGHT_CORRUPTION);
events.ScheduleEvent(EVENT_TWILIGHT_CORRUPTION, 10000);
break;
case EVENT_STONE_BLOW:
DoCastVictim(SPELL_STONE_BLOW);
events.ScheduleEvent(EVENT_STONE_BLOW, 13000);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例9: PeriodicTick
void PeriodicTick(constAuraEffectPtr aurEff)
{
if (!GetCaster())
return;
count++;
Position pos;
GetCaster()->GetNearPosition(pos, 4.0f * count, 0.0f);
GetCaster()->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLAME_BREATH_1, true);
}
示例10: GetPositionOffsetTo
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
{
float dx = endPos.GetPositionX() - GetPositionX();
float dy = endPos.GetPositionY() - GetPositionY();
retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
}
示例11: SpawnGameObject
/// @todo this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
void SpawnGameObject(uint32 entry, Position const& pos)
{
GameObject* go = new GameObject();
if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
{
delete go;
return;
}
instance->AddToMap(go);
}
示例12: HandleDummy
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
Position pos;
target->GetFirstCollisionPosition(pos, 5.0f, M_PI);
GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true);
GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH);
GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation());
}
}
示例13: OnGossipSelect
bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 sender, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
player->CLOSE_GOSSIP_MENU();
if (action >= 4)
return false;
Position loc = blackrock_depths_locs[action];
if (!player->isInCombat())
player->NearTeleportTo(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), false);
return true;
}
示例14: SpawnGameObject
/// @todo this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
void SpawnGameObject(uint32 entry, Position& pos)
{
GameObject* go = new GameObject;
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
{
delete go;
return;
}
instance->AddToMap(go);
}
示例15: HandleDummy
void HandleDummy(SpellEffIndex effIndex)
{
int32 damage = GetEffectValue();
Spell* baseSpell = GetSpell();
Position pos;
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
GetSummonPosition(effIndex, pos, 0.0f, 0);
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
}
}