本文整理汇总了C++中CAST_CRE函数的典型用法代码示例。如果您正苦于以下问题:C++ CAST_CRE函数的具体用法?C++ CAST_CRE怎么用?C++ CAST_CRE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CAST_CRE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JustDied
void JustDied(Unit* /*Killer*/)
{
Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID);
Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
DoScriptText(YELL_DIE_L, pLeftHead);
CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell();
if (instance)
instance->SetData(TYPE_OMROGG, DONE);
}
示例2: JustDied
void JustDied(Unit* /*killer*/)
{
Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID);
Creature* pRightHead = Creature::GetCreature(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
pLeftHead->AI()->Talk(YELL_DIE_L);
CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell();
if (instance)
instance->SetData(TYPE_OMROGG, DONE);
}
示例3: MoveInLineOfSight
void MoveInLineOfSight(Unit* who)
{
ScriptedAI::MoveInLineOfSight(who);
if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f))
{
if (Unit* owner = who->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
{
if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE)
CAST_CRE(who)->CastSpell(owner, 52517, true);
//Todo: Creatures must not be removed, but, must instead
// stand next to Gothik and be commanded into the pit
// and dig into the ground.
CAST_CRE(who)->DespawnOrUnsummon();
if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
owner->RemoveAllMinionsByEntry(GHOULS);
}
}
}
}
示例4: PassengerBoarded
void PassengerBoarded(Unit* who, int8 seatId, bool apply)
{
if (!me->GetVehicle())
return;
if (seatId == SEAT_PLAYER)
{
if (!apply)
return;
else
DoScriptText(SAY_PLAYER_RIDING,me);
if (Creature* pTurret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET)))
{
pTurret->setFaction(me->GetVehicleBase()->getFaction());
pTurret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable
pTurret->AI()->AttackStart(who);
}
if (Unit* pDevice = CAST_CRE(vehicle->GetPassenger(SEAT_DEVICE)))
{
pDevice->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
pDevice->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
//else //throw passenger bugged, when fixed uncomment this part.
// if (seatId == SEAT_TURRET)
// {
// if (apply)
// return;
// if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE))
// {
// device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
// device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable
// }
// }
}
示例5: PassengerBoarded
void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply)
{
if (who->GetTypeId() == TYPEID_UNIT)
{
if (who->GetEntry() == 32933)
left = apply;
else if (who->GetEntry() == 32934)
right = apply;
if (!apply && instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT);
who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
CAST_CRE(who)->SetReactState(REACT_PASSIVE);
}
}
示例6: JustDied
void JustDied(Unit* pKiller)
{
if (pKiller->GetTypeId() == TYPEID_PLAYER)
{
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, CAST_PLR(pKiller));
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, CAST_PLR(pKiller));
}
for (uint8 i = 0; i < 2; ++i)
DoCast(pKiller, SPELL_JORMUNGAR_SPAWN, true);
if (m_creature->isSummon())
if (Creature* pSummoner = CAST_CRE(CAST_SUM(m_creature)->GetSummoner()))
if (npc_gurgthockAI* pAI = CAST_AI(npc_gurgthockAI,pSummoner->AI()))
pAI->bEventInProgress = false;
}
示例7: MovementInform
void MovementInform(uint32 uiType, uint32 /*uiId*/)
{
if (uiType != POINT_MOTION_TYPE)
return;
if (me->isSummon())
{
if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner()))
{
if (npc_lord_gregor_lescovarAI* pAI = CAST_AI(npc_lord_gregor_lescovarAI,pSummoner->AI()))
{
pAI->uiTimer = 2000;
pAI->uiPhase = 5;
}
//me->ChangeOrient(0.0f, pSummoner);
}
}
}
示例8: JustDied
void JustDied(Unit* /*Killer*/)
{
if (LeftHead && RightHead)
{
Unit* Left = Unit::GetUnit(*me,LeftHead);
Unit* Right = Unit::GetUnit(*me,RightHead);
if (!Left || !Right)
return;
DoScriptText(YELL_DIE_L, Left);
((mob_omrogg_headsAI*)CAST_CRE(Right)->AI())->DoDeathYell();
}
if (pInstance)
pInstance->SetData(TYPE_WARBRINGER, DONE);
}
示例9: EnterCombat
void EnterCombat(Unit* /*who*/) {
if (pInstance)
pInstance->SetData(DATA_HEXLORDEVENT, IN_PROGRESS);
DoZoneInCombat();
me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(me, SOUND_YELL_AGGRO);
for (uint8 i = 0; i < 4; ++i) {
Unit* Temp = Unit::GetUnit((*me), AddGUID[i]);
if (Temp && Temp->isAlive())
CAST_CRE(Temp)->AI()->AttackStart(me->getVictim());
else {
EnterEvadeMode();
break;
}
}
}
示例10: Reset
void Reset()
{
if (instance)
{
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* unit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* unit = Unit::GetUnit(*me, *itr);
if (unit)
{
if (!unit->isAlive())
CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc.
// Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here.
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true);
// Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
// Small door opened after event are expected to be closed by default
// Set Inst data for encounter
instance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
}
else sLog->outError(ERROR_INST_DATA);
DrainLifeTimer = urand(3000, 7000);
DrainManaTimer = DrainLifeTimer + 5000;
FelExplosionTimer = 2100;
if (IsHeroic())
DrainCrystalTimer = urand(10000, 15000);
else
DrainCrystalTimer = urand(20000, 25000);
EmpowerTimer = 10000;
IsDraining = false;
DrainingCrystal = false;
CrystalGUID = 0;
}
示例11: MoveInLineOfSight
void MoveInLineOfSight(Unit *who)
{
ScriptedAI::MoveInLineOfSight(who);
if (who->GetEntry() == NPC_DRAKOS && me->IsWithinDistInMap(who, 10.0f))
{
if (Unit *owner = who->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER)
{
if ((CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS1) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS2) == QUEST_STATUS_INCOMPLETE))
{
CAST_PLR(owner)->KilledMonsterCredit(NPC_DRAKOS, me->GetGUID());
}
CAST_CRE(who)->ForcedDespawn();
if ((CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS1) == QUEST_STATUS_COMPLETE) && (CAST_PLR(owner)->GetQuestStatus(QUEST_DRAKOS2) == QUEST_STATUS_INCOMPLETE))
owner->RemoveAllMinionsByEntry(NPC_DRAKOS);
}
}
}
}
示例12: Reset
void Reset()
{
if (pInstance)
{
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*me, *itr);
if (pUnit)
{
if (!pUnit->isAlive())
CAST_CRE(pUnit)->Respawn(); // Let MaNGOS handle setting death state, etc.
// Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here.
pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
GameObject* Door = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR));
if (Door)
Door->SetGoState(GO_STATE_ACTIVE); // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
// Small door opened after event are expected to be closed by default
// Set Inst data for encounter
if (me->isDead())
pInstance->SetData(DATA_SELIN_EVENT, DONE);
else pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
} else error_log(ERROR_INST_DATA);
DrainLifeTimer = 3000 + rand()%4000;
DrainManaTimer = DrainLifeTimer + 5000;
FelExplosionTimer = 2100;
DrainCrystalTimer = 10000 + rand()%5000;
DrainCrystalTimer = 20000 + rand()%5000;
CheckTimer = 1000;
IsDraining = false;
DrainingCrystal = false;
CrystalGUID = 0;
}
示例13: ItemUse_item_yehkinyas_bramble
bool ItemUse_item_yehkinyas_bramble(Player* player, Item* _Item, SpellCastTargets const& targets)
{
if (player->GetQuestStatus(3520) == QUEST_STATUS_INCOMPLETE)
{
Unit* unit_target = targets.getUnitTarget();
if (unit_target &&
unit_target->GetTypeId() == TYPEID_UNIT &&
unit_target->isDead() &&
// cast only on corpse 5307 or 5308
(unit_target->GetEntry() == 5307 || unit_target->GetEntry() == 5308))
{
CAST_CRE(unit_target)->RemoveCorpse(); // remove corpse for cancelling second use
return false; // all ok
}
}
WorldPacket data(SMSG_CAST_FAILED, (4 + 2)); // prepare packet error message
data << uint32(10699); // itemId
data << uint8(SPELL_FAILED_BAD_TARGETS); // reason
player->GetSession()->SendPacket(&data); // send message: Bad target
player->SendEquipError(EQUIP_ERR_NONE, _Item, NULL); // break spell
return true;
}
示例14: Reset
void Reset()
{
Enraged = false;
if (pInstance)
{
Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH));
if (Temp)
{
if (Temp->isDead())
{
CAST_CRE(Temp)->Respawn();
} else
{
if (Temp->getVictim())
{
me->getThreatManager().addThreat(Temp->getVictim(),0.0f);
}
}
}
}
if (!me->isInCombat())
{
ConflagrationTimer = 45000;
BlazeTimer = 100;
PyrogenicsTimer = 15000;
ShadownovaTimer = 40000;
EnrageTimer = 360000;
FlamesearTimer = 15000;
IntroYellTimer = 10000;
SisterDeath = false;
}
if (pInstance)
pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED);
}
示例15: Reset
void Reset()
{
InCombat = false;
Enraged = false;
if(pInstance)
{
Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS));
if (Temp)
if (Temp->isDead())
{
CAST_CRE(Temp)->Respawn();
}else
{
if(Temp->getVictim())
{
me->getThreatManager().addThreat(Temp->getVictim(),0.0f);
InCombat = true;
}
}
}
if(!InCombat)
{
ShadowbladesTimer = 10000;
ShadownovaTimer = 30000;
ConfoundingblowTimer = 25000;
ShadowimageTimer = 20000;
ConflagrationTimer = 30000;
EnrageTimer = 360000;
SisterDeath = false;
}
if(pInstance)
pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED);
}