void
VisitHotPointInteractor::StartLeftButtonAction()
{
    int x, y, ctrl, shift;
    Interactor->GetEventPosition(x, y);
    ctrl = Interactor->GetControlKey();
    shift = Interactor->GetShiftKey();
    //
    // See if we clicked on a hotpoint.
    //
    hotPointMode = proxy.GetHotPoint(x, y, currentHotPoint);

    //
    // Hide the hotpoint highlights.
    //
    proxy.SetHighlightEnabled(false);

    //
    // If we have a hot point, call its handler.
    //
    if(hotPointMode)
    {
        StartRotate();

        if(currentHotPoint.callback != NULL && currentHotPoint.tool != NULL)
        {
            currentHotPoint.tool->SetLastLocation(x, y);
            (*currentHotPoint.callback)(currentHotPoint.tool,
                                        CB_START, ctrl, shift, x, y,
                                        currentHotPoint.data);
        }
    }
    else
        currentInteractor->OnLeftButtonDown();

    // Tell the other colleagues that motion is starting.
    MotionBegin();

    // Save the x,y location as the last coordinates.
    lastX = x;
    lastY = y;
}
Пример #2
0
void
FlyThrough::StartLeftButtonAction()
{
    DisableSpinMode();

    StartBoundingBox();

    //
    // If ctrl or shift is pushed, pan, otherwise rotate.  Save which one we
    // did so we can issue the proper "End.." statement when the button is
    // released.
    //
    if (Interactor->GetControlKey()|| Interactor->GetShiftKey())
    {
        StartPan();
        ctrlOrShiftPushed = true;
    }
    else
    {
        StartRotate();
        ctrlOrShiftPushed = false;
    }
}
Пример #3
0
void vtkInteractorStyleQuench::OnLeftButtonDown()
{
  _mouse_moved = false;
	_left_button_down=1;
	FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);

	_mousedown_x = this->Interactor->GetEventPosition()[0];
	_mousedown_y = abs(this->Interactor->GetEventPosition()[1]);

	if(_voiEditor->GetEditingROIMode() && _voiEditor->ClickInsideTomogram(_mousedown_x, _mousedown_y))
	  {
	    _voiEditor->OnLeftDown(_mousedown_x, _mousedown_y);
	    _interaction_mode = INTERACTION_ROI_EDIT;
	    return;
	  }
	
	if(_pathwayViz->OnLeftDown(_mousedown_x, _mousedown_y))
	  {
	    _interaction_mode = INTERACTION_PATHWAYS;
	    return;
	  }
	
	if (this->Interactor->GetControlKey() || ((wxVTKRenderWindowInteractor*)Interactor)->bCmdDwn) 
	{
	  _GestureInteractor->BeginSelect(_mousedown_x, _mousedown_y);
	  //NotifyAllListeners(PEvent ( new EventRefreshViz(true) ) );
	  //_renderer->GetRenderWindow()->Render();
	  _interaction_mode = INTERACTION_DRAW_GESTURE;
	  return;
	} 

	// xxxdla trying to fix bug with interactions

	//if( _voiViz->OnLeftDown(_mousedown_x, _mousedown_y) )
	//	return ;
	Interactor->GetShiftKey()?StartPan():StartRotate();
}
    void UpdateAI(const uint32 diff)
    {
        if (instance->GetData(DATA_STRANGE_POOL) != IN_PROGRESS)
            return;

        if (me->GetVisibility() == VISIBILITY_OFF)
        {
            me->SetVisibility(VISIBILITY_ON);
            me->RemoveAurasDueToSpell(SPELL_SUBMERGE);

            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

            DoZoneInCombat();
        }

        if (!UpdateVictim())
            return;

        DoSpecialThings(diff, DO_PULSE_COMBAT);

        Rotate(diff);//always check rotate things

        events.Update(diff);

        if(!m_submerged && RotType == NOROTATE)//is not spouting and not submerged
        {
            if(SpoutTimer < diff)
            {
                if(me->getVictim() && RotType == NOROTATE)
                    StartRotate(me->getVictim());//start spout and random rotate

                SpoutTimer= 35000;
                return;
            } else SpoutTimer -= diff;
        }

        while (uint32 eventId = events.ExecuteEvent())
        {
            switch (eventId)
            {    
                /*case LURKER_EVENT_SPOUT_EMOTE:
                {
                me->MonsterTextEmote(EMOTE_SPOUT, 0, true);
                ForceSpellCast(me, SPELL_SPOUT_BREATH);
                events.ScheduleEvent(LURKER_EVENT_SPOUT, 3000);
                break;
                }
                case LURKER_EVENT_SPOUT:
                {
                me->SetReactState(REACT_PASSIVE);

                me->SetSelection(0);
                me->GetMotionMaster()->MoveRotate(20000, RAND(ROTATE_DIRECTION_LEFT, ROTATE_DIRECTION_RIGHT));

                ForceSpellCast(me, SPELL_SPOUT_VISUAL, INTERRUPT_AND_CAST_INSTANTLY);

                m_rotating = true;

                events.DelayEvents(20000, 0);
                events.ScheduleEvent(LURKER_EVENT_SPOUT_EMOTE, 45000);
                events.RescheduleEvent(LURKER_EVENT_WHIRL, 21000);
                break;
                }*/
            case LURKER_EVENT_WHIRL:
                {
                    AddSpellToCast(me, SPELL_WHIRL);
                    events.ScheduleEvent(LURKER_EVENT_WHIRL, 18000);
                    break;
                }
            case LURKER_EVENT_GEYSER:
                {
                    AddSpellToCast(SPELL_GEYSER, CAST_RANDOM);
                    events.ScheduleEvent(LURKER_EVENT_GEYSER, urand(15000, 20000));
                    break;
                }
            case LURKER_EVENT_SUBMERGE:
                {
                    ForceSpellCast(me, SPELL_SUBMERGE, INTERRUPT_AND_CAST_INSTANTLY);

                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);

                    SummonAdds();
                    m_submerged = true;

                    events.CancelEvent(LURKER_EVENT_SPOUT_EMOTE);
                    SpoutTimer = 4000; // directly cast Spout after emerging!
                    // events.CancelEvent(LURKER_EVENT_SPOUT);
                    events.CancelEvent(LURKER_EVENT_WHIRL);
                    events.CancelEvent(LURKER_EVENT_GEYSER);
                    events.ScheduleEvent(LURKER_EVENT_REEMERGE, 60000);
                    break;
                }
            case LURKER_EVENT_REEMERGE:
                {
                    me->RemoveAurasDueToSpell(SPELL_SUBMERGE);

                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    m_submerged = false;

                    events.ScheduleEvent(LURKER_EVENT_SPOUT_EMOTE, 0);
                    events.ScheduleEvent(LURKER_EVENT_WHIRL, 2000);
                    events.ScheduleEvent(LURKER_EVENT_GEYSER, urand(5000, 15000));
                    events.ScheduleEvent(LURKER_EVENT_SUBMERGE, 90000);
                    break;
                }
            }
        }

        CastNextSpellIfAnyAndReady();
        DoMeleeAttackIfReady();
    }
