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


C++ TO_PLAYER函数代码示例

本文整理汇总了C++中TO_PLAYER函数的典型用法代码示例。如果您正苦于以下问题:C++ TO_PLAYER函数的具体用法?C++ TO_PLAYER怎么用?C++ TO_PLAYER使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TO_PLAYER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SoulStoneResurrection

bool SoulStoneResurrection(uint32 i, Aura* a, bool apply)
{
    Unit* u_target = a->GetTarget();
    if (!u_target->IsPlayer())
        return true;

    Player* p_target = TO_PLAYER(u_target);
    uint32 soulstone = a->GetSpellProto()->EffectMiscValue[0];

    if (apply)
    {
        p_target->SetSoulStone(soulstone);
        p_target->SetSoulStoneReceiver((uint32)a->m_casterGuid);
    }
    else if (p_target->isAlive())
    {
        p_target->SetSoulStone(0);
        p_target->SetSoulStoneReceiver(0);
    }
    return true;
}
开发者ID:lev1976g,项目名称:easywow,代码行数:21,代码来源:WarlockSpells.cpp

示例2: ProtectingOurOwn

// Protecting Our Own
bool ProtectingOurOwn(uint32 i, Spell* pSpell)
{
    if(pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer())
        return true;

    Player* plr = TO_PLAYER(pSpell->u_caster);
    QuestLogEntry *qle = plr->GetQuestLogForEntry(10488);

    if(qle == NULL)
        return true;

    if ( qle->GetMobCount( 0 ) < qle->GetQuest()->required_mobcount[0] )
    {
        uint32 NewCount = qle->GetMobCount( 0 ) + 1;
        qle->SetMobCount( 0, NewCount );
        qle->SendUpdateAddKill( 0 );
        qle->UpdatePlayerFields();
    }

    return true;
}
开发者ID:vata,项目名称:wowice,代码行数:22,代码来源:Quest_BladeEdge_Mountains.cpp

示例3: RuneOfDistortion

bool RuneOfDistortion(uint32 i, Spell * pSpell)
{
	if ( pSpell == NULL || pSpell->p_caster == NULL )
		return true;
	
	Player * plr = TO_PLAYER(pSpell->u_caster);
	if( plr == NULL )
		return true;

	Creature * pCreature = sEAS.SpawnCreature(plr, 32162, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(),0, 0);
	pCreature->Despawn(5*60*1000, 0);
	
	QuestLogEntry *qle = plr->GetQuestLogForEntry(13312);
	if(qle == NULL)
	{
		qle = plr->GetQuestLogForEntry(13337);
		if(qle == NULL)
			return true;
	}
	return true;
}
开发者ID:vata,项目名称:wowice,代码行数:21,代码来源:QIspells.cpp

示例4: PoweringOurDefenses

bool PoweringOurDefenses(uint32 i, Spell* pSpell)
{
    if(pSpell->u_caster->IsPlayer() == false)
        return true;

    Player * plr = TO_PLAYER(pSpell->u_caster);

    QuestLogEntry *qle = plr->GetQuestLogForEntry( 8490 );
    if( qle == NULL )
        return true;

    // Angelis : Need to script the scourge attack

    if( qle && qle->GetMobCount(0) < qle->GetQuest()->required_mobcount[0] )
    {
        qle->SetMobCount(0, qle->GetMobCount(0)+1);
        qle->SendUpdateAddKill(0);
        qle->UpdatePlayerFields();
    }
    return true;
}
开发者ID:vata,项目名称:wowice,代码行数:21,代码来源:Quest_EversongWoods.cpp

示例5: RodofPurification

bool RodofPurification(uint32 i, Spell * pSpell)
{
	Player * pPlayer = TO_PLAYER(pSpell->u_caster);
	if(!pPlayer)
		return true;

	if(!pSpell->u_caster->IsPlayer())
		return true;

	QuestLogEntry *qle = pPlayer->GetQuestLogForEntry(10839);
	if(qle == NULL)
		return true;

	GameObject *  Darkstone = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(-2512, 5418, 0, 185191);
	if(Darkstone != NULL)
	{
		if(pPlayer->CalcDistance(pPlayer, Darkstone) < 15)
			qle->SendQuestComplete();
	}
	return true;
}
开发者ID:vata,项目名称:wowice,代码行数:21,代码来源:QIspells.cpp

