diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 19 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.h | 3 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStructure.h | 9 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCfmt.h | 1 | ||||
-rw-r--r-- | src/server/game/Maps/PhaseMgr.cpp | 111 | ||||
-rw-r--r-- | src/server/game/Maps/PhaseMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraDefines.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 30 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 2 |
9 files changed, 138 insertions, 41 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index eeb39d46533..f7fd43d7212 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -253,7 +253,10 @@ DBCStorage <WMOAreaTableEntry> sWMOAreaTableStore(WMOAreaTableEntryfmt); DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore(WorldMapAreaEntryfmt); DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore(WorldMapOverlayEntryfmt); DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt); -DBCStorage <PhaseEntry> sPhaseStores(PhaseEntryfmt); +DBCStorage <PhaseEntry> sPhaseStore(PhaseEntryfmt); +DBCStorage <PhaseGroupEntry> sPhaseGroupStore(PhaseGroupfmt); + +PhaseGroupContainer sPhasesByGroup; typedef std::list<std::string> StoreProblemList; @@ -468,7 +471,6 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc"); //15595 LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc");//15595 - LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseStores, dbcPath, "Phase.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sMailTemplateStore, dbcPath, "MailTemplate.dbc");//15595 LoadDBC(availableDbcLocales, bad_dbc_files, sMapStore, dbcPath, "Map.dbc");//15595 @@ -494,6 +496,14 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sOverrideSpellDataStore, dbcPath, "OverrideSpellData.dbc");//15595 + LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseStore, dbcPath, "Phase.dbc"); // 15595 + LoadDBC(availableDbcLocales, bad_dbc_files, sPhaseGroupStore, dbcPath, "PhaseXPhaseGroup.dbc"); // 15595 + + for (uint32 i = 0; i < sPhaseGroupStore.GetNumRows(); ++i) + if (PhaseGroupEntry const* group = sPhaseGroupStore.LookupEntry(i)) + if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseId)) + sPhasesByGroup[group->GroupId].insert(phase->ID); + LoadDBC(availableDbcLocales, bad_dbc_files, sPowerDisplayStore, dbcPath, "PowerDisplay.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc");//15595 @@ -1299,3 +1309,8 @@ uint32 GetDefaultMapLight(uint32 mapId) return 0; } + +std::set<uint32> const& GetPhasesForGroup(uint32 group) +{ + return sPhasesByGroup[group]; +} diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 29853ba8c31..c8a2897b183 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -83,6 +83,8 @@ LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty); uint32 GetDefaultMapLight(uint32 mapId); +std::set<uint32> const& GetPhasesForGroup(uint32 group); + extern DBCStorage <AchievementEntry> sAchievementStore; extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore; extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions @@ -173,6 +175,7 @@ extern DBCStorage <MountTypeEntry> sMountTypeStore; extern DBCStorage <NameGenEntry> sNameGenStore; extern DBCStorage <NumTalentsAtLevelEntry> sNumTalentsAtLevelStore; extern DBCStorage <PhaseEntry> sPhaseStore; +extern DBCStorage <PhaseGroupEntry> sPhaseGroupStore; //extern DBCStorage <MapDifficultyEntry> sMapDifficultyStore; -- use GetMapDifficultyData insteed extern MapDifficultyMap sMapDifficultyMap; extern DBCStorage <MovieEntry> sMovieStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 013826b68f6..f3154d727e5 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1472,6 +1472,13 @@ struct PhaseEntry uint32 flag; // 2 }; +struct PhaseGroupEntry +{ + uint32 ID; + uint32 PhaseId; + uint32 GroupId; +}; + struct MailTemplateEntry { uint32 ID; // 0 @@ -2515,4 +2522,6 @@ typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath; #define TaxiMaskSize 114 typedef uint8 TaxiMask[TaxiMaskSize]; + +typedef std::unordered_map<uint32, std::set<uint32> const&> PhaseGroupContainer; #endif diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index e47bce294dd..31ae5d41fce 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -102,6 +102,7 @@ char const LightEntryfmt[] = "nifffxxxxxxxxxx"; char const LiquidTypefmt[] = "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; char const PhaseEntryfmt[] = "nsi"; +char const PhaseGroupfmt[] = "nii"; char const MailTemplateEntryfmt[] = "nxs"; char const MapEntryfmt[] = "nxiixxsixxixiffxiiii"; char const MapDifficultyEntryfmt[] = "diisiix"; diff --git a/src/server/game/Maps/PhaseMgr.cpp b/src/server/game/Maps/PhaseMgr.cpp index f3b31fdf6d5..0f542bf5948 100644 --- a/src/server/game/Maps/PhaseMgr.cpp +++ b/src/server/game/Maps/PhaseMgr.cpp @@ -93,7 +93,9 @@ void PhaseMgr::Recalculate() PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId()); if (itr != _PhaseDefinitionStore->end()) + { for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase) + { if (CheckDefinition(&(*phase))) { phaseData.AddPhaseDefinition(&(*phase)); @@ -107,6 +109,8 @@ void PhaseMgr::Recalculate() if (phase->IsLastDefinition()) break; } + } + } } inline bool PhaseMgr::CheckDefinition(PhaseDefinition const* phaseDefinition) @@ -143,35 +147,56 @@ bool PhaseMgr::NeedsPhaseUpdateWithData(PhaseUpdateData const& updateData) const void PhaseMgr::RegisterPhasingAuraEffect(AuraEffect const* auraEffect) { - PhaseInfo phaseInfo; + std::list<PhaseInfo> phases; - if (auraEffect->GetMiscValue()) + if (auraEffect->GetAuraType() == SPELL_AURA_PHASE) { - _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; - phaseInfo.phasemask = auraEffect->GetMiscValue(); - } - else - { - SpellPhaseStore::const_iterator itr = _SpellPhaseStore->find(auraEffect->GetId()); - if (itr != _SpellPhaseStore->end()) + PhaseInfo phaseInfo; + + if (auraEffect->GetMiscValue()) { - if (itr->second.phasemask) + _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + phaseInfo.phasemask = auraEffect->GetMiscValue(); + } + else + { + SpellPhaseStore::const_iterator itr = _SpellPhaseStore->find(auraEffect->GetId()); + if (itr != _SpellPhaseStore->end()) { - _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; - phaseInfo.phasemask = itr->second.phasemask; - } + if (itr->second.phasemask) + { + _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + phaseInfo.phasemask = itr->second.phasemask; + } - if (itr->second.terrainswapmap) - phaseInfo.terrainswapmap = itr->second.terrainswapmap; + if (itr->second.terrainswapmap) + phaseInfo.terrainswapmap = itr->second.terrainswapmap; + } } - } - phaseInfo.phaseId = auraEffect->GetMiscValueB(); + phaseInfo.phaseId = auraEffect->GetMiscValueB(); - if (phaseInfo.NeedsClientSideUpdate()) - _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; + if (phaseInfo.NeedsClientSideUpdate()) + _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; - phaseData.AddAuraInfo(auraEffect->GetId(), phaseInfo); + phases.push_back(phaseInfo); + } + else if (auraEffect->GetAuraType() == SPELL_AURA_PHASE_GROUP) + { + uint32 group = auraEffect->GetMiscValueB(); + std::set<uint32> const& groupPhases = GetPhasesForGroup(group); + for (auto itr = groupPhases.begin(); itr != groupPhases.end(); ++itr) + { + PhaseInfo phaseInfo; + phaseInfo.phaseId = auraEffect->GetMiscValueB(); + if (phaseInfo.NeedsClientSideUpdate()) + _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; + phases.push_back(phaseInfo); + } + } + + for (auto itr = phases.begin(); itr != phases.end(); ++itr) + phaseData.AddAuraInfo(auraEffect->GetId(), *itr); Update(); } @@ -265,11 +290,14 @@ void PhaseData::SendPhaseshiftToPlayer() for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) { - if (itr->second.terrainswapmap) - terrainswaps.insert(itr->second.terrainswapmap); + for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph) + { + if (ph->terrainswapmap) + terrainswaps.insert(ph->terrainswapmap); - if (itr->second.phaseId) - phaseIds.insert(itr->second.phaseId); + if (ph->phaseId) + phaseIds.insert(ph->phaseId); + } } // Phase Definitions @@ -288,8 +316,9 @@ void PhaseData::SendPhaseshiftToPlayer() void PhaseData::GetActivePhases(std::set<uint32>& phases) const { for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) - if (itr->second.phaseId) - phases.insert(itr->second.phaseId); + for (auto phase = itr->second.begin(); phase != itr->second.end(); ++phase) + if (phase->phaseId) + phases.insert(phase->phaseId); // Phase Definitions for (std::list<PhaseDefinition const*>::const_iterator itr = activePhaseDefinitions.begin(); itr != activePhaseDefinitions.end(); ++itr) @@ -320,7 +349,7 @@ void PhaseData::AddAuraInfo(uint32 spellId, PhaseInfo const& phaseInfo) if (phaseInfo.phasemask) _PhasemaskThroughAuras |= phaseInfo.phasemask; - spellPhaseInfo[spellId] = phaseInfo; + spellPhaseInfo[spellId].push_back(phaseInfo); } uint32 PhaseData::RemoveAuraInfo(uint32 spellId) @@ -328,21 +357,31 @@ uint32 PhaseData::RemoveAuraInfo(uint32 spellId) PhaseInfoContainer::const_iterator rAura = spellPhaseInfo.find(spellId); if (rAura != spellPhaseInfo.end()) { + bool serverUpdated = false; + bool clientUpdated = false; uint32 updateflag = 0; - if (rAura->second.NeedsClientSideUpdate()) - updateflag |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; - - if (rAura->second.NeedsServerSideUpdate()) + for (auto phase = rAura->second.begin(); phase != rAura->second.end(); ++phase) { - _PhasemaskThroughAuras = 0; + if (!clientUpdated && phase->NeedsClientSideUpdate()) + { + clientUpdated = true; + updateflag |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED; + } - updateflag |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; + if (!serverUpdated && phase->NeedsServerSideUpdate()) + { + serverUpdated = true; + _PhasemaskThroughAuras = 0; + + updateflag |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED; - spellPhaseInfo.erase(rAura); + spellPhaseInfo.erase(rAura); - for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) - _PhasemaskThroughAuras |= itr->second.phasemask; + for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr) + for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph) + _PhasemaskThroughAuras |= ph->phasemask; + } } return updateflag; diff --git a/src/server/game/Maps/PhaseMgr.h b/src/server/game/Maps/PhaseMgr.h index a2f51722e26..f5226e6468c 100644 --- a/src/server/game/Maps/PhaseMgr.h +++ b/src/server/game/Maps/PhaseMgr.h @@ -82,7 +82,7 @@ struct PhaseInfo bool NeedsClientSideUpdate() const { return terrainswapmap || phaseId; } }; -typedef std::unordered_map<uint32 /*spellId*/, PhaseInfo> PhaseInfoContainer; +typedef std::unordered_map<uint32 /*spellId*/, std::list<PhaseInfo>> PhaseInfoContainer; struct PhaseData { diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index 268034444b0..0f396ee4bc6 100644 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.h @@ -385,7 +385,7 @@ enum AuraType SPELL_AURA_323 = 323, // Not used in 4.3.4 SPELL_AURA_324 = 324, // spell critical chance (probably by school mask) SPELL_AURA_325 = 325, // Not used in 4.3.4 - SPELL_AURA_326 = 326, // phase related + SPELL_AURA_PHASE_GROUP = 326, // Puts the player in all the phases that are in the group with id = miscB SPELL_AURA_327 = 327, // Not used in 4.3.4 SPELL_AURA_PROC_ON_POWER_AMOUNT = 328, SPELL_AURA_MOD_RUNE_REGEN_SPEED = 329, // NYI diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a4210d2dad5..61a1ea40120 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -384,7 +384,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleUnused, //323 unused (4.3.4) &AuraEffect::HandleNULL, //324 SPELL_AURA_324 &AuraEffect::HandleUnused, //325 unused (4.3.4) - &AuraEffect::HandleNULL, //326 SPELL_AURA_326 + &AuraEffect::HandlePhaseGroup, //326 SPELL_AURA_PHASE_GROUP &AuraEffect::HandleUnused, //327 unused (4.3.4) &AuraEffect::HandleNoImmediateEffect, //328 SPELL_AURA_PROC_ON_POWER_AMOUNT implemented in Unit::HandleAuraProcOnPowerAmount &AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_RUNE_REGEN_SPEED @@ -1645,6 +1645,34 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app target->UpdateObjectVisibility(); } +void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const +{ + if (!(mode & AURA_EFFECT_HANDLE_REAL)) + return; + + Unit* target = aurApp->GetTarget(); + + if (Player* player = target->ToPlayer()) + { + if (apply) + player->GetPhaseMgr().RegisterPhasingAuraEffect(this); + else + player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this); + } + + // call functions which may have additional effects after chainging state of unit + // phase auras normally not expected at BG but anyway better check + if (apply) + { + // drop flag at invisibiliy in bg + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); + } + + // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) + if (target->IsVisible()) + target->UpdateObjectVisibility(); +} + /**********************/ /*** UNIT MODEL ***/ /**********************/ diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 2e849fff963..2415b89c9a8 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -134,6 +134,8 @@ class AuraEffect void HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const; + void HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const; + // unit model void HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const; void HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const; |