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


C++ CreaturePointer::CastSpell方法代码示例

本文整理汇总了C++中CreaturePointer::CastSpell方法的典型用法代码示例。如果您正苦于以下问题:C++ CreaturePointer::CastSpell方法的具体用法?C++ CreaturePointer::CastSpell怎么用?C++ CreaturePointer::CastSpell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CreaturePointer的用法示例。


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

示例1: OnQuestStart

	void OnQuestStart(PlayerPointer pPlayer, QuestLogEntry *pQuest)
	{
		if ( pPlayer == NULL || pPlayer->GetMapMgr() == NULL || pPlayer->GetMapMgr()->GetInterface() == NULL )
			return;

		CreaturePointer pAkida = sEAS.SpawnCreature( pPlayer, 17379, -4183.043457f, -12511.419922f, 44.361786f, 6.05629f, 0 );
		if ( pAkida == NULL )
			return;

		pAkida->m_escorter = pPlayer;   
		pAkida->GetAIInterface()->setMoveType( RUN );
		pAkida->GetAIInterface()->StopMovement( 1000 );
		pAkida->GetAIInterface()->SetAllowedToEnterCombat( false );
		pAkida->SendChatMessage( CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Follow me I shall result you on a place!" );
		pAkida->SetUInt32Value( UNIT_NPC_FLAGS, 0 );
		pAkida->CastSpell( pAkida, 25035, true ); // Apparition Effect

		sEAS.CreateCustomWaypointMap( pAkida );
		sEAS.WaypointCreate( pAkida, -4174.025879f, -12512.800781f, 44.361458f, 2.827430f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4078.135986f, -12535.500977f, 43.066765f, 5.949394f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4040.495361f, -12565.537109f, 43.698250f, 5.592041f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4009.526367f, -12598.929688f, 53.168480f, 5.434962f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3981.581543f, -12635.541602f, 63.896046f, 5.332861f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3953.170410f, -12680.391602f, 75.433006f, 5.218981f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3924.324951f, -12741.846680f, 95.187035f, 5.124734f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3920.791260f, -12746.218750f, 96.887978f, 3.271200f, 0, 256, 16995 );
		sEAS.EnableWaypoints( pAkida );
		mAkidas.push_back( std::make_pair( pPlayer->GetGUID(), pAkida ) );
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:29,代码来源:Azuremyst_Isle.cpp

示例2: Carcass

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

	PlayerPointer	pPlayer = TO_PLAYER(pSpell->u_caster);
	QuestLogEntry	*pQuest = pPlayer->GetQuestLogForEntry( 10804 );
	CreaturePointer	NetherDrake = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 21648);
	GameObjectPointer FlayerCarcass = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 185155);

	if ( FlayerCarcass == NULLGOB )
	{
		FlayerCarcass = sEAS.SpawnGameobject(pPlayer, 185155, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, 1, 0, 0, 0, 0);
		FlayerCarcass->Despawn(60000);
	}
	if ( NetherDrake == NULL )
		return true;

	if ( NetherDrake->HasActiveAura(38502) )
		return true;

	if( pQuest!=NULL && pQuest->GetMobCount( 0 ) < pQuest->GetQuest()->required_mobcount[0] )
	{
		NetherDrake->CastSpell(NetherDrake, dbcSpell.LookupEntry( 38502 ), true);
		NetherDrake->GetAIInterface()->m_moveFly = true;
		NetherDrake->GetAIInterface()->MoveTo(pPlayer->GetPositionX(), pPlayer->GetPositionY()+2, pPlayer->GetPositionZ(), 0);
		pQuest->SetMobCount( 0, pQuest->GetMobCount( 0 )+1);
		pQuest->SendUpdateAddKill( 0 );
		pQuest->UpdatePlayerFields();
	}
	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:32,代码来源:Shadowmoon.cpp

示例3: ShatteringStomp

