void UpdateAI(const uint32 diff) { if(!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) { m_creature->SetVisibility(VISIBILITY_OFF); m_creature->setDeathState(JUST_DIED); return; } if(!isHatching) { if(WaitTimer) { m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MovePoint(0,hatcherway[side][waypoint][0],hatcherway[side][waypoint][1],hatcherway[side][waypoint][2]); waypoint++; WaitTimer = 0; } } else { if(WaitTimer < diff) { if(HatchEggs(HatchNum)) { HatchNum++; WaitTimer = 10000; } else if(!hasChangedSide) { side = side ? 0 : 1; isHatching = false; waypoint = 3; WaitTimer = 1; hasChangedSide = true; } else { m_creature->SetVisibility(VISIBILITY_OFF); m_creature->setDeathState(JUST_DIED); } }else WaitTimer -= diff; } }
void UpdateAI(const uint32 diff) { if (!pInstance || !(pInstance->GetData(DATA_JANALAIEVENT) == IN_PROGRESS)) { me->DisappearAndDie(); return; } if (!isHatching) { if (WaitTimer) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0,hatcherway[side][waypoint][0],hatcherway[side][waypoint][1],hatcherway[side][waypoint][2]); ++waypoint; WaitTimer = 0; } } else { if (WaitTimer <= diff) { if (HatchEggs(HatchNum)) { ++HatchNum; WaitTimer = 10000; } else if (!hasChangedSide) { side = side ? 0 : 1; isHatching = false; waypoint = 3; WaitTimer = 1; hasChangedSide = true; } else me->DisappearAndDie(); } else WaitTimer -= diff; } }