Пример #1
0
int
UPNPCheckDlg::run()
{

	static const string description = getFlylinkDCAppCaption();
	// description += "Transfer port ";
	
	if (!_needUPNP)
	{
		setStage(STRING(UPNPCHECKDLG_PORT_CHECK));//  "Checkning Ports..."
		success(CheckPorts(_isTCPOk, _isUDPOk));
		return 1;
	}
	try
	{
		setStage(STRING(UPNPCHECKDLG_MINI_INIT));//  "Checkning MiniUPNP..."
		string url;
		string service;
		if (MiniUPnPc_init(url, service, m_device))
		{
			setStage(STRING(UPNPCHECKDLG_MINI_OPEN));// "Open ports in MiniUPNP..."
			// Open Ports
			bool isSuccess = false;
			bool portTestResult = false;
			string tcpDesc = description + "Transfer port (" + Util::toString(_tcp) + " TCP)";
			if (MiniUPnPc_add(_tcp, "TCP", tcpDesc, service, url))
			{
				string udpDesc = description + "Search port (" + Util::toString(_udp) + " UDP)";
				if (MiniUPnPc_add(_udp, "UDP", udpDesc, service, url))
				{
					if (_needPortCheck)
					{
						_isTCPOk = false;
						_isUDPOk = false;
						portTestResult = CheckPorts(_isTCPOk, _isUDPOk);
					}
					isSuccess = true;
					MiniUPnPc_remove(_udp, "UDP", service, url);
				}
				MiniUPnPc_remove(_tcp, "TCP", service, url);
				if (isSuccess)
				{
					success(portTestResult);
					return 1;
				}
			}
		}
	}
	catch (const Exception& /*e*/) {}
	
	try
	{
		setStage(STRING(UPNPCHECKDLG_WIN_INIT)); //"Checkning WinUPNP..."
		IUPnPNAT* pUN = NULL;
		bool isSuccess = false;
		bool portTestResult = false;
		if (WinUPnP_init(pUN))
		{
			setStage(STRING(UPNPCHECKDLG_WIN_OPEN));// "Open ports in WinUPNP..."
			if (WinUPnP_add(_tcp, "TCP", description, pUN))
			{
				if (WinUPnP_add(_udp, "UDP", description, pUN))
				{
					if (_needPortCheck)
					{
						_isTCPOk = false;
						_isUDPOk = false;
						portTestResult = CheckPorts(_isTCPOk, _isUDPOk);
					}
					isSuccess = true;
					WinUPnP_remove(_udp, "UDP", pUN);
				}
				WinUPnP_remove(_tcp, "TCP", pUN);
			}
			WinUPnP_uninit();
			if (isSuccess)
			{
				success(false);
				return 1;
			}
		}
	}
	catch (const Exception& /*e*/) {}
	
	if (_needPortCheck)
	{
		setStage(STRING(UPNPCHECKDLG_PORT_CHECK));//  "Checkning Ports..."
		CheckPorts(_isTCPOk, _isUDPOk);
	}
	
	failed();
	return 0;
}
Пример #2
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance) return;

        if (!inCombat && !m_creature->IsNonMeleeSpellCasted(false))
        {
            if (Creature *pDummyTarget = pInstance->GetSingleCreatureFromStorage(NPC_BALTHARUS_TARGET))
                timedCast(SPELL_CHANNEL_SPELL, uiDiff, pDummyTarget);
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0:
                 if ( m_creature->GetHealthPercent() <= 66.0f) setStage(1);
                 break;

            case 1:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                   //  DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(2);
                 break;

            case 2:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(3);

            case 3:
                 if ( m_creature->GetHealthPercent() <= 50.0f) setStage(4);
                 break;

            case 4:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (!is25())
                        doCast(SPELL_SUMMON_CLONE);
                        DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(5);
                 break;

            case 5:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(6);

            case 6:
                 if ( m_creature->GetHealthPercent() <= 33.0f) setStage(7);
                 break;

            case 7:
                 m_creature->InterruptNonMeleeSpells(true);
                 if (is25())
                     doCast(SPELL_SUMMON_CLONE);
                  //   DoScriptText(SAY_BALTHARUS_SPECIAL_1,m_creature);
                 setStage(8);
                 break;

            case 8:
                 if (m_creature->IsNonMeleeSpellCasted(false)) return;
                 doCast(SPELL_REPELLING_WAVE);
                 setStage(9);

            case 9:
            default:
                 break;
        }

        timedCast(SPELL_BLADE_TEMPEST, uiDiff);
        timedCast(SPELL_ENERVATING_BRAND, uiDiff);
        timedCast(SPELL_SABER_LASH, uiDiff);

        DoMeleeAttackIfReady();
    }
