diff options
Diffstat (limited to 'src')
31 files changed, 1765 insertions, 63 deletions
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index 953c349bad7..66fd60bfcdb 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -26,6 +26,7 @@ class AreaBoundary; class AreaTrigger; +class AuraApplication; class Creature; class DynamicObject; class GameObject; @@ -144,6 +145,12 @@ class TC_GAME_API CreatureAI : public UnitAI // Called when a channeled spell finishes virtual void OnChannelFinished(SpellInfo const* /*spell*/) { } + // Called when aura is applied + virtual void OnAuraApplied(AuraApplication const* /*aurApp*/) { } + + // Called when aura is removed + virtual void OnAuraRemoved(AuraApplication const* /*aurApp*/) { } + // Should return true if the NPC is currently being escorted virtual bool IsEscorted() const { return false; } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index cdc2530617c..c210b7ea582 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -29,6 +29,7 @@ #include "PetDefines.h" #include "Player.h" #include "ScriptMgr.h" +#include "SpellAuras.h" #include "Vehicle.h" #include "WaypointManager.h" @@ -611,6 +612,16 @@ void SmartAI::OnSpellStart(SpellInfo const* spellInfo) GetScript()->ProcessEventsFor(SMART_EVENT_ON_SPELL_START, nullptr, 0, 0, false, spellInfo); } +void SmartAI::OnAuraApplied(AuraApplication const* aurApp) +{ + GetScript()->ProcessEventsFor(SMART_EVENT_ON_AURA_APPLIED, nullptr, 0, 0, false, aurApp->GetBase()->GetSpellInfo()); +} + +void SmartAI::OnAuraRemoved(AuraApplication const* aurApp) +{ + GetScript()->ProcessEventsFor(SMART_EVENT_ON_AURA_REMOVED, nullptr, 0, 0, false, aurApp->GetBase()->GetSpellInfo()); +} + void SmartAI::DamageTaken(Unit* doneBy, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) { GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 0d1054796d2..79ab404e971 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -132,6 +132,12 @@ class TC_GAME_API SmartAI : public CreatureAI // Called when a spell starts void OnSpellStart(SpellInfo const* spellInfo) override; + // Called when aura is applied + void OnAuraApplied(AuraApplication const* aurApp) override; + + // Called when aura is removed + void OnAuraRemoved(AuraApplication const* aurApp) override; + // Called at any Damage from any attacker (before damage apply) void DamageTaken(Unit* doneBy, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e1715f787b6..7eccef96070 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3366,6 +3366,8 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui case SMART_EVENT_ON_SPELL_CAST: case SMART_EVENT_ON_SPELL_FAILED: case SMART_EVENT_ON_SPELL_START: + case SMART_EVENT_ON_AURA_APPLIED: + case SMART_EVENT_ON_AURA_REMOVED: { if (!spell) return; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 82ec392bfdb..7fceb43a614 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -844,6 +844,8 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) case SMART_EVENT_ON_SPELL_CAST: return sizeof(SmartEvent::spellCast); case SMART_EVENT_ON_SPELL_FAILED: return sizeof(SmartEvent::spellCast); case SMART_EVENT_ON_SPELL_START: return sizeof(SmartEvent::spellCast); + case SMART_EVENT_ON_AURA_APPLIED: return sizeof(SmartEvent::spellCast); + case SMART_EVENT_ON_AURA_REMOVED: return sizeof(SmartEvent::spellCast); case SMART_EVENT_ON_DESPAWN: return NO_PARAMS; case SMART_EVENT_SEND_EVENT_TRIGGER: return NO_PARAMS; case SMART_EVENT_AREATRIGGER_EXIT: return NO_PARAMS; @@ -1255,6 +1257,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_ON_SPELL_CAST: case SMART_EVENT_ON_SPELL_FAILED: case SMART_EVENT_ON_SPELL_START: + case SMART_EVENT_ON_AURA_APPLIED: + case SMART_EVENT_ON_AURA_REMOVED: { if (!IsSpellValid(e, e.event.spellCast.spell)) return false; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0c57aaf5415..ea7459ac26f 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -189,8 +189,10 @@ enum SMART_EVENT SMART_EVENT_ON_DESPAWN = 86, // NONE SMART_EVENT_SEND_EVENT_TRIGGER = 87, // NONE SMART_EVENT_AREATRIGGER_EXIT = 88, // NONE + SMART_EVENT_ON_AURA_APPLIED = 89, // SpellID, CooldownMin, CooldownMax + SMART_EVENT_ON_AURA_REMOVED = 90, // SpellID, CooldownMin, CooldownMax - SMART_EVENT_END = 89 + SMART_EVENT_END = 91 }; struct SmartEvent @@ -1608,7 +1610,9 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_ON_SPELL_START, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_ON_DESPAWN, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_SEND_EVENT_TRIGGER, SMART_SCRIPT_TYPE_MASK_EVENT }, - {SMART_EVENT_AREATRIGGER_EXIT, SMART_SCRIPT_TYPE_MASK_AREATRIGGER + SMART_SCRIPT_TYPE_MASK_AREATRIGGER_ENTITY } + {SMART_EVENT_AREATRIGGER_EXIT, SMART_SCRIPT_TYPE_MASK_AREATRIGGER + SMART_SCRIPT_TYPE_MASK_AREATRIGGER_ENTITY }, + {SMART_EVENT_ON_AURA_APPLIED, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_ON_AURA_REMOVED, SMART_SCRIPT_TYPE_MASK_CREATURE }, }; enum SmartEventFlags diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 2739854926b..b6716c248ae 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -32,6 +32,7 @@ #include "Player.h" #include "SharedDefines.h" #include "World.h" +#include "WorldSession.h" bool BattlegroundTemplate::IsArena() const { @@ -64,7 +65,7 @@ uint8 BattlegroundTemplate::GetMaxLevel() const BattlegroundMgr::BattlegroundMgr() : m_NextRatedArenaUpdate(sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)), - m_UpdateTimer(0), m_ArenaTesting(false), m_Testing(false) + m_UpdateTimer(0), m_ArenaTesting(0), m_Testing(false) { } BattlegroundMgr::~BattlegroundMgr() @@ -300,6 +301,15 @@ BattlegroundScriptTemplate const* BattlegroundMgr::FindBattlegroundScriptTemplat return Trinity::Containers::MapGetValuePtr(_battlegroundScriptTemplates, { mapId, BATTLEGROUND_TYPE_NONE }); } +void BattlegroundMgr::QueuePlayerForArena(Player const* player, uint8 teamSize, uint8 roles) +{ + WorldPackets::Battleground::BattlemasterJoinArena packet((WorldPacket(CMSG_BATTLEMASTER_JOIN_ARENA))); + packet.TeamSizeIndex = teamSize; + packet.Roles = roles; + + player->GetSession()->HandleBattlemasterJoinArena(packet); +} + uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id) { if (IsArenaType(bgTypeId)) @@ -507,10 +517,23 @@ void BattlegroundMgr::ToggleTesting() sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF); } -void BattlegroundMgr::ToggleArenaTesting() +bool BattlegroundMgr::ToggleArenaTesting(uint32 battlemasterListId) { - m_ArenaTesting = !m_ArenaTesting; - sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF); + if (battlemasterListId != 0) + { + BattlegroundTemplate const* bgTemplate = GetBattlegroundTemplateByTypeId(static_cast<BattlegroundTypeId>(battlemasterListId)); + if (!bgTemplate) + return false; + + if (!bgTemplate->IsArena()) + return false; + } + + if (m_ArenaTesting != battlemasterListId) + sWorld->SendWorldText((battlemasterListId != 0) ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF); + + m_ArenaTesting = battlemasterListId; + return true; } bool BattlegroundMgr::IsValidQueueId(BattlegroundQueueTypeId bgQueueTypeId) @@ -686,6 +709,9 @@ BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId) { if (BattlegroundTemplate const* bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId)) { + if (bgTemplate->IsArena() && isArenaTesting()) + return static_cast<BattlegroundTypeId>(m_ArenaTesting); + std::vector<BattlegroundTemplate const*> ids; ids.reserve(bgTemplate->MapIDs.size()); for (int32 mapId : bgTemplate->MapIDs) diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index b31b0193af0..8aa341cbca8 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -126,10 +126,11 @@ class TC_GAME_API BattlegroundMgr void ScheduleQueueUpdate(uint32 arenaMatchmakerRating, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundBracketId bracket_id); uint32 GetPrematureFinishTime() const; - void ToggleArenaTesting(); + // Return whether toggling was successful. In case of a non-existing battlemasterListId, or this battlemasterListId is not an arena, this would return false. + bool ToggleArenaTesting(uint32 battlemasterListId); void ToggleTesting(); - bool isArenaTesting() const { return m_ArenaTesting; } + bool isArenaTesting() const { return m_ArenaTesting != 0; } bool isTesting() const { return m_Testing; } static bool IsRandomBattleground(uint32 battlemasterListId); @@ -162,6 +163,8 @@ class TC_GAME_API BattlegroundMgr void LoadBattlegroundScriptTemplate(); BattlegroundScriptTemplate const* FindBattlegroundScriptTemplate(uint32 mapId, BattlegroundTypeId bgTypeId) const; + static void QueuePlayerForArena(Player const* player, uint8 teamSize, uint8 roles); + private: uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id); static bool IsArenaType(BattlegroundTypeId bgTypeId); @@ -185,7 +188,7 @@ class TC_GAME_API BattlegroundMgr std::vector<ScheduledQueueUpdate> m_QueueUpdateScheduler; uint32 m_NextRatedArenaUpdate; uint32 m_UpdateTimer; - bool m_ArenaTesting; + uint32 m_ArenaTesting; bool m_Testing; BattleMastersMap mBattleMastersMap; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 6cf24b10671..b9ff4085f20 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -444,9 +444,6 @@ ObjectGuid::LowType ChatHandler::extractLowGuidFromLink(char* text, HighGuid& gu return player->GetGUID().GetCounter(); ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name); - if (guid.IsEmpty()) - return 0; - return guid.GetCounter(); } case GUID_LINK_CREATURE: diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index fcf78441463..89012688d26 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -103,7 +103,7 @@ char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX_D ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[CONDITION_MAX] = { { .Name = "None", .HasConditionValue1 = false, .HasConditionValue2 = false, .HasConditionValue3 = false, .HasConditionStringValue1 = false }, - { .Name = "Aura", .HasConditionValue1 = true, .HasConditionValue2 = true, .HasConditionValue3 = true, .HasConditionStringValue1 = false }, + { .Name = "Aura", .HasConditionValue1 = true, .HasConditionValue2 = true, .HasConditionValue3 = false, .HasConditionStringValue1 = false }, { .Name = "Item Stored", .HasConditionValue1 = true, .HasConditionValue2 = true, .HasConditionValue3 = true, .HasConditionStringValue1 = false }, { .Name = "Item Equipped", .HasConditionValue1 = true, .HasConditionValue2 = false, .HasConditionValue3 = false, .HasConditionStringValue1 = false }, { .Name = "Zone", .HasConditionValue1 = true, .HasConditionValue2 = false, .HasConditionValue3 = false, .HasConditionStringValue1 = false }, diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 829aa4d4816..1ed4b4d06ca 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -178,7 +178,7 @@ bool AreaTrigger::Create(AreaTriggerCreatePropertiesId areaTriggerCreateProperti SetScaleCurve(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve), 1.0f); - if (caster) + if (caster && spellInfo) { if (Player const* modOwner = caster->GetSpellModOwner()) { @@ -894,6 +894,14 @@ void AreaTrigger::HandleUnitEnter(Unit* unit) DoActions(unit); _ai->OnUnitEnter(unit); + + // OnUnitEnter script can despawn this areatrigger + if (!IsInWorld()) + return; + + // Register areatrigger in Unit after actions/scripts to allow them to determine + // if the unit is in one or more areatriggers with the same id + // without forcing every script to have additional logic excluding this areatrigger unit->EnterAreaTrigger(this); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index c8c75eb8279..0bcdbbd1ec7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5626,8 +5626,8 @@ bool Player::UpdateSkillPro(uint16 skillId, int32 chance, uint32 step) if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED) return false; - uint16 value = m_activePlayerData->Skill->SkillRank[itr->second.pos]; - uint16 max = m_activePlayerData->Skill->SkillMaxRank[itr->second.pos]; + uint16 value = GetSkillRankByPos(itr->second.pos); + uint16 max = GetSkillMaxRankByPos(itr->second.pos); if (!max || !value || value >= max) return false; @@ -5666,13 +5666,13 @@ bool Player::UpdateSkillPro(uint16 skillId, int32 chance, uint32 step) void Player::ModifySkillBonus(uint32 skillid, int32 val, bool talent) { SkillStatusMap::const_iterator itr = mSkillStatus.find(skillid); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return; if (talent) - SetSkillPermBonus(itr->second.pos, m_activePlayerData->Skill->SkillPermBonus[itr->second.pos] + val); + SetSkillPermBonus(itr->second.pos, GetSkillPermBonusByPos(itr->second.pos) + val); else - SetSkillTempBonus(itr->second.pos, m_activePlayerData->Skill->SkillTempBonus[itr->second.pos] + val); + SetSkillTempBonus(itr->second.pos, GetSkillTempBonusByPos(itr->second.pos) + val); // Apply/Remove bonus to child skill lines if (std::vector<SkillLineEntry const*> const* childSkillLines = sDB2Manager.GetSkillLinesForParentSkill(skillid)) @@ -5687,7 +5687,7 @@ void Player::UpdateSkillsForLevel() for (SkillStatusMap::iterator itr = mSkillStatus.begin(); itr != mSkillStatus.end(); ++itr) { - if (itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) continue; uint32 pskill = itr->first; @@ -5706,7 +5706,7 @@ void Player::UpdateSkillsForLevel() } // Update level dependent skillline spells - LearnSkillRewardedSpells(rcEntry->SkillID, m_activePlayerData->Skill->SkillRank[itr->second.pos], race); + LearnSkillRewardedSpells(rcEntry->SkillID, GetSkillRankByPos(itr->second.pos), race); } } @@ -5761,7 +5761,7 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal) // Handle already stored skills if (itr != mSkillStatus.end()) { - currVal = m_activePlayerData->Skill->SkillRank[itr->second.pos]; + currVal = GetSkillRankByPos(itr->second.pos); // Activate and update skill line if (newVal) @@ -5879,7 +5879,7 @@ void Player::SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal) // Find a free skill slot for (uint32 i = 0; i < PLAYER_MAX_SKILLS; ++i) { - if (!m_activePlayerData->Skill->SkillLineID[i]) + if (!GetSkillLineIdByPos(i)) { skillSlot = i; break; @@ -5979,7 +5979,7 @@ bool Player::HasSkill(uint32 skill) const return false; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - return (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED && m_activePlayerData->Skill->SkillRank[itr->second.pos]); + return itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED && GetSkillRankByPos(itr->second.pos); } uint16 Player::GetSkillStep(uint32 skill) const @@ -5988,10 +5988,10 @@ uint16 Player::GetSkillStep(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - return m_activePlayerData->Skill->SkillStep[itr->second.pos]; + return GetSkillStepByPos(itr->second.pos); } uint16 Player::GetSkillValue(uint32 skill) const @@ -6000,12 +6000,12 @@ uint16 Player::GetSkillValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - int32 result = int32(m_activePlayerData->Skill->SkillRank[itr->second.pos]); - result += int32(m_activePlayerData->Skill->SkillTempBonus[itr->second.pos]); - result += int32(m_activePlayerData->Skill->SkillPermBonus[itr->second.pos]); + int32 result = int32(GetSkillRankByPos(itr->second.pos)); + result += int32(GetSkillTempBonusByPos(itr->second.pos)); + result += int32(GetSkillPermBonusByPos(itr->second.pos)); return result < 0 ? 0 : result; } @@ -6015,12 +6015,12 @@ uint16 Player::GetMaxSkillValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - int32 result = int32(m_activePlayerData->Skill->SkillMaxRank[itr->second.pos]); - result += int32(m_activePlayerData->Skill->SkillTempBonus[itr->second.pos]); - result += int32(m_activePlayerData->Skill->SkillPermBonus[itr->second.pos]); + int32 result = int32(GetSkillMaxRankByPos(itr->second.pos)); + result += int32(GetSkillTempBonusByPos(itr->second.pos)); + result += int32(GetSkillPermBonusByPos(itr->second.pos)); return result < 0 ? 0 : result; } @@ -6030,10 +6030,10 @@ uint16 Player::GetPureMaxSkillValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - return m_activePlayerData->Skill->SkillMaxRank[itr->second.pos]; + return GetSkillMaxRankByPos(itr->second.pos); } uint16 Player::GetBaseSkillValue(uint32 skill) const @@ -6042,11 +6042,11 @@ uint16 Player::GetBaseSkillValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - int32 result = int32(m_activePlayerData->Skill->SkillRank[itr->second.pos]); - result += int32(m_activePlayerData->Skill->SkillPermBonus[itr->second.pos]); + int32 result = int32(GetSkillRankByPos(itr->second.pos)); + result += int32(GetSkillPermBonusByPos(itr->second.pos)); return result < 0 ? 0 : result; } @@ -6056,10 +6056,10 @@ uint16 Player::GetPureSkillValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - return m_activePlayerData->Skill->SkillRank[itr->second.pos]; + return GetSkillRankByPos(itr->second.pos); } int16 Player::GetSkillPermBonusValue(uint32 skill) const @@ -6068,10 +6068,10 @@ int16 Player::GetSkillPermBonusValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - return m_activePlayerData->Skill->SkillPermBonus[itr->second.pos]; + return GetSkillPermBonusByPos(itr->second.pos); } int16 Player::GetSkillTempBonusValue(uint32 skill) const @@ -6080,10 +6080,10 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const return 0; SkillStatusMap::const_iterator itr = mSkillStatus.find(skill); - if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !m_activePlayerData->Skill->SkillRank[itr->second.pos]) + if (itr == mSkillStatus.end() || itr->second.uState == SKILL_DELETED || !GetSkillRankByPos(itr->second.pos)) return 0; - return m_activePlayerData->Skill->SkillTempBonus[itr->second.pos]; + return GetSkillTempBonusByPos(itr->second.pos); } void Player::SendActionButtons(uint32 state) const @@ -21205,8 +21205,8 @@ void Player::_SaveSkills(CharacterDatabaseTransaction trans) continue; } - uint16 value = m_activePlayerData->Skill->SkillRank[itr->second.pos]; - uint16 max = m_activePlayerData->Skill->SkillMaxRank[itr->second.pos]; + uint16 value = GetSkillRankByPos(itr->second.pos); + uint16 max = GetSkillMaxRankByPos(itr->second.pos); int8 professionSlot = int8(GetProfessionSlotFor(itr->first)); switch (itr->second.uState) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 51c91183d20..2b615518381 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2310,12 +2310,19 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player> void LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue, Races race); int32 GetProfessionSlotFor(uint32 skillId) const; int32 FindEmptyProfessionSlotFor(uint32 skillId) const; + uint16 GetSkillLineIdByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillLineID[pos]; } void SetSkillLineId(uint32 pos, uint16 skillLineId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillLineID, pos), skillLineId); } - void SetSkillStep(uint32 pos, uint16 step) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillStep, pos), step); }; + uint16 GetSkillStepByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillStep[pos]; } + void SetSkillStep(uint32 pos, uint16 step) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillStep, pos), step); } + uint16 GetSkillRankByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillRank[pos]; } void SetSkillRank(uint32 pos, uint16 rank) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillRank, pos), rank); } + uint16 GetSkillStartingRankByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillStartingRank[pos]; } void SetSkillStartingRank(uint32 pos, uint16 starting) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillStartingRank, pos), starting); } + uint16 GetSkillMaxRankByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillMaxRank[pos]; } void SetSkillMaxRank(uint32 pos, uint16 max) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillMaxRank, pos), max); } + int16 GetSkillTempBonusByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillTempBonus[pos]; } void SetSkillTempBonus(uint32 pos, uint16 bonus) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillTempBonus, pos), bonus); } + uint16 GetSkillPermBonusByPos(uint32 pos) const { return m_activePlayerData->Skill->SkillPermBonus[pos]; } void SetSkillPermBonus(uint32 pos, uint16 bonus) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Skill).ModifyValue(&UF::SkillInfo::SkillPermBonus, pos), bonus); } TeleportLocation& GetTeleportDest() { return m_teleport_dest; } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index aa504001619..36246c0c1a8 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -237,7 +237,7 @@ void Group::LoadGroupFromDB(Field* fields) m_raidDifficulty = Player::CheckLoadedRaidDifficultyID(Difficulty(fields[14].GetUInt8())); m_legacyRaidDifficulty = Player::CheckLoadedLegacyRaidDifficultyID(Difficulty(fields[15].GetUInt8())); - m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[16].GetUInt64()); + m_masterLooterGuid = fields[16].GetUInt64() ? ObjectGuid::Create<HighGuid::Player>(fields[16].GetUInt64()) : ObjectGuid::Empty; m_pingRestriction = RestrictPingsTo(fields[18].GetInt8()); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 8fb5a150793..e78a52042b9 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -540,9 +540,16 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPackets::Battleground::Battl return; Group* grp = _player->GetGroup(); + if (!grp) + { + grp = new Group(); + grp->Create(_player); + } + // no group found, error if (!grp) return; + if (grp->GetLeaderGUID() != _player->GetGUID()) return; @@ -559,7 +566,10 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPackets::Battleground::Battl GroupQueueInfo* ginfo = nullptr; ObjectGuid errorGuid; - GroupJoinBattlegroundResult err = grp->CanJoinBattlegroundQueue(bgTemplate, bgQueueTypeId, arenatype, arenatype, true, packet.TeamSizeIndex, errorGuid); + GroupJoinBattlegroundResult err = ERR_BATTLEGROUND_NONE; + if (!sBattlegroundMgr->isArenaTesting()) + err = grp->CanJoinBattlegroundQueue(bgTemplate, bgQueueTypeId, arenatype, arenatype, true, packet.TeamSizeIndex, errorGuid); + if (!err) { TC_LOG_DEBUG("bg.battleground", "Battleground: arena team id {}, leader {} queued with matchmaker rating {} for type {}", _player->GetArenaTeamId(packet.TeamSizeIndex), _player->GetName(), matchmakerRating, arenatype); diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp index 299fef61b80..745783a536a 100644 --- a/src/server/game/Maps/MapScripts.cpp +++ b/src/server/game/Maps/MapScripts.cpp @@ -325,7 +325,7 @@ void Map::ScriptsProcess() { switch (step.sourceGUID.GetHigh()) { - case HighGuid::Item: // as well as HIGHGUID_CONTAINER + case HighGuid::Item: if (Player* player = GetPlayer(step.ownerGUID)) source = player->GetItemByGuid(step.sourceGUID); break; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 3d9100457c0..248fd007871 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -19,6 +19,7 @@ #include "CellImpl.h" #include "Common.h" #include "Containers.h" +#include "CreatureAI.h" #include "DynamicObject.h" #include "GridNotifiersImpl.h" #include "Item.h" @@ -1593,6 +1594,19 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b } break; } + + if (apply) + { + if (Creature* creature = target->ToCreature()) + if (CreatureAI* ai = creature->AI()) + ai->OnAuraApplied(aurApp); + } + else + { + if (Creature* creature = target->ToCreature()) + if (CreatureAI* ai = creature->AI()) + ai->OnAuraRemoved(aurApp); + } } bool Aura::CanBeAppliedOn(Unit* target) diff --git a/src/server/scripts/Battlegrounds/CageOfCarnage/arena_cage_of_carnage.cpp b/src/server/scripts/Battlegrounds/CageOfCarnage/arena_cage_of_carnage.cpp new file mode 100644 index 00000000000..8ef5d8903a0 --- /dev/null +++ b/src/server/scripts/Battlegrounds/CageOfCarnage/arena_cage_of_carnage.cpp @@ -0,0 +1,332 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Battleground.h" +#include "BattlegroundScript.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "Map.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "TaskScheduler.h" + +namespace CageOfCarnage +{ + namespace Actions + { + static constexpr uint32 ReactionTrigger = 1; + static constexpr uint32 ReactionDead = 2; + } + + namespace Creatures + { + static constexpr uint32 NaminzeBoltfingers = 232750; + } + + namespace GameObjects + { + static constexpr uint32 GoblinArenaTrapDoor01 = 505683; + } + + namespace MapIds + { + static constexpr uint32 CageOfCarnage = 2759; + } + + namespace Positions + { + static constexpr Position PurpleWarningTeleport = { 442.311f, 343.167f, -34.1166f, 1.7453293f }; + static constexpr Position GoldWarningTeleport = { 443.167f, 439.243f, -42.6562f, 4.5902157f }; + } + + namespace Spells + { + static constexpr uint32 UndermineArenaVOCooldownAura = 472905; + static constexpr uint32 UndermineArenaVOCooldownAuraPlayerDeath = 472913; + static constexpr uint32 UndermineArenaReactionTrigger = 472885; + static constexpr uint32 ArenaLowHealthCooldownAura = 234031; + static constexpr uint32 Warning = 1214676; + static constexpr uint32 WarningTeleport = 371319; + static constexpr uint32 ArenaStartingAreaMarker = 228212; + } + + namespace Texts + { + namespace Naminze + { + static constexpr uint8 Prepare = 0; + static constexpr uint8 Start = 1; + static constexpr uint8 ReactionAlmostDead = 2; + static constexpr uint8 ReactionKill = 3; + } + } +} + +struct arena_cage_of_carnage : ArenaScript +{ + explicit arena_cage_of_carnage(BattlegroundMap* map) : ArenaScript(map) { } + + void OnUpdate(uint32 diff) override + { + _scheduler.Update(diff); + } + + void OnStart() override + { + for (ObjectGuid const& guid : _doorGUIDs) + { + if (GameObject* door = battlegroundMap->GetGameObject(guid)) + { + door->UseDoorOrButton(); + door->DespawnOrUnsummon(5s); + } + } + + if (Creature const* creature = battlegroundMap->GetCreature(_naminzeGUID)) + creature->AI()->Talk(CageOfCarnage::Texts::Naminze::Start); + + _scheduler.Schedule(5s, [&](TaskContext context) + { + battlegroundMap->DoOnPlayers([&](Player* player) + { + if (!player->HasAura(CageOfCarnage::Spells::ArenaStartingAreaMarker)) + return; + + if (player->HasAura(CageOfCarnage::Spells::Warning)) + return; + + player->CastSpell(nullptr, CageOfCarnage::Spells::Warning, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + }); + + context.Repeat(); + }); + } + + void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override + { + switch (actionId) + { + case CageOfCarnage::Actions::ReactionTrigger: + HandleReactionLowHealth(Object::ToPlayer(source)); + break; + case CageOfCarnage::Actions::ReactionDead: + HandleKill(Object::ToPlayer(target)); + break; + default: + break; + } + } + + void OnPrepareStage2() override + { + if (Creature const* creature = battlegroundMap->GetCreature(_naminzeGUID)) + creature->AI()->Talk(CageOfCarnage::Texts::Naminze::Prepare); + } + + void OnCreatureCreate(Creature* creature) override + { + switch (creature->GetEntry()) + { + case CageOfCarnage::Creatures::NaminzeBoltfingers: + _naminzeGUID = creature->GetGUID(); + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* gameobject) override + { + switch (gameobject->GetEntry()) + { + case CageOfCarnage::GameObjects::GoblinArenaTrapDoor01: + _doorGUIDs.emplace_back(gameobject->GetGUID()); + break; + default: + break; + } + } + + void OnPlayerJoined(Player* player, bool /*inBattleground*/) override + { + player->CastSpell(nullptr, CageOfCarnage::Spells::UndermineArenaReactionTrigger, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + void HandleKill(Player const* victim) const + { + if (!victim) + return; + + if (Creature* creature = battlegroundMap->GetCreature(_naminzeGUID)) + { + if (creature->HasAura(CageOfCarnage::Spells::UndermineArenaVOCooldownAuraPlayerDeath)) + return; + + creature->AI()->Talk(CageOfCarnage::Texts::Naminze::ReactionKill, victim); + + creature->CastSpell(nullptr, CageOfCarnage::Spells::UndermineArenaVOCooldownAuraPlayerDeath, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + } + + void HandleReactionLowHealth(Player const* victim) const + { + if (!victim) + return; + + if (Creature* creature = battlegroundMap->GetCreature(_naminzeGUID)) + { + if (creature->HasAura(CageOfCarnage::Spells::UndermineArenaVOCooldownAura)) + return; + + creature->AI()->Talk(CageOfCarnage::Texts::Naminze::ReactionAlmostDead, victim); + + creature->CastSpell(nullptr, CageOfCarnage::Spells::UndermineArenaVOCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + } + +private: + GuidVector _doorGUIDs; + ObjectGuid _naminzeGUID; + + TaskScheduler _scheduler; +}; + +// 472883 - Undermine Arena Reaction Trigger - Low Health +class spell_undermine_arena_reaction_trigger_low_health : public SpellScript +{ + bool Load() override + { + return GetCaster()->GetMapId() == CageOfCarnage::MapIds::CageOfCarnage; + } + + void HandleHit(SpellEffIndex /*effIndex*/) const + { + Unit* target = GetHitUnit(); + if (target->HasAura(CageOfCarnage::Spells::ArenaLowHealthCooldownAura)) + return; + + target->CastSpell(nullptr, CageOfCarnage::Spells::ArenaLowHealthCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + + if (ZoneScript* zoneScript = target->FindZoneScript()) + zoneScript->DoAction(CageOfCarnage::Actions::ReactionTrigger, GetCaster(), target); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_undermine_arena_reaction_trigger_low_health::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 472885 - Undermine Arena Reaction Trigger +class spell_undermine_arena_reaction_trigger : public AuraScript +{ + bool Load() override + { + return GetOwner()->GetMapId() == CageOfCarnage::MapIds::CageOfCarnage; + } + + void HandleProc(ProcEventInfo const& eventInfo) const + { + if (ZoneScript* zonescript = GetTarget()->FindZoneScript()) + zonescript->DoAction(CageOfCarnage::Actions::ReactionDead, eventInfo.GetActor(), eventInfo.GetProcTarget()); + } + + void Register() override + { + OnProc += AuraProcFn(spell_undermine_arena_reaction_trigger::HandleProc); + } +}; + +// 1214676 - Warning (countdown) +class spell_undermine_arena_warning_countdown : public AuraScript +{ + bool Load() override + { + return GetOwner()->GetMapId() == CageOfCarnage::MapIds::CageOfCarnage; + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ CageOfCarnage::Spells::WarningTeleport }); + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Player* target= GetTarget()->ToPlayer(); + if (!target) + return; + + if (!target->HasAura(CageOfCarnage::Spells::ArenaStartingAreaMarker)) + return; + + target->CastSpell(nullptr, CageOfCarnage::Spells::WarningTeleport, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_undermine_arena_warning_countdown::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 371319 - Warning Teleport +class spell_undermine_arena_warning_teleport : public SpellScript +{ + bool Load() override + { + return GetCaster()->GetMapId() == CageOfCarnage::MapIds::CageOfCarnage; + } + + void HandleTeleport(SpellEffIndex /*effIndex*/) const + { + Player* target = GetHitPlayer(); + if (!target) + return; + + if (target->GetBGTeam() == ALLIANCE) + target->NearTeleportTo(CageOfCarnage::Positions::PurpleWarningTeleport); + else + target->NearTeleportTo(CageOfCarnage::Positions::GoldWarningTeleport); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_undermine_arena_warning_teleport::HandleTeleport, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +void AddSC_arena_cage_of_carnage() +{ + RegisterBattlegroundMapScript(arena_cage_of_carnage, CageOfCarnage::MapIds::CageOfCarnage); + RegisterSpellScript(spell_undermine_arena_reaction_trigger_low_health); + RegisterSpellScript(spell_undermine_arena_reaction_trigger); + RegisterSpellScript(spell_undermine_arena_warning_countdown); + RegisterSpellScript(spell_undermine_arena_warning_teleport); +} diff --git a/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp b/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp new file mode 100644 index 00000000000..643f582e3fa --- /dev/null +++ b/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp @@ -0,0 +1,125 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Battleground.h" +#include "BattlegroundScript.h" +#include "Creature.h" +#include "GameObject.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ScriptMgr.h" + +namespace MaldraxxusColiseum +{ + namespace MapIds + { + static constexpr uint32 MaldraxxusColiseum = 2509; + } + + namespace Creatures + { + static constexpr uint32 MaldraxxianGladiator = 185764; + } + + namespace GameObjects + { + static constexpr uint32 Door = 375890; + } + + namespace Destinations + { + static constexpr Position Guard1 = { 2875.89f, 2285.57f, 3260.1755f }; + static constexpr Position Guard2 = { 2816.69f, 2300.51f, 3260.1885f }; + static constexpr Position Guard3 = { 2873.62f, 2219.39f, 3260.7085f }; + static constexpr Position Guard4 = { 2823.31f, 2204.30f, 3260.0960f }; + } + + namespace StringIds + { + static constexpr std::string_view Guard1 = "arena_maldraxxus_coliseum_1"; + static constexpr std::string_view Guard2 = "arena_maldraxxus_coliseum_2"; + static constexpr std::string_view Guard3 = "arena_maldraxxus_coliseum_3"; + static constexpr std::string_view Guard4 = "arena_maldraxxus_coliseum_4"; + } +} + +struct arena_maldraxxus_coliseum : ArenaScript +{ + explicit arena_maldraxxus_coliseum(BattlegroundMap* map) : ArenaScript(map) { } + + void OnStart() override + { + for (ObjectGuid const& guid : _doorGUIDs) + { + if (GameObject* door = battlegroundMap->GetGameObject(guid)) + { + door->UseDoorOrButton(); + door->DespawnOrUnsummon(5s); + } + } + + for (ObjectGuid const& guid : _gladiatorGUIDs) + { + if (Creature* creature = battlegroundMap->GetCreature(guid)) + { + if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard1)) + creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard1); + else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard2)) + creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard2); + else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard3)) + creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard3); + else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard4)) + creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard4); + + creature->DespawnOrUnsummon(2s); + } + } + } + + void OnCreatureCreate(Creature* creature) override + { + switch (creature->GetEntry()) + { + case MaldraxxusColiseum::Creatures::MaldraxxianGladiator: + _gladiatorGUIDs.emplace_back(creature->GetGUID()); + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* gameobject) override + { + switch (gameobject->GetEntry()) + { + case MaldraxxusColiseum::GameObjects::Door: + _doorGUIDs.emplace_back(gameobject->GetGUID()); + break; + default: + break; + } + } + +private: + GuidVector _doorGUIDs; + GuidVector _gladiatorGUIDs; +}; + +void AddSC_arena_maldraxxus_coliseum() +{ + RegisterBattlegroundMapScript(arena_maldraxxus_coliseum, MaldraxxusColiseum::MapIds::MaldraxxusColiseum); +} diff --git a/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp b/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp new file mode 100644 index 00000000000..b7e00b73969 --- /dev/null +++ b/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp @@ -0,0 +1,136 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Battleground.h" +#include "BattlegroundScript.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "Map.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "TaskScheduler.h" + +namespace TheRobodrome +{ + namespace MapIds + { + static constexpr uint32 TheRobodrome = 2167; + } + + namespace Creatures + { + static constexpr uint32 PowerCoil = 154593; + } + + namespace GameObjects + { + static constexpr uint32 Door01 = 329742; + static constexpr uint32 Door02 = 329743; + } + + namespace Spells + { + static constexpr uint32 Zap = 300642; + } +} + +struct arena_the_robodrome : ArenaScript +{ + explicit arena_the_robodrome(BattlegroundMap* map) : ArenaScript(map) { } + + void OnUpdate(uint32 diff) override + { + _scheduler.Update(diff); + } + + void OnStart() override + { + for (ObjectGuid const& guid : _doorGUIDs) + { + if (GameObject* door = battlegroundMap->GetGameObject(guid)) + { + door->UseDoorOrButton(); + door->DespawnOrUnsummon(5s); + } + } + + _scheduler.Schedule(5s, [&](TaskContext context) + { + for (ObjectGuid const& guid : _powerCoilGUIDs) + if (Creature* coil = battlegroundMap->GetCreature(guid)) + coil->CastSpell(nullptr, TheRobodrome::Spells::Zap); + + context.Repeat(); + }); + } + + void OnGameObjectCreate(GameObject* gameobject) override + { + switch (gameobject->GetEntry()) + { + case TheRobodrome::GameObjects::Door01: + case TheRobodrome::GameObjects::Door02: + _doorGUIDs.emplace_back(gameobject->GetGUID()); + break; + default: + break; + } + } + + void OnCreatureCreate(Creature* creature) override + { + switch (creature->GetEntry()) + { + case TheRobodrome::Creatures::PowerCoil: + _powerCoilGUIDs.emplace_back(creature->GetGUID()); + break; + default: + break; + } + } + +private: + GuidVector _doorGUIDs; + GuidVector _powerCoilGUIDs; + + TaskScheduler _scheduler; +}; + +// 300642 - Zap (Damage mod) +class spell_the_robodrome_zap_damage : public SpellScript +{ + void HandleHitTarget(SpellEffIndex /*effIndex*/) + { + uint32 basePct = 16; + uint32 stackCount = GetHitUnit()->GetAuraCount(TheRobodrome::Spells::Zap); + + SetEffectValue(basePct + basePct * stackCount); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_the_robodrome_zap_damage::HandleHitTarget, EFFECT_2, SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT); + } +}; + +void AddSC_arena_the_robodrome() +{ + RegisterBattlegroundMapScript(arena_the_robodrome, TheRobodrome::MapIds::TheRobodrome); + RegisterSpellScript(spell_the_robodrome_zap_damage); +} diff --git a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp index 65f831fae9e..c2c3d8b3439 100644 --- a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp +++ b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp @@ -66,6 +66,11 @@ void AddSC_battleground_deephaul_ravine(); void AddSC_arena_blades_edge_legion(); void AddSC_arena_mugambala(); +void AddSC_arena_the_robodrome(); + +void AddSC_arena_maldraxxus_coliseum(); + +void AddSC_arena_cage_of_carnage(); // The name of this function should match: // void Add${NameOfDirectory}Scripts() @@ -118,4 +123,9 @@ void AddBattlegroundsScripts() AddSC_arena_blades_edge_legion(); AddSC_arena_mugambala(); + AddSC_arena_the_robodrome(); + + AddSC_arena_maldraxxus_coliseum(); + + AddSC_arena_cage_of_carnage(); } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 68020eb435d..3785f81f70a 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -39,6 +39,7 @@ EndScriptData */ #include "GridNotifiersImpl.h" #include "InstanceScript.h" #include "Language.h" +#include "LFG.h" #include "Log.h" #include "M2Stores.h" #include "MapManager.h" @@ -856,9 +857,20 @@ public: return true; } - static bool HandleDebugArenaCommand(ChatHandler* /*handler*/) + static bool HandleDebugArenaCommand(ChatHandler* handler, uint32 battlemasterListId) { - sBattlegroundMgr->ToggleArenaTesting(); + bool successful = sBattlegroundMgr->ToggleArenaTesting(battlemasterListId); + if (!successful) + { + handler->PSendSysMessage("BattlemasterListId %u does not exist or is not an arena.", battlemasterListId); + handler->SetSentErrorMessage(true); + return true; + } + + if (!battlemasterListId || !handler || !handler->GetSession()) + return true; + + BattlegroundMgr::QueuePlayerForArena(handler->GetSession()->GetPlayer(), 0, lfg::PLAYER_ROLE_DAMAGE); return true; } diff --git a/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp b/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp new file mode 100644 index 00000000000..a249d16a0f5 --- /dev/null +++ b/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp @@ -0,0 +1,176 @@ +/* +* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "ScriptMgr.h" +#include "CreatureAIImpl.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "PhasingHandler.h" +#include "ScriptedCreature.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "TemporarySummon.h" + +namespace Scripts::EasternKingdoms::Gilneas::Chapter1 +{ + namespace Creatures + { + static constexpr uint32 EvacuationStalkerFirst = 35830; + static constexpr uint32 EvacuationStalkerNear = 35010; + static constexpr uint32 EvacuationStalkerFar = 35011; + } + + namespace Events + { + namespace EvacuateTheMerchantSquare + { + static constexpr uint32 TalkFrightened = 1; + static constexpr uint32 MoveToNearStalker = 2; + static constexpr uint32 MoveToFarStalker = 3; + static constexpr uint32 FrightenedDespawn = 4; + } + } + + namespace Texts + { + namespace FrightenedCitizen + { + static constexpr uint32 SayFrightenedCitizenRescue = 0; + } + } + + namespace Points + { + static constexpr uint32 PointStalkerFirst = 1; + static constexpr uint32 PointStalkerNear = 2; + static constexpr uint32 PointStalkerFar = 3; + } + +// 34981 - Frightened Citizen +// 35836 - Frightened Citizen +struct npc_frightened_citizen : public ScriptedAI +{ + npc_frightened_citizen(Creature* creature) : ScriptedAI(creature) {} + + void IsSummonedBy(WorldObject* /*summoner*/) override + { + me->SetReactState(REACT_PASSIVE); + + if (Creature* stalkerNear = me->FindNearestCreature(Creatures::EvacuationStalkerFirst, 20.0f)) + me->GetMotionMaster()->MovePoint(Points::PointStalkerFirst, stalkerNear->GetPosition(), true); + } + + void MovementInform(uint32 type, uint32 id) override + { + if (type != POINT_MOTION_TYPE) + return; + + switch (id) + { + case Points::PointStalkerFirst: + _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::TalkFrightened, 1s); + break; + case Points::PointStalkerNear: + _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::MoveToFarStalker, 1ms); + break; + case Points::PointStalkerFar: + _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::FrightenedDespawn, 1ms); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case Events::EvacuateTheMerchantSquare::TalkFrightened: + if (TempSummon* summon = me->ToTempSummon()) + { + if (Unit* summoner = summon->GetSummonerUnit()) + { + if (Player* player = summoner->ToPlayer()) + { + player->KilledMonsterCredit(Creatures::EvacuationStalkerFirst); + Talk(Texts::FrightenedCitizen::SayFrightenedCitizenRescue, summoner); + } + } + } + _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::MoveToNearStalker, 2s); + break; + case Events::EvacuateTheMerchantSquare::MoveToNearStalker: + if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerFar, 50.0f)) + me->GetMotionMaster()->MovePoint(Points::PointStalkerFar, stalker->GetPosition(), true); + else if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerNear, 100.0f)) + me->GetMotionMaster()->MovePoint(Points::PointStalkerNear, stalker->GetPosition(), true); + break; + case Events::EvacuateTheMerchantSquare::MoveToFarStalker: + if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerFar, 500.0f)) + me->GetMotionMaster()->MovePoint(Points::PointStalkerFar, stalker->GetPosition(), true); + break; + case Events::EvacuateTheMerchantSquare::FrightenedDespawn: + me->DespawnOrUnsummon(); + break; + default: + break; + } + } + } +private: + EventMap _events; +}; + +// 67869 - Knocking +class spell_gilneas_knocking : public SpellScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo( + { + uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()), + uint32(spellInfo->GetEffect(EFFECT_2).CalcValue()) + }); + } + + void HandleEffect() + { + GetCaster()->CastSpell(GetCaster(), GetEffectInfo(RAND(EFFECT_1, EFFECT_2)).CalcValue(), true); + } + + void Register() override + { + OnCast += SpellCastFn(spell_gilneas_knocking::HandleEffect); + } +}; +} + +void AddSC_gilneas_chapter_1() +{ + using namespace Scripts::EasternKingdoms::Gilneas::Chapter1; + + // Creatures + RegisterCreatureAI(npc_frightened_citizen); + + // Spells + RegisterSpellScript(spell_gilneas_knocking); +} diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp index 283eed704a0..13f41362243 100644 --- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp @@ -65,6 +65,7 @@ void AddSC_boss_chromaggus(); void AddSC_boss_nefarian(); void AddSC_instance_blackwing_lair(); void AddSC_instance_deadmines(); //Deadmines +void AddSC_gilneas_chapter_1(); //Gilneas void AddSC_gnomeregan(); //Gnomeregan void AddSC_instance_gnomeregan(); void AddSC_instance_grim_batol(); //Grim Batol @@ -264,6 +265,7 @@ void AddEasternKingdomsScripts() AddSC_boss_nefarian(); AddSC_instance_blackwing_lair(); AddSC_instance_deadmines(); //Deadmines + AddSC_gilneas_chapter_1(); //Gilneas AddSC_gnomeregan(); //Gnomeregan AddSC_instance_gnomeregan(); AddSC_instance_grim_batol(); //Grim Batol diff --git a/src/server/scripts/EasternKingdoms/zone_westfall.cpp b/src/server/scripts/EasternKingdoms/zone_westfall.cpp index 17b5a2de406..60162630e80 100644 --- a/src/server/scripts/EasternKingdoms/zone_westfall.cpp +++ b/src/server/scripts/EasternKingdoms/zone_westfall.cpp @@ -15,11 +15,45 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "CombatAI.h" #include "Containers.h" +#include "CreatureAIImpl.h" +#include "Player.h" #include "ScriptedCreature.h" #include "ScriptMgr.h" +#include "SpellAuraEffects.h" #include "SpellScript.h" +namespace Scripts::EasternKingdoms::Westfall +{ +namespace Creatures +{ + static constexpr uint32 EnergizedHarvestReaper = 42342; + static constexpr uint32 OverloadedHarvestGolem = 42601; +} + +namespace Events +{ + namespace ItsAlive + { + static constexpr uint32 CheckArea = 1; + static constexpr uint32 DespawnHarvester = 2; + } +} + +namespace Text +{ + namespace HarvestGolem + { + static constexpr uint32 AnnounceOutOfArea = 0; + } +} + +namespace Area +{ + static constexpr uint32 TheMoestFarm = 918; +} + // 79084 - Unbound Energy class spell_westfall_unbound_energy : public SpellScript { @@ -44,7 +78,121 @@ class spell_westfall_unbound_energy : public SpellScript } }; +// 42601 - Overloaded Harvest Golem +struct npc_westfall_overloaded_harvest_golem : public ScriptedAI +{ + npc_westfall_overloaded_harvest_golem(Creature* creature) : ScriptedAI(creature) {} + + void JustAppeared() override + { + _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s); + } + + void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) override + { + if (!apply) + me->DespawnOrUnsummon(); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case Events::ItsAlive::CheckArea: + if (me->GetAreaId() != Area::TheMoestFarm) + { + if (Unit* owner = me->GetCharmerOrOwner()) + Talk(Text::HarvestGolem::AnnounceOutOfArea, owner); + _events.ScheduleEvent(Events::ItsAlive::DespawnHarvester, 8s); + } + else + _events.Repeat(1s); + break; + case Events::ItsAlive::DespawnHarvester: + if (me->GetAreaId() != Area::TheMoestFarm) + me->DespawnOrUnsummon(); + else + _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s); + break; + default: + break; + } + } + } + +private: + EventMap _events; +}; + +// 79425 - Reaping Blows +class spell_westfall_reaping_blows : public AuraScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }) && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_1).TriggerSpell) }); + } + + void HandlePeriodic(AuraEffect const* /*aurEff*/) + { + // HACK + // periodic ticks are forcing to cast the spell onto himself instead of target + // ref AuraEffect::HandlePeriodicTriggerSpellAuraTick + PreventDefaultAction(); + if (Creature* reaper = GetTarget()->FindNearestCreature(Creatures::EnergizedHarvestReaper, 5.f, true)) + GetTarget()->CastSpell(reaper, GetSpellInfo()->GetEffect(EFFECT_1).TriggerSpell, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_westfall_reaping_blows::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } +}; + +// 79436 - Wake Harvest Golem +class spell_westfall_wake_harvest_golem : public SpellScript +{ + SpellCastResult CheckTarget() + { + Unit* target = GetExplTargetUnit(); + if (!target || !target->IsCreature()) + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster || !caster->IsPlayer()) + return; + + if (Creature* target = GetHitCreature()) + { + caster->ToPlayer()->KilledMonsterCredit(Creatures::OverloadedHarvestGolem); + target->DespawnOrUnsummon(100ms); + } + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_westfall_wake_harvest_golem::CheckTarget); + OnEffectHitTarget += SpellEffectFn(spell_westfall_wake_harvest_golem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; +} + void AddSC_westfall() { + using namespace Scripts::EasternKingdoms::Westfall; + + // Creature + RegisterCreatureAI(npc_westfall_overloaded_harvest_golem); + + // Spells RegisterSpellScript(spell_westfall_unbound_energy); + RegisterSpellScript(spell_westfall_reaping_blows); + RegisterSpellScript(spell_westfall_wake_harvest_golem); } diff --git a/src/server/scripts/KhazAlgar/CityOfThreads/boss_orator_krix_vizk.cpp b/src/server/scripts/KhazAlgar/CityOfThreads/boss_orator_krix_vizk.cpp new file mode 100644 index 00000000000..fb7129faf17 --- /dev/null +++ b/src/server/scripts/KhazAlgar/CityOfThreads/boss_orator_krix_vizk.cpp @@ -0,0 +1,525 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "AreaTrigger.h" +#include "AreaTriggerAI.h" +#include "CellImpl.h" +#include "Conversation.h" +#include "Creature.h" +#include "GridNotifiersImpl.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "PathGenerator.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" +#include "SpellScript.h" +#include "city_of_threads.h" + +enum OratorKrixVizkSpells +{ + SPELL_ORATION = 454689, + SPELL_CHAINS_OF_OPPRESSION = 434691, + SPELL_CHAINS_OF_OPPRESSION_PERIODIC = 440310, + SPELL_CHAINS_OF_OPPRESSION_CHARGE = 434712, + SPELL_CHAINS_OF_OPPRESSION_DAMAGE = 434710, + SPELL_SUBJUGATE = 434722, + SPELL_TERRORIZE_SELECTOR = 434808, + SPELL_TERRORIZE = 434779, + SPELL_SHADOWS_OF_DOUBT_SELECTOR = 448560, + SPELL_SHADOWS_OF_DOUBT = 448561, + SPELL_DOUBT = 448562, + SPELL_VOCIFEROUS_INDOCTRINATION = 434829, + SPELL_VOCIFEROUS_INDOCTRINATION_DAMAGE = 434832, + SPELL_LINGERING_INFLUENCE_AREATRIGGER = 434923, + SPELL_LINGERING_INFLUENCE_DAMAGE = 434926 +}; + +enum OratorKrixVizkConversations +{ + CONVERSATION_ORATOR_INTRO_1 = 24642, + CONVERSATION_ORATOR_INTRO_2 = 24643, + CONVERSATION_ORATOR_INTRO_3 = 24644 +}; + +enum OratorKrixVizkTexts +{ + SAY_AGGRO = 0, + SAY_SUBJUGATE = 1, + SAY_TERRORIZE = 2, + SAY_VOCIFEROUS_INDOCTRINATION = 3, + SAY_KILL = 4, + SAY_DEATH = 5 +}; + +enum OratorKrixVizkEvents +{ + EVENT_SUBJUGATE = 1, + EVENT_TERRORIZE, + EVENT_SHADOWS_OF_DOUBT, + EVENT_ENERGIZE +}; + +enum OratorKrixVizkMisc +{ + AREATRIGGER_BARRIER = 35803, + DISPLAY_POWERID = 527 +}; + +// 163 +// 164 +template<uint32 conversationEntry, uint32 data> +struct at_orator_conversation_intro : AreaTriggerAI +{ + at_orator_conversation_intro(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + InstanceScript* instance = at->GetInstanceScript(); + if (!instance) + return; + + Player* player = unit->ToPlayer(); + if (!player || player->IsGameMaster()) + return; + + if (Creature* oratorKrixVizk = instance->GetCreature(data)) + Conversation::CreateConversation(conversationEntry, oratorKrixVizk, player->GetPosition(), player->GetGUID()); + + at->Remove(); + } +}; + +// 216619 - Orator Krix'vizk <The Fifth Strand> +struct boss_orator_krix_vizk : public BossAI +{ + boss_orator_krix_vizk(Creature* creature) : BossAI(creature, DATA_ORATOR_KRIX_VIZK), _subjugateCount(1), _terrorizeCount(1), _energizeCount(0) { } + + void JustAppeared() override + { + DoCastSelf(SPELL_ORATION); + me->SetPower(POWER_ENERGY, 0); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_DEATH); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + + WorldObject* obj = nullptr; + Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck check(ObjectGuid::Empty, AREATRIGGER_BARRIER); + Trinity::WorldObjectSearcher<Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck> checker(me, obj, check, GRID_MAP_TYPE_MASK_AREATRIGGER); + Cell::VisitGridObjects(me, checker, 100.0f); + + if (!obj) + return; + + if (AreaTrigger* at = obj->ToAreaTrigger()) + at->Remove(); + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + + _EnterEvadeMode(); + _DespawnAtEvade(); + } + + void KilledUnit(Unit* victim) override + { + if (!victim->IsPlayer()) + return; + + Talk(SAY_KILL); + } + + void Reset() override + { + _Reset(); + + _subjugateCount = 1; + _terrorizeCount = 1; + _energizeCount = 0; + } + + void JustEngagedWith(Unit* who) override + { + BossAI::JustEngagedWith(who); + Talk(SAY_AGGRO); + + DoCastSelf(SPELL_CHAINS_OF_OPPRESSION); + + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); + + me->SetOverrideDisplayPowerId(DISPLAY_POWERID); // No aura handle + + events.ScheduleEvent(EVENT_ENERGIZE, 1s); + events.ScheduleEvent(EVENT_SUBJUGATE, 4500ms); + events.ScheduleEvent(EVENT_TERRORIZE, 9400ms); + + if (IsMythic() || IsMythicPlus()) + events.ScheduleEvent(EVENT_SHADOWS_OF_DOUBT, 15200ms); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SUBJUGATE: + { + Talk(SAY_SUBJUGATE); + DoCastVictim(SPELL_SUBJUGATE); + _subjugateCount++; + if (_subjugateCount % 2 == 0) + events.ScheduleEvent(EVENT_SUBJUGATE, 17100ms); + else + events.ScheduleEvent(EVENT_SUBJUGATE, 12s); + break; + } + case EVENT_TERRORIZE: + { + Talk(SAY_TERRORIZE); + DoCast(SPELL_TERRORIZE_SELECTOR); + _terrorizeCount++; + if (_terrorizeCount % 2 == 0) + events.ScheduleEvent(EVENT_TERRORIZE, 8100ms); + else + events.ScheduleEvent(EVENT_TERRORIZE, 21100ms); + break; + } + case EVENT_SHADOWS_OF_DOUBT: + { + DoCast(SPELL_SHADOWS_OF_DOUBT_SELECTOR); + events.ScheduleEvent(EVENT_SHADOWS_OF_DOUBT, 30300ms); + break; + } + case EVENT_ENERGIZE: + { + if (me->GetPower(POWER_ENERGY) == 100) + { + Talk(SAY_VOCIFEROUS_INDOCTRINATION); + DoCastSelf(SPELL_VOCIFEROUS_INDOCTRINATION); + events.RescheduleEvent(EVENT_ENERGIZE, 6s); + } + else + { + me->SetPower(POWER_ENERGY, me->GetPower(POWER_ENERGY) + 4); + _energizeCount++; + events.ScheduleEvent(EVENT_ENERGIZE, (_energizeCount % 2) ? 1200ms : 800ms); + } + break; + } + default: + break; + } + } + } + +private: + uint8 _subjugateCount; + uint8 _terrorizeCount; + uint8 _energizeCount; +}; + +// 434808 - Terrorize +class spell_orator_krix_vizk_terrorize_selector : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_TERRORIZE }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_TERRORIZE, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringSpell = GetSpell() + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_orator_krix_vizk_terrorize_selector::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 448560 - Shadows of Doubt +class spell_orator_krix_vizk_shadows_of_doubt_selector : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SHADOWS_OF_DOUBT }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_SHADOWS_OF_DOUBT, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringSpell = GetSpell() + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_orator_krix_vizk_shadows_of_doubt_selector::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 440310 - Chains of Oppression +class spell_orator_krix_vizk_chains_of_oppression_periodic : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_CHAINS_OF_OPPRESSION_DAMAGE, SPELL_CHAINS_OF_OPPRESSION_CHARGE }); + } + + void Tick(AuraEffect const* /*aurEff*/) const + { + if (Unit* caster = GetCaster()) + { + Unit* target = GetTarget(); + CastSpellExtraArgs args; + args.TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR; + + caster->CastSpell(target, SPELL_CHAINS_OF_OPPRESSION_DAMAGE, args); + target->CastSpell(caster, SPELL_CHAINS_OF_OPPRESSION_CHARGE, args); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_orator_krix_vizk_chains_of_oppression_periodic::Tick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } +}; + +// 448561 - Shadows of Doubt +class spell_orator_krix_vizk_shadows_of_doubt_periodic : public AuraScript +{ + static constexpr uint8 MAX_SHADOW_OF_DOUBTS = 5; + static constexpr uint32 DOUBT_AT_CREATE_PROPERTIES = 165; + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_DOUBT }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + return; + + Unit* caster = GetCaster(); + if (!caster) + return; + + for (uint8 i = 0; i < MAX_SHADOW_OF_DOUBTS; ++i) + { + Unit* target = GetTarget(); + float angle = 2.f * float(M_PI) / MAX_SHADOW_OF_DOUBTS * i; + Position dest(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), angle); + AreaTrigger::CreateAreaTrigger({ DOUBT_AT_CREATE_PROPERTIES, true }, dest, -1, caster, target); + } + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_orator_krix_vizk_shadows_of_doubt_periodic::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 434829 - Vociferous Indoctrination +class spell_orator_krix_vizk_vociferous_indoctrination_periodic : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_VOCIFEROUS_INDOCTRINATION_DAMAGE, SPELL_LINGERING_INFLUENCE_AREATRIGGER }); + } + + void Tick(AuraEffect const* aurEff) const + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_VOCIFEROUS_INDOCTRINATION_DAMAGE, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringAura = aurEff + }); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + if (Unit* caster = GetCaster()) + GetTarget()->CastSpell(caster, SPELL_LINGERING_INFLUENCE_AREATRIGGER, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + + if (Creature* creatureTarget = GetTarget()->ToCreature()) + creatureTarget->SetPower(POWER_ENERGY, 0); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_orator_krix_vizk_vociferous_indoctrination_periodic::Tick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_orator_krix_vizk_vociferous_indoctrination_periodic::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 434691 - Chains of Oppression +// Id - 31997 +struct at_orator_krix_vizk_chains_of_oppression : AreaTriggerAI +{ + at_orator_krix_vizk_chains_of_oppression(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + Unit* caster = at->GetCaster(); + if (!caster) + return; + + caster->CastSpell(unit, SPELL_CHAINS_OF_OPPRESSION_PERIODIC, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } + + void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override + { + if (!unit->IsPlayer()) + return; + + unit->RemoveAurasDueToSpell(SPELL_CHAINS_OF_OPPRESSION_PERIODIC); + } +}; + +// 434923 - Lingering Influence +// ID - 32026 +struct at_orator_krix_vizk_lingering_influence : AreaTriggerAI +{ + at_orator_krix_vizk_lingering_influence(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { } + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + Unit* caster = at->GetCaster(); + if (!caster) + return; + + caster->CastSpell(unit, SPELL_LINGERING_INFLUENCE_DAMAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } + + void OnUnitExit(Unit* unit, AreaTriggerExitReason /*reason*/) override + { + if (!unit->IsPlayer()) + return; + + unit->RemoveAurasDueToSpell(SPELL_LINGERING_INFLUENCE_DAMAGE); + } + + void OnInitialize() override + { + std::array<DBCPosition2D, 2> points = + { { + { 0.0f, 1.0f }, + { 1.0f, 18.0f } + } }; + + at->SetTimeToTargetScale(6000); + at->SetOverrideScaleCurve(points, 2); + } +}; + +// 165 +struct at_orator_krix_vizk_doubt : AreaTriggerAI +{ + explicit at_orator_krix_vizk_doubt(AreaTrigger* areaTrigger) : AreaTriggerAI(areaTrigger), _canHitOrigin(false) {} + + void OnInitialize() override + { + Position destPos = at->GetPosition(); + at->MovePositionToFirstCollision(destPos, 200.0f, 0.0f); + + PathGenerator path(at); + path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), true); + + at->InitSplines(path.GetPath()); + + _canHitOrigin = false; + _scheduler.Schedule(1s, [this](TaskContext /*task*/) + { + _canHitOrigin = true; + }); + } + + void OnUpdate(uint32 diff) override + { + _scheduler.Update(diff); + } + + void OnDestinationReached() override + { + at->Remove(); + } + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + if (!_canHitOrigin && unit == at->GetTarget()) + return; + + Unit* caster = at->GetCaster(); + if (!caster) + return; + + caster->CastSpell(unit, SPELL_DOUBT, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } + +private: + TaskScheduler _scheduler; + bool _canHitOrigin; +}; + +void AddSC_boss_orator_krix_vizk() +{ + new GenericAreaTriggerEntityScript<at_orator_conversation_intro<CONVERSATION_ORATOR_INTRO_1, DATA_ORATOR_CONVO>>("at_orator_conversation_intro_1"); + new GenericAreaTriggerEntityScript<at_orator_conversation_intro<CONVERSATION_ORATOR_INTRO_2, DATA_ORATOR_KRIX_VIZK>>("at_orator_conversation_intro_2"); + new GenericAreaTriggerEntityScript<at_orator_conversation_intro<CONVERSATION_ORATOR_INTRO_3, DATA_ORATOR_KRIX_VIZK>>("at_orator_conversation_intro_3"); + + RegisterCityOfThreadsCreatureAI(boss_orator_krix_vizk); + + RegisterSpellScript(spell_orator_krix_vizk_terrorize_selector); + RegisterSpellScript(spell_orator_krix_vizk_shadows_of_doubt_selector); + RegisterSpellScript(spell_orator_krix_vizk_chains_of_oppression_periodic); + RegisterSpellScript(spell_orator_krix_vizk_shadows_of_doubt_periodic); + RegisterSpellScript(spell_orator_krix_vizk_vociferous_indoctrination_periodic); + + RegisterAreaTriggerAI(at_orator_krix_vizk_chains_of_oppression); + RegisterAreaTriggerAI(at_orator_krix_vizk_lingering_influence); + RegisterAreaTriggerAI(at_orator_krix_vizk_doubt); +} diff --git a/src/server/scripts/KhazAlgar/CityOfThreads/city_of_threads.h b/src/server/scripts/KhazAlgar/CityOfThreads/city_of_threads.h new file mode 100644 index 00000000000..7efc98d0269 --- /dev/null +++ b/src/server/scripts/KhazAlgar/CityOfThreads/city_of_threads.h @@ -0,0 +1,61 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DEF_CITY_OF_THREADS_H_ +#define DEF_CITY_OF_THREADS_H_ + +#include "CreatureAIImpl.h" + +#define COTScriptName "instance_city_of_threads" +#define DataHeader "CityOfThreads" + +uint32 const EncounterCount = 4; + +enum CityOfThreadsDataTypes +{ + // Encounters + DATA_ORATOR_KRIX_VIZK = 0, + DATA_FANGS_OF_THE_QUEEN = 1, + DATA_THE_COAGLAMATION = 2, + DATA_IZO_THE_GRAND_SPLICER = 3, + + // Additional Data + DATA_ORATOR_CONVO +}; + +enum CityOfThreadsCreatureIds +{ + // Bosses + BOSS_ORATOR_KRIX_VIZK = 216619, + BOSS_NX = 216648, + BOSS_VX = 216649, + BOSS_THE_COAGLAMATION = 216320, + BOSS_IZO_THE_GRAND_SPLICER = 216658, + + // Npcs + NPC_ORATOR_KRIX_VIZK_CONVO = 220769 +}; + +template <class AI, class T> +inline AI* GetCityOfThreadsAI(T* obj) +{ + return GetInstanceAI<AI>(obj, COTScriptName); +} + +#define RegisterCityOfThreadsCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetCityOfThreadsAI) + +#endif diff --git a/src/server/scripts/KhazAlgar/CityOfThreads/instance_city_of_threads.cpp b/src/server/scripts/KhazAlgar/CityOfThreads/instance_city_of_threads.cpp new file mode 100644 index 00000000000..38e8d2905d5 --- /dev/null +++ b/src/server/scripts/KhazAlgar/CityOfThreads/instance_city_of_threads.cpp @@ -0,0 +1,66 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "InstanceScript.h" +#include "ScriptMgr.h" +#include "city_of_threads.h" + +static constexpr ObjectData creatureData[] = +{ + { BOSS_ORATOR_KRIX_VIZK, DATA_ORATOR_KRIX_VIZK }, + { BOSS_NX, DATA_FANGS_OF_THE_QUEEN }, + { BOSS_VX, DATA_FANGS_OF_THE_QUEEN }, + { BOSS_THE_COAGLAMATION, DATA_THE_COAGLAMATION }, + { BOSS_IZO_THE_GRAND_SPLICER, DATA_IZO_THE_GRAND_SPLICER }, + { NPC_ORATOR_KRIX_VIZK_CONVO, DATA_ORATOR_CONVO }, + { 0, 0 } // END +}; + +static constexpr DungeonEncounterData const encounters[] = +{ + { DATA_ORATOR_KRIX_VIZK, {{ 2907 }} }, + { DATA_FANGS_OF_THE_QUEEN, {{ 2908 }} }, + { DATA_THE_COAGLAMATION, {{ 2905 }} }, + { DATA_IZO_THE_GRAND_SPLICER, {{ 2909 }} } +}; + +class instance_city_of_threads : public InstanceMapScript +{ +public: + instance_city_of_threads() : InstanceMapScript(COTScriptName, 2669) { } + + struct instance_city_of_threads_InstanceMapScript: public InstanceScript + { + instance_city_of_threads_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, nullptr); + LoadDungeonEncounterData(encounters); + } + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_city_of_threads_InstanceMapScript(map); + } +}; + +void AddSC_instance_city_of_threads() +{ + new instance_city_of_threads(); +} diff --git a/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp b/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp index e8f1c7de329..86ae7069db0 100644 --- a/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp +++ b/src/server/scripts/KhazAlgar/khaz_algar_script_loader.cpp @@ -32,6 +32,10 @@ void AddSC_boss_skarmorak(); void AddSC_instance_nerubar_palace(); void AddSC_boss_ulgrax_the_devourer(); +// City of Threads +void AddSC_instance_city_of_threads(); +void AddSC_boss_orator_krix_vizk(); + // The name of this function should match: // void Add${NameOfDirectory}Scripts() void AddKhazAlgarScripts() @@ -50,4 +54,8 @@ void AddKhazAlgarScripts() // Nerub'ar Palace AddSC_instance_nerubar_palace(); AddSC_boss_ulgrax_the_devourer(); + + // City of Threads + AddSC_instance_city_of_threads(); + AddSC_boss_orator_krix_vizk(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 807109e1493..659f216fc1e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -648,7 +648,7 @@ struct npc_spinestalker : public ScriptedAI // Increase add count if (!me->isDead()) { - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -670,7 +670,7 @@ struct npc_spinestalker : public ScriptedAI void JustAppeared() override { ScriptedAI::JustAppeared(); - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) override @@ -773,7 +773,7 @@ struct npc_rimefang_icc : public ScriptedAI // Increase add count if (!me->isDead()) { - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -795,7 +795,7 @@ struct npc_rimefang_icc : public ScriptedAI void JustAppeared() override { ScriptedAI::JustAppeared(); - _instance->SetGuidData(DATA_SINDRAGOSA_FROSTWYRMS, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade } void JustDied(Unit* /*killer*/) override @@ -929,7 +929,7 @@ struct npc_sindragosa_trash : public ScriptedAI if (!me->isDead()) { if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetGuidData(_frostwyrmId, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(_frostwyrmId, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade Reset(); } } @@ -952,7 +952,7 @@ struct npc_sindragosa_trash : public ScriptedAI // Increase add count if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetGuidData(_frostwyrmId, ObjectGuid::Create<HighGuid::Creature>(631, me->GetEntry(), me->GetSpawnId())); // this cannot be in Reset because reset also happens on evade + _instance->SetData64(_frostwyrmId, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade } void SetData(uint32 type, uint32 data) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index e4de05aa1f5..5ea4c256ab5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -1015,18 +1015,20 @@ class instance_icecrown_citadel : public InstanceMapScript } } - void SetGuidData(uint32 type, ObjectGuid guid) override + void SetData64(uint32 type, uint64 data) override { switch (type) { case DATA_SINDRAGOSA_FROSTWYRMS: - FrostwyrmGUIDs.insert(guid.GetCounter()); + FrostwyrmGUIDs.insert(data); break; case DATA_SPINESTALKER: - SpinestalkerTrash.insert(guid.GetCounter()); + SpinestalkerTrash.insert(data); break; case DATA_RIMEFANG: - RimefangTrash.insert(guid.GetCounter()); + RimefangTrash.insert(data); + break; + default: break; } } |