Пример #5
0
    void UpdateAI(const uint32 diff)
    {
        if (instance->GetData(DATA_LURKER_FISHING_EVENT) != DONE)
            return;

        //boss is invisible, don't attack
        if (!CanStartEvent)
        {            
                if (m_submerged)
                {
                    m_submerged = false;
                    WaitTimer2 = 500;
                }
                
                //wait 500ms before emerge anim
                if (!m_submerged && WaitTimer2 <= diff)
                {
                    me->SetVisibility(VISIBILITY_ON);
                    me->RemoveAllAuras();
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);                    
                    DoCast(me, SPELL_EMERGE, false);
                    WaitTimer2 = 60000;//never reached
                    WaitTimer = 3000;
                }
                else
                    WaitTimer2 -= diff;

                //wait 3secs for emerge anim, then attack
                if (WaitTimer <= diff)
                {
                    //fresh fished from pool
                    WaitTimer = 3000;                    
                    CanStartEvent = true;
                    me->RemoveAurasDueToSpell(SPELL_SUBMERGE);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    DoZoneInCombat();

                    if (ConsecutiveSubmerge)
                    {
                        events.RescheduleEvent(LURKER_EVENT_WHIRL, 2000);
                        events.RescheduleEvent(LURKER_EVENT_GEYSER, urand(5000, 15000));
                        events.RescheduleEvent(LURKER_EVENT_SUBMERGE, 90000);
                    }
                }
                else
                    WaitTimer -= diff;
            return;
        }

        if (!UpdateVictim())
            return;

        DoSpecialThings(diff, DO_PULSE_COMBAT);

        Rotate(diff);//always check rotate things

        events.Update(diff);

        if(!m_submerged && RotType == NOROTATE)//is not spouting and not submerged
        {
            if(SpoutTimer < diff)
            {
                if(me->getVictim() && RotType == NOROTATE)
                    StartRotate(me->getVictim());//start spout and random rotate

                SpoutTimer= 35000;
                return;
            } else SpoutTimer -= diff;
        }

        while (uint32 eventId = events.ExecuteEvent())
        {
            switch (eventId)
            {    
            case LURKER_EVENT_WHIRL:
                {
                    if (m_submerged == false) {
                        AddSpellToCast(me, SPELL_WHIRL);
                    }
                    events.RescheduleEvent(LURKER_EVENT_WHIRL, 18000);                    
                    break;
                }
            case LURKER_EVENT_GEYSER:
                {
                    AddSpellToCast(SPELL_GEYSER, CAST_RANDOM);
                    events.ScheduleEvent(LURKER_EVENT_GEYSER, urand(15000, 20000));
                    break;
                }
            case LURKER_EVENT_SUBMERGE:
                {
                    ForceSpellCast(me, SPELL_SUBMERGE, INTERRUPT_AND_CAST_INSTANTLY);

                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
                    me->SetVisibility(VISIBILITY_OFF);

                    SummonAdds();
                    m_submerged = true;
                    
                    // directly cast Spout after emerging!                    
                    SpoutTimer = 4000; 
                    events.CancelEvent(LURKER_EVENT_WHIRL);
                    events.CancelEvent(LURKER_EVENT_GEYSER);
                    events.ScheduleEvent(LURKER_EVENT_REEMERGE, 60000);
                    break;
                }
            case LURKER_EVENT_REEMERGE:
                {
                    me->SetVisibility(VISIBILITY_OFF);
                    DoStopAttack();

                    //Time values here is irrelevant, they just need to be set
                    WaitTimer = 60000;
                    WaitTimer2 = 60000;
                    CanStartEvent = false;
                    m_submerged = true;
                    ConsecutiveSubmerge = true;                    
                    break;
                }
            }
        }

        CastNextSpellIfAnyAndReady();
        DoMeleeAttackIfReady();
    }