Пример #3
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!pInstance)
            return;

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0: //PHASE 1 PHYSICAL REALM
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                if (m_creature->GetHealthPercent() < 75.0f) setStage(1);
                break;

            case 1: // Switch to phase 2
                m_creature->AttackStop();
                m_creature->InterruptNonMeleeSpells(true);
                DoScriptText(SAY_HALION_PHASE_2,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, NOT_STARTED);
                SetCombatMovement(false);
                StartMovement(0);
                {
                    Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL);
                    if (!pControl)
                        pControl = m_creature->SummonCreature(NPC_HALION_CONTROL, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pControl->isAlive())
                        pControl->Respawn();
                    pControl->SetActiveObjectState(true);
                    pControl->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    m_creature->SetInCombatWith(pControl);
                    pControl->SetInCombatWith(m_creature);
                }
                setStage(2);
                break;

            case 2:
                if (MovementStarted) return;
                doCast(SPELL_SUMMON_TWILIGHT_PORTAL);
                setStage(3);
                if (GameObject* pGoPortal = pInstance->GetSingleGameObjectFromStorage(GO_HALION_PORTAL_1))
                      pGoPortal->SetPhaseMask(31,true);
                if (GameObject* pGoRing = pInstance->GetSingleGameObjectFromStorage(GO_FLAME_RING))
                      pGoRing->SetPhaseMask(65535,true);
                break;

            case 3:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                m_creature->SetActiveObjectState(true);
                doCast(SPELL_START_PHASE2);
                setStage(4);
                break;

            case 4:
                if (!m_creature->IsNonMeleeSpellCasted(false))
                {
                    if (Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL))
                    {
                        m_creature->SetInCombatWith(pControl);
                        pControl->SetInCombatWith(m_creature);
                    }
                    Creature* pTwilight = pInstance->GetSingleCreatureFromStorage(NPC_HALION_TWILIGHT);
                    if (!pTwilight)
                        pTwilight = m_creature->SummonCreature(NPC_HALION_TWILIGHT, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 1000);
                    else if (!pTwilight->isAlive())
                        pTwilight->Respawn();
                    pTwilight->SetCreatorGuid(ObjectGuid());
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    setStage(5);
                }
                break;

            case 5: // HALION awaiting end battle in TWILIGHT REALM
                if (pInstance->GetData(TYPE_HALION_EVENT) == IN_PROGRESS)
                    {
//                        pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                        doRemove(SPELL_START_PHASE2);
                        if (Creature* pControl = pInstance->GetSingleCreatureFromStorage(NPC_HALION_CONTROL))
                        {
                            m_creature->SetInCombatWith(pControl);
                            pControl->SetInCombatWith(m_creature);
                        }
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        m_creature->SetHealth(m_creature->GetMaxHealth()/2);
                        m_creature->SetInCombatWithZone();
                        setStage(6);
                    }
                return;

            case 6: // Switch to phase 3
//                doCast(SPELL_TWILIGHT_DIVISION);
                DoScriptText(SAY_HALION_PHASE_3,m_creature);
                pInstance->SetData(TYPE_HALION_EVENT, SPECIAL);
                setStage(7);
                break;

            case 7:
                if (m_creature->IsNonMeleeSpellCasted(false)) return;
                if (m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return;
                SetCombatMovement(true);
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                setStage(8);
                break;

            case 8: //PHASE 3 BOTH REALMS
                timedCast(SPELL_FLAME_BREATH, uiDiff);
                timedCast(SPELL_FIERY_COMBUSTION, uiDiff);
                timedCast(SPELL_METEOR, uiDiff);
                break;

            default:
                break;
        }

        timedCast(SPELL_BERSERK, uiDiff);

        DoMeleeAttackIfReady();

    }
