diff options
Diffstat (limited to 'src')
25 files changed, 398 insertions, 455 deletions
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index df482411a0d..74cea10809e 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -272,10 +272,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT eventEntry, state, next_start FROM game_event_save"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); - - } else { uint32 count = 0; @@ -318,10 +315,7 @@ void GameEventMgr::LoadFromDB() // 0 1 QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); - - } else { uint32 count = 0; @@ -366,15 +360,11 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.eventEntry FROM creature" - " JOIN game_event_creature ON creature.guid = game_event_creature.guid"); + // 0 1 + QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_creature"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); - - } else { uint32 count = 0; @@ -387,6 +377,13 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; + CreatureData const* data = sObjectMgr->GetCreatureData(guid); + if (!data) + { + TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_creature` contains creature (GUID: %u) not found in `creature` table.", guid); + continue; + } + if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); @@ -409,15 +406,11 @@ void GameEventMgr::LoadFromDB() { uint32 oldMSTime = getMSTime(); - // 0 1 - QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.eventEntry FROM gameobject" - " JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid"); + // 0 1 + QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_gameobject"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); - - } else { uint32 count = 0; @@ -430,6 +423,13 @@ void GameEventMgr::LoadFromDB() int32 internal_event_id = mGameEvent.size() + event_id - 1; + GameObjectData const* data = sObjectMgr->GetGOData(guid); + if (!data) + { + TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_gameobject` contains gameobject (GUID: %u) not found in `gameobject` table.", guid); + continue; + } + if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); @@ -456,9 +456,7 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - } else { uint32 count = 0; @@ -512,9 +510,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT id, quest, eventEntry FROM game_event_creature_quest"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - } else { uint32 count = 0; @@ -551,9 +547,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT id, quest, eventEntry FROM game_event_gameobject_quest"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - } else { uint32 count = 0; @@ -590,9 +584,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - } else { uint32 count = 0; @@ -631,9 +623,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - } else { uint32 count = 0; @@ -671,9 +661,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT eventEntry, condition_id, done FROM game_event_condition_save"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - } else { uint32 count = 0; @@ -717,9 +705,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry, npcflag FROM game_event_npcflag"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - } else { uint32 count = 0; @@ -755,9 +741,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - } else { uint32 count = 0; @@ -860,9 +844,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, bgflag FROM game_event_battleground_holiday"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty."); - } else { uint32 count = 0; @@ -897,9 +879,7 @@ void GameEventMgr::LoadFromDB() " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry"); if (!result) - { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - } else { uint32 count = 0; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 6546fd16d78..e6351a18fe3 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1597,20 +1597,7 @@ bool Aura::CanStackWith(Aura const* existingAura) const } } - bool isVehicleAura1 = false; - bool isVehicleAura2 = false; - uint8 i = 0; - while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2)) - { - if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE) - isVehicleAura1 = true; - if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE) - isVehicleAura2 = true; - - ++i; - } - - if (isVehicleAura1 && isVehicleAura2) + if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && existingAura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)) { Vehicle* veh = NULL; if (GetOwner()->ToUnit()) @@ -1622,7 +1609,7 @@ bool Aura::CanStackWith(Aura const* existingAura) const if (!veh->GetAvailableSeatCount()) return false; // No empty seat available - return true; // Empty seat available (skip rest) + return !sameCaster; // Empty seat available (skip rest) and different caster } // spell of same spell rank chain diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp index 2259cc84e15..adc2ad1c6ac 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_chrono_lord_epoch.cpp @@ -138,7 +138,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 8020d606532..6c945e4d2b2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -239,7 +239,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index 7cf095d176c..68f2fe1992b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -125,7 +125,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp index f404e1b242d..c12171486ae 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm_the_fleshcrafter.cpp @@ -148,7 +148,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 5b65d049dd3..35c158c1d1a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -270,7 +270,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Unit* pEmbraceTarget = GetEmbraceTarget(); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 21666f69c9e..874d025f2d9 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -341,8 +341,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 2177027d177..5c5982c2c01 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -181,7 +181,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 2438273dcba..48bf4c72d43 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -178,8 +178,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index 8318a916afe..6f5626229e2 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -272,7 +272,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index e1743bd0ade..58c82307065 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -160,7 +160,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index 0603ce0f764..23e99980508 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -154,8 +154,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_KILL); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index 464d6f13e4d..3e4ebcb5929 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -163,7 +163,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 359c7e0172e..c594ecf3447 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -221,10 +221,12 @@ public: if (instance) instance->SetData(DATA_SJONNIR_EVENT, DONE); } + void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index d524e3fb708..67bac18081f 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -149,8 +149,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_SLAY); } }; diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index f08f42be265..5245f3c4586 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -226,8 +226,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_SLAY); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index 8e43baecdb1..6be02886512 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -322,8 +322,9 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; + Talk(SAY_SLAY); } }; diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index d05f475b22f..a73c97a9157 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -214,7 +214,7 @@ public: } void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index a237845cf89..b8e42384229 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -185,7 +185,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; Talk(SAY_SLAY); diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index fffb87ed022..13d019cb119 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -812,7 +812,7 @@ public: struct npc_nexus_drake_hatchlingAI : public FollowerAI //The spell who makes the npc follow the player is missing, also we can use FollowerAI! { - npc_nexus_drake_hatchlingAI(Creature* creature) : FollowerAI(creature) + npc_nexus_drake_hatchlingAI(Creature* creature) : FollowerAI(creature) { HarpoonerGUID = 0; } diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 329759ab439..d2f53c05dc6 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -31,13 +31,12 @@ enum DrakuruShackles { - SPELL_LEFT_CHAIN = 59951, - SPELL_RIGHT_CHAIN = 59952, - SPELL_UNLOCK_SHACKLE = 55083, - SPELL_FREE_RAGECLAW = 55223, - - NPC_RAGECLAW = 29686, - QUEST_TROLLS_IS_GONE_CRAZY = 12861 + NPC_RAGECLAW = 29686, + QUEST_TROLLS_IS_GONE_CRAZY = 12861, + SPELL_LEFT_CHAIN = 59951, + SPELL_RIGHT_CHAIN = 59952, + SPELL_UNLOCK_SHACKLE = 55083, + SPELL_FREE_RAGECLAW = 55223 }; class npc_drakuru_shackles : public CreatureScript @@ -49,11 +48,9 @@ public: { npc_drakuru_shacklesAI(Creature* creature) : ScriptedAI(creature) {} - uint64 RageclawGUID; - void Reset() { - RageclawGUID = 0; + _rageclawGUID = 0; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); float x, y, z; @@ -61,20 +58,20 @@ public: if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { - RageclawGUID = summon->GetGUID(); + _rageclawGUID = summon->GetGUID(); LockRageclaw(); } } void LockRageclaw() { - Unit* Rageclaw = Unit::GetCreature(*me, RageclawGUID); + Unit* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed - me->SetInFront(Rageclaw); - Rageclaw->SetInFront(me); + me->SetInFront(rageclaw); + rageclaw->SetInFront(me); - DoCast(Rageclaw, SPELL_LEFT_CHAIN, true); - DoCast(Rageclaw, SPELL_RIGHT_CHAIN, true); + DoCast(rageclaw, SPELL_LEFT_CHAIN, true); + DoCast(rageclaw, SPELL_RIGHT_CHAIN, true); } void UnlockRageclaw(Unit* who) @@ -82,30 +79,33 @@ public: if (!who) return; - Creature* Rageclaw = Unit::GetCreature(*me, RageclawGUID); + Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed - DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true); + DoCast(rageclaw, SPELL_FREE_RAGECLAW, true); me->setDeathState(DEAD); } - void SpellHit(Unit* pCaster, const SpellInfo* pSpell) + void SpellHit(Unit* caster, const SpellInfo* spell) { - if (pSpell->Id == SPELL_UNLOCK_SHACKLE) + if (spell->Id == SPELL_UNLOCK_SHACKLE) { - if (pCaster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE) + if (caster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE) { - if (Creature* pRageclaw = Unit::GetCreature(*me, RageclawGUID)) + if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID)) { - UnlockRageclaw(pCaster); - pCaster->ToPlayer()->KilledMonster(pRageclaw->GetCreatureTemplate(), RageclawGUID); - me->DisappearAndDie(); + UnlockRageclaw(caster); + caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID); + me->DespawnOrUnsummon(); } else me->setDeathState(JUST_DIED); } } } + + private: + uint64 _rageclawGUID; }; CreatureAI* GetAI(Creature* creature) const @@ -120,16 +120,11 @@ public: enum Rageclaw { - SPELL_UNSHACKLED = 55085, - SPELL_KNEEL = 39656 + SPELL_UNSHACKLED = 55085, + SPELL_KNEEL = 39656, + SAY_RAGECLAW = 0 }; -const char* SAY_RAGECLAW_1 = "I poop on you, trollses!"; -const char* SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!"; -const char* SAY_RAGECLAW_3 = "No more mister nice wolvar!"; - -#define SAY_RAGECLAW RAND(SAY_RAGECLAW_1, SAY_RAGECLAW_2, SAY_RAGECLAW_3) - class npc_captured_rageclaw : public CreatureScript { public: @@ -139,55 +134,28 @@ public: { npc_captured_rageclawAI(Creature* creature) : ScriptedAI(creature) {} - uint32 DespawnTimer; - bool Despawn; - void Reset() { - Despawn = false; - DespawnTimer = 0; me->setFaction(35); DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P } void MoveInLineOfSight(Unit* /*who*/){} - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { - if (pSpell->Id == SPELL_FREE_RAGECLAW) + if (spell->Id == SPELL_FREE_RAGECLAW) { me->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_KNEEL); - me->setFaction(me->GetCreatureTemplate()->faction_H); - DoCast(me, SPELL_UNSHACKLED, true); - me->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, 0); + Talk(SAY_RAGECLAW); me->GetMotionMaster()->MoveRandom(10); - - DespawnTimer = 10000; - Despawn = true; + me->DespawnOrUnsummon(10000); } } - - void UpdateAI(uint32 uiDiff) - { - if (UpdateVictim()) - { - DoMeleeAttackIfReady(); - return; - } - - if (!Despawn) - return; - - if (DespawnTimer <= uiDiff) - me->DisappearAndDie(); - else DespawnTimer -= uiDiff; - } }; CreatureAI* GetAI(Creature* creature) const @@ -197,56 +165,10 @@ public: }; /*#### -## npc_gymer -####*/ - -#define GOSSIP_ITEM_G "I'm ready, Gymer. Let's go!" - -enum eGymer -{ - QUEST_STORM_KING_VENGEANCE = 12919, - SPELL_GYMER = 55568 -}; - -class npc_gymer : public CreatureScript -{ -public: - npc_gymer() : CreatureScript("npc_gymer") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - if (player->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_G, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(13640, creature->GetGUID()); - } - - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_GYMER, true); - } - - return true; - } -}; - -/*#### ## npc_gurgthock ####*/ -enum eGurgthock +enum Gurgthock { QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON = 12935, QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER = 12936, @@ -284,10 +206,10 @@ enum eGurgthock SPELL_BLAST_OF_AIR = 55912, // air SPELL_MAGMA_WAVE = 55916, // fire - SPELL_ORB_OF_WATER = 55888, // fiend of water spell - SPELL_ORB_OF_STORMS = 55882, // fiend of air spell - SPELL_BOULDER = 55886, // fiend of earth spell - SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell + SPELL_ORB_OF_WATER = 55888, // fiend of water spell + SPELL_ORB_OF_STORMS = 55882, // fiend of air spell + SPELL_BOULDER = 55886, // fiend of earth spell + SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell }; struct BossAndAdd @@ -342,21 +264,10 @@ public: { npc_gurgthockAI(Creature* creature) : ScriptedAI(creature) {} - uint64 SummonGUID; - uint64 uiPlayerGUID; - - uint32 uiTimer; - uint32 uiPhase; - uint32 uiRemoveFlagTimer; - uint32 uiQuest; - uint8 uiBossRandom; - - bool bRemoveFlag; - void Reset() { - SummonGUID = 0; - uiPlayerGUID = 0; + _summonGUID = 0; + _playerGUID = 0; me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); uiTimer = 0; @@ -364,25 +275,25 @@ public: uiQuest = 0; uiRemoveFlagTimer = 5000; - uiBossRandom = 0; + _bossRandom = 0; - bRemoveFlag = false; + _removeFlag = false; } void SetGUID(uint64 guid, int32 /*id*/) { - uiPlayerGUID = guid; + _playerGUID = guid; } - void SetData(uint32 uiId, uint32 uiValue) + void SetData(uint32 type, uint32 data) { - bRemoveFlag = true; + _removeFlag = true; me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - switch (uiId) + switch (type) { case 1: - switch (uiValue) + switch (data) { case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: Talk(SAY_QUEST_ACCEPT_TUSKARRMAGEDON); @@ -412,40 +323,40 @@ public: } } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - ScriptedAI::UpdateAI(uiDiff); + ScriptedAI::UpdateAI(diff); - if (bRemoveFlag) + if (_removeFlag) { - if (uiRemoveFlagTimer <= uiDiff) + if (uiRemoveFlagTimer <= diff) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - bRemoveFlag = false; + _removeFlag = false; uiRemoveFlagTimer = 10000; - } else uiRemoveFlagTimer -= uiDiff; + } else uiRemoveFlagTimer -= diff; } if (uiPhase) { - Player* player = me->GetPlayer(*me, uiPlayerGUID); + Player* player = me->GetPlayer(*me, _playerGUID); - if (uiTimer <= uiDiff) + if (uiTimer <= diff) { switch (uiPhase) { case 1: if (Creature* summon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = summon->GetGUID(); + _summonGUID = summon->GetGUID(); uiPhase = 2; uiTimer = 4000; break; case 2: - if (Creature* summon = Unit::GetCreature(*me, SummonGUID)) + if (Creature* summon = Unit::GetCreature(*me, _summonGUID)) summon->GetMotionMaster()->MoveJump(5776.319824f, -2981.005371f, 273.100037f, 10.0f, 20.0f); uiPhase = 0; - SummonGUID = 0; + _summonGUID = 0; break; case 3: Talk(SAY_QUEST_ACCEPT_KORRAK_2); @@ -454,7 +365,7 @@ public: break; case 4: if (Creature* summon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = summon->GetGUID(); + _summonGUID = summon->GetGUID(); uiTimer = 3000; uiPhase = 0; break; @@ -524,15 +435,28 @@ public: uiPhase = 14; break; case 14: - uiBossRandom = urand(0, 3); - if (Creature* creature = me->SummonCreature(Boss[uiBossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->SetData(1, uiBossRandom); + _bossRandom = urand(0, 3); + if (Creature* creature = me->SummonCreature(Boss[_bossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) + creature->AI()->SetData(1, _bossRandom); uiPhase = 0; break; } - }else uiTimer -= uiDiff; + } + else uiTimer -= diff; } } + + private: + bool _removeFlag; + uint8 _bossRandom; + uint64 _summonGUID; + uint64 _playerGUID; + + uint32 uiTimer; + uint32 uiPhase; + uint32 uiRemoveFlagTimer; + uint32 uiQuest; + }; bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) @@ -572,15 +496,15 @@ public: ## npc_orinoko_tuskbreaker ####*/ -enum eOrinokoTuskbreaker +enum OrinokoTuskbreaker { - SPELL_BATTLE_SHOUT = 32064, - SPELL_FISHY_SCENT = 55937, - SPELL_IMPALE = 55929, - SPELL_SUMMON_WHISKER = 55946, + NPC_WHISKER = 30113, + NPC_HUNGRY_PENGUIN = 30110, - NPC_WHISKER = 30113, - NPC_HUNGRY_PENGUIN = 30110 + SPELL_BATTLE_SHOUT = 32064, + SPELL_FISHY_SCENT = 55937, + SPELL_IMPALE = 55929, + SPELL_SUMMON_WHISKER = 55946 }; class npc_orinoko_tuskbreaker : public CreatureScript @@ -596,31 +520,21 @@ public: me->SetReactState(REACT_PASSIVE); } - bool bSummoned; - bool bBattleShout; - bool bFishyScent; - - uint32 uiBattleShoutTimer; - uint32 uiFishyScentTimer; - - uint64 AffectedGUID; - uint64 uiWhisker; - void Reset() { - bSummoned = false; - bBattleShout = false; - bFishyScent = false; + _summoned = false; + _battleShout = false; + _fishyScent = false; uiBattleShoutTimer = 0; uiFishyScentTimer = 20000; - uiWhisker = 0; - AffectedGUID = 0; + _whiskerGUID = 0; + _affectedGUID = 0; } void EnterEvadeMode() { - if (Creature* pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); + if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) + whisker->RemoveFromWorld(); } void MovementInform(uint32 type, uint32 /*pointId*/) @@ -639,35 +553,35 @@ public: DoCast(who, SPELL_IMPALE); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - if (!bBattleShout && uiBattleShoutTimer <= uiDiff) + if (!_battleShout && uiBattleShoutTimer <= diff) { DoCast(me, SPELL_BATTLE_SHOUT); - bBattleShout = true; - } else uiBattleShoutTimer -= uiDiff; + _battleShout = true; + } else uiBattleShoutTimer -= diff; - if (uiFishyScentTimer <= uiDiff) + if (uiFishyScentTimer <= diff) { - if (Unit* pAffected = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* affected = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - DoCast(pAffected, SPELL_FISHY_SCENT); - AffectedGUID = pAffected->GetGUID(); + DoCast(affected, SPELL_FISHY_SCENT); + _affectedGUID = affected->GetGUID(); } uiFishyScentTimer = 20000; - } else uiFishyScentTimer -= uiDiff; + } else uiFishyScentTimer -= diff; - if (!bSummoned && !HealthAbovePct(50)) + if (!_summoned && !HealthAbovePct(50)) { Talk(SAY_CALL_FOR_HELP); //DoCast(me->GetVictim(), SPELL_SUMMON_WHISKER); petai is not working correctly??? - if (Creature* pWhisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - uiWhisker = pWhisker->GetGUID(); - bSummoned = true; + if (Creature* whisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + _whiskerGUID = whisker->GetGUID(); + _summoned = true; } DoMeleeAttackIfReady(); @@ -681,10 +595,10 @@ public: summon->AI()->AttackStart(me->GetVictim()); break; case NPC_HUNGRY_PENGUIN: - if (Unit* pAffected = Unit::GetUnit(*me, AffectedGUID)) + if (Unit* affected = Unit::GetUnit(*me, _affectedGUID)) { - if (pAffected->IsAlive()) - summon->AI()->AttackStart(pAffected); + if (affected->IsAlive()) + summon->AI()->AttackStart(affected); } break; } @@ -692,14 +606,23 @@ public: void JustDied(Unit* killer) { - if (uiWhisker) - if (Creature* pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); + if (_whiskerGUID) + if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) + whisker->RemoveFromWorld(); if (killer->GetTypeId() == TYPEID_PLAYER) killer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, killer); } + + private: + bool _summoned; + bool _battleShout; + bool _fishyScent; + uint32 uiBattleShoutTimer; + uint32 uiFishyScentTimer; + uint64 _affectedGUID; + uint64 _whiskerGUID; }; CreatureAI* GetAI(Creature* creature) const @@ -712,12 +635,12 @@ public: ## npc_korrak_bloodrager ####*/ -enum eKorrakBloodrager +enum KorrakBloodrager { - SPELL_GROW = 55948, - SPELL_CHARGE = 24193, - SPELL_UPPERCUT = 30471, - SPELL_ENRAGE = 42745 + SPELL_GROW = 55948, + SPELL_CHARGE = 24193, + SPELL_UPPERCUT = 30471, + SPELL_ENRAGE = 42745 }; class npc_korrak_bloodrager : public CreatureScript @@ -733,18 +656,14 @@ public: SetDespawnAtEnd(false); } - uint32 uiChargeTimer; - uint32 uiUppercutTimer; - - bool bEnrage; - void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); - uiChargeTimer = 15000; - uiUppercutTimer = 12000; - bEnrage = false; + _enrage = false; + _chargeTimer = 15000; + _uppercutTimer = 12000; + } void WaypointReached(uint32 waypointId) @@ -764,31 +683,31 @@ public: DoCast(me, SPELL_GROW); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(diff); if (!UpdateVictim()) return; - if (uiUppercutTimer <= uiDiff) + if (_uppercutTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0)) DoCast(target, SPELL_UPPERCUT); - uiUppercutTimer = 12000; - } else uiUppercutTimer -= uiDiff; + _uppercutTimer = 12000; + } else _uppercutTimer -= diff; - if (uiChargeTimer <= uiDiff) + if (_chargeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) DoCast(target, SPELL_CHARGE); - uiChargeTimer = 15000; - } else uiChargeTimer -= uiDiff; + _chargeTimer = 15000; + } else _chargeTimer -= diff; - if (!bEnrage && !HealthAbovePct(20)) + if (!_enrage && !HealthAbovePct(20)) { DoCast(me, SPELL_ENRAGE); - bEnrage = true; + _enrage = true; } DoMeleeAttackIfReady(); } @@ -798,6 +717,10 @@ public: if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, killer); } + private: + bool _enrage; + uint32 _chargeTimer; + uint32 _uppercutTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -810,11 +733,11 @@ public: ## npc_yggdras ####*/ -enum eYggdras +enum Yggdras { - SPELL_CLEAVE = 40504, - SPELL_CORRODE_FLESH = 57076, - SPELL_JORMUNGAR_SPAWN = 55859 + SPELL_CLEAVE = 40504, + SPELL_CORRODE_FLESH = 57076, + SPELL_JORMUNGAR_SPAWN = 55859 }; class npc_yggdras : public CreatureScript @@ -826,16 +749,13 @@ public: { npc_yggdrasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 uiCleaveTimer; - uint32 uiCorrodeFleshTimer; - void Reset() { - uiCleaveTimer = 9000; - uiCorrodeFleshTimer = 6000; + _cleaveTimer = 9000; + _corrodeFleshTimer = 6000; } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; @@ -858,17 +778,17 @@ public: } } - if (uiCleaveTimer <= uiDiff) + if (_cleaveTimer <= diff) { DoCast(me->GetVictim(), SPELL_CLEAVE); - uiCleaveTimer = 9000; - } else uiCleaveTimer -= uiDiff; + _cleaveTimer = 9000; + } else _cleaveTimer -= diff; - if (uiCorrodeFleshTimer <= uiDiff) + if (_corrodeFleshTimer <= diff) { DoCast(me->GetVictim(), SPELL_CORRODE_FLESH); - uiCorrodeFleshTimer = 6000; - } else uiCorrodeFleshTimer -= uiDiff; + _corrodeFleshTimer = 6000; + } else _corrodeFleshTimer -= diff; DoMeleeAttackIfReady(); } @@ -890,6 +810,9 @@ public: for (uint8 i = 0; i < 3; ++i) DoCast(killer, SPELL_JORMUNGAR_SPAWN, true); } + private: + uint32 _cleaveTimer; + uint32 _corrodeFleshTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -902,13 +825,13 @@ public: ## npc_stinkbeard ####*/ -enum eStinkbeard +enum Stinkbeard { - SPELL_ENRAGE_STINKBEARD = 50420, - SPELL_KNOCK_AWAY = 31389, - SPELL_STINKY_BEARD = 55867, - SPELL_THUNDERBLADE = 55866, - SPELL_THUNDERCLAP = 15588 + SPELL_ENRAGE_STINKBEARD = 50420, + SPELL_KNOCK_AWAY = 31389, + SPELL_STINKY_BEARD = 55867, + SPELL_THUNDERBLADE = 55866, + SPELL_THUNDERCLAP = 15588 }; class npc_stinkbeard : public CreatureScript @@ -926,19 +849,13 @@ public: SetDespawnAtEnd(false); } - uint32 uiKnockAwayTimer; - uint32 uiStinkyBeardTimer; - - bool bEnrage; - bool bThunderClap; - void Reset() { me->AddAura(SPELL_THUNDERBLADE, me); uiKnockAwayTimer = 10000; uiStinkyBeardTimer = 15000; - bEnrage = false; - bThunderClap = false; + _enrage = false; + _thunderClap = false; } void WaypointReached(uint32 waypointId) @@ -981,10 +898,10 @@ public: } } - if (bThunderClap && !HealthAbovePct(10)) + if (_thunderClap && !HealthAbovePct(10)) { DoCastAOE(SPELL_THUNDERCLAP); - bThunderClap = true; + _thunderClap = true; } if (uiKnockAwayTimer <= uiDiff) @@ -1007,10 +924,10 @@ public: uiStinkyBeardTimer = 15000; } else uiStinkyBeardTimer -= uiDiff; - if (!bEnrage && !HealthAbovePct(20)) + if (!_enrage && !HealthAbovePct(20)) { DoCast(me, SPELL_ENRAGE_STINKBEARD); - bEnrage = true; + _enrage = true; } DoMeleeAttackIfReady(); } @@ -1023,6 +940,11 @@ public: std::string sText = ("And with AUTHORITY, " + std::string(killer->GetName()) + " dominates the magnataur lord! Stinkbeard's clan is gonna miss him back home in the Dragonblight!"); me->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); } + private: + bool _enrage; + bool _thunderClap; + uint32 uiKnockAwayTimer; + uint32 uiStinkyBeardTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -1189,16 +1111,13 @@ public: { npc_fiend_elementalAI(Creature* creature) : ScriptedAI(creature) {} - uint32 uiMissleTimer; - uint32 uiSpell; - void Reset() { if (me->GetPositionZ() >= 287.0f) me->GetMotionMaster()->MoveIdle(); - uiSpell = 0; - uiMissleTimer = urand(2000, 7000); + _spell = 0; + _missleTimer = urand(2000, 7000); } void AttackStart(Unit* who) @@ -1209,30 +1128,34 @@ public: AttackStartNoMove(who); } - void SetData(uint32 uiData, uint32 uiValue) + void SetData(uint32 Data, uint32 Value) { - if (uiData == 1) - uiSpell = Boss[uiValue].uiAddSpell; + if (Data == 1) + _spell = Boss[Value].uiAddSpell; } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; if (me->GetPositionZ() >= 287.0f) { - if (uiMissleTimer <= uiDiff) + if (_missleTimer <= diff) { - if (uiSpell) // Sometimes it is 0, why? - DoCast(me, uiSpell); // this spell (what spell) is not supported ... YET! - uiMissleTimer = urand(2000, 7000); - } else uiMissleTimer -= uiDiff; + if (_spell) // Sometimes it is 0, why? + DoCast(me, _spell); // this spell (what spell) is not supported ... YET! + _missleTimer = urand(2000, 7000); + } else _missleTimer -= diff; } DoMeleeAttackIfReady(); } + + private: + uint32 _missleTimer; + uint32 _spell; }; CreatureAI* GetAI(Creature* creature) const @@ -1261,11 +1184,11 @@ public: me->GetMotionMaster()->MovePoint(0, x, y, z); } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 Type, uint32 /*uiId*/) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; - me->DisappearAndDie(); + me->DespawnOrUnsummon(); } }; @@ -1279,16 +1202,17 @@ public: ## npc_crusade_recruit ######*/ -enum eCrusade_recruit +enum CrusadeRecruit { - SPELL_QUEST_CREDIT = 50633, - - QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509, - - GOSSIP_CRUSADE_TEXT = 13069 + SPELL_QUEST_CREDIT = 50633, + QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509 }; -#define GOSSIP_ITEM_1 "Get out there and make those Scourge wish they were never reborn!" +enum CrusadeRecruitEvents +{ + EVENT_RECRUIT_1 = 1, + EVENT_RECRUIT_2 = 2 +}; class npc_crusade_recruit : public CreatureScript { @@ -1299,86 +1223,57 @@ public: { npc_crusade_recruitAI(Creature* creature) : ScriptedAI(creature) {} - uint8 m_uiPhase; //The current phase we are in - uint32 m_uiTimer; //Timer until phase transition - float m_heading; //Store creature heading - void Reset() { - m_uiTimer = 0; - m_uiPhase = 0; me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); - m_heading = me->GetOrientation(); + _heading = me->GetOrientation(); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - if (m_uiPhase) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (m_uiTimer <= uiDiff) + switch (eventId) { - switch (m_uiPhase) - { - case 1: - // say random text - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - Talk(SAY_RECRUIT); - m_uiTimer = 3000; - m_uiPhase = 2; - break; - case 2: - // walk forward - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(m_heading) * 10), me->GetPositionY() + (sin(m_heading) * 10), me->GetPositionZ()); - m_uiTimer = 5000; - m_uiPhase = 3; - break; - case 3: - // despawn - me->DisappearAndDie(); - m_uiTimer = 0; - m_uiPhase = 0; - break; - } + case EVENT_RECRUIT_1: + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + Talk(SAY_RECRUIT); + _events.ScheduleEvent(EVENT_RECRUIT_2, 3000); + break; + case EVENT_RECRUIT_2: + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(_heading) * 10), me->GetPositionY() + (sin(_heading) * 10), me->GetPositionZ()); + me->DespawnOrUnsummon(5000); + break; + default: + break; } - else - m_uiTimer -= uiDiff; } - ScriptedAI::UpdateAI(uiDiff); if (!UpdateVictim()) return; } - }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_crusade_recruitAI(creature); - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - player->SEND_GOSSIP_MENU(GOSSIP_CRUSADE_TEXT, creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF +1) + void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) { + _events.ScheduleEvent(EVENT_RECRUIT_1, 100); player->CLOSE_GOSSIP_MENU(); creature->CastSpell(player, SPELL_QUEST_CREDIT, true); - CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (creature->AI()))->m_uiPhase = 1; creature->SetFacingToObject(player); } - return true; + private: + EventMap _events; + float _heading; // Store creature heading + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_crusade_recruitAI(creature); } }; @@ -1389,8 +1284,9 @@ public: enum ScourgeEnclosure { - QUEST_OUR_ONLY_HOPE = 12916, - NPC_GYMER_DUMMY = 29928 //from quest template + QUEST_OUR_ONLY_HOPE = 12916, + NPC_GYMER_DUMMY = 29928, // From quest template + SPELL_GYMER_LOCK_EXPLOSION = 55529 }; class go_scourge_enclosure : public GameObjectScript @@ -1403,12 +1299,12 @@ public: go->UseDoorOrButton(); if (player->GetQuestStatus(QUEST_OUR_ONLY_HOPE) == QUEST_STATUS_INCOMPLETE) { - Creature* pGymerDummy = go->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); - if (pGymerDummy) + Creature* gymerDummy = go->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); + if (gymerDummy) { - player->KilledMonsterCredit(pGymerDummy->GetEntry(), pGymerDummy->GetGUID()); - pGymerDummy->CastSpell(pGymerDummy, 55529, true); - pGymerDummy->DisappearAndDie(); + player->KilledMonsterCredit(gymerDummy->GetEntry(), gymerDummy->GetGUID()); + gymerDummy->CastSpell(gymerDummy, SPELL_GYMER_LOCK_EXPLOSION, true); + gymerDummy->DespawnOrUnsummon(); } } return true; @@ -1675,7 +1571,7 @@ public: } }; -uint32 const FetchIngredients[21] [4] = +uint32 const FetchIngredients[21][4] = { { SPELL_FETCH_KNOTROOT, SPELL_HAVE_KNOTROOT, ITEM_KNOTROOT, SAY_KNOTROOT }, { SPELL_FETCH_PICKLED_EAGLE_EGG, SPELL_HAVE_PICKLED_EAGLE_EGG, ITEM_PICKLED_EAGLE_EGG, SAY_PICKLED_EAGLE_EGG }, @@ -1776,7 +1672,6 @@ class spell_random_ingredient : public SpellScriptLoader { if (Player* player = GetHitPlayer()) { - uint8 ingredient = 0; switch (GetSpellInfo()->Id) @@ -1794,8 +1689,8 @@ class spell_random_ingredient : public SpellScriptLoader if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f)) { - finklestein->CastSpell(player, FetchIngredients[ingredient] [0], true, NULL); - finklestein->AI()->Talk(FetchIngredients[ingredient] [3], player->GetGUID()); + finklestein->CastSpell(player, FetchIngredients[ingredient][0], true, NULL); + finklestein->AI()->Talk(FetchIngredients[ingredient][3], player->GetGUID()); } } } @@ -1832,14 +1727,14 @@ class spell_pot_check : public SpellScriptLoader !sSpellMgr->GetSpellInfo(SPELL_FETCH_PUTRID_PIRATE_PERSPIRATION) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_ICECROWN_BOTTLED_WATER) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_WASPS_WINGS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_AMBERSEED) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SHRUNKEN_DRAGONS_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CHILLED_SERPENT_MUCUS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRYSTALLIZED_HOGSNOT) || - !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_FROZEN_SPIDER_ICHOR) || + !sSpellMgr->GetSpellInfo(SPELL_FETCH_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_FROZEN_SPIDER_ICHOR) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_KNOTROOT) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PICKLED_EAGLE_EGG) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SPECKLED_GUANO) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_WITHERED_BATWING) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SEASONED_SLIDER_CIDER) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PULVERIZED_GARGOYLE_TEETH) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_MUDDY_MIRE_MAGGOT) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SPIKY_SPIDER_EGG) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_HAIRY_HERRING_HEAD) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PUTRID_PIRATE_PERSPIRATION) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_ICECROWN_BOTTLED_WATER) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_WASPS_WINGS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_AMBERSEED) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_SHRUNKEN_DRAGONS_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_CHILLED_SERPENT_MUCUS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_CRYSTALLIZED_HOGSNOT) || - !sSpellMgr->GetSpellInfo(SPELL_HAVE_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_FROZEN_SPIDER_ICHOR)) + !sSpellMgr->GetSpellInfo(SPELL_HAVE_CRUSHED_BASILISK_CRYSTALS) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_TROLLBANE) || !sSpellMgr->GetSpellInfo(SPELL_HAVE_FROZEN_SPIDER_ICHOR)) return false; return true; } @@ -1850,14 +1745,14 @@ class spell_pot_check : public SpellScriptLoader { for (uint8 i = 0; i < 21; ++i) { - if(player->HasAura(FetchIngredients[i] [0])) + if (player->HasAura(FetchIngredients[i][0])) { player->CastSpell(player, SPELL_THROW_INGREDIENT); - player->RemoveAura(FetchIngredients[i] [0]); - if(player->HasAura(FetchIngredients[i] [1])) + player->RemoveAura(FetchIngredients[i][0]); + if (player->HasAura(FetchIngredients[i][1])) { - player->RemoveAura(FetchIngredients[i] [1]); - player->DestroyItemCount(FetchIngredients[i] [2], 1, true); + player->RemoveAura(FetchIngredients[i][1]); + player->DestroyItemCount(FetchIngredients[i][2], 1, true); if (i < 15) { if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f)) @@ -1889,8 +1784,8 @@ class spell_pot_check : public SpellScriptLoader void RemoveItems(Player* player) { for (uint8 i = 0; i < 21; ++i) - if (player->HasItemCount(FetchIngredients[i] [2], 1, true)) - player->DestroyItemCount(FetchIngredients[i] [2], 1, true); + if (player->HasItemCount(FetchIngredients[i][2], 1, true)) + player->DestroyItemCount(FetchIngredients[i][2], 1, true); } void Register() @@ -1919,14 +1814,14 @@ class spell_fetch_ingredient_aura : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { + Unit* target = GetTarget(); if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) - if (Unit* target = GetTarget()) - if (target->HasAura(SPELL_ALCHEMIST_APPRENTICE_INVISBUFF)) - if (Creature* finklestein = GetClosestCreatureWithEntry(target, NPC_FINKLESTEIN, 100.0f)) - { - target->RemoveAura(SPELL_ALCHEMIST_APPRENTICE_INVISBUFF); - finklestein->AI()->Talk(SAY_RUINED, target->GetGUID()); - } + if (target->HasAura(SPELL_ALCHEMIST_APPRENTICE_INVISBUFF)) + if (Creature* finklestein = GetClosestCreatureWithEntry(target, NPC_FINKLESTEIN, 100.0f)) + { + target->RemoveAura(SPELL_ALCHEMIST_APPRENTICE_INVISBUFF); + finklestein->AI()->Talk(SAY_RUINED, target->GetGUID()); + } } void Register() @@ -1943,23 +1838,22 @@ class spell_fetch_ingredient_aura : public SpellScriptLoader void AddSC_zuldrak() { - new npc_drakuru_shackles; - new npc_captured_rageclaw; - new npc_gymer; - new npc_gurgthock; - new npc_orinoko_tuskbreaker; - new npc_korrak_bloodrager; - new npc_yggdras; - new npc_stinkbeard; - new npc_released_offspring_harkoa; - new npc_crusade_recruit; - new npc_elemental_lord; - new npc_fiend_elemental; - new go_scourge_enclosure; - new npc_alchemist_finklestein; - new go_finklesteins_cauldron; - new spell_random_ingredient_aura; - new spell_random_ingredient; - new spell_pot_check; - new spell_fetch_ingredient_aura; + new npc_drakuru_shackles(); + new npc_captured_rageclaw(); + new npc_gurgthock(); + new npc_orinoko_tuskbreaker(); + new npc_korrak_bloodrager(); + new npc_yggdras(); + new npc_stinkbeard(); + new npc_released_offspring_harkoa(); + new npc_crusade_recruit(); + new npc_elemental_lord(); + new npc_fiend_elemental(); + new go_scourge_enclosure(); + new npc_alchemist_finklestein(); + new go_finklesteins_cauldron(); + new spell_random_ingredient_aura(); + new spell_random_ingredient(); + new spell_pot_check(); + new spell_fetch_ingredient_aura(); } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index b96418097f3..4f1d93aa04e 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -71,10 +71,10 @@ public: events.ScheduleEvent(EVENT_RESONANCE, 5000); events.ScheduleEvent(EVENT_MAGNETIC_PULL, urand(15000, 30000)); if (IsHeroic()) - { + { events.ScheduleEvent(EVENT_THUNDERING_STORM, 15000); events.ScheduleEvent(EVENT_SONIC_SHOCK, 10000); - } + } //database should have `RegenHealth`=0 to prevent regen uint32 hp = me->CountPctFromMaxHealth(40); @@ -160,7 +160,7 @@ public: DoCast(target, SPELL_THUNDERING_STORM, true); events.ScheduleEvent(EVENT_THUNDERING_STORM, 15000); break; - } + } case EVENT_SONIC_SHOCK: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20, false)) if (target->IsAlive()) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 7cac1128815..06e6c676ffa 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -574,7 +574,7 @@ public: void KilledUnit(Unit* victim) { - if (victim == me) + if (victim->GetTypeId() != TYPEID_PLAYER) return; /// @todo Find better way to handle emote diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a99c02a60c0..2ffd8c80601 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3673,6 +3673,78 @@ class spell_gen_whisper_gulch_yogg_saron_whisper : public SpellScriptLoader } }; +enum SpectatorCheerTrigger +{ + EMOTE_ONE_SHOT_CHEER = 4, + EMOTE_ONE_SHOT_EXCLAMATION = 5, + EMOTE_ONE_SHOT_APPLAUD = 21 +}; + +uint8 const EmoteArray[3] = { EMOTE_ONE_SHOT_CHEER, EMOTE_ONE_SHOT_EXCLAMATION, EMOTE_ONE_SHOT_APPLAUD }; + +class spell_gen_spectator_cheer_trigger : public SpellScriptLoader +{ + public: + spell_gen_spectator_cheer_trigger() : SpellScriptLoader("spell_gen_spectator_cheer_trigger") { } + + class spell_gen_spectator_cheer_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_spectator_cheer_trigger_SpellScript) + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetCaster()->HandleEmoteCommand(EmoteArray[urand(0, 2)]); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_spectator_cheer_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_spectator_cheer_trigger_SpellScript(); + } + +}; + +enum VendorBarkTrigger + +{ + NPC_AMPHITHEATER_VENDOR = 30098, + SAY_AMPHITHEATER_VENDOR = 0 +}; + +class spell_gen_vendor_bark_trigger : public SpellScriptLoader +{ + public: + spell_gen_vendor_bark_trigger() : SpellScriptLoader("spell_gen_vendor_bark_trigger") { } + + class spell_gen_vendor_bark_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_vendor_bark_trigger_SpellScript) + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Creature* vendor = GetCaster()->ToCreature()) + if (vendor->GetEntry() == NPC_AMPHITHEATER_VENDOR) + vendor->AI()->Talk(SAY_AMPHITHEATER_VENDOR); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_vendor_bark_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_vendor_bark_trigger_SpellScript(); + } + +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3762,4 +3834,6 @@ void AddSC_generic_spell_scripts() new spell_gen_darkflight(); new spell_gen_orc_disguise(); new spell_gen_whisper_gulch_yogg_saron_whisper(); + new spell_gen_spectator_cheer_trigger(); + new spell_gen_vendor_bark_trigger(); } |