Пример #6
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim() /*|| !m_creature->getVictim()*/ )//rotate resets target
            return;

        //Check if players in water and if in water cast spell
        Map *map = m_creature->GetMap();
        if (map->IsDungeon() && pInstance->GetData(DATA_THELURKERBELOWEVENT) == IN_PROGRESS)
        {
            Map::PlayerList const &PlayerList = map->GetPlayers();

            if (PlayerList.isEmpty())
                return;

            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_SCALDINGWATER, 0))
                    i->getSource()->CastSpell(i->getSource(), SPELL_SCALDINGWATER, true);
                else if(!i->getSource()->IsInWater())
                    i->getSource()->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
            }
        }

        Rotate(diff);//always check rotate things
        if(!Submerged)
        {
            if(PhaseTimer < diff)
            {
                m_creature->InterruptNonMeleeSpells(false);
                DoCast(m_creature,SPELL_SUBMERGE);
                PhaseTimer = 60000;//60secs submerged
                Submerged = true;
            } else PhaseTimer-=diff;
        }

        if(!Submerged && RotType == NOROTATE)//is not spouting and not submerged
        {
            if(SpoutTimer < diff)
            {
                if(m_creature->getVictim() && RotType == NOROTATE)
                    StartRotate(m_creature->getVictim());//start spout and random rotate

                SpoutTimer= 35000;
                return;
            } else SpoutTimer -= diff;

            //Whirl directly after a Spout and at random times
            if(WhirlTimer < diff)
            {
                WhirlTimer = rand()%5000 + 15000;
                DoCast(m_creature,SPELL_WHIRL);
                WaterboltTimer += 5000;//add 5secs to waterbolt timer, to add some time to run back to boss
            } else WhirlTimer -= diff;

            if(GeyserTimer < diff)
            {
                Unit* target = NULL;
                target = SelectUnit(SELECT_TARGET_RANDOM,1);

                if(target)
                    DoCast(target,SPELL_GEYSER,true);
                else
                    target = SelectUnit(SELECT_TARGET_RANDOM,0);
                if(target)
                    DoCast(target,SPELL_GEYSER,true);

                GeyserTimer = rand()%5000 + 15000;
            } else GeyserTimer -= diff;

            if(WaterboltTimer < diff)
            {
                Unit* target = SelectUnit(SELECT_TARGET_NEAREST,0,14,true);
                if(!target)
                {
                    target = SelectUnit(SELECT_TARGET_RANDOM,0);
                    if(target)
                        DoCast(target,SPELL_WATERBOLT);
                }
                WaterboltTimer = 3000;
            } else WaterboltTimer -= diff;

            if (!UpdateVictim() )
                return;

            DoMeleeAttackIfReady();
        } else if(!Submerged)
            return;
        else if(Submerged)//phase 2, submerged
        {
            if(PhaseTimer < diff)
            {
                Submerged = false;
                m_creature->InterruptNonMeleeSpells(false);//shouldn't be any
                m_creature->RemoveAllAuras();
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                m_creature->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED);
                m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,9);
                DoCast(m_creature,SPELL_EMERGE);
                Spawned = false;
                SpoutTimer = 4000; // directly cast Spout after emerging!
                WhirlTimer = 26000;
                PhaseTimer = 120000;
                return;
            } else PhaseTimer-=diff;

            if(!m_creature->isInCombat())
                m_creature->SetInCombatState(false);

            if(!Spawned)
            {
                m_creature->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                //spawn adds
                for (uint8 i = 0; i < 9; ++i)
                {
                    Creature* Summoned;
                    if(i < 7)
                        Summoned = m_creature->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                    else Summoned = m_creature->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);

                    if(Summoned)
                        Summons.Summon(Summoned);
                    Spawned = true;
                }
            }
        }
    }
