本文整理汇总了C++中instance_ulduar::GetSingleCreatureFromStorage方法的典型用法代码示例。如果您正苦于以下问题:C++ instance_ulduar::GetSingleCreatureFromStorage方法的具体用法?C++ instance_ulduar::GetSingleCreatureFromStorage怎么用?C++ instance_ulduar::GetSingleCreatureFromStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类instance_ulduar
的用法示例。
在下文中一共展示了instance_ulduar::GetSingleCreatureFromStorage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JustDidDialogueStep
void JustDidDialogueStep(int32 iEntry) override
{
if (!m_pInstance)
return;
switch (iEntry)
{
case NPC_SIF:
DoCastSpellIfCan(m_creature, SPELL_SHEAT_OF_LIGHTNING, CAST_TRIGGERED | CAST_AURA_NOT_PRESENT);
if (Creature* pSif = m_creature->SummonCreature(NPC_SIF, afSifSpawnLoc[0], afSifSpawnLoc[1], afSifSpawnLoc[2], afSifSpawnLoc[3], TEMPSUMMON_CORPSE_DESPAWN, 0))
DoScriptText(SAY_SIF_BEGIN, pSif);
break;
case SPELL_TOUCH_OF_DOMINION:
if (Creature* pSif = m_pInstance->GetSingleCreatureFromStorage(NPC_SIF))
pSif->CastSpell(m_creature, SPELL_TOUCH_OF_DOMINION, false);
break;
case PHASE_SOLO:
m_creature->GetMotionMaster()->MoveJump(afArenaCenterLoc[0], afArenaCenterLoc[1], afArenaCenterLoc[2], 45.55969f, 5.0f, 1);
break;
case SPELL_STORMHAMMER_OUTRO:
DoScriptText(SAY_DEFEATED, m_creature);
break;
case SAY_OUTRO_HARD_1:
DoCastSpellIfCan(m_creature, SPELL_STORMHAMMER_OUTRO);
break;
case SPELL_TELEPORT:
case SPELL_THORIM_CREDIT:
if (DoCastSpellIfCan(m_creature, SPELL_TELEPORT) == CAST_OK)
m_creature->ForcedDespawn(2000);
// despawn Sif if not despawned by accident
if (Creature* pSif = m_pInstance->GetSingleCreatureFromStorage(NPC_SIF))
pSif->ForcedDespawn();
break;
}
}
示例2: DoDrainElders
// Function that will drain elders after aggro
void DoDrainElders()
{
if (!m_pInstance)
return;
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_BRIGHTLEAF))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, SPELL_DRAINED_OF_POWER, true);
pElder->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_IRONBRACH))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, SPELL_DRAINED_OF_POWER, true);
pElder->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_STONEBARK))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, SPELL_DRAINED_OF_POWER, true);
pElder->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
}
示例3: JustReachedHome
void JustReachedHome() override
{
if (m_pInstance)
{
m_pInstance->SetData(TYPE_FREYA, FAIL);
// reset elders
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_BRIGHTLEAF))
{
if (pElder->isAlive())
{
pElder->AI()->EnterEvadeMode();
pElder->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_IRONBRACH))
{
if (pElder->isAlive())
{
pElder->AI()->EnterEvadeMode();
pElder->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_STONEBARK))
{
if (pElder->isAlive())
{
pElder->AI()->EnterEvadeMode();
pElder->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
}
}
示例4: ReceiveAIEvent
void ReceiveAIEvent(AIEventType eventType, Unit* /*pSender*/, Unit* pInvoker, uint32 /*uiMiscValue*/) override
{
// inform about the harpoon repair event
if (eventType == AI_EVENT_CUSTOM_A)
{
DoMoveEngineersToHarpoon();
m_uiRepairHarpoonTimer = 20000;
}
// inform about a harpoon being shot
if (eventType == AI_EVENT_CUSTOM_B)
{
++m_uiHarpoonsUsed;
// start grounded phase
if (m_uiHarpoonsUsed == m_uiMaxHarpoons)
{
// use upgraded speed rate for FlyOrLand. This isn't supported by DB but it's confirmed to happen on retail
uint32 uiSpeedRate = m_creature->GetSpeedRate(MOVE_RUN);
m_creature->SetWalk(false);
m_creature->SetSpeedRate(MOVE_RUN, SPEED_RATE_RAZORSCALE);
m_creature->GetMotionMaster()->MoveFlyOrLand(1, afRazorscaleGroundPos[0], afRazorscaleGroundPos[1], afRazorscaleGroundPos[2], false);
m_creature->SetSpeedRate(MOVE_RUN, uiSpeedRate);
m_uiPhase = PHASE_TRANSITION;
m_uiShackleTimer = 5000;
// move the trappers around
float fX, fY, fZ;
uint8 uiIndex = 5;
if (m_pInstance)
{
if (Creature* pController = m_pInstance->GetSingleCreatureFromStorage(NPC_RAZORSCALE_CONTROLLER))
{
for (GuidList::const_iterator itr = m_lTrappersGuids.begin(); itr != m_lTrappersGuids.end(); ++itr)
{
if (Creature* pTrapper = m_creature->GetMap()->GetCreature(*itr))
{
pController->GetNearPoint(pController, fX, fY, fZ, 0, 50.0f, M_PI_F / 4 * uiIndex);
pTrapper->SetWalk(false);
uiSpeedRate = pTrapper->GetSpeedRate(MOVE_RUN);
pTrapper->SetSpeedRate(MOVE_RUN, SPEED_RATE_HELPERS);
pTrapper->GetMotionMaster()->MovePoint(1, fX, fY, fZ);
pTrapper->SetSpeedRate(MOVE_RUN, uiSpeedRate);
++uiIndex;
}
}
}
// yell that Razor is grounded
if (Creature* pCommander = m_pInstance->GetSingleCreatureFromStorage(NPC_EXPEDITION_COMMANDER))
DoScriptText(SAY_GROUNDED, pCommander);
}
}
}
}
示例5: FetchElders
// check for all elders alive
void FetchElders()
{
if (!m_pInstance)
return;
uint8 uiEldersAlive = 0;
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_BRIGHTLEAF))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, m_bIsRegularMode ? SPELL_BRIGHTLEAF_ESSENCE_CHANNEL : SPELL_BRIGHTLEAF_ESSENCE_CHANNEL_H, false, NULL, NULL, m_creature->GetObjectGuid());
pElder->CastSpell(pElder, SPELL_FULL_HEAL, true);
m_uiUnstableEnergyTimer = 25000;
++uiEldersAlive;
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_IRONBRACH))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, m_bIsRegularMode ? SPELL_IRONBRANCH_ESSENCE_CHANNEL : SPELL_IRONBRANCH_ESSENCE_CHANNEL_H, false, NULL, NULL, m_creature->GetObjectGuid());
pElder->CastSpell(pElder, SPELL_FULL_HEAL, true);
m_uiIronRootsTimer = 60000;
++uiEldersAlive;
}
}
if (Creature* pElder = m_pInstance->GetSingleCreatureFromStorage(NPC_ELDER_STONEBARK))
{
if (pElder->isAlive())
{
pElder->CastSpell(pElder, m_bIsRegularMode ? SPELL_STONEBARK_ESSEMCE_CHANNEL : SPELL_STONEBARK_ESSEMCE_CHANNEL_H, false, NULL, NULL, m_creature->GetObjectGuid());
pElder->CastSpell(pElder, SPELL_FULL_HEAL, true);
m_uiGroundTremorTimer = 10000;
++uiEldersAlive;
}
}
// store the info about the elders alive
m_pInstance->SetData(TYPE_FREYA_HARD, uiEldersAlive);
if (uiEldersAlive)
{
DoScriptText(SAY_AGGRO_HARD, m_creature);
m_uiDrainEldersTimer = 5000;
}
else
DoScriptText(SAY_AGGRO, m_creature);
}
示例6: GetRandomArenaPlayer
// function to return a random player from the arena
Unit* GetRandomArenaPlayer()
{
if (!m_pInstance)
return NULL;
Creature* pTrigger = m_pInstance->GetSingleCreatureFromStorage(NPC_THORIM_COMBAT_TRIGGER);
if (!pTrigger)
return NULL;
std::vector<Unit*> suitableTargets;
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
{
if (pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->IsWithinDistInMap(pTrigger, 50.0f) && pTarget->IsWithinLOSInMap(pTrigger))
suitableTargets.push_back(pTarget);
}
}
// if no player in the arena was found trigger berserk automatically
if (suitableTargets.empty())
{
m_uiBerserkTimer = 1000;
m_uiStormHammerTimer = 60000;
return NULL;
}
else
return suitableTargets[urand(0, suitableTargets.size() - 1)];
}
示例7: DamageTaken
void DamageTaken(Unit* pDoneBy, uint32& uiDamage) override
{
if (pDoneBy->GetEntry() == NPC_FREYA)
return;
if (uiDamage >= m_creature->GetHealth())
{
uiDamage = 0;
if (m_bIsFakeDeath)
return;
if (m_pInstance)
{
if (Creature* pFreya = m_pInstance->GetSingleCreatureFromStorage(NPC_FREYA))
SendAIEvent(AI_EVENT_CUSTOM_B, m_creature, pFreya);
}
DoCastSpellIfCan(m_creature, SPELL_CLEAR_DEBUFFS, CAST_TRIGGERED);
DoCastSpellIfCan(m_creature, SPELL_FEIGN_DEATH, CAST_TRIGGERED);
m_creature->SetHealth(1);
m_creature->ClearComboPointHolders();
m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->ClearAllReactives();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
DoScriptText(EMOTE_REGEN_ALLIES, m_creature);
m_bIsFakeDeath = true;
}
}
示例8: JustDidDialogueStep
void JustDidDialogueStep(int32 iEntry) override
{
if (!m_pInstance)
{
script_error_log("Instance Ulduar: ERROR Failed to load instance data for this instace.");
return;
}
switch (iEntry)
{
case NPC_EXPEDITION_ENGINEER:
{
if (Creature* pEngineer = GetClosestCreatureWithEntry(m_creature, NPC_EXPEDITION_ENGINEER, 15.0f))
DoScriptText(SAY_INTRO_1, pEngineer);
GuidList m_lDefenderGuids;
m_pInstance->GetDefenderGuids(m_lDefenderGuids);
// move the defenders into attack position
for (GuidList::const_iterator itr = m_lDefenderGuids.begin(); itr != m_lDefenderGuids.end(); ++itr)
{
if (Creature* pDefender = m_creature->GetMap()->GetCreature(*itr))
{
pDefender->CastSpell(pDefender, SPELL_THREAT, TRIGGERED_OLD_TRIGGERED);
pDefender->SetWalk(false);
pDefender->GetMotionMaster()->MoveWaypoint();
}
}
break;
}
case NPC_RAZORSCALE:
if (Creature* pRazorscale = m_pInstance->GetSingleCreatureFromStorage(NPC_RAZORSCALE))
{
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid))
pRazorscale->AI()->AttackStart(pPlayer);
}
break;
case NPC_EXPEDITION_DEFENDER:
if (Creature* pEngineer = GetClosestCreatureWithEntry(m_creature, NPC_EXPEDITION_ENGINEER, 15.0f))
DoScriptText(SAY_INTRO_3, pEngineer);
// inform Razorscale about the start of the harpoon event
if (Creature* pRazorscale = m_pInstance->GetSingleCreatureFromStorage(NPC_RAZORSCALE))
m_creature->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, pRazorscale);
break;
}
}
示例9: JustDied
void JustDied(Unit* /*pKiller*/) override
{
// notify XT that hard mode is enabled
if (m_pInstance)
{
if (Creature* pDeconstructor = m_pInstance->GetSingleCreatureFromStorage(NPC_XT002))
SendAIEvent(AI_EVENT_CUSTOM_B, m_creature, pDeconstructor);
}
}
示例10: JustSummoned
void JustSummoned(Creature* pSummoned) override
{
if (pSummoned->GetEntry() == NPC_RUBBLE && m_pInstance)
{
if (Creature* pKologarn = m_pInstance->GetSingleCreatureFromStorage(NPC_KOLOGARN))
SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, pKologarn);
pSummoned->SetInCombatWithZone();
}
}
示例11: JustSummoned
void JustSummoned(Creature* pSummoned) override
{
// handle spawned robots
if (m_pInstance)
{
if (Creature* pDeconstructor = m_pInstance->GetSingleCreatureFromStorage(NPC_XT002))
{
float fX, fY, fZ;
pDeconstructor->GetContactPoint(pSummoned, fX, fY, fZ, INTERACTION_DISTANCE);
pSummoned->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
}
}
}
示例12: SpellHit
void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) override
{
// hard mode is failed; despawn Sif
if (pSpell->Id == SPELL_TOUCH_OF_DOMINION_AURA && m_pInstance)
{
m_pInstance->SetData(TYPE_THORIM_HARD, FAIL);
if (Creature* pSif = m_pInstance->GetSingleCreatureFromStorage(NPC_SIF))
{
DoScriptText(SAY_SIF_DESPAWN, pSif);
pSif->ForcedDespawn(5000);
}
}
}
示例13: JustDied
void JustDied(Unit* /*pKiller*/) override
{
// On Flash Freeze death, the owner should attack Hodir
if (m_creature->GetEntry() == NPC_FLASH_FREEZE_NPC && m_creature->IsTemporarySummon() && m_pInstance)
{
if (Creature* pHodir = m_pInstance->GetSingleCreatureFromStorage(NPC_HODIR))
{
// ignore if event already completed
if (pHodir->getFaction() == FACTION_ID_FRIENDLY)
return;
if (Creature* pSummoner = m_creature->GetMap()->GetCreature(((TemporarySummon*)m_creature)->GetSummonerGuid()))
pSummoner->AI()->AttackStart(pHodir);
}
}
}
示例14: DamageTaken
void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) override
{
// switch to phase 2 as soon as it's hit by any damage
if (m_uiPhase == PHASE_ARENA && uiDamage > 0)
{
StartNextDialogueText(SAY_JUMP);
m_uiPhase = PHASE_TRANSITION;
// prepare the hard mode if necessary
if (m_pInstance && m_pInstance->GetData(TYPE_THORIM_HARD) != FAIL)
{
if (Creature* pSif = m_pInstance->GetSingleCreatureFromStorage(NPC_SIF))
pSif->InterruptNonMeleeSpells(false);
m_pInstance->SetData(TYPE_THORIM_HARD, DONE);
}
return;
}
// handle outro
if (uiDamage >= m_creature->GetHealth())
{
uiDamage = 0;
if (!m_bEventFinished)
{
if (m_pInstance)
{
m_pInstance->SetData(TYPE_THORIM, DONE);
// start a different outro version for hard mode
if (m_pInstance->GetData(TYPE_THORIM_HARD) == DONE)
StartNextDialogueText(SPELL_STORMHAMMER_OUTRO);
else
StartNextDialogueText(SAY_DEFEATED);
}
m_creature->CastSpell(m_creature, SPELL_THORIM_CREDIT, true);
m_creature->setFaction(FACTION_ID_FRIENDLY);
m_bEventFinished = true;
EnterEvadeMode();
}
}
}
示例15: MovementInform
void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
{
if (uiMotionType != EFFECT_MOTION_TYPE || !uiPointId)
return;
m_uiPhase = PHASE_SOLO;
m_uiAttackTimer = 1000;
m_uiChargeOrbTimer = 20000;
m_uiBerserkTimer = 5 * MINUTE * IN_MILLISECONDS;
m_creature->RemoveAurasDueToSpell(SPELL_SHEAT_OF_LIGHTNING);
// make Sif attack too if hard mode is active
if (m_pInstance && m_pInstance->GetData(TYPE_THORIM_HARD) == DONE)
{
if (Creature* pSif = m_pInstance->GetSingleCreatureFromStorage(NPC_SIF))
{
DoScriptText(SAY_SIF_EVENT, pSif);
SendAIEvent(AI_EVENT_CUSTOM_A, m_creature, pSif);
pSif->AI()->AttackStart(m_creature->getVictim());
}
}
}