void SetData(uint32 uiI, uint32 uiValue) { switch (uiI) { case 1: SetEscortPaused(true); DoScriptText(SAY_BLASTMASTER_0, me); NextStep(1500, true); break; case 2: if (!pInstance) return; switch (uiValue) { case 1: pInstance->SetData(TYPE_EVENT, IN_PROGRESS); break; case 2: pInstance->SetData(TYPE_EVENT, DONE); NextStep(5000, false, 22); break; } break; } }
void UpdateAI(uint32 uiDiff) { ScriptedAI::UpdateAI(uiDiff); if (uiTimer <= uiDiff) { switch (uiPhase) { case 1: DoSummonGrandChampion(uiSecondBoss); NextStep(10000, true); break; case 2: DoSummonGrandChampion(uiThirdBoss); NextStep(0, false); break; case 3: if (!Champion1List.empty()) { for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) if (Creature* summon = Unit::GetCreature(*me, *itr)) AggroAllPlayers(summon); NextStep(0, false); } break; } } else uiTimer -= uiDiff; if (!UpdateVictim()) return; }
void UpdateAI(const uint32 uiDiff) { if (m_bEventEnded || !m_bEventStarted) return; if (m_uiEventTimer <= uiDiff) { switch (m_uiEventPhase) { case 0: DoScriptText(SAY_COUNCIL_INTRO_1, m_creature); NextStep(15000); break; case 1: DoScriptText(SAY_COUNCIL_INTRO_2, m_creature); NextStep(5000); break; case 2: // raise princes if (m_pInstance) { if (Creature *pTaldaram = m_pInstance->GetSingleCreatureFromStorage(NPC_TALDARAM)) { pTaldaram->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pTaldaram->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); pTaldaram->SetInCombatWithZone(); } if (Creature *pKeleseth = m_pInstance->GetSingleCreatureFromStorage(NPC_KELESETH)) { pKeleseth->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pKeleseth->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); pKeleseth->SetInCombatWithZone(); } if (Creature *pValanar = m_pInstance->GetSingleCreatureFromStorage(NPC_VALANAR)) { pValanar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pValanar->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); pValanar->SetInCombatWithZone(); } } m_creature->SetVisibility(VISIBILITY_OFF); m_bEventEnded = true; break; default: break; } } else m_uiEventTimer -= uiDiff; }
void UpdateAI(const uint32 uiDiff) { if (!m_bIsEventStarted || m_bIsEventFinished) return; if (m_uiEventTimer <= uiDiff) { switch (m_uiStep) { case 0: break; case 1: DoScriptText(SAY_SVALNA_1, m_creature); NextStep(12000); break; case 2: /*if (Unit* pCrok = m_pInstance->GetSingleCreatureFromStorage(NPC_CROK)) { DoScriptText(SAY_CROK_1, pCrok); pCrok->GetMotionMaster()->MovePoint(0, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, SpawnLoc[0].o); } if (Unit* pArnath = m_pInstance->GetSingleCreatureFromStorage(NPC_ARNATH)) pArnath->GetMotionMaster()->MovePoint(0, SpawnLoc[1].x, SpawnLoc[1].y, SpawnLoc[1].z, SpawnLoc[1].o); if (Unit* pBrandon = m_pInstance->GetSingleCreatureFromStorage(NPC_BRANDON)) pBrandon->GetMotionMaster()->MovePoint(0, SpawnLoc[2].x, SpawnLoc[2].y, SpawnLoc[2].z, SpawnLoc[2].o); if (Unit* pGrondel = m_pInstance->GetSingleCreatureFromStorage(NPC_GRONDEL)) pGrondel->GetMotionMaster()->MovePoint(0, SpawnLoc[3].x, SpawnLoc[3].y, SpawnLoc[3].z, SpawnLoc[3].o); if (Unit* pRupert = m_pInstance->GetSingleCreatureFromStorage(NPC_RUPERT)) pRupert->GetMotionMaster()->MovePoint(0, SpawnLoc[4].x, SpawnLoc[4].y, SpawnLoc[4].z, SpawnLoc[4].o);*/ NextStep(); break; case 3: break; case 4: DoScriptText(SAY_SVALNA_2, m_creature); NextStep(30000); break; case 5: DoScriptText(SAY_SVALNA_3, m_creature); NextStep(); break; default: break; } } else m_uiEventTimer -= uiDiff; }
int PlayGame(int *Parameter){ Board gameBoard,nextBoard; int i; int maxLevel; InitGame(gameBoard); PrintBoard(gameBoard); while (1){ NextStep(nextBoard,gameBoard, Parameter, COUNT_STEP, MoveLeft, MoveRight, MoveUp, MoveDown); UpdateBoard(gameBoard,nextBoard); maxLevel = FinishGame(gameBoard); if ( maxLevel != 0){ break; } if (PLAY_MODE == 1) if ( TotalScore > 1000) Sleep(1000); else Sleep(100); } return maxLevel; }
bool CFX_LedRandomAnimation::UpdateAnimation(int timeStep) { bool returnval = false; m_stepIncrement++; m_brightness += m_brightnessIncrement; if (m_brightness > 255) { m_output->SetBrightness(255); } else if (m_brightness < 0) { m_output->SetBrightness(0); } else { m_output->SetBrightness(m_brightness); } if (m_stepIncrement >= m_totalIncrements) { NextStep(); returnval = true; } return returnval; }
/* * NOTE: This function has an important side effect. If this machine * is not the first in a new cell, then this function will get the * cell name from the config info. The cell name may be needed in * config calls that come later, and so this function must be called * before they are. */ static int IsConfigInfoValid(BOOL& bValid, afs_status_t& nStatus) { if (bCancel) return FALSE; afs_status_t configStatus; char *pszCellName = 0; NextStep(IDS_CHECK_CONFIG_INFO); bValid = FALSE; g_LogFile.Write("Is there valid configuration information on this machine: "); int nResult = cfg_HostQueryStatus(GetHostnameA(), &configStatus, &pszCellName, &nStatus); if (!nResult) return FALSE; g_LogFile.WriteBoolResult((configStatus == 0)); if (configStatus == 0) lstrncpy(g_CfgData.szCellName, A2S(pszCellName), MAX_CELL_NAME_LEN); else g_LogFile.WriteError("The configuration information on this host is not valid", configStatus); bValid = (BOOL)(configStatus == 0); return TRUE; }
void UpdateAI(const uint32 diff) { if (YellTimer <= diff) { if (EventStarted) YellTimer = NextStep(Step++); } else YellTimer -= diff; if (Step >= 7 && Step <= 12) { Unit* arca = Unit::GetUnit(*me, ArcanagosGUID); if (FireArcanagosTimer <= diff) { if (arca) arca->CastSpell(me, SPELL_FIRE_BALL, false); FireArcanagosTimer = 6000; } else FireArcanagosTimer -= diff; if (FireMedivhTimer <= diff) { if (arca) DoCast(arca, SPELL_FIRE_BALL); FireMedivhTimer = 5000; } else FireMedivhTimer -= diff; } }
void SetData(uint32 uiType, uint32 uiData) { switch (uiType) { case DATA_START: if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) pInstance->HandleGameObject(pGO->GetGUID(),true); if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE1))) pInstance->HandleGameObject(pGO->GetGUID(),false); DoScriptText(SAY_START, me); DoSummonGrandChampion(uiFirstBoss); NextStep(10000,false,1); break; case DATA_IN_POSITION: //movement done. me->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); me->GetMotionMaster()->MovePoint(1,735.898, 651.961, 411.93); DoScriptText(SAY_START2, me); if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) pInstance->HandleGameObject(pGO->GetGUID(),false); NextStep(20000,false,3); break; case DATA_LESSER_CHAMPIONS_DEFEATED: { ++uiLesserChampions; std::list<uint64> TempList; if (uiLesserChampions == 3 || uiLesserChampions == 6) { switch(uiLesserChampions) { case 3: TempList = Champion2List; break; case 6: TempList = Champion3List; break; } for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) if (Creature* pSummon = Unit::GetCreature(*me, *itr)) AggroAllPlayers(pSummon); }else if (uiLesserChampions == 9) StartGrandChampionsAttack(); break; } } }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (EventStarted) { SayTimer = NextStep(Step++); } } else SayTimer -= diff; }
DWORD ISequence::Next(void) { switch(m_seq_type) { case SEQ_STEP: NextStep(); break; case SEQ_FUNCTION: sequence_func(); break; } return m_dwNumber; }
void UpdateAI(const uint32 diff) { if (StepsTimer <= diff) { if (Intro) StepsTimer = NextStep(++Steps); } else StepsTimer -= diff; }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (EventStarted) SayTimer = NextStep(++Step); } else SayTimer -= diff; }
void UpdateAI(uint32 diff) override { if (SayTimer <= diff) { if (EventStarted) SayTimer = NextStep(Step++); } else SayTimer -= diff; }
void AntennaMissionState::Retry(std::uint8_t limit) { if ((this->_retryCount + 1) == limit) { NextStep(); } else { ++this->_retryCount; } }
void SetData(uint32 uiType, uint32 /*uiData*/) { switch (uiType) { case DATA_START: DoSummonGrandChampion(uiFirstBoss); NextStep(10000, false, 1); break; case DATA_IN_POSITION: //movement done. me->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) instance->HandleGameObject(go->GetGUID(), false); NextStep(10000, false, 3); break; case DATA_LESSER_CHAMPIONS_DEFEATED: { ++uiLesserChampions; std::list<uint64> TempList; if (uiLesserChampions == 3 || uiLesserChampions == 6) { switch (uiLesserChampions) { case 3: TempList = Champion2List; break; case 6: TempList = Champion3List; break; } for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) if (Creature* summon = Unit::GetCreature(*me, *itr)) AggroAllPlayers(summon); }else if (uiLesserChampions == 9) StartGrandChampionsAttack(); break; } } }
bool CFX_LedAnimationSequence::UpdateAnimation(int timeStep) { bool returnval = false; m_stepIncrement++; m_output->SetBrightness(CalculateValue(m_stepIncrement, m_totalIncrements, m_startBrightness, m_steps[m_activeStep].brightness, m_steps[m_activeStep].type)); if (m_stepIncrement >= m_totalIncrements) { returnval = NextStep(); } return returnval; }
void MoveInLineOfSight(Unit *pWho) { if (!m_bIsEventStarted) { if (pWho->GetTypeId() == TYPEID_PLAYER) { m_bIsEventStarted = true; NextStep(); } } ScriptedAI::MoveInLineOfSight(pWho); }
__interrupt void watchdog_timer(void) { // Dekrementuje zmienna uniemozliwiajaca zbyt czeste naciskanie przyciskow (eliminacja drgan). if (gTicksToEnableButton > 0) gTicksToEnableButton--; // Wywolywanie obslugi kolejnego zdarzenia po wyznaczonej liczbie taktow zegara. if (gTicksToNextStep > 0) gTicksToNextStep--; if (gTicksToNextStep == 0) NextStep(); }
void CTestMachine::StepRestoreDatabaseL() { test.Printf(_L("Restoring Database...")); delete iDb; iDb = NULL; //Close TESTTRAPL(CopyFileL(KTestFileBaseFullPath, KTestFileFullPath)); //Open test.Printf(_L("Opening cntmodel...")); iDb=CContactDatabase::OpenL(KTestFile); NextStep(); //User::After(1000000); test.Printf(_L("done!\n")); }
void SetData(uint32 uiI, uint32 uiValue) override { switch (uiI) { case 1: SetEscortPaused(true); Talk(SAY_BLASTMASTER_0); NextStep(2000, true); break; case 2: switch (uiValue) { case 1: instance->SetData(TYPE_EVENT, IN_PROGRESS); break; case 2: instance->SetData(TYPE_EVENT, DONE); NextStep(5000, false, 22); break; } break; } }
void PlayGame() { char userChoice = 'k'; printf("Going to start game. Use AD for left, right. WS for up, down.\n"); printf("k to kill game.\n"); InitTiles(); NextStep(); do{ if(!NextStep()){ break; } PrintTiles(); refresh(); // printing on screen - via ncurses. userChoice = getch(); // if(userChoice=='\n') userChoice = getchar(); switch(userChoice){ case 'a': case 'A': MergeLeft(); ShiftLeft(); break; case 'd': case 'D': MergeRight(); ShiftRight(); break; case 'w': case 'W': MergeUp(); ShiftUp(); break; case 's': case 'S': MergeDown(); ShiftDown(); break; } clear(); } while(SpaceAvailable() && userChoice != 'k'); printf("\nGame over.\n"); }
void UpdateAI(const uint32 diff) { if (bEvent && !bActiveAttack) { if (m_uiSayTimer < diff) m_uiSayTimer = NextStep(++m_uiStep); else m_uiSayTimer -= diff; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; DoMeleeAttackIfReady(); }
// Game::Start void Game::Start() { if( this->GameMode == MODE_NET_HOST ) { this->Server = new GameServer(DEFAULT_PORT); } if( this->GameMode == MODE_NET_CLIENT ) { this->Client = new GameClient(); } for(;;) { DrawBoard(); Analyze(); NextStep(); } }
void Test() override { if (!GetMap()) Finish(false); switch (GetTestStep()) { case 0: Wait(100); break; case 1: Finish(true); break; } NextStep(); }
void UpdateAI(const uint32 diff) { npc_escortAI::UpdateAI(diff); if (StepsTimer <= diff) { if (Event) StepsTimer = NextStep(++Steps); } else StepsTimer -= diff; if (HadMount && !me->isInCombat()) DoMount(); if (EmoteTimer) { if (EmoteTimer <= diff) { me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); EmoteTimer = 0; } else EmoteTimer -= diff; } if (!UpdateVictim()) return; if (StrikeTimer < diff) { DoCast(me->getVictim(), SPELL_STRIKE); StrikeTimer = urand(4000, 7000); } else StrikeTimer -= diff; if (ShieldBlockTimer < diff) { DoCast(me, SPELL_SHIELD_BLOCK); ShieldBlockTimer = urand(8000, 15000); } else ShieldBlockTimer -= diff; if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) { DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1, SAY_TH_RANDOM_LOW_HP2), me); LowHp = true; } }
void WaypointReached(uint32 uiPoint) { //just in case if (GetPlayerForEscort()) if (me->GetFaction() != GetPlayerForEscort()->GetFaction()) me->SetFaction(GetPlayerForEscort()->GetFaction()); switch (uiPoint) { case 3: SetEscortPaused(true); NextStep(2000, false, 3); break; case 7: SetEscortPaused(true); NextStep(2000, false, 4); break; case 9: NextStep(1000, false, 8); break; case 10: NextStep(25000, false, 10); break; case 11: SetEscortPaused(true); SetInFace(true); NextStep(1000, false, 11); break; case 12: NextStep(25000, false, 18); break; case 13: Summon(7); NextStep(25000, false, 19); break; case 14: SetInFace(false); DoScriptText(SAY_BLASTMASTER_26, me); SetEscortPaused(true); NextStep(5000, false, 20); break; } }
void WaypointReached(uint32 waypointId) override { //just in case if (GetPlayerForEscort()) if (me->getFaction() != GetPlayerForEscort()->getFaction()) me->setFaction(GetPlayerForEscort()->getFaction()); switch (waypointId) { case 3: SetEscortPaused(true); NextStep(2000, false, 3); break; case 7: SetEscortPaused(true); NextStep(2000, false, 4); break; case 9: NextStep(1000, false, 8); break; case 10: NextStep(25000, false, 10); break; case 11: SetEscortPaused(true); SetInFace(true); NextStep(1000, false, 11); break; case 12: NextStep(25000, false, 18); break; case 13: Summon(6); NextStep(25000, false, 19); break; case 14: SetInFace(false); Talk(SAY_BLASTMASTER_17); SetEscortPaused(true); NextStep(5000, false, 20); break; } }
void Test() override { switch (GetTestStep()) { case 0: SpawnPlayer(0, CLASS_WARLOCK, RACE_UNDEAD, 0, 1); SpawnPlayer(1, CLASS_MAGE, RACE_GNOME, 0, 0); WaitPlayerSummon(); break; case 1: { Player* warlock = GetTestPlayer(0); Player* mage = GetTestPlayer(1, TESTPLAYER_MAXLEVEL); warlock->SetPvP(false); mage->SetPvP(true); mage->CastSpell(mage, SPELL_FROST_NOVA, false); TEST_ASSERT(!mage->IsValidAttackTarget(warlock)); TEST_ASSERT(mage->IsPvP()); Wait(2000); break; } case 2: { Player* warlock = GetTestPlayer(0, TESTPLAYER_MAXLEVEL); Player* mage = GetTestPlayer(1); warlock->SetPvP(true); warlock->CastSpell(warlock, SPELL_FROST_NOVA, false); TEST_ASSERT(mage->IsPvP()); TEST_ASSERT(warlock->IsPvP()); TEST_ASSERT(!warlock->HasAura(SPELL_FROST_NOVA)); TEST_ASSERT(mage->IsValidAttackTarget(warlock)); TEST_ASSERT(warlock->IsValidAttackTarget(mage)); Wait(2000); break; } case 3: { Player* mage = GetTestPlayer(1); TEST_ASSERT(mage->HasAura(SPELL_FROST_NOVA)); Finish(); break; } } NextStep(); }
void UpdateAI(const uint32 diff) { if (SayTimer <= diff) { if (Event) SayTimer = NextStep(++Step); } else SayTimer -= diff; if (Attack) { Player* player = Unit::GetPlayer(*me, PlayerGUID); me->setFaction(14); me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (!player || !me->canCreatureAttack(player)) { EnterEvadeMode(); return; } Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { Creepjack->AI()->AttackStart(player); Creepjack->setFaction(14); Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20); if (Malone) { Malone->AI()->AttackStart(player); Malone->setFaction(14); Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } AttackStart(player); Attack = false; } if (!UpdateVictim()) return; DoMeleeAttackIfReady(); }