bool ShatteringStomp(uint32 i, SpellPointer pSpell)
{
	if( !pSpell->u_caster )
		return false;

	UnitPointer _unit = pSpell->u_caster;
	CreaturePointer golem = NULLCREATURE;
	for(unordered_set<ObjectPointer>::iterator itr = _unit->GetInRangeSetBegin(); itr != _unit->GetInRangeSetEnd(); ++itr) 
	{
		if( (*itr) && (*itr)->IsCreature() )
		{
			golem = TO_CREATURE((*itr));
			if( golem->isAlive() && golem->creature_info && golem->creature_info->Id == MOLTEN_GOLEM_ENTRY )
			{
				uint32 spellid = pSpell->m_spellInfo->Id == 59529 ? 59527 : 52429;
				CreaturePointer Golem = TO_CREATURE( (*itr) );
				Golem->CastSpell( Golem, spellid, true );
				for( uint8 i=0; i<7; i++ )
					Golem->SchoolImmunityList[i] = 0;
				_unit->DealDamage( Golem, Golem->GetHealth(),0,0,0);
			}
		}
	}
	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:25,代码来源:Instance_HallsOfLightning.cpp

示例4: GossipSelectOption

	void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * EnteredCode)
	{
		if(!plr)
			return;

		CreaturePointer doctor = TO_CREATURE(pObject);
		if (doctor == NULL)
			return;

		switch (IntId)
		{
			case 0:
				GossipHello(pObject, plr, true);
				break;

			case 1:
			{
				plr->GetItemInterface()->RemoveItemAmt(2799, 1);
				doctor->CastSpell(doctor, dbcSpell.LookupEntry(12380), true);
				if( !plr || !plr->GetMapMgr() || !plr->GetMapMgr()->GetInterface() )
					return;
				CreaturePointer firstenemy = sEAS.SpawnCreature(plr, 1511, -13770.5, -6.79, 42.8, 5.7 , 0);
				firstenemy->GetAIInterface()->MoveTo(-13727.8, -26.2, 46.15, 4.07);
				firstenemy->Despawn(10*60*1000, 0);
			}break;
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:27,代码来源:StranglethornVale.cpp

示例5: GossipSelectOption

	void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
	{
		CreaturePointer creat = TO_CREATURE(pObject);
		switch(IntId)
		{
		case 1:
			creat->CastSpell(plr, dbcSpell.LookupEntry(34891), true);
			break;
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:10,代码来源:Tanaris.cpp

示例6: GossipSelectOption

	void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
	{
		if(IntId == 1)
		{
			QuestLogEntry *en = plr->GetQuestLogForEntry(9785);
			CreaturePointer casta = (TO_CREATURE(pObject));
			switch (pObject->GetEntry())
			{
			case 17900:
				{
					if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
					{
						en->SetMobCount(0, 1);
						en->SendUpdateAddKill(0);
						en->UpdatePlayerFields();
					}
					
					if(plr->GetStandingRank(942) == 4)
						casta->CastSpell(plr, 31808, true);
					else if(plr->GetStandingRank(942) == 5)
						casta->CastSpell(plr, 31810, true);
					else if(plr->GetStandingRank(942) == 6)
						casta->CastSpell(plr, 31811, true);
					else if(plr->GetStandingRank(942) == 7)
						casta->CastSpell(plr, 31815, true);

				}break;
			case 17901:
				{
					if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1])
					{
						en->SetMobCount(1, 1);
						en->SendUpdateAddKill(1);
						en->UpdatePlayerFields();
					}

					CreaturePointer casta = (TO_CREATURE(pObject));
					if(plr->GetStandingRank(942) == 4)
						casta->CastSpell(plr, 31807, true);
					else if(plr->GetStandingRank(942) == 5)
						casta->CastSpell(plr, 31814, true);
					else if(plr->GetStandingRank(942) == 6)
						casta->CastSpell(plr, 31813, true);
					else if(plr->GetStandingRank(942) == 7)
						casta->CastSpell(plr, 31812, true);

				}break;
			}
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:50,代码来源:Zangarmarsh.cpp

示例7: GossipSelectOption

    void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
    {
		CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
		if(pObject->GetTypeId()!=TYPEID_UNIT)
			return;
		
		switch(IntId)
        {
        case 1:
			{
				plr->Gossip_Complete();
				pCreature->CastSpell(plr, dbcSpell.LookupEntry(42711), true);
            }break;
		}
    }
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:15,代码来源:Gossip_Stormwind.cpp

示例8: OnQuestCancel

	void OnQuestCancel(PlayerPointer pPlayer)
	{
		uint64 PlayerGuid = pPlayer->GetGUID();
		for ( QuestCreature::iterator itr = mAkidas.begin(); itr != mAkidas.end(); ++itr )
		{
			if ( itr->first == PlayerGuid )
			{
				CreaturePointer pAkida = itr->second;
				if ( pAkida != NULL )							// Can't happen, but whatever :)
				{
					pAkida->CastSpell( pAkida, 30428, true );	// Disparition Effect
					pAkida->Despawn( 5000, 0 );
				}

				mAkidas.erase( itr );
			}
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:18,代码来源:Azuremyst_Isle.cpp

示例9: GossipSelectOption

    void GossipSelectOption(ObjectPointer pObject, PlayerPointer  plr, uint32 Id, uint32 IntId, const char * Code)
    {
		if( !plr )
			return;
		
		CreaturePointer  pCreature = NULLCREATURE;
		pCreature = pObject->IsCreature() ? TO_CREATURE( pObject ) : NULLCREATURE;
		if( !pCreature )
			return;

		if( IntId == 3 )
		{
			plr->GetSession()->SendInventoryList(pCreature);
			return;
		}

		uint32 CastSpellID = IntId == 1 ? 32430 : 32431;
		if( CastSpellID != 0 )
			if( !plr->HasAura( CastSpellID ) )
				pCreature->CastSpell(plr,CastSpellID,true);
		return;
    }
开发者ID:AwkwardDev,项目名称:Descent-core-scripts-3.3.5,代码行数:22,代码来源:ZoneZangarmarsh.cpp

示例10: 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

示例11: GossipSelectOption

void InnkeeperGossip::GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
{
	CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
	if(pCreature==NULLCREATURE)
		return;

    switch(IntId)
    {
    case 1:     // VENDOR
        Plr->GetSession()->SendInventoryList(pCreature);
        break;
    case 2:     // BINDER
        Plr->GetSession()->SendInnkeeperBind(pCreature);
        break;
    case 3:     // WHAT CAN I DO ?
        // Prepare second menu
        GossipMenu *Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1853, Plr);
        Menu->AddItem(5, "Make this inn your home.", 2);
        Menu->SendTo(Plr);
        break;
	case 4:     // EVENT OF HALLOWEEN
		if(!Plr->HasAura(SPELL_TRICK_OR_TREATED))
		{
			pCreature->CastSpell(Plr, SPELL_TRICK_OR_TREATED, true);

			// either trick or treat, 50% chance
			if(rand()%2)
			{
				Plr->CastSpell(Plr, SPELL_TREAT, true);
			}
			else
			{
				int32 trickspell=0;
				switch (rand()%9)
				{
					case 0:
					    trickspell=24753;                       // cannot cast, random 30sec
						break;
					case 1:
						trickspell=24713;                       // lepper gnome costume
						break;
					case 2:
						if(Plr->getGender() == 0){
							trickspell=24735;                   // male ghost costume
						}else{
							trickspell=24736;                   // female ghostcostume
						}
	                    break;
	                case 3:
						if(Plr->getGender() == 0){
							trickspell=24711;                   // male ninja costume
						}else{
							trickspell=24710;                   // female ninja costume
						}
		                break;
	                case 4:
						if(Plr->getGender() == 0){
							trickspell=24708;                   // male pirate costume
						}else{
							trickspell=24709;                   // female pirate costume
						}
	                    break;
	                case 5:
	                    trickspell=24723;                       // skeleton costume
	                    break;
	            }
	            pCreature->CastSpell(Plr, trickspell, true);
			}	
		}
		Plr->Gossip_Complete();
        break;
    }
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:74,代码来源:Gossip_Innkeepers.cpp

示例12: GossipSelectOption

    void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
    {
		GossipMenu * Menu;
		switch (IntId)	// switch and case 0 can be deleted, but I added it, because in future maybe we will have to expand script with more options.
		{
			case 0:
				GossipHello(pObject, plr, true);
				break;

			case 1:
			{
				if (!plr->_HasSkillLine(164) || plr->_GetSkillLineCurrent(164, false) < 300)
				{
				    //pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Only skilled blacksmiths can obtain this knowledge." );
					SendQuickMenu(20001);
				}
		
				else if (!plr->HasSpell(9787))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need to know Weaponsmith first to learn anything more from me." );
					SendQuickMenu(20002);
				}
		
				else if (plr->HasSpell(17040))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know that." );
					SendQuickMenu(20003);
				}
	
				else if (plr->HasSpell(17041) || plr->HasSpell(17039) || plr->HasSpell(9788))
				{
					//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You already know one specialization." );
					SendQuickMenu(20004);
				}
		
				else
				{
					if ( plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 600 )
					{
						//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You need 6 silver coins to learn this skill.");
						SendQuickMenu(20005);
					}
		
					else
					{
						//pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Make good use of this knowledge." );
						SendQuickMenu(20006);
						CreaturePointer Trainer = TO_CREATURE(pObject);
						Trainer->CastSpell(plr, 39099, true);
						int32 gold = plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
						plr->SetUInt32Value(PLAYER_FIELD_COINAGE, gold - 600);
					}	
				}
			}break;

			case 2:
			{
				if (!plr->HasSpell(17040))
				{
					SendQuickMenu(20007);
				}

				else if ((plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 250000 && plr->getLevel() <= 50) ||
						(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 500000 && plr->getLevel() > 50 && plr->getLevel() <= 65) ||
						(plr->GetUInt32Value(PLAYER_FIELD_COINAGE) < 1000000 && plr->getLevel() > 65))
				{
					SendQuickMenu(20008);
				}

				else
				{
					int32 unlearnGold;
					if (plr->getLevel() <= 50)
						unlearnGold = 250000;
					if (plr->getLevel() > 50 && plr->getLevel() <= 65)
						unlearnGold = 500000;
					if (plr->getLevel() > 65)
						unlearnGold = 1000000;

                    plr->SetUInt32Value(PLAYER_FIELD_COINAGE, plr->GetUInt32Value(PLAYER_FIELD_COINAGE) - unlearnGold);
					plr->removeSpell(17040, false, false, 0);
					SendQuickMenu(20009);
				}
			}break;
		}
	}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:86,代码来源:Gossip_Trainer.cpp


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