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


C++ Creature::Despawn方法代码示例

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


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

示例1: WarIsHell

// War is Hell
bool WarIsHell(uint32 i, Spell* pSpell)
{
	if( !pSpell->u_caster->IsPlayer() )
		return true;

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

	Creature* target = TO_CREATURE(plr->GetMapMgr()->GetInterface()->GetCreatureNearestCoords( plr->GetPositionX(), plr->GetPositionY() , plr->GetPositionZ(), 24008 ));
	if( target == NULL )
		return true;

	QuestLogEntry *qle = plr->GetQuestLogForEntry(11270);
  
	if( qle == NULL )
		return true;
 
	GameObject* obj = NULL;

	sEAS.KillMobForQuest( plr, qle, 0 );

	obj = sEAS.SpawnGameobject(plr, 183816, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 1, 0, 0, 0, 0);
	sEAS.GameobjectDelete(obj, 1*30*1000);

	target->Despawn( 2000, 60*1000 );
	plr->UpdateNearbyGameObjects();
	qle->UpdatePlayerFields();
	return true;
}
开发者ID:vata,项目名称:wowice,代码行数:31,代码来源:Quest_Howling_Fjord.cpp

示例2: FilledShimmeringVessel

bool FilledShimmeringVessel(uint32 i, Spell* pSpell) // Blood Elf ress. quest
{
	if(!pSpell->u_caster->IsPlayer())
		return true;

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

	Creature *target = plr->GetMapMgr()->GetCreature((uint32)plr->GetSelection());
	if(target == NULL)
		return true;

	if(target->GetEntry() != 17768)
		return true;

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

	target->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
	target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);

	target->Despawn(10*1000, 1*60*1000);

	target->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Thank you, dear Paladin, you just saved my life.");

	qle->SetMobCount(0, 1);
	qle->SendUpdateAddKill(0);
	qle->UpdatePlayerFields();

	return true;
}
开发者ID:Chero,项目名称:abcwow,代码行数:31,代码来源:Paladin.cpp

示例3: GossipHello

   void GossipHello(Object *pObject, Player *Plr, bool AutoSend)
   {
      QuestLogEntry *en = Plr->GetQuestLogForEntry(5211);

      if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
      {
        uint32 newcount = en->GetMobCount(0) + 1;

        en->SetMobCount(0, newcount);
        en->SendUpdateAddKill(0);
        en->UpdatePlayerFields();
      }
   
      GossipMenu *Menu;
      objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 3873, Plr);

      if(AutoSend)
         Menu->SendTo(Plr);

      if(!pObject->IsCreature())
        return;

      Creature *Spirit = static_cast<Creature*>(pObject);

      Spirit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
      
      TimedEvent *te = TimedEvent::Allocate(this, new CallbackP1<Darrowshire_Spirit, Creature*>(this, &Darrowshire_Spirit::DeleteDelay, Spirit), 0, 5000, 1);  
      Spirit->event_AddEvent(te);
      Spirit->Despawn(4000, 0);
   }
开发者ID:Chero,项目名称:abcwow,代码行数:30,代码来源:Eastern_Plaguelands.cpp

示例4: HookOnUnitDied

void StrandOfTheAncient::HookOnUnitDied(Unit* victim)
{
    if (victim->IsCreature())
    {

        for (uint32 i = 0; i < SOTA_NUM_DEMOLISHERS; i++)
        {
            Creature *c = demolisher[i];

            if (c == NULL)
                continue;

            if (victim->GetGUID() != c->GetGUID())
                continue;

            demolisher[i] = SpawnCreature(28781, DemolisherLocations[i], TeamFactions[Attackers]);
            c->Despawn(1, 0);
        }

        for (uint32 i = 0; i < SOTA_NUM_CANONS; i++)
        {
            if (canon[i] == NULL)
                continue;

            if (victim->GetGUID() != canon[i]->GetGUID())
                continue;

            canon[i]->Despawn(1, 0);
            canon[i] = NULL;
        }
    }
}
开发者ID:lev1976g,项目名称:AscEmu,代码行数:32,代码来源:StrandOfTheAncient.cpp

示例5: StoppingTheSpread

// Stopping the Spread
bool StoppingTheSpread(uint32 i, Spell* pSpell)
{
  if(!pSpell->u_caster->IsPlayer())
	return true;

  Player *plr = (Player*)pSpell->u_caster;
  Creature *target = (Creature*)plr->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(plr->GetPositionX(), plr->GetPositionY() , plr->GetPositionZ(), 18240);

  if(target == NULL)
	  return true;

  QuestLogEntry *qle = plr->GetQuestLogForEntry(9874);
  
  if(qle == NULL)
    return true;
 
  GameObject *obj = NULL;
 
  if(qle && qle->GetMobCount(0) < qle->GetQuest()->required_mobcount[0])
  {
		qle->SetMobCount(0, qle->GetMobCount(0)+1);
		qle->SendUpdateAddKill(0);
		
		obj = sEAS.SpawnGameobject(plr, 183816, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 1);
		sEAS.GameobjectDelete(obj, 1*30*1000);
  }
  target->Despawn(2000, 60*1000);
  plr->UpdateNearbyGameObjects();
  qle->UpdatePlayerFields();
  return true;
}
开发者ID:miklasiak,项目名称:projekt,代码行数:32,代码来源:Nagrand.cpp

