void MoonScriptCreatureAI::StopWaypointMovement() { SetBehavior(Behavior_Default); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTIDLE); SetMoveType(Move_DontMoveWP); SetWaypointToMove(0); }
void MoonScriptCreatureAI::ForceWaypointMove(uint32 pWaypointId) { if (GetCanEnterCombat()) _unit->GetAIInterface()->SetAllowedToEnterCombat(false); if (!GetCanMove()) SetCanMove(true); StopMovement(); _unit->GetAIInterface()->SetAIState(STATE_SCRIPTMOVE); SetMoveType(Move_WantedWP); SetWaypointToMove(pWaypointId); }
void OnReachWP(uint32 iWaypointId, bool /*bForwards*/) override { switch (iWaypointId) { case 1: { SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_WANTEDWP); SetWaypointToMove(2); for (const auto& itr : getCreature()->getInRangeObjectsSet()) { if (itr && itr->isPlayer()) { Player* pPlayer = static_cast<Player*>(itr); if (pPlayer != nullptr) { QuestLogEntry* pQuest = pPlayer->GetQuestLogForEntry(10097); if (pQuest != nullptr && pQuest->GetMobCount(1) < 1) { pQuest->SetMobCount(1, 1); pQuest->SendUpdateAddKill(1); pQuest->UpdatePlayerFields(); } } } } } break; case 3: { despawn(100, 0); } break; default: { SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_WANTEDWP); SetWaypointToMove(1); } } }
void OnReachWP(uint32 iWaypointId, bool /*bForwards*/) override { switch (iWaypointId) { case 1: getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Reached wp 1!"); SetWaypointToMove(2); break; case 2: { if (m_isIntroMob) { getCreature()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Reached wp 2!"); getCreature()->Despawn(500, 0); } else { // TODO: Door attack code } }break; } }
void OnCombatStop(Unit* pTarget) { ParentClass::OnCombatStop(pTarget); SetWaypointToMove(m_currentWp); }