Пример #4
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            switch (getStage())
            {
                case 0: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
						 if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
							DoCast(SPELL_FLAME_BREATH_25);
						 else DoCast(SPELL_FLAME_BREATH_10);
                         m_uiFlameBreathTimer = urand(12*IN_MILLISECONDS,13*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(17*IN_MILLISECONDS,20*IN_MILLISECONDS);
                         DoScriptText(-1666404,me);
                     } else m_uiEnrage -= diff;

					 if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         setStage(1);
                         m_uiBeakonTimer = urand(30*IN_MILLISECONDS,31*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     break;

                case 1: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(2);
                     break;

                case 2: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666403,me);
                     setStage(3);
                     break;

                case 3: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(4);
                     }
                     break;

                case 4: // Air phase
                    // if (m_uiConflagrateTimer <= diff)
                    // {
                        // if (conflagated)
                       //  { 
                             //DoCast(SPELL_CONFLAGATION_1);
                             doBeacon(false);
                       //  }
						 setStage(5);
                     //    m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                   //  } else m_uiConflagrateTimer -= diff;
                     break;

                case 5: //Air phase end
                     StartMovement(0);
                     setStage(6);
                     break;

                case 6: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
					 for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
					 {
						 Unit *pTemp = (*itr);
						 me->CastSpell(pTemp, SPELL_CONFLAGATION_2, true);
					 }
					// DoCast(SPELL_CONFLAGATION_2);
					 playerList.clear();
					 setStage(0);
                     break;

                default:
                    break;
            }

            DoMeleeAttackIfReady();
        }
Пример #5
0
LCDbWorkEntry::LCDbWorkEntry( const LQuery & central )
 : LDbIdBase( central.readInt( "record_no" ) ),
   LDbWorkEntry( central.readString( "barcode" ),
				 central.readInt( "project_cid" ),
				 central.readInt( "sample_id" ),
				 central.readDateTime( "in_date" ),
				 central.readInt( "test_cid" ) ),
   groupID( central.readInt( "group_id" ) ),
   profileName( central.readString( "profile_name" ) )
{
	const LPDbProfile * pp = NULL;
	const LPDbProfiles & profiles = LPDbProfiles::records( getProjectID() );
	if( !profiles.empty() )
	{
		if( central.fieldExists( "profile_id" ) )
		{
			int ppid = central.readInt( "profile_id" );
			if( ppid != 0 )
				pp = profiles.findByID( ppid );
		}
		
		if( pp == NULL && profileName.Length() > 2 )
			pp = profiles.findByName( profileName );
	}
	setProfileID( pp == NULL ? 0 : pp -> getID() );

	limits.setAnalyserID( central.readInt( "machine_cid" ) );
	limits.setPrivate( central.readChar( "private_result" ) == 'Y' );

	if( central.fieldExists( "min_value" ) && central.fieldExists( "max_value" ) )
	{
		limits.setRange( central.readDouble( "min_value" ),
						 central.readDouble( "max_value" ) );
	}

	if( central.fieldExists( "lower_warning" ) && central.fieldExists( "upper_warning" ) )
	{
		limits.setWarnLevels( central.readDouble( "lower_warning" ),
							  central.readDouble( "upper_warning" ) );
	}

	int trigger = central.readInt( "trigger_id" );
	if( trigger != 0 && central.fieldExists( "lower_trigger_limit" )
					 && central.fieldExists( "upper_trigger_limit" ) )
	{
		limits.setTriggerLimits( trigger,
							central.readDouble( "lower_trigger_limit" ),
							central.readDouble( "upper_trigger_limit" ) );
	}

	setTimeStamp( central.readDateTime( "time_stamp" ) );
	setCategoryID( central.readInt( "category_id" ) );

	if( central.fieldExists( "buddy_result_id" ) )
		setDilution( central.readDouble( "buddy_result_id" ) );
	else
		setDilution( 0 );

	if( central.fieldExists( "diluent" ) )
		setDilution( central.readDouble( "diluent" ) );
	else
		setDilution( 0 );

	switch( central.readChar( "buddy_read" ) )
	{
		case LCDbWorkEntry::COPIED:
			copied = true;
			setStage( makeStage( central.readChar( "status" ) ) );
			break;

		case LCDbWorkEntry::HELD:
			copied = true;
			setStage( LDbStage::L0_HELD );
			break;

		case LCDbWorkEntry::FINISHED:
			copied = true;
			setStage( LDbStage::TRANSMITTED );
			break;

		default:
			copied = false;
			setStage( makeStage( central.readChar( "status" ) ) );
	}
}
Пример #6
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (getStage())
        {
            case 0: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 80.0f) setStage(1);
                 break;

            case 1: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(2);
                 break;

            case 2: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(SAY_SPECIAL,m_creature);
                 setStage(3);
                 break;

            case 3: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(4);
                 };
                 break;

            case 4: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 60.0f) setStage(5);
                 break;

            case 5: //Air phase end
                 StartMovement(0);
                 setStage(6);
                 break;

            case 6: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(7);
                 break;

            case 7: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff);
                 if ( m_creature->GetHealthPercent() <= 40.0f) setStage(8);
                 break;

            case 8: //Air phase start
                 SetCombatMovement(false);
                 m_creature->InterruptNonMeleeSpells(true);
                 SetFly(true);
                 doBeacon(true);
                 StartMovement(1);
                 setStage(9);
                 break;

            case 9: // Wait for movement
                 if (MovementStarted) return;
                 doCast(SPELL_CONFLAGATION);
                 DoScriptText(SAY_SPECIAL,m_creature);
                 setStage(10);
                 break;

            case 10: // Wait for cast finish
                 if (!m_creature->IsNonMeleeSpellCasted(false))
                 {
                     doBeacon(false);
                     setStage(11);
                 };
                 break;

            case 11: // Air phase
                 timedCast(SPELL_FLAME_BREATH, diff);
                 if (timedQuery(SPELL_BEACON, diff))
                     {
                         doBeacon(true);
                         doCast(SPELL_CONFLAGATION);
                     };
                 if (conflagated && timedQuery(SPELL_CONFLAGATION_1, diff))
                     {
                         doBeacon(false);
                     };
                 if ( m_creature->GetHealthPercent() <= 20.0f) setStage(12);
                 break;

            case 12: //Air phase end
                 StartMovement(0);
                 setStage(13);
                 break;

            case 13: // Wait for movement
                 if (MovementStarted) return;
                 SetFly(false);
                 SetCombatMovement(true);
                 m_creature->GetMotionMaster()->Clear();
                 m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                 setStage(14);
                 break;

            case 14: //GROUND
                 timedCast(SPELL_FLAME_BREATH, diff);
                 timedCast(SPELL_ENRAGE, diff*2);
                 break;

            default:
                break;
        }

        DoMeleeAttackIfReady();
    }