示例6: OrbOfMurlocControl

bool OrbOfMurlocControl(uint32 i, Spell* pSpell)
{
	if(pSpell->m_caster->IsPlayer() == false)
		return true;

	Player* pPlayer = TO_PLAYER( pSpell->u_caster );

	QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry(11541);
	if(pQuest == NULL)
		return true;

	Creature* pTarget;
	
	for(ObjectSet::iterator itr = pSpell->m_caster->GetInRangeSetBegin(); itr != pSpell->m_caster->GetInRangeSetEnd(); ++itr)
	{
		if( (*itr)->IsUnit() && TO_UNIT(*itr)->IsCreature() )
			pTarget = TO_CREATURE(*itr);
		else
			continue;

		if( pSpell->m_caster->CalcDistance(pTarget) > 5 )
			continue;

		if( pTarget->GetEntry() == 25084)
		{
		  if(pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0])
		  {
			pQuest->SetMobCount(0, pQuest->GetMobCount(0) + 1);
			pQuest->SendUpdateAddKill(0);		
			Creature* FreedGreengill = sEAS.SpawnCreature(pPlayer, 25085, pTarget->GetPositionX(),
			pTarget->GetPositionY(), pTarget->GetPositionZ(), pTarget->GetOrientation(), 0);
			FreedGreengill->Despawn(6*60*1000, 0);
			pTarget->Despawn(0, 6*60*1000);
			pQuest->UpdatePlayerFields();
			return true;
		  }  
		}
  }
  return true;
}
开发者ID:vata,项目名称:wowice,代码行数:40,代码来源:Quest_Isle_of_QuelDanas.cpp

示例7: GetDBCCastTime

/// Spell Target Handling for type 33: Party members of totem, inside given range
void Spell::SpellTargetNearbyPartyMembers(uint32 i, uint32 j)
{
	// this implementation is wrong.... this one is for totems
	if( u_caster != NULL )
	{
		if( u_caster->GetTypeId()==TYPEID_UNIT)
		{
			if( TO_CREATURE( u_caster )->IsTotem() )
			{
				float r = GetDBCCastTime(i);
				r *= r;

				Player* p = TO_PLAYER( TO_CREATURE(u_caster)->GetSummonOwner());

				if( p == NULL)
					return;

				if(IsInrange(m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ(),p,r))
					_AddTargetForced(p->GetGUID(), i);

				SubGroup * pGroup = p->GetGroup() ?
					p->GetGroup()->GetSubGroup(p->GetSubGroup()) : 0;

				if(pGroup)
				{
					p->GetGroup()->Lock();
					for(GroupMembersSet::iterator itr = pGroup->GetGroupMembersBegin();
						itr != pGroup->GetGroupMembersEnd(); itr++)
					{
						if(!(*itr)->m_loggedInPlayer || p == (*itr)->m_loggedInPlayer)
							continue;
						if(IsInrange(m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ(),(*itr)->m_loggedInPlayer,r))
							_AddTargetForced((*itr)->m_loggedInPlayer->GetGUID(), i);
					}
					p->GetGroup()->Unlock();
				}
			}
		}
	}
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:41,代码来源:SpellTarget.cpp

示例8: HealingTheLake

bool HealingTheLake(uint32 i, SpellPointer pSpell)
{
	if ( pSpell == NULL || pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer() )
		return true;

	PlayerPointer pPlayer = TO_PLAYER( pSpell->u_caster );

	QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 9294 );
	if ( pQuest == NULL )
		return true;

	if ( pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[0] )
	{
		pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 ) + 1 );
		pQuest->SendUpdateAddKill( 0 );
		pQuest->UpdatePlayerFields();
		
		return true;
	}
	
	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:22,代码来源:Azuremyst_Isle.cpp

