diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-07-22 21:43:19 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-07-22 21:43:19 +0200 |
| commit | 3388587b7a2ded9333ab48ce4d02372d750a60fe (patch) | |
| tree | 04adaaa84bd21e4693ebb5492125468504f9faae /src/server/scripts/EasternKingdoms | |
| parent | 0b236d480a9ff5e75da966e50c144d3bcce9b1fa (diff) | |
Core/Misc: Replace rand() calls with SFMT
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
32 files changed, 112 insertions, 135 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 3eab75cfd76..907aaed3a0d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -125,7 +125,7 @@ public: npc_grimstoneAI(Creature* creature) : npc_escortAI(creature) { instance = creature->GetInstanceScript(); - MobSpawnId = rand()%6; + MobSpawnId = rand32() % 6; } InstanceScript* instance; @@ -175,7 +175,7 @@ public: /// @todo move them to center void SummonRingBoss() { - if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0)) + if (Creature* tmp = me->SummonCreature(RingBoss[rand32() % 6], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0)) RingBossGUID = tmp->GetGUID(); MobDeath_Timer = 2500; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index 23a7cb10dd8..262befdd3ec 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -419,7 +419,7 @@ public: void KilledUnit(Unit* victim) override { - if (rand()%5) + if (rand32() % 5) return; Talk(SAY_SLAY, victim); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp index bbe70947901..e3085854f4a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp @@ -111,7 +111,7 @@ public: void KilledUnit(Unit* victim) override { - if (rand()%5) + if (rand32() % 5) return; Talk(SAY_KILLTARGET, victim); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 06c523dfabb..9fe21313f71 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -136,7 +136,7 @@ public: if (AddTimer <= diff) { //Summon Astral Flare - Creature* AstralFlare = DoSpawnCreature(17096, float(rand()%37), float(rand()%37), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + Creature* AstralFlare = DoSpawnCreature(17096, float(rand32() % 37), float(rand32() % 37), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 2e29c68e2ce..04b58af2a4a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -64,9 +64,9 @@ public: void Reset() override { - Repentance_Timer = 25000+(rand()%15000); - Holyfire_Timer = 8000+(rand()%17000); - Holywrath_Timer = 15000+(rand()%10000); + Repentance_Timer = 25000 + (rand32() % 15000); + Holyfire_Timer = 8000 + (rand32() % 17000); + Holywrath_Timer = 15000 + (rand32() % 10000); Holyground_Timer = 3000; Enrage_Timer = 600000; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index b130ac74be3..d812a8e3001 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -294,7 +294,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(uint32 diff) target = NULL; } if (!target_list.empty()) - target = *(target_list.begin()+rand()%target_list.size()); + target = *(target_list.begin() + rand32() % target_list.size()); DoCast(target, SPELL_BERSERKER_CHARGE); ChargeTimer = 20000; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 0ca7ee90986..411ebed869d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -358,7 +358,7 @@ struct boss_moroes_guestAI : public ScriptedAI Unit* SelectGuestTarget() { - uint64 TempGUID = GuestGUID[rand()%4]; + uint64 TempGUID = GuestGUID[rand32() % 4]; if (TempGUID) { Unit* unit = ObjectAccessor::GetUnit(*me, TempGUID); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 010b7223f97..e495cae71fc 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -140,7 +140,7 @@ public: void SummonPortals() { - uint8 r = rand()%4; + uint8 r = rand32() % 4; uint8 pos[3]; pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0); pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1)); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index befe72a6403..e6c544aa0a0 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -322,7 +322,7 @@ public: //cut down to size if we have more than 5 targets while (targets.size() > 5) - targets.erase(targets.begin()+rand()%targets.size()); + targets.erase(targets.begin() + rand32() % targets.size()); uint32 i = 0; for (std::vector<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 9bda41b03a1..6a89adca967 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -131,7 +131,7 @@ public: BerserkTimer = 720000; CloseDoorTimer = 15000; - LastSuperSpell = rand()%3; + LastSuperSpell = rand32() % 3; FlameWreathTimer = 0; FlameWreathCheckTime = 0; @@ -192,7 +192,7 @@ public: //cut down to size if we have more than 3 targets while (targets.size() > 3) - targets.erase(targets.begin()+rand()%targets.size()); + targets.erase(targets.begin() + rand32() % targets.size()); uint32 i = 0; for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr) @@ -322,7 +322,7 @@ public: //If no available spells wait 1 second and try again if (AvailableSpells) { - CurrentNormalSpell = Spells[rand() % AvailableSpells]; + CurrentNormalSpell = Spells[rand32() % AvailableSpells]; DoCast(target, CurrentNormalSpell); } } @@ -514,7 +514,7 @@ public: void Reset() override { - CastTimer = 2000 + (rand()%3000); + CastTimer = 2000 + (rand32() % 3000); } void EnterCombat(Unit* /*who*/) override { } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index c0e6a8d3b90..dd5ad8ee7ae 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -350,7 +350,7 @@ public: void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) override { - if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) + if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand32() % 10))) { /* if (not direct damage(aoe, dot)) diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 2af9d9b1567..45fd9fed60a 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -195,7 +195,7 @@ public: //remove random entries while (LackeyEntryList.size() > MAX_ACTIVE_LACKEY) - LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); + LackeyEntryList.erase(LackeyEntryList.begin() + rand32() % LackeyEntryList.size()); //summon all the remaining in vector for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) @@ -287,7 +287,7 @@ public: Unit* target = me; if (urand(0, 1)) - if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand32() % MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive()) target = pAdd; @@ -300,7 +300,7 @@ public: Unit* target = me; if (urand(0, 1)) - if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand32() % MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive() && !pAdd->HasAura(SPELL_SHIELD)) target = pAdd; @@ -319,7 +319,7 @@ public: if (urand(0, 1)) target = me; else - if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[rand32() % MAX_ACTIVE_LACKEY])) if (pAdd->IsAlive()) target = pAdd; } @@ -1167,17 +1167,8 @@ public: if (Healing_Wave_Timer <= diff) { - // std::vector<Add*>::const_iterator itr = Group.begin() + rand()%Group.size(); - // uint64 guid = (*itr)->guid; - // if (guid) - // { - // Unit* pAdd = ObjectAccessor::GetUnit(*me, (*itr)->guid); - // if (pAdd && pAdd->IsAlive()) - // { DoCast(me, SPELL_LESSER_HEALING_WAVE); Healing_Wave_Timer = 5000; - // } - // } } else Healing_Wave_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 09377f20bed..8e3743ad5e2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -514,7 +514,7 @@ public: void Shout() { - if (rand()%100 < 15) + if (rand32() % 100 < 15) Talk(SAY_VALROTH_RAND); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 40773c87b68..2800e9473b7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -669,7 +669,7 @@ public: uiPhase_timer = 500; if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) { - Unit* temp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + Unit* temp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->SetWalk(false); temp->setFaction(2084); uiGhoulGUID[uiSummon_counter] = temp->GetGUID(); @@ -687,7 +687,7 @@ public: uiPhase_timer = 500; if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) { - Unit* temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + Unit* temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->SetWalk(false); temp->setFaction(2084); uiAbominationGUID[uiSummon_counter] = temp->GetGUID(); @@ -705,7 +705,7 @@ public: uiPhase_timer = 500; if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) { - Unit* temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + Unit* temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->SetWalk(false); temp->setFaction(2084); uiWarriorGUID[uiSummon_counter] = temp->GetGUID(); @@ -723,7 +723,7 @@ public: uiPhase_timer = 500; if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) { - Unit* temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + Unit* temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX() - 20) + rand32() % 40, (me->GetPositionY() - 20) + rand32() % 40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->SetWalk(false); temp->setFaction(2084); uiBehemothGUID[uiSummon_counter] = temp->GetGUID(); @@ -746,30 +746,30 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); } for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); JumpToNextStep(5000); break; @@ -1016,7 +1016,7 @@ public: if (fLichPositionX && fLichPositionY) { - Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); @@ -1024,7 +1024,7 @@ public: temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); uiDefenderGUID[0] = temp->GetGUID(); - temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); @@ -1088,13 +1088,13 @@ public: { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[0])) { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z); } JumpToNextStep(3000); break; @@ -1556,7 +1556,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiGhoulGUID[i] = temp->GetGUID(); } @@ -1566,7 +1566,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiAbominationGUID[i] = temp->GetGUID(); } @@ -1576,7 +1576,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiWarriorGUID[i] = temp->GetGUID(); } @@ -1586,7 +1586,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiBehemothGUID[i] = temp->GetGUID(); } @@ -1598,7 +1598,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiDefenderGUID[i] = temp->GetGUID(); @@ -1609,7 +1609,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiEarthshatterGUID[i] = temp->GetGUID(); @@ -1618,7 +1618,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID); if (!temp) { - temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiKorfaxGUID = temp->GetGUID(); @@ -1626,7 +1626,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID); if (!temp) { - temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiMaxwellGUID = temp->GetGUID(); @@ -1634,7 +1634,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiEligorGUID); if (!temp) { - temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiEligorGUID = temp->GetGUID(); @@ -1642,7 +1642,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiRayneGUID); if (!temp) { - temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiRayneGUID = temp->GetGUID(); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 0be681af915..e169e521d0b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -546,7 +546,7 @@ public: if (!temp.empty()) { std::list<Player*>::const_iterator j = temp.begin(); - advance(j, rand()%temp.size()); + advance(j, rand32() % temp.size()); return (*j); } return NULL; @@ -619,7 +619,7 @@ public: me->SetName("Headless Horseman, Unhorsed"); if (!headGUID) - headGUID = DoSpawnCreature(HEAD, float(rand()%6), float(rand()%6), 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->GetGUID(); + headGUID = DoSpawnCreature(HEAD, float(rand32() % 6), float(rand32() % 6), 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->GetGUID(); Unit* Head = ObjectAccessor::GetUnit(*me, headGUID); if (Head && Head->IsAlive()) @@ -720,7 +720,7 @@ public: { laugh = urand(11000, 22000); me->MonsterTextEmote(EMOTE_LAUGHS, NULL); - DoPlaySoundToSet(me, RandomLaugh[rand()%3]); + DoPlaySoundToSet(me, RandomLaugh[rand32() % 3]); } else laugh -= diff; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index 916d321a7f0..de54e87fc97 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -134,14 +134,14 @@ public: { DoCastVictim(SPELL_CLEAVE); //13 seconds until we should cast this again - Cleave_Timer = 7000 + (rand()%10000); + Cleave_Timer = 7000 + (rand32() % 10000); } else Cleave_Timer -= diff; //MortalStrike if (MortalStrike_Timer <= diff) { DoCastVictim(SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000 + (rand()%15000); + MortalStrike_Timer = 10000 + (rand32() % 15000); } else MortalStrike_Timer -= diff; //RaiseDead diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index 5f9c5075250..a3eb66ac23c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -84,7 +84,7 @@ public: //BansheeWail if (BansheeWail_Timer <= diff) { - if (rand()%100 < 95) + if (rand32() % 100 < 95) DoCastVictim(SPELL_BANSHEEWAIL); //4 seconds until we should cast this again BansheeWail_Timer = 4000; @@ -93,7 +93,7 @@ public: //BansheeCurse if (BansheeCurse_Timer <= diff) { - if (rand()%100 < 75) + if (rand32() % 100 < 75) DoCastVictim(SPELL_BANSHEECURSE); //18 seconds until we should cast this again BansheeCurse_Timer = 18000; @@ -102,27 +102,12 @@ public: //Silence if (Silence_Timer <= diff) { - if (rand()%100 < 80) + if (rand32() % 100 < 80) DoCastVictim(SPELL_SILENCE); //13 seconds until we should cast this again Silence_Timer = 13000; } else Silence_Timer -= diff; - //Possess - /* if (Possess_Timer <= diff) - { - //Cast - if (rand()%100 < 65) - { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (target)DoCast(target, SPELL_POSSESS); - } - //50 seconds until we should cast this again - Possess_Timer = 50000; - } else Possess_Timer -= diff; - */ - DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index 65b2fb25525..14d2a9a9f26 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -132,7 +132,7 @@ public: if (Pummel_Timer <= diff) { //Cast - if (rand()%100 < 90) //90% chance to cast + if (rand32() % 100 < 90) //90% chance to cast { DoCastVictim(SPELL_PUMMEL); } @@ -144,7 +144,7 @@ public: if (KnockAway_Timer <= diff) { //Cast - if (rand()%100 < 80) //80% chance to cast + if (rand32() % 100 < 80) //80% chance to cast { DoCastVictim(SPELL_KNOCKAWAY); } @@ -165,7 +165,7 @@ public: if (SummonRifleman_Timer <= diff) { //Cast - switch (rand()%9) + switch (rand32() % 9) { case 0: me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 5910905b6b5..b3fae9821aa 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -84,7 +84,7 @@ public: //Frostbolt if (Frostbolt_Timer <= diff) { - if (rand()%100 < 90) + if (rand32() % 100 < 90) DoCastVictim(SPELL_FROSTBOLT); Frostbolt_Timer = 3500; } else Frostbolt_Timer -= diff; @@ -92,7 +92,7 @@ public: //IceTomb if (IceTomb_Timer <= diff) { - if (rand()%100 < 65) + if (rand32() % 100 < 65) DoCastVictim(SPELL_ICETOMB); IceTomb_Timer = 28000; } else IceTomb_Timer -= diff; @@ -100,7 +100,7 @@ public: //DrainLife if (DrainLife_Timer <= diff) { - if (rand()%100 < 55) + if (rand32() % 100 < 55) DoCastVictim(SPELL_DRAINLIFE); DrainLife_Timer = 31000; } else DrainLife_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 9c129984ae4..f5ca0a42fad 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -92,27 +92,27 @@ class boss_postmaster_malown : public CreatureScript switch (eventId) { case EVENT_WAILINGDEAD: - if (rand()%100 < 65) //65% chance to cast + if (rand32() % 100 < 65) //65% chance to cast DoCastVictim(SPELL_WAILINGDEAD, true); events.ScheduleEvent(EVENT_WAILINGDEAD, 19000); break; case EVENT_BACKHAND: - if (rand()%100 < 45) //45% chance to cast + if (rand32() % 100 < 45) //45% chance to cast DoCastVictim(SPELL_BACKHAND, true); events.ScheduleEvent(EVENT_WAILINGDEAD, 8000); break; case EVENT_CURSEOFWEAKNESS: - if (rand()%100 < 3) //3% chance to cast + if (rand32() % 100 < 3) //3% chance to cast DoCastVictim(SPELL_CURSEOFWEAKNESS, true); events.ScheduleEvent(EVENT_WAILINGDEAD, 20000); break; case EVENT_CURSEOFTONGUES: - if (rand()%100 < 3) //3% chance to cast + if (rand32() % 100 < 3) //3% chance to cast DoCastVictim(SPELL_CURSEOFTONGUES, true); events.ScheduleEvent(EVENT_WAILINGDEAD, 22000); break; case EVENT_CALLOFTHEGRAVE: - if (rand()%100 < 5) //5% chance to cast + if (rand32() % 100 < 5) //5% chance to cast DoCastVictim(SPELL_CALLOFTHEGRAVE, true); events.ScheduleEvent(EVENT_WAILINGDEAD, 25000); break; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 8fc749dc43b..3701d37ed7f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -136,7 +136,7 @@ public: void KilledUnit(Unit* /*victim*/) override { - if (rand()%4 == 0) + if (rand32() % 4 == 0) Talk(YELL_SAC_KILL); } @@ -222,7 +222,7 @@ public: me->InterruptSpell(CURRENT_GENERIC_SPELL); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); + ConflagrationTimer = 30000 + (rand32() % 5000); } } else ConflagrationTimer -= diff; } @@ -242,7 +242,7 @@ public: Talk(EMOTE_SHADOW_NOVA, target); Talk(YELL_SHADOW_NOVA); } - ShadownovaTimer = 30000+(rand()%5000); + ShadownovaTimer = 30000 + (rand32() % 5000); } } else ShadownovaTimer -=diff; } @@ -253,7 +253,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFOUNDING_BLOW); - ConfoundingblowTimer = 20000 + (rand()%5000); + ConfoundingblowTimer = 20000 + (rand32() % 5000); } } else ConfoundingblowTimer -=diff; @@ -407,7 +407,7 @@ public: void KilledUnit(Unit* /*victim*/) override { - if (rand()%4 == 0) + if (rand32() % 4 == 0) Talk(YELL_ALY_KILL); } @@ -552,7 +552,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_NOVA); - ShadownovaTimer= 30000+(rand()%5000); + ShadownovaTimer = 30000 + (rand32() % 5000); } } else ShadownovaTimer -=diff; } @@ -566,7 +566,7 @@ public: Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); + ConflagrationTimer = 30000 + (rand32() % 5000); if (!SisterDeath) { @@ -644,7 +644,7 @@ public: void Reset() override { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - ShadowfuryTimer = 5000 + (rand()%15000); + ShadowfuryTimer = 5000 + (rand32() % 15000); DarkstrikeTimer = 3000; KillTimer = 15000; } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 8a9699ed1be..120d3a0b231 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -288,7 +288,7 @@ public: return; } - if (Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + if (Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX() - 5 + rand32() % 10, target->GetPositionY() - 5 + rand32() % 10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) { Vapor->AI()->AttackStart(target); me->InterruptNonMeleeSpells(false); @@ -315,7 +315,7 @@ public: } //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support - if (Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + if (Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX() - 5 + rand32() % 10, target->GetPositionY() - 5 + rand32() % 10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) { if (pVapor->AI()) pVapor->AI()->AttackStart(target); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index d300703152c..9c83b038545 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -285,7 +285,7 @@ public: if (WildMagicTimer <= diff) { - DoCastAOE(WildMagic[rand()%6]); + DoCastAOE(WildMagic[rand32() % 6]); WildMagicTimer = 20000; } else WildMagicTimer -= diff; @@ -312,11 +312,11 @@ public: } std::list<Unit*>::const_iterator i = targetList.begin(); - advance(i, rand()%targetList.size()); + advance(i, rand32() % targetList.size()); if ((*i)) { (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST, true); - SpectralBlastTimer = 20000+rand()%5000; + SpectralBlastTimer = 20000 + rand32() % 5000; } else SpectralBlastTimer = 1000; } else SpectralBlastTimer -= diff; @@ -775,10 +775,10 @@ public: if (ShadowBoltTimer <= diff) { - if (!(rand()%5)) + if (!(rand32() % 5)) Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); - ShadowBoltTimer = 7000+(rand()%3000); + ShadowBoltTimer = 7000 + (rand32() % 3000); } else ShadowBoltTimer -= diff; if (AgonyCurseTimer <= diff) @@ -792,7 +792,7 @@ public: if (CorruptionStrikeTimer <= diff) { - if (!(rand()%5))Talk(SAY_SATH_SPELL2); + if (!(rand32() % 5))Talk(SAY_SATH_SPELL2); DoCastVictim(SPELL_CORRUPTION_STRIKE); CorruptionStrikeTimer = 13000; } else CorruptionStrikeTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index faecb2ca2f0..6ccce62cb6f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -539,7 +539,7 @@ public: void JustDied(Unit* /*killer*/) override { for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand32() % 6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 9810c42bdfb..b55a9cc74d6 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -182,10 +182,11 @@ class boss_akilzon : public CreatureScript // visual float x, y, z; z = me->GetPositionZ(); - for (uint8 i = 0; i < 5+rand()%5; ++i) + uint8 maxCount = 5 + rand32() % 5; + for (uint8 i = 0; i < maxCount; ++i) { - x = 343.0f+rand()%60; - y = 1380.0f+rand()%60; + x = 343.0f + rand32() % 60; + y = 1380.0f + rand32() % 60; if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2000)) { trigger->setFaction(35); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 6e5517e82a6..0fee04f0d20 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -352,7 +352,7 @@ class boss_hexlord_malacrass : public CreatureScript AddList.push_back(AddEntryList[i]); while (AddList.size() > 4) - AddList.erase(AddList.begin()+rand()%AddList.size()); + AddList.erase(AddList.begin() + rand32() % AddList.size()); uint8 i = 0; for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index f264b12ca23..fa2b9430682 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -385,7 +385,7 @@ class boss_janalai : public CreatureScript for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive()) - DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0); + DoTeleportPlayer(i_pl, JanalainPos[0][0] - 5 + rand32() % 10, JanalainPos[0][1] - 5 + rand32() % 10, JanalainPos[0][2], 0); //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far return; } else BombTimer -= diff; @@ -636,9 +636,9 @@ class npc_janalai_hatchling : public CreatureScript { BuffetTimer = 7000; if (me->GetPositionY() > 1150) - me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0]+rand()%4-2, 1150.0f+rand()%4-2, hatcherway[0][3][2]); + me->GetMotionMaster()->MovePoint(0, hatcherway[0][3][0] + rand32() % 4 - 2, 1150.0f + rand32() % 4 - 2, hatcherway[0][3][2]); else - me->GetMotionMaster()->MovePoint(0, hatcherway[1][3][0]+rand()%4-2, 1150.0f+rand()%4-2, hatcherway[1][3][2]); + me->GetMotionMaster()->MovePoint(0, hatcherway[1][3][0] + rand32() % 4 - 2, 1150.0f + rand32() % 4 - 2, hatcherway[1][3][2]); me->SetDisableGravity(true); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index b2eec0574f3..5561ed3c2dd 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -75,7 +75,7 @@ class npc_forest_frog : public CreatureScript void DoSpawnRandom() { uint32 cEntry = 0; - switch (rand()%10) + switch (rand32() % 10) { case 0: cEntry = 24397; break; //Mannuth case 1: cEntry = 24403; break; //Deez @@ -90,9 +90,9 @@ class npc_forest_frog : public CreatureScript } if (!instance->GetData(TYPE_RAND_VENDOR_1)) - if (rand()%10 == 1) cEntry = 24408; //Gunter + if (rand32() % 10 == 1) cEntry = 24408; //Gunter if (!instance->GetData(TYPE_RAND_VENDOR_2)) - if (rand()%10 == 1) cEntry = 24409; //Kyren + if (rand32() % 10 == 1) cEntry = 24409; //Kyren if (cEntry) me->UpdateEntry(cEntry); @@ -105,7 +105,7 @@ class npc_forest_frog : public CreatureScript if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG) { //increase or decrease chance of mojo? - if (rand()%99 == 50) DoCast(caster, SPELL_PUSH_MOJO, true); + if (rand32() % 99 == 50) DoCast(caster, SPELL_PUSH_MOJO, true); else DoSpawnRandom(); } } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index 52fbcaba003..997818aced2 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -313,7 +313,7 @@ class npc_zealot_lorkhan : public CreatureScript if (BloodLust_Timer <= diff) { DoCast(me, SPELL_BLOODLUST); - BloodLust_Timer = 20000+rand()%8000; + BloodLust_Timer = 20000 + rand32() % 8000; } else BloodLust_Timer -= diff; //Casting Greaterheal to Thekal or Zath if they are in meele range. @@ -337,14 +337,14 @@ class npc_zealot_lorkhan : public CreatureScript break; } - GreaterHeal_Timer = 15000+rand()%5000; + GreaterHeal_Timer = 15000 + rand32() % 5000; } else GreaterHeal_Timer -= diff; //Disarm_Timer if (Disarm_Timer <= diff) { DoCastVictim(SPELL_DISARM); - Disarm_Timer = 15000+rand()%10000; + Disarm_Timer = 15000 + rand32() % 10000; } else Disarm_Timer -= diff; //Check_Timer for the death of LorKhan and Zath. @@ -456,14 +456,14 @@ class npc_zealot_zath : public CreatureScript if (SweepingStrikes_Timer <= diff) { DoCastVictim(SPELL_SWEEPINGSTRIKES); - SweepingStrikes_Timer = 22000+rand()%4000; + SweepingStrikes_Timer = 22000 + rand32() % 4000; } else SweepingStrikes_Timer -= diff; //SinisterStrike_Timer if (SinisterStrike_Timer <= diff) { DoCastVictim(SPELL_SINISTERSTRIKE); - SinisterStrike_Timer = 8000+rand()%8000; + SinisterStrike_Timer = 8000 + rand32() % 8000; } else SinisterStrike_Timer -= diff; //Gouge_Timer @@ -474,21 +474,21 @@ class npc_zealot_zath : public CreatureScript if (DoGetThreat(me->GetVictim())) DoModifyThreatPercent(me->GetVictim(), -100); - Gouge_Timer = 17000+rand()%10000; + Gouge_Timer = 17000 + rand32() % 10000; } else Gouge_Timer -= diff; //Kick_Timer if (Kick_Timer <= diff) { DoCastVictim(SPELL_KICK); - Kick_Timer = 15000+rand()%10000; + Kick_Timer = 15000 + rand32() % 10000; } else Kick_Timer -= diff; //Blind_Timer if (Blind_Timer <= diff) { DoCastVictim(SPELL_BLIND); - Blind_Timer = 10000+rand()%10000; + Blind_Timer = 10000 + rand32() % 10000; } else Blind_Timer -= diff; //Check_Timer for the death of LorKhan and Zath. diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp index bc4fff4da7b..82212972f45 100644 --- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp @@ -285,9 +285,9 @@ public: if (WaveTimer < diff && !Completed && Progress) { - uint32 ran1 = rand()%8; - uint32 ran2 = rand()%8; - uint32 ran3 = rand()%8; + uint32 ran1 = rand32() % 8; + uint32 ran2 = rand32() % 8; + uint32 ran3 = rand32() % 8; me->SummonCreature(NPC_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); me->SummonCreature(NPC_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); me->SummonCreature(NPC_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index 390a64fb21c..86ddf33f2fd 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -207,7 +207,7 @@ public: _IsByOutrunner = true; } - if (rand()%4) + if (rand32() % 4) return; //only if attacked and escorter is not in combat? diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 0958a9141f0..8baeaec96ff 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -170,7 +170,7 @@ public: DoCast(me, SPELL_FADE); // add a blink to simulate a stealthed movement and reappearing elsewhere DoCast(me, SPELL_FADE_BLINK); - FadeTimer = 30000 + rand()%5000; + FadeTimer = 30000 + rand32() % 5000; // if the victim is out of melee range she cast multi shot if (Unit* victim = me->GetVictim()) if (me->GetDistance(victim) > 10.0f) @@ -180,7 +180,7 @@ public: if (SummonSkeletonTimer <= diff) { DoCast(me, SPELL_SUMMON_SKELETON); - SummonSkeletonTimer = 20000 + rand()%10000; + SummonSkeletonTimer = 20000 + rand32() % 10000; } else SummonSkeletonTimer -= diff; if (BlackArrowTimer <= diff) @@ -188,7 +188,7 @@ public: if (Unit* victim = me->GetVictim()) { DoCast(victim, SPELL_BLACK_ARROW); - BlackArrowTimer = 15000 + rand()%5000; + BlackArrowTimer = 15000 + rand32() % 5000; } } else BlackArrowTimer -= diff; @@ -197,7 +197,7 @@ public: if (Unit* victim = me->GetVictim()) { DoCast(victim, SPELL_SHOT); - ShotTimer = 8000 + rand()%2000; + ShotTimer = 8000 + rand32() % 2000; } } else ShotTimer -= diff; @@ -206,7 +206,7 @@ public: if (Unit* victim = me->GetVictim()) { DoCast(victim, SPELL_MULTI_SHOT); - MultiShotTimer = 10000 + rand()%3000; + MultiShotTimer = 10000 + rand32() % 3000; } } else MultiShotTimer -= diff; |