Пример #7
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch(getStage())
        {
            case 0: 
                    if (timedQuery(SPELL_BONE_STRIKE, diff))
                        if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f, isHeroic()))
                            if (doCast(SPELL_BONE_STRIKE, pTarget) == CAST_OK)
                            {
                                doSummonSpike(pTarget);
                                switch (urand(0,1)) {
                                                   case 0:
                                                   DoScriptText(-1631003,m_creature,pTarget);
                                                   break;
                                                   case 1:
                                                   DoScriptText(-1631004,m_creature,pTarget);
                                                   break;
                                                   case 2:
                                                   DoScriptText(-1631005,m_creature,pTarget);
                                                   break;
                                                   };

                            };

                    if (timedQuery(SPELL_BONE_STORM, diff)) setStage(1);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff))
                    {
                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                            else  doCast(SPELL_CALL_COLD_FLAME_1);

                        if (m_creature->GetHealthPercent() <= 30.0f)
                        {
                            if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
                                else  doCast(SPELL_CALL_COLD_FLAME_1);
                        }
                    }

                    timedCast(SPELL_SABER_LASH, diff);

                    DoMeleeAttackIfReady();

                    break;
            case 1:
                    m_creature->InterruptNonMeleeSpells(true);
                    doCast(SPELL_BONE_STORM);
                    setStage(2);
                    DoScriptText(-1631002,m_creature);
                    DoResetThreat();
                    m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
                    m_creature->SetSpeedRate(MOVE_RUN, 3);
                    m_creature->SetSpeedRate(MOVE_WALK, 3);
                    break;
            case 2:
                    if (!m_creature->IsNonMeleeSpellCasted(false)) setStage(3);
                    break;
            case 3:
                    if (isHeroic())
                        if (timedQuery(SPELL_BONE_STRIKE, diff, true))
                            if (Unit* pTarget = doSelectRandomPlayer(SPELL_BONE_STRIKE_IMPALE, false, 60.0f))
                                doSummonSpike(pTarget);

                    if (timedQuery(SPELL_CALL_COLD_FLAME, diff, true)
                        && m_creature->IsWithinDistInMap(m_creature->getVictim(),2.0f))
                    {
                        pInstance->SetData(DATA_DIRECTION, (uint32)(1000*2.0f*M_PI_F*((float)urand(1,16)/16.0f)));
//                        if (urand(0,1)) doCast(SPELL_CALL_COLD_FLAME);
//                            else  doCast(SPELL_CALL_COLD_FLAME_1);
                        float fPosX, fPosY, fPosZ;
                        m_creature->GetPosition(fPosX, fPosY, fPosZ);
                        doSummon(NPC_COLD_FLAME, fPosX, fPosY, fPosZ);
                        DoResetThreat();
                        if (Unit* pTarget = doSelectRandomPlayerAtRange(60.0f))
                            AttackStart(pTarget);
                    }
                    if (!hasAura(SPELL_BONE_STORM_STRIKE, m_creature) && !hasAura(SPELL_BONE_STORM, m_creature)) setStage(4);
                    break;
            case 4:
                    pInstance->SetData(DATA_DIRECTION, 0);
                    m_creature->SetSpeedRate(MOVE_RUN, 1);
                    m_creature->SetSpeedRate(MOVE_WALK, 1);
