diff options
Diffstat (limited to 'src/server/scripts')
105 files changed, 1201 insertions, 1441 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 0c37b1491c3..22a8fcb67f0 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -481,15 +481,15 @@ public: char const* msg = "testtest"; uint8 type = atoi(args); - WorldPacket data; - ChatHandler::BuildChatPacket(data, ChatMsg(type), LANG_UNIVERSAL, handler->GetSession()->GetPlayer(), handler->GetSession()->GetPlayer(), msg, 0, "chan"); - handler->GetSession()->SendPacket(&data); + WorldPackets::Chat::Chat packet; + ChatHandler::BuildChatPacket(&packet, ChatMsg(type), LANG_UNIVERSAL, handler->GetSession()->GetPlayer(), handler->GetSession()->GetPlayer(), msg, 0, "chan"); + handler->GetSession()->SendPacket(packet.Write()); return true; } static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, char const* args) { - uint32 msg = atol((char*)args); + uint32 msg = atoul(args); handler->GetSession()->GetPlayer()->SendPushToPartyResponse(handler->GetSession()->GetPlayer(), msg); return true; } @@ -508,7 +508,7 @@ public: static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args) { - QuestFailedReason msg = static_cast<QuestFailedReason>(atol((char*)args)); + QuestFailedReason msg = static_cast<QuestFailedReason>(atoul(args)); handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg); return true; } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 20ce825ad5e..d802d5a496d 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -118,7 +118,7 @@ public: if (!id) return false; - uint32 objectId = atol(id); + uint32 objectId = atoul(id); if (!objectId) return false; @@ -241,7 +241,7 @@ public: if (!id) return false; - uint32 objectId = atol(id); + uint32 objectId = atoul(id); if (objectId) result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1", diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 2cf97403595..e571f30b74e 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -204,7 +204,7 @@ public: // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) player->LearnSpellHighestRank(talentInfo->SpellID); - player->AddTalent(talentInfo->SpellID, player->GetActiveTalentGroup()); + player->AddTalent(talentInfo->SpellID, player->GetActiveTalentGroup(), true); } handler->SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS); diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 46929e3967c..7721fed3fba 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -65,7 +65,7 @@ public: if (!id) return false; - uint32 creatureId = atol(id); + uint32 creatureId = atoul(id); if (!creatureId) { handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId); @@ -82,7 +82,7 @@ public: } char* countStr = strtok(NULL, " "); - uint32 count = countStr ? atol(countStr) : 10; + uint32 count = countStr ? atoul(countStr) : 10; if (count == 0) return false; @@ -133,11 +133,11 @@ public: if (!*args) return false; - char* id = handler->extractKeyFromLink((char*)args, "Hitem"); + char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); if (!id) return false; - uint32 itemId = atol(id); + uint32 itemId = atoul(id); if (!itemId) { handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); @@ -154,7 +154,7 @@ public: } char* countStr = strtok(NULL, " "); - uint32 count = countStr ? atol(countStr) : 10; + uint32 count = countStr ? atoul(countStr) : 10; if (count == 0) return false; @@ -354,7 +354,7 @@ public: if (!id) return false; - uint32 gameObjectId = atol(id); + uint32 gameObjectId = atoul(id); if (!gameObjectId) { handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId); @@ -371,7 +371,7 @@ public: } char* countStr = strtok(NULL, " "); - uint32 count = countStr ? atol(countStr) : 10; + uint32 count = countStr ? atoul(countStr) : 10; if (count == 0) return false; diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 39644e5c08f..47f20c622bf 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -808,9 +808,11 @@ public: } bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); + bool learn = effect ? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; + + SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; bool talent = (GetTalentBySpellID(id) != nullptr); bool passive = spellInfo->IsPassive(); @@ -878,9 +880,11 @@ public: } bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + SpellEffectInfo const* effect = spellInfo->GetEffect(EFFECT_0); + bool learn = effect? (effect->Effect == SPELL_EFFECT_LEARN_SPELL) : false; + + SpellInfo const* learnSpellInfo = effect ? sSpellMgr->GetSpellInfo(effect->TriggerSpell) : NULL; bool talent = (GetTalentBySpellID(id) != nullptr); bool passive = spellInfo->IsPassive(); @@ -1065,39 +1069,44 @@ public: // Search in CharTitles.dbc for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) { - CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); - if (titleInfo) + if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id)) { - std::string name = target->getGender() == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang; + for (uint8 gender = GENDER_MALE; gender <= GENDER_FEMALE; ++gender) + { + if (target && target->getGender() != gender) + continue; - if (name.empty()) - continue; + std::string name = gender == GENDER_MALE ? titleInfo->NameMale_lang : titleInfo->NameFemale_lang; - if (!Utf8FitTo(name, wNamePart)) - continue; + if (name.empty()) + continue; - if (maxResults && counter == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + if (!Utf8FitTo(name, wNamePart)) + continue; + + if (maxResults && counter == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; + char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID - ? handler->GetTrinityString(LANG_ACTIVE) - : ""; + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID + ? handler->GetTrinityString(LANG_ACTIVE) + : ""; - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); - // send title in "id (idx:idx) - [namedlink locale]" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr); - else - handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr); + // send title in "id (idx:idx) - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->MaskID, id, titleNameStr, "", knownStr, activeStr); + else + handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->MaskID, titleNameStr, "", knownStr, activeStr); - ++counter; + ++counter; + } } } if (counter == 0) // if counter == 0 then we found nth diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index 715487eff99..664c8f3d216 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -74,7 +74,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); Channel* channcel = NULL; - if (ChannelMgr* cMgr = ChannelMgr::forTeam(player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::ForTeam(player->GetTeam())) channcel = cMgr->GetChannel(channelStr, player); if (strcmp(argStr, "on") == 0) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index e868811b113..52b8b859c21 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -96,6 +96,7 @@ public: { "unstuck", rbac::RBAC_PERM_COMMAND_UNSTUCK, true, &HandleUnstuckCommand, "", NULL }, { "wchange", rbac::RBAC_PERM_COMMAND_WCHANGE, false, &HandleChangeWeather, "", NULL }, { "mailbox", rbac::RBAC_PERM_COMMAND_MAILBOX, false, &HandleMailBoxCommand, "", NULL }, + { "auras ", rbac::RBAC_PERM_COMMAND_LIST_AURAS, false, &HandleAurasCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; @@ -1135,7 +1136,7 @@ public: char const* id = handler->extractKeyFromLink((char*)args, "Hitem"); if (!id) return false; - itemId = uint32(atol(id)); + itemId = atoul(id); } char const* ccount = strtok(NULL, " "); @@ -1217,7 +1218,7 @@ public: if (!id) return false; - uint32 itemSetId = atol(id); + uint32 itemSetId = atoul(id); // prevent generation all items with itemset field value '0' if (itemSetId == 0) @@ -1358,7 +1359,7 @@ public: return false; } - int32 level = uint32(atol(levelStr)); + int32 level = atol(levelStr); Player* target = handler->getSelectedPlayer(); if (!target) @@ -1380,7 +1381,7 @@ public: // If our target does not yet have the skill they are trying to add to them, the chosen level also becomes // the max level of the new profession. - uint16 max = maxPureSkill ? atol(maxPureSkill) : targetHasSkill ? target->GetPureMaxSkillValue(skill) : uint16(level); + uint16 max = maxPureSkill ? atoul(maxPureSkill) : targetHasSkill ? target->GetPureMaxSkillValue(skill) : uint16(level); if (level <= 0 || level > max || max <= 0) return false; @@ -1779,7 +1780,7 @@ public: uint32 totalmail = uint32(fields[1].GetUInt64()); // ... we have to convert it from Char to int. We can use totalmail as it is - rmailint = atol(readmail.c_str()); + rmailint = atoul(readmail.c_str()); // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given if (totalmail >= 1) @@ -2248,7 +2249,7 @@ public: SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); - if (Unit::IsDamageReducedByArmor(schoolmask)) + if (handler->GetSession()->GetPlayer()->IsDamageReducedByArmor(schoolmask)) damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); char* spellStr = strtok((char*)NULL, " "); @@ -2279,7 +2280,10 @@ public: if (!spellid || !sSpellMgr->GetSpellInfo(spellid)) return false; - handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); + SpellNonMeleeDamage damageInfo(handler->GetSession()->GetPlayer(), target, spellid, sSpellMgr->GetSpellInfo(spellid)->SchoolMask); + handler->GetSession()->GetPlayer()->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); + target->SendSpellNonMeleeDamageLog(&damageInfo); + target->DealSpellDamage(&damageInfo, true); return true; } @@ -2597,6 +2601,44 @@ public: handler->GetSession()->SendShowMailBox(player->GetGUID()); return true; } + + static bool HandleAurasCommand(ChatHandler* handler, char const* args) + { + Unit* target = handler->GetSession()->GetPlayer()->GetSelectedUnit(); + + if (!target) + { + handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + handler->SetSentErrorMessage(true); + return false; + } + + Unit::AuraApplicationMap const& uAuras = target->GetAppliedAuras(); + handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size()); + for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr) + { + AuraApplication const* aurApp = itr->second; + Aura const* aura = aurApp->GetBase(); + char const* name = aura->GetSpellInfo()->SpellName; + + bool self = target->GetGUID() == aura->GetCasterGUID(); + if (self) + handler->PSendSysMessage("%u: %s (self)", aura->GetId(), name); + else + { + if (Unit* u = aura->GetCaster()) + { + if (u->GetTypeId() == TYPEID_PLAYER) + handler->PSendSysMessage("%u: %s (player: %s)", aura->GetId(), name, u->GetName().c_str()); + else if (u->GetTypeId() == TYPEID_UNIT) + handler->PSendSysMessage("%u: %s (creature: %s)", aura->GetId(), name, u->GetName().c_str()); + } + else + handler->PSendSysMessage("%u: %s)", aura->GetId(), name); + } + } + return true; + } }; void AddSC_misc_commandscript() diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 7d42609a2a0..aadf97e9b0c 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1004,7 +1004,7 @@ public: if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c')) moneyToAdd = MoneyStringToMoney(std::string(args)); else - moneyToAdd = atol(args); + moneyToAdd = atoll(args); uint64 targetMoney = target->GetMoney(); @@ -1344,7 +1344,7 @@ public: } // Set gender - target->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender); + target->SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, gender); target->SetByteValue(PLAYER_BYTES_3, 0, gender); // Change display ID diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 9d64ba60bc4..3e841f45f59 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -332,15 +332,15 @@ public: char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0 uint32 maxcount = 0; if (fmaxcount) - maxcount = atol(fmaxcount); + maxcount = atoul(fmaxcount); char* fincrtime = strtok(NULL, " "); //add incrtime, default: 0 uint32 incrtime = 0; if (fincrtime) - incrtime = atol(fincrtime); + incrtime = atoul(fincrtime); char* fextendedcost = strtok(NULL, " "); //add ExtendedCost, default: 0 - uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; + uint32 extendedcost = fextendedcost ? atoul(fextendedcost) : 0; Creature* vendor = handler->getSelectedCreature(); if (!vendor) { @@ -570,7 +570,7 @@ public: handler->SetSentErrorMessage(true); return false; } - uint32 itemId = atol(pitem); + uint32 itemId = atoul(pitem); const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index b5186bdb948..8138a755f87 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -67,7 +67,7 @@ public: if (!cId) return false; - uint32 entry = atol(cId); + uint32 entry = atoul(cId); Quest const* quest = sObjectMgr->GetQuestTemplate(entry); @@ -112,7 +112,7 @@ public: if (!cId) return false; - uint32 entry = atol(cId); + uint32 entry = atoul(cId); Quest const* quest = sObjectMgr->GetQuestTemplate(entry); @@ -165,7 +165,7 @@ public: if (!cId) return false; - uint32 entry = atol(cId); + uint32 entry = atoul(cId); Quest const* quest = sObjectMgr->GetQuestTemplate(entry); @@ -269,7 +269,7 @@ public: if (!cId) return false; - uint32 entry = atol(cId); + uint32 entry = atoul(cId); Quest const* quest = sObjectMgr->GetQuestTemplate(entry); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index fa6adcc8eb0..a25c6bbcb59 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -137,7 +137,6 @@ public: { "smart_scripts", rbac::RBAC_PERM_COMMAND_RELOAD_SMART_SCRIPTS, true, &HandleReloadSmartScripts, "", NULL }, { "spell_required", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_REQUIRED, true, &HandleReloadSpellRequiredCommand, "", NULL }, { "spell_area", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_AREA, true, &HandleReloadSpellAreaCommand, "", NULL }, - { "spell_bonus_data", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_BONUS_DATA, true, &HandleReloadSpellBonusesCommand, "", NULL }, { "spell_group", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_GROUP, true, &HandleReloadSpellGroupsCommand, "", NULL }, { "spell_learn_spell", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_LEARN_SPELL, true, &HandleReloadSpellLearnSpellCommand, "", NULL }, { "spell_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_SPELL_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesSpellCommand, "", NULL }, @@ -279,7 +278,6 @@ public: HandleReloadSpellLinkedSpellCommand(handler, "a"); HandleReloadSpellProcEventCommand(handler, "a"); HandleReloadSpellProcsCommand(handler, "a"); - HandleReloadSpellBonusesCommand(handler, "a"); HandleReloadSpellTargetPositionCommand(handler, "a"); HandleReloadSpellThreatsCommand(handler, "a"); HandleReloadSpellGroupStackRulesCommand(handler, "a"); @@ -819,14 +817,6 @@ public: return true; } - static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/) - { - TC_LOG_INFO("misc", "Re-Loading Spell Bonus Data..."); - sSpellMgr->LoadSpellBonusess(); - handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); - return true; - } - static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/) { TC_LOG_INFO("misc", "Re-Loading Spell target coordinates..."); @@ -954,7 +944,7 @@ public: sObjectMgr->LoadGraveyardZones(); - handler->SendGlobalGMSysMessage("DB table `game_graveyard_zone` reloaded."); + handler->SendGlobalGMSysMessage("DB table `graveyard_zone` reloaded."); return true; } diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 01a0094bfc7..1c3bff77593 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -100,8 +100,7 @@ public: player->SetShapeshiftForm(FORM_NONE); player->setFactionForRace(player->getRace()); - - player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24))); + player->SetUInt32Value(UNIT_FIELD_DISPLAY_POWER, powerType); // reset only if player not in some form; if (player->GetShapeshiftForm() == FORM_NONE) diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp index 62d12a94c54..80ddecf8914 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp @@ -81,10 +81,7 @@ class boss_alizabal : public CreatureScript struct boss_alizabalAI : public BossAI { - boss_alizabalAI(Creature* creature) : BossAI(creature, DATA_ALIZABAL) - { - _intro = false; - } + boss_alizabalAI(Creature* creature) : BossAI(creature, DATA_ALIZABAL) { } void Reset() override { @@ -251,10 +248,9 @@ class boss_alizabal : public CreatureScript } private: - bool _intro; - bool _hate; - bool _skewer; - + bool _intro = false; + bool _hate = false; + bool _skewer = false; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp index 9c203ac2395..5805509cc9b 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_occuthar.cpp @@ -267,7 +267,7 @@ class spell_occuthar_eyes_of_occuthar : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue())) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue())) return false; return true; } diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp index 008803f9a52..26a6b89dee9 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp @@ -157,12 +157,6 @@ class spell_argaloth_meteor_slash : public SpellScriptLoader { PrepareSpellScript(spell_argaloth_meteor_slash_SpellScript); - bool Load() override - { - _targetCount = 0; - return true; - } - void CountTargets(std::list<WorldObject*>& targets) { _targetCount = targets.size(); @@ -183,7 +177,7 @@ class spell_argaloth_meteor_slash : public SpellScriptLoader } private: - uint32 _targetCount; + uint32 _targetCount = 0; }; SpellScript* GetSpellScript() const override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp index f736aa6ffbc..97d43ab163c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.cpp @@ -357,7 +357,7 @@ class npc_twilight_sadist : public CreatureScript void Reset() override { _combatPhase = false; - if(!me->GetWaypointPath()) + if (!me->GetWaypointPath()) _events.ScheduleEvent(EVENT_INFLICT_PAIN_TS, urand(6000, 18000)); } @@ -422,7 +422,7 @@ class npc_twilight_sadist : public CreatureScript private: EventMap _events; InstanceScript* _instance; - bool _combatPhase; + bool _combatPhase = false; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_corla.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_corla.cpp index 3f2e8f8b243..e97583c3575 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_corla.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_corla.cpp @@ -114,7 +114,7 @@ class boss_corla : public CreatureScript } private: - bool combatPhase; + bool combatPhase = false; }; CreatureAI* GetAI(Creature* creature) const override 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 4cb0b61365d..9c4865a8d84 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -485,23 +485,23 @@ public: void SpellHit(Unit* /*pAttacker*/, const SpellInfo* Spell) override { //We only care about interrupt effects and only if they are durring a spell currently being cast - if ((Spell->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effects[1].Effect != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effects[2].Effect != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCast(false)) - return; - - //Interrupt effect - me->InterruptNonMeleeSpells(false); + for (SpellEffectInfo const* effect : Spell->GetEffectsForDifficulty(me->GetMap()->GetDifficulty())) + if (effect && effect->Effect == SPELL_EFFECT_INTERRUPT_CAST && me->IsNonMeleeSpellCast(false)) + { + //Interrupt effect + me->InterruptNonMeleeSpells(false); - //Normally we would set the cooldown equal to the spell duration - //but we do not have access to the DurationStore + //Normally we would set the cooldown equal to the spell duration + //but we do not have access to the DurationStore - switch (CurrentNormalSpell) - { - case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; - case SPELL_FIREBALL: FireCooldown = 5000; break; - case SPELL_FROSTBOLT: FrostCooldown = 5000; break; - } + switch (CurrentNormalSpell) + { + case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; + case SPELL_FIREBALL: FireCooldown = 5000; break; + case SPELL_FROSTBOLT: FrostCooldown = 5000; break; + } + return; + } } }; }; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 6cd14598a58..6758808c5d9 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -164,8 +164,10 @@ public: { if (Player* player = i->GetSource()) { - if (spell && spell->Effects[0].MiscValue) - player->KilledMonsterCredit(spell->Effects[0].MiscValue); + if (spell) + if (SpellEffectInfo const* effect = spell->GetEffect(EFFECT_0)) + if (effect->MiscValue) + player->KilledMonsterCredit(effect->MiscValue); } } } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 69c188a61dc..e5a42096a04 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -314,7 +314,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader int8 phase_to_set = 0; int32 gate_to_close = 0; - switch (GetSpellInfo()->Effects[effIndex].MiscValue) + switch (GetSpellInfo()->GetEffect(effIndex)->MiscValue) { case SPELL_EVENT_HALLOFSECRETS: pos_to_summon = 0; // Not yet spawned diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 99b710afb1e..cf0228f5192 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -412,9 +412,14 @@ public: void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) override { - for (uint8 i = 0; i < 3; ++i) - if (Spell->Effects[i].Effect == 38) + for (SpellEffectInfo const* effect : Spell->GetEffectsForDifficulty(DIFFICULTY_NONE)) + { + if (effect && effect->Effect == 38) + { me->DisappearAndDie(); + return; + } + } } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index dd1152a02a5..ac557bcad97 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -141,6 +141,7 @@ class npc_voljin_zulaman : public CreatureScript case EVENT_INTRO_MOVEPOINT_3: Talk(SAY_INTRO_2); _events.ScheduleEvent(EVENT_BANGING_THE_GONG, 3000); + break; case EVENT_BANGING_THE_GONG: DoCast(me, SPELL_BANGING_THE_GONG); if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG))) @@ -208,7 +209,7 @@ class npc_voljin_zulaman : public CreatureScript private: InstanceScript* _instance; EventMap _events; - uint8 _gongCount; + uint8 _gongCount = 0; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 992b20d2580..e0416b56397 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -25,10 +25,9 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "hyjal.h" -#include "SpellAuras.h" -#include "hyjal_trash.h" +#include "SpellScript.h" #include "Player.h" +#include "hyjal.h" enum Texts { @@ -39,42 +38,59 @@ enum Texts SAY_ENRAGE = 5, SAY_DEATH = 6, SAY_SOUL_CHARGE = 7, + // YELL_ARCHIMONDE_INTRO = 8 }; enum Spells { - SPELL_DENOUEMENT_WISP = 32124, - SPELL_ANCIENT_SPARK = 39349, - SPELL_PROTECTION_OF_ELUNE = 38528, - - SPELL_DRAIN_WORLD_TREE = 39140, - SPELL_DRAIN_WORLD_TREE_2 = 39141, - - SPELL_FINGER_OF_DEATH = 31984, - SPELL_HAND_OF_DEATH = 35354, - SPELL_AIR_BURST = 32014, - SPELL_GRIP_OF_THE_LEGION = 31972, - SPELL_DOOMFIRE_STRIKE = 31903, //summons two creatures - SPELL_DOOMFIRE_SPAWN = 32074, - SPELL_DOOMFIRE = 31945, - SPELL_SOUL_CHARGE_YELLOW = 32045, - SPELL_SOUL_CHARGE_GREEN = 32051, - SPELL_SOUL_CHARGE_RED = 32052, - SPELL_UNLEASH_SOUL_YELLOW = 32054, - SPELL_UNLEASH_SOUL_GREEN = 32057, - SPELL_UNLEASH_SOUL_RED = 32053, - SPELL_FEAR = 31970, + SPELL_DENOUEMENT_WISP = 32124, + SPELL_ANCIENT_SPARK = 39349, + SPELL_PROTECTION_OF_ELUNE = 38528, + + SPELL_DRAIN_WORLD_TREE = 39140, + SPELL_DRAIN_WORLD_TREE_TRIGGERED = 39141, + + SPELL_FINGER_OF_DEATH = 31984, + SPELL_HAND_OF_DEATH = 35354, + SPELL_AIR_BURST = 32014, + SPELL_GRIP_OF_THE_LEGION = 31972, + SPELL_DOOMFIRE_STRIKE = 31903, // summons two creatures + SPELL_DOOMFIRE_SPAWN = 32074, + SPELL_DOOMFIRE = 31945, + SPELL_SOUL_CHARGE_YELLOW = 32045, + SPELL_SOUL_CHARGE_GREEN = 32051, + SPELL_SOUL_CHARGE_RED = 32052, + SPELL_UNLEASH_SOUL_YELLOW = 32054, + SPELL_UNLEASH_SOUL_GREEN = 32057, + SPELL_UNLEASH_SOUL_RED = 32053, + SPELL_FEAR = 31970 +}; + +enum Events +{ + EVENT_HAND_OF_DEATH = 1, // Raid wiper + EVENT_UNLEASH_SOUL_CHARGE, + EVENT_FINGER_OF_DEATH, + EVENT_GRIP_OF_THE_LEGION, + EVENT_FEAR, + EVENT_AIR_BURST, + EVENT_DOOMFIRE, + EVENT_DISTANCE_CHECK, // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage + EVENT_SUMMON_WHISP }; enum Summons { - CREATURE_DOOMFIRE = 18095, - CREATURE_DOOMFIRE_SPIRIT = 18104, - CREATURE_ANCIENT_WISP = 17946, - CREATURE_CHANNEL_TARGET = 22418, + NPC_DOOMFIRE = 18095, + NPC_DOOMFIRE_SPIRIT = 18104, + NPC_ANCIENT_WISP = 17946 }; -Position const NordrassilLoc = {5503.713f, -3523.436f, 1608.781f, 0.0f}; +enum Actions +{ + ACTION_ENRAGE, + ACTION_CHANNEL_WORLD_TREE +}; class npc_ancient_wisp : public CreatureScript { @@ -200,7 +216,6 @@ public: } void MoveInLineOfSight(Unit* who) override - { //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 //when UpdateAI needs it, it will be forced to select randomPoint @@ -249,409 +264,309 @@ class boss_archimonde : public CreatureScript public: boss_archimonde() : CreatureScript("boss_archimonde") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_archimondeAI>(creature); - } - - struct boss_archimondeAI : public hyjal_trashAI + struct boss_archimondeAI : public BossAI { - boss_archimondeAI(Creature* creature) : hyjal_trashAI(creature) + boss_archimondeAI(Creature* creature) : BossAI(creature, DATA_ARCHIMONDE) { Initialize(); - instance = creature->GetInstanceScript(); } void Initialize() { DoomfireSpiritGUID.Clear(); - damageTaken = 0; - WorldTreeGUID.Clear(); - - DrainNordrassilTimer = 0; - FearTimer = 42000; - AirBurstTimer = 30000; - GripOfTheLegionTimer = urand(5000, 25000); - DoomfireTimer = 20000; - SoulChargeTimer = urand(2000, 30000); + SoulChargeCount = 0; - MeleeRangeCheckTimer = 15000; - HandOfDeathTimer = 2000; WispCount = 0; // When ~30 wisps are summoned, Archimonde dies - EnrageTimer = 600000; // 10 minutes - CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage - SummonWispTimer = 0; + _unleashSpell = 0; + _chargeSpell = 0; Enraged = false; - BelowTenPercent = false; HasProtected = false; - IsChanneling = false; } - InstanceScript* instance; - - ObjectGuid DoomfireSpiritGUID; - ObjectGuid WorldTreeGUID; - - uint32 DrainNordrassilTimer; - uint32 FearTimer; - uint32 AirBurstTimer; - uint32 GripOfTheLegionTimer; - uint32 DoomfireTimer; - uint32 SoulChargeTimer; - uint8 SoulChargeCount; - uint32 MeleeRangeCheckTimer; - uint32 HandOfDeathTimer; - uint32 SummonWispTimer; - uint8 WispCount; - uint32 EnrageTimer; - uint32 CheckDistanceTimer; - - bool Enraged; - bool BelowTenPercent; - bool HasProtected; - bool IsChanneling; + void InitializeAI() override + { + BossAI::InitializeAI(); + DoAction(ACTION_CHANNEL_WORLD_TREE); + } void Reset() override { - instance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - Initialize(); + _Reset(); + me->RemoveAllAuras(); // Reset Soul Charge auras. } void EnterCombat(Unit* /*who*/) override { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); Talk(SAY_AGGRO); - DoZoneInCombat(); - - instance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); - } - - void KilledUnit(Unit* victim) override - { - Talk(SAY_SLAY); - - if (victim && victim->GetTypeId() == TYPEID_PLAYER) - GainSoulCharge(victim->ToPlayer()); + _EnterCombat(); + events.ScheduleEvent(EVENT_FEAR, 42000); + events.ScheduleEvent(EVENT_AIR_BURST, 30000); + events.ScheduleEvent(EVENT_GRIP_OF_THE_LEGION, urand(5000, 25000)); + events.ScheduleEvent(EVENT_DOOMFIRE, 20000); + events.ScheduleEvent(EVENT_UNLEASH_SOUL_CHARGE, urand(2000, 30000)); + events.ScheduleEvent(EVENT_FINGER_OF_DEATH, 15000); + events.ScheduleEvent(EVENT_HAND_OF_DEATH, 600000); + events.ScheduleEvent(EVENT_DISTANCE_CHECK, 30000); } - void GainSoulCharge(Player* victim) + void ExecuteEvent(uint32 eventId) override { - switch (victim->getClass()) + switch (eventId) { - case CLASS_PRIEST: - case CLASS_PALADIN: - case CLASS_WARLOCK: - victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); + case EVENT_HAND_OF_DEATH: + DoCastAOE(SPELL_HAND_OF_DEATH); + events.ScheduleEvent(EVENT_HAND_OF_DEATH, 2000); + break; + case EVENT_UNLEASH_SOUL_CHARGE: + _chargeSpell = 0; + _unleashSpell = 0; + me->InterruptNonMeleeSpells(false); + switch (urand(0, 2)) + { + case 0: + _chargeSpell = SPELL_SOUL_CHARGE_RED; + _unleashSpell = SPELL_UNLEASH_SOUL_RED; + break; + case 1: + _chargeSpell = SPELL_SOUL_CHARGE_YELLOW; + _unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; + break; + case 2: + _chargeSpell = SPELL_SOUL_CHARGE_GREEN; + _unleashSpell = SPELL_UNLEASH_SOUL_GREEN; + break; + } + + if (me->HasAura(_chargeSpell)) + { + me->RemoveAuraFromStack(_chargeSpell); + DoCastVictim(_unleashSpell); + SoulChargeCount--; + events.ScheduleEvent(EVENT_UNLEASH_SOUL_CHARGE, urand(2000, 30000)); + } + break; + case EVENT_FINGER_OF_DEATH: + if (!SelectTarget(SELECT_TARGET_RANDOM, 0, 5.0f)) // Checks if there are no targets in melee range + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); + events.ScheduleEvent(EVENT_FINGER_OF_DEATH, 1000); + } + else + events.ScheduleEvent(EVENT_FINGER_OF_DEATH, 5000); break; - case CLASS_MAGE: - case CLASS_ROGUE: - case CLASS_WARRIOR: - victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); + case EVENT_GRIP_OF_THE_LEGION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_GRIP_OF_THE_LEGION); + events.ScheduleEvent(EVENT_GRIP_OF_THE_LEGION, urand(5000, 25000)); break; - case CLASS_DRUID: - case CLASS_SHAMAN: - case CLASS_HUNTER: - victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); + case EVENT_AIR_BURST: + Talk(SAY_AIR_BURST); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + DoCast(target, SPELL_AIR_BURST); //not on tank + events.ScheduleEvent(EVENT_AIR_BURST, urand(25000, 40000)); + break; + case EVENT_FEAR: + DoCastAOE(SPELL_FEAR); + events.ScheduleEvent(EVENT_FEAR, 42000); + break; + case EVENT_DOOMFIRE: + Talk(SAY_DOOMFIRE); + if (Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1)) + SummonDoomfire(temp); + else + SummonDoomfire(me->GetVictim()); + events.ScheduleEvent(EVENT_DOOMFIRE, 20000); + break; + case EVENT_DISTANCE_CHECK: + if (Creature* channelTrigger = instance->GetCreature(DATA_CHANNEL_TARGET)) + if (me->IsWithinDistInMap(channelTrigger, 75.0f)) + DoAction(ACTION_ENRAGE); + events.ScheduleEvent(EVENT_DISTANCE_CHECK, 5000); + break; + case EVENT_SUMMON_WHISP: + DoSpawnCreature(NPC_ANCIENT_WISP, float(rand32() % 40), float(rand32() % 40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + ++WispCount; + if (WispCount >= 30) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + events.ScheduleEvent(EVENT_SUMMON_WHISP, 1500); + break; + default: break; } - - SoulChargeTimer = urand(2000, 30000); - ++SoulChargeCount; - } - - void JustDied(Unit* killer) override - { - hyjal_trashAI::JustDied(killer); - Talk(SAY_DEATH); - - instance->SetData(DATA_ARCHIMONDEEVENT, DONE); } - bool CanUseFingerOfDeath() + void DamageTaken(Unit* /*attacker*/, uint32 &damage) override { - // First we check if our current victim is in melee range or not. - Unit* victim = me->GetVictim(); - if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim))) - return false; - - ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); - if (threatlist.empty()) - return false; - - std::list<Unit*> targets; - ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); - for (; itr != threatlist.end(); ++itr) + if (me->HealthBelowPctDamaged(10, damage)) { - Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); - if (unit && unit->IsAlive()) - targets.push_back(unit); - } + if (!Enraged) + DoAction(ACTION_ENRAGE); - if (targets.empty()) - return false; + if (!HasProtected) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); - targets.sort(Trinity::ObjectDistanceOrderPred(me)); - Unit* target = targets.front(); - if (target) - { - if (!me->IsWithinDistInMap(target, me->GetAttackDistance(target))) - return true; // Cast Finger of Death - else // This target is closest, he is our new tank - me->AddThreat(target, me->getThreatManager().getThreat(me->GetVictim())); + // All members of raid must get this buff + DoCastAOE(SPELL_PROTECTION_OF_ELUNE, true); + HasProtected = true; + events.ScheduleEvent(EVENT_SUMMON_WHISP, 1500); + } } - - return false; } - void JustSummoned(Creature* summoned) override + void KilledUnit(Unit* victim) override { - if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) - summoned->AI()->AttackStart(me); - else - { - summoned->setFaction(me->getFaction()); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) - { - DoomfireSpiritGUID = summoned->GetGUID(); - } + Talk(SAY_SLAY); - if (summoned->GetEntry() == CREATURE_DOOMFIRE) + if (victim->GetTypeId() == TYPEID_PLAYER) { - summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false); - summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID()); - - if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID)) + switch (victim->getClass()) { - summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f); - DoomfireSpiritGUID.Clear(); + case CLASS_PRIEST: + case CLASS_PALADIN: + case CLASS_WARLOCK: + victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); + break; + case CLASS_MAGE: + case CLASS_ROGUE: + case CLASS_WARRIOR: + victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); + break; + case CLASS_DRUID: + case CLASS_SHAMAN: + case CLASS_HUNTER: + victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); + break; } + + events.ScheduleEvent(EVENT_UNLEASH_SOUL_CHARGE, urand(2000, 30000)); + ++SoulChargeCount; } } - //this is code doing close to what the summoning spell would do (spell 31903) - void SummonDoomfire(Unit* target) + void JustReachedHome() override { - me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, - target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, - TEMPSUMMON_TIMED_DESPAWN, 27000); - - me->SummonCreature(CREATURE_DOOMFIRE, - target->GetPositionX()-15.0f, target->GetPositionY()-15.0f, target->GetPositionZ(), 0, - TEMPSUMMON_TIMED_DESPAWN, 27000); + DoAction(ACTION_CHANNEL_WORLD_TREE); } - void UnleashSoulCharge() + void JustDied(Unit* /*killer*/) override { - me->InterruptNonMeleeSpells(false); - - bool HasCast = false; - uint32 chargeSpell = 0; - uint32 unleashSpell = 0; + Talk(SAY_DEATH); + _JustDied(); + // @todo: remove this when instance script gets updated, kept for compatibility only + instance->SetData(DATA_ARCHIMONDE, DONE); + } - switch (urand(0, 2)) + void JustSummoned(Creature* summoned) override + { + switch (summoned->GetEntry()) { - case 0: - chargeSpell = SPELL_SOUL_CHARGE_RED; - unleashSpell = SPELL_UNLEASH_SOUL_RED; - break; - case 1: - chargeSpell = SPELL_SOUL_CHARGE_YELLOW; - unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; + case NPC_ANCIENT_WISP: + summoned->AI()->AttackStart(me); break; - case 2: - chargeSpell = SPELL_SOUL_CHARGE_GREEN; - unleashSpell = SPELL_UNLEASH_SOUL_GREEN; + case NPC_DOOMFIRE_SPIRIT: + DoomfireSpiritGUID = summoned->GetGUID(); break; - } + case NPC_DOOMFIRE: + summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN, false); + summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID()); - if (me->HasAura(chargeSpell)) - { - me->RemoveAuraFromStack(chargeSpell); - DoCastVictim(unleashSpell); - HasCast = true; - SoulChargeCount--; + if (Unit* DoomfireSpirit = ObjectAccessor::GetUnit(*me, DoomfireSpiritGUID)) + { + summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit, 0.0f, 0.0f); + DoomfireSpiritGUID.Clear(); + } + break; + default: + break; } - - if (HasCast) - SoulChargeTimer = urand(2000, 30000); } - void UpdateAI(uint32 diff) override + void DoAction(int32 actionId) override { - if (!me->IsInCombat()) + switch (actionId) { - // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. - if ((instance->GetData(DATA_AZGALOREVENT) < DONE) && (me->IsVisible() || (me->getFaction() != 35))) - { - me->SetVisible(false); - me->setFaction(35); - } - else if ((instance->GetData(DATA_AZGALOREVENT) >= DONE) && (!me->IsVisible() || (me->getFaction() == 35))) - { - me->setFaction(1720); - me->SetVisible(true); - } - - if (DrainNordrassilTimer <= diff) - { - if (!IsChanneling) - { - Creature* temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 1200000); - - if (temp) - WorldTreeGUID = temp->GetGUID(); - - if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID)) - { - Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Nordrassil->SetDisplayId(11686); - DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); - IsChanneling = true; - } - } - - if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID)) - { - Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); - DrainNordrassilTimer = 1000; - } - } else DrainNordrassilTimer -= diff; + case ACTION_ENRAGE: + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + Enraged = true; + Talk(SAY_ENRAGE); + break; + case ACTION_CHANNEL_WORLD_TREE: + DoCastAOE(SPELL_DRAIN_WORLD_TREE, true); + break; + default: + break; } + } - if (!UpdateVictim()) + //this is code doing close to what the summoning spell would do (spell 31903) + void SummonDoomfire(Unit* target) + { + if (!target) return; - if (me->HealthBelowPct(10) && !BelowTenPercent && !Enraged) - BelowTenPercent = true; - - if (!Enraged) - { - if (EnrageTimer <= diff) - { - if (HealthAbovePct(10)) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - Enraged = true; - Talk(SAY_ENRAGE); - } - } else EnrageTimer -= diff; + me->SummonCreature(NPC_DOOMFIRE_SPIRIT, + target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, + TEMPSUMMON_TIMED_DESPAWN, 27000); - if (CheckDistanceTimer <= diff) - { - // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature - Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NordrassilLoc, TEMPSUMMON_TIMED_DESPAWN, 2000); - if (Check) - { - Check->SetVisible(false); - - if (me->IsWithinDistInMap(Check, 75)) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - Enraged = true; - Talk(SAY_ENRAGE); - } - } - CheckDistanceTimer = 5000; - } else CheckDistanceTimer -= diff; - } + me->SummonCreature(NPC_DOOMFIRE, + target->GetPositionX()-15.0f, target->GetPositionY()-15.0f, target->GetPositionZ(), 0, + TEMPSUMMON_TIMED_DESPAWN, 27000); + } - if (BelowTenPercent) - { - if (!HasProtected) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); + private: + ObjectGuid DoomfireSpiritGUID; + uint8 SoulChargeCount; + uint8 WispCount; + uint32 _chargeSpell; + uint32 _unleashSpell; + bool Enraged; + bool HasProtected; + }; - //all members of raid must get this buff - DoCastVictim(SPELL_PROTECTION_OF_ELUNE, true); - HasProtected = true; - Enraged = true; - } + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI<boss_archimondeAI>(creature); + } +}; - if (SummonWispTimer <= diff) - { - 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; +// 39142 - Drain World Tree Dummy +class spell_archimonde_drain_world_tree_dummy : public SpellScriptLoader +{ + public: + spell_archimonde_drain_world_tree_dummy() : SpellScriptLoader("spell_archimonde_drain_world_tree_dummy") { } - if (WispCount >= 30) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + class spell_archimonde_drain_world_tree_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_archimonde_drain_world_tree_dummy_SpellScript); - if (Enraged) + bool Validate(SpellInfo const* /*spellInfo*/) override { - if (HandOfDeathTimer <= diff) - { - DoCastVictim(SPELL_HAND_OF_DEATH); - HandOfDeathTimer = 2000; - } else HandOfDeathTimer -= diff; - return; // Don't do anything after this point. + if (!sSpellMgr->GetSpellInfo(SPELL_DRAIN_WORLD_TREE_TRIGGERED)) + return false; + return true; } - if (SoulChargeCount) + void HandleScript(SpellEffIndex /*effIndex*/) { - if (SoulChargeTimer <= diff) - UnleashSoulCharge(); - else SoulChargeTimer -= diff; + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), SPELL_DRAIN_WORLD_TREE_TRIGGERED, true); } - if (GripOfTheLegionTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); - GripOfTheLegionTimer = urand(5000, 25000); - } else GripOfTheLegionTimer -= diff; - - if (AirBurstTimer <= diff) - { - Talk(SAY_AIR_BURST); - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank - AirBurstTimer = urand(25000, 40000); - } else AirBurstTimer -= diff; - - if (FearTimer <= diff) - { - DoCastVictim(SPELL_FEAR); - FearTimer = 42000; - } else FearTimer -= diff; - - if (DoomfireTimer <= diff) + void Register() override { - Talk(SAY_DOOMFIRE); - Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 1); - if (!temp) - temp = me->GetVictim(); - - //replace with spell cast 31903 once implicitTarget 73 implemented - SummonDoomfire(temp); - - //supposedly three doomfire can be up at the same time - DoomfireTimer = 20000; - } else DoomfireTimer -= diff; - - if (MeleeRangeCheckTimer <= diff) - { - if (CanUseFingerOfDeath()) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); - MeleeRangeCheckTimer = 1000; - } - - MeleeRangeCheckTimer = 5000; - } else MeleeRangeCheckTimer -= diff; + OnEffectHitTarget += SpellEffectFn(spell_archimonde_drain_world_tree_dummy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - DoMeleeAttackIfReady(); + SpellScript* GetSpellScript() const override + { + return new spell_archimonde_drain_world_tree_dummy_SpellScript(); } - void WaypointReached(uint32 /*waypointId*/) override { } - }; }; void AddSC_boss_archimonde() @@ -660,4 +575,5 @@ void AddSC_boss_archimonde() new npc_doomfire(); new npc_doomfire_targetting(); new npc_ancient_wisp(); + new spell_archimonde_drain_world_tree_dummy(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h index c5f4d4ae679..54a763573ed 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h @@ -44,7 +44,8 @@ enum DataTypes DATA_HORDE_RETREAT = 17, DATA_RAIDDAMAGE = 18, DATA_RESET_RAIDDAMAGE = 19, - TYPE_RETREAT = 20 + TYPE_RETREAT = 20, + DATA_CHANNEL_TARGET = 21 }; enum WorldStateIds @@ -77,7 +78,8 @@ enum CreaturesIds KAZROGAL = 17888, AZGALOR = 17842, ARCHIMONDE = 17968, - NPC_WORLD_TRIGGER_TINY = 21987 + NPC_WORLD_TRIGGER_TINY = 21987, + NPC_CHANNEL_TARGET = 22418 }; enum GameobjectIds @@ -89,5 +91,6 @@ enum GameobjectIds GO_ROARING_FLAME = 182592 }; -#endif +#define MINRAIDDAMAGE 700000 // minimal damage before trash can drop loot and reputation, resets if faction leader dies +#endif diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 56b79b6b3e1..0394b8535e5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -26,7 +26,6 @@ enum Spells SPELL_METEOR = 33814, //infernal visual SPELL_IMMOLATION = 37059, SPELL_FLAME_BUFFET = 31724, - NPC_TRIGGER = 21987, //World Trigger (Tiny) MODEL_INVIS = 11686, //invisible model SPELL_DISEASE_CLOUD = 31607, SPELL_KNOCKDOWN = 31610, @@ -465,10 +464,7 @@ public: } if (!meteor) { - float x, y, z; - me->GetPosition(x, y, z); - Creature* trigger = me->SummonCreature(NPC_TRIGGER, x + 8, y + 8, z + 25 + rand32() % 10, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1000); - if (trigger) + if (Creature* trigger = me->SummonCreature(NPC_WORLD_TRIGGER_TINY, me->GetPositionWithOffset({ 8.0f, 8.0f, frand(25.0f, 35.0f), 0.0f }), TEMPSUMMON_TIMED_DESPAWN, 1000)) { trigger->SetVisible(false); trigger->setFaction(me->getFaction()); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h index 18122ba2b0c..62f82ebcee1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h @@ -21,8 +21,6 @@ #include "hyjal.h" #include "ScriptedEscortAI.h" -#define MINRAIDDAMAGE 700000//minimal damage before trash can drop loot and reputation, resets if faction leader dies - struct hyjal_trashAI : public npc_escortAI { hyjal_trashAI(Creature* creature); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 176c24f6707..99b8515c6e8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -26,11 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "ScriptedCreature.h" -#include "hyjal_trash.h" -#include "Player.h" -#include "WorldPacket.h" -#include "Chat.h" -#include "WorldSession.h" +#include "hyjal.h" /* Battle of Mount Hyjal encounters: 0 - Rage Winterchill event @@ -40,8 +36,16 @@ EndScriptData */ 4 - Archimonde event */ -#define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." -#define YELL_EFFORTS_NAME "Archimonde" +enum Yells +{ + YELL_ARCHIMONDE_INTRO = 8 +}; + +ObjectData const creatureData[] = +{ + { NPC_CHANNEL_TARGET, DATA_CHANNEL_TARGET }, + { 0, 0 } // END +}; class instance_hyjal : public InstanceMapScript { @@ -58,6 +62,7 @@ public: instance_mount_hyjal_InstanceMapScript(Map* map) : InstanceScript(map) { SetHeaders(DataHeader); + LoadObjectData(creatureData, nullptr); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); RaidDamage = 0; @@ -105,15 +110,35 @@ public: { switch (creature->GetEntry()) { - case RAGE_WINTERCHILL: RageWinterchill = creature->GetGUID(); break; - case ANETHERON: Anetheron = creature->GetGUID(); break; - case KAZROGAL: Kazrogal = creature->GetGUID(); break; - case AZGALOR: Azgalor = creature->GetGUID(); break; - case ARCHIMONDE: Archimonde = creature->GetGUID(); break; - case JAINA: JainaProudmoore = creature->GetGUID(); break; - case THRALL: Thrall = creature->GetGUID(); break; - case TYRANDE: TyrandeWhisperwind = creature->GetGUID(); break; + case RAGE_WINTERCHILL: + RageWinterchill = creature->GetGUID(); + break; + case ANETHERON: + Anetheron = creature->GetGUID(); + break; + case KAZROGAL: + Kazrogal = creature->GetGUID(); + break; + case AZGALOR: + Azgalor = creature->GetGUID(); + break; + case ARCHIMONDE: + Archimonde = creature->GetGUID(); + if (GetData(DATA_AZGALOREVENT) != DONE) + creature->SetVisible(false); + break; + case JAINA: + JainaProudmoore = creature->GetGUID(); + break; + case THRALL: + Thrall = creature->GetGUID(); + break; + case TYRANDE: + TyrandeWhisperwind = creature->GetGUID(); + break; } + + InstanceScript::OnCreatureCreate(creature); } ObjectGuid GetGuidData(uint32 identifier) const override @@ -147,40 +172,18 @@ public: m_auiEncounter[2] = data; break; case DATA_AZGALOREVENT: + m_auiEncounter[3] = data; + if (data == DONE) { - m_auiEncounter[3] = data; - if (data == DONE) + instance->LoadGrid(5581.49f, -3445.63f); + if (Creature* archimonde = instance->GetCreature(Archimonde)) { - if (ArchiYell) - break; + archimonde->SetVisible(true); - ArchiYell = true; - - Creature* creature = instance->GetCreature(Azgalor); - if (creature) + if (!ArchiYell) { - Creature* unit = creature->SummonCreature(NPC_WORLD_TRIGGER_TINY, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000); - - Map* map = creature->GetMap(); - if (map->IsDungeon() && unit) - { - unit->SetVisible(false); - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (Player* player = i->GetSource()) - { - WorldPacket packet; - - ChatHandler::BuildChatPacket(packet, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, unit, player, YELL_EFFORTS); - player->SendDirectMessage(&packet); - player->PlayDirectSound(10986, player); - } - } - } + ArchiYell = true; + archimonde->AI()->Talk(YELL_ARCHIMONDE_INTRO); } } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index b84d24d66d3..794496382c2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -292,6 +292,7 @@ public: break; } player->CLOSE_GOSSIP_MENU(); + ai->SetDespawnAtFar(false); creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); return true; } diff --git a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp index 9b8b435e93c..386f80c0c64 100644 --- a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp +++ b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp @@ -484,7 +484,7 @@ class npc_egg_pile : public CreatureScript private: EventMap _events; - uint32 _callHatchlingSpell; + uint32 _callHatchlingSpell = 0; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp index 84a267543c5..15fbef8a08b 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp @@ -537,7 +537,7 @@ public: /// TODO: Remove this once we find a general rule for WorldObject::MovePosition (this spell shouldn't take the Z change into consideration) Unit* caster = GetCaster(); float angle = float(rand_norm()) * static_cast<float>(2 * M_PI); - uint32 dist = caster->GetObjectSize() + GetSpellInfo()->Effects[effIndex].CalcRadius(GetCaster()) * (float)rand_norm(); + uint32 dist = caster->GetObjectSize() + GetSpellInfo()->GetEffect(effIndex)->CalcRadius(GetCaster()) * (float)rand_norm(); float x = caster->GetPositionX() + dist * std::cos(angle); float y = caster->GetPositionY() + dist * std::sin(angle); diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp index 47a40dd56ef..38b587eacf7 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp @@ -80,7 +80,17 @@ public: struct boss_temple_guardian_anhuurAI : public BossAI { - boss_temple_guardian_anhuurAI(Creature* creature) : BossAI(creature, DATA_TEMPLE_GUARDIAN_ANHUUR) { } + boss_temple_guardian_anhuurAI(Creature* creature) : BossAI(creature, DATA_TEMPLE_GUARDIAN_ANHUUR) + { + Initialize(); + } + + void Initialize() + { + _phase = PHASE_FIRST_SHIELD; + _oldPhase = PHASE_FIRST_SHIELD; + _beacons = 0; + } void CleanStalkers() { @@ -95,9 +105,7 @@ public: void Reset() override { - _phase = PHASE_FIRST_SHIELD; - _oldPhase = PHASE_FIRST_SHIELD; - _beacons = 0; + Initialize(); _Reset(); CleanStalkers(); me->RemoveAurasDueToSpell(SPELL_SHIELD_OF_LIGHT); @@ -378,7 +386,7 @@ public: { CustomSpellValues values; values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()); - caster->CastCustomSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, values, GetTarget()); + caster->CastCustomSpell(GetSpellInfo()->GetEffect(caster, EFFECT_0)->TriggerSpell, values, GetTarget()); } } diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp index 4377344fb26..30a0e2441fb 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp @@ -65,6 +65,7 @@ class instance_halls_of_origination : public InstanceMapScript { case GO_ANHUURS_BRIDGE: AnhuursBridgeGUID = go->GetGUID(); + // no break case GO_DOODAD_ULDUM_ELEVATOR_COL01: case GO_VAULT_OF_LIGHTS_DOOR: case GO_DOODAD_ULDUM_LIGHTMACHINE_01: diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 189cc842d9b..919f8b43ce3 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -106,7 +106,7 @@ public: //THIS GOB IS A TRAP - What shall i do? =( //Cast it spell? Copyed Heigan method floorEruption->SendCustomAnim(floorEruption->GetGoAnimProgress()); - floorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId + floorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == DIFFICULTY_10_N ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId //Get all immediatly nearby floors std::list<GameObject*> nearFloorList; diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index e0b03d54f69..533d78a68f5 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -518,7 +518,7 @@ class spell_ooze_zap : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) + if (!GetCaster()->HasAura(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct if (!GetExplTargetUnit()) @@ -603,7 +603,7 @@ class spell_energize_aoe : public SpellScriptLoader { for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE) + if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()) == QUEST_STATUS_INCOMPLETE) ++itr; else targets.erase(itr++); diff --git a/src/server/scripts/Kalimdor/zone_felwood.cpp b/src/server/scripts/Kalimdor/zone_felwood.cpp index e4d5925c950..9f02e14220e 100644 --- a/src/server/scripts/Kalimdor/zone_felwood.cpp +++ b/src/server/scripts/Kalimdor/zone_felwood.cpp @@ -51,7 +51,7 @@ public: void Reset() override { - lasher_clicked = false; + lasherClicked = false; } void OnSpellClick(Unit* clicker, bool& result) override @@ -74,7 +74,7 @@ public: me->CastSpell(me, SPELL_STAND); me->GetMotionMaster()->MoveRandom(8.0f); events.ScheduleEvent(EVENT_CHECK_OOC, 20000); - lasher_clicked = true; + lasherClicked = true; if (Player* player = clicker->ToPlayer()) player->KilledMonsterCredit(NPC_WHISPERWIND_LASHER); @@ -82,7 +82,7 @@ public: void UpdateAI(uint32 diff) override { - if (!lasher_clicked) + if (!lasherClicked) return; events.Update(diff); @@ -104,7 +104,7 @@ public: private: EventMap events; - bool lasher_clicked; + bool lasherClicked = false; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp index 01baf54eef7..1cf0cc56242 100644 --- a/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/boss_corborus.cpp @@ -241,7 +241,7 @@ class boss_corborus : public CreatureScript private: EncounterState stateIntro; - uint32 countTrashingCharge; + uint32 countTrashingCharge = 0; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp index 0535ac64a9f..08d56f2fa50 100644 --- a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp @@ -132,13 +132,11 @@ class boss_high_priestess_azil : public CreatureScript struct boss_high_priestess_azilAI : public BossAI { - boss_high_priestess_azilAI(Creature* creature) : BossAI(creature, DATA_HIGH_PRIESTESS_AZIL), vehicle(creature->GetVehicleKit()) + boss_high_priestess_azilAI(Creature* creature) : BossAI(creature, DATA_HIGH_PRIESTESS_AZIL) { - ASSERT(vehicle); + ASSERT(creature->GetVehicleKit()); } - Vehicle* vehicle; - void Reset() override { _Reset(); @@ -276,7 +274,7 @@ class boss_high_priestess_azil : public CreatureScript me->GetMotionMaster()->MovePoint(POINT_ABOVE_PLATFORM, AbovePlatformPos); break; case EVENT_EARTH_FURY_CHECK_SEAT0: - if (!vehicle->GetPassenger(0)) + if (!me->GetVehicleKit()->GetPassenger(0)) DoCast(SPELL_SEISMIC_SHARD_PREPARE); events.ScheduleEvent(EVENT_EARTH_FURY_LAUNCH_SHARD, 1800); break; @@ -318,7 +316,7 @@ class boss_high_priestess_azil : public CreatureScript } private: - uint8 countSeismicShard; + uint8 countSeismicShard = 3; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp index dc2fdb62d19..abfb82284d3 100644 --- a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp @@ -213,7 +213,7 @@ class npc_sc_millhouse_manastorm : public CreatureScript events.Update(diff); // Impending Doom is exception because it needs to be interrupted. - if (me->HasUnitState(UNIT_STATE_CASTING) && !me->GetCurrentSpell(SPELL_IMPENDING_DOOM)) + if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->GetSpellInfo()->Id != SPELL_IMPENDING_DOOM_CHANNEL) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 592d69c5c76..5b88cfb332b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -142,7 +142,7 @@ public: // clone player->CastSpell(summon, SPELL_CLONE_PLAYER, true); // phase the summon - summon->SetInPhase(spellInfo->Effects[EFFECT_0].MiscValueB, true, true); + summon->SetInPhase(spellInfo->GetEffect(EFFECT_0)->MiscValueB, true, true); } } ++insanityHandled; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index c826b8fc9ef..f1d029e53e2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -151,7 +151,7 @@ class boss_baltharus_the_warborn : public CreatureScript void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_10_N) { if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 1) DoAction(ACTION_CLONE); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index ee77671d83e..16cbcee562e 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1499,8 +1499,8 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); + uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); @@ -1607,8 +1607,8 @@ class spell_halion_clear_debuffs : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { - if (GetHitUnit()->HasAura(GetSpellInfo()->Effects[effIndex].CalcValue())) - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[effIndex].CalcValue()); + if (GetHitUnit()->HasAura(GetSpellInfo()->GetEffect(effIndex)->CalcValue())) + GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->GetEffect(effIndex)->CalcValue()); } void Register() override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 69dc25892c1..aa80295d83c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -837,10 +837,9 @@ class spell_impale : public SpellScriptLoader void HandleDamageCalc(SpellEffIndex /*effIndex*/) { Unit* target = GetHitUnit(); - uint32 permafrost = sSpellMgr->GetSpellIdForDifficulty(SPELL_PERMAFROST, target); // make sure Impale doesnt do damage if we are standing on permafrost - if (target && target->HasAura(permafrost)) + if (target && target->HasAura(SPELL_PERMAFROST)) SetHitDamage(0); } 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 2b541e4b972..b79e093a3e0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -384,7 +384,7 @@ class boss_toc_champion_controller : public CreatureScript vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); uint8 healersSubtracted = 2; - if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) + if (_instance->instance->GetSpawnMode() == DIFFICULTY_25_N || _instance->instance->GetSpawnMode() == DIFFICULTY_25_HC) healersSubtracted = 1; for (uint8 i = 0; i < healersSubtracted; ++i) { @@ -421,7 +421,7 @@ class boss_toc_champion_controller : public CreatureScript vHealersEntries.erase(vHealersEntries.begin() + pos); } - if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) + if (_instance->instance->GetSpawnMode() == DIFFICULTY_10_N || _instance->instance->GetSpawnMode() == DIFFICULTY_10_HC) for (uint8 i = 0; i < 4; ++i) vOtherEntries.erase(vOtherEntries.begin() + urand(0, vOtherEntries.size() - 1)); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 7e8653c4a55..25dc59acc34 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -494,7 +494,7 @@ class spell_mistress_kiss : public SpellScriptLoader bool Load() override { if (GetCaster()) - if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DAMAGE_SILENCE, GetCaster())) + if (sSpellMgr->GetSpellInfo(SPELL_MISTRESS_KISS_DAMAGE_SILENCE)) return true; return false; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index dec2f44745d..07eec388ca2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -706,11 +706,11 @@ class spell_powering_up : public SpellScriptLoader bool Load() override { - spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); + spellId = SPELL_SURGE_OF_SPEED; if (!sSpellMgr->GetSpellInfo(spellId)) return false; - poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, GetCaster()); + poweringUp = SPELL_POWERING_UP; if (!sSpellMgr->GetSpellInfo(poweringUp)) return false; @@ -769,7 +769,7 @@ class spell_valkyr_essences : public SpellScriptLoader bool Load() override { - spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); + spellId = SPELL_SURGE_OF_SPEED; if (!sSpellMgr->GetSpellInfo(spellId)) return false; return true; @@ -781,57 +781,54 @@ class spell_valkyr_essences : public SpellScriptLoader { if (dmgInfo.GetSpellInfo()) { - if (uint32 poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, owner)) - { - if (urand(0, 99) < 5) - GetTarget()->CastSpell(GetTarget(), spellId, true); + if (urand(0, 99) < 5) + GetTarget()->CastSpell(GetTarget(), spellId, true); - // Twin Vortex part - uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner); - uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner); - int32 stacksCount = dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue() / 1000 - 1; + // Twin Vortex part + uint32 lightVortex = SPELL_LIGHT_VORTEX_DAMAGE; + uint32 darkVortex = SPELL_DARK_VORTEX_DAMAGE; + int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue() / 1000 - 1; - if (lightVortex && darkVortex && stacksCount) + if (lightVortex && darkVortex && stacksCount) + { + if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex) { - if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex) + Aura* pAura = owner->GetAura(SPELL_POWERING_UP); + if (pAura) + { + pAura->ModStackAmount(stacksCount); + owner->CastSpell(owner, SPELL_POWERING_UP, true); + } + else { - Aura* pAura = owner->GetAura(poweringUp); - if (pAura) - { - pAura->ModStackAmount(stacksCount); - owner->CastSpell(owner, poweringUp, true); - } - else - { - owner->CastSpell(owner, poweringUp, true); - if (Aura* pTemp = owner->GetAura(poweringUp)) - pTemp->ModStackAmount(stacksCount); - } + owner->CastSpell(owner, SPELL_POWERING_UP, true); + if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP)) + pTemp->ModStackAmount(stacksCount); } } + } - // Picking floating balls - uint32 unleashedDark = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_DARK, owner); - uint32 unleashedLight = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_LIGHT, owner); + // Picking floating balls + uint32 unleashedDark = SPELL_UNLEASHED_DARK; + uint32 unleashedLight = SPELL_UNLEASHED_LIGHT; - if (unleashedDark && unleashedLight) + if (unleashedDark && unleashedLight) + { + if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight) { - if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight) + // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening + Aura* pAura = owner->GetAura(SPELL_POWERING_UP); + if (pAura) + { + // 2 lines together add the correct amount of buff stacks + pAura->ModStackAmount(stacksCount); + owner->CastSpell(owner, SPELL_POWERING_UP, true); + } + else { - // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening - Aura* pAura = owner->GetAura(poweringUp); - if (pAura) - { - // 2 lines together add the correct amount of buff stacks - pAura->ModStackAmount(stacksCount); - owner->CastSpell(owner, poweringUp, true); - } - else - { - owner->CastSpell(owner, poweringUp, true); - if (Aura* pTemp = owner->GetAura(poweringUp)) - pTemp->ModStackAmount(stacksCount); - } + owner->CastSpell(owner, SPELL_POWERING_UP, true); + if (Aura* pTemp = owner->GetAura(SPELL_POWERING_UP)) + pTemp->ModStackAmount(stacksCount); } } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index cb7e58cfe16..91da9ebd9be 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -274,7 +274,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript { EventStage = 6000; uint32 tributeChest = 0; - if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC) + if (instance->GetSpawnMode() == DIFFICULTY_10_HC) { if (TrialCounter >= 50) tributeChest = GO_TRIBUTE_CHEST_10H_99; @@ -291,7 +291,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript } } } - else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC) + else if (instance->GetSpawnMode() == DIFFICULTY_25_HC) { if (TrialCounter >= 50) tributeChest = GO_TRIBUTE_CHEST_25H_99; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index b91ca893955..f24ca7dd583 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -309,7 +309,7 @@ class spell_trollgore_invader_taunt : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue())) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue())) return false; return true; } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index a014be4369e..ebad98de91a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -89,7 +89,7 @@ class boss_falric : public CreatureScript || (_hopelessnessCount < 3 && me->HealthBelowPctDamaged(10, damage))) { if (_hopelessnessCount) - me->RemoveOwnedAura(sSpellMgr->GetSpellIdForDifficulty(HopelessnessHelper[_hopelessnessCount - 1], me)); + me->RemoveOwnedAura(HopelessnessHelper[_hopelessnessCount - 1]); DoCast(me, HopelessnessHelper[_hopelessnessCount]); ++_hopelessnessCount; } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index eeb05f44a71..c99ebddae37 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2390,7 +2390,7 @@ class spell_hor_evasion : public SpellScriptLoader return; float angle = pos.GetAngle(&home); - float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float dist = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); target->MovePosition(pos, dist, angle); dest.Relocate(pos); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 6053ff295a9..d289d494d62 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -553,8 +553,7 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader if (GetCaster()->GetTypeId() != TYPEID_PLAYER) return; - uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster()); - GetCaster()->RemoveAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetCaster()->RemoveAura(SPELL_FRENZIED_BLOODTHIRST, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK); // Shadowmourne questline @@ -807,7 +806,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader void PeriodicTick(AuraEffect const* aurEff) { SpellInfo const* damageSpell = sSpellMgr->EnsureSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE); - int32 damage = damageSpell->Effects[EFFECT_0].CalcValue(); + int32 damage = damageSpell->GetEffect(EFFECT_0)->CalcValue(); float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) damage = int32(damage * multiplier); GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index b1f6a4a5e83..008a89030a7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -377,11 +377,7 @@ class spell_festergut_pungent_blight : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - // Get Inhaled Blight id for our difficulty - uint32 blightId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), GetCaster()); - - // ...and remove it - GetCaster()->RemoveAurasDueToSpell(blightId); + GetCaster()->RemoveAurasDueToSpell(uint32(GetEffectValue())); GetCaster()->ToCreature()->AI()->Talk(EMOTE_PUNGENT_BLIGHT); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 416c27b7353..080880608d6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -1847,7 +1847,7 @@ class spell_igb_rocket_pack : public SpellScriptLoader void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { SpellInfo const* damageInfo = sSpellMgr->EnsureSpellInfo(SPELL_ROCKET_PACK_DAMAGE); - GetTarget()->CastCustomSpell(SPELL_ROCKET_PACK_DAMAGE, SPELLVALUE_BASE_POINT0, 2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetPeriod()), NULL, TRIGGERED_FULL_MASK); + GetTarget()->CastCustomSpell(SPELL_ROCKET_PACK_DAMAGE, SPELLVALUE_BASE_POINT0, 2 * (damageInfo->GetEffect(EFFECT_0)->CalcValue() + aurEff->GetTickNumber() * aurEff->GetPeriod()), NULL, TRIGGERED_FULL_MASK); GetTarget()->CastSpell(NULL, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK); } @@ -1977,7 +1977,7 @@ class spell_igb_periodic_trigger_with_power_cost : public SpellScriptLoader void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->GetEffect(EFFECT_0)->TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 3e78865c924..834b0aeb5e1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -288,7 +288,7 @@ class boss_lady_deathwhisper : public CreatureScript events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); - if (GetDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() != DIFFICULTY_10_N) events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000); Talk(SAY_AGGRO); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 2e360e19b75..3a66d3e1363 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -576,7 +576,7 @@ class spell_marrowgar_coldflame_damage : public SpellScriptLoader if (target->HasAura(SPELL_IMPALED)) return false; - if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->Effects[EFFECT_0].CalcRadius()) + if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->GetEffect(target, EFFECT_0)->CalcRadius()) return false; if (Aura* aur = target->GetAura(GetId())) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 8f5ca0b4322..d0bf573ba19 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -395,14 +395,14 @@ class boss_professor_putricide : public CreatureScript { SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_CREATE_CONCOCTION); DoCast(me, SPELL_CREATE_CONCOCTION); - events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 100); + events.ScheduleEvent(EVENT_PHASE_TRANSITION, spell->CalcCastTime() + 100); break; } case PHASE_COMBAT_3: { SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_GUZZLE_POTIONS); DoCast(me, SPELL_GUZZLE_POTIONS); - events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 100); + events.ScheduleEvent(EVENT_PHASE_TRANSITION, spell->CalcCastTime() + 100); break; } default: @@ -725,7 +725,7 @@ class npc_putricide_oozeAI : public ScriptedAI void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override { - if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me)) + if (!_newTargetSelectTimer && spell->Id == _hitTargetSpellId) _newTargetSelectTimer = 1000; } @@ -1031,7 +1031,7 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader break; } - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->CastSpell(target, uint32(GetSpellInfo()->GetEffect(stage)->CalcValue()), true, NULL, NULL, GetCaster()->GetGUID()); } void Register() override @@ -1057,11 +1057,10 @@ class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - uint32 adhesiveId = sSpellMgr->GetSpellIdForDifficulty(SPELL_VOLATILE_OOZE_ADHESIVE, GetCaster()); - if (GetHitUnit()->HasAura(adhesiveId)) + if (GetHitUnit()->HasAura(SPELL_VOLATILE_OOZE_ADHESIVE)) { GetCaster()->CastSpell(GetHitUnit(), SPELL_OOZE_ERUPTION, true); - GetHitUnit()->RemoveAurasDueToSpell(adhesiveId, GetCaster()->GetGUID(), 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetHitUnit()->RemoveAurasDueToSpell(SPELL_VOLATILE_OOZE_ADHESIVE, GetCaster()->GetGUID(), 0, AURA_REMOVE_BY_ENEMY_SPELL); } } @@ -1089,12 +1088,12 @@ class spell_putricide_choking_gas_bomb : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { uint32 skipIndex = urand(0, 2); - for (uint32 i = 0; i < 3; ++i) + for (SpellEffectInfo const* effect : GetSpellInfo()->GetEffectsForDifficulty(GetCaster()->GetMap()->GetDifficulty())) { - if (i == skipIndex) + if (!effect || effect->EffectIndex == skipIndex) continue; - uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); + uint32 spellId = uint32(effect->CalcValue()); GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID()); } } @@ -1141,7 +1140,7 @@ class spell_putricide_unbound_plague : public SpellScriptLoader } - targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()))); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_UNBOUND_PLAGUE)); Trinity::Containers::RandomResizeList(targets, 1); } @@ -1154,15 +1153,13 @@ class spell_putricide_unbound_plague : public SpellScriptLoader if (!instance) return; - uint32 plagueId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()); - - if (!GetHitUnit()->HasAura(plagueId)) + if (!GetHitUnit()->HasAura(SPELL_UNBOUND_PLAGUE)) { if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) { - if (Aura* oldPlague = GetCaster()->GetAura(plagueId, professor->GetGUID())) + if (Aura* oldPlague = GetCaster()->GetAura(SPELL_UNBOUND_PLAGUE, professor->GetGUID())) { - if (Aura* newPlague = professor->AddAura(plagueId, GetHitUnit())) + if (Aura* newPlague = professor->AddAura(SPELL_UNBOUND_PLAGUE, GetHitUnit())) { newPlague->SetMaxDuration(oldPlague->GetMaxDuration()); newPlague->SetDuration(oldPlague->GetDuration()); @@ -1258,11 +1255,10 @@ class spell_putricide_mutated_plague : public SpellScriptLoader if (!caster) return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell; SpellInfo const* spell = sSpellMgr->GetSpellInfo(triggerSpell); - spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster); - int32 damage = spell->Effects[EFFECT_0].CalcValue(caster); + int32 damage = spell->GetEffect(EFFECT_0)->CalcValue(caster); float multiplier = 2.0f; if (GetTarget()->GetMap()->GetSpawnMode() & 1) multiplier = 3.0f; @@ -1275,13 +1271,13 @@ class spell_putricide_mutated_plague : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - uint32 healSpell = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + uint32 healSpell = uint32(GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue()); SpellInfo const* healSpellInfo = sSpellMgr->GetSpellInfo(healSpell); if (!healSpellInfo) return; - int32 heal = healSpellInfo->Effects[0].CalcValue() * GetStackAmount(); + int32 heal = healSpellInfo->GetEffect(EFFECT_0)->CalcValue() * GetStackAmount(); GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, NULL, NULL, GetCasterGUID()); } @@ -1445,8 +1441,8 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader return; } - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); + uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); @@ -1543,8 +1539,7 @@ class spell_putricide_clear_aura_effect_value : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - uint32 auraId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), GetCaster()); - GetHitUnit()->RemoveAurasDueToSpell(auraId); + GetHitUnit()->RemoveAurasDueToSpell(GetEffectValue()); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index d5c07fb6942..ee948789bc4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -745,7 +745,7 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader if (!GetExplTargetDest()) return; - uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = GetSpellInfo()->GetEffect(effIndex)->TriggerSpell; float x, y, z; GetExplTargetDest()->GetPosition(x, y, z); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 8e659a746ed..ab19ffe7fed 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -409,10 +409,9 @@ class boss_sindragosa : public CreatureScript void SpellHitTarget(Unit* target, SpellInfo const* spell) override { - if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me)) - if (spellId == spell->Id) - if (Aura const* mysticBuffet = target->GetAura(spell->Id)) - _mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount()); + if (spell->Id == 70127) + if (Aura const* mysticBuffet = target->GetAura(spell->Id)) + _mysticBuffetStack = std::max<uint8>(_mysticBuffetStack, mysticBuffet->GetStackAmount()); } @@ -1546,7 +1545,7 @@ class spell_frostwarden_handler_focus_fire : public SpellScriptLoader PreventDefaultAction(); if (Unit* caster = GetCaster()) { - caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue())); + caster->AddThreat(GetTarget(), -float(GetSpellInfo()->GetEffect(caster, EFFECT_1)->CalcValue())); caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 03c26ba2e09..caba9ff5262 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2437,7 +2437,7 @@ class spell_the_lich_king_summon_into_air : public SpellScriptLoader dest->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); // spirit bombs get higher - if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) + if (GetSpellInfo()->GetEffect(effIndex)->MiscValue == NPC_SPIRIT_BOMB) { dest->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); @@ -2641,7 +2641,7 @@ class spell_the_lich_king_vile_spirits : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) - GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff, GetCasterGUID()); + GetTarget()->CastSpell((Unit*)NULL, aurEff->GetSpellEffectInfo()->TriggerSpell, true, NULL, aurEff, GetCasterGUID()); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 49e24f54b02..eebf5a2c2ea 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1227,7 +1227,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1306,7 +1306,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1442,7 +1442,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader // return; if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true, NULL, NULL, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index abe178a874d..ab7606f5e6f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1799,7 +1799,7 @@ class spell_icc_sprit_alarm : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); uint32 trapId = 0; - switch (GetSpellInfo()->Effects[effIndex].MiscValue) + switch (GetSpellInfo()->GetEffect(effIndex)->MiscValue) { case EVENT_AWAKEN_WARD_1: trapId = GO_SPIRIT_ALARM_1; @@ -1838,7 +1838,7 @@ class spell_icc_sprit_alarm : public SpellScriptLoader void Register() override { - OnEffectHit += SpellEffectFn(spell_icc_sprit_alarm_SpellScript::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT); + OnEffectHit += SpellEffectFn(spell_icc_sprit_alarm_SpellScript::HandleEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); } }; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 35402771494..90b252a47ce 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -80,7 +80,7 @@ public: Initialize(); - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_25_N) { Position pos; @@ -121,7 +121,7 @@ public: events.ScheduleEvent(EVENT_LOCUST, 90000); events.ScheduleEvent(EVENT_BERSERK, 600000); - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_10_N) events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000, 20000)); } @@ -160,7 +160,7 @@ public: case EVENT_IMPALE: //Cast Impale on a random target //Do NOT cast it when we are afflicted by locust swarm - if (!me->HasAura(sSpellMgr->GetSpellIdForDifficulty(SPELL_LOCUST_SWARM, me))) + if (!me->HasAura(SPELL_LOCUST_SWARM)) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_IMPALE); events.ScheduleEvent(EVENT_IMPALE, urand(10000, 20000)); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index dcb004cc3a0..568df379f15 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -192,7 +192,7 @@ class npc_faerlina_add : public CreatureScript void Reset() override { - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { + if (GetDifficulty() == DIFFICULTY_10_N) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_BIND, true); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); } @@ -200,7 +200,7 @@ class npc_faerlina_add : public CreatureScript void JustDied(Unit* /*killer*/) override { - if (_instance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (_instance && GetDifficulty() == DIFFICULTY_10_N) if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_FAERLINA))) DoCast(faerlina, SPELL_WIDOWS_EMBRACE); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 39381f38d67..a70d354b966 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -259,7 +259,7 @@ class boss_gothik : public CreatureScript void DoGothikSummon(uint32 entry) { - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_25_N) { switch (entry) { @@ -421,9 +421,9 @@ class boss_gothik : public CreatureScript case EVENT_SUMMON: if (waves[waveCount].entry) { - if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + if ((waves[waveCount].mode == 2) && (GetDifficulty() == DIFFICULTY_25_N)) DoGothikSummon(waves[waveCount].entry); - else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + else if ((waves[waveCount].mode == 0) && (GetDifficulty() == DIFFICULTY_10_N)) DoGothikSummon(waves[waveCount].entry); else if (waves[waveCount].mode == 1) DoGothikSummon(waves[waveCount].entry); @@ -443,9 +443,9 @@ class boss_gothik : public CreatureScript if (waves[waveCount].mode == 1) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); - else if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + else if ((waves[waveCount].mode == 2) && (GetDifficulty() == DIFFICULTY_25_N)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); - else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + else if ((waves[waveCount].mode == 0) && (GetDifficulty() == DIFFICULTY_10_N)) events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time); else events.ScheduleEvent(EVENT_SUMMON, 0); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 929c52a986c..ba54b5150e4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -194,7 +194,7 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell)) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell)) return false; return true; } @@ -203,7 +203,7 @@ class spell_grobbulus_poison_cloud : public SpellScriptLoader { PreventDefaultAction(); - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)NULL, TRIGGERED_FULL_MASK, NULL, aurEff); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 87466b6bf41..8c927dcb0ac 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -30,26 +30,23 @@ EndScriptData */ #include "naxxramas.h" #include "Player.h" -enum Yells +enum Texts { - //when shappiron dies. dialog between kel and lich king (in this order) - SAY_SAPP_DIALOG1 = 0, //not used - SAY_SAPP_DIALOG2_LICH = 1, //not used - SAY_SAPP_DIALOG3 = 2, //not used - SAY_SAPP_DIALOG4_LICH = 3, //not used - SAY_SAPP_DIALOG5 = 4, //not used - SAY_CAT_DIED = 5, //when cat dies, not used - //when each of the 4 wing bosses dies - SAY_TAUNT = 6, SAY_AGGRO = 7, SAY_SLAY = 8, SAY_DEATH = 9, SAY_CHAIN = 10, SAY_FROST_BLAST = 11, SAY_REQUEST_AID = 12, //start of phase 3 - SAY_ANSWER_REQUEST = 13, //lich king answer + EMOTE_PHASE_TWO = 13, SAY_SUMMON_MINIONS = 14, //start of phase 1 - SAY_SPECIAL = 15 + SAY_SPECIAL = 15, + + // The Lich King + SAY_ANSWER_REQUEST = 3, + + // Old World Trigger + SAY_GUARDIAN_SPAWNED = 0 }; enum Events @@ -70,7 +67,10 @@ enum Events EVENT_TRIGGER, EVENT_PHASE, - EVENT_MORTAL_WOUND + EVENT_MORTAL_WOUND, + + EVENT_ANSWER_REQUEST, + EVENT_SUMMON_GUARDIANS }; enum Spells @@ -123,6 +123,13 @@ enum Spells SPELL_MORTAL_WOUND = 28467 }; +enum Phases +{ + PHASE_ONE = 1, // Players move in the circle and Kel'Thuzad spawns his minions. + PHASE_TWO = 2, // Starts on a timer. + PHASE_THREE = 3 // At 45% health. +}; + enum Creatures { NPC_WASTE = 16427, // Soldiers of the Frozen Wastes @@ -270,15 +277,11 @@ public: void Initialize() { nGuardiansOfIcecrownCount = 0; - uiGuardiansOfIcecrownTimer = 5000; // 5 seconds for summoning each Guardian of Icecrown in phase 3 - Phase = 0; nAbomination = 0; nWeaver = 0; } - uint32 Phase; - uint32 uiGuardiansOfIcecrownTimer; uint32 uiFaction; uint8 nGuardiansOfIcecrownCount; @@ -345,7 +348,6 @@ public: void EnterCombat(Unit* /*who*/) override { me->setFaction(uiFaction); - _EnterCombat(); for (uint8 i = 0; i <= 3; ++i) { @@ -354,10 +356,10 @@ public: } DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); Talk(SAY_SUMMON_MINIONS); - Phase = 1; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 4); + events.SetPhase(PHASE_ONE); events.ScheduleEvent(EVENT_TRIGGER, 5000); events.ScheduleEvent(EVENT_WASTE, 15000); events.ScheduleEvent(EVENT_ABOMIN, 30000); @@ -365,6 +367,23 @@ public: events.ScheduleEvent(EVENT_PHASE, 228000); } + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + if (events.IsInPhase(PHASE_TWO) && me->HealthBelowPctDamaged(45, damage)) + { + Talk(SAY_REQUEST_AID); + events.SetPhase(PHASE_THREE); + events.ScheduleEvent(EVENT_ANSWER_REQUEST, 4000); + + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i))) + if (portal->getLootState() == GO_READY) + portal->UseDoorOrButton(); + } + } + } + void UpdateAI(uint32 diff) override { if (!UpdateVictim()) @@ -372,7 +391,7 @@ public: events.Update(diff); - if (Phase == 1) + if (events.IsInPhase(PHASE_ONE)) { while (uint32 eventId = events.ExecuteEvent()) { @@ -405,6 +424,7 @@ public: case EVENT_PHASE: events.Reset(); Talk(SAY_AGGRO); + Talk(EMOTE_PHASE_TWO); spawns.DespawnAll(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); me->CastStop(); @@ -415,9 +435,9 @@ public: events.ScheduleEvent(EVENT_DETONATE, urand(30000, 40000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000, 30000)); events.ScheduleEvent(EVENT_BLAST, urand(60000, 120000)); - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_25_N) events.ScheduleEvent(EVENT_CHAIN, urand(30000, 60000)); - Phase = 2; + events.SetPhase(PHASE_TWO); break; default: break; @@ -426,38 +446,6 @@ public: } else { - //start phase 3 when we are 45% health - if (Phase != 3) - { - if (HealthBelowPct(45)) - { - Phase = 3; - Talk(SAY_REQUEST_AID); - //here Lich King should respond to KelThuzad but I don't know which Creature to make talk - //so for now just make Kelthuzad says it. - Talk(SAY_ANSWER_REQUEST); - - for (uint8 i = 0; i <= 3; ++i) - { - if (GameObject* portal = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_KELTHUZAD_PORTAL01 + i))) - if (portal->getLootState() == GO_READY) - portal->UseDoorOrButton(); - } - } - } - else if (nGuardiansOfIcecrownCount < RAID_MODE(2, 4)) - { - if (uiGuardiansOfIcecrownTimer <= diff) - { - /// @todo Add missing text - if (Creature* guardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)])) - guardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); - ++nGuardiansOfIcecrownCount; - uiGuardiansOfIcecrownTimer = 5000; - } - else uiGuardiansOfIcecrownTimer -= diff; - } - if (me->HasUnitState(UNIT_STATE_CASTING)) return; @@ -609,6 +597,18 @@ public: Talk(SAY_FROST_BLAST); events.Repeat(30000, 90000); break; + case EVENT_ANSWER_REQUEST: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_LICH_KING))) + lichKing->AI()->Talk(SAY_ANSWER_REQUEST); + events.ScheduleEvent(EVENT_SUMMON_GUARDIANS, 5000); + break; + case EVENT_SUMMON_GUARDIANS: + if (Creature* guardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)])) + guardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); + ++nGuardiansOfIcecrownCount; + if (nGuardiansOfIcecrownCount < RAID_MODE(2, 4)) + events.ScheduleEvent(EVENT_SUMMON_GUARDIANS, 5000); + break; default: break; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index fc376a5439f..cc7e38173c8 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -112,7 +112,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) { - target->RemoveAura(sSpellMgr->GetSpellIdForDifficulty(SPELL_WEB_SPRAY, me)); + target->RemoveAura(SPELL_WEB_SPRAY); 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)) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 0e07ff027f6..be4c8583377 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -106,7 +106,7 @@ public: events.ScheduleEvent(EVENT_BALCONY, 110000); events.ScheduleEvent(EVENT_CURSE, 10000 + rand32() % 15000); events.ScheduleEvent(EVENT_WARRIOR, 30000); - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_25_N) events.ScheduleEvent(EVENT_BLINK, urand(20000, 40000)); } } diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index b66bc07f2c8..ce478cd0664 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -115,6 +115,7 @@ class instance_naxxramas : public InstanceMapScript minHorsemenDiedTime = 0; maxHorsemenDiedTime = 0; AbominationCount = 0; + CurrentWingTaunt = SAY_KELTHUZAD_FIRST_WING_TAUNT; playerDied = 0; } @@ -156,6 +157,9 @@ class instance_naxxramas : public InstanceMapScript case NPC_KEL_THUZAD: KelthuzadGUID = creature->GetGUID(); break; + case NPC_LICH_KING: + LichKingGUID = creature->GetGUID(); + break; default: break; } @@ -201,6 +205,9 @@ class instance_naxxramas : public InstanceMapScript case GO_KELTHUZAD_TRIGGER: KelthuzadTriggerGUID = go->GetGUID(); break; + case GO_ROOM_KELTHUZAD: + KelthuzadDoorGUID = go->GetGUID(); + break; default: break; } @@ -242,6 +249,15 @@ class instance_naxxramas : public InstanceMapScript playerDied = 1; SaveToDB(); } + + if (Creature* creature = unit->ToCreature()) + if (creature->GetEntry() == NPC_BIGGLESWORTH) + { + // Loads Kel'Thuzad's grid. We need this as he must be active in order for his texts to work. + instance->LoadGrid(3749.67f, -5114.06f); + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(SAY_KELTHUZAD_CAT_DIED); + } } void SetData(uint32 id, uint32 value) override @@ -327,6 +343,8 @@ class instance_naxxramas : public InstanceMapScript return PortalsGUID[3]; case DATA_KELTHUZAD_TRIGGER: return KelthuzadTriggerGUID; + case DATA_LICH_KING: + return LichKingGUID; } return ObjectGuid::Empty; @@ -337,18 +355,131 @@ class instance_naxxramas : public InstanceMapScript if (!InstanceScript::SetBossState(id, state)) return false; - if (id == BOSS_HORSEMEN && state == DONE) + switch (id) { - if (GameObject* horsemenChest = instance->GetGameObject(HorsemenChestGUID)) - { - horsemenChest->SetRespawnTime(horsemenChest->GetRespawnDelay()); - horsemenChest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + case BOSS_MAEXXNA: + case BOSS_LOATHEB: + case BOSS_THADDIUS: + if (state == DONE) + events.ScheduleEvent(EVENT_KELTHUZAD_WING_TAUNT, 6000); + break; + case BOSS_GOTHIK: + if (state == DONE) + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_KORTHAZZ, 10000); + break; + case BOSS_HORSEMEN: + if (state == DONE) + { + if (GameObject* horsemenChest = instance->GetGameObject(HorsemenChestGUID)) + { + horsemenChest->SetRespawnTime(horsemenChest->GetRespawnDelay()); + horsemenChest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + events.ScheduleEvent(EVENT_KELTHUZAD_WING_TAUNT, 6000); + } + break; + case BOSS_SAPPHIRON: + if (state == DONE) + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD, 6000); + break; + default: + break; } return true; } + void Update(uint32 diff) override + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DIALOGUE_GOTHIK_KORTHAZZ: + if (Creature* korthazz = instance->GetCreature(ThaneGUID)) + korthazz->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_ZELIEK, 5000); + break; + case EVENT_DIALOGUE_GOTHIK_ZELIEK: + if (Creature* zeliek = instance->GetCreature(SirGUID)) + zeliek->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_BLAUMEUX, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_BLAUMEUX: + if (Creature* blaumeux = instance->GetCreature(LadyGUID)) + blaumeux->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_RIVENDARE, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_RIVENDARE: + if (Creature* rivendare = instance->GetCreature(BaronGUID)) + rivendare->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_BLAUMEUX2, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_BLAUMEUX2: + if (Creature* blaumeux = instance->GetCreature(LadyGUID)) + blaumeux->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN2); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_ZELIEK2, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_ZELIEK2: + if (Creature* zeliek = instance->GetCreature(SirGUID)) + zeliek->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN2); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_KORTHAZZ2, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_KORTHAZZ2: + if (Creature* korthazz = instance->GetCreature(ThaneGUID)) + korthazz->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN2); + events.ScheduleEvent(EVENT_DIALOGUE_GOTHIK_RIVENDARE2, 6000); + break; + case EVENT_DIALOGUE_GOTHIK_RIVENDARE2: + if (Creature* rivendare = instance->GetCreature(BaronGUID)) + rivendare->AI()->Talk(SAY_DIALOGUE_GOTHIK_HORSEMAN2); + break; + case EVENT_KELTHUZAD_WING_TAUNT: + // Loads Kel'Thuzad's grid. We need this as he must be active in order for his texts to work. + instance->LoadGrid(3749.67f, -5114.06f); + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(CurrentWingTaunt); + ++CurrentWingTaunt; + break; + case EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD: + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_KELTHUZAD); + HandleGameObject(KelthuzadDoorGUID, false); + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_LICHKING, 6000); + break; + case EVENT_DIALOGUE_SAPPHIRON_LICHKING: + if (Creature* lichKing = instance->GetCreature(LichKingGUID)) + lichKing->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_LICH_KING); + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD2, 16000); + break; + case EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD2: + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_KELTHUZAD2); + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_LICHKING2, 9000); + break; + case EVENT_DIALOGUE_SAPPHIRON_LICHKING2: + if (Creature* lichKing = instance->GetCreature(LichKingGUID)) + lichKing->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_LICH_KING2); + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD3, 12000); + break; + case EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD3: + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_KELTHUZAD3); + events.ScheduleEvent(EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD4, 6000); + break; + case EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD4: + if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) + kelthuzad->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_KELTHUZAD4); + HandleGameObject(KelthuzadDoorGUID, true); + break; + default: + break; + } + } + } + void HeiganErupt(uint32 section) { for (uint32 i = 0; i < 4; ++i) @@ -387,11 +518,11 @@ class instance_naxxramas : public InstanceMapScript switch (criteria_id) { case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + if (Difficulty(instance->GetSpawnMode()) == DIFFICULTY_10_N && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) return true; return false; case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + if (Difficulty(instance->GetSpawnMode()) == DIFFICULTY_25_N && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) return true; return false; // Difficulty checks are done on DB. @@ -450,10 +581,15 @@ class instance_naxxramas : public InstanceMapScript ObjectGuid KelthuzadGUID; ObjectGuid KelthuzadTriggerGUID; ObjectGuid PortalsGUID[4]; + ObjectGuid KelthuzadDoorGUID; + ObjectGuid LichKingGUID; uint8 AbominationCount; + uint8 CurrentWingTaunt; /* The Immortal / The Undying */ uint32 playerDied; + + EventMap events; }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h index 8325271a403..eb77980f3ba 100644 --- a/src/server/scripts/Northrend/Naxxramas/naxxramas.h +++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.h @@ -71,6 +71,7 @@ enum Data64 DATA_KELTHUZAD_PORTAL03, DATA_KELTHUZAD_PORTAL04, DATA_KELTHUZAD_TRIGGER, + DATA_LICH_KING }; enum CreaturesIds @@ -89,7 +90,10 @@ enum CreaturesIds NPC_CRYPT_GUARD = 16573, NPC_NAXXRAMAS_FOLLOWER = 16505, NPC_FOLLOWER_WORSHIPPER = 16506, - NPC_DK_UNDERSTUDY = 16803 + NPC_DK_UNDERSTUDY = 16803, + NPC_BIGGLESWORTH = 16998, + NPC_LICH_KING = 16980, + NPC_OLD_WORLD_TRIGGER = 15384 }; enum GameObjectsIds @@ -142,6 +146,50 @@ enum SpellIds SPELL_SLIME = 28801 }; +enum InstanceEvents +{ + // Dialogue that happens after Gothik's death. + EVENT_DIALOGUE_GOTHIK_KORTHAZZ = 1, + EVENT_DIALOGUE_GOTHIK_ZELIEK, + EVENT_DIALOGUE_GOTHIK_BLAUMEUX, + EVENT_DIALOGUE_GOTHIK_RIVENDARE, + EVENT_DIALOGUE_GOTHIK_BLAUMEUX2, + EVENT_DIALOGUE_GOTHIK_ZELIEK2, + EVENT_DIALOGUE_GOTHIK_KORTHAZZ2, + EVENT_DIALOGUE_GOTHIK_RIVENDARE2, + + // Dialogue that happens after each wing. + EVENT_KELTHUZAD_WING_TAUNT, + + // Dialogue that happens after Sapphiron's death. + EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD, + EVENT_DIALOGUE_SAPPHIRON_LICHKING, + EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD2, + EVENT_DIALOGUE_SAPPHIRON_LICHKING2, + EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD3, + EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD4 +}; + +enum InstanceTexts +{ + // The Four Horsemen + SAY_DIALOGUE_GOTHIK_HORSEMAN = 5, + SAY_DIALOGUE_GOTHIK_HORSEMAN2 = 6, + + // Kel'Thuzad + SAY_DIALOGUE_SAPPHIRON_KELTHUZAD = 0, + SAY_DIALOGUE_SAPPHIRON_KELTHUZAD2 = 2, + SAY_DIALOGUE_SAPPHIRON_KELTHUZAD3 = 4, + SAY_DIALOGUE_SAPPHIRON_KELTHUZAD4 = 20, + + SAY_KELTHUZAD_CAT_DIED = 5, + SAY_KELTHUZAD_FIRST_WING_TAUNT = 16, + + // Lich King + SAY_DIALOGUE_SAPPHIRON_LICH_KING = 1, + SAY_DIALOGUE_SAPPHIRON_LICH_KING2 = 2 +}; + /* template<class AI> CreatureAI* GetNaxxramasAI(Creature* creature) diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 813e51ad23c..b4f27710e03 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -406,7 +406,7 @@ public: { _summonDeaths = value; - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_10_N) { if (_summonDeaths == MAX_SUMMONS_PHASE_TWO_10MAN) { @@ -414,7 +414,7 @@ public: DoAction(ACTION_HANDLE_P_THREE_INTRO); } } - else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + else if (GetDifficulty() == DIFFICULTY_25_N) { if (_summonDeaths == MAX_SUMMONS_PHASE_TWO_25MAN) { @@ -862,7 +862,7 @@ public: if (_arcaneReinforcements) { - for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++) + for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == DIFFICULTY_10_N ? 4 : 5); rangeDisks++) { Creature* casterDiskSummon = me->SummonCreature(NPC_HOVER_DISK_CASTER, RangeHoverDisksSpawnPositions[rangeDisks]); @@ -878,7 +878,7 @@ public: _arcaneReinforcements = false; - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_25_N) events.ScheduleEvent(EVENT_DELAYED_REINFORCEMENTS, 1*IN_MILLISECONDS, 0, PHASE_TWO); } break; @@ -958,7 +958,7 @@ public: SetPhase(PHASE_THREE, true); break; case EVENT_SURGE_OF_POWER_P_THREE: - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_10_N) { if (Unit* tempSurgeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, false, SPELL_RIDE_RED_DRAGON_BUDDY)) { @@ -975,7 +975,7 @@ public: } } } - else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + else if (GetDifficulty() == DIFFICULTY_25_N) { memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID)); DoCastAOE(SPELL_SURGE_OF_POWER_WARNING_SELECTOR_25, true); @@ -1007,10 +1007,10 @@ public: Talk(SAY_DEATH); if (Creature* alexstraszaGiftBoxBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_GIFT_BOX_BUNNY_GUID))) { - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == DIFFICULTY_10_N) alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_10, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(), HeartOfMagicSpawnPos.GetPositionZ(), HeartOfMagicSpawnPos.GetOrientation(), 0.0f, 0.0f, 0.0f, 1.0f, 0); - else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + else if (GetDifficulty() == DIFFICULTY_25_N) alexstraszaGiftBoxBunny->SummonGameObject(GO_HEART_OF_MAGIC_25, HeartOfMagicSpawnPos.GetPositionX(), HeartOfMagicSpawnPos.GetPositionY(), HeartOfMagicSpawnPos.GetPositionZ(), HeartOfMagicSpawnPos.GetOrientation(), 0.0f, 0.0f, 0.0f, 1.0f, 0); } @@ -1786,10 +1786,10 @@ class spell_malygos_arcane_storm : public SpellScriptLoader { // Resize list only to objects that are vehicles. IsCreatureVehicleCheck check(true); - Trinity::Containers::RandomResizeList(targets, check, (malygos->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 10)); + Trinity::Containers::RandomResizeList(targets, check, (malygos->GetMap()->GetDifficulty() == DIFFICULTY_10_N ? 4 : 10)); } else - Trinity::Containers::RandomResizeList(targets, (malygos->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 10)); + Trinity::Containers::RandomResizeList(targets, (malygos->GetMap()->GetDifficulty() == DIFFICULTY_10_N ? 4 : 10)); } void HandleVisual(SpellEffIndex /*effIndex*/) @@ -1948,7 +1948,7 @@ class spell_arcane_overload : public SpellScriptLoader { Creature* arcaneOverload = GetCaster()->ToCreature(); targets.remove_if(ExactDistanceCheck(arcaneOverload, - GetSpellInfo()->Effects[EFFECT_0].CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); + GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); } void Register() override @@ -2475,9 +2475,9 @@ class spell_alexstrasza_gift_beam_visual : public SpellScriptLoader { if (Creature* target = GetTarget()->ToCreature()) { - if (target->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (target->GetMap()->GetDifficulty() == DIFFICULTY_10_N) _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_10, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0); - else if (target->GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + else if (target->GetMap()->GetDifficulty() == DIFFICULTY_25_N) _alexstraszaGift = target->SummonGameObject(GO_ALEXSTRASZA_S_GIFT_25, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0); } } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index 90decfbf46e..b689df3c977 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -92,14 +92,14 @@ public: platformGUID = go->GetGUID(); break; case GO_FOCUSING_IRIS_10: - if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (instance->GetDifficulty() == DIFFICULTY_10_N) { irisGUID = go->GetGUID(); focusingIrisPosition = go->GetPosition(); } break; case GO_FOCUSING_IRIS_25: - if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (instance->GetDifficulty() == DIFFICULTY_25_N) { irisGUID = go->GetGUID(); focusingIrisPosition = go->GetPosition(); @@ -110,11 +110,11 @@ public: exitPortalPosition = go->GetPosition(); break; case GO_HEART_OF_MAGIC_10: - if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (instance->GetDifficulty() == DIFFICULTY_10_N) heartOfMagicGUID = go->GetGUID(); break; case GO_HEART_OF_MAGIC_25: - if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (instance->GetDifficulty() == DIFFICULTY_25_N) heartOfMagicGUID = go->GetGUID(); break; } @@ -240,7 +240,7 @@ public: PowerSparksHandling(); break; case DATA_RESPAWN_IRIS: - SpawnGameObject(instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? GO_FOCUSING_IRIS_10 : GO_FOCUSING_IRIS_25, focusingIrisPosition); + SpawnGameObject(instance->GetDifficulty() == DIFFICULTY_10_N ? GO_FOCUSING_IRIS_10 : GO_FOCUSING_IRIS_25, focusingIrisPosition); break; } } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 3f882e0b99e..b0c4be44ee8 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -418,7 +418,7 @@ class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader // caster of the triggered spell is wrong for an unknown reason, handle it here correctly PreventDefaultAction(); if (Unit* caster = GetCaster()) - GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell(caster, aurEff->GetSpellEffectInfo()->TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index fc29369c28f..86a19d16efb 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -28,7 +28,7 @@ EndScriptData */ #include "SpellScript.h" #include "halls_of_lightning.h" -enum Yells +enum Texts { SAY_INTRO_1 = 0, SAY_INTRO_2 = 1, @@ -51,6 +51,21 @@ enum Spells SPELL_PULSING_SHOCKWAVE_AURA = 59414 }; +enum Events +{ + EVENT_ARC_LIGHTNING = 1, + EVENT_LIGHTNING_NOVA, + EVENT_RESUME_PULSING_SHOCKWAVE, + EVENT_INTRO_DIALOGUE +}; + +enum Phases +{ + // Phases are used to allow executing the intro event while UpdateVictim() returns false and convenience. + PHASE_INTRO = 1, + PHASE_NORMAL +}; + enum Misc { ACHIEV_TIMELY_DEATH_START_EVENT = 20384 @@ -65,57 +80,41 @@ class boss_loken : public CreatureScript public: boss_loken() : CreatureScript("boss_loken") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI<boss_lokenAI>(creature); - } - - struct boss_lokenAI : public ScriptedAI + struct boss_lokenAI : public BossAI { - boss_lokenAI(Creature* creature) : ScriptedAI(creature) + boss_lokenAI(Creature* creature) : BossAI(creature, DATA_LOKEN) { Initialize(); - instance = creature->GetInstanceScript(); + _isIntroDone = false; } void Initialize() { - m_uiArcLightning_Timer = 15000; - m_uiLightningNova_Timer = 20000; - m_uiResumePulsingShockwave_Timer = 1000; - - m_uiHealthAmountModifier = 1; + _healthAmountModifier = 1; } - InstanceScript* instance; - - uint32 m_uiArcLightning_Timer; - uint32 m_uiLightningNova_Timer; - uint32 m_uiResumePulsingShockwave_Timer; - - uint32 m_uiHealthAmountModifier; - void Reset() override { Initialize(); - - instance->SetBossState(DATA_LOKEN, NOT_STARTED); + _Reset(); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); } void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); - - instance->SetBossState(DATA_LOKEN, IN_PROGRESS); + events.SetPhase(PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARC_LIGHTNING, 15000); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 20000); + events.ScheduleEvent(EVENT_RESUME_PULSING_SHOCKWAVE, 1000); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); } void JustDied(Unit* /*killer*/) override { Talk(SAY_DEATH); - - instance->SetBossState(DATA_LOKEN, DONE); + _JustDied(); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA); } @@ -125,66 +124,89 @@ public: Talk(SAY_SLAY); } - void UpdateAI(uint32 uiDiff) override + void MoveInLineOfSight(Unit* who) override { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_uiResumePulsingShockwave_Timer) + if (!_isIntroDone && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40.0f)) { - if (m_uiResumePulsingShockwave_Timer <= uiDiff) - { - DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); - me->ClearUnitState(UNIT_STATE_CASTING); // this flag breaks movement - - DoCast(me, SPELL_PULSING_SHOCKWAVE, true); - m_uiResumePulsingShockwave_Timer = 0; - } - else - m_uiResumePulsingShockwave_Timer -= uiDiff; + _isIntroDone = true; + Talk(SAY_INTRO_1); + events.ScheduleEvent(EVENT_INTRO_DIALOGUE, 20000, 0, PHASE_INTRO); } + BossAI::MoveInLineOfSight(who); + } - if (m_uiArcLightning_Timer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_ARC_LIGHTNING); + void UpdateAI(uint32 diff) override + { + if (events.IsInPhase(PHASE_NORMAL) && !UpdateVictim()) + return; - m_uiArcLightning_Timer = urand(15000, 16000); - } - else - m_uiArcLightning_Timer -= uiDiff; + events.Update(diff); - if (m_uiLightningNova_Timer <= uiDiff) + while (uint32 eventId = events.ExecuteEvent()) { - Talk(SAY_NOVA); - Talk(EMOTE_NOVA); - DoCast(me, SPELL_LIGHTNING_NOVA); - - me->RemoveAurasDueToSpell(sSpellMgr->GetSpellIdForDifficulty(SPELL_PULSING_SHOCKWAVE, me)); - m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura - m_uiLightningNova_Timer = urand(20000, 21000); + switch (eventId) + { + case EVENT_ARC_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_ARC_LIGHTNING); + events.ScheduleEvent(EVENT_ARC_LIGHTNING, urand(15000, 16000)); + break; + case EVENT_LIGHTNING_NOVA: + Talk(SAY_NOVA); + Talk(EMOTE_NOVA); + DoCastAOE(SPELL_LIGHTNING_NOVA); + me->RemoveAurasDueToSpell(SPELL_PULSING_SHOCKWAVE); + events.ScheduleEvent(EVENT_RESUME_PULSING_SHOCKWAVE, DUNGEON_MODE(5000, 4000)); // Pause Pulsing Shockwave aura + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, urand(20000, 21000)); + break; + case EVENT_RESUME_PULSING_SHOCKWAVE: + DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); + me->ClearUnitState(UNIT_STATE_CASTING); // This flag breaks movement. + DoCast(me, SPELL_PULSING_SHOCKWAVE, true); + break; + case EVENT_INTRO_DIALOGUE: + Talk(SAY_INTRO_2); + events.SetPhase(PHASE_NORMAL); + break; + default: + break; + } } - else - m_uiLightningNova_Timer -= uiDiff; - // Health check - if (HealthBelowPct(100 - 25 * m_uiHealthAmountModifier)) + DoMeleeAttackIfReady(); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + if (me->HealthBelowPctDamaged(100 - 25 * _healthAmountModifier, damage)) { - switch (m_uiHealthAmountModifier) + switch (_healthAmountModifier) { - case 1: Talk(SAY_75HEALTH); break; - case 2: Talk(SAY_50HEALTH); break; - case 3: Talk(SAY_25HEALTH); break; + case 1: + Talk(SAY_75HEALTH); + break; + case 2: + Talk(SAY_50HEALTH); + break; + case 3: + Talk(SAY_25HEALTH); + break; + default: + break; } - - ++m_uiHealthAmountModifier; + ++_healthAmountModifier; } - - DoMeleeAttackIfReady(); } + + private: + uint32 _healthAmountModifier; + bool _isIntroDone; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetInstanceAI<boss_lokenAI>(creature); + } }; class spell_loken_pulsing_shockwave : public SpellScriptLoader diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index d63d5e87923..3a707e7fa70 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -428,7 +428,7 @@ public: void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) override { // This is the dummy effect of the spells - if (pSpell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_SHATTER, me)) + if (pSpell->Id == SPELL_SHATTER) if (me->GetEntry() == NPC_BRITTLE_GOLEM) me->DespawnOrUnsummon(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index 07cdfa3353c..d911bf07439 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -182,7 +182,7 @@ class spell_krystallus_shatter_effect : public SpellScriptLoader if (!GetHitUnit()) return; - float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float radius = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); if (!radius) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index bb7a8592e04..41da9ec09ea 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -615,7 +615,7 @@ class boss_stormcaller_brundir : public CreatureScript break; case EVENT_GROUND: //me->SetLevitate(false); - me->RemoveAurasDueToSpell(sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHTNING_TENDRILS, me)); + me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS); me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL); DoStartMovement(me->GetVictim()); events.CancelEvent(EVENT_GROUND); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 40c189a8da2..b6ac62257d0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1793,7 +1793,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader } } } - if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct + if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->GetEffect(effIndex)->CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct passenger->EnterVehicle(target, 0); else { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 93fee8d1964..5952c9f8501 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1583,7 +1583,7 @@ class spell_freya_iron_roots : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); + uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); Position pos = GetCaster()->GetPosition(); // Not good at all, but this prevents having roots in a different position then player diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 419052baddc..5ac0024c032 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -454,11 +454,11 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader switch (target->GetMap()->GetDifficulty()) { - case RAID_DIFFICULTY_10MAN_NORMAL: - target->RemoveAura(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + case DIFFICULTY_10_N: + target->RemoveAura(GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue()); break; - case RAID_DIFFICULTY_25MAN_NORMAL: - target->RemoveAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + case DIFFICULTY_25_N: + target->RemoveAura(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()); break; default: break; @@ -534,7 +534,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader if (!GetOwner()->ToCreature()) return; - uint32 rubbleStalkerEntry = (GetOwner()->GetMap()->GetDifficulty() == DUNGEON_DIFFICULTY_NORMAL ? 33809 : 33942); + uint32 rubbleStalkerEntry = (GetOwner()->GetMap()->GetDifficulty() == DIFFICULTY_NORMAL ? 33809 : 33942); Creature* rubbleStalker = GetOwner()->FindNearestCreature(rubbleStalkerEntry, 200.0f, true); if (rubbleStalker) rubbleStalker->CastSpell(rubbleStalker, SPELL_STONE_GRIP_CANCEL, true); @@ -643,7 +643,7 @@ class spell_kologarn_summon_focused_eyebeam : public SpellScriptLoader void HandleForceCast(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true); + GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index cad6b045120..947b1ce9b86 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -237,7 +237,7 @@ class boss_razorscale_controller : public CreatureScript { case ACTION_HARPOON_BUILD: events.ScheduleEvent(EVENT_BUILD_HARPOON_1, 50000); - if (me->GetMap()->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL) + if (me->GetMap()->GetSpawnMode() == DIFFICULTY_25_N) events.ScheduleEvent(EVENT_BUILD_HARPOON_3, 90000); break; case ACTION_PLACE_BROKEN_HARPOON: @@ -1075,7 +1075,7 @@ class spell_razorscale_devouring_flame : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); + uint32 entry = uint32(GetSpellInfo()->GetEffect(effIndex)->MiscValue); WorldLocation const* summonLocation = GetExplTargetDest(); if (!caster || !summonLocation) return; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 53fbf8f0cf7..1f55abf8a11 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -21,8 +21,14 @@ DoorData const doorData[] = { - { GO_IKISS_DOOR, DATA_TALON_KING_IKISS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END + { GO_IKISS_DOOR, DATA_TALON_KING_IKISS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END +}; + +ObjectData const gameObjectData[] = +{ + { GO_TALON_KING_COFFER, DATA_TALON_KING_COFFER }, + { 0, 0 } // END }; class instance_sethekk_halls : public InstanceMapScript @@ -37,6 +43,7 @@ class instance_sethekk_halls : public InstanceMapScript SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); + LoadObjectData(nullptr, gameObjectData); } void OnCreatureCreate(Creature* creature) override @@ -50,16 +57,27 @@ class instance_sethekk_halls : public InstanceMapScript } } - void OnGameObjectCreate(GameObject* go) override + bool SetBossState(uint32 type, EncounterState state) override { - if (go->GetEntry() == GO_IKISS_DOOR) - AddDoor(go, true); - } + if (!InstanceScript::SetBossState(type, state)) + return false; - void OnGameObjectRemove(GameObject* go) override - { - if (go->GetEntry() == GO_IKISS_DOOR) - AddDoor(go, false); + switch (type) + { + case DATA_TALON_KING_IKISS: + if (state == DONE) + { + /// @workaround: GO_FLAG_INTERACT_COND remains on the gob, but it is not handled correctly in this case + /// gameobject should have GO_DYNFLAG_LO_ACTIVATE too, which makes gobs interactable with GO_FLAG_INTERACT_COND + /// so just removed GO_FLAG_INTERACT_COND + if (GameObject* coffer = GetGameObject(DATA_TALON_KING_COFFER)) + coffer->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + } + break; + default: + break; + } + return true; } }; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h index 4b6bfab46cb..8cf01fb4635 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h @@ -28,7 +28,10 @@ enum DataTypes // Encounter States/Boss GUIDs DATA_DARKWEAVER_SYTH = 0, DATA_TALON_KING_IKISS = 1, - DATA_ANZU = 2 + DATA_ANZU = 2, + + // Additional Data + DATA_TALON_KING_COFFER = 3 }; enum CreatureIds @@ -39,7 +42,8 @@ enum CreatureIds enum GameObjectIds { - GO_IKISS_DOOR = 177203 + GO_IKISS_DOOR = 177203, + GO_TALON_KING_COFFER = 187372 }; template<class AI> 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 d49a23c85dd..1e55eb37007 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -572,8 +572,8 @@ public: void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override { if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - for (uint8 i = 0; i < 3; ++i) - if (spell->Effects[i].Effect == SPELL_EFFECT_INTERRUPT_CAST) + for (SpellEffectInfo const* effect : spell->GetEffectsForDifficulty(me->GetMap()->GetDifficulty())) + if (effect->Effect == SPELL_EFFECT_INTERRUPT_CAST) if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK || me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN) me->InterruptSpell(CURRENT_GENERIC_SPELL, false); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index f0884e83baa..794d3a490f6 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -31,21 +31,25 @@ class go_main_chambers_access_panel : public GameObjectScript return false; if (go->GetEntry() == GO_ACCESS_PANEL_HYDRO && (instance->GetBossState(DATA_HYDROMANCER_THESPIA) == DONE || instance->GetBossState(DATA_HYDROMANCER_THESPIA) == SPECIAL)) - { instance->SetBossState(DATA_HYDROMANCER_THESPIA, SPECIAL); - go->SetGoState(GO_STATE_ACTIVE); - } if (go->GetEntry() == GO_ACCESS_PANEL_MEK && (instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == DONE || instance->GetBossState(DATA_MEKGINEER_STEAMRIGGER) == SPECIAL)) - { instance->SetBossState(DATA_MEKGINEER_STEAMRIGGER, SPECIAL); - go->SetGoState(GO_STATE_ACTIVE); - } + + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); return true; } }; +ObjectData const gameObjectData[] = +{ + { GO_ACCESS_PANEL_HYDRO, DATA_ACCESS_PANEL_HYDRO }, + { GO_ACCESS_PANEL_MEK, DATA_ACCESS_PANEL_MEK }, + { 0, 0 } // END +}; + class instance_steam_vault : public InstanceMapScript { public: @@ -57,6 +61,7 @@ class instance_steam_vault : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(EncounterCount); + LoadObjectData(nullptr, gameObjectData); DistillerState = 0; } @@ -89,6 +94,8 @@ class instance_steam_vault : public InstanceMapScript default: break; } + + InstanceScript::OnGameObjectCreate(go); } ObjectGuid GetGuidData(uint32 type) const override @@ -128,6 +135,9 @@ class instance_steam_vault : public InstanceMapScript switch (type) { case DATA_HYDROMANCER_THESPIA: + if (state == DONE) + if (GameObject* panel = GetGameObject(DATA_ACCESS_PANEL_HYDRO)) + panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (state == SPECIAL) { if (GetBossState(DATA_MEKGINEER_STEAMRIGGER) == SPECIAL) @@ -137,6 +147,9 @@ class instance_steam_vault : public InstanceMapScript } break; case DATA_MEKGINEER_STEAMRIGGER: + if (state == DONE) + if (GameObject* panel = GetGameObject(DATA_ACCESS_PANEL_MEK)) + panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (state == SPECIAL) { if (GetBossState(DATA_HYDROMANCER_THESPIA) == SPECIAL) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h index 58f71b047ef..d18d0406dea 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h @@ -28,7 +28,11 @@ enum DataTypes DATA_HYDROMANCER_THESPIA = 0, DATA_MEKGINEER_STEAMRIGGER = 1, DATA_WARLORD_KALITHRESH = 2, - DATA_DISTILLER = 3 + DATA_DISTILLER = 3, + + // Additional Data + DATA_ACCESS_PANEL_HYDRO = 4, + DATA_ACCESS_PANEL_MEK = 5 }; enum CreatureIds diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 2cee741cbf3..a3404e048ce 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -317,7 +317,7 @@ class spell_gruul_shatter_effect : public SpellScriptLoader if (!GetHitUnit()) return; - float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float radius = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); if (!radius) return; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index a0673d4aced..c0a7f85cb63 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -154,7 +154,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell)) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell)) return false; return true; } @@ -163,7 +163,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader { PreventDefaultAction(); - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)NULL, TRIGGERED_FULL_MASK, NULL, aurEff); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index cd433000e8e..7e30ae1a931 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -542,7 +542,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader return; Unit* target = GetUnitOwner(); - target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), false); + target->CastSpell(target, GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(), false); } void Register() override diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 0ff7d116a88..cc96b27cb0a 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -89,7 +89,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(GetCaster()); return true; } @@ -138,8 +138,8 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader uint32 absorbPct, hpPct; bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); - hpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + absorbPct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(GetCaster()); + hpPct = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(GetCaster()); return true; } @@ -203,7 +203,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(GetCaster()); return true; } @@ -217,7 +217,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { SpellInfo const* talentSpell = sSpellMgr->EnsureSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT); - amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster()); + amount = talentSpell->GetEffect(EFFECT_0)->CalcValue(GetCaster()); if (Player* player = GetCaster()->ToPlayer()) amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK)); } @@ -628,7 +628,7 @@ class spell_dk_death_strike : public SpellScriptLoader if (AuraEffect* enabler = GetCaster()->GetAuraEffect(SPELL_DK_DEATH_STRIKE_ENABLER, EFFECT_0, GetCaster()->GetGUID())) { // Call CalculateAmount() to constantly fire the AuraEffect's HandleCalcAmount method - int32 heal = CalculatePct(enabler->CalculateAmount(GetCaster()), GetSpellInfo()->Effects[EFFECT_0].ChainAmplitude); + int32 heal = CalculatePct(enabler->CalculateAmount(GetCaster()), GetSpellInfo()->GetEffect(EFFECT_0)->ChainAmplitude); if (AuraEffect const* aurEff = GetCaster()->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_DEATH_STRIKE, EFFECT_2)) heal = AddPct(heal, aurEff->GetAmount()); @@ -1045,7 +1045,7 @@ class spell_dk_pestilence : public SpellScriptLoader { aurEffNew->SetCritChance(critChance); // Blood Plague can crit if caster has T9. aurEffNew->SetDonePct(donePct); - aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct); + aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT, aurEffNew->GetSpellEffectInfo()) * donePct); } } } @@ -1064,7 +1064,7 @@ class spell_dk_pestilence : public SpellScriptLoader if (AuraEffect* aurEffNew = aurNew->GetEffect(EFFECT_0)) { aurEffNew->SetDonePct(donePct); - aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT) * donePct); + aurEffNew->SetDamage(caster->SpellDamageBonusDone(hitUnit, aurEffNew->GetSpellInfo(), std::max(aurEffNew->GetAmount(), 0), DOT, aurEffNew->GetSpellEffectInfo()) * donePct); } } } @@ -1231,12 +1231,13 @@ class spell_dk_raise_dead : public SpellScriptLoader private: bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue()) - || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_2].CalcValue()) + // 6.x effects changed + /*if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_1)->CalcValue()) + || !sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_2)->CalcValue()) || !sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT) || !sSpellMgr->GetSpellInfo(SPELL_DK_MASTER_OF_GHOULS)) - return false; - return true; + return false;*/ + return false; } bool Load() override @@ -1314,10 +1315,10 @@ class spell_dk_raise_dead : public SpellScriptLoader // Do we have talent Master of Ghouls? if (GetCaster()->HasAura(SPELL_DK_MASTER_OF_GHOULS)) // summon as pet - return GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + return GetSpellInfo()->GetEffect(EFFECT_2)->CalcValue(); // or guardian - return GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + return GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(); } void HandleRaiseDead(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 184e12cdccb..c38d6b07124 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -148,8 +148,6 @@ class spell_dru_eclipse_energize : public SpellScriptLoader { PrepareSpellScript(spell_dru_eclipse_energize_SpellScript); - int32 energizeAmount; - bool Load() override { if (GetCaster()->GetTypeId() != TYPEID_PLAYER) @@ -158,8 +156,6 @@ class spell_dru_eclipse_energize : public SpellScriptLoader if (GetCaster()->ToPlayer()->getClass() != CLASS_DRUID) return false; - energizeAmount = 0; - return true; } @@ -175,7 +171,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader { case SPELL_DRUID_WRATH: { - energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -13 + int32 energizeAmount = -GetEffectValue(); // -13 // If we are set to fill the lunar side or we've just logged in with 0 power.. if ((!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) || caster->GetPower(POWER_ECLIPSE) == 0) @@ -192,7 +188,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader } case SPELL_DRUID_STARFIRE: { - energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 20 + int32 energizeAmount = GetEffectValue(); // 20 // If we are set to fill the solar side or we've just logged in with 0 power.. if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) || caster->GetPower(POWER_ECLIPSE) == 0) @@ -213,7 +209,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader if ((!caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER)) || caster->GetPower(POWER_ECLIPSE) == 0) { - energizeAmount = GetSpellInfo()->Effects[effIndex].BasePoints; // 15 + int32 energizeAmount = GetEffectValue(); // 15 caster->CastCustomSpell(caster, SPELL_DRUID_STARSURGE_ENERGIZE, &energizeAmount, 0, 0, true); // If the energize was due to 0 power, cast the eclipse marker aura @@ -222,7 +218,7 @@ class spell_dru_eclipse_energize : public SpellScriptLoader } else if (!caster->HasAura(SPELL_DRUID_SOLAR_ECLIPSE_MARKER) && caster->HasAura(SPELL_DRUID_LUNAR_ECLIPSE_MARKER)) { - energizeAmount = -GetSpellInfo()->Effects[effIndex].BasePoints; // -15 + int32 energizeAmount = -GetEffectValue(); // -15 caster->CastCustomSpell(caster, SPELL_DRUID_STARSURGE_ENERGIZE, &energizeAmount, 0, 0, true); } // The energizing effect brought us out of the lunar eclipse, remove the aura @@ -430,7 +426,7 @@ class spell_dru_idol_lifebloom : public SpellScriptLoader spellMod->op = SPELLMOD_DOT; spellMod->type = SPELLMOD_FLAT; spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; + spellMod->mask = GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->SpellClassMask; } spellMod->value = aurEff->GetAmount() / 7; } @@ -536,8 +532,8 @@ class spell_dru_lifebloom : public SpellScriptLoader int32 healAmount = aurEff->GetAmount(); if (Unit* caster = GetCaster()) { - healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack); - healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack); + healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), stack); + healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), stack); GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); @@ -560,8 +556,8 @@ class spell_dru_lifebloom : public SpellScriptLoader int32 healAmount = aurEff->GetAmount(); if (Unit* caster = GetCaster()) { - healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); - healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges()); + healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), dispelInfo->GetRemovedCharges()); + healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), dispelInfo->GetRemovedCharges()); target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); // restore mana @@ -757,7 +753,7 @@ class spell_dru_savage_defense : public SpellScriptLoader bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(GetCaster()); return true; } @@ -1191,7 +1187,7 @@ class spell_dru_wild_growth : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (spellInfo->Effects[EFFECT_2].IsEffect() || spellInfo->Effects[EFFECT_2].CalcValue() <= 0) + if (spellInfo->GetEffect(EFFECT_2)->IsEffect() || spellInfo->GetEffect(EFFECT_2)->CalcValue() <= 0) return false; return true; } @@ -1200,7 +1196,7 @@ class spell_dru_wild_growth : public SpellScriptLoader { targets.remove_if(RaidCheck(GetCaster())); - uint32 const maxTargets = uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue(GetCaster())); + uint32 const maxTargets = uint32(GetSpellInfo()->GetEffect(EFFECT_2)->CalcValue(GetCaster())); if (targets.size() > maxTargets) { diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index badb19c12c3..87619460ee7 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -59,7 +59,7 @@ class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader bool Load() override { // Max absorb stored in 1 dummy effect - limit = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + limit = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(); return true; } @@ -207,9 +207,9 @@ class spell_gen_alchemist_stone : public SpellScriptLoader uint32 spellId = 0; int32 bp = int32(eventInfo.GetDamageInfo()->GetDamage() * 0.4f); - if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_HEAL)) + if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(DIFFICULTY_NONE, SPELL_EFFECT_HEAL)) spellId = ALECHEMIST_STONE_HEAL; - else if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(SPELL_EFFECT_ENERGIZE)) + else if (eventInfo.GetDamageInfo()->GetSpellInfo()->HasEffect(DIFFICULTY_NONE, SPELL_EFFECT_ENERGIZE)) spellId = ALECHEMIST_STONE_MANA; if (!spellId) @@ -1180,13 +1180,14 @@ class spell_gen_defend : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) - return false; - return true; + // 6.x effects changed + //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_1)) + // return false; + //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_2)) + // return false; + //if (!sSpellMgr->GetSpellInfo(SPELL_VISUAL_SHIELD_3)) + // return false; + return false; } void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) @@ -1222,23 +1223,24 @@ class spell_gen_defend : public SpellScriptLoader { SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId); + // 6.x effects removed + // Defend spells cast by NPCs (add visuals) - if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + /*if (spell->GetEffect(EFFECT_0)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - } - + }*/ // Remove Defend spell from player when he dismounts - if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) - OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); + //if (spell->GetEffect(EFFECT_2)->ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + // OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); // Defend spells cast by players (add/remove visuals) - if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY) + /*if (spell->GetEffect(EFFECT_1)->ApplyAuraName == SPELL_AURA_DUMMY) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend_AuraScript::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend_AuraScript::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); - } + }*/ } }; @@ -1264,7 +1266,7 @@ class spell_gen_despawn_self : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) + if (GetSpellInfo()->GetEffect(effIndex)->Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->GetEffect(effIndex)->Effect == SPELL_EFFECT_SCRIPT_EFFECT) GetCaster()->ToCreature()->DespawnOrUnsummon(); } @@ -1945,10 +1947,10 @@ class spell_gen_mounted_charge: public SpellScriptLoader { SpellInfo const* spell = sSpellMgr->EnsureSpellInfo(m_scriptSpellId); - if (spell->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT)) + if (spell->HasEffect(DIFFICULTY_NONE, SPELL_EFFECT_SCRIPT_EFFECT)) OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); - if (spell->Effects[EFFECT_0].Effect == SPELL_EFFECT_CHARGE) + if (spell->GetEffect(EFFECT_0)->Effect == SPELL_EFFECT_CHARGE) OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge_SpellScript::HandleChargeEffect, EFFECT_0, SPELL_EFFECT_CHARGE); } }; @@ -2426,8 +2428,8 @@ class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { Player* player = GetCaster()->ToPlayer(); - uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); - int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + uint32 factionId = GetSpellInfo()->GetEffect(effIndex)->CalcValue(); + int32 repChange = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) @@ -3845,7 +3847,7 @@ public: void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { - if (GetCaster()->HasAura(SPELL_MIXOLOGY) && GetCaster()->HasSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell)) + if (GetCaster()->HasAura(SPELL_MIXOLOGY) && GetCaster()->HasSpell(GetSpellInfo()->GetEffect(EFFECT_0)->TriggerSpell)) { switch (GetId()) { diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index 5c84f3045f8..a5eec35d95b 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -691,7 +691,7 @@ class spell_brewfest_relay_race_intro_force_player_to_throw : public SpellScript PreventHitDefaultEffect(effIndex); // All this spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->GetEffect(effIndex)->TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index f8ef7862c35..9f7f0dc4a5b 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -231,42 +231,6 @@ class spell_hun_disengage : public SpellScriptLoader } }; -// 82926 - Fire! -class spell_hun_fire : public SpellScriptLoader -{ - public: - spell_hun_fire() : SpellScriptLoader("spell_hun_fire") { } - - class spell_hun_fire_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_fire_AuraScript); - - void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) - { - if (!spellMod) - { - spellMod = new SpellModifier(GetAura()); - spellMod->op = SPELLMOD_CASTING_TIME; - spellMod->type = SPELLMOD_PCT; - spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; - } - - spellMod->value = -aurEff->GetAmount(); - } - - void Register() override - { - DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_hun_fire_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_hun_fire_AuraScript(); - } -}; - // -19572 - Improved Mend Pet class spell_hun_improved_mend_pet : public SpellScriptLoader { @@ -308,42 +272,6 @@ class spell_hun_improved_mend_pet : public SpellScriptLoader } }; -// -19464 Improved Serpent Sting -class spell_hun_improved_serpent_sting : public SpellScriptLoader -{ - public: - spell_hun_improved_serpent_sting() : SpellScriptLoader("spell_hun_improved_serpent_sting") { } - - class spell_hun_improved_serpent_sting_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_improved_serpent_sting_AuraScript); - - void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) - { - if (!spellMod) - { - spellMod = new SpellModifier(GetAura()); - spellMod->op = SpellModOp(aurEff->GetMiscValue()); - spellMod->type = SPELLMOD_PCT; - spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; - } - - spellMod->value = aurEff->GetAmount(); - } - - void Register() override - { - DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_hun_improved_serpent_sting_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_hun_improved_serpent_sting_AuraScript(); - } -}; - // 53412 - Invigoration class spell_hun_invigoration : public SpellScriptLoader { @@ -430,7 +358,7 @@ class spell_hun_masters_call : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_MASTERS_CALL_TRIGGERED) || - !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue())) + !sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue())) return false; return true; } @@ -1087,9 +1015,7 @@ void AddSC_hunter_spell_scripts() new spell_hun_chimera_shot(); new spell_hun_cobra_shot(); new spell_hun_disengage(); - new spell_hun_fire(); new spell_hun_improved_mend_pet(); - new spell_hun_improved_serpent_sting(); new spell_hun_invigoration(); new spell_hun_last_stand_pet(); new spell_hun_masters_call(); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 17c72ba5561..baf7ff48cb5 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -221,7 +221,7 @@ class spell_mage_blast_wave : public SpellScriptLoader } private: - uint32 _targetCount; + uint32 _targetCount = 0; }; SpellScript* GetSpellScript() const override @@ -497,7 +497,7 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) { - Unit* target = GetTarget(); + /*Unit* target = GetTarget(); if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) { int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET @@ -510,7 +510,7 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader absorbAmount = 0; PreventDefaultAction(); } - } + }*/ } void Register() override @@ -738,7 +738,7 @@ class spell_mage_living_bomb : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) { - if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_1].CalcValue()))) + if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->GetEffect(EFFECT_1)->CalcValue()))) return false; return true; } @@ -780,7 +780,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader { canBeRecalculated = false; if (Unit* caster = GetCaster()) - amount += int32(0.87f * caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask())); + amount += int32(4.95f * caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask())); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -836,7 +836,7 @@ class spell_mage_ignite : public SpellScriptLoader SpellInfo const* igniteDot = sSpellMgr->EnsureSpellInfo(SPELL_MAGE_IGNITE); int32 pct = 8 * GetSpellInfo()->GetRank(); - int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks()); + int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks(DIFFICULTY_NONE)); amount += eventInfo.GetProcTarget()->GetRemainingPeriodicAmount(eventInfo.GetActor()->GetGUID(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE); GetTarget()->CastCustomSpell(SPELL_MAGE_IGNITE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff); } @@ -1078,12 +1078,6 @@ class spell_mage_polymorph : public SpellScriptLoader return true; } - bool Load() override - { - _caster = NULL; - return true; - } - bool DoCheck(ProcEventInfo& eventInfo) { _caster = GetCaster(); @@ -1111,7 +1105,7 @@ class spell_mage_polymorph : public SpellScriptLoader } private: - Unit* _caster; + Unit* _caster = nullptr; }; AuraScript* GetAuraScript() const override @@ -1254,7 +1248,7 @@ class spell_mage_ring_of_frost : public SpellScriptLoader void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { std::list<Creature*> MinionList; - GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->Effects[EFFECT_0].MiscValue); + GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->GetEffect(EFFECT_0)->MiscValue); // Get the last summoned RoF, save it and despawn older ones for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) @@ -1313,7 +1307,7 @@ class spell_mage_ring_of_frost_freeze : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets) { - float outRadius = sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->Effects[EFFECT_0].CalcRadius(); + float outRadius = sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_SUMMON)->GetEffect(EFFECT_0)->CalcRadius(); float inRadius = 4.7f; for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr) @@ -1456,7 +1450,7 @@ class spell_mage_water_elemental_freeze : public SpellScriptLoader } private: - bool _didHit; + bool _didHit = false; }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 1dab620a9c7..f4afee89d6f 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -401,62 +401,6 @@ class spell_pal_blessing_of_faith : public SpellScriptLoader } }; -// 64205 - Divine Sacrifice -class spell_pal_divine_sacrifice : public SpellScriptLoader -{ - public: - spell_pal_divine_sacrifice() : SpellScriptLoader("spell_pal_divine_sacrifice") { } - - class spell_pal_divine_sacrifice_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_divine_sacrifice_AuraScript); - - uint32 groupSize, minHpPct; - int32 remainingAmount; - - bool Load() override - { - - if (Unit* caster = GetCaster()) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - if (caster->ToPlayer()->GetGroup()) - groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount(); - else - groupSize = 1; - } - else - return false; - - remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); - minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); - return true; - } - return false; - } - - void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount) - { - remainingAmount -= splitAmount; - // break when absorbed everything it could, or if the casters hp drops below 20% - if (Unit* caster = GetCaster()) - if (remainingAmount <= 0 || (caster->GetHealthPct() < minHpPct)) - caster->RemoveAura(SPELL_PALADIN_DIVINE_SACRIFICE); - } - - void Register() override - { - OnEffectSplit += AuraEffectSplitFn(spell_pal_divine_sacrifice_AuraScript::Split, EFFECT_0); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_pal_divine_sacrifice_AuraScript(); - } -}; - // 53385 - Divine Storm class spell_pal_divine_storm : public SpellScriptLoader { @@ -485,7 +429,7 @@ class spell_pal_divine_storm : public SpellScriptLoader bool Load() override { - healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + healPct = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(GetCaster()); return true; } @@ -1279,7 +1223,6 @@ void AddSC_paladin_spell_scripts() new spell_pal_avenging_wrath(); new spell_pal_beacon_of_light(); new spell_pal_blessing_of_faith(); - new spell_pal_divine_sacrifice(); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); new spell_pal_exorcism_and_holy_wrath_damage(); diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 9fd55ae057e..042f1c321ee 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -915,7 +915,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue()); + AddPct(mod, spellInfo->GetEffect(EFFECT_0)->CalcValue()); } ownerBonus = owner->GetStat(STAT_STAMINA)*mod; @@ -958,7 +958,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1)->CalcValue()); } bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod; @@ -988,7 +988,7 @@ public: if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt { SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value - mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue()); + mod += CalculatePct(1.0f, spellInfo->GetEffect(EFFECT_1)->CalcValue()); } bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod; @@ -1450,7 +1450,7 @@ public: amount = -90; // Night of the dead else if (Aura* aur = owner->GetAuraOfRankedSpell(SPELL_NIGHT_OF_THE_DEAD)) - amount = aur->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + amount = aur->GetSpellInfo()->GetEffect(EFFECT_2)->CalcValue(); } } } @@ -1502,7 +1502,7 @@ public: // Ravenous Dead. Check just if owner has Ravenous Dead since it's effect is not an aura if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0)) - mod += aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()/100; // Ravenous Dead edits the original scale + mod += aurEff->GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()/100; // Ravenous Dead edits the original scale // Glyph of the Ghoul if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_DEATH_KNIGHT_GLYPH_OF_GHOUL, 0)) @@ -1547,7 +1547,7 @@ public: aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); if (aurEff) { - mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + mod += CalculatePct(mod, aurEff->GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()); // Ravenous Dead edits the original scale } // Glyph of the Ghoul aurEff = owner->GetAuraEffect(58686, 0); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8ec5450072f..77386808136 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -369,7 +369,7 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader PreventDefaultAction(); SpellInfo const* triggeredSpellInfo = sSpellMgr->EnsureSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL); - int32 heal = int32(CalculatePct(int32(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks()); + int32 heal = int32(CalculatePct(int32(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks(DIFFICULTY_NONE)); GetTarget()->CastCustomSpell(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, SPELLVALUE_BASE_POINT0, heal, eventInfo.GetProcTarget(), true, NULL, aurEff); } @@ -402,7 +402,7 @@ class spell_pri_improved_power_word_shield : public SpellScriptLoader spellMod->op = SpellModOp(aurEff->GetMiscValue()); spellMod->type = SPELLMOD_PCT; spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; + spellMod->mask = GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->SpellClassMask; } spellMod->value = aurEff->GetAmount(); @@ -483,7 +483,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader bool Load() override { - healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + healPct = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(); return true; } @@ -752,7 +752,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader { uint32 damage = std::max(aur->GetAmount(), 0); sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT) * aur->GetDonePct()); + aur->SetDamage(caster->SpellDamageBonusDone(target, aur->GetSpellInfo(), damage, DOT, aur->GetSpellEffectInfo()) * aur->GetDonePct()); aur->CalculatePeriodic(caster, false, false); aur->GetBase()->RefreshDuration(); } @@ -1016,8 +1016,8 @@ class spell_pri_renew : public SpellScriptLoader // Divine Touch if (AuraEffect const* empoweredRenewAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_DIVINE_TOUCH_TALENT, EFFECT_0)) { - uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), aurEff->GetAmount(), DOT); - heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT); + uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), aurEff->GetAmount(), DOT, aurEff->GetSpellEffectInfo()); + heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, aurEff->GetSpellEffectInfo()); int32 basepoints0 = CalculatePct(int32(heal) * aurEff->GetTotalTicks(), empoweredRenewAurEff->GetAmount()); caster->CastCustomSpell(GetTarget(), SPELL_PRIEST_DIVINE_TOUCH, &basepoints0, NULL, NULL, true, NULL, aurEff); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 580549a3d99..e9cf81f2e64 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -635,12 +635,12 @@ class spell_q12683_take_sputum_sample : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + uint32 reqAuraId = GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue(); Unit* caster = GetCaster(); if (caster->HasAuraEffect(reqAuraId, 0)) { - uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + uint32 spellId = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(); caster->CastSpell(caster, spellId, true, NULL); } } @@ -1850,7 +1850,7 @@ class spell_q13086_cannons_target : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue())) + if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->CalcValue())) return false; return true; } @@ -2011,7 +2011,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa void ModDest(SpellDestination& dest) { - float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float dist = GetSpellInfo()->GetEffect(EFFECT_0)->CalcRadius(GetCaster()); float angle = frand(0.75f, 1.25f) * float(M_PI); Position pos = GetCaster()->GetNearPosition(dist, angle); @@ -2151,7 +2151,7 @@ class spell_q12619_emblazon_runeblade : public SpellScriptLoader { PreventDefaultAction(); if (Unit* caster = GetCaster()) - caster->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff); + caster->CastSpell(caster, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, true, NULL, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 9b3b38875af..78ebe0734b5 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -145,7 +145,8 @@ class spell_rog_cheat_death : public SpellScriptLoader bool Load() override { - absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + // 6.x has basepoint = 0 ! + absorbChance = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(); return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; } @@ -491,57 +492,6 @@ class spell_rog_master_of_subtlety : public SpellScriptLoader } }; -// 31130 - Nerves of Steel -class spell_rog_nerves_of_steel : public SpellScriptLoader -{ - public: - spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { } - - class spell_rog_nerves_of_steel_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript); - - public: - spell_rog_nerves_of_steel_AuraScript() - { - absorbPct = 0; - } - - private: - uint32 absorbPct; - - bool Load() override - { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); - return true; - } - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } - - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - // reduces all damage taken while stun or fear - if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))) - absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_rog_nerves_of_steel_AuraScript(); - } -}; - // 58428 - Overkill class spell_rog_overkill : public SpellScriptLoader { @@ -642,51 +592,6 @@ class spell_rog_preparation : public SpellScriptLoader } }; -// 51685 - Prey on the Weak -class spell_rog_prey_on_the_weak : public SpellScriptLoader -{ - public: - spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { } - - class spell_rog_prey_on_the_weak_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK)) - return false; - return true; - } - - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) - { - Unit* target = GetTarget(); - Unit* victim = target->GetVictim(); - if (victim && (target->GetHealthPct() > victim->GetHealthPct())) - { - if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK)) - { - int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, nullptr, nullptr, true); - } - } - else - target->RemoveAurasDueToSpell(SPELL_ROGUE_PREY_ON_THE_WEAK); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_rog_prey_on_the_weak_AuraScript(); - } -}; - // 73651 - Recuperate class spell_rog_recuperate : public SpellScriptLoader { @@ -714,7 +619,7 @@ class spell_rog_recuperate : public SpellScriptLoader canBeRecalculated = false; if (Unit* caster = GetCaster()) { - int32 baseAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster) * 1000; + int32 baseAmount = GetSpellInfo()->GetEffect(EFFECT_0)->CalcValue(caster) * 1000; // Improved Recuperate if (AuraEffect const* auraEffect = caster->GetDummyAuraEffect(SPELLFAMILY_ROGUE, ICON_ROGUE_IMPROVED_RECUPERATE, EFFECT_0)) baseAmount += auraEffect->GetAmount(); @@ -1028,10 +933,8 @@ void AddSC_rogue_spell_scripts() new spell_rog_deadly_poison(); new spell_rog_killing_spree(); new spell_rog_master_of_subtlety(); - new spell_rog_nerves_of_steel(); new spell_rog_overkill(); new spell_rog_preparation(); - new spell_rog_prey_on_the_weak(); new spell_rog_recuperate(); new spell_rog_rupture(); new spell_rog_shiv(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 5e8e3a1070f..8e363c6f125 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -236,7 +236,7 @@ class spell_sha_chain_heal : public SpellScriptLoader if (AuraEffect* aurEff = GetHitUnit()->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, GetCaster()->GetGUID())) { riptide = true; - amount = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + amount = aurEff->GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_2)->CalcValue(); // Consume it GetHitUnit()->RemoveAura(aurEff->GetBase()); } @@ -284,12 +284,12 @@ class spell_sha_earth_shield : public SpellScriptLoader return true; } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool & /*canBeRecalculated*/) + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool & /*canBeRecalculated*/) { if (Unit* caster = GetCaster()) { - amount = caster->SpellHealingBonusDone(GetUnitOwner(), GetSpellInfo(), amount, HEAL); - amount = GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, HEAL); + amount = caster->SpellHealingBonusDone(GetUnitOwner(), GetSpellInfo(), amount, HEAL, aurEff->GetSpellEffectInfo()); + amount = GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, HEAL, aurEff->GetSpellEffectInfo()); //! WORKAROUND // If target is affected by healing reduction, modifier is guaranteed to be negative @@ -561,44 +561,6 @@ class spell_sha_flame_shock : public SpellScriptLoader } }; -// 77794 - Focused Insight -class spell_sha_focused_insight : public SpellScriptLoader -{ - public: - spell_sha_focused_insight() : SpellScriptLoader("spell_sha_focused_insight") { } - - class spell_sha_focused_insight_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sha_focused_insight_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FOCUSED_INSIGHT)) - return false; - return true; - } - - void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - int32 basePoints0 = aurEff->GetAmount(); - int32 basePoints1 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - - GetTarget()->CastCustomSpell(GetTarget(), SPELL_SHAMAN_FOCUSED_INSIGHT, &basePoints0, &basePoints1, &basePoints1, true, NULL, aurEff); - } - - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_sha_focused_insight_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_sha_focused_insight_AuraScript(); - } -}; - // 55440 - Glyph of Healing Wave class spell_sha_glyph_of_healing_wave : public SpellScriptLoader { @@ -659,26 +621,26 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader return sSpellMgr->GetSpellInfo(SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL) != nullptr; } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleDummy(SpellEffIndex effIndex) { int32 damage = GetEffectValue(); SpellInfo const* triggeringSpell = GetTriggeringSpell(); if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) + { + if (Unit* owner = GetCaster()->GetOwner()) { - if (Unit* owner = caster->GetOwner()) - { - if (triggeringSpell) - damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL)); - - // Soothing Rains - if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_SOOTHING_RAIN, EFFECT_0)) - AddPct(damage, dummy->GetAmount()); - - damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL)); - } - caster->CastCustomSpell(target, SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + if (triggeringSpell) + damage = int32(owner->SpellHealingBonusDone(target, triggeringSpell, damage, HEAL, triggeringSpell->GetEffect(target, effIndex))); + + // Soothing Rains + if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_SOOTHING_RAIN, EFFECT_0)) + AddPct(damage, dummy->GetAmount()); + + if (triggeringSpell) + damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL, triggeringSpell->GetEffect(target, effIndex))); } + GetCaster()->CastCustomSpell(target, SPELL_SHAMAN_TOTEM_HEALING_STREAM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + } } void Register() override @@ -1072,7 +1034,7 @@ class spell_sha_nature_guardian : public SpellScriptLoader eventInfo.GetProcTarget()->getThreatManager().modifyThreatPercent(GetTarget(), -10); if (Player* player = GetTarget()->ToPlayer()) - player->AddSpellCooldown(GetSpellInfo()->Id, 0, time(NULL) + aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + player->AddSpellCooldown(GetSpellInfo()->Id, 0, time(NULL) + aurEff->GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()); } void Register() override @@ -1242,7 +1204,6 @@ void AddSC_shaman_spell_scripts() new spell_sha_feedback(); new spell_sha_fire_nova(); new spell_sha_flame_shock(); - new spell_sha_focused_insight(); new spell_sha_glyph_of_healing_wave(); new spell_sha_healing_stream_totem(); new spell_sha_heroism(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 128cddef1c1..5e745f6ab00 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -201,15 +201,16 @@ class spell_warl_conflagrate : public SpellScriptLoader return true; } - void HandleHit(SpellEffIndex /*effIndex*/) - { - if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffect(SPELL_WARLOCK_IMMOLATE, EFFECT_2, GetCaster()->GetGUID())) - SetHitDamage(CalculatePct(aurEff->GetAmount(), GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()))); - } + // 6.x dmg formula in tooltip + // void HandleHit(SpellEffIndex /*effIndex*/) + // { + // if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffect(SPELL_WARLOCK_IMMOLATE, EFFECT_2, GetCaster()->GetGUID())) + // SetHitDamage(CalculatePct(aurEff->GetAmount(), GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()))); + // } void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_warl_conflagrate_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + //OnEffectHitTarget += SpellEffectFn(spell_warl_conflagrate_SpellScript::HandleHit, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; @@ -426,7 +427,7 @@ class spell_warl_demon_soul : public SpellScriptLoader { if (targetCreature->IsPet()) { - CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(targetCreature->GetEntry()); + CreatureTemplate const* ci = targetCreature->GetCreatureTemplate(); switch (ci->family) { case CREATURE_FAMILY_SUCCUBUS: @@ -485,8 +486,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader { if (targetCreature->IsPet()) { - CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(targetCreature->GetEntry()); - ASSERT(ci); + CreatureTemplate const* ci = targetCreature->GetCreatureTemplate(); switch (ci->family) { case CREATURE_FAMILY_SUCCUBUS: @@ -536,7 +536,7 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader { PrepareSpellScript(spell_warl_everlasting_affliction_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex effIndex) { Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) @@ -545,7 +545,7 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader { uint32 damage = std::max(aurEff->GetAmount(), 0); sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage); - aurEff->SetDamage(caster->SpellDamageBonusDone(target, aurEff->GetSpellInfo(), damage, DOT) * aurEff->GetDonePct()); + aurEff->SetDamage(caster->SpellDamageBonusDone(target, aurEff->GetSpellInfo(), damage, DOT, GetEffectInfo(effIndex)) * aurEff->GetDonePct()); aurEff->CalculatePeriodic(caster, false, false); aurEff->GetBase()->RefreshDuration(true); } @@ -563,43 +563,6 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader } }; -// 77799 - Fel Flame - Updated to 4.3.4 -class spell_warl_fel_flame : public SpellScriptLoader -{ - public: - spell_warl_fel_flame() : SpellScriptLoader("spell_warl_fel_flame") { } - - class spell_warl_fel_flame_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warl_fel_flame_SpellScript); - - void OnHitTarget(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); - Aura* aura = target->GetAura(SPELL_WARLOCK_UNSTABLE_AFFLICTION, caster->GetGUID()); - if (!aura) - aura = target->GetAura(SPELL_WARLOCK_IMMOLATE, caster->GetGUID()); - - if (!aura) - return; - - int32 newDuration = aura->GetDuration() + GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 1000; - aura->SetDuration(std::min(newDuration, aura->GetMaxDuration())); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_warl_fel_flame_SpellScript::OnHitTarget, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_warl_fel_flame_SpellScript; - } -}; - // -47230 - Fel Synergy class spell_warl_fel_synergy : public SpellScriptLoader { @@ -868,7 +831,8 @@ class spell_warl_improved_soul_fire : public SpellScriptLoader // 1454 - Life Tap /// Updated 4.3.4 -class spell_warl_life_tap : public SpellScriptLoader +// 6.x fully changed this +/*class spell_warl_life_tap : public SpellScriptLoader { public: spell_warl_life_tap() : SpellScriptLoader("spell_warl_life_tap") { } @@ -882,7 +846,7 @@ class spell_warl_life_tap : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - bool Validate(SpellInfo const* /*spellInfo*/) override + bool Validate(SpellInfo const* spellInfo) override { if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2)) @@ -890,7 +854,7 @@ class spell_warl_life_tap : public SpellScriptLoader return true; } - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex effIndex) { Player* caster = GetCaster()->ToPlayer(); if (Unit* target = GetHitUnit()) @@ -935,7 +899,7 @@ class spell_warl_life_tap : public SpellScriptLoader { return new spell_warl_life_tap_SpellScript(); } -}; +};*/ // 687 - Demon Armor // 28176 - Fel Armor @@ -1194,22 +1158,18 @@ class spell_warl_soul_swap : public SpellScriptLoader } }; +#define SoulSwapOverrideScriptName "spell_warl_soul_swap_override" + // 86211 - Soul Swap Override - Also acts as a dot container class spell_warl_soul_swap_override : public SpellScriptLoader { public: - spell_warl_soul_swap_override() : SpellScriptLoader("spell_warl_soul_swap_override") { } + spell_warl_soul_swap_override() : SpellScriptLoader(SoulSwapOverrideScriptName) { } class spell_warl_soul_swap_override_AuraScript : public AuraScript { PrepareAuraScript(spell_warl_soul_swap_override_AuraScript); - bool Load() override - { - _swapCaster = NULL; - return true; - } - //! Forced to, pure virtual functions must have a body when linking void Register() override { } @@ -1221,7 +1181,7 @@ class spell_warl_soul_swap_override : public SpellScriptLoader private: std::list<uint32> _dotList; - Unit* _swapCaster; + Unit* _swapCaster = nullptr; }; AuraScript* GetAuraScript() const override @@ -1249,14 +1209,16 @@ class spell_warl_soul_swap_dot_marker : public SpellScriptLoader if (!warlock || !swapVictim) return; - flag128 classMask = GetSpellInfo()->Effects[effIndex].SpellClassMask; + // effect existance checked in dbc, should not be removed by core at any time, so no need to check for null + SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_0); + flag128 classMask = effect->SpellClassMask; Unit::AuraApplicationMap const& appliedAuras = swapVictim->GetAppliedAuras(); - SoulSwapOverrideAuraScript* swapSpellScript = NULL; + SoulSwapOverrideAuraScript* swapSpellScript = nullptr; if (Aura* swapOverrideAura = warlock->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE)) - swapSpellScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverrideAura->GetScriptByName("spell_warl_soul_swap_override")); + swapSpellScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverrideAura->GetScriptByName(SoulSwapOverrideScriptName)); - if (swapSpellScript == NULL) + if (!swapSpellScript) return; for (Unit::AuraApplicationMap::const_iterator itr = appliedAuras.begin(); itr != appliedAuras.end(); ++itr) @@ -1303,9 +1265,9 @@ public: SpellCastResult CheckCast() { Unit* currentTarget = GetExplTargetUnit(); - Unit* swapTarget = NULL; + Unit* swapTarget = nullptr; if (Aura const* swapOverride = GetCaster()->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE)) - if (SoulSwapOverrideAuraScript* swapScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverride->GetScriptByName("spell_warl_soul_swap_override"))) + if (SoulSwapOverrideAuraScript* swapScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverride->GetScriptByName(SoulSwapOverrideScriptName))) swapTarget = swapScript->GetOriginalSwapSource(); // Soul Swap Exhale can't be cast on the same target than Soul Swap @@ -1321,10 +1283,10 @@ public: bool hasGlyph = GetCaster()->HasAura(SPELL_WARLOCK_GLYPH_OF_SOUL_SWAP); std::list<uint32> dotList; - Unit* swapSource = NULL; + Unit* swapSource = nullptr; if (Aura const* swapOverride = GetCaster()->GetAura(SPELL_WARLOCK_SOUL_SWAP_OVERRIDE)) { - SoulSwapOverrideAuraScript* swapScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverride->GetScriptByName("spell_warl_soul_swap_override")); + SoulSwapOverrideAuraScript* swapScript = dynamic_cast<SoulSwapOverrideAuraScript*>(swapOverride->GetScriptByName(SoulSwapOverrideScriptName)); if (!swapScript) return; dotList = swapScript->GetDotList(); @@ -1452,14 +1414,14 @@ void AddSC_warlock_spell_scripts() new spell_warl_demonic_empowerment(); new spell_warl_demon_soul(); new spell_warl_everlasting_affliction(); - new spell_warl_fel_flame(); + //new spell_warl_fel_flame(); new spell_warl_fel_synergy(); new spell_warl_glyph_of_shadowflame(); new spell_warl_haunt(); new spell_warl_health_funnel(); new spell_warl_healthstone_heal(); new spell_warl_improved_soul_fire(); - new spell_warl_life_tap(); + //new spell_warl_life_tap(); new spell_warl_nether_ward_overrride(); new spell_warl_seduction(); new spell_warl_seed_of_corruption(); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 3b6b68d3fce..d6ff9375544 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -87,15 +87,15 @@ class spell_warr_bloodthirst : public SpellScriptLoader { PrepareSpellScript(spell_warr_bloodthirst_SpellScript); - void HandleDamage(SpellEffIndex /*effIndex*/) + void HandleDamage(SpellEffIndex effIndex) { int32 damage = GetEffectValue(); ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)); if (Unit* target = GetHitUnit()) { - damage = GetCaster()->SpellDamageBonusDone(target, GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE); - damage = target->SpellDamageBonusTaken(GetCaster(), GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE); + damage = GetCaster()->SpellDamageBonusDone(target, GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE, GetEffectInfo(effIndex)); + damage = target->SpellDamageBonusTaken(GetCaster(), GetSpellInfo(), uint32(damage), SPELL_DIRECT_DAMAGE, GetEffectInfo(effIndex)); } SetHitDamage(damage); } @@ -120,34 +120,6 @@ class spell_warr_bloodthirst : public SpellScriptLoader }; /// Updated 4.3.4 -class spell_warr_bloodthirst_heal : public SpellScriptLoader -{ - public: - spell_warr_bloodthirst_heal() : SpellScriptLoader("spell_warr_bloodthirst_heal") { } - - class spell_warr_bloodthirst_heal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warr_bloodthirst_heal_SpellScript); - - void HandleHeal(SpellEffIndex /*effIndex*/) - { - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARRIOR_BLOODTHIRST_DAMAGE)) - SetHitHeal(GetCaster()->CountPctFromMaxHealth(spellInfo->Effects[EFFECT_1].CalcValue(GetCaster())) / 100); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_warr_bloodthirst_heal_SpellScript(); - } -}; - -/// Updated 4.3.4 class spell_warr_charge : public SpellScriptLoader { public: @@ -216,59 +188,6 @@ class spell_warr_concussion_blow : public SpellScriptLoader } }; -// -12162 - Deep Wounds -class spell_warr_deep_wounds : public SpellScriptLoader -{ - public: - spell_warr_deep_wounds() : SpellScriptLoader("spell_warr_deep_wounds") { } - - class spell_warr_deep_wounds_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warr_deep_wounds_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_1) || - !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_2) || - !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_RANK_3) || - !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC)) - return false; - return true; - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - int32 damage = GetEffectValue(); - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - ApplyPct(damage, 16 * GetSpellInfo()->GetRank()); - - SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC); - uint32 ticks = uint32(spellInfo->GetDuration()) / spellInfo->Effects[EFFECT_0].ApplyAuraPeriod; - - // Add remaining ticks to damage done - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, EFFECT_0, caster->GetGUID())) - damage += aurEff->GetDamage() * int32(ticks - aurEff->GetTickNumber()); - - damage /= int32(ticks); - - caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_PERIODIC, &damage, NULL, NULL, true); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_warr_deep_wounds_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_warr_deep_wounds_SpellScript(); - } -}; - /// Updated 4.3.4 class spell_warr_execute : public SpellScriptLoader { @@ -281,7 +200,7 @@ class spell_warr_execute : public SpellScriptLoader void HandleEffect(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); + /*Unit* caster = GetCaster(); if (GetHitUnit()) { SpellInfo const* spellInfo = GetSpellInfo(); @@ -302,7 +221,7 @@ class spell_warr_execute : public SpellScriptLoader /// Formula taken from the DBC: "${$ap*0.874*$m1/100-1} = 20 rage" int32 moreDamage = int32(rageUsed * (caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.874f * GetEffectValue() / 100.0f - 1) / 200); SetHitDamage(baseDamage + moreDamage); - } + }*/ } void Register() override @@ -317,42 +236,6 @@ class spell_warr_execute : public SpellScriptLoader } }; -// 58387 - Glyph of Sunder Armor -class spell_warr_glyph_of_sunder_armor : public SpellScriptLoader -{ - public: - spell_warr_glyph_of_sunder_armor() : SpellScriptLoader("spell_warr_glyph_of_sunder_armor") { } - - class spell_warr_glyph_of_sunder_armor_AuraScript : public AuraScript - { - PrepareAuraScript(spell_warr_glyph_of_sunder_armor_AuraScript); - - void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) - { - if (!spellMod) - { - spellMod = new SpellModifier(aurEff->GetBase()); - spellMod->op = SpellModOp(aurEff->GetMiscValue()); - spellMod->type = SPELLMOD_FLAT; - spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; - } - - spellMod->value = aurEff->GetAmount(); - } - - void Register() override - { - DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_warr_glyph_of_sunder_armor_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_warr_glyph_of_sunder_armor_AuraScript(); - } -}; - // 59725 - Improved Spell Reflection class spell_warr_improved_spell_reflection : public SpellScriptLoader { @@ -991,11 +874,11 @@ class spell_warr_vigilance : public SpellScriptLoader void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { - PreventDefaultAction(); + /*PreventDefaultAction(); int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue())); GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_VIGILANCE_PROC, true, NULL, aurEff); - _procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff); + _procTarget->CastCustomSpell(_procTarget, SPELL_WARRIOR_VENGEANCE, &damage, &damage, &damage, true, NULL, aurEff);*/ } void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1058,12 +941,9 @@ class spell_warr_vigilance_trigger : public SpellScriptLoader void AddSC_warrior_spell_scripts() { new spell_warr_bloodthirst(); - new spell_warr_bloodthirst_heal(); new spell_warr_charge(); new spell_warr_concussion_blow(); - new spell_warr_deep_wounds(); new spell_warr_execute(); - new spell_warr_glyph_of_sunder_armor(); new spell_warr_improved_spell_reflection(); new spell_warr_intimidating_shout(); new spell_warr_lambs_to_the_slaughter(); diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp index 9d2aa868234..c82459d0599 100644 --- a/src/server/scripts/World/action_ip_logger.cpp +++ b/src/server/scripts/World/action_ip_logger.cpp @@ -16,13 +16,10 @@ */ #include "ScriptMgr.h" -#include "Channel.h" -#include "Guild.h" -#include "Group.h" +#include "Player.h" enum IPLoggingTypes { - // AccountActionIpLogger(); ACCOUNT_LOGIN = 0, ACCOUNT_FAIL_LOGIN = 1, diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 17c37c7eba0..3e89041a9e9 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -234,9 +234,12 @@ bool EquippedOk(Player* player, uint32 spellId) if (!spell) return false; - for (uint8 i = 0; i < 3; ++i) + for (SpellEffectInfo const* effect : spell->GetEffectsForDifficulty(DIFFICULTY_NONE)) { - uint32 reqSpell = spell->Effects[i].TriggerSpell; + if (!effect) + continue; + + uint32 reqSpell = effect->TriggerSpell; if (!reqSpell) continue; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 57c0ddf066e..34699c19648 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2159,8 +2159,8 @@ public: const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (spellInfo && spellInfo->Effects[0].Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) - return spellInfo->Effects[0].MiscValue; + if (spellInfo && spellInfo->GetEffect(EFFECT_0)->Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) + return spellInfo->GetEffect(EFFECT_0)->MiscValue; return 0; } |