示例9: OnLoad

    void OnLoad()
    {
        if(!_unit->IsSummon())
            return;

        Unit* summoner = TO< Summon* >(_unit)->GetOwner();

        if(summoner != NULL)
        {
            if(summoner->IsPlayer())
            {
                Player* p = TO_PLAYER(summoner);
                if(p->HasQuest(11608))
                {
                    GameObject* pSinkhole = p->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), 300171);
                    if(pSinkhole != NULL)
                    {
                        _unit->CastSpell(_unit, 45502, true);

                        float posX = pSinkhole->GetPositionX();
                        if(posX == 2657.13f)
                            sEAS.KillMobForQuest(p, 11608, 0);

                        if(posX == 2716.02f)
                            sEAS.KillMobForQuest(p, 11608, 1);

                        if(posX == 2877.96f)
                            sEAS.KillMobForQuest(p, 11608, 2);

                        if(posX == 2962.16f)
                            sEAS.KillMobForQuest(p, 11608, 3);

                    }
                }
            }
        }
        _unit->Despawn(500, 0);
    }
开发者ID:treetrees,项目名称:Edge-of-Chaos,代码行数:38,代码来源:Quest_BoreanTundra.cpp

示例10: WaitingToResurrect

bool WaitingToResurrect(uint32 i, Aura* a, bool apply)
{
	Unit* u_target = a->GetTarget();

	if(!u_target->IsPlayer())
		return true;

	Player* p_target = TO_PLAYER(u_target);

	if(apply)		// already applied in opcode handler
		return true;

	uint64 crtguid = p_target->m_areaSpiritHealer_guid;

	Creature* pCreature = p_target->IsInWorld() ? p_target->GetMapMgr()->GetCreature(GET_LOWGUID_PART(crtguid)) : NULL;

	if(pCreature == NULL || p_target->m_bg == NULL)
		return true;

	p_target->m_bg->RemovePlayerFromResurrect(p_target, pCreature);

	return true;
}
开发者ID:Antares84,项目名称:arcemu,代码行数:23,代码来源:MiscSpells.cpp

示例11: DouseEternalFlame