void TaskVidageChateau(void)
{
    switch (robotState.taskState)
    {
        case T_VC_INIT:
            //On dit au robot d'aller à la position initiale
            allerRetourCounter=0;
            StartMove(T_VC_INIT_EN_COURS,380,taskVidageChateau.startingPosY,ALIGNED_WITH_MOVE);
            PWMSetSpeedConsigne(VITESSE_ROULEAU_AVALE, MOTEUR_ROULEAU);
            break;
        case T_VC_INIT_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_AVANCE_0,4000);
                robotState.AligneAvantVersDirectionMouvement = 0;
            break;

        case T_VC_AVANCE_0:
            if (allerRetourCounter < 2)
            {
                allerRetourCounter++;
                StartRotate(T_VC_AVANCE_0_EN_COURS,90);
                PWMSetSpeedConsigne(VITESSE_ROULEAU_ARRET, MOTEUR_ROULEAU); //On recrache
            }
            else
            {
                robotState.taskState = T_VC_FIN;
            }
            break;
            
        case T_VC_AVANCE_0_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_AVANCE_1,2500);
            break;

        case T_VC_AVANCE_1:
            SendState();
            StartMove(T_VC_AVANCE_1_EN_COURS,550,taskVidageChateau.startingPosY,ALIGNED_WITH_MOVE);
            PWMSetSpeedConsigne(VITESSE_ROULEAU_RECRACHE, MOTEUR_ROULEAU); //On recrache
            break;
            
        case T_VC_AVANCE_1_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_TOURNE_1,1600);   
            break;

        case T_VC_TOURNE_1:
            StartRotate(T_VC_TOURNE_1_EN_COURS,75);
            PWMSetSpeedConsigne(VITESSE_ROULEAU_RECRACHE, MOTEUR_ROULEAU); //On recrache
            break;
            
        case T_VC_TOURNE_1_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_TOURNE_2,500);
            break;
            
        case T_VC_TOURNE_2:
            StartRotate(T_VC_TOURNE_2_EN_COURS,95);
            PWMSetSpeedConsigne(VITESSE_ROULEAU_RECRACHE, MOTEUR_ROULEAU); //On recrache
            break;
            
        case T_VC_TOURNE_2_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_RECULE_1,700);
            break;

        case T_VC_RECULE_1:
            SendState();
            StartMove(T_VC_RECULE_1_EN_COURS,330,taskVidageChateau.startingPosY,NOT_ALIGNED);
            PWMSetSpeedConsigne(VITESSE_ROULEAU_RECRACHE, MOTEUR_ROULEAU); //On recrache
            break;

        case T_VC_RECULE_1_EN_COURS:
            IsCurrentMoveFinishedGoToState(T_VC_AVANCE_0,1600);
            break;

        case T_VC_FIN:
            SendState();
            robotState.taskState = T_VC_FIN_EN_COURS;
            PWMSetSpeedConsigne(VITESSE_ROULEAU_ARRET, MOTEUR_ROULEAU); //On recrache
            //taskVidageChateau.nbTaskCompleted++;
            break;

        case T_VC_FIN_EN_COURS:
            break;

        default:
            robotState.taskState = T_VC_FIN;
            break;
    }
}