float randf() { int n = (int)rand32(); return n/2147483647.0f; }
void KilledUnit(Unit* /*victim*/) override { if (!(rand32() % 5)) Talk(SAY_FEUG_SLAY); }
void WardenWin::RequestData() { TC_LOG_DEBUG("warden", "Request data"); // If all checks were done, fill the todo list again if (_memChecksTodo.empty()) _memChecksTodo.assign(sWardenCheckMgr->MemChecksIdPool.begin(), sWardenCheckMgr->MemChecksIdPool.end()); if (_otherChecksTodo.empty()) _otherChecksTodo.assign(sWardenCheckMgr->OtherChecksIdPool.begin(), sWardenCheckMgr->OtherChecksIdPool.end()); _serverTicks = getMSTime(); uint16 id; uint8 type; WardenCheck* wd; _currentChecks.clear(); // Build check request for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_MEM_CHECKS); ++i) { // If todo list is done break loop (will be filled on next Update() run) if (_memChecksTodo.empty()) break; // Get check id from the end and remove it from todo id = _memChecksTodo.back(); _memChecksTodo.pop_back(); // Add the id to the list sent in this cycle _currentChecks.push_back(id); } ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i) { // If todo list is done break loop (will be filled on next Update() run) if (_otherChecksTodo.empty()) break; // Get check id from the end and remove it from todo id = _otherChecksTodo.back(); _otherChecksTodo.pop_back(); // Add the id to the list sent in this cycle _currentChecks.push_back(id); wd = sWardenCheckMgr->GetWardenDataById(id); switch (wd->Type) { case MPQ_CHECK: case LUA_STR_CHECK: case DRIVER_CHECK: buff << uint8(wd->Str.size()); buff.append(wd->Str.c_str(), wd->Str.size()); break; default: break; } } uint8 xorByte = _inputKey[0]; // Add TIMING_CHECK buff << uint8(0x00); buff << uint8(TIMING_CHECK ^ xorByte); uint8 index = 1; for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { wd = sWardenCheckMgr->GetWardenDataById(*itr); type = wd->Type; buff << uint8(type ^ xorByte); switch (type) { case MEM_CHECK: { buff << uint8(0x00); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: { buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes()); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case MPQ_CHECK: case LUA_STR_CHECK: { buff << uint8(index++); break; } case DRIVER_CHECK: { buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes()); buff << uint8(index++); break; } case MODULE_CHECK: { uint32 seed = static_cast<uint32>(rand32()); buff << uint32(seed); HmacHash hmac(4, (uint8*)&seed); hmac.UpdateData(wd->Str); hmac.Finalize(); buff.append(hmac.GetDigest(), hmac.GetLength()); break; } /*case PROC_CHECK: { buff.append(wd->i.AsByteArray(0, false).get(), wd->i.GetNumBytes()); buff << uint8(index++); buff << uint8(index++); buff << uint32(wd->Address); buff << uint8(wd->Length); break; }*/ default: break; // Should never happen } } buff << uint8(xorByte); buff.hexlike(); // Encrypt with warden RC4 key EncryptData(buff.contents(), buff.size()); WorldPacket pkt(SMSG_WARDEN_DATA, buff.size()); pkt.append(buff); _session->SendPacket(&pkt); _dataSent = true; std::stringstream stream; stream << "Sent check id's: "; for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) stream << *itr << " "; TC_LOG_DEBUG("warden", "%s", stream.str().c_str()); }
void UpdateAI(uint32 diff) override { if (!Intro) { if (Intro_Timer <= diff) { switch (Intro_Phase) { case 1: Talk(SAY_INTRO); instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), true); ++Intro_Phase; Intro_Timer = 25000; break; case 2: Talk(SAY_AGGRO); if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_MELLICHAR))) { //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); instance->HandleGameObject(instance->GetGuidData(DATA_WARDENS_SHIELD), false); } ++Intro_Phase; Intro_Timer = 3000; break; case 3: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); Intro = true; break; } } else Intro_Timer -=diff; } if (!UpdateVictim()) return; if (!IsImage66 && !HealthAbovePct(66)) { DoSplit(66); IsImage66 = true; } if (!IsImage33 && !HealthAbovePct(33)) { DoSplit(33); IsImage33 = true; } if (MindRend_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_MIND_REND); else DoCastVictim(SPELL_MIND_REND); MindRend_Timer = 8000; } else MindRend_Timer -=diff; if (Fear_Timer <= diff) { if (me->IsNonMeleeSpellCast(false)) return; Talk(SAY_FEAR); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_FEAR); else DoCastVictim(SPELL_FEAR); Fear_Timer = 25000; } else Fear_Timer -=diff; if (Domination_Timer <= diff) { if (me->IsNonMeleeSpellCast(false)) return; Talk(SAY_MIND); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_DOMINATION); else DoCastVictim(SPELL_DOMINATION); Domination_Timer = 16000 + rand32() % 16000; } else Domination_Timer -=diff; if (IsHeroic()) { if (ManaBurn_Timer <= diff) { if (me->IsNonMeleeSpellCast(false)) return; if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, H_SPELL_MANA_BURN); ManaBurn_Timer = 16000 + rand32() % 16000; } else ManaBurn_Timer -=diff; } DoMeleeAttackIfReady(); }
void WardenWin::RequestData() { DEBUG_LOG("WARDEN: Request data"); if (MemCheck.empty()) MemCheck.assign(WardenDataStorage.MemCheckIds.begin(), WardenDataStorage.MemCheckIds.end()); ServerTicks = WorldTimer::getMSTime(); uint32 maxid = WardenDataStorage.InternalDataID; uint32 id; uint8 type; WardenData *wd; SendDataId.clear(); for (int i = 0; i < 3; ++i) // for now include 3 MEM_CHECK's { if (MemCheck.empty()) break; id = MemCheck.back(); SendDataId.push_back(id); MemCheck.pop_back(); } ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); for (int i = 0; i < 5; ++i) // for now include 5 random checks { id = irand(1, maxid - 1); wd = WardenDataStorage.GetWardenDataById(id); SendDataId.push_back(id); switch (wd->Type) { case MPQ_CHECK: case LUA_STR_CHECK: case DRIVER_CHECK: buff << uint8(wd->str.size()); buff.append(wd->str.c_str(), wd->str.size()); break; default: break; } } uint8 xorByte = InputKey[0]; buff << uint8(0x00); buff << uint8(TIMING_CHECK ^ xorByte); // check TIMING_CHECK uint8 index = 1; for (std::vector<uint32>::iterator itr = SendDataId.begin(); itr != SendDataId.end(); ++itr) { wd = WardenDataStorage.GetWardenDataById(*itr); type = wd->Type; buff << uint8(type ^ xorByte); switch (type) { case MEM_CHECK: { buff << uint8(0x00); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: { buff.append(wd->i.AsByteArray(0, false), wd->i.GetNumBytes()); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case MPQ_CHECK: case LUA_STR_CHECK: { buff << uint8(index++); break; } case DRIVER_CHECK: { buff.append(wd->i.AsByteArray(0, false), wd->i.GetNumBytes()); buff << uint8(index++); break; } case MODULE_CHECK: { uint32 seed = static_cast<uint32>(rand32()); buff << uint32(seed); HMACSHA1 hmac(4, (uint8*)&seed); hmac.UpdateData(wd->str); hmac.Finalize(); buff.append(hmac.GetDigest(), hmac.GetLength()); break; } /*case PROC_CHECK: { buff.append(wd->i.AsByteArray(0, false), wd->i.GetNumBytes()); buff << uint8(index++); buff << uint8(index++); buff << uint32(wd->Address); buff << uint8(wd->Length); break; }*/ default: break; // should never happens } } buff << uint8(xorByte); buff.hexlike(); // Encrypt with warden RC4 key. EncryptData(const_cast<uint8*>(buff.contents()), buff.size()); WorldPacket pkt(SMSG_WARDEN_DATA, buff.size()); pkt.append(buff); Client->SendPacket(&pkt); m_WardenDataSent = true; std::stringstream stream; stream << "Sent check id's: "; for (std::vector<uint32>::iterator itr = SendDataId.begin(); itr != SendDataId.end(); ++itr) stream << *itr << " "; DEBUG_LOG("WARDEN: %s",stream.str().c_str()); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (CloseDoorTimer) { if (CloseDoorTimer <= diff) { instance->HandleGameObject(instance->GetData64(DATA_GO_LIBRARY_DOOR), false); CloseDoorTimer = 0; } else CloseDoorTimer -= diff; } //Cooldowns for casts if (ArcaneCooldown) { if (ArcaneCooldown >= diff) ArcaneCooldown -= diff; else ArcaneCooldown = 0; } if (FireCooldown) { if (FireCooldown >= diff) FireCooldown -= diff; else FireCooldown = 0; } if (FrostCooldown) { if (FrostCooldown >= diff) FrostCooldown -= diff; else FrostCooldown = 0; } if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) { Drinking = true; me->InterruptNonMeleeSpells(false); Talk(SAY_DRINK); if (!DrinkInturrupted) { DoCast(me, SPELL_MASS_POLY, true); DoCast(me, SPELL_CONJURE, false); DoCast(me, SPELL_DRINK, false); me->SetStandState(UNIT_STAND_STATE_SIT); DrinkInterruptTimer = 10000; } } //Drink Interrupt if (Drinking && DrinkInturrupted) { Drinking = false; me->RemoveAurasDueToSpell(SPELL_DRINK); me->SetStandState(UNIT_STAND_STATE_STAND); me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000); DoCast(me, SPELL_POTION, false); } //Drink Interrupt Timer if (Drinking && !DrinkInturrupted) { if (DrinkInterruptTimer >= diff) DrinkInterruptTimer -= diff; else { me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_POTION, true); DoCast(me, SPELL_AOE_PYROBLAST, false); DrinkInturrupted = true; Drinking = false; } } //Don't execute any more code if we are drinking if (Drinking) return; //Normal casts if (NormalCastTimer <= diff) { if (!me->IsNonMeleeSpellCast(false)) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (!target) return; uint32 Spells[3]; uint8 AvailableSpells = 0; //Check for what spells are not on cooldown if (!ArcaneCooldown) { Spells[AvailableSpells] = SPELL_ARCMISSLE; ++AvailableSpells; } if (!FireCooldown) { Spells[AvailableSpells] = SPELL_FIREBALL; ++AvailableSpells; } if (!FrostCooldown) { Spells[AvailableSpells] = SPELL_FROSTBOLT; ++AvailableSpells; } //If no available spells wait 1 second and try again if (AvailableSpells) { CurrentNormalSpell = Spells[rand32() % AvailableSpells]; DoCast(target, CurrentNormalSpell); } } NormalCastTimer = 1000; } else NormalCastTimer -= diff; if (SecondarySpellTimer <= diff) { switch (urand(0, 1)) { case 0: DoCast(me, SPELL_AOE_CS); break; case 1: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(target, SPELL_CHAINSOFICE); break; } SecondarySpellTimer = urand(5000, 20000); } else SecondarySpellTimer -= diff; if (SuperCastTimer <= diff) { uint8 Available[2]; switch (LastSuperSpell) { case SUPER_AE: Available[0] = SUPER_FLAME; Available[1] = SUPER_BLIZZARD; break; case SUPER_FLAME: Available[0] = SUPER_AE; Available[1] = SUPER_BLIZZARD; break; case SUPER_BLIZZARD: Available[0] = SUPER_FLAME; Available[1] = SUPER_AE; break; } LastSuperSpell = Available[urand(0, 1)]; switch (LastSuperSpell) { case SUPER_AE: Talk(SAY_EXPLOSION); DoCast(me, SPELL_BLINK_CENTER, true); DoCast(me, SPELL_PLAYERPULL, true); DoCast(me, SPELL_MASSSLOW, true); DoCast(me, SPELL_AEXPLOSION, false); break; case SUPER_FLAME: Talk(SAY_FLAMEWREATH); FlameWreathTimer = 20000; FlameWreathCheckTime = 500; FlameWreathTarget[0] = 0; FlameWreathTarget[1] = 0; FlameWreathTarget[2] = 0; FlameWreathEffect(); break; case SUPER_BLIZZARD: Talk(SAY_BLIZZARD); if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) { pSpawn->setFaction(me->getFaction()); pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false); } break; } SuperCastTimer = urand(35000, 40000); } else SuperCastTimer -= diff; if (!ElementalsSpawned && HealthBelowPct(40)) { ElementalsSpawned = true; for (uint32 i = 0; i < 4; ++i) { if (Creature* unit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) { unit->Attack(me->GetVictim(), true); unit->setFaction(me->getFaction()); } } Talk(SAY_ELEMENTALS); } if (BerserkTimer <= diff) { for (uint32 i = 0; i < 5; ++i) { if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { unit->Attack(me->GetVictim(), true); unit->setFaction(me->getFaction()); } } Talk(SAY_TIMEOVER); BerserkTimer = 60000; } else BerserkTimer -= diff; //Flame Wreath check if (FlameWreathTimer) { if (FlameWreathTimer >= diff) FlameWreathTimer -= diff; else FlameWreathTimer = 0; if (FlameWreathCheckTime <= diff) { for (uint8 i = 0; i < 3; ++i) { if (!FlameWreathTarget[i]) continue; Unit* unit = ObjectAccessor::GetUnit(*me, FlameWreathTarget[i]); if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) { unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); unit->CastSpell(unit, 11027, true); FlameWreathTarget[i] = 0; } } FlameWreathCheckTime = 500; } else FlameWreathCheckTime -= diff; } if (ArcaneCooldown && FireCooldown && FrostCooldown) DoMeleeAttackIfReady(); }
void SpawnMobs() { for (uint8 i = 0; i < DUNGEON_MODE(5, 6); ++i) { switch (urand(0, 2)) { case 0: me->SummonCreature(NPC_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX() + rand32() % 5, SpawnLoc.GetPositionY() + rand32() % 5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 1: me->SummonCreature(NPC_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX() + rand32() % 5, SpawnLoc.GetPositionY() + rand32() % 5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 2: me->SummonCreature(NPC_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX() + rand32() % 5, SpawnLoc.GetPositionY() + rand32() % 5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; } } }
void UpdateAI(uint32 diff) override { if (TalkTimer) { if (!TalkSequence) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); me->InterruptNonMeleeSpells(true); me->RemoveAllAuras(); me->DeleteThreatList(); me->CombatStop(); ++TalkSequence; } if (TalkTimer <= diff) { if (isFriendly) GoodEnding(); else BadEnding(); ++TalkSequence; } else TalkTimer -= diff; } else { if (bJustReset) { if (ResetTimer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); me->SetDisableGravity(false); me->SetVisible(true); me->SetStandState(UNIT_STAND_STATE_SLEEP); ResetTimer = 10000; bJustReset = false; } else ResetTimer -= diff; return; } if (!UpdateVictim()) return; if (CheckTimer <= diff) { if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) { EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) Sath->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } if (!isBanished && HealthBelowPct(1)) { if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) { if (Sath->HasAura(SPELL_BANISH)) { Sath->DealDamage(Sath, Sath->GetHealth()); return; } else DoAction(DO_BANISH); } else { TC_LOG_ERROR("scripts", "Didn't find Shathrowar. Kalecgos event reseted."); EnterEvadeMode(); return; } } CheckTimer = 1000; } else CheckTimer -= diff; if (ArcaneBuffetTimer <= diff) { DoCastAOE(SPELL_ARCANE_BUFFET); ArcaneBuffetTimer = 8000; } else ArcaneBuffetTimer -= diff; if (FrostBreathTimer <= diff) { DoCastAOE(SPELL_FROST_BREATH); FrostBreathTimer = 15000; } else FrostBreathTimer -= diff; if (TailLashTimer <= diff) { DoCastAOE(SPELL_TAIL_LASH); TailLashTimer = 15000; } else TailLashTimer -= diff; if (WildMagicTimer <= diff) { DoCastAOE(WildMagic[rand32() % 6]); WildMagicTimer = 20000; } else WildMagicTimer -= diff; if (SpectralBlastTimer <= diff) { ThreatContainer::StorageType const& m_threatlist = me->getThreatManager().getThreatList(); std::list<Unit*> targetList; for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) { Unit* target = (*itr)->getTarget(); if (target && target->GetTypeId() == TYPEID_PLAYER && (!target->GetVictim() || target->GetGUID() != me->EnsureVictim()->GetGUID()) && target->GetPositionZ() > me->GetPositionZ() - 5 && !target->HasAura(AURA_SPECTRAL_EXHAUSTION)) { targetList.push_back(target); } } if (targetList.empty()) { SpectralBlastTimer = 1000; return; } std::list<Unit*>::const_iterator i = targetList.begin(); advance(i, rand32() % targetList.size()); if ((*i)) { (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST, true); SpectralBlastTimer = 20000 + rand32() % 5000; } else SpectralBlastTimer = 1000; } else SpectralBlastTimer -= diff; DoMeleeAttackIfReady(); } }
void UpdateAI(uint32 diff) override { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; if (CheckTimer <= diff) { Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID); if (!Kalec || !Kalec->IsAlive()) { if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID); if (Kalecgos && !Kalecgos->IsInCombat()) { EnterEvadeMode(); return; } if (!isBanished && HealthBelowPct(1)) { if (Kalecgos) { if (Kalecgos->HasAura(SPELL_BANISH)) { me->DealDamage(me, me->GetHealth()); return; } DoAction(DO_BANISH); } else { me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); EnterEvadeMode(); return; } } CheckTimer = 1000; } else CheckTimer -= diff; if (ResetThreat <= diff) { ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (unit->GetPositionZ() > me->GetPositionZ() + 5) me->getThreatManager().modifyThreatPercent(unit, -100); } ResetThreat = 1000; } else ResetThreat -= diff; if (ShadowBoltTimer <= diff) { if (!(rand32() % 5)) Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000 + (rand32() % 3000); } else ShadowBoltTimer -= diff; if (AgonyCurseTimer <= diff) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (!target) target = me->GetVictim(); DoCast(target, SPELL_AGONY_CURSE); AgonyCurseTimer = 20000; } else AgonyCurseTimer -= diff; if (CorruptionStrikeTimer <= diff) { if (!(rand32() % 5))Talk(SAY_SATH_SPELL2); DoCastVictim(SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; DoMeleeAttackIfReady(); }
void ExecuteEvent(uint32 eventId) override { switch (eventId) { case EVENT_HAND_OF_DEATH: DoCastAOE(SPELL_HAND_OF_DEATH); events.ScheduleEvent(EVENT_HAND_OF_DEATH, 2000); break; case EVENT_UNLEASH_SOUL_CHARGE: _chargeSpell = 0; _unleashSpell = 0; me->InterruptNonMeleeSpells(false); switch (urand(0, 2)) { case 0: _chargeSpell = SPELL_SOUL_CHARGE_RED; _unleashSpell = SPELL_UNLEASH_SOUL_RED; break; case 1: _chargeSpell = SPELL_SOUL_CHARGE_YELLOW; _unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; break; case 2: _chargeSpell = SPELL_SOUL_CHARGE_GREEN; _unleashSpell = SPELL_UNLEASH_SOUL_GREEN; break; } if (me->HasAura(_chargeSpell)) { me->RemoveAuraFromStack(_chargeSpell); DoCastVictim(_unleashSpell); SoulChargeCount--; events.ScheduleEvent(EVENT_UNLEASH_SOUL_CHARGE, urand(2000, 30000)); } break; case EVENT_FINGER_OF_DEATH: if (!SelectTarget(SELECT_TARGET_RANDOM, 0, 5.0f)) // Checks if there are no targets in melee range { DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); events.ScheduleEvent(EVENT_FINGER_OF_DEATH, 1000); } else events.ScheduleEvent(EVENT_FINGER_OF_DEATH, 5000); break; case EVENT_GRIP_OF_THE_LEGION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_GRIP_OF_THE_LEGION); events.ScheduleEvent(EVENT_GRIP_OF_THE_LEGION, urand(5000, 25000)); break; case EVENT_AIR_BURST: Talk(SAY_AIR_BURST); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_AIR_BURST); //not on tank events.ScheduleEvent(EVENT_AIR_BURST, urand(25000, 40000)); break; case EVENT_FEAR: DoCastAOE(SPELL_FEAR); events.ScheduleEvent(EVENT_FEAR, 42000); break; case EVENT_DOOMFIRE: Talk(SAY_DOOMFIRE); if (Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1)) SummonDoomfire(temp); else SummonDoomfire(me->GetVictim()); events.ScheduleEvent(EVENT_DOOMFIRE, 20000); break; case EVENT_DISTANCE_CHECK: if (Creature* channelTrigger = instance->GetCreature(DATA_CHANNEL_TARGET)) if (me->IsWithinDistInMap(channelTrigger, 75.0f)) DoAction(ACTION_ENRAGE); events.ScheduleEvent(EVENT_DISTANCE_CHECK, 5000); break; case EVENT_SUMMON_WHISP: DoSpawnCreature(NPC_ANCIENT_WISP, float(rand32() % 40), float(rand32() % 40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); ++WispCount; if (WispCount >= 30) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); events.ScheduleEvent(EVENT_SUMMON_WHISP, 1500); break; default: break; } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; // Evade if too far if (check_Timer <= diff) { float x, y, z, o; me->GetHomePosition(x, y, z, o); if (!me->IsWithinDist3d(x, y, z, 60)) { EnterEvadeMode(); return; } check_Timer = 1000; } else check_Timer -= diff; // Spore Striders if (IsHeroic() && SporeStriders_Timer <= diff) { DoCast(me, SPELL_SUMMON_SPORE_STRIDER); SporeStriders_Timer = 10000 + rand32() % 5000; } else SporeStriders_Timer -= diff; // Levitate if (LevitatedTarget) { if (LevitatedTarget_Timer <= diff) { if (Unit* target = ObjectAccessor::GetUnit(*me, LevitatedTarget)) { if (!target->HasAura(SPELL_LEVITATE)) { LevitatedTarget.Clear(); return; } if (InAir) { target->AddAura(SPELL_SUSPENSION, target); LevitatedTarget.Clear(); } else { target->CastSpell(target, SPELL_MAGNETIC_PULL, true); InAir = true; LevitatedTarget_Timer = 1500; } } else LevitatedTarget.Clear(); } else LevitatedTarget_Timer -= diff; } if (Levitate_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) { DoCast(target, SPELL_LEVITATE); LevitatedTarget = target->GetGUID(); LevitatedTarget_Timer = 2000; InAir = false; } Levitate_Timer = 12000 + rand32() % 3000; } else Levitate_Timer -= diff; // Chain Lightning if (ChainLightning_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightning_Timer = 7000; } else ChainLightning_Timer -= diff; // Static Charge if (StaticCharge_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true)) DoCast(target, SPELL_STATIC_CHARGE); StaticCharge_Timer = 10000; } else StaticCharge_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (Delay_Timer <= diff) { Delay_Timer = 3500; Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID); Creature* RightHead = ObjectAccessor::GetCreature(*me, RightHeadGUID); if (!LeftHead || !RightHead) return; if (AggroYell) { RightHead->AI()->Talk(GoCombatDelay[iaggro].id); AggroYell = false; } if (ThreatYell2) { Creature* source = (LeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? LeftHead : RightHead); source->AI()->Talk(ThreatDelay2[ithreat].id); ThreatYell2 = false; } if (ThreatYell) { Creature* source = (LeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? LeftHead : RightHead); source->AI()->Talk(ThreatDelay1[ithreat].id); ThreatYell = false; ThreatYell2 = true; } if (KillingYell) { Creature* source = (LeftHead->GetEntry() == KillingDelay[ikilling].creature ? LeftHead : RightHead); source->AI()->Talk(KillingDelay[ikilling].id); KillingYell = false; } } else Delay_Timer -= diff; if (!UpdateVictim()) return; if (BlastCount && BlastWave_Timer <= diff) { DoCast(me, SPELL_BLAST_WAVE); BlastWave_Timer = 5000; ++BlastCount; if (BlastCount == 3) BlastCount = 0; } else BlastWave_Timer -= diff; if (BurningMaul_Timer <= diff) { Talk(EMOTE_ENRAGE); DoCast(me, SPELL_BURNING_MAUL); BurningMaul_Timer = 40000; BlastWave_Timer = 16000; BlastCount = 1; } else BurningMaul_Timer -= diff; if (ResetThreat_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { DoYellForThreat(); DoResetThreat(); me->AddThreat(target, 0.0f); } ResetThreat_Timer = 25000 + rand32() % 15000; } else ResetThreat_Timer -= diff; if (Fear_Timer <= diff) { DoCast(me, SPELL_FEAR); Fear_Timer = 15000 + rand32() % 20000; } else Fear_Timer -= diff; if (ThunderClap_Timer <= diff) { DoCast(me, SPELL_THUNDERCLAP); ThunderClap_Timer = 15000 + rand32() % 15000; } else ThunderClap_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (IsIntroEvent) { if (instance->GetBossState(DATA_NETHEKURSE) == IN_PROGRESS) { if (IntroEvent_Timer <= diff) DoTauntPeons(); else IntroEvent_Timer -= diff; } } if (!UpdateVictim()) return; if (!IsMainEvent) return; if (Phase) { if (!SpinOnce) { DoCastVictim(SPELL_DARK_SPIN); SpinOnce = true; } if (Cleave_Timer <= diff) { DoCastVictim(SPELL_SHADOW_CLEAVE); Cleave_Timer = 6000 + rand32() % 2500; } else Cleave_Timer -= diff; } else { if (ShadowFissure_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_FISSURE); ShadowFissure_Timer = urand(7500, 15000); } else ShadowFissure_Timer -= diff; if (DeathCoil_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_DEATH_COIL); DeathCoil_Timer = urand(15000, 20000); } else DeathCoil_Timer -= diff; if (!HealthAbovePct(20)) Phase = true; DoMeleeAttackIfReady(); } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; // Pounding if (Pounding_Timer <= diff) { DoCastVictim(SPELL_POUNDING); Talk(SAY_POUNDING); Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000) } else Pounding_Timer -= diff; // Arcane Orb if (ArcaneOrb_Timer <= diff) { Unit* target = NULL; std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); std::vector<Unit*> target_list; for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); if (!target) continue; // exclude pets & totems, 18 yard radius minimum if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false)) target_list.push_back(target); target = NULL; } if (!target_list.empty()) target = *(target_list.begin() + rand32() % target_list.size()); else target = me->GetVictim(); if (target) me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL, 0); ArcaneOrb_Timer = 3000; } else ArcaneOrb_Timer -= diff; // Single Target knock back, reduces aggro if (KnockAway_Timer <= diff) { DoCastVictim(SPELL_KNOCK_AWAY); //Drop 25% aggro if (DoGetThreat(me->GetVictim())) DoModifyThreatPercent(me->GetVictim(), -25); KnockAway_Timer = 30000; } else KnockAway_Timer -= diff; //Berserk if (Berserk_Timer < diff && !Enraged) { DoCast(me, SPELL_BERSERK); Enraged = true; } else Berserk_Timer -= diff; DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(diff); }
static void fill_ctdb_reply_error(TALLOC_CTX *mem_ctx, struct ctdb_reply_error *c) { c->status = rand32(); fill_tdb_data(mem_ctx, &c->msg); }
void HandleStormSequence(Unit* Cloud) // 1: begin, 2-9: tick, 10: end { if (StormCount < 10 && StormCount > 1) { // deal damage int32 bp0 = 800; for (uint8 i = 2; i < StormCount; ++i) bp0 *= 2; CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); Cell cell(p); cell.SetNoCreate(); std::list<Unit*> tempUnitMap; { Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS); Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS); } // deal damage for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i) { if (Unit* target = (*i)) { if (Cloud && !Cloud->IsWithinDist(target, 6, false)) Cloud->CastCustomSpell(target, SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, me->GetGUID()); } } // visual float x, y, z; z = me->GetPositionZ(); uint8 maxCount = 5 + rand32() % 5; for (uint8 i = 0; i < maxCount; ++i) { x = 343.0f + rand32() % 60; y = 1380.0f + rand32() % 60; if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2000)) { trigger->setFaction(35); trigger->SetMaxHealth(100000); trigger->SetHealth(100000); trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Cloud) Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, NULL, NULL, true, 0, 0, Cloud->GetGUID()); } } } ++StormCount; if (StormCount > 10) { StormCount = 0; // finish events.ScheduleEvent(EVENT_SUMMON_EAGLES, 5000); me->InterruptNonMeleeSpells(false); CloudGUID.Clear(); if (Cloud) Cloud->DealDamage(Cloud, Cloud->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); SetWeather(WEATHER_STATE_FINE, 0.0f); isRaining = false; } events.ScheduleEvent(EVENT_STORM_SEQUENCE, 1000); }
WorldSocket::WorldSocket(boost::asio::io_service &service, std::function<void (Socket *)> closeHandler) : Socket(service, closeHandler), m_lastPingTime(std::chrono::system_clock::time_point::min()), m_overSpeedPings(0), m_useExistingHeader(false), m_session(nullptr), m_sessionFinalized(false), m_seed(static_cast<uint32>(rand32())) {}
void UpdateAI(uint32 diff) override { //Return since we have no target if (!UpdateVictim()) return; //Pummel if (Pummel_Timer <= diff) { //Cast if (rand32() % 100 < 90) //90% chance to cast { DoCastVictim(SPELL_PUMMEL); } //12 seconds until we should cast this again Pummel_Timer = 12000; } else Pummel_Timer -= diff; //KnockAway if (KnockAway_Timer <= diff) { //Cast if (rand32() % 100 < 80) //80% chance to cast { DoCastVictim(SPELL_KNOCKAWAY); } //14 seconds until we should cast this again KnockAway_Timer = 14000; } else KnockAway_Timer -= diff; //Shoot if (Shoot_Timer <= diff) { //Cast DoCastVictim(SPELL_SHOOT); //1 seconds until we should cast this again Shoot_Timer = 1000; } else Shoot_Timer -= diff; //SummonRifleman if (SummonRifleman_Timer <= diff) { //Cast switch (rand32() % 9) { case 0: me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_2X, ADD_2Y, ADD_2Z, ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_4X, ADD_4Y, ADD_4Z, ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 1: me->SummonCreature(11054, ADD_2X, ADD_2Y, ADD_2Z, ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_3X, ADD_3Y, ADD_3Z, ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_5X, ADD_5Y, ADD_5Z, ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 2: me->SummonCreature(11054, ADD_3X, ADD_3Y, ADD_3Z, ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_4X, ADD_4Y, ADD_4Z, ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_6X, ADD_6Y, ADD_6Z, ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 3: me->SummonCreature(11054, ADD_4X, ADD_4Y, ADD_4Z, ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_5X, ADD_5Y, ADD_5Z, ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_7X, ADD_7Y, ADD_7Z, ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 4: me->SummonCreature(11054, ADD_5X, ADD_5Y, ADD_5Z, ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_6X, ADD_6Y, ADD_6Z, ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_8X, ADD_8Y, ADD_8Z, ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 5: me->SummonCreature(11054, ADD_6X, ADD_6Y, ADD_6Z, ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_7X, ADD_7Y, ADD_7Z, ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_9X, ADD_9Y, ADD_9Z, ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 6: me->SummonCreature(11054, ADD_7X, ADD_7Y, ADD_7Z, ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_8X, ADD_8Y, ADD_8Z, ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 7: me->SummonCreature(11054, ADD_8X, ADD_8Y, ADD_8Z, ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_9X, ADD_9Y, ADD_9Z, ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_2X, ADD_2Y, ADD_2Z, ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; case 8: me->SummonCreature(11054, ADD_9X, ADD_9Y, ADD_9Z, ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000); me->SummonCreature(11054, ADD_3X, ADD_3Y, ADD_3Z, ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000); break; } //30 seconds until we should cast this again SummonRifleman_Timer = 30000; } else SummonRifleman_Timer -= diff; DoMeleeAttackIfReady(); }
void Reset() override { CastTimer = 2000 + (rand32() % 3000); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) { if (check_Timer <= diff) { if (!me->IsNonMeleeSpellCast(false)) DoCast(me, SPELL_EVOCATION); check_Timer = 5000; } else check_Timer -= diff; return; } if (Firenova) { if (Firenova_Timer <= diff) { DoCast(me, SPELL_FIRE_NOVA, true); Firenova = false; ShadowVolley_Timer = 2000; } else Firenova_Timer -=diff; return; } if (ShadowVolley_Timer <= diff) { DoCast(me, SPELL_SHADOW_BOLT_VOLLEY); ShadowVolley_Timer = 5000 + rand32() % 8000; } else ShadowVolley_Timer -=diff; if (Corruption_Timer <= diff) { DoCast(me, SPELL_CORRUPTION); Corruption_Timer = 30000 + rand32() % 20000; } else Corruption_Timer -=diff; if (BurningNova_Timer <= diff) { if (me->IsNonMeleeSpellCast(false)) me->InterruptNonMeleeSpells(true); Talk(SAY_NOVA); if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA)) { if (Aura* aura = Aura::TryRefreshStackOrCreate(nova, MAX_EFFECT_MASK, me, me)) aura->ApplyForTargets(); } if (IsHeroic()) DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); BurningNova_Timer = 20000 + rand32() % 8000; Firenova_Timer= 5000; Firenova = true; } else BurningNova_Timer -=diff; DoMeleeAttackIfReady(); }
void Shout() { if (rand32() % 100 < 15) Talk(SAY_VALROTH_RAND); }
void Initialize() { ShadowBolt_Timer = 1000 + rand32() % 1000; MarkOfShadow_Timer = 5000 + rand32() % 2000; check_Timer = 0; }
void UpdateAI(uint32 diff) override { if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted) { nextMovementStarted = true; me->GetMotionMaster()->MovePoint(nextWP, WaypointPositions[nextWP]); } if (!UpdateVictim() || !CheckInRoom() || !movementCompleted) return; events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_MARK: if (!(rand32() % 5)) Talk(SAY_SPECIAL); DoCastAOE(SPELL_MARK[id]); events.ScheduleEvent(EVENT_MARK, 15000); break; case EVENT_CAST: if (!(rand32() % 5)) Talk(SAY_TAUNT); if (caster) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) DoCast(target, SPELL_PRIMARY(id)); } else DoCastVictim(SPELL_PRIMARY(id)); events.ScheduleEvent(EVENT_CAST, 15000); break; case EVENT_BERSERK: Talk(SAY_SPECIAL); DoCast(me, EVENT_BERSERK); break; } } if (punishTimer <= diff) { if (doDelayPunish) { DoCastAOE(SPELL_PUNISH[id], true); doDelayPunish = false; } punishTimer = 2000; } else punishTimer -= diff; if (!caster) DoMeleeAttackIfReady(); else if ((!DoSpellAttackIfReady(SPELL_SECONDARY(id)) || !me->IsWithinLOSInMap(me->GetVictim())) && movementCompleted && !doDelayPunish) doDelayPunish = true; }
static void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx, struct ctdb_reply_control_data *cd, uint32_t opcode) { cd->opcode = opcode; switch (opcode) { case CTDB_CONTROL_PROCESS_EXISTS: break; case CTDB_CONTROL_STATISTICS: cd->data.stats = talloc(mem_ctx, struct ctdb_statistics); assert(cd->data.stats != NULL); fill_ctdb_statistics(mem_ctx, cd->data.stats); break; case CTDB_CONTROL_PING: break; case CTDB_CONTROL_GETDBPATH: fill_ctdb_string(mem_ctx, &cd->data.db_path); assert(cd->data.db_path != NULL); break; case CTDB_CONTROL_GETVNNMAP: cd->data.vnnmap = talloc(mem_ctx, struct ctdb_vnn_map); assert(cd->data.vnnmap != NULL); fill_ctdb_vnn_map(mem_ctx, cd->data.vnnmap); break; case CTDB_CONTROL_SETVNNMAP: break; case CTDB_CONTROL_GET_DEBUG: cd->data.loglevel = rand_int(5); break; case CTDB_CONTROL_SET_DEBUG: break; case CTDB_CONTROL_GET_DBMAP: cd->data.dbmap = talloc(mem_ctx, struct ctdb_dbid_map); assert(cd->data.dbmap != NULL); fill_ctdb_dbid_map(mem_ctx, cd->data.dbmap); break; case CTDB_CONTROL_PULL_DB: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_PUSH_DB: break; case CTDB_CONTROL_GET_RECMODE: break; case CTDB_CONTROL_SET_RECMODE: break; case CTDB_CONTROL_STATISTICS_RESET: break; case CTDB_CONTROL_DB_ATTACH: cd->data.db_id = rand32(); break; case CTDB_CONTROL_SET_CALL: break; case CTDB_CONTROL_TRAVERSE_START: break; case CTDB_CONTROL_TRAVERSE_ALL: break; case CTDB_CONTROL_TRAVERSE_DATA: break; case CTDB_CONTROL_REGISTER_SRVID: break; case CTDB_CONTROL_DEREGISTER_SRVID: break; case CTDB_CONTROL_GET_DBNAME: fill_ctdb_string(mem_ctx, &cd->data.db_name); assert(cd->data.db_name); break; case CTDB_CONTROL_ENABLE_SEQNUM: break; case CTDB_CONTROL_UPDATE_SEQNUM: break; case CTDB_CONTROL_DUMP_MEMORY: fill_ctdb_string(mem_ctx, &cd->data.mem_str); assert(cd->data.mem_str); break; case CTDB_CONTROL_GET_PID: break; case CTDB_CONTROL_GET_RECMASTER: break; case CTDB_CONTROL_SET_RECMASTER: break; case CTDB_CONTROL_FREEZE: break; case CTDB_CONTROL_THAW: break; case CTDB_CONTROL_GET_PNN: break; case CTDB_CONTROL_SHUTDOWN: break; case CTDB_CONTROL_GET_MONMODE: break; case CTDB_CONTROL_TCP_CLIENT: break; case CTDB_CONTROL_TCP_ADD: break; case CTDB_CONTROL_TCP_REMOVE: break; case CTDB_CONTROL_STARTUP: break; case CTDB_CONTROL_SET_TUNABLE: break; case CTDB_CONTROL_GET_TUNABLE: cd->data.tun_value = rand32(); break; case CTDB_CONTROL_LIST_TUNABLES: cd->data.tun_var_list = talloc(mem_ctx, struct ctdb_var_list); assert(cd->data.tun_var_list != NULL); fill_ctdb_var_list(mem_ctx, cd->data.tun_var_list); break; case CTDB_CONTROL_MODIFY_FLAGS: break; case CTDB_CONTROL_GET_ALL_TUNABLES: cd->data.tun_list = talloc(mem_ctx, struct ctdb_tunable_list); assert(cd->data.tun_list != NULL); fill_ctdb_tunable_list(mem_ctx, cd->data.tun_list); break; case CTDB_CONTROL_GET_TCP_TICKLE_LIST: cd->data.tickles = talloc(mem_ctx, struct ctdb_tickle_list); assert(cd->data.tickles != NULL); fill_ctdb_tickle_list(mem_ctx, cd->data.tickles); break; case CTDB_CONTROL_SET_TCP_TICKLE_LIST: break; case CTDB_CONTROL_DB_ATTACH_PERSISTENT: break; case CTDB_CONTROL_UPDATE_RECORD: break; case CTDB_CONTROL_SEND_GRATUITOUS_ARP: break; case CTDB_CONTROL_TRANSACTION_START: break; case CTDB_CONTROL_TRANSACTION_COMMIT: break; case CTDB_CONTROL_WIPE_DATABASE: break; case CTDB_CONTROL_UPTIME: cd->data.uptime = talloc(mem_ctx, struct ctdb_uptime); assert(cd->data.uptime != NULL); fill_ctdb_uptime(mem_ctx, cd->data.uptime); break; case CTDB_CONTROL_START_RECOVERY: break; case CTDB_CONTROL_END_RECOVERY: break; case CTDB_CONTROL_RELOAD_NODES_FILE: break; case CTDB_CONTROL_TRY_DELETE_RECORDS: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_ENABLE_MONITOR: break; case CTDB_CONTROL_DISABLE_MONITOR: break; case CTDB_CONTROL_ADD_PUBLIC_IP: break; case CTDB_CONTROL_DEL_PUBLIC_IP: break; case CTDB_CONTROL_RUN_EVENTSCRIPTS: break; case CTDB_CONTROL_GET_CAPABILITIES: cd->data.caps = rand32(); break; case CTDB_CONTROL_START_PERSISTENT_UPDATE: break; case CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE: break; case CTDB_CONTROL_RECD_PING: break; case CTDB_CONTROL_RELEASE_IP: break; case CTDB_CONTROL_TAKEOVER_IP: break; case CTDB_CONTROL_GET_PUBLIC_IPS: cd->data.pubip_list = talloc(mem_ctx, struct ctdb_public_ip_list); assert(cd->data.pubip_list != NULL); fill_ctdb_public_ip_list(mem_ctx, cd->data.pubip_list); break; case CTDB_CONTROL_GET_NODEMAP: cd->data.nodemap = talloc(mem_ctx, struct ctdb_node_map); assert(cd->data.nodemap != NULL); fill_ctdb_node_map(mem_ctx, cd->data.nodemap); break; case CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS: cd->data.script_list = talloc(mem_ctx, struct ctdb_script_list); assert(cd->data.script_list != NULL); fill_ctdb_script_list(mem_ctx, cd->data.script_list); break; case CTDB_CONTROL_TRAVERSE_KILL: break; case CTDB_CONTROL_RECD_RECLOCK_LATENCY: break; case CTDB_CONTROL_GET_RECLOCK_FILE: fill_ctdb_string(mem_ctx, &cd->data.reclock_file); assert(cd->data.reclock_file != NULL); break; case CTDB_CONTROL_SET_RECLOCK_FILE: break; case CTDB_CONTROL_STOP_NODE: break; case CTDB_CONTROL_CONTINUE_NODE: break; case CTDB_CONTROL_SET_LMASTERROLE: break; case CTDB_CONTROL_SET_RECMASTERROLE: break; case CTDB_CONTROL_ENABLE_SCRIPT: break; case CTDB_CONTROL_DISABLE_SCRIPT: break; case CTDB_CONTROL_SET_BAN_STATE: break; case CTDB_CONTROL_GET_BAN_STATE: cd->data.ban_state = talloc(mem_ctx, struct ctdb_ban_state); assert(cd->data.ban_state != NULL); fill_ctdb_ban_state(mem_ctx, cd->data.ban_state); break; case CTDB_CONTROL_SET_DB_PRIORITY: break; case CTDB_CONTROL_GET_DB_PRIORITY: break; case CTDB_CONTROL_TRANSACTION_CANCEL: break; case CTDB_CONTROL_REGISTER_NOTIFY: break; case CTDB_CONTROL_DEREGISTER_NOTIFY: break; case CTDB_CONTROL_TRANS3_COMMIT: break; case CTDB_CONTROL_GET_DB_SEQNUM: cd->data.seqnum = rand64(); break; case CTDB_CONTROL_DB_SET_HEALTHY: break; case CTDB_CONTROL_DB_GET_HEALTH: fill_ctdb_string(mem_ctx, &cd->data.reason); assert(cd->data.reason != NULL); break; case CTDB_CONTROL_GET_PUBLIC_IP_INFO: cd->data.ipinfo = talloc(mem_ctx, struct ctdb_public_ip_info); assert(cd->data.ipinfo != NULL); fill_ctdb_public_ip_info(mem_ctx, cd->data.ipinfo); break; case CTDB_CONTROL_GET_IFACES: cd->data.iface_list = talloc(mem_ctx, struct ctdb_iface_list); assert(cd->data.iface_list != NULL); fill_ctdb_iface_list(mem_ctx, cd->data.iface_list); break; case CTDB_CONTROL_SET_IFACE_LINK_STATE: break; case CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE: break; case CTDB_CONTROL_GET_STAT_HISTORY: cd->data.stats_list = talloc(mem_ctx, struct ctdb_statistics_list); assert(cd->data.stats_list != NULL); fill_ctdb_statistics_list(mem_ctx, cd->data.stats_list); break; case CTDB_CONTROL_SCHEDULE_FOR_DELETION: break; case CTDB_CONTROL_SET_DB_READONLY: break; case CTDB_CONTROL_CHECK_SRVIDS: cd->data.u8_array = talloc(mem_ctx, struct ctdb_uint8_array); assert(cd->data.u8_array != NULL); fill_ctdb_uint8_array(mem_ctx, cd->data.u8_array); break; case CTDB_CONTROL_TRAVERSE_START_EXT: break; case CTDB_CONTROL_GET_DB_STATISTICS: cd->data.dbstats = talloc(mem_ctx, struct ctdb_db_statistics); assert(cd->data.dbstats != NULL); fill_ctdb_db_statistics(mem_ctx, cd->data.dbstats); break; case CTDB_CONTROL_SET_DB_STICKY: break; case CTDB_CONTROL_RELOAD_PUBLIC_IPS: break; case CTDB_CONTROL_TRAVERSE_ALL_EXT: break; case CTDB_CONTROL_RECEIVE_RECORDS: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_IPREALLOCATED: break; case CTDB_CONTROL_GET_RUNSTATE: cd->data.runstate = rand32(); break; case CTDB_CONTROL_DB_DETACH: break; case CTDB_CONTROL_GET_NODES_FILE: cd->data.nodemap = talloc(mem_ctx, struct ctdb_node_map); assert(cd->data.nodemap != NULL); fill_ctdb_node_map(mem_ctx, cd->data.nodemap); break; case CTDB_CONTROL_DB_PULL: cd->data.num_records = rand32(); break; case CTDB_CONTROL_DB_PUSH_CONFIRM: cd->data.num_records = rand32(); break; } }
npc_grimstoneAI(Creature* creature) : EscortAI(creature) { Initialize(); instance = creature->GetInstanceScript(); MobSpawnId = rand32() % 6; }
static void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx, struct ctdb_req_control_data *cd, uint32_t opcode) { cd->opcode = opcode; switch (opcode) { case CTDB_CONTROL_PROCESS_EXISTS: cd->data.pid = rand32(); break; case CTDB_CONTROL_STATISTICS: break; case CTDB_CONTROL_PING: break; case CTDB_CONTROL_GETDBPATH: cd->data.db_id = rand32(); break; case CTDB_CONTROL_GETVNNMAP: break; case CTDB_CONTROL_SETVNNMAP: cd->data.vnnmap = talloc(mem_ctx, struct ctdb_vnn_map); assert(cd->data.vnnmap != NULL); fill_ctdb_vnn_map(mem_ctx, cd->data.vnnmap); break; case CTDB_CONTROL_GET_DEBUG: break; case CTDB_CONTROL_SET_DEBUG: cd->data.loglevel = rand_int(5); break; case CTDB_CONTROL_GET_DBMAP: break; case CTDB_CONTROL_PULL_DB: cd->data.pulldb = talloc(mem_ctx, struct ctdb_pulldb); assert(cd->data.pulldb != NULL); fill_ctdb_pulldb(mem_ctx, cd->data.pulldb); break; case CTDB_CONTROL_PUSH_DB: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_GET_RECMODE: break; case CTDB_CONTROL_SET_RECMODE: cd->data.recmode = rand_int(2); break; case CTDB_CONTROL_STATISTICS_RESET: break; case CTDB_CONTROL_DB_ATTACH: fill_ctdb_string(mem_ctx, &cd->data.db_name); assert(cd->data.db_name != NULL); break; case CTDB_CONTROL_SET_CALL: break; case CTDB_CONTROL_TRAVERSE_START: cd->data.traverse_start = talloc(mem_ctx, struct ctdb_traverse_start); assert(cd->data.traverse_start != NULL); fill_ctdb_traverse_start(mem_ctx, cd->data.traverse_start); break; case CTDB_CONTROL_TRAVERSE_ALL: cd->data.traverse_all = talloc(mem_ctx, struct ctdb_traverse_all); assert(cd->data.traverse_all != NULL); fill_ctdb_traverse_all(mem_ctx, cd->data.traverse_all); break; case CTDB_CONTROL_TRAVERSE_DATA: cd->data.rec_data = talloc(mem_ctx, struct ctdb_rec_data); assert(cd->data.rec_data != NULL); fill_ctdb_rec_data(mem_ctx, cd->data.rec_data); break; case CTDB_CONTROL_REGISTER_SRVID: break; case CTDB_CONTROL_DEREGISTER_SRVID: break; case CTDB_CONTROL_GET_DBNAME: cd->data.db_id = rand32(); break; case CTDB_CONTROL_ENABLE_SEQNUM: cd->data.db_id = rand32(); break; case CTDB_CONTROL_UPDATE_SEQNUM: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DUMP_MEMORY: break; case CTDB_CONTROL_GET_PID: break; case CTDB_CONTROL_GET_RECMASTER: break; case CTDB_CONTROL_SET_RECMASTER: cd->data.recmaster = rand_int(32); break; case CTDB_CONTROL_FREEZE: break; case CTDB_CONTROL_THAW: break; case CTDB_CONTROL_GET_PNN: break; case CTDB_CONTROL_SHUTDOWN: break; case CTDB_CONTROL_GET_MONMODE: break; case CTDB_CONTROL_TCP_CLIENT: cd->data.conn = talloc(mem_ctx, struct ctdb_connection); assert(cd->data.conn != NULL); fill_ctdb_connection(mem_ctx, cd->data.conn); break; case CTDB_CONTROL_TCP_ADD: cd->data.conn = talloc(mem_ctx, struct ctdb_connection); assert(cd->data.conn != NULL); fill_ctdb_connection(mem_ctx, cd->data.conn); break; case CTDB_CONTROL_TCP_REMOVE: cd->data.conn = talloc(mem_ctx, struct ctdb_connection); assert(cd->data.conn != NULL); fill_ctdb_connection(mem_ctx, cd->data.conn); break; case CTDB_CONTROL_STARTUP: break; case CTDB_CONTROL_SET_TUNABLE: cd->data.tunable = talloc(mem_ctx, struct ctdb_tunable); assert(cd->data.tunable != NULL); fill_ctdb_tunable(mem_ctx, cd->data.tunable); break; case CTDB_CONTROL_GET_TUNABLE: fill_ctdb_string(mem_ctx, &cd->data.tun_var); assert(cd->data.tun_var != NULL); break; case CTDB_CONTROL_LIST_TUNABLES: break; case CTDB_CONTROL_MODIFY_FLAGS: cd->data.flag_change = talloc(mem_ctx, struct ctdb_node_flag_change); assert(cd->data.flag_change != NULL); fill_ctdb_node_flag_change(mem_ctx, cd->data.flag_change); break; case CTDB_CONTROL_GET_ALL_TUNABLES: break; case CTDB_CONTROL_GET_TCP_TICKLE_LIST: cd->data.addr = talloc(mem_ctx, ctdb_sock_addr); assert(cd->data.addr != NULL); fill_ctdb_sock_addr(mem_ctx, cd->data.addr); break; case CTDB_CONTROL_SET_TCP_TICKLE_LIST: cd->data.tickles = talloc(mem_ctx, struct ctdb_tickle_list); assert(cd->data.tickles != NULL); fill_ctdb_tickle_list(mem_ctx, cd->data.tickles); break; case CTDB_CONTROL_DB_ATTACH_PERSISTENT: fill_ctdb_string(mem_ctx, &cd->data.db_name); assert(cd->data.db_name != NULL); break; case CTDB_CONTROL_UPDATE_RECORD: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_SEND_GRATUITOUS_ARP: cd->data.addr_info = talloc(mem_ctx, struct ctdb_addr_info); assert(cd->data.addr_info != NULL); fill_ctdb_addr_info(mem_ctx, cd->data.addr_info); break; case CTDB_CONTROL_TRANSACTION_START: cd->data.tid = rand32(); break; case CTDB_CONTROL_TRANSACTION_COMMIT: cd->data.tid = rand32(); break; case CTDB_CONTROL_WIPE_DATABASE: cd->data.transdb = talloc(mem_ctx, struct ctdb_transdb); assert(cd->data.transdb != NULL); fill_ctdb_transdb(mem_ctx, cd->data.transdb); break; case CTDB_CONTROL_UPTIME: break; case CTDB_CONTROL_START_RECOVERY: break; case CTDB_CONTROL_END_RECOVERY: break; case CTDB_CONTROL_RELOAD_NODES_FILE: break; case CTDB_CONTROL_TRY_DELETE_RECORDS: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_ENABLE_MONITOR: break; case CTDB_CONTROL_DISABLE_MONITOR: break; case CTDB_CONTROL_ADD_PUBLIC_IP: cd->data.addr_info = talloc(mem_ctx, struct ctdb_addr_info); assert(cd->data.addr_info != NULL); fill_ctdb_addr_info(mem_ctx, cd->data.addr_info); break; case CTDB_CONTROL_DEL_PUBLIC_IP: cd->data.addr_info = talloc(mem_ctx, struct ctdb_addr_info); assert(cd->data.addr_info != NULL); fill_ctdb_addr_info(mem_ctx, cd->data.addr_info); break; case CTDB_CONTROL_RUN_EVENTSCRIPTS: fill_ctdb_string(mem_ctx, &cd->data.event_str); assert(cd->data.event_str != NULL); break; case CTDB_CONTROL_GET_CAPABILITIES: break; case CTDB_CONTROL_START_PERSISTENT_UPDATE: break; case CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE: break; case CTDB_CONTROL_RECD_PING: break; case CTDB_CONTROL_RELEASE_IP: cd->data.pubip = talloc(mem_ctx, struct ctdb_public_ip); assert(cd->data.pubip != NULL); fill_ctdb_public_ip(mem_ctx, cd->data.pubip); break; case CTDB_CONTROL_TAKEOVER_IP: cd->data.pubip = talloc(mem_ctx, struct ctdb_public_ip); assert(cd->data.pubip != NULL); fill_ctdb_public_ip(mem_ctx, cd->data.pubip); break; case CTDB_CONTROL_GET_PUBLIC_IPS: break; case CTDB_CONTROL_GET_NODEMAP: break; case CTDB_CONTROL_GET_EVENT_SCRIPT_STATUS: cd->data.event = rand_int(CTDB_EVENT_MAX); break; case CTDB_CONTROL_TRAVERSE_KILL: cd->data.traverse_start = talloc(mem_ctx, struct ctdb_traverse_start); assert(cd->data.traverse_start != NULL); fill_ctdb_traverse_start(mem_ctx, cd->data.traverse_start); break; case CTDB_CONTROL_RECD_RECLOCK_LATENCY: cd->data.reclock_latency = rand_double(); break; case CTDB_CONTROL_GET_RECLOCK_FILE: break; case CTDB_CONTROL_SET_RECLOCK_FILE: fill_ctdb_string(mem_ctx, &cd->data.reclock_file); assert(cd->data.reclock_file != NULL); break; case CTDB_CONTROL_STOP_NODE: break; case CTDB_CONTROL_CONTINUE_NODE: break; case CTDB_CONTROL_SET_LMASTERROLE: cd->data.role = rand_int(2); break; case CTDB_CONTROL_SET_RECMASTERROLE: cd->data.role = rand_int(2); break; case CTDB_CONTROL_ENABLE_SCRIPT: fill_ctdb_string(mem_ctx, &cd->data.script); assert(cd->data.script != NULL); break; case CTDB_CONTROL_DISABLE_SCRIPT: fill_ctdb_string(mem_ctx, &cd->data.script); assert(cd->data.script != NULL); break; case CTDB_CONTROL_SET_BAN_STATE: cd->data.ban_state = talloc(mem_ctx, struct ctdb_ban_state); assert(cd->data.ban_state != NULL); fill_ctdb_ban_state(mem_ctx, cd->data.ban_state); break; case CTDB_CONTROL_GET_BAN_STATE: break; case CTDB_CONTROL_SET_DB_PRIORITY: cd->data.db_prio = talloc(mem_ctx, struct ctdb_db_priority); assert(cd->data.db_prio != NULL); fill_ctdb_db_priority(mem_ctx, cd->data.db_prio); break; case CTDB_CONTROL_GET_DB_PRIORITY: cd->data.db_prio = talloc(mem_ctx, struct ctdb_db_priority); assert(cd->data.db_prio != NULL); fill_ctdb_db_priority(mem_ctx, cd->data.db_prio); break; case CTDB_CONTROL_TRANSACTION_CANCEL: break; case CTDB_CONTROL_REGISTER_NOTIFY: cd->data.notify = talloc(mem_ctx, struct ctdb_notify_data); assert(cd->data.notify != NULL); fill_ctdb_notify_data(mem_ctx, cd->data.notify); break; case CTDB_CONTROL_DEREGISTER_NOTIFY: cd->data.srvid = rand64(); break; case CTDB_CONTROL_TRANS3_COMMIT: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_GET_DB_SEQNUM: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DB_SET_HEALTHY: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DB_GET_HEALTH: cd->data.db_id = rand32(); break; case CTDB_CONTROL_GET_PUBLIC_IP_INFO: cd->data.addr = talloc(mem_ctx, ctdb_sock_addr); assert(cd->data.addr != NULL); fill_ctdb_sock_addr(mem_ctx, cd->data.addr); break; case CTDB_CONTROL_GET_IFACES: break; case CTDB_CONTROL_SET_IFACE_LINK_STATE: cd->data.iface = talloc(mem_ctx, struct ctdb_iface); assert(cd->data.iface != NULL); fill_ctdb_iface(mem_ctx, cd->data.iface); break; case CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE: cd->data.conn = talloc(mem_ctx, struct ctdb_connection); assert(cd->data.conn != NULL); fill_ctdb_connection(mem_ctx, cd->data.conn); break; case CTDB_CONTROL_GET_STAT_HISTORY: break; case CTDB_CONTROL_SCHEDULE_FOR_DELETION: cd->data.key = talloc(mem_ctx, struct ctdb_key_data); assert(cd->data.key != NULL); fill_ctdb_key_data(mem_ctx, cd->data.key); break; case CTDB_CONTROL_SET_DB_READONLY: cd->data.db_id = rand32(); break; case CTDB_CONTROL_CHECK_SRVIDS: cd->data.u64_array = talloc(mem_ctx, struct ctdb_uint64_array); assert(cd->data.u64_array != NULL); fill_ctdb_uint64_array(mem_ctx, cd->data.u64_array); break; case CTDB_CONTROL_TRAVERSE_START_EXT: cd->data.traverse_start_ext = talloc(mem_ctx, struct ctdb_traverse_start_ext); assert(cd->data.traverse_start_ext != NULL); fill_ctdb_traverse_start_ext(mem_ctx, cd->data.traverse_start_ext); break; case CTDB_CONTROL_GET_DB_STATISTICS: cd->data.db_id = rand32(); break; case CTDB_CONTROL_SET_DB_STICKY: cd->data.db_id = rand32(); break; case CTDB_CONTROL_RELOAD_PUBLIC_IPS: break; case CTDB_CONTROL_TRAVERSE_ALL_EXT: cd->data.traverse_all_ext = talloc(mem_ctx, struct ctdb_traverse_all_ext); assert(cd->data.traverse_all_ext != NULL); fill_ctdb_traverse_all_ext(mem_ctx, cd->data.traverse_all_ext); break; case CTDB_CONTROL_RECEIVE_RECORDS: cd->data.recbuf = talloc(mem_ctx, struct ctdb_rec_buffer); assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; case CTDB_CONTROL_IPREALLOCATED: break; case CTDB_CONTROL_GET_RUNSTATE: break; case CTDB_CONTROL_DB_DETACH: cd->data.db_id = rand32(); break; case CTDB_CONTROL_GET_NODES_FILE: break; case CTDB_CONTROL_DB_FREEZE: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DB_THAW: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DB_TRANSACTION_START: cd->data.transdb = talloc(mem_ctx, struct ctdb_transdb); assert(cd->data.transdb != NULL); fill_ctdb_transdb(mem_ctx, cd->data.transdb); break; case CTDB_CONTROL_DB_TRANSACTION_COMMIT: cd->data.transdb = talloc(mem_ctx, struct ctdb_transdb); assert(cd->data.transdb != NULL); fill_ctdb_transdb(mem_ctx, cd->data.transdb); break; case CTDB_CONTROL_DB_TRANSACTION_CANCEL: cd->data.db_id = rand32(); break; case CTDB_CONTROL_DB_PULL: cd->data.pulldb_ext = talloc(mem_ctx, struct ctdb_pulldb_ext); assert(cd->data.pulldb_ext != NULL); fill_ctdb_pulldb_ext(mem_ctx, cd->data.pulldb_ext); break; case CTDB_CONTROL_DB_PUSH_START: cd->data.pulldb_ext = talloc(mem_ctx, struct ctdb_pulldb_ext); assert(cd->data.pulldb_ext != NULL); fill_ctdb_pulldb_ext(mem_ctx, cd->data.pulldb_ext); break; case CTDB_CONTROL_DB_PUSH_CONFIRM: cd->data.db_id = rand32(); break; } }
static void sanitise_setuid(int childno) { shm->syscall[childno].a1 = rand32(); }
static void fill_ctdb_reply_call(TALLOC_CTX *mem_ctx, struct ctdb_reply_call *c) { c->status = rand32(); fill_tdb_data(mem_ctx, &c->data); }
void UpdateAI(uint32 diff) override { //Check if we have a target if (!UpdateVictim()) { //No target so we'll use this section to do our random wispers instance wide //WisperTimer if (WisperTimer <= diff) { //Play random sound to the zone Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) me->PlayDirectSound(RANDOM_SOUND_WHISPER, itr->GetSource()); //One random wisper every 90 - 300 seconds WisperTimer = urand(90000, 300000); } else WisperTimer -= diff; return; } me->SetTarget(ObjectGuid::Empty); uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE); if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) { // EyeTentacleTimer if (EyeTentacleTimer <= diff) { //Spawn the 8 Eye Tentacles in the corret spots SpawnEyeTentacle(0, 20); //south SpawnEyeTentacle(10, 10); //south west SpawnEyeTentacle(20, 0); //west SpawnEyeTentacle(10, -10); //north west SpawnEyeTentacle(0, -20); //north SpawnEyeTentacle(-10, -10); //north east SpawnEyeTentacle(-20, 0); // east SpawnEyeTentacle(-10, 10); // south east EyeTentacleTimer = 30000; // every 30sec in phase 2 } else EyeTentacleTimer -= diff; } switch (currentPhase) { //Transition phase case PHASE_CTHUN_TRANSITION: //PhaseTimer if (PhaseTimer <= diff) { //Switch instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Switch to c'thun model me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_TRANSFORM, false); me->SetFullHealth(); me->SetVisible(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase //AttackStart(ObjectAccessor::GetUnit(*me, HoldpPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach Stomach_Map.clear(); for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) Stomach_Map[(*i)->getUnitGuid()] = false; //Outside stomach //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; //Body Phase case PHASE_CTHUN_STOMACH: //Remove Target field me->SetTarget(ObjectGuid::Empty); //Weaken if (FleshTentaclesKilled > 1) { instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); Talk(EMOTE_WEAKENED); PhaseTimer = 45000; DoCast(me, SPELL_PURPLE_COLORATION, true); std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* unit = ObjectAccessor::GetUnit(*me, i->first); //Only move units in stomach if (unit && i->second == true) { //Teleport each player out DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10, float(rand32() % 6)); //Cast knockback on them DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } ++i; } return; } //Stomach acid if (StomachAcidTimer <= diff) { //Apply aura to all players in stomach std::unordered_map<ObjectGuid, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { //Check for valid player Unit* unit = ObjectAccessor::GetUnit(*me, i->first); //Only apply to units in stomach if (unit && i->second == true) { //Cast digestive acid on them DoCast(unit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach if (unit->IsWithinDist3d(&KickPos, 15.0f)) { //Teleport each player out DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10, float(rand32() % 6)); //Cast knockback on them DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } } ++i; } StomachAcidTimer = 4000; } else StomachAcidTimer -= diff; //Stomach Enter Timer if (StomachEnterTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Set target in stomach Stomach_Map[target->GetGUID()] = true; target->InterruptNonMeleeSpells(false); target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } StomachEnterTimer = 13800; } else StomachEnterTimer -= diff; if (StomachEnterVisTimer && !StomachEnterTarget.IsEmpty()) { if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* unit = ObjectAccessor::GetUnit(*me, StomachEnterTarget); if (unit) { DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget.Clear(); StomachEnterVisTimer = 0; } else StomachEnterVisTimer -= diff; } //GientClawTentacleTimer if (GiantClawTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(NPC_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; } else GiantClawTentacleTimer -= diff; //GiantEyeTentacleTimer if (GiantEyeTentacleTimer <= diff) { if (Unit* target = SelectRandomNotStomach()) { //Spawn claw tentacle on the random target if (Creature* spawned = me->SummonCreature(NPC_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) if (spawned->AI()) spawned->AI()->AttackStart(target); } //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; } else GiantEyeTentacleTimer -= diff; break; //Weakened state case PHASE_CTHUN_WEAK: //PhaseTimer if (PhaseTimer <= diff) { //Switch instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); //Remove purple coloration me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { Creature* spawned = me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); if (!spawned) ++FleshTentaclesKilled; } PhaseTimer = 0; } else PhaseTimer -= diff; break; } }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (AppearDelay) { me->StopMoving(); me->AttackStop(); if (AppearDelay_Timer <= diff) { AppearDelay = false; if (Phase == 2) { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(false); } AppearDelay_Timer = 2000; } else AppearDelay_Timer -= diff; } if (Phase == 1) { if (BlindingLight_Timer <= diff) { BlindingLight = true; BlindingLight_Timer = 45000; } else BlindingLight_Timer -= diff; if (Wrath_Timer <= diff) { me->InterruptNonMeleeSpells(false); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER, true); Wrath_Timer = 20000 + rand32() % 5000; } else Wrath_Timer -= diff; if (ArcaneMissiles_Timer <= diff) { if (BlindingLight) { DoCastVictim(SPELL_BLINDING_LIGHT); BlindingLight = false; } else { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { if (!me->HasInArc(2.5f, target)) target = me->GetVictim(); DoCast(target, SPELL_ARCANE_MISSILES); } } ArcaneMissiles_Timer = 3000; } else ArcaneMissiles_Timer -= diff; if (m_uiWrathOfTheAstromancer_Timer <= diff) { me->InterruptNonMeleeSpells(false); //Target the tank ? if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) { if (target->GetTypeId() == TYPEID_PLAYER) { DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER); m_uiWrathOfTheAstromancer_Timer = 25000; } else m_uiWrathOfTheAstromancer_Timer = 1000; } } else m_uiWrathOfTheAstromancer_Timer -= diff; //Phase1_Timer if (Phase1_Timer <= diff) { Phase = 2; Phase1_Timer = 50000; //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. me->GetMotionMaster()->Clear(); me->SetPosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); for (uint8 i=0; i <= 2; ++i) { if (!i) { Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS); Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS); Portals[i][2] = CENTER_Z; } else { Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS); Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS); Portals[i][2] = PORTAL_Z; } } if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7)) { int i = 1; if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7) i = -1; Portals[2][0] = Portals[2][0]+7*i; Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS); } for (int i = 0; i <= 2; ++i) { if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer+Phase3_Timer+AppearDelay_Timer+1700)) { Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false); } } AppearDelay = true; } else Phase1_Timer-=diff; } else if (Phase == 2) { //10 seconds after Solarian disappears, 12 mobs spawn out of the three portals. me->AttackStop(); me->StopMoving(); if (Phase2_Timer <= diff) { Phase = 3; for (int i=0; i <= 2; ++i) for (int j=1; j <= 4; j++) SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]); Talk(SAY_SUMMON1); Phase2_Timer = 10000; } else Phase2_Timer -= diff; } else if (Phase == 3) { me->AttackStop(); me->StopMoving(); //Check Phase3_Timer if (Phase3_Timer <= diff) { Phase = 1; //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals. int i = rand32() % 3; me->GetMotionMaster()->Clear(); me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O); for (int j=0; j <= 2; j++) if (j != i) SummonMinion(NPC_SOLARIUM_PRIEST, Portals[j][0], Portals[j][1], Portals[j][2]); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); Talk(SAY_SUMMON2); AppearDelay = true; Phase3_Timer = 15000; } else Phase3_Timer -= diff; } else if (Phase == 4) { //Fear_Timer if (Fear_Timer <= diff) { DoCast(me, SPELL_FEAR); Fear_Timer = 20000; } else Fear_Timer -= diff; //VoidBolt_Timer if (VoidBolt_Timer <= diff) { DoCastVictim(SPELL_VOID_BOLT); VoidBolt_Timer = 10000; } else VoidBolt_Timer -= diff; } //When Solarian reaches 20% she will transform into a huge void walker. if (Phase != 4 && me->HealthBelowPct(20)) { Phase = 4; //To make sure she wont be invisible or not selecatble me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); Talk(SAY_VOIDA); Talk(SAY_VOIDB); me->SetArmor(WV_ARMOR); me->SetDisplayId(MODEL_VOIDWALKER); me->SetObjectScale(defaultsize*2.5f); } DoMeleeAttackIfReady(); }