bool DouseEternalFlame(uint32 i, Spell* pSpell)
{
    if (pSpell->u_caster == NULL || !pSpell->u_caster->IsPlayer())
        return true;

    Player* plr = TO_PLAYER(pSpell->u_caster);
    QuestLogEntry *qle = plr->GetQuestLogForEntry(9737);
    if(qle == NULL)
        return true;

    GameObject* Flame = plr->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(3678, -3640, 139, 182068);
    if(Flame != NULL)
    {
        if(plr->CalcDistance(plr, Flame) < 30)
            if(qle->GetMobCount(0) < qle->GetQuest()->required_mobcount[0])
            {
                qle->SetMobCount(0, qle->GetMobCount(0)+1);
                qle->SendUpdateAddKill(0);
                qle->UpdatePlayerFields();
            }
    }
    return true;
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:23,代码来源:Paladin.cpp

示例12: AIUpdate

        void AIUpdate()
        {
            // Let's see if we are netted
            Aura* a = _unit->FindAura(38177);
            if (a != nullptr)
            {
                Unit* Caster = a->GetUnitCaster();
                if (!Caster)
                    return;

                if (Caster->IsPlayer())
                {

                    QuestLogEntry* qle = TO_PLAYER(Caster)->GetQuestLogForEntry(10747);
                    if (qle != nullptr)
                    {
                        // casting the spell that will create the item for the player
                        _unit->CastSpell(Caster, 38178, true);
                        _unit->Despawn(1000, 360000);
                    }
                }
            }
        }
开发者ID:TheGhostGroup,项目名称:AscEmu,代码行数:23,代码来源:Quest_BladeEdge_Mountains.cpp

示例13: ForceofNeltharakuSpell

bool ForceofNeltharakuSpell(uint32 i, SpellPointer pSpell) // Becoming a Shadoweave Tailor
{
	if(pSpell->u_caster->IsPlayer() == false)
		return true;

	PlayerPointer	pPlayer= TO_PLAYER(pSpell->u_caster);
	UnitPointer		pUnit	= TO_UNIT(pPlayer->GetMapMgr()->GetCreature(GET_LOWGUID_PART(pPlayer->GetSelection())));

	if(pUnit == NULLUNIT)
		return true;

	if(!pUnit->IsCreature())
		return true;

	CreaturePointer		 pTarget	= TO_CREATURE(pUnit);
	QuestLogEntry	 *pQuest	= pPlayer->GetQuestLogForEntry(10854);
	if(pQuest == NULL)
		return true;

	if(pTarget->GetEntry() == 21722 && pPlayer->CalcDistance(pUnit)<30)
	{
		if ( pQuest && pQuest->GetMobCount(0) < pQuest->GetQuest()->required_mobcount[0] )
		{
			pTarget->CastSpell(pPlayer, dbcSpell.LookupEntry(38775), true);
			pQuest->SetMobCount(0, pQuest->GetMobCount(0)+1);
			pQuest->SendUpdateAddKill(0);
			pQuest->UpdatePlayerFields();
			if ( pTarget->GetScript() != NULL )
			{
				MoonScriptCreatureAI *pDrakeAI = static_cast<MoonScriptCreatureAI*>(pTarget->GetScript());
				pDrakeAI->SetCanMove(true);
				pDrakeAI->SetWaypointToMove(0);
			}
		}
	}
	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:37,代码来源:Shadowmoon.cpp

示例14: OnDied

	void OnDied(UnitPointer mKiller)
	{
		if(mKiller->IsPlayer())
		{
			PlayerPointer mPlayer = TO_PLAYER(mKiller);
			if(mPlayer == NULL || mPlayer->GetMapMgr() == NULL || mPlayer->GetMapMgr()->GetInterface() == NULL)
				return;
			CreaturePointer  beka1 = sEAS.SpawnCreature(mPlayer, 1516, -13770.5, -6.79, 42.8, 5.7 , 0);
			beka1->GetAIInterface()->MoveTo(-13727.8, -26.2, 46.15, 4.07);
			beka1->Despawn(10*60*1000, 0);
		}
		else
		{
			PlayerPointer mPlayer = _unit->GetMapMgr()->GetInterface()->GetPlayerNearestCoords(_unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ());
			if(mPlayer)
			{
				if(mPlayer == NULL || mPlayer->GetMapMgr() == NULL || mPlayer->GetMapMgr()->GetInterface() == NULL)
					return;
				CreaturePointer  beka1 = sEAS.SpawnCreature(mPlayer, 1516, -13770.5, -6.79, 42.8, 5.7 , 0);
				beka1->GetAIInterface()->MoveTo(-13727.8, -26.2, 46.15, 4.07);
				beka1->Despawn(10*60*1000, 0);
			}
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:24,代码来源:StranglethornVale.cpp

示例15: TO_PLAYER

/// Spell Target Handling for type 18: All Party Members around the Caster in given range NOT RAID
void Spell::SpellTargetAllPartyMembersRangeNR(uint32 i, uint32 j)
{
	Player* p = p_caster;

	if( p == NULL )
	{
		if( TO_CREATURE( u_caster)->IsTotem() )
			p = TO_PLAYER( TO_CREATURE(u_caster)->GetSummonOwner());
		else if( u_caster->IsPet() && TO_PET( u_caster )->GetPetOwner() )
			p = TO_PET( u_caster )->GetPetOwner();
	}

	if( p == NULL )
		return;

	float r = GetDBCCastTime(i);

	r *= r;
	if( IsInrange( m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), p, r ) )
		_AddTargetForced(p->GetGUID(), i);

	SubGroup* subgroup = p->GetGroup() ? p->GetGroup()->GetSubGroup( p->GetSubGroup() ) : 0;

	if( subgroup != NULL )
	{
		p->GetGroup()->Lock();
		for(GroupMembersSet::iterator itr = subgroup->GetGroupMembersBegin(); itr != subgroup->GetGroupMembersEnd(); itr++)
		{
			if(!(*itr)->m_loggedInPlayer || m_caster == (*itr)->m_loggedInPlayer)
				continue;
			if(IsInrange(m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ(),(*itr)->m_loggedInPlayer,r))
				_AddTargetForced( (*itr)->m_loggedInPlayer->GetGUID(), i );
		}
		p->GetGroup()->Unlock();
	}
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:37,代码来源:SpellTarget.cpp


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