示例6: OnSelectOption

		void OnSelectOption(Object* pObject, Player* pPlayer, uint32 Id, const char* EnteredCode)
		{
			switch(Id)
			{
				case 0: OnHello(pObject, pPlayer); break;
				case 1:
					{
						int32 i = -1;
						Creature* pPrisoner = TO_CREATURE(pObject);
						switch(pPrisoner->GetEntry())
						{
							case 20677: i = 0; break;
							case 20678: i = 1; break;
							case 20679: i = 2; break;
						}

						if(i == -1)
							return;

						QuestLogEntry* pQuest = pPlayer->GetQuestLogForEntry(10368);
						if(pQuest != NULL && pQuest->GetMobCount(i) < pQuest->GetQuest()->required_mobcount[i])
						{
							pQuest->SetMobCount(i, pQuest->GetMobCount(i) + 1);
							pQuest->SendUpdateAddKill(i);
							pQuest->UpdatePlayerFields();

							pPrisoner->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "You've freed me! The winds speak to my people one again and grant us their strength. I thank you, stranger.");
							pPrisoner->Despawn(5000, 6 * 60 * 1000);
							pPrisoner->SetStandState(STANDSTATE_STAND);
						}
					}
					break;
			}
		}
开发者ID:Refuge89,项目名称:arcscripts2,代码行数:34,代码来源:Quest_Hellfire_Peninsula.cpp

示例7: SpragglesCanteen

bool SpragglesCanteen(uint32 i, Spell* pSpell)
{
  if(!pSpell->u_caster->IsPlayer())
    return true;

  Player *plr = (Player*)pSpell->u_caster;
  
  Creature *target = plr->GetMapMgr()->GetCreature(GET_LOWGUID_PART(plr->GetSelection()));
  if(target == NULL)
    return true;

  if(target->GetEntry() != 9999)
    return true;

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

  target->SetStandState(0);
  target->setDeathState(ALIVE);

  target->Despawn(30*1000, 1*60*1000);

  qle->SetMobCount(0, 1);
  qle->SendUpdateAddKill(0);
  qle->UpdatePlayerFields();

  return true;
}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:29,代码来源:UnGoro.cpp

示例8: ConvertingSentry

bool ConvertingSentry(uint32 i, Spell* pSpell)
{
	Player *caster = pSpell->p_caster;
	if(caster == NULL)
		return false;

	Creature *target = static_cast<Creature*>(pSpell->GetUnitTarget());
	if(target == NULL)
		return false;

	if( caster->GetUInt32Value(UNIT_FIELD_SUMMON) == 24981 )
		return false;

	// Erratic Sentry: 24972
	if(target->GetEntry() != 24972)
		return false;

	if(!target->isAlive())
		return false;

	target->Despawn(1, 2*60*1000);

	caster->CastSpell(caster, 45009, true);

	return true;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例9: GossipSelectOption

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

		Creature* spirit = TO_CREATURE(pObject);
		if (spirit == NULL)
			return;

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

			case 1:
				{
					QuestLogEntry *en = plr->GetQuestLogForEntry(3520);
					if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
					{
						en->SetMobCount(0, en->GetMobCount(0) + 1);
						en->SendUpdateAddKill(0);
						en->UpdatePlayerFields();
					}
					if(!spirit)
						return;

					spirit->Despawn(1, 0);
					return;

				}
		}
	}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例10: GossipSelectOption

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

			Creature* windwatcher = TO_CREATURE(pObject);
			if(windwatcher == NULL)
				return;

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

				case 1:
					{
						Creature* whirlwind = plr->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), 6239);
						if(whirlwind != NULL)
						{
							if(!whirlwind->isAlive())
							{
								whirlwind->Delete();
							}
							else
								return;
						}

						whirlwind = sEAS.SpawnCreature(plr, 6239, plr->GetPositionX() + 7, plr->GetPositionY() + 7, plr->GetPositionZ(), plr->GetOrientation(), 0);
						whirlwind->Despawn(5 * 60 * 1000, 0);
					}
					break;
			}
		}
开发者ID:DebugProject,项目名称:Lua-Other,代码行数:34,代码来源:Quest_Warrior.cpp

示例11: ChickenNet

