本文整理汇总了C++中PlayerPointer::CalcDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::CalcDistance方法的具体用法?C++ PlayerPointer::CalcDistance怎么用?C++ PlayerPointer::CalcDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::CalcDistance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GossipHello
void GossipHello( ObjectPointer pObject, PlayerPointer pPlayer, bool AutoSend )
{
if ( pObject == NULL || pObject->GetTypeId() != TYPEID_ITEM || pPlayer == NULL )
return;
QuestLogEntry* QuestEntry = pPlayer->GetQuestLogForEntry( 9452 );
if ( QuestEntry == NULL )
return;
#ifndef BLIZZLIKE
//if ( QuestEntry->GetMobCount( 0 ) >= QuestEntry->GetQuest()->required_mobcount[ 0 ] )
// return;
#endif
if ( pPlayer->GetMapMgr() == NULLMAPMGR )
return;
// Meh, double object looking - we should find a way to remove this
GameObjectPointer School = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 181616 );
if ( School == NULLGOB || pPlayer->CalcDistance( School ) > 5.0f )
return;
#ifdef BLIZZLIKE
sEventMgr.AddEvent( School, &GameObject::Despawn, static_cast< uint32 >( 20000 ), EVENT_GAMEOBJECT_ITEM_SPAWN, 1000, 1, 0 );
#else
School->Despawn( 20000 );
#endif
pPlayer->CastSpell( pPlayer, dbcSpell.LookupEntry( TO_ITEM( pObject )->GetProto()->Spells[ 0 ].Id ), false );
uint32 Chance = RandomUInt( 10 );
if ( Chance <= 3 )
{
CreaturePointer NewCreature = sEAS.SpawnCreature( pPlayer, 17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 180000 );
if ( NewCreature != NULLCREATURE )
{
NewCreature->GetAIInterface()->StopMovement( 500 );
NewCreature->setAttackTimer( 1000, false );
NewCreature->m_noRespawn = true;
};
return;
};
sEAS.AddItem( 23614, pPlayer );
QuestEntry->SendUpdateAddKill( 1 );
QuestEntry->UpdatePlayerFields();
pPlayer->Gossip_Complete();
};
示例2: DropFlag
void DropFlag(PlayerPointer pPlayer, uint32 spellID)
{
if(!pPlayer || spellID != SILITHYST_SPELL)
return;
uint32 triggerID = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_RETURN : HORDE_RETURN;
// we have to use AreaTrigger.dbc here
AreaTrigger* pAreaTrigger = AreaTriggerStorage.LookupEntry(triggerID);
if(pAreaTrigger)
if(pPlayer->CalcDistance(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z) > 10.0f)
{
GameObjectPointer pGo = pPlayer->GetMapMgr()->GetInterface()->SpawnGameObject(SILITHYST_MOUND, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, true, 0, 0);
if(pGo == NULL)
{
pGo->Destructor();
pGo = NULLGOB;
}
};
}
示例3: OnQuestStart
void OnQuestStart(PlayerPointer mTarget, QuestLogEntry * qLogEntry)
{
if( !mTarget || !mTarget->GetMapMgr() || !mTarget->GetMapMgr()->GetInterface() )
return;
Yor = sEAS.SpawnCreature( mTarget, 17393, -4634.246582f, -13071.686523f, -14.755350f, 1.569997f, 0 );
if( !Yor )
return;
Yor->CastSpell( Yor, 25035, true ); // Apparition Effect
Yor->m_escorter = mTarget;
Yor->GetAIInterface()->StopMovement( 1000 );
Yor->SetUInt32Value( UNIT_NPC_FLAGS, 0 );
char msg[256];
snprintf((char*)msg, 256, "Come, %s . Let us leave the water together, purified.", mTarget->GetName() );
Yor->SendChatMessage( CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, msg );
sEAS.CreateCustomWaypointMap( Yor );
sEAS.WaypointCreate( Yor, -4650.081055f, -13016.692383f, 1.776296f, 2.021601f, 0, 256, 16393 );
sEAS.WaypointCreate( Yor, -3886.341553f, -13098.914063f, 3.964841f, 1.855801f, 1000, 256, 16393 );
sEAS.WaypointCreate( Yor, -4677.421387f, -12983.874023f, 0.833827f, 2.335760f, 0, 256, 16393 ); // Should look player
sEAS.EnableWaypoints( Yor );
//We have to set up these pointers first to resolve ambiguity in the event manager template
UnitPointer Totem = TO_UNIT(Yor);
UnitPointer Plr = TO_UNIT(mTarget);
// Change to Stillpine form
sEventMgr.AddEvent(Totem, &Unit::EventCastSpell, Totem, dbcSpell.LookupEntry(30446), EVENT_CREATURE_UPDATE, 15500, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
string msg2 = "[Furbolg] We go now, together. We will seek Vark.";
sEventMgr.AddEvent(Totem, &Unit::SendChatMessage, (uint8)CHAT_MSG_MONSTER_SAY, (uint32)LANG_UNIVERSAL, msg2.c_str(), EVENT_UNIT_CHAT_MSG, 26500, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
// Change to nightsaber form
sEventMgr.AddEvent(Totem, &Unit::EventCastSpell, Totem, dbcSpell.LookupEntry(30448), EVENT_CREATURE_UPDATE, 30000, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
string msg3 = "[Furbolg] Follow me to Vark.";
sEventMgr.AddEvent(Totem, &Unit::SendChatMessage, (uint8)CHAT_MSG_MONSTER_SAY, (uint32)LANG_UNIVERSAL, msg3.c_str(), EVENT_UNIT_CHAT_MSG, 31000, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
if( mTarget->CalcDistance( Totem, Plr ) <= 10 )
sEventMgr.AddEvent(Totem, &Unit::EventCastSpell, Plr, dbcSpell.LookupEntry(30448), EVENT_CREATURE_UPDATE, 31000, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
}