//                    m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);
                    setStage(0);
                    break;
            default:
                    break;
            }

        if (timedQuery(SPELL_BERSERK, diff))
            {
                doCast(SPELL_BERSERK);
                DoScriptText(-1631008,m_creature);
            }


    }
Пример #8
0
    void UpdateAI(const uint32 diff)
    {

        if(!pInstance) return;

        if (!pet) 
        {
            if (Creature* pGuard = pInstance->GetSingleCreatureFromStorage(NPC_STINKY))
                if (!pGuard->isAlive())
                {
                     pet = true;
                     if (pInstance->GetData(TYPE_STINKY) == NOT_STARTED)
                     {
                         DoScriptText(-1631209,m_creature);
                         pInstance->SetData(TYPE_STINKY,DONE);
                     }
                }
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        Creature* pBlightTarget = m_creature->GetMap()->GetCreature(blightTargetGUID);

        switch(getStage())
        {
            case 0:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_2, diff))
                        setStage(1);
                    break;
            case 1:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(2);
                    break;
            case 2:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_1);
                        doRemove(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_1,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(3);
                    break;
            case 3:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(4);
                    break;
            case 4:
                    switch (urand(0,2))
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(5);
                    break;
            case 5:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_2);
                        doRemove(SPELL_BLIGHT_VISUAL_2,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_2,m_creature);
                        doCast(SPELL_GASEOUS_BLIGHT_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(6);
                    break;
            case 6:
                    if (timedQuery(SPELL_GASEOUS_BLIGHT_3, diff))
                        setStage(7);
                    break;
            case 7:
                    switch (urand(0,2)) 
                    {
                        case 0:  DoScriptText(-1631210,m_creature); break;
                        case 1:  DoScriptText(-1631211,m_creature); break;
                        case 2:  DoScriptText(-1631212,m_creature); break;
                    }
                    doCast(SPELL_INHALE_BLIGHT);
                    setStage(8);
                    break;
            case 8:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doRemove(SPELL_GASEOUS_BLIGHT_3);
                        doRemove(SPELL_BLIGHT_VISUAL_3,pBlightTarget);
                        doRemove(SPELL_BLIGHT_VISUAL_3,m_creature);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    setStage(9);
                    break;
            case 9:
                    if (timedQuery(SPELL_PUNGENT_BLIGHT, diff))
                    {
                        DoScriptText(-1631208,m_creature);
                        doCast(SPELL_PUNGENT_BLIGHT);
                        setStage(10);
                    }
                    break;
            case 10:
                    if (m_creature->IsNonMeleeSpellCasted(false)) return;
                    if (pBlightTarget)
                    {
                        doCast(SPELL_BLIGHT_VISUAL_1,pBlightTarget);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_3);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_2);
                        doRemoveFromAll(SPELL_BLIGHT_VISUAL_1);
                    }
                    m_creature->RemoveAurasDueToSpell(SPELL_INHALED_BLIGHT);
                    setStage(0);
                    break;
        }


        timedCast(SPELL_GAS_SPORE, diff);

        timedCast(SPELL_GASTRIC_BLOAT, diff);

        if (timedQuery(SPELL_VILE_GAS, diff))
        {
                       float fPosX, fPosY, fPosZ;
                       m_creature->GetPosition(fPosX, fPosY, fPosZ);
                       m_creature->GetRandomPoint(fPosX, fPosY, fPosZ, 30.0f, fPosX, fPosY, fPosZ);
                       if (Unit* pTemp = doSummon(NPC_VILE_GAS_STALKER,fPosX, fPosY, fPosZ))
                            doCast(SPELL_VILE_GAS, pTemp);
                       DoScriptText(-1631213,m_creature);
        };

        if (timedQuery(SPELL_BERSERK, diff))
        {
            doCast(SPELL_BERSERK);
            DoScriptText(-1631207,m_creature);
        };

        DoMeleeAttackIfReady();
    }
