本文整理汇总了C++中GuidList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ GuidList::empty方法的具体用法?C++ GuidList::empty怎么用?C++ GuidList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuidList
的用法示例。
在下文中一共展示了GuidList::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RestoreAll
void RestoreAll()
{
if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_RIGHT)))
instance->HandleGameObject(ObjectGuid::Empty, false, go);
if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_GO_CAVE_IN_LEFT)))
instance->HandleGameObject(ObjectGuid::Empty, false, go);
if (!GoSummonList.empty())
for (GuidList::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr))
go->RemoveFromWorld();
}
if (!SummonList.empty())
for (GuidList::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
{
if (summon->IsAlive())
summon->DisappearAndDie();
else
summon->RemoveCorpse();
}
}
}
示例2: InitSentinelsNear
void InitSentinelsNear(Unit* pTarget)
{
if (!m_lAssistList.empty())
{
for (GuidList::const_iterator itr = m_lAssistList.begin(); itr != m_lAssistList.end(); ++itr)
{
if (*itr == m_creature->GetObjectGuid())
continue;
if (Creature* pBuddy = m_creature->GetMap()->GetCreature(*itr))
{
if (pBuddy->isAlive())
pBuddy->AI()->AttackStart(pTarget);
}
}
return;
}
std::list<Creature*> lAssistList;
GetCreatureListWithEntryInGrid(lAssistList, m_creature, m_creature->GetEntry(), 80.0f);
for (std::list<Creature*>::iterator iter = lAssistList.begin(); iter != lAssistList.end(); ++iter)
{
m_lAssistList.push_back((*iter)->GetObjectGuid());
if ((*iter)->GetObjectGuid() == m_creature->GetObjectGuid())
continue;
(*iter)->AI()->AttackStart(pTarget);
}
if (m_lAssistList.size() != MAX_BUDDY)
script_error_log("npc_anubisath_sentinel for %s found too few/too many buddies, expected %u.", m_creature->GetGuidStr().c_str(), MAX_BUDDY);
}
示例3: SummonAdds
void SummonAdds(bool /*bRightSide*/, uint32 uiSummonEntry)
{
GuidList* plSummonPosGuids;
switch (uiSummonEntry)
{
case NPC_UNREL_TRAINEE:
plSummonPosGuids = &m_lTraineeSummonPosGuids;
break;
case NPC_UNREL_DEATH_KNIGHT:
plSummonPosGuids = &m_lDeathKnightSummonPosGuids;
break;
case NPC_UNREL_RIDER:
plSummonPosGuids = &m_lRiderSummonPosGuids;
break;
default:
return;
}
if (plSummonPosGuids->empty())
{
return;
}
for (GuidList::iterator itr = plSummonPosGuids->begin(); itr != plSummonPosGuids->end(); ++itr)
{
if (Creature* pPos = m_creature->GetMap()->GetCreature(*itr))
{
m_creature->SummonCreature(uiSummonEntry, pPos->GetPositionX(), pPos->GetPositionY(), pPos->GetPositionZ(), pPos->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
}
}
}
示例4: UpdateAI
void UpdateAI(uint32 uiDiff) override
{
ScriptedAI::UpdateAI(uiDiff);
if (uiTimer <= uiDiff)
{
switch (uiPhase)
{
case 1:
DoSummonGrandChampion(uiSecondBoss);
NextStep(10000, true);
break;
case 2:
DoSummonGrandChampion(uiThirdBoss);
NextStep(0, false);
break;
case 3:
if (!Champion1List.empty())
{
for (GuidList::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
AggroAllPlayers(summon);
NextStep(0, false);
}
break;
}
} else uiTimer -= uiDiff;
if (!UpdateVictim())
return;
}
示例5: SummonedCreatureJustDied
void SummonedCreatureJustDied(Creature* pSummoned) override
{
if (pSummoned->GetEntry() == NPC_GLOB_OF_VISCIDUS)
{
// shrink - modify scale
m_creature->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, float(-4), true);
m_creature->UpdateModelData();
m_creature->SetHealth(m_creature->GetHealth() - (m_creature->GetMaxHealth() * 0.05f));
m_lGlobesGuidList.remove(pSummoned->GetObjectGuid());
// suicide if required
if (m_creature->GetHealthPercent() < 5.0f)
{
m_creature->SetVisibility(VISIBILITY_ON);
if (DoCastSpellIfCan(m_creature, SPELL_VISCIDUS_SUICIDE, CAST_TRIGGERED) == CAST_OK)
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);
}
else if (m_lGlobesGuidList.empty())
{
m_creature->SetVisibility(VISIBILITY_ON);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
m_uiPhase = PHASE_NORMAL;
SetCombatMovement(true);
DoStartMovement(m_creature->getVictim());
}
}
}
示例6: ActivateRandomConstellation
// Activate a random Constellation
void ActivateRandomConstellation()
{
// spawn a new set of constellations if empty
if (m_lConstellationsGuids.empty())
{
DoSpawnConstellations();
m_uiConstellationTimer = 5000;
return;
}
GuidList::iterator iter = m_lConstellationsGuids.begin();
advance(iter, urand(0, m_lConstellationsGuids.size() - 1));
if (Creature* pConstellation = m_creature->GetMap()->GetCreature(*iter))
{
// follow second top aggro player
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, uint32(0), SELECT_FLAG_PLAYER))
{
pConstellation->GetMotionMaster()->MoveFollow(pTarget, CONTACT_DISTANCE, 0);
SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, pConstellation);
++m_uiActiveConstelations;
}
}
m_lConstellationsGuids.remove(*iter);
}
示例7: ShatterGolems
void ShatterGolems()
{
if (m_lGolemGUIDList.empty())
return;
uint8 m_uiBrittleGolemsCount = 0;
for (GuidList::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr)
{
if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
{
// only shatter brittle golems
if (pTemp->GetEntry() == NPC_BRITTLE_GOLEM)
{
pTemp->CastSpell(pTemp, m_bIsRegularMode ? SPELL_SHATTER : SPELL_SHATTER_H, true);
++m_uiBrittleGolemsCount;
}
}
}
// If shattered more than 4 golems mark achiev as failed
if (m_uiBrittleGolemsCount > MAX_ACHIEV_GOLEMS)
{
if (m_pInstance)
m_pInstance->SetData(TYPE_VOLKHAN, SPECIAL);
}
}
示例8: SelectTargetWithinDist
Unit* SelectTargetWithinDist()
{
ThreatList const& m_threatlist = m_creature->getThreatManager().getThreatList();
if (m_threatlist.empty())
return NULL;
GuidList distPositive;
for (ThreatList::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
{
if (Unit* pTemp = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
{
//player within 80 yards
if ((pTemp->GetTypeId() == TYPEID_PLAYER && !m_creature->IsWithinDist(pTemp, 10.0f) && m_creature->IsWithinDist(pTemp, 80.0f)))
distPositive.push_back(pTemp->GetObjectGuid());
}
}
if (!distPositive.empty())
{
GuidList::iterator m_uiPlayerGUID = distPositive.begin();
advance(m_uiPlayerGUID, (rand()%distPositive.size()));
if (Player* pTemp = m_creature->GetMap()->GetPlayer(*m_uiPlayerGUID))
return pTemp;
}
return NULL;
}
示例9: FindNewGroups
/**
Checks que main queue to try to form a Lfg group. Returns first match found (if any)
@param[in] check List of guids trying to match with other groups
@param[in] all List of all other guids in main queue to match against
@return LfgCompatibility type of compatibility between groups
*/
LfgCompatibility LFGQueue::FindNewGroups(GuidList& check, GuidList& all)
{
std::string strGuids = ConcatenateGuids(check);
LfgCompatibility compatibles = GetCompatibles(strGuids);
TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str());
if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate
compatibles = CheckCompatibility(check);
if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check))
{
TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str());
SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH);
return LFG_COMPATIBLES_MATCH;
}
if (compatibles != LFG_COMPATIBLES_WITH_LESS_PLAYERS)
return compatibles;
// Try to match with queued groups
while (!all.empty())
{
check.push_back(all.front());
all.pop_front();
LfgCompatibility subcompatibility = FindNewGroups(check, all);
if (subcompatibility == LFG_COMPATIBLES_MATCH)
return LFG_COMPATIBLES_MATCH;
check.pop_back();
}
return compatibles;
}
示例10: GetAIInformation
void GetAIInformation(ChatHandler& reader) override
{
if (m_lAssistList.empty())
reader.PSendSysMessage("Anubisath Sentinel - group not assigned, will be assigned OnAggro");
if (m_lAssistList.size() == MAX_BUDDY)
reader.PSendSysMessage("Anubisath Sentinel - proper group found");
else
reader.PSendSysMessage("Anubisath Sentinel - not correct number of mobs for group found. Number found %u, should be %u", uint32(m_lAssistList.size()), MAX_BUDDY);
}
示例11: SummonedCreatureJustDied
void SummonedCreatureJustDied(Creature* pSummoned) override
{
if (pSummoned->GetEntry() == NPC_IRONTREE_STOMPER || pSummoned->GetEntry() == NPC_IRONTREE_WANDERER)
{
m_lSummonsGuids.remove(pSummoned->GetObjectGuid());
if (m_lSummonsGuids.empty())
dialogueStep = 1;
}
}
示例12: SelectRandomVolunteer
ObjectGuid SelectRandomVolunteer()
{
if (m_lVolunteerGuidList.empty())
return ObjectGuid();
GuidList::iterator iter = m_lVolunteerGuidList.begin();
advance(iter, urand(0, m_lVolunteerGuidList.size() - 1));
return *iter;
}
示例13: SelectRandomUpperBunny
// function to return a random arena upper Bunny
Creature* SelectRandomUpperBunny()
{
if (m_lUpperBunniesGuids.empty())
return NULL;
GuidList::iterator iter = m_lUpperBunniesGuids.begin();
advance(iter, urand(0, m_lUpperBunniesGuids.size() - 1));
return m_creature->GetMap()->GetCreature(*iter);
}
示例14: SelectRandomBunnyGuid
// function to return a random arena bunny for Blizzard spell
ObjectGuid SelectRandomBunnyGuid()
{
if (m_lBunniesGuids.empty())
return ObjectGuid();
GuidList::iterator iter = m_lBunniesGuids.begin();
advance(iter, urand(0, m_lBunniesGuids.size() - 1));
return *iter;
}
示例15: SelectRandomCrowdNpc
ObjectGuid SelectRandomCrowdNpc()
{
if (m_lCrowdGuidList.empty())
return ObjectGuid();
GuidList::iterator iter = m_lCrowdGuidList.begin();
advance(iter, urand(0, m_lCrowdGuidList.size() - 1));
return *iter;
}