void SmartAI::CorpseRemoved(uint32& respawnDelay) { GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, NULL, respawnDelay); // xinef: end escort upon corpse remove, safe check in case of immediate despawn if (IsEscorted()) EndPath(true); }
void UpdateEscortAI(const uint32 diff) { if (IsEscorted()) { events.Update(diff); while (uint32 event = events.ExecuteEvent()) { switch (event) { case EVENT_SPEECH_DISGUISE: DoScriptText(SAY_HIGH_ABBOT_DISGUISE_FAILED, me); events.ScheduleEvent(EVENT_SPEECH_MASTER, 5000); break; case EVENT_SPEECH_MASTER: DoScriptText(SAY_HIGH_ABBOT_THE_MASTER, me); events.ScheduleEvent(EVENT_SPEECH_NOT_YOU, 5000); break; case EVENT_SPEECH_NOT_YOU: DoScriptText(SAY_HIGH_ABBOT_NOT_DIE_BY_YOUR_HAND, me); events.ScheduleEvent(EVENT_SPEECH_CHOOSING, 5000); break; case EVENT_SPEECH_CHOOSING: DoScriptText(SAY_HIGH_ABBOT_MY_CHOOSING, me); events.ScheduleEvent(EVENT_JUMP_OFF_CLIFF_PT1, 5000); break; case EVENT_JUMP_OFF_CLIFF_PT1: if (Player* player = GetPlayerForEscort()) { player->KilledMonsterCredit(NPC_HIGH_ABBOT_KILL_BUNNY, 0); } me->GetMotionMaster()->MoveJump(dummyTarget.GetPositionX(), dummyTarget.GetPositionY(), dummyTarget.GetPositionZ(), 10.0f, 10.0f); events.ScheduleEvent(EVENT_JUMP_OFF_CLIFF_PT2, 200); break; case EVENT_JUMP_OFF_CLIFF_PT2: DoScriptText(SAY_HIGH_ABBOT_SCREAMING_JUMP, me); me->GetMotionMaster()->MoveJump(jumpTarget.GetPositionX(), jumpTarget.GetPositionY(), jumpTarget.GetPositionZ(), 30.0f, 30.0f); events.ScheduleEvent(EVENT_DIE, 10000); break; case EVENT_DIE: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_GOSSIP); me->DespawnOrUnsummon(); break; } } } else { if (!UpdateVictim()) return; DoMeleeAttackIfReady(); } }
void EnterCombat(Unit* who) { if (IsEscorted()) { // Note: Since we cannot enter combat while being friendly to all in a regular way, we prefer evasion over irregular behavior. EnterEvadeMode(); } else { // If we're not friendly (i.e. not being escorted), get this handled by the base class. npc_escortAI::EnterCombat(who); } }
void DamageTaken(Unit* /*attacker*/, uint32& damage) { if(IsEscorted()) damage = 0; }