Пример #9
0
        void UpdateAI(uint32 const diff)
        {
            if (!UpdateVictim())
                return;

            switch (getStage())
            {
                case 0: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;

                     if ( HealthBelowPct(81) ) setStage(1);
                     break;

                case 1: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(2);
                     break;

                case 2: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666404,me);
                     setStage(3);
                     break;

                case 3: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(4);
                     }
                     break;

                case 4: // Air phase
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         DoCast(SPELL_CONFLAGATION);
                         m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     if (m_uiConflagrateTimer <= diff)
                     {
                         if (conflagated)
                         {
                             //DoCast(SPELL_CONFLAGATION_1);
                             doBeacon(false);
                         }
                         m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                     } else m_uiConflagrateTimer -= diff;

                     if ( HealthBelowPct(61) ) setStage(5);
                     break;

                case 5: //Air phase end
                     StartMovement(0);
                     setStage(6);
                     break;

                case 6: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
                     setStage(7);
                     break;

                case 7: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(20*IN_MILLISECONDS,40*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;

                     if ( HealthBelowPct(41) ) setStage(8);
                     break;

                case 8: //Air phase start
                     SetCombatMovement(false);
                     me->InterruptNonMeleeSpells(true);
                     SetFly(true);
                     doBeacon(true);
                     StartMovement(1);
                     setStage(9);
                     break;

                case 9: // Wait for movement
                     if (MovementStarted) return;
                     DoCast(SPELL_CONFLAGATION);
                     DoScriptText(-1666404,me);
                     setStage(10);
                     break;

                case 10: // Wait for cast finish
                     if (!me->IsNonMeleeSpellCasted(false))
                     {
                         doBeacon(false);
                         setStage(11);
                     };
                     break;

                case 11: // Air phase
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiBeakonTimer <= diff)
                     {
                         doBeacon(true);
                         DoCast(SPELL_CONFLAGATION);
                         m_uiBeakonTimer = urand(12*IN_MILLISECONDS,22*IN_MILLISECONDS);
                     } else m_uiBeakonTimer -= diff;

                     if (m_uiConflagrateTimer <= diff)
                     {
                         if (conflagated)
                         {
                              //DoCast(SPELL_CONFLAGATION_1);
                              doBeacon(false);
                         }
                         m_uiConflagrateTimer = 5*IN_MILLISECONDS;
                     } else m_uiConflagrateTimer -= diff;

                     if ( HealthBelowPct(21) ) setStage(12);
                     break;

                case 12: //Air phase end
                     StartMovement(0);
                     setStage(13);
                     break;

                case 13: // Wait for movement
                     if (MovementStarted) return;
                     SetFly(false);
                     SetCombatMovement(true);
                     me->GetMotionMaster()->Clear();
                     me->GetMotionMaster()->MoveChase(me->getVictim());
                     setStage(14);
                     break;

                case 14: //GROUND
                     if (m_uiFlameBreathTimer <= diff)
                     {
                         DoCast(SPELL_FLAME_BREATH);
                         m_uiFlameBreathTimer = urand(5*IN_MILLISECONDS,15*IN_MILLISECONDS);
                     } else m_uiFlameBreathTimer -= diff;

                     if (m_uiEnrage <= diff)
                     {
                         DoCast(SPELL_ENRAGE);
                         m_uiEnrage = urand(15*IN_MILLISECONDS,30*IN_MILLISECONDS);
                         DoScriptText(-1666405,me);
                     } else m_uiEnrage -= diff;
                     break;

                default:
                    break;
            }

            DoMeleeAttackIfReady();
        }