aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/authserver/Server/AuthSession.cpp2
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp6
-rw-r--r--src/server/game/Spells/SpellEffects.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_vaelastrasz.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp50
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp10
-rw-r--r--src/server/scripts/Examples/example_creature.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp8
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp12
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp46
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp6
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp2
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp6
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp8
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp8
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_silithus.cpp2
-rw-r--r--src/server/scripts/Kalimdor/zone_the_barrens.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp8
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp2
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp6
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp2
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp20
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp6
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_dragonblight.cpp2
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp14
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp6
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp4
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp10
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp8
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp4
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp18
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp38
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp8
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp2
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp10
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp8
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp6
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp6
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp16
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp10
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp6
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp12
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp6
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp8
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp16
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp2
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp10
-rw-r--r--src/server/scripts/Outland/zone_blades_edge_mountains.cpp8
-rw-r--r--src/server/scripts/Outland/zone_nagrand.cpp6
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp10
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp34
-rw-r--r--src/server/scripts/Outland/zone_terokkar_forest.cpp14
-rw-r--r--src/server/scripts/Pet/pet_hunter.cpp8
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp2
-rw-r--r--src/server/scripts/World/go_scripts.cpp4
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp4
-rw-r--r--src/server/scripts/World/npcs_special.cpp8
-rw-r--r--src/server/worldserver/worldserver.conf.dist11
113 files changed, 403 insertions, 422 deletions
diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp
index 560cf75b447..bcc32887616 100644
--- a/src/server/authserver/Server/AuthSession.cpp
+++ b/src/server/authserver/Server/AuthSession.cpp
@@ -145,7 +145,7 @@ void AuthSession::AsyncReadHeader()
if ((uint8)entry.cmd == _readBuffer[0] && (entry.status == STATUS_CONNECTED || (_isAuthenticated && entry.status == STATUS_AUTHED)))
{
// Handle dynamic size packet
- if (_readBuffer[0] == AUTH_LOGON_CHALLENGE)
+ if (_readBuffer[0] == AUTH_LOGON_CHALLENGE || _readBuffer[0] == AUTH_RECONNECT_CHALLENGE)
{
_socket.read_some(boost::asio::buffer(&_readBuffer[1], sizeof(uint8) + sizeof(uint16))); //error + size
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 27144728a3e..78ba5d0719c 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -76,7 +76,7 @@ void CombatAI::EnterCombat(Unit* who)
if (AISpellInfo[*i].condition == AICOND_AGGRO)
me->CastSpell(who, *i, false);
else if (AISpellInfo[*i].condition == AICOND_COMBAT)
- events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown);
+ events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand32() % AISpellInfo[*i].cooldown);
}
}
@@ -93,7 +93,7 @@ void CombatAI::UpdateAI(uint32 diff)
if (uint32 spellId = events.ExecuteEvent())
{
DoCast(spellId);
- events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand()%AISpellInfo[spellId].cooldown);
+ events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand32() % AISpellInfo[spellId].cooldown);
}
else
DoMeleeAttackIfReady();
@@ -125,7 +125,7 @@ void CasterAI::EnterCombat(Unit* who)
if (spells.empty())
return;
- uint32 spell = rand()%spells.size();
+ uint32 spell = rand32() % spells.size();
uint32 count = 0;
for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count)
{
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index daef0208678..a287b94c2f8 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3465,7 +3465,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
uint32 spellId = 0;
- switch (rand() % 4)
+ switch (rand32() % 4)
{
case 0: spellId = 46740; break;
case 1: spellId = 46739; break;
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 a3804f8b35a..bba98839fef 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp
@@ -418,7 +418,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 5d7e7403686..6e55f9d41fb 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/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_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;
diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp
index d573241137f..9fa2940a43f 100644
--- a/src/server/scripts/Examples/example_creature.cpp
+++ b/src/server/scripts/Examples/example_creature.cpp
@@ -199,7 +199,7 @@ class example_creature : public CreatureScript
if (m_uiSpell1Timer <= uiDiff)
{
//Cast spell one on our current target.
- if (rand()%50 > 10)
+ if (rand32() % 50 > 10)
DoCastVictim(SPELL_ONE_ALT);
else if (me->IsWithinDist(me->GetVictim(), 25.0f))
DoCastVictim(SPELL_ONE);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index d86e3342cf0..576b3dbdb39 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -558,7 +558,7 @@ public:
if (SummonWispTimer <= diff)
{
- DoSpawnCreature(CREATURE_ANCIENT_WISP, float(rand()%40), float(rand()%40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
+ DoSpawnCreature(CREATURE_ANCIENT_WISP, float(rand32() % 40), float(rand32() % 40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SummonWispTimer = 1500;
++WispCount;
} else SummonWispTimer -= diff;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
index c9e010e4159..38e398f3d5b 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
@@ -142,13 +142,13 @@ public:
if (RainTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true), SPELL_RAIN_OF_FIRE);
- RainTimer = 20000+rand()%15000;
+ RainTimer = 20000 + rand32() % 15000;
} else RainTimer -= diff;
if (DoomTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_DOOM);//never on tank
- DoomTimer = 45000+rand()%5000;
+ DoomTimer = 45000 + rand32() % 5000;
} else DoomTimer -= diff;
if (HowlTimer <= diff)
@@ -160,7 +160,7 @@ public:
if (CleaveTimer <= diff)
{
DoCastVictim(SPELL_CLEAVE);
- CleaveTimer = 10000+rand()%5000;
+ CleaveTimer = 10000 + rand32() % 5000;
} else CleaveTimer -= diff;
if (EnrageTimer < diff && !enraged)
@@ -259,13 +259,13 @@ public:
if (WarstompTimer <= diff)
{
DoCast(me, SPELL_WARSTOMP);
- WarstompTimer = 10000+rand()%5000;
+ WarstompTimer = 10000 + rand32() % 5000;
} else WarstompTimer -= diff;
if (CrippleTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE);
- CrippleTimer = 25000+rand()%5000;
+ CrippleTimer = 25000 + rand32() % 5000;
} else CrippleTimer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
index 606188250dd..e08ac61bcde 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp
@@ -137,7 +137,7 @@ public:
if (CleaveTimer <= diff)
{
DoCast(me, SPELL_CLEAVE);
- CleaveTimer = 6000+rand()%15000;
+ CleaveTimer = 6000 + rand32() % 15000;
} else CleaveTimer -= diff;
if (WarStompTimer <= diff)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
index 9ac5034d954..c37b9d910e7 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp
@@ -132,24 +132,24 @@ public:
if (FrostArmorTimer <= diff)
{
DoCast(me, SPELL_FROST_ARMOR);
- FrostArmorTimer = 40000+rand()%20000;
+ FrostArmorTimer = 40000 + rand32() % 20000;
} else FrostArmorTimer -= diff;
if (DecayTimer <= diff)
{
DoCastVictim(SPELL_DEATH_AND_DECAY);
- DecayTimer = 60000+rand()%20000;
+ DecayTimer = 60000 + rand32() % 20000;
Talk(SAY_DECAY);
} else DecayTimer -= diff;
if (NovaTimer <= diff)
{
DoCastVictim(SPELL_FROST_NOVA);
- NovaTimer = 30000+rand()%15000;
+ NovaTimer = 30000 + rand32() % 15000;
Talk(SAY_NOVA);
} else NovaTimer -= diff;
if (IceboltTimer <= diff)
{
DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true), SPELL_ICEBOLT);
- IceboltTimer = 11000+rand()%20000;
+ IceboltTimer = 11000 + rand32() % 20000;
} else IceboltTimer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index 4e6da7dcac2..316834c422a 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -444,7 +444,7 @@ void hyjalAI::MoveInLineOfSight(Unit* who)
void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
{
- uint32 random = rand()%4;
+ uint32 random = rand32() % 4;
float SpawnLoc[3];
for (uint8 i = 0; i < 3; ++i)
@@ -529,7 +529,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3])
{
// 1 in 4 chance we give a rally yell. Not sure if the chance is offilike.
- if (rand()%4 == 0)
+ if (rand32() % 4 == 0)
Talk(RALLY);
InfernalCount = 0;//reset infernal count every new wave
@@ -1032,7 +1032,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
- uint8 r = rand()%4;
+ uint8 r = rand32() % 4;
Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
@@ -1044,7 +1044,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
}
for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
{
- uint8 r = rand()%4;
+ uint8 r = rand32() % 4;
Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
@@ -1085,7 +1085,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
}
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
- uint8 r = rand()%4;
+ uint8 r = rand32() % 4;
Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
@@ -1097,7 +1097,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
}
for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
{
- uint8 r = rand()%4;
+ uint8 r = rand32() % 4;
Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 85de43cb4c4..3a5025695f8 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -417,7 +417,7 @@ public:
instance = creature->GetInstanceScript();
meteor = false;//call once!
CanMove = false;
- Delay = rand()%30000;
+ Delay = rand32() % 30000;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(MODEL_INVIS);
@@ -467,7 +467,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
- Creature* trigger = me->SummonCreature(NPC_TRIGGER, x+8, y+8, z+25+rand()%10, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1000);
+ Creature* trigger = me->SummonCreature(NPC_TRIGGER, x + 8, y + 8, z + 25 + rand32() % 10, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1000);
if (trigger)
{
trigger->SetVisible(false);
@@ -618,7 +618,7 @@ public:
if (KnockDownTimer <= diff)
{
DoCastVictim(SPELL_KNOCKDOWN);
- KnockDownTimer = 15000+rand()%10000;
+ KnockDownTimer = 15000 + rand32() % 10000;
} else KnockDownTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -651,7 +651,7 @@ public:
bool RandomMove;
void Reset() override
{
- FrenzyTimer = 5000+rand()%5000;
+ FrenzyTimer = 5000 + rand32() % 5000;
MoveTimer = 2000;
RandomMove = false;
}
@@ -714,7 +714,7 @@ public:
if (FrenzyTimer <= diff)
{
DoCast(me, SPELL_FRENZY);
- FrenzyTimer = 15000+rand()%15000;
+ FrenzyTimer = 15000 + rand32() % 15000;
} else FrenzyTimer -= diff;
if (!UpdateVictim())
return;
@@ -750,7 +750,7 @@ public:
void Reset() override
{
- ShadowBoltTimer = 1000+rand()%5000;
+ ShadowBoltTimer = 1000 + rand32() % 5000;
summons.DespawnAll();
}
@@ -840,7 +840,7 @@ public:
if (ShadowBoltTimer <= diff)
{
DoCastVictim(SPELL_SHADOW_BOLT);
- ShadowBoltTimer = 20000+rand()%10000;
+ ShadowBoltTimer = 20000 + rand32() % 10000;
} else ShadowBoltTimer -= diff;
DoMeleeAttackIfReady();
@@ -875,9 +875,9 @@ public:
void Reset() override
{
- CourseTimer = 20000+rand()%5000;
- WailTimer = 15000+rand()%5000;
- ShellTimer = 50000+rand()%10000;
+ CourseTimer = 20000 + rand32() % 5000;
+ WailTimer = 15000 + rand32() % 5000;
+ ShellTimer = 50000 + rand32() % 10000;
}
void WaypointReached(uint32 waypointId) override
@@ -931,17 +931,17 @@ public:
if (CourseTimer <= diff)
{
DoCastVictim(SPELL_BANSHEE_CURSE);
- CourseTimer = 20000+rand()%5000;
+ CourseTimer = 20000 + rand32() % 5000;
} else CourseTimer -= diff;
if (WailTimer <= diff)
{
DoCastVictim(SPELL_BANSHEE_WAIL);
- WailTimer = 15000+rand()%5000;
+ WailTimer = 15000 + rand32() % 5000;
} else WailTimer -= diff;
if (ShellTimer <= diff)
{
DoCast(me, SPELL_ANTI_MAGIC_SHELL);
- ShellTimer = 50000+rand()%10000;
+ ShellTimer = 50000 + rand32() % 10000;
} else ShellTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -973,7 +973,7 @@ public:
void Reset() override
{
- WebTimer = 20000+rand()%5000;
+ WebTimer = 20000 + rand32() % 5000;
}
void WaypointReached(uint32 waypointId) override
@@ -1027,7 +1027,7 @@ public:
if (WebTimer <= diff)
{
DoCastVictim(SPELL_WEB);
- WebTimer = 20000+rand()%5000;
+ WebTimer = 20000 + rand32() % 5000;
} else WebTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -1059,7 +1059,7 @@ public:
void Reset() override
{
- ManaBurnTimer = 9000+rand()%5000;
+ ManaBurnTimer = 9000 + rand32() % 5000;
}
void WaypointReached(uint32 waypointId) override
@@ -1113,7 +1113,7 @@ public:
if (ManaBurnTimer <= diff)
{
DoCastVictim(SPELL_MANA_BURN);
- ManaBurnTimer = 9000+rand()%5000;
+ ManaBurnTimer = 9000 + rand32() % 5000;
} else ManaBurnTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -1267,7 +1267,7 @@ public:
{
forcemove = true;
Zpos = 10.0f;
- StrikeTimer = 2000+rand()%5000;
+ StrikeTimer = 2000 + rand32() % 5000;
MoveTimer = 0;
me->SetDisableGravity(true);
}
@@ -1332,7 +1332,7 @@ public:
if (StrikeTimer <= diff)
{
me->CastSpell(DummyTarget[0], DummyTarget[1], DummyTarget[2], SPELL_GARGOYLE_STRIKE, false);
- StrikeTimer = 2000+rand()%1000;
+ StrikeTimer = 2000 + rand32() % 1000;
} else StrikeTimer -= diff;
}
}
@@ -1367,7 +1367,7 @@ public:
DoCastVictim(SPELL_GARGOYLE_STRIKE);
me->StopMoving();
me->GetMotionMaster()->Clear();
- StrikeTimer = 2000+rand()%1000;
+ StrikeTimer = 2000 + rand32() % 1000;
} else StrikeTimer=0;
} else StrikeTimer -= diff;
}
@@ -1399,7 +1399,7 @@ public:
void Reset() override
{
- ExplodeTimer = 5000+rand()%5000;
+ ExplodeTimer = 5000 + rand32() % 5000;
}
void MoveInLineOfSight(Unit* who) override
@@ -1432,9 +1432,9 @@ public:
EnterEvadeMode();
return;
}
- int dmg = 500+rand()%700;
+ int dmg = 500 + rand32() % 700;
me->CastCustomSpell(me->GetVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false);
- ExplodeTimer = 5000+rand()%5000;
+ ExplodeTimer = 5000 + rand32() % 5000;
} else ExplodeTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
index 4192feb52a7..e27dec09802 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
@@ -117,14 +117,14 @@ public:
if (ImpendingDeath_Timer <= diff)
{
DoCastVictim(SPELL_IMPENDING_DEATH);
- ImpendingDeath_Timer = 25000+rand()%5000;
+ ImpendingDeath_Timer = 25000 + rand32() % 5000;
} else ImpendingDeath_Timer -= diff;
if (WingBuffet_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_WING_BUFFET);
- WingBuffet_Timer = 25000+rand()%10000;
+ WingBuffet_Timer = 25000 + rand32() % 10000;
} else WingBuffet_Timer -= diff;
if (Mda_Timer <= diff)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
index a6f1cdd5b0b..2cf5169b530 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -167,7 +167,7 @@ public:
if (Whirlwind_Timer <= diff)
{
DoCastVictim(SPELL_WHIRLWIND);
- Whirlwind_Timer = 20000+rand()%5000;
+ Whirlwind_Timer = 20000 + rand32() % 5000;
} else Whirlwind_Timer -= diff;
//Fear
@@ -175,7 +175,7 @@ public:
{
Talk(SAY_SHOUT);
DoCastVictim(SPELL_FRIGHTENING_SHOUT);
- Fear_Timer = 25000+rand()%10000;
+ Fear_Timer = 25000 + rand32() % 10000;
} else Fear_Timer -= diff;
//Mortal Strike
@@ -183,7 +183,7 @@ public:
{
Talk(SAY_MORTAL);
DoCastVictim(SPELL_MORTAL_STRIKE);
- MortalStrike_Timer = 20000+rand()%10000;
+ MortalStrike_Timer = 20000 + rand32() % 10000;
} else MortalStrike_Timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
index cf3eff4732c..3e776a0c905 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp
@@ -37,7 +37,7 @@ enum Misc
RIFT_BOSS = 1
};
-inline uint32 RandRiftBoss() { return ((rand()%2) ? NPC_RIFT_KEEPER : NPC_RIFT_LORD); }
+inline uint32 RandRiftBoss() { return ((rand32() % 2) ? NPC_RIFT_KEEPER : NPC_RIFT_LORD); }
float PortalLocation[4][4]=
{
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index b904ed44b47..189cb7854ad 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -309,7 +309,7 @@ public:
break;
}
- Heal_Timer = 15000+rand()%15000;
+ Heal_Timer = 15000 + rand32() % 15000;
} else Heal_Timer -= diff;
//Checking if Vem is dead. If yes we will enrage.
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 21da920e4fd..dd0c93e8a28 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -561,7 +561,7 @@ public:
//Get random but only if we have more than one unit on threat list
if (temp.size() > 1)
- advance (j, rand() % (temp.size() - 1));
+ advance(j, rand32() % (temp.size() - 1));
return (*j);
}
@@ -692,7 +692,7 @@ public:
if (unit && i->second == true)
{
//Teleport each player out
- DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
+ DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10, float(rand32() % 6));
//Cast knockback on them
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
@@ -729,7 +729,7 @@ public:
if (unit->IsWithinDist3d(&KickPos, 15.0f))
{
//Teleport each player out
- DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
+ DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10, float(rand32() % 6));
//Cast knockback on them
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
index 5eced848b47..5947c9860ec 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
@@ -77,15 +77,15 @@ public:
if (!victim)
return;
- Rand = 10 + (rand()%10);
- switch (rand()%2)
+ Rand = 10 + (rand32() % 10);
+ switch (rand32() % 2)
{
case 0: RandX = 0.0f - Rand; break;
case 1: RandX = 0.0f + Rand; break;
}
- Rand = 10 + (rand()%10);
- switch (rand()%2)
+ Rand = 10 + (rand32() % 10);
+ switch (rand32() % 2)
{
case 0: RandY = 0.0f - Rand; break;
case 1: RandY = 0.0f + Rand; break;
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index acf0215f9ff..c5011eba2f8 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -330,7 +330,7 @@ struct boss_twinemperorsAI : public ScriptedAI
}
if (c->IsWithinDistInMap(me, ABUSE_BUG_RANGE))
{
- if (!nearb || (rand()%4) == 0)
+ if (!nearb || (rand32() % 4) == 0)
nearb = c;
}
}
@@ -437,7 +437,7 @@ public:
if (UnbalancingStrike_Timer <= diff)
{
DoCastVictim(SPELL_UNBALANCING_STRIKE);
- UnbalancingStrike_Timer = 8000+rand()%12000;
+ UnbalancingStrike_Timer = 8000 + rand32() % 12000;
} else UnbalancingStrike_Timer -= diff;
if (UpperCut_Timer <= diff)
@@ -445,7 +445,7 @@ public:
Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true);
if (randomMelee)
DoCast(randomMelee, SPELL_UPPERCUT);
- UpperCut_Timer = 15000+rand()%15000;
+ UpperCut_Timer = 15000 + rand32() % 15000;
} else UpperCut_Timer -= diff;
HandleBugs(diff);
@@ -542,7 +542,7 @@ public:
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true);
if (target)
DoCast(target, SPELL_BLIZZARD);
- Blizzard_Timer = 15000+rand()%15000;
+ Blizzard_Timer = 15000 + rand32() % 15000;
} else Blizzard_Timer -= diff;
if (ArcaneBurst_Timer <= diff)
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index 0614303515c..e41fbb7d90d 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -169,7 +169,7 @@ public:
{
for (int t = 0; t < 2; ++t)
{
- for (int i = !t ? (rand()%9) : 0; i < 9; ++i)
+ for (int i = !t ? (rand32()%9) : 0; i < 9; ++i)
{
if (!chosenAbilities[i])
{
diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp
index 00ef96dc785..c024c1a567a 100644
--- a/src/server/scripts/Kalimdor/zone_silithus.cpp
+++ b/src/server/scripts/Kalimdor/zone_silithus.cpp
@@ -905,7 +905,7 @@ public:
if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer))
{
if (spawn->GetEntry() == 15423)
- spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4);
+ spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427 + rand32() % 4);
if (i >= 30) WaveCount = 1;
if (i >= 33) WaveCount = 2;
if (i >= 45) WaveCount = 3;
diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
index 42caaaca9fd..a8b5428e499 100644
--- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp
@@ -156,7 +156,7 @@ public:
void EnterCombat(Unit* who) override
{
//not always use
- if (rand()%4)
+ if (rand32() % 4)
return;
//only aggro text if not player and only in this area
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
index 77697cdb3e8..0a43c01081f 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -652,7 +652,7 @@ struct boss_faction_championsAI : public BossAI
std::list<Creature*>::const_iterator itr = lst.begin();
if (lst.empty())
return NULL;
- advance(itr, rand() % lst.size());
+ advance(itr, rand32() % lst.size());
return (*itr);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index d4f00414b7d..2a587e535a3 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -93,7 +93,7 @@ public:
void KilledUnit(Unit* victim) override
{
/// Force the player to spawn corpse scarabs via spell, @todo Check percent chance for scarabs, 20% at the moment
- if (!(rand()%5))
+ if (!(rand32() % 5))
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID());
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 77486c37498..ca478244d2a 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -288,7 +288,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SLAY);
}
@@ -318,7 +318,7 @@ public:
Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_MARK, 15000);
- events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000);
+ events.ScheduleEvent(EVENT_CAST, 20000 + rand32() % 5000);
events.ScheduleEvent(EVENT_BERSERK, 15*100*1000);
}
@@ -343,13 +343,13 @@ public:
switch (eventId)
{
case EVENT_MARK:
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SPECIAL);
DoCastAOE(SPELL_MARK[id]);
events.ScheduleEvent(EVENT_MARK, 15000);
break;
case EVENT_CAST:
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_TAUNT);
if (caster)
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index 381be8d5cd1..cea4b540f7b 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -129,7 +129,7 @@ public:
break;
case EVENT_SUMMON:
for (int32 i = 0; i < RAID_MODE(1, 2); ++i)
- DoSummon(NPC_ZOMBIE, PosSummon[rand() % RAID_MODE(1, 3)]);
+ DoSummon(NPC_ZOMBIE, PosSummon[rand32() % RAID_MODE(1, 3)]);
events.ScheduleEvent(EVENT_SUMMON, 10000);
break;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 554c7957d2a..fa5a0c47808 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -236,7 +236,7 @@ class boss_gothik : public CreatureScript
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_KILL);
}
@@ -359,7 +359,7 @@ class boss_gothik : public CreatureScript
if (spellId && me->IsInCombat())
{
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST);
- if (Creature* pRandomDeadTrigger = ObjectAccessor::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD]))
+ if (Creature* pRandomDeadTrigger = ObjectAccessor::GetCreature(*me, DeadTriggerGUID[rand32() % POS_DEAD]))
me->CastSpell(pRandomDeadTrigger, spellId, true);
}
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index 48dc889ef2b..53efc628aa2 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -75,7 +75,7 @@ public:
void KilledUnit(Unit* who) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SLAY);
if (who->GetTypeId() == TYPEID_PLAYER)
safetyDance = false;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 9875eb5aa68..f010192f6f1 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -583,7 +583,7 @@ public:
if (!unitList.empty())
{
std::vector<Unit*>::const_iterator itr = unitList.begin();
- advance(itr, rand()%unitList.size());
+ advance(itr, rand32() % unitList.size());
DoCast(*itr, SPELL_MANA_DETONATION);
Talk(SAY_SPECIAL);
}
@@ -599,7 +599,7 @@ public:
case EVENT_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true))
DoCast(target, SPELL_FROST_BLAST);
- if (rand()%2)
+ if (rand32() % 2)
Talk(SAY_FROST_BLAST);
events.Repeat(30000, 90000);
break;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 52723b591a2..7f7adefc2fb 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -109,7 +109,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP))
{
target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25));
- uint8 pos = rand()%MAX_POS_WRAP;
+ uint8 pos = rand32() % MAX_POS_WRAP;
target->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20);
if (Creature* wrap = DoSummon(NPC_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN))
wrap->AI()->SetGUID(target->GetGUID());
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index d6d91d14a21..94117e9dbbf 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -100,7 +100,7 @@ public:
else
{
events.ScheduleEvent(EVENT_BALCONY, 110000);
- events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000);
+ events.ScheduleEvent(EVENT_CURSE, 10000 + rand32() % 15000);
events.ScheduleEvent(EVENT_WARRIOR, 30000);
if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_BLINK, urand(20000, 40000));
@@ -109,7 +109,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SLAY);
}
@@ -129,7 +129,7 @@ public:
void SummonUndead(uint32 entry, uint32 num)
{
for (uint32 i = 0; i < num; ++i)
- me->SummonCreature(entry, SummonPos[rand()%MAX_SUMMON_POS], TEMPSUMMON_CORPSE_DESPAWN, 60000);
+ me->SummonCreature(entry, SummonPos[rand32() % MAX_SUMMON_POS], TEMPSUMMON_CORPSE_DESPAWN, 60000);
}
void UpdateAI(uint32 diff) override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index a713474d256..a47b75ec234 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -75,7 +75,7 @@ public:
void KilledUnit(Unit* /*Victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SLAY);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index d9a64569516..3a29e8ac83f 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -72,7 +72,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%3))
+ if (!(rand32() % 3))
DoPlaySoundToSet(me, SOUND_SLAY);
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index e3527b46bed..6a3927d4aa0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -312,7 +312,7 @@ class boss_sapphiron : public CreatureScript
else
{
std::vector<Unit*>::const_iterator itr = targets.begin();
- advance(itr, rand()%targets.size());
+ advance(itr, rand32() % targets.size());
_iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
DoCast(*itr, SPELL_ICEBOLT);
--_iceboltCount;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index 406ca3963a4..34e21336547 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -149,7 +149,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_SLAY);
}
@@ -309,7 +309,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_STAL_SLAY);
}
@@ -399,7 +399,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (!(rand()%5))
+ if (!(rand32() % 5))
Talk(SAY_FEUG_SLAY);
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 13ea815febc..40fa5a5c934 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -245,7 +245,7 @@ public:
DoRemoveStanceAura(m_uiStance);
- int uiTempStance = rand()%(3-1);
+ int uiTempStance = rand32() % (3 - 1);
if (uiTempStance >= m_uiStance)
++uiTempStance;
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
index 9be91bf9c64..8e619864201 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -201,7 +201,7 @@ class boss_skarvald_the_constructor : public CreatureScript
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me)))
DoCast(target, SPELL_CHARGE);
- Charge_Timer = 5000+rand()%5000;
+ Charge_Timer = 5000 + rand32() % 5000;
}
else
Charge_Timer -= diff;
@@ -209,7 +209,7 @@ class boss_skarvald_the_constructor : public CreatureScript
if (StoneStrike_Timer <= diff)
{
DoCastVictim(SPELL_STONE_STRIKE);
- StoneStrike_Timer = 5000+rand()%5000;
+ StoneStrike_Timer = 5000 + rand32() % 5000;
}
else
StoneStrike_Timer -= diff;
@@ -374,7 +374,7 @@ class boss_dalronn_the_controller : public CreatureScript
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
DoCast(target, SPELL_DEBILITATE);
- Debilitate_Timer = 5000+rand()%5000;
+ Debilitate_Timer = 5000 + rand32() % 5000;
}
}
else
@@ -387,7 +387,7 @@ class boss_dalronn_the_controller : public CreatureScript
if (!me->IsNonMeleeSpellCast(false))
{
DoCast(me, H_SPELL_SUMMON_SKELETONS);
- Summon_Timer = (rand()%10000) + 20000;
+ Summon_Timer = (rand32() % 10000) + 20000;
}
}
else
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index 664facd31a1..245cf46336d 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -297,19 +297,19 @@ public:
if (uiChainLightingTimer <= diff)
{
DoCastVictim(SPELL_CHAIN_LIGHTING);
- uiChainLightingTimer = 5000 + rand() % 5000;
+ uiChainLightingTimer = 5000 + rand32() % 5000;
} else uiChainLightingTimer -= diff;
if (uiCrazedTimer <= diff)
{
DoCast(me, SPELL_CRAZED);
- uiCrazedTimer = 8000 + rand() % 4000;
+ uiCrazedTimer = 8000 + rand32() % 4000;
} else uiCrazedTimer -= diff;
if (uiTerrifyingRoarTimer <= diff)
{
DoCast(me, SPELL_TERRIFYING_ROAR);
- uiTerrifyingRoarTimer = 10000 + rand() % 10000;
+ uiTerrifyingRoarTimer = 10000 + rand32() % 10000;
} else uiTerrifyingRoarTimer -= diff;
DoMeleeAttackIfReady();
@@ -405,7 +405,7 @@ public:
if (uiMortalWoundTimer <= diff)
{
DoCastVictim(SPELL_MORTAL_WOUND);
- uiMortalWoundTimer = 3000 + rand() % 4000;
+ uiMortalWoundTimer = 3000 + rand32() % 4000;
} else uiMortalWoundTimer -= diff;
if (uiEnrage1Timer <= diff)
@@ -515,20 +515,20 @@ public:
if (uiStompTimer <= diff)
{
DoCastVictim(SPELL_STOMP);
- uiStompTimer = 8000 + rand() % 4000;
+ uiStompTimer = 8000 + rand32() % 4000;
} else uiStompTimer -= diff;
if (uiGoreTimer <= diff)
{
DoCastVictim(SPELL_GORE);
- uiGoreTimer = 13000 + rand() % 4000;
+ uiGoreTimer = 13000 + rand32() % 4000;
} else uiGoreTimer -= diff;
if (uiGrievousWoundTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_GRIEVOUS_WOUND);
- uiGrievousWoundTimer = 18000 + rand() % 4000;
+ uiGrievousWoundTimer = 18000 + rand32() % 4000;
} else uiGrievousWoundTimer -= diff;
DoMeleeAttackIfReady();
@@ -631,20 +631,20 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_ACID_SPIT);
- uiAcidSpitTimer = 2000 + rand() % 2000;
+ uiAcidSpitTimer = 2000 + rand32() % 2000;
} else uiAcidSpitTimer -= diff;
if (uiAcidSplatterTimer <= diff)
{
DoCast(me, SPELL_POISON_BREATH);
- uiAcidSplatterTimer = 10000 + rand() % 4000;
+ uiAcidSplatterTimer = 10000 + rand32() % 4000;
} else uiAcidSplatterTimer -= diff;
if (uiPoisonBreathTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_POISON_BREATH);
- uiPoisonBreathTimer = 8000 + rand() % 4000;
+ uiPoisonBreathTimer = 8000 + rand32() % 4000;
} else uiPoisonBreathTimer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 41dd1a165f2..ea44d76e7e6 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -421,15 +421,15 @@ public:
switch (urand(0, 2))
{
case 0:
- me->SummonCreature(NPC_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ 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()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ 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()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
+ me->SummonCreature(NPC_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX() + rand32() % 5, SpawnLoc.GetPositionY() + rand32() % 5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
}
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index de4d6c32c97..dfef80133c4 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -111,7 +111,7 @@ public:
m_uiActiveOrder[i] = i;
for (int i = 0; i < 3; ++i)
{
- int r = i + (rand() % (4 - i));
+ int r = i + (rand32() % (4 - i));
int temp = m_uiActiveOrder[i];
m_uiActiveOrder[i] = m_uiActiveOrder[r];
m_uiActiveOrder[r] = temp;
@@ -275,7 +275,7 @@ public:
if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff)
{
//DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control
- if (Creature* temp = me->SummonCreature(NPC_SPIRIT_FOUNT, 385.0f + rand() % 10, -330.0f + rand() % 10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000))
+ if (Creature* temp = me->SummonCreature(NPC_SPIRIT_FOUNT, 385.0f + rand32() % 10, -330.0f + rand32() % 10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000))
{
temp->SetSpeed(MOVE_RUN, 0.4f);
temp->CastSpell(temp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true);
@@ -307,7 +307,7 @@ public:
for (uint8 i = 0; i < 4; ++i)
{
//DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control
- if (Creature* temp = me->SummonCreature(NPC_AVENGING_SPIRIT, x + rand() % 10, y + rand() % 10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
+ if (Creature* temp = me->SummonCreature(NPC_AVENGING_SPIRIT, x + rand32() % 10, y + rand32() % 10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 66ab5a04c3c..b63709b34c8 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -174,7 +174,7 @@ public:
//If one of the adds is dead spawn heals faster
Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_1));
Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EREKEM_GUARD_2));
- uiChainHealTimer = ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()) ? 3000 : 8000) + rand()%3000;
+ uiChainHealTimer = ((pGuard1 && !pGuard1->IsAlive()) || (pGuard2 && !pGuard2->IsAlive()) ? 3000 : 8000) + rand32() % 3000;
}
} else uiChainHealTimer -= diff;
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 2bac444a558..734c20000eb 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -177,7 +177,7 @@ public:
Talk(SAY_SPAWN);
DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1);
if (IsHeroic()) // extra one for heroic
- me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000);
+ me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX() - 5 + rand32() % 10, me->GetPositionY() - 5 + rand32() % 10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000);
uiSummonEtherealSphere_Timer = urand(45000, 47000);
uiArcaneBuffet_Timer = urand(5000, 6000);
diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp
index 59c9b21a220..80e496a6e13 100644
--- a/src/server/scripts/Northrend/zone_dragonblight.cpp
+++ b/src/server/scripts/Northrend/zone_dragonblight.cpp
@@ -433,7 +433,7 @@ public:
void HandleDummy(SpellEffIndex /*effIndex*/)
{
- uint32 roll = rand() % 2;
+ uint32 roll = rand32() % 2;
Creature* tree = GetHitCreature();
Player* player = GetCaster()->ToPlayer();
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
index ea877435acf..2b3928f322a 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -190,9 +190,9 @@ public:
soulholder = 0;
soulclass = 0;
- Fear_timer = 15000 + rand()% 5000;
+ Fear_timer = 15000 + rand32() % 5000;
Ribbon_of_Souls_timer = 5000;
- StolenSoul_Timer = 25000 + rand()% 10000;
+ StolenSoul_Timer = 25000 + rand32() % 10000;
Avatar_summoned = false;
}
@@ -234,7 +234,7 @@ public:
void KilledUnit(Unit* /*victim*/) override
{
- if (rand()%2)
+ if (rand32() % 2)
return;
Talk(SAY_SLAY);
@@ -261,7 +261,7 @@ public:
DoCast(me, SPELL_SUMMON_AVATAR);
Avatar_summoned = true;
- StolenSoul_Timer = 15000 + rand()% 15000;
+ StolenSoul_Timer = 15000 + rand32() % 15000;
}
if (StolenSoul_Timer <= diff)
@@ -282,7 +282,7 @@ public:
DoCast(target, SPELL_STOLEN_SOUL);
me->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
- StolenSoul_Timer = 20000 + rand()% 10000;
+ StolenSoul_Timer = 20000 + rand32() % 10000;
} else StolenSoul_Timer = 1000;
}
} else StolenSoul_Timer -= diff;
@@ -292,13 +292,13 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_RIBBON_OF_SOULS);
- Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000);
+ Ribbon_of_Souls_timer = 5000 + (rand32() % 20 * 1000);
} else Ribbon_of_Souls_timer -= diff;
if (Fear_timer <= diff)
{
DoCast(me, SPELL_SOUL_SCREAM);
- Fear_timer = 15000 + rand()% 15000;
+ Fear_timer = 15000 + rand32() % 15000;
} else Fear_timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
index 26e9df6620c..683b253d8a1 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp
@@ -118,7 +118,7 @@ public:
if (dist < 15)
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
}
- Inhibitmagic_Timer = 3000+(rand()%1000);
+ Inhibitmagic_Timer = 3000 + (rand32() % 1000);
} else Inhibitmagic_Timer -= diff;
//Return since we have no target
@@ -151,7 +151,7 @@ public:
me->SummonCreature(NPC_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5500);
Talk(EMOTE_FOCUSED, target);
}
- FocusFire_Timer = 15000+(rand()%5000);
+ FocusFire_Timer = 15000 + (rand32() % 5000);
} else FocusFire_Timer -= diff;
DoMeleeAttackIfReady();
@@ -181,7 +181,7 @@ public:
void Reset() override
{
- FieryBlast_Timer = 3000+(rand()%1000);
+ FieryBlast_Timer = 3000 + (rand32() % 1000);
fiery1 = fiery2 = true;
}
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
index 2a359419e79..f7f901a9349 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
@@ -61,7 +61,7 @@ public:
void Reset() override
{
- VoidBlast_Timer = 8000+rand()%15000;
+ VoidBlast_Timer = 8000 + rand32() % 15000;
DarkShell_Timer = 20000;
VoidBlast_Counter = 0;
}
@@ -97,7 +97,7 @@ public:
if (VoidBlast_Counter == 5)
{
- VoidBlast_Timer = 15000+rand()%10000;
+ VoidBlast_Timer = 15000 + rand32() % 10000;
VoidBlast_Counter = 0;
}
} else VoidBlast_Timer -= diff;
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
index cd53b5c18c1..9cb7505c015 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
@@ -66,7 +66,7 @@ public:
ArcaneVolley_Timer = 5000;
Sheep_Timer = 8000;
Blink_Timer = 35000;
- Slow_Timer = 15000+rand()%15000;
+ Slow_Timer = 15000 + rand32() % 15000;
Blink = false;
Intro = false;
ManaShield = false;
@@ -127,7 +127,7 @@ public:
if (ArcaneVolley_Timer <= diff)
{
DoCast(me, SPELL_ARCANE_VOLLEY);
- ArcaneVolley_Timer = 7000+rand()%5000;
+ ArcaneVolley_Timer = 7000 + rand32() % 5000;
} else ArcaneVolley_Timer -= diff;
if (Sheep_Timer <= diff)
@@ -142,7 +142,7 @@ public:
if (target)
DoCast(target, SPELL_POLYMORPH);
- Sheep_Timer = 15000+rand()%2500;
+ Sheep_Timer = 15000 + rand32() % 2500;
} else Sheep_Timer -= diff;
//may not be correct time to cast
@@ -157,7 +157,7 @@ public:
if (Slow_Timer <= diff)
{
DoCast(me, H_SPELL_SLOW);
- Slow_Timer = 15000+rand()%25000;
+ Slow_Timer = 15000 + rand32() % 25000;
} else Slow_Timer -= diff;
}
@@ -182,7 +182,7 @@ public:
DoCast(target, SPELL_BLINK_TELEPORT);
Blink = true;
}
- Blink_Timer = 35000+rand()%5000;
+ Blink_Timer = 35000 + rand32() % 5000;
} else Blink_Timer -= diff;
if (!Blink)
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index b1c3d607396..ec89acfb7b6 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -637,7 +637,7 @@ public:
break;
case PHASE_FLIGHT:
Timer[EVENT_FIREBALL] = 1000;
- if (!(rand()%4))
+ if (!(rand32() % 4))
Timer[EVENT_DARK_BARRAGE] = 10000;
Timer[EVENT_EYE_BLAST] = urand(10, 25) * 1000;
Timer[EVENT_MOVE_POINT] = urand(20, 40) * 1000;
@@ -993,7 +993,7 @@ public:
case EVENT_SHEAR:
// no longer exists in 3.0f.2
// DoCastVictim(SPELL_SHEAR);
- Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000);
+ Timer[EVENT_SHEAR] = 25000 + (rand32() % 16 * 1000);
break;
case EVENT_FLAME_CRASH:
@@ -1062,7 +1062,7 @@ public:
case EVENT_MOVE_POINT:
Phase = PHASE_FLIGHT_SEQUENCE;
Timer[EVENT_FLIGHT_SEQUENCE] = 0; // do not start Event when changing hover point
- HoverPoint += (rand()%3 + 1);
+ HoverPoint += (rand32() % 3 + 1);
if (HoverPoint > 3)
HoverPoint -= 4;
me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z);
@@ -1254,7 +1254,7 @@ public:
if (!target || !me->IsWithinDistInMap(target, 80) || illidan->IsWithinDistInMap(target, 20))
{
- uint8 pos = rand()%4;
+ uint8 pos = rand32() % 4;
BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z);
}
else
@@ -1720,7 +1720,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
- Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
+ Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x + rand32() % 10, y + rand32() % 10, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
// Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x, y, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
if (Elite)
{
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index db3fcea35db..3415451fef5 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -155,7 +155,7 @@ public:
void TeleportPlayers()
{
- uint32 random = rand()%7;
+ uint32 random = rand32() % 7;
float X = TeleportPoint[random].x;
float Y = TeleportPoint[random].y;
float Z = TeleportPoint[random].z;
@@ -211,14 +211,14 @@ public:
uint32 Beam = CurrentBeam;
if (BeamCount > 3)
while (CurrentBeam == Beam)
- CurrentBeam = rand()%3;
+ CurrentBeam = rand32() % 3;
} else BeamTimer -= diff;
// Random Prismatic Shield every 15 seconds.
if (PrismaticShieldTimer <= diff)
{
- uint32 random = rand()%6;
+ uint32 random = rand32() % 6;
if (PrismaticAuras[random])
DoCast(me, PrismaticAuras[random]);
PrismaticShieldTimer = 15000;
@@ -264,13 +264,13 @@ public:
if (ShriekTimer <= diff)
{
DoCastVictim(SPELL_SILENCING_SHRIEK);
- ShriekTimer = 25000+rand()%10 * 1000;
+ ShriekTimer = 25000 + rand32() % 10 * 1000;
} else ShriekTimer -= diff;
if (SaberTimer <= diff)
{
DoCastVictim(SPELL_SABER_LASH);
- SaberTimer = 25000+rand()%10 * 1000;
+ SaberTimer = 25000 + rand32() % 10 * 1000;
} else SaberTimer -= diff;
//Enrage
diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
index 9b304c3cd7b..67d456286d5 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -205,7 +205,7 @@ public:
bool SummonSoul()
{
- uint32 random = rand()%6;
+ uint32 random = rand32() % 6;
float x = Coords[random].x;
float y = Coords[random].y;
@@ -478,7 +478,7 @@ public:
{
CastFixate();
FixateTimer = 5000;
- if (!(rand()%16))
+ if (!(rand32() % 16))
{
Talk(SUFF_SAY_AGGRO);
}
@@ -599,7 +599,7 @@ public:
me->InterruptNonMeleeSpells(false);
DoCastVictim(SPELL_DEADEN);
DeadenTimer = urand(25000, 35000);
- if (!(rand()%2))
+ if (!(rand32() % 2))
{
Talk(DESI_SAY_SPEC);
}
@@ -692,7 +692,7 @@ public:
{
DoCastVictim(SPELL_SOUL_SCREAM);
SoulScreamTimer = urand(9000, 11000);
- if (!(rand()%3))
+ if (!(rand32() % 3))
{
Talk(ANGER_SAY_SPEC);
}
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 0d9537b8b7a..c2bf5966a5c 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -306,10 +306,10 @@ public:
switch (urand(0, 1))
{
case 0:
- coord += rand()%radius;
+ coord += rand32() % radius;
break;
case 1:
- coord -= rand()%radius;
+ coord -= rand32() % radius;
break;
}
return coord;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 2362f534b05..b9a9f41ca09 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -132,7 +132,7 @@ public:
Talk(SAY_AGGRO);
DoZoneInCombat();
events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
- events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL);
+ events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
ResetTimer();
}
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 49762275169..ba7730ba566 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -489,7 +489,7 @@ public:
Unit* unit = me;
uint32 member = 0; // He chooses Lady Malande most often
- if (rand()%10 == 0) // But there is a chance he picks someone else.
+ if (rand32() % 10 == 0) // But there is a chance he picks someone else.
member = urand(1, 3);
if (member != 2) // No need to create another pointer to us using Unit::GetUnit
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
index c6b62ee8de7..0f9a10e5c4f 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -131,7 +131,7 @@ public:
{
CataclysmicBolt_Timer = 10000;
Enrage_Timer = 600000; //10 minutes
- SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds
+ SearNova_Timer = 20000 + rand32() % 40000; // 20 - 60 seconds
BlessingOfTides = false;
@@ -253,7 +253,7 @@ public:
if (SearNova_Timer <= diff)
{
DoCastVictim(SPELL_SEAR_NOVA);
- SearNova_Timer = 20000+rand()%40000;
+ SearNova_Timer = 20000 + rand32() % 40000;
} else SearNova_Timer -= diff;
//Enrage_Timer
@@ -508,7 +508,7 @@ public:
if (FrostShock_Timer <= diff)
{
DoCastVictim(SPELL_FROST_SHOCK);
- FrostShock_Timer = 25000+rand()%5000;
+ FrostShock_Timer = 25000 + rand32() % 5000;
} else FrostShock_Timer -= diff;
//Spitfire_Timer
@@ -575,9 +575,9 @@ public:
void Reset() override
{
WaterBoltVolley_Timer = 35000;
- TidalSurge_Timer = 15000+rand()%5000;
+ TidalSurge_Timer = 15000 + rand32() % 5000;
Heal_Timer = 55000;
- Cyclone_Timer = 30000+rand()%10000;
+ Cyclone_Timer = 30000 + rand32() % 10000;
instance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED);
}
@@ -628,16 +628,16 @@ public:
// Hacky way to do it - won't trigger elseways
if (me->GetVictim())
me->EnsureVictim()->CastSpell(me->GetVictim(), SPELL_TIDAL_SURGE_FREEZE, true);
- TidalSurge_Timer = 15000+rand()%5000;
+ TidalSurge_Timer = 15000 + rand32() % 5000;
} else TidalSurge_Timer -= diff;
//Cyclone_Timer
if (Cyclone_Timer <= diff)
{
//DoCast(me, SPELL_SUMMON_CYCLONE); // Doesn't work
- Cyclone_Timer = 30000+rand()%10000;
+ Cyclone_Timer = 30000 + rand32() % 10000;
- if (Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000))
+ if (Creature* Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand32() % 5), TEMPSUMMON_TIMED_DESPAWN, 15000))
{
Cyclone->SetObjectScale(3.0f);
Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -672,7 +672,7 @@ public:
Unit* selectAdvisorUnit()
{
Unit* unit = NULL;
- switch (rand()%4)
+ switch (rand32() % 4)
{
case 0:
unit = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_KARATHRESS));
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
index 0745a85bf02..f877ce83b37 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -182,15 +182,15 @@ public:
void Reset() override
{
AggroTimer = 19000;
- ShockBlastTimer = 1+rand()%60000;
+ ShockBlastTimer = 1 + rand32() % 60000;
EntangleTimer = 30000;
- StaticChargeTimer = 10000+rand()%15000;
+ StaticChargeTimer = 10000 + rand32() % 15000;
ForkedLightningTimer = 2000;
CheckTimer = 15000;
EnchantedElementalTimer = 5000;
TaintedElementalTimer = 50000;
- CoilfangEliteTimer = 45000+rand()%5000;
- CoilfangStriderTimer = 60000+rand()%10000;
+ CoilfangEliteTimer = 45000 + rand32() % 5000;
+ CoilfangStriderTimer = 60000 + rand32() % 10000;
SummonSporebatTimer = 10000;
SummonSporebatStaticTimer = 30000;
EnchantedElementalPos = 0;
@@ -304,7 +304,7 @@ public:
DoCastVictim(SPELL_MULTI_SHOT);
break;
}
- if (rand()%3)
+ if (rand32() % 3)
{
Talk(SAY_BOWSHOT);
}
@@ -346,7 +346,7 @@ public:
DoCastVictim(SPELL_SHOCK_BLAST);
me->TauntApply(me->GetVictim());
- ShockBlastTimer = 1000+rand()%14000; // random cooldown
+ ShockBlastTimer = 1000 + rand32() % 14000; // random cooldown
} else ShockBlastTimer -= diff;
// StaticChargeTimer
@@ -358,7 +358,7 @@ public:
if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds
- StaticChargeTimer = 10000+rand()%20000;
+ StaticChargeTimer = 10000 + rand32() % 20000;
} else StaticChargeTimer -= diff;
// EntangleTimer
@@ -376,7 +376,7 @@ public:
{
CastShootOrMultishot();
Entangle = false;
- EntangleTimer = 20000+rand()%5000;
+ EntangleTimer = 20000 + rand32() % 5000;
}
} else EntangleTimer -= diff;
@@ -461,7 +461,7 @@ public:
DoCast(target, SPELL_FORKED_LIGHTNING);
- ForkedLightningTimer = 2000+rand()%6000;
+ ForkedLightningTimer = 2000 + rand32() % 6000;
} else ForkedLightningTimer -= diff;
// EnchantedElementalTimer
@@ -474,13 +474,13 @@ public:
else
++EnchantedElementalPos;
- EnchantedElementalTimer = 10000+rand()%5000;
+ EnchantedElementalTimer = 10000 + rand32() % 5000;
} else EnchantedElementalTimer -= diff;
// TaintedElementalTimer
if (TaintedElementalTimer <= diff)
{
- uint32 pos = rand()%8;
+ uint32 pos = rand32() % 8;
me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0);
TaintedElementalTimer = 120000;
@@ -489,7 +489,7 @@ public:
// CoilfangEliteTimer
if (CoilfangEliteTimer <= diff)
{
- uint32 pos = rand()%3;
+ uint32 pos = rand32() % 3;
Creature* coilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
if (coilfangElite)
{
@@ -498,13 +498,13 @@ public:
else if (me->GetVictim())
coilfangElite->AI()->AttackStart(me->GetVictim());
}
- CoilfangEliteTimer = 45000+rand()%5000;
+ CoilfangEliteTimer = 45000 + rand32() % 5000;
} else CoilfangEliteTimer -= diff;
// CoilfangStriderTimer
if (CoilfangStriderTimer <= diff)
{
- uint32 pos = rand()%3;
+ uint32 pos = rand32() % 3;
if (Creature* CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -512,7 +512,7 @@ public:
else if (me->GetVictim())
CoilfangStrider->AI()->AttackStart(me->GetVictim());
}
- CoilfangStriderTimer = 60000+rand()%10000;
+ CoilfangStriderTimer = 60000 + rand32() % 10000;
} else CoilfangStriderTimer -= diff;
// CheckTimer
@@ -656,7 +656,7 @@ public:
void Reset() override
{
- PoisonBoltTimer = 5000+rand()%5000;
+ PoisonBoltTimer = 5000 + rand32() % 5000;
DespawnTimer = 30000;
}
@@ -681,7 +681,7 @@ public:
if (target && target->IsWithinDistInMap(me, 30))
DoCast(target, SPELL_POISON_BOLT);
- PoisonBoltTimer = 5000+rand()%5000;
+ PoisonBoltTimer = 5000 + rand32() % 5000;
} else PoisonBoltTimer -= diff;
// DespawnTimer
@@ -754,7 +754,7 @@ public:
// Random movement
if (MovementTimer <= diff)
{
- uint32 rndpos = rand()%8;
+ uint32 rndpos = rand32() % 8;
me->GetMotionMaster()->MovePoint(1, SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]);
MovementTimer = 6000;
} else MovementTimer -= diff;
@@ -770,7 +770,7 @@ public:
trig->CastSpell(trig, SPELL_TOXIC_SPORES, true);
}
}
- BoltTimer = 10000+rand()%5000;
+ BoltTimer = 10000 + rand32() % 5000;
}
else BoltTimer -= diff;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
index 1f58573465f..a0ff469733c 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -127,7 +127,7 @@ public:
SpoutTimer = 45000;
WhirlTimer = 18000; // after avery spout
PhaseTimer = 120000;
- GeyserTimer = rand()%5000 + 15000;
+ GeyserTimer = rand32() % 5000 + 15000;
CheckTimer = 15000; // give time to get in range when fight starts
WaitTimer = 60000; // never reached
WaitTimer2 = 60000; // never reached
@@ -299,7 +299,7 @@ public:
target = me->GetVictim();
if (target)
DoCast(target, SPELL_GEYSER, true);
- GeyserTimer = rand()%5000 + 15000;
+ GeyserTimer = rand32() % 5000 + 15000;
} else GeyserTimer -= diff;
if (!InRange) // if on players in melee range cast Waterbolt
@@ -403,7 +403,7 @@ public:
if (me->GetVictim())
DoCastVictim(SPELL_SPREAD_SHOT, true);
- MultiShotTimer = 10000+rand()%10000;
+ MultiShotTimer = 10000 + rand32() % 10000;
ShootBowTimer += 1500; // add global cooldown
} else MultiShotTimer -= diff;
@@ -412,7 +412,7 @@ public:
int bp0 = 1100;
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
me->CastCustomSpell(target, SPELL_SHOOT, &bp0, NULL, NULL, true);
- ShootBowTimer = 4000+rand()%5000;
+ ShootBowTimer = 4000 + rand32() % 5000;
MultiShotTimer += 1500; // add global cooldown
} else ShootBowTimer -= diff;
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
index 75d2026537e..d501b919614 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -197,7 +197,7 @@ public:
}
Talk(EMOTE_EARTHQUAKE);
Earthquake = false;
- Earthquake_Timer = 40000+rand()%5000;
+ Earthquake_Timer = 40000 + rand32() % 5000;
}
} else Earthquake_Timer -= diff;
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
index 848e9140f25..dc0a6643624 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
@@ -101,7 +101,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_LIGHTNING_CLOUD);
- LightningCloud_Timer = 15000+rand()%10000;
+ LightningCloud_Timer = 15000 + rand32() % 10000;
} else LightningCloud_Timer -=diff;
//LungBurst_Timer
@@ -109,7 +109,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_LUNG_BURST);
- LungBurst_Timer = 7000+rand()%5000;
+ LungBurst_Timer = 7000 + rand32() % 5000;
} else LungBurst_Timer -=diff;
//EnvelopingWinds_Timer
@@ -122,7 +122,7 @@ public:
if (IsHeroic())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_ENVELOPING_WINDS);
- EnvelopingWinds_Timer = 10000+rand()%5000;
+ EnvelopingWinds_Timer = 10000 + rand32() % 5000;
} else EnvelopingWinds_Timer -=diff;
DoMeleeAttackIfReady();
@@ -149,7 +149,7 @@ public:
void Reset() override
{
- WaterBoltVolley_Timer = 3000+rand()%3000;
+ WaterBoltVolley_Timer = 3000 + rand32() % 3000;
}
void EnterCombat(Unit* /*who*/) override { }
@@ -162,7 +162,7 @@ public:
if (WaterBoltVolley_Timer <= diff)
{
DoCast(me, SPELL_WATER_BOLT_VOLLEY);
- WaterBoltVolley_Timer = 7000+rand()%5000;
+ WaterBoltVolley_Timer = 7000 + rand32() % 5000;
} else WaterBoltVolley_Timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
index 5dbc6a91418..78a14539e25 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -117,9 +117,9 @@ public:
DoSpawnCreature(NPC_STREAMRIGGER_MECHANIC, -5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
DoSpawnCreature(NPC_STREAMRIGGER_MECHANIC, -5, -5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
- if (rand()%2)
+ if (rand32() % 2)
DoSpawnCreature(NPC_STREAMRIGGER_MECHANIC, 5, -7, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
- if (rand()%2)
+ if (rand32() % 2)
DoSpawnCreature(NPC_STREAMRIGGER_MECHANIC, 7, -5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
index 536ea77a98b..ab6e0afaab4 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -123,7 +123,7 @@ public:
void Reset() override
{
Reflection_Timer = 10000;
- Impale_Timer = 7000+rand()%7000;
+ Impale_Timer = 7000 + rand32() % 7000;
Rage_Timer = 45000;
CanRage = false;
@@ -170,14 +170,14 @@ public:
DoCast(me, SPELL_WARLORDS_RAGE);
CAST_AI(npc_naga_distiller::npc_naga_distillerAI, distiller->AI())->StartRageGen(me);
}
- Rage_Timer = 3000+rand()%15000;
+ Rage_Timer = 3000 + rand32() % 15000;
} else Rage_Timer -= diff;
//Reflection_Timer
if (Reflection_Timer <= diff)
{
DoCast(me, SPELL_SPELL_REFLECTION);
- Reflection_Timer = 15000+rand()%10000;
+ Reflection_Timer = 15000 + rand32() % 10000;
} else Reflection_Timer -= diff;
//Impale_Timer
@@ -186,7 +186,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_IMPALE);
- Impale_Timer = 7500+rand()%5000;
+ Impale_Timer = 7500 + rand32() % 5000;
} else Impale_Timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
index ae7d5fd2308..90853138448 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp
@@ -84,9 +84,9 @@ public:
if (Mushroom_Timer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- me->SummonCreature(17990, target->GetPositionX()+(rand()%8), target->GetPositionY()+(rand()%8), target->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000);
+ me->SummonCreature(17990, target->GetPositionX() + (rand32() % 8), target->GetPositionY() + (rand32() % 8), target->GetPositionZ(), float(rand32() % 5), TEMPSUMMON_TIMED_DESPAWN, 22000);
else
- me->SummonCreature(17990, me->GetPositionX()+(rand()%8), me->GetPositionY()+(rand()%8), me->GetPositionZ(), float(rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000);
+ me->SummonCreature(17990, me->GetPositionX() + (rand32() % 8), me->GetPositionY() + (rand32() % 8), me->GetPositionZ(), float(rand32() % 5), TEMPSUMMON_TIMED_DESPAWN, 22000);
Mushroom_Timer = 10000;
} else Mushroom_Timer -= diff;
@@ -95,7 +95,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_ACID_GEYSER);
- AcidGeyser_Timer = 10000+rand()%7500;
+ AcidGeyser_Timer = 10000 + rand32() % 7500;
} else AcidGeyser_Timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
index 7e37c22565a..7090a693876 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp
@@ -73,7 +73,7 @@ public:
Levitate_Timer = 12000;
ChainLightning_Timer = 6000;
StaticCharge_Timer = 10000;
- SporeStriders_Timer = 10000+rand()%5000;
+ SporeStriders_Timer = 10000 + rand32() % 5000;
check_Timer = 5000;
LevitatedTarget = 0;
LevitatedTarget_Timer = 0;
@@ -124,7 +124,7 @@ public:
if (IsHeroic() && SporeStriders_Timer <= diff)
{
DoCast(me, SPELL_SUMMON_SPORE_STRIDER);
- SporeStriders_Timer = 10000+rand()%5000;
+ SporeStriders_Timer = 10000 + rand32() % 5000;
} else SporeStriders_Timer -= diff;
// Levitate
@@ -164,7 +164,7 @@ public:
LevitatedTarget_Timer = 2000;
InAir = false;
}
- Levitate_Timer = 12000+rand()%3000;
+ Levitate_Timer = 12000 + rand32() % 3000;
} else Levitate_Timer -= diff;
// Chain Lightning
diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
index 89aad2534f0..3b7bb0c4312 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -153,7 +153,7 @@ public:
if (MightyBlow_Timer <= diff)
{
DoCastVictim(SPELL_MIGHTY_BLOW);
- MightyBlow_Timer = 30000+rand()%10000;
+ MightyBlow_Timer = 30000 + rand32() % 10000;
} else MightyBlow_Timer -= diff;
//Entering Phase 2
@@ -186,7 +186,7 @@ public:
if (Roar_Timer <= diff)
{
DoCast(me, SPELL_ROAR);
- Roar_Timer = 40000+(rand()%10000);
+ Roar_Timer = 40000 + (rand32() % 10000);
} else Roar_Timer -= diff;
}
@@ -537,7 +537,7 @@ public:
target = NULL;
}
if (!target_list.empty())
- target = *(target_list.begin()+rand()%target_list.size());
+ target = *(target_list.begin() + rand32() % target_list.size());
me->InterruptNonMeleeSpells(false);
DoCast(target, SPELL_BLAST_WAVE);
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index 063a30ca875..55e9801320f 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -83,7 +83,7 @@ class boss_broggok : public CreatureScript
if (AcidSpray_Timer <= diff)
{
DoCastVictim(SPELL_SLIME_SPRAY);
- AcidSpray_Timer = 4000+rand()%8000;
+ AcidSpray_Timer = 4000 + rand32() % 8000;
}
else
AcidSpray_Timer -=diff;
@@ -91,7 +91,7 @@ class boss_broggok : public CreatureScript
if (PoisonBolt_Timer <= diff)
{
DoCastVictim(SPELL_POISON_BOLT);
- PoisonBolt_Timer = 4000+rand()%8000;
+ PoisonBolt_Timer = 4000 + rand32() % 8000;
}
else
PoisonBolt_Timer -=diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
index c85a26a25ab..e56b82d4507 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp
@@ -103,7 +103,7 @@ class boss_kelidan_the_breaker : public CreatureScript
void KilledUnit(Unit* /*victim*/) override
{
- if (rand()%2)
+ if (rand32() % 2)
return;
Talk(SAY_KILL);
@@ -206,7 +206,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (ShadowVolley_Timer <= diff)
{
DoCast(me, SPELL_SHADOW_BOLT_VOLLEY);
- ShadowVolley_Timer = 5000+rand()%8000;
+ ShadowVolley_Timer = 5000 + rand32() % 8000;
}
else
ShadowVolley_Timer -=diff;
@@ -214,7 +214,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (Corruption_Timer <= diff)
{
DoCast(me, SPELL_CORRUPTION);
- Corruption_Timer = 30000+rand()%20000;
+ Corruption_Timer = 30000 + rand32() % 20000;
}
else
Corruption_Timer -=diff;
@@ -235,7 +235,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (IsHeroic())
DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- BurningNova_Timer = 20000+rand()%8000;
+ BurningNova_Timer = 20000 + rand32() % 8000;
Firenova_Timer= 5000;
Firenova = true;
}
@@ -281,8 +281,8 @@ class npc_shadowmoon_channeler : public CreatureScript
void Reset() override
{
- ShadowBolt_Timer = 1000+rand()%1000;
- MarkOfShadow_Timer = 5000+rand()%2000;
+ ShadowBolt_Timer = 1000 + rand32() % 1000;
+ MarkOfShadow_Timer = 5000 + rand32() % 2000;
check_Timer = 0;
if (me->IsNonMeleeSpellCast(false))
me->InterruptNonMeleeSpells(true);
@@ -327,7 +327,7 @@ class npc_shadowmoon_channeler : public CreatureScript
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_MARK_OF_SHADOW);
- MarkOfShadow_Timer = 15000+rand()%5000;
+ MarkOfShadow_Timer = 15000 + rand32() % 5000;
}
else
MarkOfShadow_Timer -=diff;
@@ -335,7 +335,7 @@ class npc_shadowmoon_channeler : public CreatureScript
if (ShadowBolt_Timer <= diff)
{
DoCastVictim(SPELL_SHADOW_BOLT);
- ShadowBolt_Timer = 5000+rand()%1000;
+ ShadowBolt_Timer = 5000 + rand32() % 1000;
}
else
ShadowBolt_Timer -=diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
index a24abac44d6..53680739e55 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
@@ -91,7 +91,7 @@ class boss_the_maker : public CreatureScript
if (AcidSpray_Timer <= diff)
{
DoCastVictim(SPELL_ACID_SPRAY);
- AcidSpray_Timer = 15000+rand()%8000;
+ AcidSpray_Timer = 15000 + rand32() % 8000;
}
else
AcidSpray_Timer -=diff;
@@ -100,7 +100,7 @@ class boss_the_maker : public CreatureScript
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_EXPLODING_BREAKER);
- ExplodingBreaker_Timer = 4000+rand()%8000;
+ ExplodingBreaker_Timer = 4000 + rand32() % 8000;
}
else
ExplodingBreaker_Timer -=diff;
@@ -120,7 +120,7 @@ class boss_the_maker : public CreatureScript
if (Knockdown_Timer <= diff)
{
DoCastVictim(SPELL_KNOCKDOWN);
- Knockdown_Timer = 4000+rand()%8000;
+ Knockdown_Timer = 4000 + rand32() % 8000;
}
else
Knockdown_Timer -=diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
index b735a831e35..237aa506589 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp
@@ -88,7 +88,7 @@ class boss_omor_the_unscarred : public CreatureScript
void KilledUnit(Unit* /*victim*/) override
{
- if (rand()%2)
+ if (rand32() % 2)
return;
Talk(SAY_KILL_1);
@@ -122,7 +122,7 @@ class boss_omor_the_unscarred : public CreatureScript
{
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SUMMON_FIENDISH_HOUND);
- Summon_Timer = 15000+rand()%15000;
+ Summon_Timer = 15000 + rand32() % 15000;
}
else
Summon_Timer -= diff;
@@ -159,7 +159,7 @@ class boss_omor_the_unscarred : public CreatureScript
if (temp && temp->GetTypeId() == TYPEID_PLAYER)
{
DoCast(temp, SPELL_ORBITAL_STRIKE);
- OrbitalStrike_Timer = 14000+rand()%2000;
+ OrbitalStrike_Timer = 14000 + rand32() % 2000;
PlayerGUID = temp->GetGUID();
if (PlayerGUID)
@@ -187,7 +187,7 @@ class boss_omor_the_unscarred : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_TREACHEROUS_AURA);
- Aura_Timer = 8000+rand()%8000;
+ Aura_Timer = 8000 + rand32() % 8000;
}
}
else
@@ -201,7 +201,7 @@ class boss_omor_the_unscarred : public CreatureScript
target = me->GetVictim();
DoCast(target, SPELL_SHADOW_BOLT);
- Shadowbolt_Timer = 4000+rand()%2500;
+ Shadowbolt_Timer = 4000 + rand32() % 2500;
}
}
else
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 1bdaf4fc260..c6756feb0ce 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -180,7 +180,7 @@ class npc_abyssal : public CreatureScript
if (FireBlast_Timer <= diff)
{
DoCastVictim(SPELL_FIRE_BLAST);
- FireBlast_Timer = 5000+rand()%10000;
+ FireBlast_Timer = 5000 + rand32() % 10000;
}
else FireBlast_Timer -= diff;
@@ -232,7 +232,7 @@ class boss_magtheridon : public CreatureScript
Berserk_Timer = 1320000;
Quake_Timer = 40000;
Debris_Timer = 10000;
- Blaze_Timer = 10000+rand()%20000;
+ Blaze_Timer = 10000 + rand32() % 20000;
BlastNova_Timer = 60000;
Cleave_Timer = 15000;
RandChat_Timer = 90000;
@@ -538,7 +538,7 @@ class npc_hellfire_channeler : public CreatureScript
{
if (HealthBelowPct(50))
DoCast(me, SPELL_DARK_MENDING);
- DarkMending_Timer = 10000 +(rand() % 10000);
+ DarkMending_Timer = 10000 + (rand32() % 10000);
}
else
DarkMending_Timer -= diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 88c3041b62c..9a8f83fa1c2 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -243,7 +243,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
if (Cleave_Timer <= diff)
{
DoCastVictim(SPELL_SHADOW_CLEAVE);
- Cleave_Timer = 6000+rand()%2500;
+ Cleave_Timer = 6000 + rand32() % 2500;
}
else
Cleave_Timer -= diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
index b03fc651e12..d61c40f8e3b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -178,7 +178,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (!LeftHead || !RightHead)
return;
- ithreat = rand()%4;
+ ithreat = rand32() % 4;
Creature* source = (LeftHead->GetEntry() == Threat[ithreat].creature ? LeftHead : RightHead);
@@ -195,7 +195,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (Creature* LeftHead = ObjectAccessor::GetCreature(*me, LeftHeadGUID))
{
- iaggro = rand()%3;
+ iaggro = rand32() % 3;
LeftHead->AI()->Talk(GoCombat[iaggro].id);
@@ -227,7 +227,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (!LeftHead || !RightHead)
return;
- ikilling = rand()%2;
+ ikilling = rand32() % 2;
Creature* source = (LeftHead->GetEntry() == Killing[ikilling].creature ? LeftHead : RightHead);
@@ -338,7 +338,7 @@ class boss_warbringer_omrogg : public CreatureScript
DoResetThreat();
me->AddThreat(target, 0.0f);
}
- ResetThreat_Timer = 25000+rand()%15000;
+ ResetThreat_Timer = 25000 + rand32() % 15000;
}
else
ResetThreat_Timer -= diff;
@@ -346,7 +346,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (Fear_Timer <= diff)
{
DoCast(me, SPELL_FEAR);
- Fear_Timer = 15000+rand()%20000;
+ Fear_Timer = 15000 + rand32() % 20000;
}
else
Fear_Timer -= diff;
@@ -354,7 +354,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (ThunderClap_Timer <= diff)
{
DoCast(me, SPELL_THUNDERCLAP);
- ThunderClap_Timer = 15000+rand()%15000;
+ ThunderClap_Timer = 15000 + rand32() % 15000;
}
else
ThunderClap_Timer -= diff;
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index 66aa02bbeaf..f1dfcc2b391 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -213,8 +213,8 @@ class boss_warchief_kargath_bladefist : public CreatureScript
{
//move in bladedance
float x, y, randx, randy;
- randx = 0.0f + rand()%40;
- randy = 0.0f + rand()%40;
+ randx = 0.0f + rand32() % 40;
+ randy = 0.0f + rand32() % 40;
x = 210+ randx;
y = -60- randy;
me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index bcc8b0c5a48..09cb72f1a47 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -245,7 +245,7 @@ class boss_alar : public CreatureScript
switch (WaitEvent)
{
case WE_PLATFORM:
- Platforms_Move_Timer = 30000+rand()%5000;
+ Platforms_Move_Timer = 30000 + rand32() % 5000;
break;
case WE_QUILL:
DoCast(me, SPELL_FLAME_QUILLS, true);
@@ -268,7 +268,7 @@ class boss_alar : public CreatureScript
DoCast(me, SPELL_REBIRTH, true);
MeltArmor_Timer = 60000;
Charge_Timer = 7000;
- DiveBomb_Timer = 40000+rand()%5000;
+ DiveBomb_Timer = 40000 + rand32() % 5000;
FlamePatch_Timer = 30000;
Phase1 = false;
break;
@@ -391,7 +391,7 @@ class boss_alar : public CreatureScript
me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 50);
WaitEvent = WE_METEOR;
WaitTimer = 0;
- DiveBomb_Timer = 40000+rand()%5000;
+ DiveBomb_Timer = 40000 + rand32() % 5000;
return;
}
else
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 2cac4a0be1a..be437a154b3 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -143,7 +143,7 @@ class boss_high_astromancer_solarian : public CreatureScript
AppearDelay_Timer = 2000;
BlindingLight = false;
AppearDelay = false;
- Wrath_Timer = 20000+rand()%5000;//twice in phase one
+ Wrath_Timer = 20000 + rand32() % 5000;//twice in phase one
Phase = 1;
instance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, NOT_STARTED);
@@ -195,7 +195,7 @@ class boss_high_astromancer_solarian : public CreatureScript
if (urand(0, 1))
radius = -radius;
- return radius * (float)(rand()%100)/100.0f + CENTER_X;
+ return radius * (float)(rand32() % 100) / 100.0f + CENTER_X;
}
float Portal_Y(float x, float radius)
@@ -241,7 +241,7 @@ class boss_high_astromancer_solarian : public CreatureScript
me->InterruptNonMeleeSpells(false);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
DoCast(target, SPELL_WRATH_OF_THE_ASTROMANCER, true);
- Wrath_Timer = 20000+rand()%5000;
+ Wrath_Timer = 20000 + rand32() % 5000;
}
else
Wrath_Timer -= diff;
@@ -359,7 +359,7 @@ class boss_high_astromancer_solarian : public CreatureScript
{
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 = rand()%3;
+ int i = rand32() % 3;
me->GetMotionMaster()->Clear();
me->SetPosition(Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index a24e1d5d34f..29f240773e5 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -320,7 +320,7 @@ class boss_kaelthas : public CreatureScript
void Reset() override
{
- Fireball_Timer = 5000+rand()%10000;
+ Fireball_Timer = 5000 + rand32() % 10000;
ArcaneDisruption_Timer = 45000;
MindControl_Timer = 40000;
Phoenix_Timer = 50000;
@@ -746,7 +746,7 @@ class boss_kaelthas : public CreatureScript
{
//interruptable
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false);
- int32 dmg = 20000+rand()%5000;
+ int32 dmg = 20000 + rand32() % 5000;
me->CastCustomSpell(me->GetVictim(), SPELL_FIREBALL, &dmg, 0, 0, false);
IsCastingFireball = true;
Fireball_Timer = 2500;
@@ -757,7 +757,7 @@ class boss_kaelthas : public CreatureScript
//apply resistance
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
IsCastingFireball = false;
- Fireball_Timer = 5000+rand()%10000;
+ Fireball_Timer = 5000 + rand32() % 10000;
}
}
else
@@ -1089,7 +1089,7 @@ class boss_thaladred_the_darkener : public CreatureScript
if (PsychicBlow_Timer <= diff)
{
DoCastVictim(SPELL_PSYCHIC_BLOW);
- PsychicBlow_Timer = 20000+rand()%5000;
+ PsychicBlow_Timer = 20000 + rand32() % 5000;
}
else
PsychicBlow_Timer -= diff;
@@ -1158,7 +1158,7 @@ class boss_lord_sanguinar : public CreatureScript
if (Fear_Timer <= diff)
{
DoCastVictim(SPELL_BELLOWING_ROAR);
- Fear_Timer = 25000+rand()%10000; //approximately every 30 seconds
+ Fear_Timer = 25000 + rand32() % 10000; //approximately every 30 seconds
}
else
Fear_Timer -= diff;
@@ -1275,7 +1275,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
else
DoCastVictim(SPELL_CONFLAGRATION);
- Conflagration_Timer = 10000+rand()%5000;
+ Conflagration_Timer = 10000 + rand32() % 5000;
}
else
Conflagration_Timer -= diff;
@@ -1301,7 +1301,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
if (InMeleeRange)
DoCast(target, SPELL_ARCANE_EXPLOSION);
- ArcaneExplosion_Timer = 4000+rand()%2000;
+ ArcaneExplosion_Timer = 4000 + rand32() % 2000;
}
else
ArcaneExplosion_Timer -= diff;
@@ -1384,7 +1384,7 @@ class boss_master_engineer_telonicus : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_REMOTE_TOY);
- RemoteToy_Timer = 10000+rand()%5000;
+ RemoteToy_Timer = 10000 + rand32() % 5000;
}
else
RemoteToy_Timer -= diff;
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
index 634d54ed58b..6b78706b437 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -132,7 +132,7 @@ class boss_void_reaver : public CreatureScript
}
if (!target_list.empty())
- target = *(target_list.begin()+rand()%target_list.size());
+ target = *(target_list.begin() + rand32() % target_list.size());
else
target = me->GetVictim();
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
index 1917bae1a6c..7563ecb40db 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -238,7 +238,7 @@ class boss_harbinger_skyriss : public CreatureScript
else
DoCastVictim(SPELL_DOMINATION);
- Domination_Timer = 16000+rand()%16000;
+ Domination_Timer = 16000 + rand32() % 16000;
}
else
Domination_Timer -=diff;
@@ -253,7 +253,7 @@ class boss_harbinger_skyriss : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
DoCast(target, H_SPELL_MANA_BURN);
- ManaBurn_Timer = 16000+rand()%16000;
+ ManaBurn_Timer = 16000 + rand32() % 16000;
}
else
ManaBurn_Timer -=diff;
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
index 2c15a6dd30d..0c322877808 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp
@@ -98,7 +98,7 @@ class boss_high_botanist_freywinn : public CreatureScript
void DoSummonSeedling()
{
- switch (rand()%4)
+ switch (rand32() % 4)
{
case 0: DoCast(me, SPELL_PLANT_WHITE); break;
case 1: DoCast(me, SPELL_PLANT_GREEN); break;
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
index 8cab7485510..768c9b5b8f1 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
@@ -88,7 +88,7 @@ class boss_laj : public CreatureScript
void DoTransform()
{
- switch (rand()%5)
+ switch (rand32() % 5)
{
case 0:
me->SetDisplayId(MODEL_DEFAULT);
@@ -135,7 +135,7 @@ class boss_laj : public CreatureScript
void DoSummons()
{
- switch (rand()%4)
+ switch (rand32() % 4)
{
case 0:
DoCast(me, SPELL_SUMMON_LASHER_1, true);
@@ -187,7 +187,7 @@ class boss_laj : public CreatureScript
if (Allergic_Timer <= diff)
{
DoCastVictim(SPELL_ALLERGIC_REACTION);
- Allergic_Timer = 25000+rand()%15000;
+ Allergic_Timer = 25000 + rand32() % 15000;
}
else
Allergic_Timer -= diff;
@@ -195,7 +195,7 @@ class boss_laj : public CreatureScript
if (Teleport_Timer <= diff)
{
DoCast(me, SPELL_TELEPORT_SELF);
- Teleport_Timer = 30000+rand()%10000;
+ Teleport_Timer = 30000 + rand32() % 10000;
CanSummon = true;
}
else
@@ -204,7 +204,7 @@ class boss_laj : public CreatureScript
if (Transform_Timer <= diff)
{
DoTransform();
- Transform_Timer = 25000+rand()%15000;
+ Transform_Timer = 25000 + rand32() % 15000;
}
else
Transform_Timer -= diff;
diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
index ebcddafe309..d54eb6fff8c 100644
--- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp
@@ -301,7 +301,7 @@ public:
if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER)
{
const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL};
- int cid = rand()%(4-1);
+ int cid = rand32() % (4 - 1);
if (entry_list[cid] == me->GetEntry())
++cid;
@@ -371,7 +371,7 @@ public:
if (IntangiblePresence_Timer <= diff)
{
DoCastVictim(SPELL_INTANGIBLE_PRESENCE);
- IntangiblePresence_Timer = 15000+rand()%15000;
+ IntangiblePresence_Timer = 15000 + rand32() % 15000;
} else IntangiblePresence_Timer -= diff;
if (ManaBurn_Timer <= diff)
@@ -379,13 +379,13 @@ public:
Unit* target = me->GetVictim();
if (target && target->getPowerType() == POWER_MANA)
DoCast(target, SPELL_MANA_BURN);
- ManaBurn_Timer = 8000+rand()%8000;
+ ManaBurn_Timer = 8000 + rand32() % 8000;
} else ManaBurn_Timer -= diff;
if (ArcaneBlast_Timer <= diff)
{
DoCastVictim(SPELL_ARCANE_BLAST);
- ArcaneBlast_Timer = 2500+rand()%5000;
+ ArcaneBlast_Timer = 2500 + rand32() % 5000;
} else ArcaneBlast_Timer -= diff;
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp
index 3b9d865cb3b..f32d2516ee0 100644
--- a/src/server/scripts/Outland/zone_nagrand.cpp
+++ b/src/server/scripts/Outland/zone_nagrand.cpp
@@ -277,7 +277,7 @@ public:
{
if (spell->Id == SPELL_CHAIN_LIGHTNING)
{
- if (rand()%10)
+ if (rand32() % 10)
return;
Talk(SAY_MAG_LIGHTNING);
@@ -627,7 +627,7 @@ public:
{
if (spell->Id == SPELL_KUR_CHAIN_LIGHTNING)
{
- if (rand()%30)
+ if (rand32() % 30)
return;
Talk(SAY_KUR_LIGHTNING);
@@ -635,7 +635,7 @@ public:
if (spell->Id == SPELL_KUR_FROST_SHOCK)
{
- if (rand()%30)
+ if (rand32() % 30)
return;
Talk(SAY_KUR_SHOCK);
diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp
index cb75ee3b2ad..6f331425be0 100644
--- a/src/server/scripts/Outland/zone_netherstorm.cpp
+++ b/src/server/scripts/Outland/zone_netherstorm.cpp
@@ -152,7 +152,7 @@ public:
switch (creature->GetEntry())
{
case ENTRY_BNAAR_C_CONSOLE:
- if (rand()%2)
+ if (rand32() % 2)
{
add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2933.68f, 4162.55f, 164.00f, 1.60f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
if (add) add->GetMotionMaster()->MovePoint(0, 2927.36f, 4212.97f, 164.00f);
@@ -179,7 +179,7 @@ public:
Wave_Timer = 15000;
break;
case ENTRY_ARA_C_CONSOLE:
- if (rand()%2)
+ if (rand32() % 2)
{
add = me->SummonCreature(ENTRY_ARA_TECH, 4035.11f, 4038.97f, 194.27f, 2.57f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
if (add) add->GetMotionMaster()->MovePoint(0, 4003.42f, 4040.19f, 193.49f);
@@ -752,11 +752,11 @@ public:
Weak = false;
Materialize = false;
Drained = false;
- WeakPercent = 25 + (rand() % 16); // 25-40
+ WeakPercent = 25 + (rand32() % 16); // 25-40
PlayerGUID = 0;
- ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd
+ ManaBurnTimer = 5000 + (rand32() % 3 * 1000); // 5-8 sec cd
if (me->GetEntry() == NPC_DRAINED_PHASE_HUNTER_ENTRY)
me->UpdateEntry(NPC_PHASE_HUNTER_ENTRY);
@@ -804,7 +804,7 @@ public:
if (!UnitsWithMana.empty())
{
DoCast(Trinity::Containers::SelectRandomContainerElement(UnitsWithMana), SPELL_MANA_BURN);
- ManaBurnTimer = 8000 + (rand() % 10 * 1000); // 8-18 sec cd
+ ManaBurnTimer = 8000 + (rand32() % 10 * 1000); // 8-18 sec cd
}
else
ManaBurnTimer = 3500;
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index cfcc05a625c..e1590873455 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -1051,7 +1051,7 @@ public:
void EnterCombat(Unit* who) override
{
//don't always use
- if (rand()%5)
+ if (rand32() % 5)
return;
//only aggro text if not player
@@ -1290,19 +1290,19 @@ public:
if (SpellTimer1 <= diff)
{
DoCastVictim(SpawnCast[6].SpellId);//Cleave
- SpellTimer1 = SpawnCast[6].Timer2 + (rand()%10 * 1000);
+ SpellTimer1 = SpawnCast[6].Timer2 + (rand32() % 10 * 1000);
} else SpellTimer1 -= diff;
if (SpellTimer2 <= diff)
{
DoCastVictim(SpawnCast[7].SpellId);//Shadowfury
- SpellTimer2 = SpawnCast[7].Timer2 + (rand()%5 * 1000);
+ SpellTimer2 = SpawnCast[7].Timer2 + (rand32() % 5 * 1000);
} else SpellTimer2 -= diff;
if (SpellTimer3 <= diff)
{
DoCast(me, SpawnCast[8].SpellId);
- SpellTimer3 = SpawnCast[8].Timer2 + (rand()%7 * 1000);//Spell Reflection
+ SpellTimer3 = SpawnCast[8].Timer2 + (rand32() % 7 * 1000);//Spell Reflection
} else SpellTimer3 -= diff;
}
@@ -1521,18 +1521,18 @@ public:
{
if (me->GetEntry() == 22075)//Illidari Soldier
{
- SpellTimer1 = SpawnCast[0].Timer1 + (rand()%4 * 1000);
+ SpellTimer1 = SpawnCast[0].Timer1 + (rand32() % 4 * 1000);
}
if (me->GetEntry() == 22074)//Illidari Mind Breaker
{
- SpellTimer1 = SpawnCast[1].Timer1 + (rand()%10 * 1000);
- SpellTimer2 = SpawnCast[2].Timer1 + (rand()%4 * 1000);
- SpellTimer3 = SpawnCast[3].Timer1 + (rand()%4 * 1000);
+ SpellTimer1 = SpawnCast[1].Timer1 + (rand32() % 10 * 1000);
+ SpellTimer2 = SpawnCast[2].Timer1 + (rand32() % 4 * 1000);
+ SpellTimer3 = SpawnCast[3].Timer1 + (rand32() % 4 * 1000);
}
if (me->GetEntry() == 19797)// Illidari Highlord
{
- SpellTimer1 = SpawnCast[4].Timer1 + (rand()%4 * 1000);
- SpellTimer2 = SpawnCast[5].Timer1 + (rand()%4 * 1000);
+ SpellTimer1 = SpawnCast[4].Timer1 + (rand32() % 4 * 1000);
+ SpellTimer2 = SpawnCast[5].Timer1 + (rand32() % 4 * 1000);
}
Timers = true;
}
@@ -1542,7 +1542,7 @@ public:
if (SpellTimer1 <= diff)
{
DoCastVictim(SpawnCast[0].SpellId);//Spellbreaker
- SpellTimer1 = SpawnCast[0].Timer2 + (rand()%5 * 1000);
+ SpellTimer1 = SpawnCast[0].Timer2 + (rand32() % 5 * 1000);
} else SpellTimer1 -= diff;
}
//Illidari Mind Breaker
@@ -1555,7 +1555,7 @@ public:
if (target->GetTypeId() == TYPEID_PLAYER)
{
DoCast(target, SpawnCast[1].SpellId); //Focused Bursts
- SpellTimer1 = SpawnCast[1].Timer2 + (rand()%5 * 1000);
+ SpellTimer1 = SpawnCast[1].Timer2 + (rand32() % 5 * 1000);
} else SpellTimer1 = 2000;
}
} else SpellTimer1 -= diff;
@@ -1563,13 +1563,13 @@ public:
if (SpellTimer2 <= diff)
{
DoCastVictim(SpawnCast[2].SpellId);//Psychic Scream
- SpellTimer2 = SpawnCast[2].Timer2 + (rand()%13 * 1000);
+ SpellTimer2 = SpawnCast[2].Timer2 + (rand32() % 13 * 1000);
} else SpellTimer2 -= diff;
if (SpellTimer3 <= diff)
{
DoCastVictim(SpawnCast[3].SpellId);//Mind Blast
- SpellTimer3 = SpawnCast[3].Timer2 + (rand()%8 * 1000);
+ SpellTimer3 = SpawnCast[3].Timer2 + (rand32() % 8 * 1000);
} else SpellTimer3 -= diff;
}
//Illidari Highlord
@@ -1578,13 +1578,13 @@ public:
if (SpellTimer1 <= diff)
{
DoCastVictim(SpawnCast[4].SpellId);//Curse Of Flames
- SpellTimer1 = SpawnCast[4].Timer2 + (rand()%10 * 1000);
+ SpellTimer1 = SpawnCast[4].Timer2 + (rand32() % 10 * 1000);
} else SpellTimer1 -= diff;
if (SpellTimer2 <= diff)
{
DoCastVictim(SpawnCast[5].SpellId);//Flamestrike
- SpellTimer2 = SpawnCast[5].Timer2 + (rand()%7 * 13000);
+ SpellTimer2 = SpawnCast[5].Timer2 + (rand32() % 7 * 13000);
} else SpellTimer2 -= diff;
}
@@ -1616,7 +1616,7 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave()
if (WaveCount == 0)//1 Wave
{
- if (rand()%3 == 1 && FelguardCount<2)
+ if (rand32() % 3 == 1 && FelguardCount<2)
{
Spawn->SetDisplayId(18654);
++FelguardCount;
diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp
index a902bd49154..c0755b6b06b 100644
--- a/src/server/scripts/Outland/zone_terokkar_forest.cpp
+++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp
@@ -184,7 +184,7 @@ public:
{
if (done_by && done_by->GetTypeId() == TYPEID_PLAYER)
if (me->GetHealth() <= damage)
- if (rand()%100 < 75)
+ if (rand32() % 100 < 75)
//Summon Wood Mites
DoCast(me, 39130, true);
}
@@ -271,7 +271,7 @@ public:
{
if (done_by->GetTypeId() == TYPEID_PLAYER)
if (me->GetHealth() <= damage)
- if (rand()%100 < 75)
+ if (rand32() % 100 < 75)
//Summon Lots of Wood Mights
DoCast(me, 39134, true);
}
@@ -320,18 +320,18 @@ public:
if (player->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE)
{
- if (rand()%100 < 25)
+ if (rand32() % 100 < 25)
{
me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
player->KilledMonsterCredit(QUEST_TARGET, 0);
}
else
- me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(netherwebVictims[rand32() % 6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- if (rand()%100 < 75)
- me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ if (rand32() % 100 < 75)
+ me->SummonCreature(netherwebVictims[rand32() % 6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
- me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
+ me->SummonCreature(netherwebVictims[rand32() % 6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
}
}
};
diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp
index 0346cebb220..7dbdc7af63f 100644
--- a/src/server/scripts/Pet/pet_hunter.cpp
+++ b/src/server/scripts/Pet/pet_hunter.cpp
@@ -56,7 +56,7 @@ class npc_pet_hunter_snake_trap : public CreatureScript
me->SetMaxHealth(uint32(107 * (me->getLevel() - 40) * 0.025f));
// Add delta to make them not all hit the same time
- uint32 delta = (rand() % 7) * 100;
+ uint32 delta = (rand32() % 7) * 100;
me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta);
//me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER, float(Info->attackpower));
@@ -81,10 +81,10 @@ class npc_pet_hunter_snake_trap : public CreatureScript
float attackRadius = me->GetAttackDistance(who);
if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who))
{
- if (!(rand() % 5))
+ if (!(rand32() % 5))
{
- me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100);
- _spellTimer = (rand() % 10) * 100;
+ me->setAttackTimer(BASE_ATTACK, (rand32() % 10) * 100);
+ _spellTimer = (rand32() % 10) * 100;
AttackStart(who);
}
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 316ce973319..854bc77671b 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -426,7 +426,7 @@ class spell_q11587_arcane_prisoner_rescue : public SpellScriptLoader
if (Unit* unitTarget = GetHitUnit())
{
uint32 spellId = SPELL_SUMMON_ARCANE_PRISONER_MALE;
- if (rand() % 2)
+ if (rand32() % 2)
spellId = SPELL_SUMMON_ARCANE_PRISONER_FEMALE;
caster->CastSpell(caster, spellId, true);
unitTarget->CastSpell(caster, SPELL_ARCANE_PRISONER_KILL_CREDIT, true);
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index f73d1c77da4..f5301fe5cac 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -245,7 +245,7 @@ public:
bool OnGossipHello(Player* player, GameObject* go) override
{
go->UseDoorOrButton();
- int Random = rand() % (sizeof(NpcPrisonEntry) / sizeof(uint32));
+ int Random = rand32() % (sizeof(NpcPrisonEntry) / sizeof(uint32));
if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player),
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
@@ -295,7 +295,7 @@ public:
bool OnGossipHello(Player* player, GameObject* go) override
{
go->UseDoorOrButton();
- int Random = rand() % (sizeof(NpcStasisEntry) / sizeof(uint32));
+ int Random = rand32() % (sizeof(NpcStasisEntry) / sizeof(uint32));
player->SummonCreature(NpcStasisEntry[Random], go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player),
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 2eb91b7b8fe..a27a78a5338 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -107,7 +107,7 @@ public:
else info = SelectSpell(me->GetVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);
//50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell
- if (info && (rand() % (me->GetCreatureTemplate()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown)
+ if (info && (rand32() % (me->GetCreatureTemplate()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown)
{
//Cast the spell
if (Healing)DoCastSpell(me, info);
@@ -130,7 +130,7 @@ public:
SpellInfo const* info = NULL;
//Select a healing spell if less than 30% hp ONLY 33% of the time
- if (HealthBelowPct(30) && rand() % 3 == 0)
+ if (HealthBelowPct(30) && rand32() % 3 == 0)
info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index d2f0a7898bb..969bfa57d58 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -365,7 +365,7 @@ public:
switch (emote)
{
case TEXT_EMOTE_CHICKEN:
- if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand() % 30 == 1)
+ if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand32() % 30 == 1)
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
@@ -835,16 +835,16 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff)
if (Coordinates.empty())
return;
- std::vector<Location*>::iterator itr = Coordinates.begin() + rand() % Coordinates.size();
+ std::vector<Location*>::iterator itr = Coordinates.begin() + rand32() % Coordinates.size();
uint32 patientEntry = 0;
switch (me->GetEntry())
{
case DOCTOR_ALLIANCE:
- patientEntry = AllianceSoldierId[rand() % 3];
+ patientEntry = AllianceSoldierId[rand32() % 3];
break;
case DOCTOR_HORDE:
- patientEntry = HordeSoldierId[rand() % 3];
+ patientEntry = HordeSoldierId[rand32() % 3];
break;
default:
TC_LOG_ERROR("scripts", "Invalid entry for Triage doctor. Please check your database");
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index e482e3d4c37..fcb4010075f 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -147,10 +147,15 @@ BindIP = "0.0.0.0"
#
# ThreadPool
# Description: Number of threads to be used for the global thread pool
-# The thread pool is currently used for the signal handler and remote access
-# Default: 1
+# The thread pool is currently used for:
+# - Signal handling
+# - Remote access
+# - Database keep-alive ping
+# - Core freeze check
+# - World socket networking
+# Default: 2
-ThreadPool = 1
+ThreadPool = 2
#
###################################################################################################