bool ChickenNet( uint32 i, Spell * pSpell )
{
	if( !pSpell->u_caster->IsPlayer() )
        return true;

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

	QuestLogEntry *qle = pPlayer->GetQuestLogForEntry( 12532 );
	if( qle == NULL )
	{
		QuestLogEntry *qle = pPlayer->GetQuestLogForEntry( 12702 );
		if( qle == NULL )
			return true;
	}

	
	if( !pSpell->GetUnitTarget()->IsCreature() )
		return true;

	Creature * Chicken = TO_CREATURE( pSpell->GetUnitTarget() );

	if( Chicken != NULL && Chicken->GetEntry() == 28161 )
	{
		Chicken->Despawn( 5000, 360000 );
		pPlayer->CastSpell( pSpell->u_caster, dbcSpell.LookupEntry( 51037 ), true );
	}

   return true;
}
开发者ID:AscNHalf,项目名称:AscNHalf,代码行数:29,代码来源:SholazarBasin.cpp

示例12: GossipSelectOption

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

		Creature* 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;
				Creature* 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:arcticdev,项目名称:arctic-test,代码行数:27,代码来源:StranglethornVale.cpp

示例13: OnQuestStart

	  void OnQuestStart(Player * mTarget, QuestLogEntry * qLogEntry)
	  {
		if( mTarget == NULL || mTarget->GetMapMgr() == NULL || mTarget->GetMapMgr()->GetInterface() == NULL )
			return;
		 Creature * brokentoe = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(mTarget->GetPositionX(), mTarget->GetPositionY(), 0, 18398);
			if(brokentoe)
			{
			   brokentoe->Despawn(1000,0);
			}

			Unit * Qgiver = NULL;
				Qgiver = mTarget->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(mTarget->GetPositionX(), mTarget->GetPositionY(), 0, 18471);

				if(Qgiver)
				{
				char msg[256];
				snprintf((char*)msg, 256, "Get in the Ring of Blood, %s . The fight is about to start!", mTarget->GetName());
				Qgiver->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, msg);
				string msg2 = "The battle is about to begin! The unmerciful Murkblood twins versus ";
				msg2 += mTarget->GetName();
				sEventMgr.AddEvent(static_cast< Unit* >(Qgiver), &Unit::SendChatMessage, (uint8)CHAT_MSG_MONSTER_YELL, (uint32)LANG_UNIVERSAL, msg2.c_str(), EVENT_UNIT_CHAT_MSG, 4000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
				mTarget->GetMapMgr()->GetInterface()->SpawnCreature(18399, -704.669f, 7871.08f, 45.0387f, 1.59531f, true, false, 0, 0);
				mTarget->GetMapMgr()->GetInterface()->SpawnCreature(18399, -708.076f, 7870.41f, 44.8457f, 1.59531f, true, false, 0, 0);
				}
	  }
开发者ID:miklasiak,项目名称:projekt,代码行数:25,代码来源:Nagrand.cpp

示例14: GossipHello

   void GossipHello(Object * pObject, Player * plr, bool AutoSend)
   {
      QuestLogEntry *en = plr->GetQuestLogForEntry(5211);

      if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0])
      {
        uint32 newcount = en->GetMobCount(0) + 1;

        en->SetMobCount(0, newcount);
        en->SendUpdateAddKill(0);
        en->UpdatePlayerFields();
      }
   
      GossipMenu *Menu;
      objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 3873, plr);

      if(AutoSend)
         Menu->SendTo(plr);

      if(!pObject || !pObject->IsCreature())
        return;

      Creature * Spirit = TO_CREATURE(pObject);

      Spirit->SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
      sEventMgr.AddEvent(Spirit, &Creature::SafeDelete, EVENT_CREATURE_REMOVE_CORPSE,5000, 1, 0);
      Spirit->Despawn(4000, 0);
   }
开发者ID:AscNHalf,项目名称:AscNHalf,代码行数:28,代码来源:Eastern_Plaguelands.cpp

示例15: AnAmbitiousPlan

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

	Player *pPlayer = static_cast< Player* >( pSpell->u_caster );
	QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 9383 );
	if ( pQuest == NULL )
		return true;

	Creature *pTarget = pPlayer->GetMapMgr()->GetCreature( GET_LOWGUID_PART( pPlayer->GetSelection() ) );
	if ( pTarget == NULL || pTarget->GetEntry() != 16975 )
		return true;

	float SSx = pTarget->GetPositionX();
	float SSy = pTarget->GetPositionY();
	float SSz = pTarget->GetPositionZ();
	pTarget->GetAIInterface()->SetAllowedToEnterCombat( false );
	pTarget->GetAIInterface()->StopMovement( 0 );
	pTarget->GetAIInterface()->setCurrentAgent( AGENT_NULL );
	pTarget->GetAIInterface()->SetAIState( STATE_IDLE );
	pTarget->Despawn( 0, 0 );

	GameObject *pGameobject = sEAS.SpawnGameobject( pPlayer, 183816, SSx, SSy, SSz, 0, 1 );
	if ( pGameobject != NULL )
	{
		sEAS.GameobjectDelete( pGameobject, 1 * 60 * 1000 );
		pPlayer->UpdateNearbyGameObjects();
	}

	return true;
}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:32,代码来源:Hellfire_Peninsula.cpp


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