当前位置: 首页>>代码示例>>C++>>正文


C++ Position::GetPositionZ方法代码示例

本文整理汇总了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);
	}
}
开发者ID:AwkwardDev,项目名称:Trinity-Fun-3.3.5,代码行数:27,代码来源:AnticheatMgr.cpp

示例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;
}
开发者ID:Declipe,项目名称:ElunaTrinityWotlk,代码行数:27,代码来源:Position.cpp

示例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);
}
开发者ID:Anonymus123,项目名称:AtomicCore-3.3.5a,代码行数:25,代码来源:Vehicle.cpp

示例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());
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:7,代码来源:Position.cpp

示例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);
    }
}
开发者ID:ahuraa,项目名称:Core-1,代码行数:32,代码来源:AnticheatMgr.cpp

示例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;
}
开发者ID:Myst,项目名称:ElunaTrinityCata,代码行数:31,代码来源:AreaTrigger.cpp

示例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());
            }
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:8,代码来源:boss_striker_gadok.cpp

示例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();
        }
开发者ID:BlueSellafield,项目名称:ArkCORE,代码行数:58,代码来源:boss_ascendant_lord_obsidius.cpp

示例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);
            }
开发者ID:Cailiaock,项目名称:5.4.7-Wow-source,代码行数:10,代码来源:boss_janalai.cpp

示例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());
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:10,代码来源:Position.cpp

示例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);
 }
开发者ID:GlassFace,项目名称:LegacyCore_6.x.x,代码行数:14,代码来源:instance_eye_of_eternity.cpp

示例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());
				}

            }
开发者ID:Cryostorm,项目名称:SunwellCore,代码行数:13,代码来源:boss_moroes.cpp

示例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;
    }
开发者ID:Lbniese,项目名称:WoWCircle434,代码行数:13,代码来源:blackrock_depths.cpp

示例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);
        }
开发者ID:Aravu,项目名称:Talador-Project,代码行数:15,代码来源:instance_eye_of_eternity.cpp

示例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);
                }
            }
开发者ID:Sra89,项目名称:TrinityCore,代码行数:14,代码来源:spell_dk.cpp


注:本文中的Position::GetPositionZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。