diff options
| author | Ovahlord <dreadkiller@gmx.de> | 2023-11-15 10:14:06 +0100 |
|---|---|---|
| committer | Ovahlord <dreadkiller@gmx.de> | 2023-11-15 10:14:06 +0100 |
| commit | 6dcfeb3a85b126e5226debd00bfdf8a6913e15ac (patch) | |
| tree | 675511e4c46fc7f49cfb532c06a5f747cb210161 /src | |
| parent | d8b546707130b5fa81f73277c5fbd05e7e7cc2b9 (diff) | |
Core/Misc: duc tape build
Diffstat (limited to 'src')
58 files changed, 147 insertions, 3059 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 00c15509f5a..1210a10a2c2 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -345,7 +345,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec return nullptr; // Silenced so we can't cast - if (me->IsSilenced(school ? SpellSchoolMask(school) : SPELL_SCHOOL_MASK_MAGIC)) + if (me->HasUnitFlag(UNIT_FLAG_SILENCED)) return nullptr; // Using the extended script system we first create a list of viable spells diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 39328c9f9c2..46891c35031 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -111,13 +111,6 @@ bool AchievementMgr::CanUpdateCriteriaTree(Criteria const* criteria, CriteriaTre if (referencePlayer->GetSession()->HasPermission(rbac::RBAC_PERM_CANNOT_EARN_REALM_FIRST_ACHIEVEMENTS)) return false; - if (achievement->CovenantID && referencePlayer->m_playerData->CovenantID != achievement->CovenantID) - { - TC_LOG_TRACE("criteria.achievement", "AchievementMgr::CanUpdateCriteriaTree: (Id: {} Type {} Achievement {}) Wrong covenant", - criteria->ID, CriteriaMgr::GetCriteriaTypeString(criteria->Entry->Type), achievement->ID); - return false; - } - return CriteriaHandler::CanUpdateCriteriaTree(criteria, tree, referencePlayer); } diff --git a/src/server/game/Achievements/CriteriaHandler.cpp b/src/server/game/Achievements/CriteriaHandler.cpp index 2f4d7d1a356..31147a4dbd6 100644 --- a/src/server/game/Achievements/CriteriaHandler.cpp +++ b/src/server/game/Achievements/CriteriaHandler.cpp @@ -17,7 +17,6 @@ #include "CriteriaHandler.h" #include "ArenaTeamMgr.h" -#include "AzeriteItem.h" #include "Battleground.h" #include "BattlePetMgr.h" #include "CollectionMgr.h" @@ -2163,17 +2162,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 return false; break; case ModifierTreeType::FriendshipRepReactionIsMet: // 94 - { - FriendshipRepReactionEntry const* friendshipRepReaction = sFriendshipRepReactionStore.LookupEntry(reqValue); - if (!friendshipRepReaction) - return false; - FriendshipReputationEntry const* friendshipReputation = sFriendshipReputationStore.LookupEntry(friendshipRepReaction->FriendshipRepID); - if (!friendshipReputation) - return false; - if (referencePlayer->GetReputation(friendshipReputation->FactionID) < int32(friendshipRepReaction->ReactionThreshold)) - return false; - break; - } + return false; case ModifierTreeType::ReputationWithFactionIsEqualOrGreaterThan: // 95 if (referencePlayer->GetReputationMgr().GetReputation(reqValue) < int32(secondaryAsset)) return false; @@ -3222,12 +3211,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 break; } case ModifierTreeType::PlayerAzeriteLevelEqualOrGreaterThan: // 235 - { - Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere); - if (!heartOfAzeroth || heartOfAzeroth->ToAzeriteItem()->GetLevel() < reqValue) - return false; - break; - } + return false; case ModifierTreeType::PlayerIsOnQuestInQuestline: // 236 { bool isOnQuest = false; @@ -3359,25 +3343,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 break; } case ModifierTreeType::FriendshipRepReactionEqual: // 254 - { - FriendshipRepReactionEntry const* friendshipRepReaction = sFriendshipRepReactionStore.LookupEntry(reqValue); - if (!friendshipRepReaction) - return false; - FriendshipReputationEntry const* friendshipReputation = sFriendshipReputationStore.LookupEntry(friendshipRepReaction->FriendshipRepID); - if (!friendshipReputation) - return false; - DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(reqValue); - if (!friendshipReactions) - return false; - uint32 rank = referencePlayer->GetReputationRank(friendshipReputation->FactionID); - if (rank >= friendshipReactions->size()) - return false; - auto itr = friendshipReactions->begin(); - std::advance(itr, rank); - if ((*itr)->ID != reqValue) - return false; - break; - } + return false; case ModifierTreeType::PlayerAuraStackCountEqual: // 255 if (referencePlayer->GetAuraCount(secondaryAsset) != reqValue) return false; @@ -3395,32 +3361,11 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 return false; break; case ModifierTreeType::PlayerHasAzeriteEssenceRankLessThan: // 259 - { - if (Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - for (UF::UnlockedAzeriteEssence const& essence : azeriteItem->m_azeriteItemData->UnlockedEssences) - if (essence.AzeriteEssenceID == reqValue && essence.Rank < secondaryAsset) - return true; return false; - } case ModifierTreeType::PlayerHasAzeriteEssenceRankEqual: // 260 - { - if (Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - for (UF::UnlockedAzeriteEssence const& essence : azeriteItem->m_azeriteItemData->UnlockedEssences) - if (essence.AzeriteEssenceID == reqValue && essence.Rank == secondaryAsset) - return true; return false; - } case ModifierTreeType::PlayerHasAzeriteEssenceRankGreaterThan: // 261 - { - if (Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - for (UF::UnlockedAzeriteEssence const& essence : azeriteItem->m_azeriteItemData->UnlockedEssences) - if (essence.AzeriteEssenceID == reqValue && essence.Rank > secondaryAsset) - return true; return false; - } case ModifierTreeType::PlayerHasAuraWithEffectIndex: // 262 if (!referencePlayer->GetAuraEffect(reqValue, secondaryAsset)) return false; @@ -3446,20 +3391,8 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 break; } case ModifierTreeType::PlayerHasAzeriteEssenceInSlotAtRankLessThan: // 266 - if (Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences()) - for (UF::UnlockedAzeriteEssence const& essence : azeriteItem->m_azeriteItemData->UnlockedEssences) - if (essence.AzeriteEssenceID == selectedEssences->AzeriteEssenceID[reqValue] && essence.Rank < secondaryAsset) - return true; return false; case ModifierTreeType::PlayerHasAzeriteEssenceInSlotAtRankGreaterThan: // 267 - if (Item const* heartOfAzeroth = referencePlayer->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences()) - for (UF::UnlockedAzeriteEssence const& essence : azeriteItem->m_azeriteItemData->UnlockedEssences) - if (essence.AzeriteEssenceID == selectedEssences->AzeriteEssenceID[reqValue] && essence.Rank > secondaryAsset) - return true; return false; case ModifierTreeType::PlayerLevelWithinContentTuning: // 268 { @@ -3514,9 +3447,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 case ModifierTreeType::TargetLevelWithinOrAboveLevelRange: // 275 NYI return false; case ModifierTreeType::MaxJailersTowerLevelEqualOrGreaterThan: // 276 - if (referencePlayer->m_activePlayerData->JailersTowerLevelMax < int32(reqValue)) - return false; - break; + return false; case ModifierTreeType::GroupedWithRaFRecruit: // 277 { Group const* group = referencePlayer->GetGroup(); @@ -3560,9 +3491,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 case ModifierTreeType::JailersTowerActiveFloorDifficultyEqualOrGreaterThan: // 287 NYI return false; case ModifierTreeType::PlayerCovenant: // 288 - if (referencePlayer->m_playerData->CovenantID != int32(reqValue)) - return false; - break; + return false; case ModifierTreeType::HasTimeEventPassed: // 289 { time_t eventTimestamp = GameTime::GetGameTime(); @@ -3602,9 +3531,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 case ModifierTreeType::GarrisonHasPermanentTalent: // 290 NYI return false; case ModifierTreeType::HasActiveSoulbind: // 291 - if (referencePlayer->m_playerData->SoulbindID != int32(reqValue)) - return false; - break; + return false; case ModifierTreeType::HasMemorizedSpell: // 292 NYI return false; case ModifierTreeType::PlayerHasAPACSubscriptionReward_2020: // 293 @@ -3632,30 +3559,17 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 return false; } case ModifierTreeType::PlayerIsInChromieTime: // 300 - if (referencePlayer->m_activePlayerData->UiChromieTimeExpansionID != int32(reqValue)) - return false; - break; + return false; case ModifierTreeType::PlayerIsInAnyChromieTime: // 301 - if (referencePlayer->m_activePlayerData->UiChromieTimeExpansionID == 0) - return false; - break; + return false; case ModifierTreeType::ItemIsAzeriteArmor: // 302 if (!sDB2Manager.GetAzeriteEmpoweredItem(miscValue1)) return false; break; case ModifierTreeType::PlayerHasRuneforgePower: // 303 - { - uint32 block = reqValue / 32; - if (block >= referencePlayer->m_activePlayerData->RuneforgePowers.size()) - return false; - - uint32 bit = reqValue % 32; - return referencePlayer->m_activePlayerData->RuneforgePowers[block] & (1 << bit); - } + return false; case ModifierTreeType::PlayerInChromieTimeForScaling: // 304 - if (!(referencePlayer->m_playerData->CtrOptions->ContentTuningConditionMask & 1)) - return false; - break; + return false; case ModifierTreeType::IsRaFRecruit: // 305 if (!referencePlayer->GetSession()->GetRecruiterId()) return false; @@ -3708,15 +3622,9 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 break; } case ModifierTreeType::PlayerHasWeeklyRewardsAvailable: // 313 - if (!*referencePlayer->m_activePlayerData->WeeklyRewardsPeriodSinceOrigin) - return false; - break; + return false; case ModifierTreeType::TargetCovenant: // 314 - if (!ref || !ref->IsPlayer()) - return false; - if (ref->ToPlayer()->m_playerData->CovenantID != int32(reqValue)) - return false; - break; + return false; case ModifierTreeType::PlayerHasTBCCollectorsEdition: // 315 case ModifierTreeType::PlayerHasWrathCollectorsEdition: // 316 return false; @@ -3876,9 +3784,7 @@ bool CriteriaHandler::ModifierSatisfied(ModifierTreeEntry const* modifier, uint6 return false; break; case ModifierTreeType::PlayerHasPerksProgramPendingReward: // 350 - if (!referencePlayer->m_activePlayerData->HasPerksProgramPendingReward) - return false; - break; + return false; case ModifierTreeType::PlayerCanUseItem: // 351 { ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(reqValue); diff --git a/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp b/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp index e4b0d7b4d2c..1f807dc914a 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommandArgs.cpp @@ -115,9 +115,7 @@ struct SpellInfoVisitor using value_type = SpellInfo const*; value_type operator()(Hyperlink<apower> artifactPower) const { return operator()(artifactPower->ArtifactPower->SpellID); } - value_type operator()(Hyperlink<conduit> soulbindConduit) const { return operator()((*soulbindConduit)->SpellID); } value_type operator()(Hyperlink<enchant> enchant) const { return enchant; } - value_type operator()(Hyperlink<mawpower> mawPower) const { return operator()((*mawPower)->SpellID); } value_type operator()(Hyperlink<mount> const& mount) const { return mount->Spell; } value_type operator()(Hyperlink<pvptal> pvpTalent) const { return operator()((*pvpTalent)->SpellID); } value_type operator()(Hyperlink<spell> spell) const { return spell->Spell; } @@ -128,7 +126,7 @@ struct SpellInfoVisitor }; ChatCommandResult Trinity::Impl::ChatCommands::ArgInfo<SpellInfo const*>::TryConsume(SpellInfo const*& data, ChatHandler const* handler, std::string_view args) { - Variant<Hyperlink<apower>, Hyperlink<conduit>, Hyperlink<enchant>, Hyperlink<mawpower>, Hyperlink<mount>, Hyperlink<pvptal>, Hyperlink<spell>, Hyperlink<talent>, Hyperlink<trade>, uint32> val; + Variant<Hyperlink<apower>, Hyperlink<mount>, Hyperlink<pvptal>, Hyperlink<spell>, Hyperlink<talent>, Hyperlink<trade>, uint32> val; ChatCommandResult result = ArgInfo<decltype(val)>::TryConsume(val, handler, args); if (!result || (data = val.visit(SpellInfoVisitor()))) return result; diff --git a/src/server/game/Chat/HyperlinkTags.cpp b/src/server/game/Chat/HyperlinkTags.cpp index 64ce77b3f2d..58a16880de7 100644 --- a/src/server/game/Chat/HyperlinkTags.cpp +++ b/src/server/game/Chat/HyperlinkTags.cpp @@ -154,15 +154,6 @@ bool Trinity::Hyperlinks::LinkTags::battlePetAbil::StoreTo(BattlePetAbilLinkData && t.IsEmpty(); } -bool Trinity::Hyperlinks::LinkTags::conduit::StoreTo(SoulbindConduitRankEntry const*& val, std::string_view text) -{ - HyperlinkDataTokenizer t(text); - uint32 soulbindConduitId, rank; - if (!(t.TryConsumeTo(soulbindConduitId) && t.TryConsumeTo(rank) && t.IsEmpty())) - return false; - return !!(val = sDB2Manager.GetSoulbindConduitRank(soulbindConduitId, rank)); -} - bool Trinity::Hyperlinks::LinkTags::currency::StoreTo(CurrencyLinkData& val, std::string_view text) { HyperlinkDataTokenizer t(text); @@ -406,15 +397,6 @@ bool Trinity::Hyperlinks::LinkTags::keystone::StoreTo(KeystoneLinkData& val, std return true; } -bool Trinity::Hyperlinks::LinkTags::mawpower::StoreTo(MawPowerEntry const*& val, std::string_view text) -{ - HyperlinkDataTokenizer t(text); - uint32 mawPowerId; - if (!t.TryConsumeTo(mawPowerId)) - return false; - return !!(val = sMawPowerStore.LookupEntry(mawPowerId)) && t.IsEmpty(); -} - bool Trinity::Hyperlinks::LinkTags::mount::StoreTo(MountLinkData& val, std::string_view text) { HyperlinkDataTokenizer t(text); @@ -502,16 +484,6 @@ bool Trinity::Hyperlinks::LinkTags::transmogappearance::StoreTo(ItemModifiedAppe return !!(val = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId)) && t.IsEmpty(); } -bool Trinity::Hyperlinks::LinkTags::transmogillusion::StoreTo(SpellItemEnchantmentEntry const*& val, std::string_view text) -{ - HyperlinkDataTokenizer t(text); - uint32 spellItemEnchantmentId; - if (!t.TryConsumeTo(spellItemEnchantmentId)) - return false; - return !!(val = sSpellItemEnchantmentStore.LookupEntry(spellItemEnchantmentId)) - && sDB2Manager.GetTransmogIllusionForEnchantment(spellItemEnchantmentId) && t.IsEmpty(); -} - bool Trinity::Hyperlinks::LinkTags::transmogset::StoreTo(TransmogSetEntry const*& val, std::string_view text) { HyperlinkDataTokenizer t(text); diff --git a/src/server/game/Chat/Hyperlinks.cpp b/src/server/game/Chat/Hyperlinks.cpp index 2d991fd05bf..d15a17f2c6d 100644 --- a/src/server/game/Chat/Hyperlinks.cpp +++ b/src/server/game/Chat/Hyperlinks.cpp @@ -234,22 +234,6 @@ struct LinkValidator<LinkTags::battlePetAbil> }; template <> -struct LinkValidator<LinkTags::conduit> -{ - static bool IsTextValid(SoulbindConduitRankEntry const* rank, std::string_view text) - { - if (SpellInfo const* info = sSpellMgr->GetSpellInfo(rank->SpellID, DIFFICULTY_NONE)) - return LinkValidator<LinkTags::spell>::IsTextValid(info, text); - return false; - } - - static bool IsColorValid(SoulbindConduitRankEntry const*, HyperlinkColor c) - { - return c == CHAT_LINK_COLOR_SPELL; - } -}; - -template <> struct LinkValidator<LinkTags::currency> { static bool IsTextValid(CurrencyLinkData const& data, std::string_view text) @@ -498,22 +482,6 @@ struct LinkValidator<LinkTags::quest> }; template <> -struct LinkValidator<LinkTags::mawpower> -{ - static bool IsTextValid(MawPowerEntry const* mawPower, std::string_view text) - { - if (SpellInfo const* info = sSpellMgr->GetSpellInfo(mawPower->SpellID, DIFFICULTY_NONE)) - return LinkValidator<LinkTags::spell>::IsTextValid(info, text); - return false; - } - - static bool IsColorValid(MawPowerEntry const*, HyperlinkColor c) - { - return c == CHAT_LINK_COLOR_SPELL; - } -}; - -template <> struct LinkValidator<LinkTags::mount> { static bool IsTextValid(MountLinkData const& data, std::string_view text) @@ -604,26 +572,6 @@ struct LinkValidator<LinkTags::transmogappearance> }; template <> -struct LinkValidator<LinkTags::transmogillusion> -{ - static bool IsTextValid(SpellItemEnchantmentEntry const* enchantment, std::string_view text) - { - for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1)) - if (enchantment->Name[i] == text) - return true; - for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1)) - if (enchantment->HordeName[i] == text) - return true; - return false; - } - - static bool IsColorValid(SpellItemEnchantmentEntry const*, HyperlinkColor c) - { - return c == CHAT_LINK_COLOR_TRANSMOG; - } -}; - -template <> struct LinkValidator<LinkTags::transmogset> { static bool IsTextValid(TransmogSetEntry const* set, std::string_view text) @@ -698,7 +646,6 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info) TryValidateAs(battlePetAbil); TryValidateAs(clubFinder); TryValidateAs(clubTicket); - TryValidateAs(conduit); TryValidateAs(creature); TryValidateAs(creature_entry); TryValidateAs(currency); @@ -715,7 +662,6 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info) TryValidateAs(itemset); TryValidateAs(journal); TryValidateAs(keystone); - TryValidateAs(mawpower); TryValidateAs(mount); TryValidateAs(outfit); TryValidateAs(player); @@ -730,7 +676,6 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info) TryValidateAs(title); TryValidateAs(trade); TryValidateAs(transmogappearance); - TryValidateAs(transmogillusion); TryValidateAs(transmogset); TryValidateAs(worldmap); return false; diff --git a/src/server/game/Chat/Hyperlinks.h b/src/server/game/Chat/Hyperlinks.h index 8adb96187f9..5f136b28ef2 100644 --- a/src/server/game/Chat/Hyperlinks.h +++ b/src/server/game/Chat/Hyperlinks.h @@ -368,13 +368,6 @@ namespace Trinity::Hyperlinks static bool StoreTo(BattlePetAbilLinkData& val, std::string_view text); }; - struct TC_GAME_API conduit - { - using value_type = SoulbindConduitRankEntry const*; - static constexpr std::string_view tag() { return "conduit"; } - static bool StoreTo(SoulbindConduitRankEntry const*& val, std::string_view text); - }; - struct TC_GAME_API currency { using value_type = CurrencyLinkData const&; @@ -445,13 +438,6 @@ namespace Trinity::Hyperlinks static bool StoreTo(KeystoneLinkData& val, std::string_view text); }; - struct TC_GAME_API mawpower - { - using value_type = MawPowerEntry const*; - static constexpr std::string_view tag() { return "mawpower"; } - static bool StoreTo(MawPowerEntry const*& val, std::string_view text); - }; - struct TC_GAME_API mount { using value_type = MountLinkData const&; @@ -508,13 +494,6 @@ namespace Trinity::Hyperlinks static bool StoreTo(ItemModifiedAppearanceEntry const*& val, std::string_view text); }; - struct TC_GAME_API transmogillusion - { - using value_type = SpellItemEnchantmentEntry const*; - static constexpr std::string_view tag() { return "transmogillusion"; } - static bool StoreTo(SpellItemEnchantmentEntry const*& val, std::string_view text); - }; - struct TC_GAME_API transmogset { using value_type = TransmogSetEntry const*; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 40a3f78bab0..0c59309bbb7 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -2974,31 +2974,6 @@ uint32 ConditionMgr::GetPlayerConditionLfgValue(Player const* player, PlayerCond bool ConditionMgr::IsPlayerMeetingCondition(Player const* player, PlayerConditionEntry const* condition) { - if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(condition->ContentTuningID, player->m_playerData->CtrOptions->ContentTuningConditionMask)) - { - uint8 minLevel = condition->Flags & 0x800 ? levels->MinLevelWithDelta : levels->MinLevel; - uint8 maxLevel = 0; - if (!(condition->Flags & 0x20)) - maxLevel = condition->Flags & 0x800 ? levels->MaxLevelWithDelta : levels->MaxLevel; - - if (condition->Flags & 0x80) - { - if (minLevel && player->GetLevel() >= minLevel && (!maxLevel || player->GetLevel() <= maxLevel)) - return false; - - if (maxLevel && player->GetLevel() <= maxLevel && (!minLevel || player->GetLevel() >= minLevel)) - return false; - } - else - { - if (minLevel && player->GetLevel() < minLevel) - return false; - - if (maxLevel && player->GetLevel() > maxLevel) - return false; - } - } - if (!condition->RaceMask.IsEmpty() && !condition->RaceMask.HasRace(player->GetRace())) return false; @@ -3390,49 +3365,6 @@ bool ConditionMgr::IsPlayerMeetingCondition(Player const* player, PlayerConditio if (condition->ModifierTreeID && !player->ModifierTreeSatisfied(condition->ModifierTreeID)) return false; - if (condition->CovenantID && player->m_playerData->CovenantID != condition->CovenantID) - return false; - - if (std::any_of(condition->TraitNodeEntryID.begin(), condition->TraitNodeEntryID.end(), [](int32 traitNodeEntryId) { return traitNodeEntryId != 0; })) - { - auto getTraitNodeEntryRank = [player](int32 traitNodeEntryId) -> Optional<uint16> - { - for (UF::TraitConfig const& traitConfig : player->m_activePlayerData->TraitConfigs) - { - if (TraitConfigType(*traitConfig.Type) == TraitConfigType::Combat) - { - if (int32(*player->m_activePlayerData->ActiveCombatTraitConfigID) != traitConfig.ID - || !EnumFlag(TraitCombatConfigFlags(*traitConfig.CombatConfigFlags)).HasFlag(TraitCombatConfigFlags::ActiveForSpec)) - continue; - } - - for (UF::TraitEntry const& traitEntry : traitConfig.Entries) - if (traitEntry.TraitNodeEntryID == traitNodeEntryId) - return traitEntry.Rank; - } - return {}; - }; - - std::array<bool, std::tuple_size_v<decltype(condition->TraitNodeEntryID)>> results; - results.fill(true); - for (std::size_t i = 0; i < condition->TraitNodeEntryID.size(); ++i) - { - if (!condition->TraitNodeEntryID[i]) - continue; - - Optional<int32> rank = getTraitNodeEntryRank(condition->TraitNodeEntryID[i]); - if (!rank) - results[i] = false; - else if (condition->TraitNodeEntryMinRank[i] && rank < condition->TraitNodeEntryMinRank[i]) - results[i] = false; - else if (condition->TraitNodeEntryMaxRank[i] && rank > condition->TraitNodeEntryMaxRank[i]) - results[i] = false; - } - - if (!PlayerConditionLogic(condition->TraitNodeEntryLogic, results)) - return false; - } - return true; } diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 6b882eb1bcd..8b233144e1b 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -73,7 +73,6 @@ DB2Storage<AzeritePowerEntry> sAzeritePowerStore("AzeritePower DB2Storage<AzeritePowerSetMemberEntry> sAzeritePowerSetMemberStore("AzeritePowerSetMember.db2", &AzeritePowerSetMemberLoadInfo::Instance); DB2Storage<AzeriteTierUnlockEntry> sAzeriteTierUnlockStore("AzeriteTierUnlock.db2", &AzeriteTierUnlockLoadInfo::Instance); DB2Storage<AzeriteTierUnlockSetEntry> sAzeriteTierUnlockSetStore("AzeriteTierUnlockSet.db2", &AzeriteTierUnlockSetLoadInfo::Instance); -DB2Storage<AzeriteUnlockMappingEntry> sAzeriteUnlockMappingStore("AzeriteUnlockMapping.db2", &AzeriteUnlockMappingLoadInfo::Instance); DB2Storage<BankBagSlotPricesEntry> sBankBagSlotPricesStore("BankBagSlotPrices.db2", &BankBagSlotPricesLoadInfo::Instance); DB2Storage<BannedAddonsEntry> sBannedAddonsStore("BannedAddons.db2", &BannedAddonsLoadInfo::Instance); DB2Storage<BarberShopStyleEntry> sBarberShopStyleStore("BarberShopStyle.db2", &BarberShopStyleLoadInfo::Instance); @@ -84,10 +83,8 @@ DB2Storage<BattlePetSpeciesEntry> sBattlePetSpeciesStore("BattlePe DB2Storage<BattlePetSpeciesStateEntry> sBattlePetSpeciesStateStore("BattlePetSpeciesState.db2", &BattlePetSpeciesStateLoadInfo::Instance); DB2Storage<BattlemasterListEntry> sBattlemasterListStore("BattlemasterList.db2", &BattlemasterListLoadInfo::Instance); DB2Storage<BroadcastTextEntry> sBroadcastTextStore("BroadcastText.db2", &BroadcastTextLoadInfo::Instance); -DB2Storage<BroadcastTextDurationEntry> sBroadcastTextDurationStore("BroadcastTextDuration.db2", &BroadcastTextDurationLoadInfo::Instance); DB2Storage<Cfg_CategoriesEntry> sCfgCategoriesStore("Cfg_Categories.db2", &CfgCategoriesLoadInfo::Instance); DB2Storage<Cfg_RegionsEntry> sCfgRegionsStore("Cfg_Regions.db2", &CfgRegionsLoadInfo::Instance); -DB2Storage<ChallengeModeItemBonusOverrideEntry> sChallengeModeItemBonusOverrideStore("ChallengeModeItemBonusOverride.db2", &ChallengeModeItemBonusOverrideLoadInfo::Instance); DB2Storage<CharTitlesEntry> sCharTitlesStore("CharTitles.db2", &CharTitlesLoadInfo::Instance); DB2Storage<CharacterLoadoutEntry> sCharacterLoadoutStore("CharacterLoadout.db2", &CharacterLoadoutLoadInfo::Instance); DB2Storage<CharacterLoadoutItemEntry> sCharacterLoadoutItemStore("CharacterLoadoutItem.db2", &CharacterLoadoutItemLoadInfo::Instance); @@ -110,10 +107,7 @@ DB2Storage<CinematicSequencesEntry> sCinematicSequencesStore("Cinema DB2Storage<ConditionalChrModelEntry> sConditionalChrModelStore("ConditionalChrModel.db2", &ConditionalChrModelLoadInfo::Instance); DB2Storage<ConditionalContentTuningEntry> sConditionalContentTuningStore("ConditionalContentTuning.db2", &ConditionalContentTuningLoadInfo::Instance); DB2Storage<ContentTuningEntry> sContentTuningStore("ContentTuning.db2", &ContentTuningLoadInfo::Instance); -DB2Storage<ContentTuningXExpectedEntry> sContentTuningXExpectedStore("ContentTuningXExpected.db2", &ContentTuningXExpectedLoadInfo::Instance); -DB2Storage<ContentTuningXLabelEntry> sContentTuningXLabelStore("ContentTuningXLabel.db2", &ContentTuningXLabelLoadInfo::Instance); DB2Storage<ConversationLineEntry> sConversationLineStore("ConversationLine.db2", &ConversationLineLoadInfo::Instance); -DB2Storage<CorruptionEffectsEntry> sCorruptionEffectsStore("CorruptionEffects.db2", &CorruptionEffectsLoadInfo::Instance); DB2Storage<CreatureDisplayInfoEntry> sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", &CreatureDisplayInfoLoadInfo::Instance); DB2Storage<CreatureDisplayInfoExtraEntry> sCreatureDisplayInfoExtraStore("CreatureDisplayInfoExtra.db2", &CreatureDisplayInfoExtraLoadInfo::Instance); DB2Storage<CreatureFamilyEntry> sCreatureFamilyStore("CreatureFamily.db2", &CreatureFamilyLoadInfo::Instance); @@ -156,7 +150,6 @@ DB2Storage<GarrSiteLevelEntry> sGarrSiteLevelStore("GarrSiteLev DB2Storage<GarrSiteLevelPlotInstEntry> sGarrSiteLevelPlotInstStore("GarrSiteLevelPlotInst.db2", &GarrSiteLevelPlotInstLoadInfo::Instance); DB2Storage<GarrTalentTreeEntry> sGarrTalentTreeStore("GarrTalentTree.db2", &GarrTalentTreeLoadInfo::Instance); DB2Storage<GemPropertiesEntry> sGemPropertiesStore("GemProperties.db2", &GemPropertiesLoadInfo::Instance); -DB2Storage<GlobalCurveEntry> sGlobalCurveStore("GlobalCurve.db2", &GlobalCurveLoadInfo::Instance); DB2Storage<GlyphBindableSpellEntry> sGlyphBindableSpellStore("GlyphBindableSpell.db2", &GlyphBindableSpellLoadInfo::Instance); DB2Storage<GlyphPropertiesEntry> sGlyphPropertiesStore("GlyphProperties.db2", &GlyphPropertiesLoadInfo::Instance); DB2Storage<GlyphRequiredSpecEntry> sGlyphRequiredSpecStore("GlyphRequiredSpec.db2", &GlyphRequiredSpecLoadInfo::Instance); @@ -177,9 +170,7 @@ DB2Storage<ItemArmorShieldEntry> sItemArmorShieldStore("ItemArmor DB2Storage<ItemArmorTotalEntry> sItemArmorTotalStore("ItemArmorTotal.db2", &ItemArmorTotalLoadInfo::Instance); DB2Storage<ItemBagFamilyEntry> sItemBagFamilyStore("ItemBagFamily.db2", &ItemBagFamilyLoadInfo::Instance); DB2Storage<ItemBonusEntry> sItemBonusStore("ItemBonus.db2", &ItemBonusLoadInfo::Instance); -DB2Storage<ItemBonusListGroupEntryEntry> sItemBonusListGroupEntryStore("ItemBonusListGroupEntry.db2", &ItemBonusListGroupEntryLoadInfo::Instance); DB2Storage<ItemBonusListLevelDeltaEntry> sItemBonusListLevelDeltaStore("ItemBonusListLevelDelta.db2", &ItemBonusListLevelDeltaLoadInfo::Instance); -DB2Storage<ItemBonusTreeEntry> sItemBonusTreeStore("ItemBonusTree.db2", &ItemBonusTreeLoadInfo::Instance); DB2Storage<ItemBonusTreeNodeEntry> sItemBonusTreeNodeStore("ItemBonusTreeNode.db2", &ItemBonusTreeNodeLoadInfo::Instance); DB2Storage<ItemChildEquipmentEntry> sItemChildEquipmentStore("ItemChildEquipment.db2", &ItemChildEquipmentLoadInfo::Instance); DB2Storage<ItemClassEntry> sItemClassStore("ItemClass.db2", &ItemClassLoadInfo::Instance); @@ -210,7 +201,6 @@ DB2Storage<ItemSparseEntry> sItemSparseStore("ItemSparse.db2 DB2Storage<ItemSpecEntry> sItemSpecStore("ItemSpec.db2", &ItemSpecLoadInfo::Instance); DB2Storage<ItemSpecOverrideEntry> sItemSpecOverrideStore("ItemSpecOverride.db2", &ItemSpecOverrideLoadInfo::Instance); DB2Storage<ItemXBonusTreeEntry> sItemXBonusTreeStore("ItemXBonusTree.db2", &ItemXBonusTreeLoadInfo::Instance); -DB2Storage<ItemXItemEffectEntry> sItemXItemEffectStore("ItemXItemEffect.db2", &ItemXItemEffectLoadInfo::Instance); DB2Storage<JournalEncounterEntry> sJournalEncounterStore("JournalEncounter.db2", &JournalEncounterLoadInfo::Instance); DB2Storage<JournalEncounterSectionEntry> sJournalEncounterSectionStore("JournalEncounterSection.db2", &JournalEncounterSectionLoadInfo::Instance); DB2Storage<JournalInstanceEntry> sJournalInstanceStore("JournalInstance.db2", &JournalInstanceLoadInfo::Instance); @@ -228,7 +218,6 @@ DB2Storage<MapEntry> sMapStore("Map.db2", &MapLoadInf DB2Storage<MapChallengeModeEntry> sMapChallengeModeStore("MapChallengeMode.db2", &MapChallengeModeLoadInfo::Instance); DB2Storage<MapDifficultyEntry> sMapDifficultyStore("MapDifficulty.db2", &MapDifficultyLoadInfo::Instance); DB2Storage<MapDifficultyXConditionEntry> sMapDifficultyXConditionStore("MapDifficultyXCondition.db2", &MapDifficultyXConditionLoadInfo::Instance); -DB2Storage<MawPowerEntry> sMawPowerStore("MawPower.db2", &MawPowerLoadInfo::Instance); DB2Storage<ModifierTreeEntry> sModifierTreeStore("ModifierTree.db2", &ModifierTreeLoadInfo::Instance); DB2Storage<MountCapabilityEntry> sMountCapabilityStore("MountCapability.db2", &MountCapabilityLoadInfo::Instance); DB2Storage<MountEntry> sMountStore("Mount.db2", &MountLoadInfo::Instance); @@ -279,7 +268,6 @@ DB2Storage<SkillLineEntry> sSkillLineStore("SkillLine.db2", DB2Storage<SkillLineAbilityEntry> sSkillLineAbilityStore("SkillLineAbility.db2", &SkillLineAbilityLoadInfo::Instance); DB2Storage<SkillLineXTraitTreeEntry> sSkillLineXTraitTreeStore("SkillLineXTraitTree.db2", &SkillLineXTraitTreeLoadInfo::Instance); DB2Storage<SkillRaceClassInfoEntry> sSkillRaceClassInfoStore("SkillRaceClassInfo.db2", &SkillRaceClassInfoLoadInfo::Instance); -DB2Storage<SoulbindConduitRankEntry> sSoulbindConduitRankStore("SoulbindConduitRank.db2", &SoulbindConduitRankLoadInfo::Instance); DB2Storage<SoundKitEntry> sSoundKitStore("SoundKit.db2", &SoundKitLoadInfo::Instance); DB2Storage<SpecializationSpellsEntry> sSpecializationSpellsStore("SpecializationSpells.db2", &SpecializationSpellsLoadInfo::Instance); DB2Storage<SpecSetMemberEntry> sSpecSetMemberStore("SpecSetMember.db2", &SpecSetMemberLoadInfo::Instance); @@ -354,7 +342,6 @@ DB2Storage<TraitTreeLoadoutEntryEntry> sTraitTreeLoadoutEntryStore("Tra DB2Storage<TraitTreeXTraitCostEntry> sTraitTreeXTraitCostStore("TraitTreeXTraitCost.db2", &TraitTreeXTraitCostLoadInfo::Instance); DB2Storage<TraitTreeXTraitCurrencyEntry> sTraitTreeXTraitCurrencyStore("TraitTreeXTraitCurrency.db2", &TraitTreeXTraitCurrencyLoadInfo::Instance); DB2Storage<TransmogHolidayEntry> sTransmogHolidayStore("TransmogHoliday.db2", &TransmogHolidayLoadInfo::Instance); -DB2Storage<TransmogIllusionEntry> sTransmogIllusionStore("TransmogIllusion.db2", &TransmogIllusionLoadInfo::Instance); DB2Storage<TransmogSetEntry> sTransmogSetStore("TransmogSet.db2", &TransmogSetLoadInfo::Instance); DB2Storage<TransmogSetGroupEntry> sTransmogSetGroupStore("TransmogSetGroup.db2", &TransmogSetGroupLoadInfo::Instance); DB2Storage<TransmogSetItemEntry> sTransmogSetItemStore("TransmogSetItem.db2", &TransmogSetItemLoadInfo::Instance); @@ -364,7 +351,6 @@ DB2Storage<UiMapEntry> sUiMapStore("UiMap.db2", &UiMapL DB2Storage<UiMapAssignmentEntry> sUiMapAssignmentStore("UiMapAssignment.db2", &UiMapAssignmentLoadInfo::Instance); DB2Storage<UiMapLinkEntry> sUiMapLinkStore("UiMapLink.db2", &UiMapLinkLoadInfo::Instance); DB2Storage<UiMapXMapArtEntry> sUiMapXMapArtStore("UiMapXMapArt.db2", &UiMapXMapArtLoadInfo::Instance); -DB2Storage<UISplashScreenEntry> sUISplashScreenStore("UISplashScreen.db2", &UiSplashScreenLoadInfo::Instance); DB2Storage<UnitConditionEntry> sUnitConditionStore("UnitCondition.db2", &UnitConditionLoadInfo::Instance); DB2Storage<UnitPowerBarEntry> sUnitPowerBarStore("UnitPowerBar.db2", &UnitPowerBarLoadInfo::Instance); DB2Storage<VehicleEntry> sVehicleStore("Vehicle.db2", &VehicleLoadInfo::Instance); @@ -447,7 +433,6 @@ namespace std::array<AzeriteItemMilestonePowerEntry const*, MAX_AZERITE_ESSENCE_SLOT> _azeriteItemMilestonePowerByEssenceSlot; std::unordered_map<uint32 /*azeritePowerSetId*/, std::vector<AzeritePowerSetMemberEntry const*>> _azeritePowers; std::unordered_map<std::pair<uint32 /*azeriteUnlockSetId*/, ItemContext>, std::array<uint8, MAX_AZERITE_EMPOWERED_TIER>> _azeriteTierUnlockLevels; - std::unordered_map<std::pair<int32 /*broadcastTextId*/, CascLocaleBit /*cascLocaleBit*/>, int32> _broadcastTextDurations; std::array<ChrClassUIDisplayEntry const*, MAX_CLASSES> _uiDisplayByClass; std::array<std::array<uint32, MAX_POWERS>, MAX_CLASSES> _powersByClass; std::unordered_map<uint32 /*chrCustomizationOptionId*/, std::vector<ChrCustomizationChoiceEntry const*>> _chrCustomizationChoicesByOption; @@ -457,12 +442,10 @@ namespace std::unordered_map<uint32 /*chrCustomizationReqId*/, std::vector<std::pair<uint32 /*chrCustomizationOptionId*/, std::vector<uint32>>>> _chrCustomizationRequiredChoices; ChrSpecializationByIndexContainer _chrSpecializationsByIndex; std::unordered_multimap<uint32, ConditionalContentTuningEntry const*> _conditionalContentTuning; - std::unordered_set<std::pair<uint32, int32>> _contentTuningLabels; std::unordered_multimap<uint32, CurrencyContainerEntry const*> _currencyContainers; CurvePointsContainer _curvePoints; EmotesTextSoundContainer _emoteTextSounds; std::unordered_map<std::pair<uint32 /*level*/, int32 /*expansion*/>, ExpectedStatEntry const*> _expectedStatsByLevel; - std::unordered_map<uint32 /*contentTuningId*/, std::vector<ContentTuningXExpectedEntry const*>> _expectedStatModsByContentTuning; FactionTeamContainer _factionTeams; std::unordered_map<uint32, std::set<FriendshipRepReactionEntry const*, DB2Manager::FriendshipRepReactionEntryComparator>> _friendshipRepReactions; HeirloomItemsContainer _heirlooms; @@ -495,7 +478,6 @@ namespace std::unordered_map<uint32, std::vector<SkillLineEntry const*>> _skillLinesByParentSkillLine; std::unordered_map<uint32, std::vector<SkillLineAbilityEntry const*>> _skillLineAbilitiesBySkillupSkill; SkillRaceClassInfoContainer _skillRaceClassInfoBySkill; - std::unordered_map<std::pair<int32, int32>, SoulbindConduitRankEntry const*> _soulbindConduitRanks; SpecializationSpellsContainer _specializationSpellsBySpec; std::unordered_set<std::pair<int32, uint32>> _specsBySpecSet; std::unordered_set<uint8> _spellFamilyNames; @@ -504,7 +486,6 @@ namespace TalentsByPosition _talentsByPosition; std::unordered_map<std::pair<uint32, uint32>, TaxiPathEntry const*> _taxiPaths; ToyItemIdsContainer _toys; - std::unordered_map<uint32, TransmogIllusionEntry const*> _transmogIllusionsByEnchantmentId; std::unordered_map<uint32, std::vector<TransmogSetEntry const*>> _transmogSetsByItemModifiedAppearance; std::unordered_map<uint32, std::vector<TransmogSetItemEntry const*>> _transmogSetItemsByTransmogSet; std::unordered_map<int32, UiMapBounds> _uiMapBounds; @@ -669,7 +650,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sAzeritePowerSetMemberStore); LOAD_DB2(sAzeriteTierUnlockStore); LOAD_DB2(sAzeriteTierUnlockSetStore); - LOAD_DB2(sAzeriteUnlockMappingStore); LOAD_DB2(sBankBagSlotPricesStore); LOAD_DB2(sBannedAddonsStore); LOAD_DB2(sBarberShopStyleStore); @@ -680,10 +660,8 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sBattlePetSpeciesStateStore); LOAD_DB2(sBattlemasterListStore); LOAD_DB2(sBroadcastTextStore); - LOAD_DB2(sBroadcastTextDurationStore); LOAD_DB2(sCfgCategoriesStore); LOAD_DB2(sCfgRegionsStore); - LOAD_DB2(sChallengeModeItemBonusOverrideStore); LOAD_DB2(sCharTitlesStore); LOAD_DB2(sCharacterLoadoutStore); LOAD_DB2(sCharacterLoadoutItemStore); @@ -706,10 +684,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sConditionalChrModelStore); LOAD_DB2(sConditionalContentTuningStore); LOAD_DB2(sContentTuningStore); - LOAD_DB2(sContentTuningXExpectedStore); - LOAD_DB2(sContentTuningXLabelStore); LOAD_DB2(sConversationLineStore); - LOAD_DB2(sCorruptionEffectsStore); LOAD_DB2(sCreatureDisplayInfoStore); LOAD_DB2(sCreatureDisplayInfoExtraStore); LOAD_DB2(sCreatureFamilyStore); @@ -752,7 +727,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sGarrSiteLevelPlotInstStore); LOAD_DB2(sGarrTalentTreeStore); LOAD_DB2(sGemPropertiesStore); - LOAD_DB2(sGlobalCurveStore); LOAD_DB2(sGlyphBindableSpellStore); LOAD_DB2(sGlyphPropertiesStore); LOAD_DB2(sGlyphRequiredSpecStore); @@ -773,9 +747,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sItemArmorTotalStore); LOAD_DB2(sItemBagFamilyStore); LOAD_DB2(sItemBonusStore); - LOAD_DB2(sItemBonusListGroupEntryStore); LOAD_DB2(sItemBonusListLevelDeltaStore); - LOAD_DB2(sItemBonusTreeStore); LOAD_DB2(sItemBonusTreeNodeStore); LOAD_DB2(sItemChildEquipmentStore); LOAD_DB2(sItemClassStore); @@ -806,7 +778,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sItemSpecStore); LOAD_DB2(sItemSpecOverrideStore); LOAD_DB2(sItemXBonusTreeStore); - LOAD_DB2(sItemXItemEffectStore); LOAD_DB2(sJournalEncounterStore); LOAD_DB2(sJournalEncounterSectionStore); LOAD_DB2(sJournalInstanceStore); @@ -824,7 +795,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sMapChallengeModeStore); LOAD_DB2(sMapDifficultyStore); LOAD_DB2(sMapDifficultyXConditionStore); - LOAD_DB2(sMawPowerStore); LOAD_DB2(sModifierTreeStore); LOAD_DB2(sMountCapabilityStore); LOAD_DB2(sMountStore); @@ -875,7 +845,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sSkillLineAbilityStore); LOAD_DB2(sSkillLineXTraitTreeStore); LOAD_DB2(sSkillRaceClassInfoStore); - LOAD_DB2(sSoulbindConduitRankStore); LOAD_DB2(sSoundKitStore); LOAD_DB2(sSpecializationSpellsStore); LOAD_DB2(sSpecSetMemberStore); @@ -950,7 +919,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sTraitTreeXTraitCostStore); LOAD_DB2(sTraitTreeXTraitCurrencyStore); LOAD_DB2(sTransmogHolidayStore); - LOAD_DB2(sTransmogIllusionStore); LOAD_DB2(sTransmogSetStore); LOAD_DB2(sTransmogSetGroupStore); LOAD_DB2(sTransmogSetItemStore); @@ -960,7 +928,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sUiMapAssignmentStore); LOAD_DB2(sUiMapLinkStore); LOAD_DB2(sUiMapXMapArtStore); - LOAD_DB2(sUISplashScreenStore); LOAD_DB2(sUnitConditionStore); LOAD_DB2(sUnitPowerBarStore); LOAD_DB2(sVehicleStore); @@ -1062,10 +1029,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul } } - _broadcastTextDurations.reserve(sBroadcastTextDurationStore.GetNumRows()); - for (BroadcastTextDurationEntry const* broadcastTextDuration : sBroadcastTextDurationStore) - _broadcastTextDurations[{ broadcastTextDuration->BroadcastTextID, CascLocaleBit(broadcastTextDuration->Locale) }] = broadcastTextDuration->Duration; - for (ChrClassUIDisplayEntry const* uiDisplay : sChrClassUIDisplayStore) { ASSERT(uiDisplay->ChrClassesID < MAX_CLASSES); @@ -1199,13 +1162,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul for (ConditionalContentTuningEntry const* conditionalContentTuning : sConditionalContentTuningStore) _conditionalContentTuning.emplace(conditionalContentTuning->ParentContentTuningID, conditionalContentTuning); - for (ContentTuningXExpectedEntry const* contentTuningXExpectedStat : sContentTuningXExpectedStore) - if (sExpectedStatModStore.LookupEntry(contentTuningXExpectedStat->ExpectedStatModID)) - _expectedStatModsByContentTuning[contentTuningXExpectedStat->ContentTuningID].push_back(contentTuningXExpectedStat); - - for (ContentTuningXLabelEntry const* contentTuningXLabel : sContentTuningXLabelStore) - _contentTuningLabels.emplace(contentTuningXLabel->ContentTuningID, contentTuningXLabel->LabelID); - for (CurrencyContainerEntry const* currencyContainer : sCurrencyContainerStore) _currencyContainers.emplace(currencyContainer->CurrencyTypesID, currencyContainer); @@ -1428,9 +1384,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul if (sSkillLineStore.LookupEntry(entry->SkillID)) _skillRaceClassInfoBySkill.insert(SkillRaceClassInfoContainer::value_type(entry->SkillID, entry)); - for (SoulbindConduitRankEntry const* soulbindConduitRank : sSoulbindConduitRankStore) - _soulbindConduitRanks[{ soulbindConduitRank->SoulbindConduitID, soulbindConduitRank->RankIndex }] = soulbindConduitRank; - for (SpecializationSpellsEntry const* specSpells : sSpecializationSpellsStore) _specializationSpellsBySpec[specSpells->SpecID].push_back(specSpells); @@ -1479,9 +1432,6 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul for (ToyEntry const* toy : sToyStore) _toys.insert(toy->ItemID); - for (TransmogIllusionEntry const* transmogIllusion : sTransmogIllusionStore) - _transmogIllusionsByEnchantmentId[transmogIllusion->SpellItemEnchantmentID] = transmogIllusion; - for (TransmogSetItemEntry const* transmogSetItem : sTransmogSetItemStore) { TransmogSetEntry const* set = sTransmogSetStore.LookupEntry(transmogSetItem->TransmogSetID); @@ -1903,22 +1853,6 @@ bool DB2Manager::IsInArea(uint32 objectAreaId, uint32 areaId) return false; } -ContentTuningEntry const* DB2Manager::GetContentTuningForArea(AreaTableEntry const* areaEntry) -{ - if (!areaEntry) - return nullptr; - - // Get ContentTuning for the area - if (ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(areaEntry->ContentTuningID)) - return contentTuning; - - // If there is no data for the current area and it has a parent area, get data from the last (recursive) - if (AreaTableEntry const* parentAreaEntry = sAreaTableStore.LookupEntry(areaEntry->ParentAreaID)) - return GetContentTuningForArea(parentAreaEntry); - - return nullptr; -} - std::vector<ArtifactPowerEntry const*> DB2Manager::GetArtifactPowers(uint8 artifactId) const { auto itr = _artifactPowers.find(artifactId); @@ -2003,11 +1937,6 @@ char const* DB2Manager::GetBroadcastTextValue(BroadcastTextEntry const* broadcas return broadcastText->Text[DEFAULT_LOCALE]; } -int32 const* DB2Manager::GetBroadcastTextDuration(int32 broadcastTextId, LocaleConstant locale /*= DEFAULT_LOCALE*/) const -{ - return Trinity::Containers::MapGetValuePtr(_broadcastTextDurations, { broadcastTextId, WowLocaleToCascLocaleBit[locale] }); -} - ChrClassUIDisplayEntry const* DB2Manager::GetUiDisplayForClass(Classes unitClass) const { ASSERT(unitClass < MAX_CLASSES); @@ -2073,67 +2002,32 @@ ChrSpecializationEntry const* DB2Manager::GetDefaultChrSpecializationForClass(ui return GetChrSpecializationByIndex(class_, INITIAL_SPECIALIZATION_INDEX); } -uint32 DB2Manager::GetRedirectedContentTuningId(uint32 contentTuningId, uint32 redirectFlag) const -{ - for (auto [_, conditionalContentTuning] : Trinity::Containers::MapEqualRange(_conditionalContentTuning, contentTuningId)) - if (conditionalContentTuning->RedirectFlag & redirectFlag) - return conditionalContentTuning->RedirectContentTuningID; - - return contentTuningId; -} - -Optional<ContentTuningLevels> DB2Manager::GetContentTuningData(uint32 contentTuningId, uint32 redirectFlag, bool forItem /*= false*/) const +Optional<ContentTuningLevels> DB2Manager::GetContentTuningData(uint32 contentTuningId, bool forItem /*= false*/) const { - ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(GetRedirectedContentTuningId(contentTuningId, redirectFlag)); + ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(contentTuningId); if (!contentTuning) return {}; if (forItem && contentTuning->GetFlags().HasFlag(ContentTuningFlag::DisabledForItem)) return {}; - auto getLevelAdjustment = [](ContentTuningCalcType type) -> int32 - { - switch (type) - { - case ContentTuningCalcType::PlusOne: - return 1; - case ContentTuningCalcType::PlusMaxLevelForExpansion: - return GetMaxLevelForExpansion(sWorld->getIntConfig(CONFIG_EXPANSION)); - default: - break; - } - - return 0; - }; ContentTuningLevels levels; - levels.MinLevel = contentTuning->MinLevel + getLevelAdjustment(static_cast<ContentTuningCalcType>(contentTuning->MinLevelType)); - levels.MaxLevel = contentTuning->MaxLevel + getLevelAdjustment(static_cast<ContentTuningCalcType>(contentTuning->MaxLevelType)); - levels.MinLevelWithDelta = std::clamp<int32>(levels.MinLevel + contentTuning->TargetLevelDelta, 1, MAX_LEVEL); - levels.MaxLevelWithDelta = std::clamp<int32>(levels.MaxLevel + contentTuning->TargetLevelMaxDelta, 1, MAX_LEVEL); + levels.MinLevel = contentTuning->MinLevel; + levels.MaxLevel = contentTuning->MaxLevel; + levels.MinLevelWithDelta = std::clamp<int32>(levels.MinLevel, 1, MAX_LEVEL); + levels.MaxLevelWithDelta = std::clamp<int32>(levels.MaxLevel, 1, MAX_LEVEL); // clamp after calculating levels with delta (delta can bring "overflown" level back into correct range) levels.MinLevel = std::clamp<int32>(levels.MinLevel, 1, MAX_LEVEL); levels.MaxLevel = std::clamp<int32>(levels.MaxLevel, 1, MAX_LEVEL); - if (contentTuning->TargetLevelMin) - levels.TargetLevelMin = contentTuning->TargetLevelMin; - else - levels.TargetLevelMin = levels.MinLevelWithDelta; - - if (contentTuning->TargetLevelMax) - levels.TargetLevelMax = contentTuning->TargetLevelMax; - else - levels.TargetLevelMax = levels.MaxLevelWithDelta; + levels.TargetLevelMin = levels.MinLevelWithDelta; + levels.TargetLevelMax = levels.MaxLevelWithDelta; return levels; } -bool DB2Manager::HasContentTuningLabel(uint32 contentTuningId, int32 label) const -{ - return _contentTuningLabels.contains({ contentTuningId, label }); -} - char const* DB2Manager::GetCreatureFamilyPetName(uint32 petfamily, LocaleConstant locale) { if (!petfamily) @@ -2324,31 +2218,6 @@ EmotesTextSoundEntry const* DB2Manager::GetTextSoundEmoteFor(uint32 emote, uint8 return nullptr; } -template<float(ExpectedStatModEntry::*field)> -struct ExpectedStatModReducer -{ - explicit ExpectedStatModReducer(int32 mythicPlusMilestoneSeason) : ActiveMilestoneSeason(mythicPlusMilestoneSeason) { } - - float operator()(float mod, ContentTuningXExpectedEntry const* contentTuningXExpected) const - { - if (!contentTuningXExpected) - return mod; - - if (contentTuningXExpected->MinMythicPlusSeasonID) - if (MythicPlusSeasonEntry const* mythicPlusSeason = sMythicPlusSeasonStore.LookupEntry(contentTuningXExpected->MinMythicPlusSeasonID)) - if (ActiveMilestoneSeason < mythicPlusSeason->MilestoneSeason) - return mod; - - if (contentTuningXExpected->MaxMythicPlusSeasonID) - if (MythicPlusSeasonEntry const* mythicPlusSeason = sMythicPlusSeasonStore.LookupEntry(contentTuningXExpected->MaxMythicPlusSeasonID)) - if (ActiveMilestoneSeason >= mythicPlusSeason->MilestoneSeason) - return mod; - - return mod * sExpectedStatModStore.AssertEntry(contentTuningXExpected->ExpectedStatModID)->*field; - } - - int32 ActiveMilestoneSeason = 0; -}; float DB2Manager::EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 contentTuningId, Classes unitClass, int32 mythicPlusMilestoneSeason) const { @@ -2378,71 +2247,46 @@ float DB2Manager::EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int3 break; } - std::vector<ContentTuningXExpectedEntry const*> const* contentTuningMods = Trinity::Containers::MapGetValuePtr(_expectedStatModsByContentTuning, contentTuningId); float value = 0.0f; switch (stat) { case ExpectedStatType::CreatureHealth: value = expectedStatItr->second->CreatureHealth; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::CreatureHealthMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->CreatureHealthMod; break; case ExpectedStatType::PlayerHealth: value = expectedStatItr->second->PlayerHealth; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::PlayerHealthMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->PlayerHealthMod; break; case ExpectedStatType::CreatureAutoAttackDps: value = expectedStatItr->second->CreatureAutoAttackDps; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::CreatureAutoAttackDPSMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->CreatureAutoAttackDPSMod; break; case ExpectedStatType::CreatureArmor: value = expectedStatItr->second->CreatureArmor; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::CreatureArmorMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->CreatureArmorMod; break; case ExpectedStatType::PlayerMana: value = expectedStatItr->second->PlayerMana; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::PlayerManaMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->PlayerManaMod; break; case ExpectedStatType::PlayerPrimaryStat: value = expectedStatItr->second->PlayerPrimaryStat; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::PlayerPrimaryStatMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->PlayerPrimaryStatMod; break; case ExpectedStatType::PlayerSecondaryStat: value = expectedStatItr->second->PlayerSecondaryStat; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::PlayerSecondaryStatMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->PlayerSecondaryStatMod; break; case ExpectedStatType::ArmorConstant: value = expectedStatItr->second->ArmorConstant; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::ArmorConstantMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->ArmorConstantMod; break; @@ -2450,9 +2294,6 @@ float DB2Manager::EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int3 break; case ExpectedStatType::CreatureSpellDamage: value = expectedStatItr->second->CreatureSpellDamage; - if (contentTuningMods) - value *= std::accumulate(contentTuningMods->begin(), contentTuningMods->end(), 1.0f, - ExpectedStatModReducer<&ExpectedStatModEntry::CreatureSpellDamageMod>(mythicPlusMilestoneSeason)); if (classMod) value *= classMod->CreatureSpellDamageMod; break; @@ -2473,15 +2314,6 @@ DB2Manager::FriendshipRepReactionSet const* DB2Manager::GetFriendshipRepReaction return Trinity::Containers::MapGetValuePtr(_friendshipRepReactions, friendshipRepID); } -uint32 DB2Manager::GetGlobalCurveId(GlobalCurve globalCurveType) const -{ - for (GlobalCurveEntry const* globalCurveEntry : sGlobalCurveStore) - if (GlobalCurve(globalCurveEntry->Type) == globalCurveType) - return globalCurveEntry->CurveID; - - return 0; -} - std::vector<uint32> const* DB2Manager::GetGlyphBindableSpells(uint32 glyphPropertiesId) const { return Trinity::Containers::MapGetValuePtr(_glyphBindableSpells, glyphPropertiesId); @@ -2920,11 +2752,6 @@ std::vector<SkillRaceClassInfoEntry const*> DB2Manager::GetSkillRaceClassInfo(ui return result; } -SoulbindConduitRankEntry const* DB2Manager::GetSoulbindConduitRank(int32 soulbindConduitId, int32 rank) const -{ - return Trinity::Containers::MapGetValuePtr(_soulbindConduitRanks, { soulbindConduitId, rank }); -} - std::vector<SpecializationSpellsEntry const*> const* DB2Manager::GetSpecializationSpells(uint32 specId) const { return Trinity::Containers::MapGetValuePtr(_specializationSpellsBySpec, specId); @@ -2990,11 +2817,6 @@ bool DB2Manager::IsToyItem(uint32 toy) const return _toys.count(toy) > 0; } -TransmogIllusionEntry const* DB2Manager::GetTransmogIllusionForEnchantment(uint32 spellItemEnchantmentId) const -{ - return Trinity::Containers::MapGetValuePtr(_transmogIllusionsByEnchantmentId, spellItemEnchantmentId); -} - std::vector<TransmogSetEntry const*> const* DB2Manager::GetTransmogSetsForItemModifiedAppearance(uint32 itemModifiedAppearanceId) const { return Trinity::Containers::MapGetValuePtr(_transmogSetsByItemModifiedAppearance, itemModifiedAppearanceId); diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index a8f40b74d48..5f8b611f26b 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -58,7 +58,6 @@ TC_GAME_API extern DB2Storage<AzeriteKnowledgeMultiplierEntry> sAzeriteKnow TC_GAME_API extern DB2Storage<AzeriteItemMilestonePowerEntry> sAzeriteItemMilestonePowerStore; TC_GAME_API extern DB2Storage<AzeriteLevelInfoEntry> sAzeriteLevelInfoStore; TC_GAME_API extern DB2Storage<AzeritePowerEntry> sAzeritePowerStore; -TC_GAME_API extern DB2Storage<AzeriteUnlockMappingEntry> sAzeriteUnlockMappingStore; TC_GAME_API extern DB2Storage<BankBagSlotPricesEntry> sBankBagSlotPricesStore; TC_GAME_API extern DB2Storage<BannedAddonsEntry> sBannedAddonsStore; TC_GAME_API extern DB2Storage<BarberShopStyleEntry> sBarberShopStyleStore; @@ -71,7 +70,6 @@ TC_GAME_API extern DB2Storage<BattlemasterListEntry> sBattlemaste TC_GAME_API extern DB2Storage<BroadcastTextEntry> sBroadcastTextStore; TC_GAME_API extern DB2Storage<Cfg_CategoriesEntry> sCfgCategoriesStore; TC_GAME_API extern DB2Storage<Cfg_RegionsEntry> sCfgRegionsStore; -TC_GAME_API extern DB2Storage<ChallengeModeItemBonusOverrideEntry> sChallengeModeItemBonusOverrideStore; TC_GAME_API extern DB2Storage<CharTitlesEntry> sCharTitlesStore; TC_GAME_API extern DB2Storage<CharacterLoadoutEntry> sCharacterLoadoutStore; TC_GAME_API extern DB2Storage<CharacterLoadoutItemEntry> sCharacterLoadoutItemStore; @@ -86,7 +84,6 @@ TC_GAME_API extern DB2Storage<CinematicSequencesEntry> sCinematicSe TC_GAME_API extern DB2Storage<ConditionalChrModelEntry> sConditionalChrModelStore; TC_GAME_API extern DB2Storage<ContentTuningEntry> sContentTuningStore; TC_GAME_API extern DB2Storage<ConversationLineEntry> sConversationLineStore; -TC_GAME_API extern DB2Storage<CorruptionEffectsEntry> sCorruptionEffectsStore; TC_GAME_API extern DB2Storage<CreatureDisplayInfoEntry> sCreatureDisplayInfoStore; TC_GAME_API extern DB2Storage<CreatureDisplayInfoExtraEntry> sCreatureDisplayInfoExtraStore; TC_GAME_API extern DB2Storage<CreatureFamilyEntry> sCreatureFamilyStore; @@ -141,9 +138,7 @@ TC_GAME_API extern DB2Storage<ItemArmorShieldEntry> sItemArmorSh TC_GAME_API extern DB2Storage<ItemArmorTotalEntry> sItemArmorTotalStore; TC_GAME_API extern DB2Storage<ItemBagFamilyEntry> sItemBagFamilyStore; TC_GAME_API extern DB2Storage<ItemBonusEntry> sItemBonusStore; -TC_GAME_API extern DB2Storage<ItemBonusListGroupEntryEntry> sItemBonusListGroupEntryStore; TC_GAME_API extern DB2Storage<ItemBonusListLevelDeltaEntry> sItemBonusListLevelDeltaStore; -TC_GAME_API extern DB2Storage<ItemBonusTreeEntry> sItemBonusTreeStore; TC_GAME_API extern DB2Storage<ItemBonusTreeNodeEntry> sItemBonusTreeNodeStore; TC_GAME_API extern DB2Storage<ItemContextPickerEntryEntry> sItemContextPickerEntryStore; TC_GAME_API extern DB2Storage<ItemDamageAmmoEntry> sItemDamageAmmoStore; @@ -170,7 +165,6 @@ TC_GAME_API extern DB2Storage<ItemSparseEntry> sItemSparseS TC_GAME_API extern DB2Storage<ItemSpecEntry> sItemSpecStore; TC_GAME_API extern DB2Storage<ItemSpecOverrideEntry> sItemSpecOverrideStore; TC_GAME_API extern DB2Storage<ItemXBonusTreeEntry> sItemXBonusTreeStore; -TC_GAME_API extern DB2Storage<ItemXItemEffectEntry> sItemXItemEffectStore; TC_GAME_API extern DB2Storage<JournalEncounterEntry> sJournalEncounterStore; TC_GAME_API extern DB2Storage<JournalEncounterSectionEntry> sJournalEncounterSectionStore; TC_GAME_API extern DB2Storage<JournalInstanceEntry> sJournalInstanceStore; @@ -185,7 +179,6 @@ TC_GAME_API extern DB2Storage<MailTemplateEntry> sMailTemplat TC_GAME_API extern DB2Storage<MapEntry> sMapStore; TC_GAME_API extern DB2Storage<MapChallengeModeEntry> sMapChallengeModeStore; TC_GAME_API extern DB2Storage<MapDifficultyEntry> sMapDifficultyStore; -TC_GAME_API extern DB2Storage<MawPowerEntry> sMawPowerStore; TC_GAME_API extern DB2Storage<ModifierTreeEntry> sModifierTreeStore; TC_GAME_API extern DB2Storage<MountCapabilityEntry> sMountCapabilityStore; TC_GAME_API extern DB2Storage<MountEntry> sMountStore; @@ -283,14 +276,12 @@ TC_GAME_API extern DB2Storage<TraitTreeLoadoutEntryEntry> sTraitTreeLo TC_GAME_API extern DB2Storage<TraitTreeXTraitCostEntry> sTraitTreeXTraitCostStore; TC_GAME_API extern DB2Storage<TraitTreeXTraitCurrencyEntry> sTraitTreeXTraitCurrencyStore; TC_GAME_API extern DB2Storage<TransmogHolidayEntry> sTransmogHolidayStore; -TC_GAME_API extern DB2Storage<TransmogIllusionEntry> sTransmogIllusionStore; TC_GAME_API extern DB2Storage<TransmogSetEntry> sTransmogSetStore; TC_GAME_API extern DB2Storage<TransmogSetGroupEntry> sTransmogSetGroupStore; TC_GAME_API extern DB2Storage<TransmogSetItemEntry> sTransmogSetItemStore; TC_GAME_API extern DB2Storage<TransportAnimationEntry> sTransportAnimationStore; TC_GAME_API extern DB2Storage<TransportRotationEntry> sTransportRotationStore; TC_GAME_API extern DB2Storage<UiMapEntry> sUiMapStore; -TC_GAME_API extern DB2Storage<UISplashScreenEntry> sUISplashScreenStore; TC_GAME_API extern DB2Storage<UnitConditionEntry> sUnitConditionStore; TC_GAME_API extern DB2Storage<UnitPowerBarEntry> sUnitPowerBarStore; TC_GAME_API extern DB2Storage<VehicleEntry> sVehicleStore; @@ -420,7 +411,6 @@ public: uint32 GetEmptyAnimStateID() const; std::vector<uint32> GetAreasForGroup(uint32 areaGroupId) const; static bool IsInArea(uint32 objectAreaId, uint32 areaId); - static ContentTuningEntry const* GetContentTuningForArea(AreaTableEntry const* areaEntry); std::vector<ArtifactPowerEntry const*> GetArtifactPowers(uint8 artifactId) const; std::vector<uint32> const* GetArtifactPowerLinks(uint32 artifactPowerId) const; ArtifactPowerRankEntry const* GetArtifactPowerRank(uint32 artifactPowerId, uint8 rank) const; @@ -432,7 +422,6 @@ public: std::vector<AzeritePowerSetMemberEntry const*> const* GetAzeritePowers(uint32 itemId) const; uint32 GetRequiredAzeriteLevelForAzeritePowerTier(uint32 azeriteUnlockSetId, ItemContext context, uint32 tier) const; static char const* GetBroadcastTextValue(BroadcastTextEntry const* broadcastText, LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false); - int32 const* GetBroadcastTextDuration(int32 broadcastTextId, LocaleConstant locale = DEFAULT_LOCALE) const; ChrClassUIDisplayEntry const* GetUiDisplayForClass(Classes unitClass) const; static char const* GetClassName(uint8 class_, LocaleConstant locale = DEFAULT_LOCALE); uint32 GetPowerIndexByClass(Powers power, uint32 classId) const; @@ -443,9 +432,7 @@ public: static char const* GetChrRaceName(uint8 race, LocaleConstant locale = DEFAULT_LOCALE); ChrSpecializationEntry const* GetChrSpecializationByIndex(uint32 class_, uint32 index) const; ChrSpecializationEntry const* GetDefaultChrSpecializationForClass(uint32 class_) const; - uint32 GetRedirectedContentTuningId(uint32 contentTuningId, uint32 redirectFlag) const; - Optional<ContentTuningLevels> GetContentTuningData(uint32 contentTuningId, uint32 redirectFlag, bool forItem = false) const; - bool HasContentTuningLabel(uint32 contentTuningId, int32 label) const; + Optional<ContentTuningLevels> GetContentTuningData(uint32 contentTuningId, bool forItem = false) const; static char const* GetCreatureFamilyPetName(uint32 petfamily, LocaleConstant locale); CurrencyContainerEntry const* GetCurrencyContainerForCurrencyQuantity(uint32 currencyId, int32 quantity) const; std::pair<float, float> GetCurveXAxisRange(uint32 curveId) const; @@ -455,7 +442,6 @@ public: float EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 contentTuningId, Classes unitClass, int32 mythicPlusMilestoneSeason) const; std::vector<uint32> const* GetFactionTeamList(uint32 faction) const; FriendshipRepReactionSet const* GetFriendshipRepReactions(uint32 friendshipRepID) const; - uint32 GetGlobalCurveId(GlobalCurve globalCurveType) const; std::vector<uint32> const* GetGlyphBindableSpells(uint32 glyphPropertiesId) const; std::vector<ChrSpecialization> const* GetGlyphRequiredSpecs(uint32 glyphPropertiesId) const; HeirloomEntry const* GetHeirloomByItemId(uint32 itemId) const; @@ -503,7 +489,6 @@ public: std::vector<SkillLineAbilityEntry const*> const* GetSkillLineAbilitiesBySkill(uint32 skillId) const; SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_) const; std::vector<SkillRaceClassInfoEntry const*> GetSkillRaceClassInfo(uint32 skill) const; - SoulbindConduitRankEntry const* GetSoulbindConduitRank(int32 soulbindConduitId, int32 rank) const; std::vector<SpecializationSpellsEntry const*> const* GetSpecializationSpells(uint32 specId) const; bool IsSpecSetMember(int32 specSetId, uint32 specId) const; static bool IsValidSpellFamiliyName(SpellFamilyNames family); @@ -513,7 +498,6 @@ public: TaxiPathEntry const* GetTaxiPath(uint32 from, uint32 to) const; static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId, bool requireAllTotems = true); bool IsToyItem(uint32 toy) const; - TransmogIllusionEntry const* GetTransmogIllusionForEnchantment(uint32 spellItemEnchantmentId) const; std::vector<TransmogSetEntry const*> const* GetTransmogSetsForItemModifiedAppearance(uint32 itemModifiedAppearanceId) const; std::vector<TransmogSetItemEntry const*> const* GetTransmogSetItems(uint32 transmogSetId) const; static bool GetUiMapPosition(float x, float y, float z, int32 mapId, int32 areaId, int32 wmoDoodadPlacementId, int32 wmoGroupId, UiMapSystem system, bool local, diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index e99faab32c1..07c80a9c41d 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -42,19 +42,17 @@ namespace lfg { -LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), contentTuningId(0), +LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), minlevel(0), maxlevel(0), difficulty(DIFFICULTY_NONE), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), finalDungeonEncounterId(0) { } LFGDungeonData::LFGDungeonData(LFGDungeonsEntry const* dbc) : id(dbc->ID), name(dbc->Name[sWorld->GetDefaultDbcLocale()]), map(dbc->MapID), type(uint8(dbc->TypeID)), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)), - contentTuningId(uint32(dbc->ContentTuningID)), difficulty(Difficulty(dbc->DifficultyID)), + minlevel(dbc->MinLevel), maxlevel(dbc->MaxLevel), difficulty(Difficulty(dbc->DifficultyID)), seasonal((dbc->Flags[0] & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), finalDungeonEncounterId(0) { - if (JournalEncounterEntry const* journalEncounter = sJournalEncounterStore.LookupEntry(dbc->FinalEncounterID)) - finalDungeonEncounterId = journalEncounter->DungeonEncounterID; } LFGMgr::LFGMgr() : m_QueueTimer(0), m_lfgProposalId(1), @@ -1759,13 +1757,10 @@ LfgLockMap LFGMgr::GetLockedDungeons(ObjectGuid guid) return LFG_LOCKSTATUS_RAID_LOCKED; if (sInstanceLockMgr.FindActiveInstanceLock(guid, { dungeon->map, Difficulty(dungeon->difficulty) })) return LFG_LOCKSTATUS_RAID_LOCKED; - if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(dungeon->contentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask)) - { - if (levels->MinLevel > level) - return LFG_LOCKSTATUS_TOO_LOW_LEVEL; - if (levels->MaxLevel < level) - return LFG_LOCKSTATUS_TOO_HIGH_LEVEL; - } + if (dungeon->minlevel > level) + return LFG_LOCKSTATUS_TOO_LOW_LEVEL; + if (dungeon->maxlevel < level) + return LFG_LOCKSTATUS_TOO_HIGH_LEVEL; if (dungeon->seasonal && !IsSeasonActive(dungeon->id)) return LFG_LOCKSTATUS_NOT_IN_SEASON; if (dungeon->requiredItemLevel > player->GetAverageItemLevel()) @@ -2212,9 +2207,8 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion, if (dungeon.expansion > expansion) continue; - if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(dungeon.contentTuningId, contentTuningReplacementConditionMask)) - if (levels->MinLevel > level || level > levels->MaxLevel) - continue; + if (dungeon.minlevel > level || level > dungeon.maxlevel) + continue; randomDungeons.insert(dungeon.Entry()); } diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 99a0a46be84..51098031414 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -301,7 +301,8 @@ struct LFGDungeonData uint8 type; uint8 expansion; uint8 group; - uint32 contentTuningId; + uint8 minlevel; + uint8 maxlevel; Difficulty difficulty; bool seasonal; float x, y, z, o; diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 0af01e062a7..0afd85c2c83 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -144,8 +144,6 @@ bool AreaTrigger::Create(uint32 areaTriggerCreatePropertiesId, Unit* caster, Uni SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellID), spellInfo->Id); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), spellInfo->Id); - SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::SpellXSpellVisualID), spellVisual.SpellXSpellVisualID); - SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), spellVisual.ScriptVisualID); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::TimeToTargetScale), GetCreateProperties()->TimeToTargetScale != 0 ? GetCreateProperties()->TimeToTargetScale : *m_areaTriggerData->Duration); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::BoundsRadius2D), GetCreateProperties()->GetMaxSearchRadius()); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), GetCreateProperties()->DecalPropertiesId); @@ -295,8 +293,6 @@ bool AreaTrigger::CreateServer(Map* map, AreaTriggerTemplate const* areaTriggerT { SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*position.SpellForVisuals, DIFFICULTY_NONE); SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), *position.SpellForVisuals); - SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::SpellXSpellVisualID), spellInfo->GetSpellXSpellVisualId()); - SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), 0); } SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::BoundsRadius2D), _shape.GetMaxSearchRadius()); @@ -735,8 +731,7 @@ void AreaTrigger::SearchUnitInCylinder(std::vector<Unit*>& targetList) float scale = CalcCurrentScale(); float radius = G3D::lerp(_shape.CylinderDatas.Radius, _shape.CylinderDatas.RadiusTarget, progress) * scale; float height = G3D::lerp(_shape.CylinderDatas.Height, _shape.CylinderDatas.HeightTarget, progress); - if (!m_areaTriggerData->HeightIgnoresScale) - height *= scale; + height *= scale; float minZ = GetPositionZ() - height; float maxZ = GetPositionZ() + height; @@ -761,8 +756,7 @@ void AreaTrigger::SearchUnitInDisk(std::vector<Unit*>& targetList) float innerRadius = G3D::lerp(_shape.DiskDatas.InnerRadius, _shape.DiskDatas.InnerRadiusTarget, progress) * scale; float outerRadius = G3D::lerp(_shape.DiskDatas.OuterRadius, _shape.DiskDatas.OuterRadiusTarget, progress) * scale; float height = G3D::lerp(_shape.DiskDatas.Height, _shape.DiskDatas.HeightTarget, progress); - if (!m_areaTriggerData->HeightIgnoresScale) - height *= scale; + height *= scale; float minZ = GetPositionZ() - height; float maxZ = GetPositionZ() + height; @@ -843,10 +837,6 @@ void AreaTrigger::HandleUnitEnterExit(std::vector<Unit*> const& newTargetList) _ai->OnUnitExit(leavingUnit); } } - - SetUpdateFieldValue(m_values.ModifyValue(&AreaTrigger::m_areaTriggerData).ModifyValue(&UF::AreaTriggerData::NumUnitsInside), _insideUnits.size()); - SetUpdateFieldValue(m_values.ModifyValue(&AreaTrigger::m_areaTriggerData).ModifyValue(&UF::AreaTriggerData::NumPlayersInside), - std::count_if(_insideUnits.begin(), _insideUnits.end(), [](ObjectGuid const& guid) { return guid.IsPlayer(); })); } AreaTriggerTemplate const* AreaTrigger::GetTemplate() const diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h index 0d03f845cdf..0de60a71177 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h @@ -99,8 +99,6 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge AuraEffect const* GetAuraEffect() const { return _aurEff; } uint32 GetTimeSinceCreated() const { return _timeSinceCreated; } - void SetHeightIgnoresScale(bool heightIgnoresScale) { SetUpdateFieldValue(m_values.ModifyValue(&AreaTrigger::m_areaTriggerData).ModifyValue(&UF::AreaTriggerData::HeightIgnoresScale), heightIgnoresScale); } - void SetOverrideScaleCurve(float overrideScale); void SetOverrideScaleCurve(std::array<DBCPosition2D, 2> const& points, Optional<uint32> startTimeOffset = {}, CurveInterpolationMode interpolation = CurveInterpolationMode::Linear); void ClearOverrideScaleCurve(); diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index 9ed3043e877..8461f1f47e9 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -69,15 +69,7 @@ void Conversation::Update(uint32 diff) sScriptMgr->OnConversationUpdate(this, diff); if (GetDuration() > Milliseconds(diff)) - { _duration -= Milliseconds(diff); - DoWithSuppressingObjectUpdates([&]() - { - // Only sent in CreateObject - ApplyModUpdateFieldValue(m_values.ModifyValue(&Conversation::m_conversationData).ModifyValue(&UF::ConversationData::Progress), int32(diff), true); - const_cast<UF::ConversationData&>(*m_conversationData).ClearChanged(&UF::ConversationData::Progress); - }); - } else { Remove(); // expired @@ -196,11 +188,9 @@ void Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, UF::ConversationLine& lineField = lines.emplace_back(); lineField.ConversationLineID = line->Id; - lineField.BroadcastTextID = convoLine->BroadcastTextID; lineField.UiCameraID = line->UiCameraID; lineField.ActorIndex = line->ActorIdx; lineField.Flags = line->Flags; - lineField.ChatType = line->ChatType; for (LocaleConstant locale = LOCALE_enUS; locale < TOTAL_LOCALES; locale = LocaleConstant(locale + 1)) { @@ -211,9 +201,6 @@ void Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, if (locale == DEFAULT_LOCALE) lineField.StartTime = _lastLineEndTimes[locale].count(); - if (int32 const* broadcastTextDuration = sDB2Manager.GetBroadcastTextDuration(convoLine->BroadcastTextID, locale)) - _lastLineEndTimes[locale] += Milliseconds(*broadcastTextDuration); - _lastLineEndTimes[locale] += Milliseconds(convoLine->AdditionalDuration); } } @@ -233,7 +220,7 @@ bool Conversation::Start() for (UF::ConversationLine const& line : *m_conversationData->Lines) { UF::ConversationActor const* actor = line.ActorIndex < m_conversationData->Actors.size() ? &m_conversationData->Actors[line.ActorIndex] : nullptr; - if (!actor || (!actor->CreatureID && actor->ActorGUID.IsEmpty() && !actor->NoActorObject)) + if (!actor || (!actor->CreatureID && actor->ActorGUID.IsEmpty())) { TC_LOG_ERROR("entities.conversation", "Failed to create conversation (Id: {}) due to missing actor (Idx: {}).", GetEntry(), line.ActorIndex); return false; @@ -255,7 +242,6 @@ void Conversation::AddActor(int32 actorId, uint32 actorIdx, ObjectGuid const& ac SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::ActorGUID), actorGuid); SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::Id), actorId); SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::Type), AsUnderlyingType(ConversationActorType::WorldObject)); - SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::NoActorObject), 0); } void Conversation::AddActor(int32 actorId, uint32 actorIdx, ConversationActorType type, uint32 creatureId, uint32 creatureDisplayInfoId) @@ -266,7 +252,6 @@ void Conversation::AddActor(int32 actorId, uint32 actorIdx, ConversationActorTyp SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::ActorGUID), ObjectGuid::Empty); SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::Id), actorId); SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::Type), AsUnderlyingType(type)); - SetUpdateFieldValue(actorField.ModifyValue(&UF::ConversationActor::NoActorObject), type == ConversationActorType::WorldObject ? 1 : 0); } Milliseconds const* Conversation::GetLineStartTime(LocaleConstant locale, int32 lineId) const @@ -288,11 +273,7 @@ int32 Conversation::GetLineDuration(LocaleConstant locale, int32 lineId) return 0; } - int32 const* textDuration = sDB2Manager.GetBroadcastTextDuration(convoLine->BroadcastTextID, locale); - if (!textDuration) - return 0; - - return *textDuration + convoLine->AdditionalDuration; + return 0; } Milliseconds Conversation::GetLineEndTime(LocaleConstant locale, int32 lineId) const diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 304f3d2df8d..0b09a1a2316 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -643,15 +643,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, // checked and error show at loading templates if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction)) - { SetPvP((factionTemplate->Flags & FACTION_TEMPLATE_FLAG_PVP) != 0); - if (IsTaxi()) - { - uint32 taxiNodesId = sObjectMgr->GetNearestTaxiNode(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), - factionTemplate->FactionGroup & FACTION_MASK_ALLIANCE ? ALLIANCE : HORDE); - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::TaxiNodesID), taxiNodesId); - } - } // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template if (IsVehicle()) diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index f4023c18c68..81956cf3945 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -102,8 +102,6 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste auto dynamicObjectData = m_values.ModifyValue(&DynamicObject::m_dynamicObjectData); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Caster), caster->GetGUID()); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Type), type); - SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellVisual).ModifyValue(&UF::SpellCastVisual::SpellXSpellVisualID), spellVisual.SpellXSpellVisualID); - SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), spellVisual.ScriptVisualID); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellID), spell->Id); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Radius), radius); SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::CastTime), GameTime::GetGameTimeMS()); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index d362d3a9f2e..f08f8576754 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -17,7 +17,6 @@ #include "GameObject.h" #include "ArtifactPackets.h" -#include "AzeriteItem.h" #include "AzeritePackets.h" #include "Battleground.h" #include "BattlegroundPackets.h" @@ -2183,7 +2182,7 @@ uint8 GameObject::GetLevelForTarget(WorldObject const* target) const if (GetGoType() == GAMEOBJECT_TYPE_TRAP) { if (Player const* player = target->ToPlayer()) - if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(GetGOInfo()->ContentTuningId)) return uint8(std::clamp<int16>(player->GetLevel(), userLevels->MinLevel, userLevels->MaxLevel)); if (Unit const* targetUnit = target->ToUnit()) @@ -2865,16 +2864,12 @@ void GameObject::Use(Unit* user) } // Update the correct fishing skill according to the area's ContentTuning - ContentTuningEntry const* areaContentTuning = DB2Manager::GetContentTuningForArea(areaEntry); - if (!areaContentTuning) - break; - - player->UpdateFishingSkill(areaContentTuning->ExpansionID); + player->UpdateFishingSkill(0); // Send loot int32 areaFishingLevel = sObjectMgr->GetFishingBaseSkillLevel(areaEntry); - uint32 playerFishingSkill = player->GetProfessionSkillForExp(SKILL_FISHING, areaContentTuning->ExpansionID); + uint32 playerFishingSkill = player->GetProfessionSkillForExp(SKILL_FISHING, 0); int32 playerFishingLevel = player->GetSkillValue(playerFishingSkill); int32 roll = irand(1, 100); @@ -3073,11 +3068,11 @@ void GameObject::Use(Unit* user) return; //required lvl checks! - if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(info->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> userLevels = sDB2Manager.GetContentTuningData(info->ContentTuningId)) if (player->GetLevel() < userLevels->MaxLevel) return; - if (Optional<ContentTuningLevels> targetLevels = sDB2Manager.GetContentTuningData(info->ContentTuningId, targetPlayer->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> targetLevels = sDB2Manager.GetContentTuningData(info->ContentTuningId)) if (targetPlayer->GetLevel() < targetLevels->MaxLevel) return; @@ -3294,41 +3289,6 @@ void GameObject::Use(Unit* user) if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(info->itemForge.conditionID1)) if (!sConditionMgr->IsPlayerMeetingCondition(player, playerCondition)) return; - - switch (info->itemForge.ForgeType) - { - case 0: // Artifact Forge - case 1: // Relic Forge - { - Aura const* artifactAura = player->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE); - Item const* item = artifactAura ? player->GetItemByGuid(artifactAura->GetCastItemGUID()) : nullptr; - if (!item) - { - player->SendDirectMessage(WorldPackets::Misc::DisplayGameError(GameError::ERR_MUST_EQUIP_ARTIFACT).Write()); - return; - } - - WorldPackets::Artifact::OpenArtifactForge openArtifactForge; - openArtifactForge.ArtifactGUID = item->GetGUID(); - openArtifactForge.ForgeGUID = GetGUID(); - player->SendDirectMessage(openArtifactForge.Write()); - break; - } - case 2: // Heart Forge - { - Item const* item = player->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere); - if (!item) - return; - - WorldPackets::GameObject::GameObjectInteraction openHeartForge; - openHeartForge.ObjectGUID = GetGUID(); - openHeartForge.InteractionType = PlayerInteractionType::AzeriteForge; - player->SendDirectMessage(openHeartForge.Write()); - break; - } - default: - break; - } return; } case GAMEOBJECT_TYPE_UI_LINK: diff --git a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp b/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp deleted file mode 100644 index c755a372a1d..00000000000 --- a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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 "AzeriteEmpoweredItem.h" -#include "DatabaseEnv.h" -#include "DB2Stores.h" -#include "Player.h" -#include "UpdateData.h" - -AzeriteEmpoweredItem::AzeriteEmpoweredItem() -{ - m_objectType |= TYPEMASK_AZERITE_EMPOWERED_ITEM; - m_objectTypeId = TYPEID_AZERITE_EMPOWERED_ITEM; - - m_azeritePowers = nullptr; - m_maxTier = 0; -} - -bool AzeriteEmpoweredItem::Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner) -{ - if (!Item::Create(guidlow, itemId, context, owner)) - return false; - - InitAzeritePowerData(); - return true; -} - -void AzeriteEmpoweredItem::SaveToDB(CharacterDatabaseTransaction trans) -{ - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); - stmt->setUInt64(0, GetGUID().GetCounter()); - trans->Append(stmt); - - switch (GetState()) - { - case ITEM_NEW: - case ITEM_CHANGED: - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_EMPOWERED); - stmt->setUInt64(0, GetGUID().GetCounter()); - for (uint32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i) - stmt->setInt32(1 + i, m_azeriteEmpoweredItemData->Selections[i]); - - trans->Append(stmt); - break; - } - case ITEM_REMOVED: - default: - break; - } - - Item::SaveToDB(trans); -} - -void AzeriteEmpoweredItem::LoadAzeriteEmpoweredItemData(Player const* owner, AzeriteEmpoweredItemData& azeriteEmpoweredItem) -{ - InitAzeritePowerData(); - bool needSave = false; - if (m_azeritePowers) - { - for (int32 i = MAX_AZERITE_EMPOWERED_TIER; --i >= 0; ) - { - int32 selection = azeriteEmpoweredItem.SelectedAzeritePowers[i]; - if (GetTierForAzeritePower(Classes(owner->GetClass()), selection) != i) - { - needSave = true; - break; - } - - SetSelectedAzeritePower(i, selection); - } - } - else - needSave = true; - - if (needSave) - { - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_INSTANCE_AZERITE_EMPOWERED); - for (uint32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i) - stmt->setInt32(i, m_azeriteEmpoweredItemData->Selections[i]); - - stmt->setUInt64(5, GetGUID().GetCounter()); - CharacterDatabase.Execute(stmt); - } -} - -void AzeriteEmpoweredItem::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid) -{ - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); - stmt->setUInt64(0, itemGuid); - CharacterDatabase.ExecuteOrAppend(trans, stmt); -} - -void AzeriteEmpoweredItem::DeleteFromDB(CharacterDatabaseTransaction trans) -{ - AzeriteEmpoweredItem::DeleteFromDB(trans, GetGUID().GetCounter()); - Item::DeleteFromDB(trans); -} - -uint32 AzeriteEmpoweredItem::GetRequiredAzeriteLevelForTier(uint32 tier) const -{ - return sDB2Manager.GetRequiredAzeriteLevelForAzeritePowerTier(_bonusData.AzeriteTierUnlockSetId, GetContext(), tier); -} - -int32 AzeriteEmpoweredItem::GetTierForAzeritePower(Classes playerClass, int32 azeritePowerId) const -{ - auto azeritePowerItr = std::find_if(m_azeritePowers->begin(), m_azeritePowers->end(), [&](AzeritePowerSetMemberEntry const* power) - { - return power->AzeritePowerID == azeritePowerId && power->Class == playerClass; - }); - if (azeritePowerItr != m_azeritePowers->end()) - return (*azeritePowerItr)->Tier; - - return MAX_AZERITE_EMPOWERED_TIER; -} - -void AzeriteEmpoweredItem::SetSelectedAzeritePower(int32 tier, int32 azeritePowerId) -{ - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteEmpoweredItem::m_azeriteEmpoweredItemData).ModifyValue(&UF::AzeriteEmpoweredItemData::Selections, uint32(tier)), azeritePowerId); - - // Not added to UF::ItemData::BonusListIDs, client fakes it on its own too - _bonusData.AddBonusList(sAzeritePowerStore.AssertEntry(azeritePowerId)->ItemBonusListID); -} - -void AzeriteEmpoweredItem::ClearSelectedAzeritePowers() -{ - for (uint32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i) - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteEmpoweredItem::m_azeriteEmpoweredItemData).ModifyValue(&UF::AzeriteEmpoweredItemData::Selections, i), 0); - - _bonusData.Initialize(GetTemplate()); - for (int32 bonusListID : GetBonusListIDs()) - _bonusData.AddBonusList(bonusListID); -} - -int64 AzeriteEmpoweredItem::GetRespecCost() const -{ - if (Player const* owner = GetOwner()) - return int64(float(GOLD) * sDB2Manager.GetCurveValueAt(CURVE_ID_AZERITE_EMPOWERED_ITEM_RESPEC_COST, float(owner->GetNumRespecs()))); - - return MAX_MONEY_AMOUNT + 1; -} - -void AzeriteEmpoweredItem::BuildValuesCreate(ByteBuffer* data, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - std::size_t sizePos = data->wpos(); - *data << uint32(0); - *data << uint8(flags); - m_objectData->WriteCreate(*data, flags, this, target); - m_itemData->WriteCreate(*data, flags, this, target); - m_azeriteEmpoweredItemData->WriteCreate(*data, flags, this, target); - data->put<uint32>(sizePos, data->wpos() - sizePos - 4); -} - -void AzeriteEmpoweredItem::BuildValuesUpdate(ByteBuffer* data, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - std::size_t sizePos = data->wpos(); - *data << uint32(0); - *data << uint32(m_values.GetChangedObjectTypeMask()); - - if (m_values.HasChanged(TYPEID_OBJECT)) - m_objectData->WriteUpdate(*data, flags, this, target); - - if (m_values.HasChanged(TYPEID_ITEM)) - m_itemData->WriteUpdate(*data, flags, this, target); - - if (m_values.HasChanged(TYPEID_AZERITE_EMPOWERED_ITEM)) - m_azeriteEmpoweredItemData->WriteUpdate(*data, flags, this, target); - - data->put<uint32>(sizePos, data->wpos() - sizePos - 4); -} - -void AzeriteEmpoweredItem::BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask, - UF::ItemData::Mask const& requestedItemMask, UF::AzeriteEmpoweredItemData::Mask const& requestedAzeriteEmpoweredItemMask, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask<NUM_CLIENT_OBJECT_TYPES> valuesMask; - if (requestedObjectMask.IsAnySet()) - valuesMask.Set(TYPEID_OBJECT); - - UF::ItemData::Mask itemMask = requestedItemMask; - m_itemData->FilterDisallowedFieldsMaskForFlag(itemMask, flags); - if (itemMask.IsAnySet()) - valuesMask.Set(TYPEID_ITEM); - - if (requestedAzeriteEmpoweredItemMask.IsAnySet()) - valuesMask.Set(TYPEID_AZERITE_EMPOWERED_ITEM); - - ByteBuffer& buffer = PrepareValuesUpdateBuffer(data); - std::size_t sizePos = buffer.wpos(); - buffer << uint32(0); - buffer << uint32(valuesMask.GetBlock(0)); - - if (valuesMask[TYPEID_OBJECT]) - m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target); - - if (valuesMask[TYPEID_ITEM]) - m_itemData->WriteUpdate(buffer, itemMask, true, this, target); - - if (valuesMask[TYPEID_AZERITE_EMPOWERED_ITEM]) - m_azeriteEmpoweredItemData->WriteUpdate(buffer, requestedAzeriteEmpoweredItemMask, true, this, target); - - buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4); - - data->AddUpdateBlock(); -} - -void AzeriteEmpoweredItem::ValuesUpdateForPlayerWithMaskSender::operator()(Player const* player) const -{ - UpdateData udata(player->GetMapId()); - WorldPacket packet; - - Owner->BuildValuesUpdateForPlayerWithMask(&udata, ObjectMask.GetChangesMask(), ItemMask.GetChangesMask(), AzeriteEmpoweredItemMask.GetChangesMask(), player); - - udata.BuildPacket(&packet); - player->SendDirectMessage(&packet); -} - -void AzeriteEmpoweredItem::ClearUpdateMask(bool remove) -{ - m_values.ClearChangesMask(&AzeriteEmpoweredItem::m_azeriteEmpoweredItemData); - Item::ClearUpdateMask(remove); -} - -void AzeriteEmpoweredItem::InitAzeritePowerData() -{ - m_azeritePowers = sDB2Manager.GetAzeritePowers(GetEntry()); - if (m_azeritePowers) - { - m_maxTier = (*std::max_element(m_azeritePowers->begin(), m_azeritePowers->end(), [](AzeritePowerSetMemberEntry const* a1, AzeritePowerSetMemberEntry const* a2) - { - return a1->Tier < a2->Tier; - }))->Tier; - } -} diff --git a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.h b/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.h deleted file mode 100644 index 608e8f1fc71..00000000000 --- a/src/server/game/Entities/Item/AzeriteItem/AzeriteEmpoweredItem.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 AzeriteEmpoweredItem_h__ -#define AzeriteEmpoweredItem_h__ - -#include "Item.h" - -class TC_GAME_API AzeriteEmpoweredItem : public Item -{ -public: - AzeriteEmpoweredItem(); - - bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner) override; - - void SaveToDB(CharacterDatabaseTransaction trans) override; - void LoadAzeriteEmpoweredItemData(Player const* owner, AzeriteEmpoweredItemData& azeriteEmpoweredItem); - static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid); - void DeleteFromDB(CharacterDatabaseTransaction trans) override; - - uint32 GetRequiredAzeriteLevelForTier(uint32 tier) const; - int32 GetTierForAzeritePower(Classes playerClass, int32 azeritePowerId) const; - int32 GetMaxAzeritePowerTier() const { return m_maxTier; } - - uint32 GetSelectedAzeritePower(int32 tier) const { return uint32(m_azeriteEmpoweredItemData->Selections[uint32(tier)]); } - void SetSelectedAzeritePower(int32 tier, int32 azeritePowerId); - void ClearSelectedAzeritePowers(); - - int64 GetRespecCost() const; - -protected: - void BuildValuesCreate(ByteBuffer* data, Player const* target) const override; - void BuildValuesUpdate(ByteBuffer* data, Player const* target) const override; - void ClearUpdateMask(bool remove) override; - -public: - void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask, UF::ItemData::Mask const& requestedItemMask, - UF::AzeriteEmpoweredItemData::Mask const& requestedAzeriteEmpoweredItemMask, Player const* target) const; - - struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer - { - explicit ValuesUpdateForPlayerWithMaskSender(AzeriteEmpoweredItem const* owner) : Owner(owner) { } - - AzeriteEmpoweredItem const* Owner; - UF::ObjectData::Base ObjectMask; - UF::ItemData::Base ItemMask; - UF::AzeriteEmpoweredItemData::Base AzeriteEmpoweredItemMask; - - void operator()(Player const* player) const; - }; - - UF::UpdateField<UF::AzeriteEmpoweredItemData, 0, TYPEID_AZERITE_EMPOWERED_ITEM> m_azeriteEmpoweredItemData; - -private: - void InitAzeritePowerData(); - std::vector<AzeritePowerSetMemberEntry const*> const* m_azeritePowers; - int32 m_maxTier; -}; - -#endif // AzeriteEmpoweredItem_h__ diff --git a/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.cpp b/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.cpp deleted file mode 100644 index 6f76852e93a..00000000000 --- a/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.cpp +++ /dev/null @@ -1,523 +0,0 @@ -/* - * 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 "AzeriteItem.h" -#include "AzeritePackets.h" -#include "ConditionMgr.h" -#include "DB2Stores.h" -#include "DatabaseEnv.h" -#include "GameObject.h" -#include "GameTime.h" -#include "Player.h" -#include "UpdateData.h" -#include <boost/date_time/gregorian/gregorian_types.hpp> -#include <boost/date_time/posix_time/conversion.hpp> - -AzeriteItem::AzeriteItem() : Item() -{ - m_objectType |= TYPEMASK_AZERITE_ITEM; - m_objectTypeId = TYPEID_AZERITE_ITEM; - - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::DEBUGknowledgeWeek), -1); -} - -bool AzeriteItem::Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner) -{ - if (!Item::Create(guidlow, itemId, context, owner)) - return false; - - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::Level), 1); - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::KnowledgeLevel), GetCurrentKnowledgeLevel()); - UnlockDefaultMilestones(); - return true; -} - -void AzeriteItem::SaveToDB(CharacterDatabaseTransaction trans) -{ - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE); - stmt->setUInt64(0, GetGUID().GetCounter()); - trans->Append(stmt); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); - stmt->setUInt64(0, GetGUID().GetCounter()); - trans->Append(stmt); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); - stmt->setUInt64(0, GetGUID().GetCounter()); - trans->Append(stmt); - - switch (GetState()) - { - case ITEM_NEW: - case ITEM_CHANGED: - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_AZERITE); - stmt->setUInt64(0, GetGUID().GetCounter()); - stmt->setUInt64(1, m_azeriteItemData->Xp); - stmt->setUInt32(2, m_azeriteItemData->Level); - stmt->setUInt32(3, m_azeriteItemData->KnowledgeLevel); - std::size_t specIndex = 0; - for (; specIndex < m_azeriteItemData->SelectedEssences.size(); ++specIndex) - { - stmt->setUInt32(4 + specIndex * 5, m_azeriteItemData->SelectedEssences[specIndex].SpecializationID); - for (std::size_t j = 0; j < MAX_AZERITE_ESSENCE_SLOT; ++j) - stmt->setUInt32(5 + specIndex * 5 + j, m_azeriteItemData->SelectedEssences[specIndex].AzeriteEssenceID[j]); - } - for (; specIndex < 4; ++specIndex) - { - stmt->setUInt32(4 + specIndex * 5, 0); - for (std::size_t j = 0; j < MAX_AZERITE_ESSENCE_SLOT; ++j) - stmt->setUInt32(5 + specIndex * 5 + j, 0); - } - - trans->Append(stmt); - - for (uint32 azeriteItemMilestonePowerId : m_azeriteItemData->UnlockedEssenceMilestones) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); - stmt->setUInt64(0, GetGUID().GetCounter()); - stmt->setUInt32(1, azeriteItemMilestonePowerId); - trans->Append(stmt); - } - - for (UF::UnlockedAzeriteEssence const& azeriteEssence : m_azeriteItemData->UnlockedEssences) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); - stmt->setUInt64(0, GetGUID().GetCounter()); - stmt->setUInt32(1, azeriteEssence.AzeriteEssenceID); - stmt->setUInt32(2, azeriteEssence.Rank); - trans->Append(stmt); - } - break; - } - case ITEM_REMOVED: - default: - break; - } - - Item::SaveToDB(trans); -} - -void AzeriteItem::LoadAzeriteItemData(Player const* owner, AzeriteItemData& azeriteItemData) -{ - bool needSave = false; - - if (!sAzeriteLevelInfoStore.LookupEntry(azeriteItemData.Level)) - { - azeriteItemData.Xp = 0; - azeriteItemData.Level = 1; - azeriteItemData.KnowledgeLevel = GetCurrentKnowledgeLevel(); - needSave = true; - } - else if (azeriteItemData.Level > MAX_AZERITE_ITEM_LEVEL) - { - azeriteItemData.Xp = 0; - azeriteItemData.Level = MAX_AZERITE_ITEM_LEVEL; - needSave = true; - } - - if (azeriteItemData.KnowledgeLevel != GetCurrentKnowledgeLevel()) - { - // rescale XP to maintain same progress % - uint64 oldMax = CalcTotalXPToNextLevel(azeriteItemData.Level, azeriteItemData.KnowledgeLevel); - azeriteItemData.KnowledgeLevel = GetCurrentKnowledgeLevel(); - uint64 newMax = CalcTotalXPToNextLevel(azeriteItemData.Level, azeriteItemData.KnowledgeLevel); - azeriteItemData.Xp = uint64(azeriteItemData.Xp / double(oldMax) * newMax); - needSave = true; - } - else if (azeriteItemData.KnowledgeLevel > MAX_AZERITE_ITEM_KNOWLEDGE_LEVEL) - { - azeriteItemData.KnowledgeLevel = MAX_AZERITE_ITEM_KNOWLEDGE_LEVEL; - needSave = true; - } - - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::Xp), azeriteItemData.Xp); - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::Level), azeriteItemData.Level); - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::KnowledgeLevel), azeriteItemData.KnowledgeLevel); - for (uint32 azeriteItemMilestonePowerId : azeriteItemData.AzeriteItemMilestonePowers) - AddUnlockedEssenceMilestone(azeriteItemMilestonePowerId); - - UnlockDefaultMilestones(); - - for (AzeriteEssencePowerEntry const* unlockedAzeriteEssence : azeriteItemData.UnlockedAzeriteEssences) - SetEssenceRank(unlockedAzeriteEssence->AzeriteEssenceID, unlockedAzeriteEssence->Tier); - - for (AzeriteItemSelectedEssencesData const& selectedEssenceData : azeriteItemData.SelectedAzeriteEssences) - { - if (!selectedEssenceData.SpecializationId) - continue; - - auto selectedEssences = AddDynamicUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::SelectedEssences)); - selectedEssences.ModifyValue(&UF::SelectedAzeriteEssences::SpecializationID).SetValue(selectedEssenceData.SpecializationId); - for (uint32 i = 0; i < MAX_AZERITE_ESSENCE_SLOT; ++i) - { - // Check if essence was unlocked - if (!GetEssenceRank(selectedEssenceData.AzeriteEssenceId[i])) - continue; - - selectedEssences.ModifyValue(&UF::SelectedAzeriteEssences::AzeriteEssenceID, i).SetValue(selectedEssenceData.AzeriteEssenceId[i]); - } - - if (owner && owner->GetPrimarySpecialization() == ChrSpecialization(selectedEssenceData.SpecializationId)) - selectedEssences.ModifyValue(&UF::SelectedAzeriteEssences::Enabled).SetValue(true); - } - - // add selected essences for current spec - if (owner && !GetSelectedAzeriteEssences()) - CreateSelectedAzeriteEssences(AsUnderlyingType(owner->GetPrimarySpecialization())); - - if (needSave) - { - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_INSTANCE_AZERITE_ON_LOAD); - stmt->setUInt64(0, azeriteItemData.Xp); - stmt->setUInt32(1, azeriteItemData.KnowledgeLevel); - stmt->setUInt64(2, GetGUID().GetCounter()); - CharacterDatabase.Execute(stmt); - } -} - -void AzeriteItem::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid) -{ - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE); - stmt->setUInt64(0, itemGuid); - CharacterDatabase.ExecuteOrAppend(trans, stmt); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); - stmt->setUInt64(0, itemGuid); - CharacterDatabase.ExecuteOrAppend(trans, stmt); - - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); - stmt->setUInt64(0, itemGuid); - CharacterDatabase.ExecuteOrAppend(trans, stmt); -} - -void AzeriteItem::DeleteFromDB(CharacterDatabaseTransaction trans) -{ - AzeriteItem::DeleteFromDB(trans, GetGUID().GetCounter()); - Item::DeleteFromDB(trans); -} - -uint32 AzeriteItem::GetCurrentKnowledgeLevel() -{ - // count weeks from 14.01.2020 - boost::gregorian::date now = boost::posix_time::from_time_t(GameTime::GetGameTime()).date(); - boost::gregorian::week_iterator itr(boost::gregorian::date(2020, boost::date_time::Jan, 14)); - uint32 knowledge = 0; - while (*itr < now && knowledge < MAX_AZERITE_ITEM_KNOWLEDGE_LEVEL) - { - ++knowledge; - ++itr; - } - return knowledge; -} - -uint64 AzeriteItem::CalcTotalXPToNextLevel(uint32 level, uint32 knowledgeLevel) -{ - AzeriteLevelInfoEntry const* levelInfo = sAzeriteLevelInfoStore.AssertEntry(level); - uint64 totalXp = levelInfo->BaseExperienceToNextLevel * sAzeriteKnowledgeMultiplierStore.AssertEntry(knowledgeLevel)->Multiplier; - return std::max(totalXp, levelInfo->MinimumExperienceToNextLevel); -} - -void AzeriteItem::GiveXP(uint64 xp) -{ - Player* owner = GetOwner(); - uint32 level = m_azeriteItemData->Level; - if (level < MAX_AZERITE_ITEM_LEVEL) - { - uint64 currentXP = m_azeriteItemData->Xp; - uint64 remainingXP = xp; - do - { - uint64 totalXp = CalcTotalXPToNextLevel(level, m_azeriteItemData->KnowledgeLevel); - if (currentXP + remainingXP >= totalXp) - { - // advance to next level - ++level; - remainingXP -= totalXp - currentXP; - currentXP = 0; - } - else - { - currentXP += remainingXP; - remainingXP = 0; - } - } while (remainingXP > 0 && level < MAX_AZERITE_ITEM_LEVEL); - - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::Xp), currentXP); - - owner->UpdateCriteria(CriteriaType::EarnArtifactXPForAzeriteItem, xp); - - // changing azerite level changes item level, need to update stats - if (m_azeriteItemData->Level != level) - { - if (IsEquipped()) - owner->_ApplyItemBonuses(this, GetSlot(), false); - - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::Level), level); - UnlockDefaultMilestones(); - owner->UpdateCriteria(CriteriaType::AzeriteLevelReached, level); - - if (IsEquipped()) - owner->_ApplyItemBonuses(this, GetSlot(), true); - } - - SetState(ITEM_CHANGED, owner); - } - - WorldPackets::Azerite::PlayerAzeriteItemGains xpGain; - xpGain.ItemGUID = GetGUID(); - xpGain.XP = xp; - owner->SendDirectMessage(xpGain.Write()); -} - -GameObject const* AzeriteItem::FindHeartForge(Player const* owner) -{ - if (GameObject const* forge = owner->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_ITEM_FORGE, 40.0f)) - if (forge->GetGOInfo()->itemForge.ForgeType == 2) - return forge; - - return nullptr; -} - -bool AzeriteItem::CanUseEssences() const -{ - if (PlayerConditionEntry const* condition = sPlayerConditionStore.LookupEntry(PLAYER_CONDITION_ID_UNLOCKED_AZERITE_ESSENCES)) - return ConditionMgr::IsPlayerMeetingCondition(GetOwner(), condition); - - return false; -} - -bool AzeriteItem::HasUnlockedEssenceSlot(uint8 slot) const -{ - AzeriteItemMilestonePowerEntry const* milestone = sDB2Manager.GetAzeriteItemMilestonePower(slot); - return m_azeriteItemData->UnlockedEssenceMilestones.FindIndex(milestone->ID) != -1; -} - -uint32 AzeriteItem::GetEssenceRank(uint32 azeriteEssenceId) const -{ - int32 index = m_azeriteItemData->UnlockedEssences.FindIndexIf([azeriteEssenceId](UF::UnlockedAzeriteEssence const& essence) - { - return essence.AzeriteEssenceID == azeriteEssenceId; - }); - - if (index < 0) - return 0; - - return m_azeriteItemData->UnlockedEssences[index].Rank; -} - -void AzeriteItem::SetEssenceRank(uint32 azeriteEssenceId, uint32 rank) -{ - int32 index = m_azeriteItemData->UnlockedEssences.FindIndexIf([azeriteEssenceId](UF::UnlockedAzeriteEssence const& essence) - { - return essence.AzeriteEssenceID == azeriteEssenceId; - }); - - if (!rank && index >= 0) - { - RemoveDynamicUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::UnlockedEssences), index); - return; - } - - if (!sDB2Manager.GetAzeriteEssencePower(azeriteEssenceId, rank)) - return; - - if (index < 0) - { - UF::UnlockedAzeriteEssence& unlockedEssence = AddDynamicUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData) - .ModifyValue(&UF::AzeriteItemData::UnlockedEssences)); - unlockedEssence.AzeriteEssenceID = azeriteEssenceId; - unlockedEssence.Rank = rank; - } - else - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::UnlockedEssences, index) - .ModifyValue(&UF::UnlockedAzeriteEssence::Rank), rank); -} - -UF::SelectedAzeriteEssences const* AzeriteItem::GetSelectedAzeriteEssences() const -{ - for (UF::SelectedAzeriteEssences const& essences : m_azeriteItemData->SelectedEssences) - if (essences.Enabled) - return &essences; - - return nullptr; -} - -void AzeriteItem::SetSelectedAzeriteEssences(uint32 specializationId) -{ - int32 index = m_azeriteItemData->SelectedEssences.FindIndexIf([](UF::SelectedAzeriteEssences const& essences) { return essences.Enabled == 1; }); - if (index >= 0) - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::SelectedEssences, index) - .ModifyValue(&UF::SelectedAzeriteEssences::Enabled), false); - - index = m_azeriteItemData->SelectedEssences.FindIndexIf([specializationId](UF::SelectedAzeriteEssences const& essences) - { - return essences.SpecializationID == specializationId; - }); - - if (index >= 0) - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::SelectedEssences, index) - .ModifyValue(&UF::SelectedAzeriteEssences::Enabled), true); - else - CreateSelectedAzeriteEssences(specializationId); -} - -void AzeriteItem::CreateSelectedAzeriteEssences(uint32 specializationId) -{ - auto selectedEssences = AddDynamicUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::SelectedEssences)); - selectedEssences.ModifyValue(&UF::SelectedAzeriteEssences::SpecializationID).SetValue(specializationId); - selectedEssences.ModifyValue(&UF::SelectedAzeriteEssences::Enabled).SetValue(true); -} - -void AzeriteItem::SetSelectedAzeriteEssence(uint8 slot, uint32 azeriteEssenceId) -{ - ASSERT(slot < MAX_AZERITE_ESSENCE_SLOT); - int32 index = m_azeriteItemData->SelectedEssences.FindIndexIf([](UF::SelectedAzeriteEssences const& essences) { return essences.Enabled == 1; }); - ASSERT(index >= 0); - SetUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData).ModifyValue(&UF::AzeriteItemData::SelectedEssences, index) - .ModifyValue(&UF::SelectedAzeriteEssences::AzeriteEssenceID, slot), azeriteEssenceId); -} - -void AzeriteItem::BuildValuesCreate(ByteBuffer* data, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - std::size_t sizePos = data->wpos(); - *data << uint32(0); - *data << uint8(flags); - m_objectData->WriteCreate(*data, flags, this, target); - m_itemData->WriteCreate(*data, flags, this, target); - m_azeriteItemData->WriteCreate(*data, flags, this, target); - data->put<uint32>(sizePos, data->wpos() - sizePos - 4); -} - -void AzeriteItem::BuildValuesUpdate(ByteBuffer* data, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - std::size_t sizePos = data->wpos(); - *data << uint32(0); - *data << uint32(m_values.GetChangedObjectTypeMask()); - - if (m_values.HasChanged(TYPEID_OBJECT)) - m_objectData->WriteUpdate(*data, flags, this, target); - - if (m_values.HasChanged(TYPEID_ITEM)) - m_itemData->WriteUpdate(*data, flags, this, target); - - if (m_values.HasChanged(TYPEID_AZERITE_ITEM)) - m_azeriteItemData->WriteUpdate(*data, flags, this, target); - - data->put<uint32>(sizePos, data->wpos() - sizePos - 4); -} - -void AzeriteItem::BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const -{ - UpdateMask<NUM_CLIENT_OBJECT_TYPES> valuesMask; - valuesMask.Set(TYPEID_ITEM); - valuesMask.Set(TYPEID_AZERITE_ITEM); - - std::size_t sizePos = data->wpos(); - *data << uint32(0); - *data << uint32(valuesMask.GetBlock(0)); - - UF::ItemData::Mask mask; - m_itemData->AppendAllowedFieldsMaskForFlag(mask, flags); - m_itemData->WriteUpdate(*data, mask, true, this, target); - - UF::AzeriteItemData::Mask mask2; - m_azeriteItemData->AppendAllowedFieldsMaskForFlag(mask2, flags); - m_azeriteItemData->WriteUpdate(*data, mask2, true, this, target); - - data->put<uint32>(sizePos, data->wpos() - sizePos - 4); -} - -void AzeriteItem::BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask, - UF::ItemData::Mask const& requestedItemMask, UF::AzeriteItemData::Mask const& requestedAzeriteItemMask, Player const* target) const -{ - UF::UpdateFieldFlag flags = GetUpdateFieldFlagsFor(target); - UpdateMask<NUM_CLIENT_OBJECT_TYPES> valuesMask; - if (requestedObjectMask.IsAnySet()) - valuesMask.Set(TYPEID_OBJECT); - - UF::ItemData::Mask itemMask = requestedItemMask; - m_itemData->FilterDisallowedFieldsMaskForFlag(itemMask, flags); - if (itemMask.IsAnySet()) - valuesMask.Set(TYPEID_ITEM); - - UF::AzeriteItemData::Mask azeriteItemMask = requestedAzeriteItemMask; - m_azeriteItemData->FilterDisallowedFieldsMaskForFlag(azeriteItemMask, flags); - if (azeriteItemMask.IsAnySet()) - valuesMask.Set(TYPEID_AZERITE_ITEM); - - ByteBuffer& buffer = PrepareValuesUpdateBuffer(data); - std::size_t sizePos = buffer.wpos(); - buffer << uint32(0); - buffer << uint32(valuesMask.GetBlock(0)); - - if (valuesMask[TYPEID_OBJECT]) - m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target); - - if (valuesMask[TYPEID_ITEM]) - m_itemData->WriteUpdate(buffer, itemMask, true, this, target); - - if (valuesMask[TYPEID_AZERITE_ITEM]) - m_azeriteItemData->WriteUpdate(buffer, azeriteItemMask, true, this, target); - - buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4); - - data->AddUpdateBlock(); -} - -void AzeriteItem::ValuesUpdateForPlayerWithMaskSender::operator()(Player const* player) const -{ - UpdateData udata(player->GetMapId()); - WorldPacket packet; - - Owner->BuildValuesUpdateForPlayerWithMask(&udata, ObjectMask.GetChangesMask(), ItemMask.GetChangesMask(), AzeriteItemMask.GetChangesMask(), player); - - udata.BuildPacket(&packet); - player->SendDirectMessage(&packet); -} - -void AzeriteItem::ClearUpdateMask(bool remove) -{ - m_values.ClearChangesMask(&AzeriteItem::m_azeriteItemData); - Item::ClearUpdateMask(remove); -} - -void AzeriteItem::UnlockDefaultMilestones() -{ - bool hasPreviousMilestone = true; - for (AzeriteItemMilestonePowerEntry const* milestone : sDB2Manager.GetAzeriteItemMilestonePowers()) - { - if (!hasPreviousMilestone) - break; - - if (milestone->RequiredLevel > int32(GetLevel())) - break; - - if (HasUnlockedEssenceMilestone(milestone->ID)) - continue; - - if (milestone->AutoUnlock) - { - AddUnlockedEssenceMilestone(milestone->ID); - hasPreviousMilestone = true; - } - else - hasPreviousMilestone = false; - } -} diff --git a/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.h b/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.h deleted file mode 100644 index 444bc9c7b02..00000000000 --- a/src/server/game/Entities/Item/AzeriteItem/AzeriteItem.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 AzeriteItem_h__ -#define AzeriteItem_h__ - -#include "Item.h" - -constexpr uint32 ITEM_ID_HEART_OF_AZEROTH = 158075; -constexpr uint32 MAX_AZERITE_ITEM_LEVEL = 129; -constexpr uint32 MAX_AZERITE_ITEM_KNOWLEDGE_LEVEL = 30; -constexpr uint32 PLAYER_CONDITION_ID_UNLOCKED_AZERITE_ESSENCES = 69048; -constexpr uint32 SPELL_ID_HEART_ESSENCE_ACTION_BAR_OVERRIDE = 298554; - -class TC_GAME_API AzeriteItem : public Item -{ -public: - AzeriteItem(); - - bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner) override; - - void SaveToDB(CharacterDatabaseTransaction trans) override; - void LoadAzeriteItemData(Player const* owner, AzeriteItemData& azeriteItem); - static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid); - void DeleteFromDB(CharacterDatabaseTransaction trans) override; - - uint32 GetLevel() const { return m_azeriteItemData->Level; } - uint32 GetEffectiveLevel() const - { - uint32 level = m_azeriteItemData->AuraLevel; - if (!level) - level = m_azeriteItemData->Level; - - return level; - } - - // Gaining artifact power - static uint32 GetCurrentKnowledgeLevel(); - static uint64 CalcTotalXPToNextLevel(uint32 level, uint32 knowledgeLevel); - void GiveXP(uint64 xp); - - // Essences - // C_AzeriteEssence.CanOpenUI - checks PlayerCondition 69048 - HasAura(261912) || RewardedQuest(57010) || IsOnQuest(57010) - static GameObject const* FindHeartForge(Player const* owner); - bool CanUseEssences() const; - bool HasUnlockedEssenceSlot(uint8 slot) const; - bool HasUnlockedEssenceMilestone(uint32 azeriteItemMilestonePowerId) const { return m_azeriteItemData->UnlockedEssenceMilestones.FindIndex(azeriteItemMilestonePowerId) != -1; } - void AddUnlockedEssenceMilestone(uint32 azeriteItemMilestonePowerId) - { - AddDynamicUpdateFieldValue(m_values.ModifyValue(&AzeriteItem::m_azeriteItemData) - .ModifyValue(&UF::AzeriteItemData::UnlockedEssenceMilestones)) = azeriteItemMilestonePowerId; - } - - uint32 GetEssenceRank(uint32 azeriteEssenceId) const; - void SetEssenceRank(uint32 azeriteEssenceId, uint32 rank); - - UF::SelectedAzeriteEssences const* GetSelectedAzeriteEssences() const; - void SetSelectedAzeriteEssences(uint32 specializationId); - void CreateSelectedAzeriteEssences(uint32 specializationId); - void SetSelectedAzeriteEssence(uint8 slot, uint32 azeriteEssenceId); - -protected: - void BuildValuesCreate(ByteBuffer* data, Player const* target) const override; - void BuildValuesUpdate(ByteBuffer* data, Player const* target) const override; - void ClearUpdateMask(bool remove) override; - -public: - void BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const override; - void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask, UF::ItemData::Mask const& requestedItemMask, - UF::AzeriteItemData::Mask const& requestedAzeriteItemMask, Player const* target) const; - - struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer - { - explicit ValuesUpdateForPlayerWithMaskSender(AzeriteItem const* owner) : Owner(owner) { } - - AzeriteItem const* Owner; - UF::ObjectData::Base ObjectMask; - UF::ItemData::Base ItemMask; - UF::AzeriteItemData::Base AzeriteItemMask; - - void operator()(Player const* player) const; - }; - - UF::UpdateField<UF::AzeriteItemData, 0, TYPEID_AZERITE_ITEM> m_azeriteItemData; - -private: - void UnlockDefaultMilestones(); -}; - -#endif // AzeriteItem_h__ diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index ae0ea9784fd..4aa432afb26 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -17,8 +17,6 @@ #include "Item.h" #include "ArtifactPackets.h" -#include "AzeriteEmpoweredItem.h" -#include "AzeriteItem.h" #include "Bag.h" #include "CollectionMgr.h" #include "Common.h" @@ -54,12 +52,6 @@ Item* NewItemOrBag(ItemTemplate const* proto) if (proto->GetInventoryType() == INVTYPE_BAG) return new Bag(); - if (sDB2Manager.IsAzeriteItem(proto->GetId())) - return new AzeriteItem(); - - if (sDB2Manager.GetAzeriteEmpoweredItem(proto->GetId())) - return new AzeriteEmpoweredItem(); - return new Item(); } @@ -89,7 +81,7 @@ void AddItemsSetItem(Player* player, Item const* item) { uint32 maxLevel = sDB2Manager.GetCurveXAxisRange(item->GetBonus()->PlayerLevelToItemLevelCurveId).second; - if (Optional<ContentTuningLevels> contentTuning = sDB2Manager.GetContentTuningData(item->GetBonus()->ContentTuningId, player->m_playerData->CtrOptions->ContentTuningConditionMask, true)) + if (Optional<ContentTuningLevels> contentTuning = sDB2Manager.GetContentTuningData(item->GetBonus()->ContentTuningId, true)) maxLevel = std::min<uint32>(maxLevel, contentTuning->MaxLevel); if (player->GetLevel() > maxLevel) @@ -1474,7 +1466,6 @@ void Item::ClearEnchantment(EnchantmentSlot slot) SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), 0); SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), 0); SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), 0); - SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Inactive), 0); SetState(ITEM_CHANGED, GetOwner()); } @@ -2277,8 +2268,7 @@ uint32 Item::GetItemLevel(Player const* owner) const uint32 maxItemLevel = itemTemplate->HasFlag(ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP) ? 0 : owner->m_unitData->MaxItemLevel; bool pvpBonus = owner->IsUsingPvpItemLevels(); uint32 azeriteLevel = 0; - if (AzeriteItem const* azeriteItem = ToAzeriteItem()) - azeriteLevel = azeriteItem->GetEffectiveLevel(); + return Item::GetItemLevel(itemTemplate, _bonusData, owner->GetLevel(), GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL), minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus, azeriteLevel); } @@ -2297,7 +2287,7 @@ uint32 Item::GetItemLevel(ItemTemplate const* itemTemplate, BonusData const& bon { if (fixedLevel) level = fixedLevel; - else if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(bonusData.ContentTuningId, 0, true)) + else if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(bonusData.ContentTuningId, true)) level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel); itemLevel = uint32(sDB2Manager.GetCurveValueAt(bonusData.PlayerLevelToItemLevelCurveId, level)); @@ -2677,10 +2667,6 @@ void Item::ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enc SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData) .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex) .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank); - - if (IsEquipped()) - if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0)) - owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0); } } break; @@ -2697,10 +2683,6 @@ void Item::ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enc SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData) .ModifyValue(&UF::ItemData::ArtifactPowers, *artifactPowerIndex) .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank); - - if (IsEquipped()) - if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(m_itemData->ArtifactPowers[*artifactPowerIndex].ArtifactPowerID, newRank ? newRank - 1 : 0)) - owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0); } break; } @@ -2726,10 +2708,6 @@ void Item::ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enc SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData) .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex) .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank); - - if (IsEquipped()) - if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0)) - owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0); } } } @@ -2790,7 +2768,7 @@ void Item::SetFixedLevel(uint8 level) if (_bonusData.PlayerLevelToItemLevelCurveId) { - if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(_bonusData.ContentTuningId, 0, true)) + if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(_bonusData.ContentTuningId, true)) level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel); SetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL, level); diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index ec233c98ffc..12366987c79 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -240,10 +240,6 @@ class TC_GAME_API Item : public Object Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; } Bag const* ToBag() const { if (IsBag()) return reinterpret_cast<Bag const*>(this); else return nullptr; } - AzeriteItem* ToAzeriteItem() { return IsAzeriteItem() ? reinterpret_cast<AzeriteItem*>(this) : nullptr; } - AzeriteItem const* ToAzeriteItem() const { return IsAzeriteItem() ? reinterpret_cast<AzeriteItem const*>(this) : nullptr; } - AzeriteEmpoweredItem* ToAzeriteEmpoweredItem() { return IsAzeriteEmpoweredItem() ? reinterpret_cast<AzeriteEmpoweredItem*>(this) : nullptr; } - AzeriteEmpoweredItem const* ToAzeriteEmpoweredItem() const { return IsAzeriteEmpoweredItem() ? reinterpret_cast<AzeriteEmpoweredItem const*>(this) : nullptr; } bool IsRefundable() const { return HasItemFlag(ITEM_FIELD_FLAG_REFUNDABLE); } bool IsBOPTradeable() const { return HasItemFlag(ITEM_FIELD_FLAG_BOP_TRADEABLE); } diff --git a/src/server/game/Entities/Item/ItemBonusMgr.cpp b/src/server/game/Entities/Item/ItemBonusMgr.cpp index 748fd929647..8b6620e4e0f 100644 --- a/src/server/game/Entities/Item/ItemBonusMgr.cpp +++ b/src/server/game/Entities/Item/ItemBonusMgr.cpp @@ -32,10 +32,7 @@ struct ItemLevelSelectorQualityEntryComparator using ItemLevelSelectorQualities = std::set<ItemLevelSelectorQualityEntry const*, ItemLevelSelectorQualityEntryComparator>; -std::unordered_multimap<int32 /*azeriteUnlockMappingSetId*/, AzeriteUnlockMappingEntry const*> _azeriteUnlockMappings; -std::unordered_multimap<uint32 /*itemBonusTreeId*/, ChallengeModeItemBonusOverrideEntry const*> _challengeModeItemBonusOverrides; std::unordered_map<uint32 /*itemBonusListId*/, std::vector<ItemBonusEntry const*>> _itemBonusLists; -std::unordered_multimap<int32, ItemBonusListGroupEntryEntry const*> _itemBonusListGroupEntries; std::unordered_map<int16 /*itemLevelDelta*/, uint32 /*itemBonusListId*/> _itemLevelDeltaToBonusListContainer; std::unordered_map<uint32 /*itemLevelSelectorQualitySetId*/, ItemLevelSelectorQualities> _itemLevelQualitySelectorQualities; std::unordered_map<uint32 /*itemBonusTreeId*/, std::set<ItemBonusTreeNodeEntry const*>> _itemBonusTrees; @@ -46,18 +43,9 @@ namespace ItemBonusMgr { void Load() { - for (AzeriteUnlockMappingEntry const* azeriteUnlockMapping : sAzeriteUnlockMappingStore) - _azeriteUnlockMappings.emplace(azeriteUnlockMapping->AzeriteUnlockMappingSetID, azeriteUnlockMapping); - - for (ChallengeModeItemBonusOverrideEntry const* challengeModeItemBonusOverride : sChallengeModeItemBonusOverrideStore) - _challengeModeItemBonusOverrides.emplace(challengeModeItemBonusOverride->SrcItemBonusTreeID, challengeModeItemBonusOverride); - for (ItemBonusEntry const* bonus : sItemBonusStore) _itemBonusLists[bonus->ParentItemBonusListID].push_back(bonus); - for (ItemBonusListGroupEntryEntry const* bonusListGroupEntry : sItemBonusListGroupEntryStore) - _itemBonusListGroupEntries.emplace(bonusListGroupEntry->ItemBonusListGroupID, bonusListGroupEntry); - for (ItemBonusListLevelDeltaEntry const* itemBonusListLevelDelta : sItemBonusListLevelDeltaStore) _itemLevelDeltaToBonusListContainer[itemBonusListLevelDelta->ItemLevelDelta] = itemBonusListLevelDelta->ID; @@ -90,7 +78,7 @@ ItemContext GetContextForPlayer(MapDifficultyEntry const* mapDifficulty, Player if (mapDifficulty->ItemContextPickerID) { - uint32 contentTuningId = sDB2Manager.GetRedirectedContentTuningId(mapDifficulty->ContentTuningID, player->m_playerData->CtrOptions->ContentTuningConditionMask); + uint32 contentTuningId = mapDifficulty->ContentTuningID; ItemContextPickerEntryEntry const* selectedPickerEntry = nullptr; for (ItemContextPickerEntryEntry const* itemContextPickerEntry : sItemContextPickerEntryStore) @@ -112,9 +100,6 @@ ItemContext GetContextForPlayer(MapDifficultyEntry const* mapDifficulty, Player if (!meetsPlayerCondition) continue; - if (itemContextPickerEntry->LabelID && !sDB2Manager.HasContentTuningLabel(contentTuningId, itemContextPickerEntry->LabelID)) - continue; - if (!selectedPickerEntry || selectedPickerEntry->OrderIndex < itemContextPickerEntry->OrderIndex) selectedPickerEntry = itemContextPickerEntry; } @@ -144,33 +129,11 @@ uint32 GetItemBonusListForItemLevelDelta(int16 delta) bool CanApplyBonusTreeToItem(ItemTemplate const* itemTemplate, uint32 itemBonusTreeId, ItemBonusGenerationParams const& params) { - if (ItemBonusTreeEntry const* bonusTree = sItemBonusTreeStore.LookupEntry(itemBonusTreeId)) - { - if (bonusTree->InventoryTypeSlotMask) - if (!(1 << itemTemplate->GetInventoryType() & bonusTree->InventoryTypeSlotMask)) - return false; - - if (bonusTree->Flags & 0x8 && !itemTemplate->HasFlag(ITEM_FLAG2_CASTER_WEAPON)) - return false; - if (bonusTree->Flags & 0x10 && itemTemplate->HasFlag(ITEM_FLAG2_CASTER_WEAPON)) - return false; - if (bonusTree->Flags & 0x20 && !itemTemplate->HasFlag(ITEM_FLAG4_CC_TRINKET)) - return false; - if (bonusTree->Flags & 0x40 && itemTemplate->HasFlag(ITEM_FLAG4_CC_TRINKET)) - return false; - - if (bonusTree->Flags & 0x4) - return true; - } - if (std::set<ItemBonusTreeNodeEntry const*>* bonusTreeNodes = Trinity::Containers::MapGetValuePtr(_itemBonusTrees, itemBonusTreeId)) { bool anyNodeMatched = false; for (ItemBonusTreeNodeEntry const* bonusTreeNode : *bonusTreeNodes) { - if (bonusTreeNode->MinMythicPlusLevel > 0) - continue; - ItemContext nodeContext = ItemContext(bonusTreeNode->ItemContext); if (nodeContext == ItemContext::NONE || nodeContext == params.Context) { @@ -187,92 +150,6 @@ bool CanApplyBonusTreeToItem(ItemTemplate const* itemTemplate, uint32 itemBonusT uint32 GetBonusTreeIdOverride(uint32 itemBonusTreeId, ItemBonusGenerationParams const& params) { - // TODO: configure seasons globally - if (MythicPlusSeasonEntry const* mythicPlusSeason = sMythicPlusSeasonStore.LookupEntry(0)) - { - int32 selectedLevel = -1; - int32 selectedMilestoneSeason = -1; - ChallengeModeItemBonusOverrideEntry const* selectedItemBonusOverride = nullptr; - for (auto& [_, itemBonusOverride] : Trinity::Containers::MapEqualRange(_challengeModeItemBonusOverrides, itemBonusTreeId)) - { - if (itemBonusOverride->Type != 0) - continue; - - if (itemBonusOverride->Value > params.MythicPlusKeystoneLevel.value_or(-1)) - continue; - - if (itemBonusOverride->MythicPlusSeasonID) - { - MythicPlusSeasonEntry const* overrideSeason = sMythicPlusSeasonStore.LookupEntry(itemBonusOverride->MythicPlusSeasonID); - if (!overrideSeason) - continue; - - if (mythicPlusSeason->MilestoneSeason < overrideSeason->MilestoneSeason) - continue; - - if (selectedMilestoneSeason > overrideSeason->MilestoneSeason) - continue; - - if (selectedMilestoneSeason == overrideSeason->MilestoneSeason) - if (selectedLevel > itemBonusOverride->Value) - continue; - - selectedMilestoneSeason = overrideSeason->MilestoneSeason; - } - else if (selectedLevel > itemBonusOverride->Value) - continue; - - selectedLevel = itemBonusOverride->Value; - selectedItemBonusOverride = itemBonusOverride; - } - - if (selectedItemBonusOverride && selectedItemBonusOverride->DstItemBonusTreeID) - itemBonusTreeId = selectedItemBonusOverride->DstItemBonusTreeID; - } - - // TODO: configure seasons globally - if (PvpSeasonEntry const* pvpSeason = sPvpSeasonStore.LookupEntry(0)) - { - int32 selectedLevel = -1; - int32 selectedMilestoneSeason = -1; - ChallengeModeItemBonusOverrideEntry const* selectedItemBonusOverride = nullptr; - for (auto& [_, itemBonusOverride] : Trinity::Containers::MapEqualRange(_challengeModeItemBonusOverrides, itemBonusTreeId)) - { - if (itemBonusOverride->Type != 1) - continue; - - if (itemBonusOverride->Value > params.PvpTier.value_or(-1)) - continue; - - if (itemBonusOverride->PvPSeasonID) - { - PvpSeasonEntry const* overrideSeason = sPvpSeasonStore.LookupEntry(itemBonusOverride->PvPSeasonID); - if (!overrideSeason) - continue; - - if (pvpSeason->MilestoneSeason < overrideSeason->MilestoneSeason) - continue; - - if (selectedMilestoneSeason > overrideSeason->MilestoneSeason) - continue; - - if (selectedMilestoneSeason == overrideSeason->MilestoneSeason) - if (selectedLevel > itemBonusOverride->Value) - continue; - - selectedMilestoneSeason = overrideSeason->MilestoneSeason; - } - else if (selectedLevel > itemBonusOverride->Value) - continue; - - selectedLevel = itemBonusOverride->Value; - selectedItemBonusOverride = itemBonusOverride; - } - - if (selectedItemBonusOverride && selectedItemBonusOverride->DstItemBonusTreeID) - itemBonusTreeId = selectedItemBonusOverride->DstItemBonusTreeID; - } - return itemBonusTreeId; } @@ -297,141 +174,17 @@ void ApplyBonusTreeHelper(ItemTemplate const* itemTemplate, uint32 itemBonusTree if (nodeContext != ItemContext::NONE && params.Context != requiredContext) continue; - if (params.MythicPlusKeystoneLevel) - { - if (bonusTreeNode->MinMythicPlusLevel && params.MythicPlusKeystoneLevel < bonusTreeNode->MinMythicPlusLevel) - continue; - - if (bonusTreeNode->MaxMythicPlusLevel && params.MythicPlusKeystoneLevel > bonusTreeNode->MaxMythicPlusLevel) - continue; - } - if (bonusTreeNode->ChildItemBonusTreeID) ApplyBonusTreeHelper(itemTemplate, bonusTreeNode->ChildItemBonusTreeID, params, sequenceLevel, itemLevelSelectorId, bonusListIDs); else if (bonusTreeNode->ChildItemBonusListID) bonusListIDs->push_back(bonusTreeNode->ChildItemBonusListID); else if (bonusTreeNode->ChildItemLevelSelectorID) *itemLevelSelectorId = bonusTreeNode->ChildItemLevelSelectorID; - else if (bonusTreeNode->ChildItemBonusListGroupID) - { - int32 resolvedSequenceLevel = sequenceLevel; - switch (originalItemBonusTreeId) - { - case 4001: - resolvedSequenceLevel = 1; - break; - case 4079: - if (params.MythicPlusKeystoneLevel) - { - switch (bonusTreeNode->IblGroupPointsModSetID) - { - case 2909: // MythicPlus_End_of_Run levels 2-8 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(62951, *params.MythicPlusKeystoneLevel); - break; - case 2910: // MythicPlus_End_of_Run levels 9-16 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(62952, *params.MythicPlusKeystoneLevel); - break; - case 2911: // MythicPlus_End_of_Run levels 17-20 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(62954, *params.MythicPlusKeystoneLevel); - break; - case 3007: // MythicPlus_Jackpot (weekly reward) levels 2-7 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(64388, *params.MythicPlusKeystoneLevel); - break; - case 3008: // MythicPlus_Jackpot (weekly reward) levels 8-15 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(64389, *params.MythicPlusKeystoneLevel); - break; - case 3009: // MythicPlus_Jackpot (weekly reward) levels 16-20 - resolvedSequenceLevel = sDB2Manager.GetCurveValueAt(64395, *params.MythicPlusKeystoneLevel); - break; - default: - break; - } - } - break; - case 4125: - resolvedSequenceLevel = 2; - break; - case 4126: - resolvedSequenceLevel = 3; - break; - case 4127: - resolvedSequenceLevel = 4; - break; - case 4128: - switch (params.Context) - { - case ItemContext::Raid_Normal: - case ItemContext::Raid_Raid_Finder: - case ItemContext::Raid_Heroic: - resolvedSequenceLevel = 2; - break; - case ItemContext::Raid_Mythic: - resolvedSequenceLevel = 6; - break; - default: - break; - } - break; - case 4140: - switch (params.Context) - { - case ItemContext::Dungeon_Normal: - resolvedSequenceLevel = 2; - break; - case ItemContext::Dungeon_Mythic: - resolvedSequenceLevel = 4; - break; - default: - break; - } - break; - default: - break; - } - - for (auto const& [_, bonusListGroupEntry] : Trinity::Containers::MapEqualRange(_itemBonusListGroupEntries, bonusTreeNode->ChildItemBonusListGroupID)) - { - if ((resolvedSequenceLevel > 0 || bonusListGroupEntry->SequenceValue <= 0) && resolvedSequenceLevel != bonusListGroupEntry->SequenceValue) - continue; - - *itemLevelSelectorId = bonusListGroupEntry->ItemLevelSelectorID; - bonusListIDs->push_back(bonusListGroupEntry->ItemBonusListID); - break; - } - } } } int32 GetAzeriteUnlockBonusList(uint16 azeriteUnlockMappingSetId, uint16 minItemLevel, InventoryType inventoryType) { - AzeriteUnlockMappingEntry const* selectedAzeriteUnlockMapping = nullptr; - for (auto [_, azeriteUnlockMapping] : Trinity::Containers::MapEqualRange(_azeriteUnlockMappings, azeriteUnlockMappingSetId)) - { - if (minItemLevel < azeriteUnlockMapping->ItemLevel) - continue; - - if (selectedAzeriteUnlockMapping && selectedAzeriteUnlockMapping->ItemLevel > azeriteUnlockMapping->ItemLevel) - continue; - - selectedAzeriteUnlockMapping = azeriteUnlockMapping; - } - - if (selectedAzeriteUnlockMapping) - { - switch (inventoryType) - { - case INVTYPE_HEAD: - return selectedAzeriteUnlockMapping->ItemBonusListHead; - case INVTYPE_SHOULDERS: - return selectedAzeriteUnlockMapping->ItemBonusListShoulders; - case INVTYPE_CHEST: - case INVTYPE_ROBE: - return selectedAzeriteUnlockMapping->ItemBonusListChest; - default: - break; - } - } - return 0; } @@ -473,9 +226,6 @@ std::vector<int32> GetBonusListsForItem(uint32 itemId, ItemBonusGenerationParams bonusListIDs.push_back((*itemSelectorQuality)->QualityItemBonusListID); } } - - if (int32 azeriteUnlockBonusListId = GetAzeriteUnlockBonusList(selector->AzeriteUnlockMappingSet, selector->MinItemLevel, itemTemplate->GetInventoryType())) - bonusListIDs.push_back(azeriteUnlockBonusListId); } return bonusListIDs; diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 297d39f1da9..224a8cc6001 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -160,14 +160,14 @@ TC_GAME_API float GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint switch (quality) { case ITEM_QUALITY_UNCOMMON: - return randPropPointsEntry->GoodF[propIndex]; + return randPropPointsEntry->Good[propIndex]; case ITEM_QUALITY_RARE: case ITEM_QUALITY_HEIRLOOM: - return randPropPointsEntry->SuperiorF[propIndex]; + return randPropPointsEntry->Superior[propIndex]; case ITEM_QUALITY_EPIC: case ITEM_QUALITY_LEGENDARY: case ITEM_QUALITY_ARTIFACT: - return randPropPointsEntry->EpicF[propIndex]; + return randPropPointsEntry->Epic[propIndex]; } return 0; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 96f75e910b4..2130605f1d6 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2379,7 +2379,7 @@ int32 WorldObject::CalcSpellDuration(SpellInfo const* spellInfo, std::vector<Spe int32 baseComboCost = (*itr)->ManaCost + (*itr)->OptionalCost; if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(POWER_COMBO_POINTS)) - baseComboCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, (*itr)->PowerCostPct + (*itr)->OptionalCostPct)); + baseComboCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, (*itr)->PowerCostPct)); float durationPerComboPoint = float(maxduration - minduration) / baseComboCost; return minduration + int32(durationPerComboPoint * consumedItr->Amount); diff --git a/src/server/game/Entities/Player/CollectionMgr.cpp b/src/server/game/Entities/Player/CollectionMgr.cpp index 7868afe5ab9..5dc2febd2fe 100644 --- a/src/server/game/Entities/Player/CollectionMgr.cpp +++ b/src/server/game/Entities/Player/CollectionMgr.cpp @@ -884,11 +884,6 @@ void CollectionMgr::SendFavoriteAppearances() const void CollectionMgr::LoadTransmogIllusions() { - Player* owner = _owner->GetPlayer(); - boost::to_block_range(*_transmogIllusions, DynamicBitsetBlockOutputIterator([owner](uint32 blockValue) - { - owner->AddIllusionBlock(blockValue); - })); } void CollectionMgr::LoadAccountTransmogIllusions(PreparedQueryResult knownTransmogIllusions) @@ -951,21 +946,6 @@ void CollectionMgr::SaveAccountTransmogIllusions(LoginDatabaseTransaction trans) void CollectionMgr::AddTransmogIllusion(uint32 transmogIllusionId) { - Player* owner = _owner->GetPlayer(); - if (_transmogIllusions->size() <= transmogIllusionId) - { - std::size_t numBlocks = _transmogIllusions->num_blocks(); - _transmogIllusions->resize(transmogIllusionId + 1); - numBlocks = _transmogIllusions->num_blocks() - numBlocks; - while (numBlocks--) - owner->AddIllusionBlock(0); - } - - _transmogIllusions->set(transmogIllusionId); - uint32 blockIndex = transmogIllusionId / 32; - uint32 bitIndex = transmogIllusionId % 32; - - owner->AddIllusionFlag(blockIndex, 1 << bitIndex); } bool CollectionMgr::HasTransmogIllusion(uint32 transmogIllusionId) const diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e587dd7e389..08d16d09232 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21,8 +21,6 @@ #include "AchievementMgr.h" #include "ArenaTeam.h" #include "ArenaTeamMgr.h" -#include "AzeriteEmpoweredItem.h" -#include "AzeriteItem.h" #include "Bag.h" #include "Battlefield.h" #include "BattlefieldMgr.h" @@ -2523,9 +2521,9 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDoneNeg, i), 0); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDonePos, i), 0); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModDamageDonePercent, i), 1.0f); - SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModHealingDonePercent, i), 1.0f); } + SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModHealingDonePercent), 1.0f); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModSpellPowerPercent), 1.0f); //reset attack power, damage and attack speed fields @@ -2555,7 +2553,8 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::RangedCritPercentage), 0.0f); // Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset - SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::SpellCritPercentage), 0.0f); + for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::SpellCritPercentage, i), 0.0f); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ParryPercentage), 0.0f); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::BlockPercentage), 0.0f); @@ -2567,18 +2566,12 @@ void Player::InitStatsForLevel(bool reapplyMods) // set armor (resistance 0) to original value (create_agility*2) SetArmor(int32(m_createStats[STAT_AGILITY] * 2), 0); - SetBonusResistanceMod(SPELL_SCHOOL_NORMAL, 0); // set other resistance to original value (0) for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - { SetResistance(SpellSchools(i), 0); - SetBonusResistanceMod(SpellSchools(i), 0); - } SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModTargetResistance), 0); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModTargetPhysicalResistance), 0); - for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) - SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostModifier, i), 0); // Reset no reagent cost field SetNoRegentCostMask(flag128()); @@ -5342,63 +5335,7 @@ float Player::GetRatingMultiplier(CombatRating cr) const float Player::GetRatingBonusValue(CombatRating cr) const { - float baseResult = ApplyRatingDiminishing(cr, float(m_activePlayerData->CombatRatings[cr]) * GetRatingMultiplier(cr)); - if (cr != CR_RESILIENCE_PLAYER_DAMAGE) - return baseResult; - return float(1.0f - pow(0.99f, baseResult)) * 100.0f; -} - -float Player::ApplyRatingDiminishing(CombatRating cr, float bonusValue) const -{ - uint32 diminishingCurveId = 0; - switch (cr) - { - case CR_DODGE: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::DodgeDiminishing); - break; - case CR_PARRY: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::ParryDiminishing); - break; - case CR_BLOCK: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::BlockDiminishing); - break; - case CR_CRIT_MELEE: - case CR_CRIT_RANGED: - case CR_CRIT_SPELL: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::CritDiminishing); - break; - case CR_SPEED: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::SpeedDiminishing); - break; - case CR_LIFESTEAL: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::LifestealDiminishing); - break; - case CR_HASTE_MELEE: - case CR_HASTE_RANGED: - case CR_HASTE_SPELL: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::HasteDiminishing); - break; - case CR_AVOIDANCE: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::AvoidanceDiminishing); - break; - case CR_MASTERY: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::MasteryDiminishing); - break; - case CR_VERSATILITY_DAMAGE_DONE: - case CR_VERSATILITY_HEALING_DONE: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::VersatilityDoneDiminishing); - break; - case CR_VERSATILITY_DAMAGE_TAKEN: - diminishingCurveId = sDB2Manager.GetGlobalCurveId(GlobalCurve::VersatilityTakenDiminishing); - break; - default: - break; - } - - if (diminishingCurveId) - return sDB2Manager.GetCurveValueAt(diminishingCurveId, bonusValue); - - return bonusValue; + return float(m_activePlayerData->CombatRatings[cr]) * GetRatingMultiplier(cr); } float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const @@ -5504,8 +5441,8 @@ void Player::UpdateRating(CombatRating cr) { // explicit affected values float const multiplier = GetRatingMultiplier(cr); - float const oldVal = ApplyRatingDiminishing(cr, oldRating * multiplier); - float const newVal = ApplyRatingDiminishing(cr, amount * multiplier); + float const oldVal = float(oldRating * multiplier); + float const newVal = float(amount * multiplier); switch (cr) { case CR_HASTE_MELEE: @@ -6434,46 +6371,6 @@ void Player::CheckAreaExploreAndOutdoor() SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ExploredZones, offset), val); UpdateCriteria(CriteriaType::RevealWorldMapOverlay, GetAreaId()); - - if (Optional<ContentTuningLevels> areaLevels = sDB2Manager.GetContentTuningData(areaEntry->ContentTuningID, m_playerData->CtrOptions->ContentTuningConditionMask)) - { - if (IsMaxLevel()) - { - SendExplorationExperience(areaId, 0); - } - else - { - int16 areaLevel = std::min(std::max(int16(GetLevel()), areaLevels->MinLevel), areaLevels->MaxLevel); - int32 diff = int32(GetLevel()) - areaLevel; - uint32 XP; - if (diff < -5) - { - XP = uint32(sObjectMgr->GetBaseXP(GetLevel() + 5) * sWorld->getRate(RATE_XP_EXPLORE)); - } - else if (diff > 5) - { - int32 exploration_percent = 100 - ((diff - 5) * 5); - if (exploration_percent < 0) - exploration_percent = 0; - - XP = uint32(sObjectMgr->GetBaseXP(areaLevel) * exploration_percent / 100 * sWorld->getRate(RATE_XP_EXPLORE)); - } - else - { - XP = uint32(sObjectMgr->GetBaseXP(areaLevel) * sWorld->getRate(RATE_XP_EXPLORE)); - } - - if (sWorld->getIntConfig(CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO)) - { - uint32 minScaledXP = uint32(sObjectMgr->GetBaseXP(areaLevel)*sWorld->getRate(RATE_XP_EXPLORE)) * sWorld->getIntConfig(CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO) / 100; - XP = std::max(minScaledXP, XP); - } - - GiveXP(XP, nullptr); - SendExplorationExperience(areaId, XP); - } - TC_LOG_DEBUG("entities.player", "Player '{}' ({}) discovered a new area: {}", GetName(),GetGUID().ToString(), areaId); - } } } @@ -6529,24 +6426,14 @@ ReputationRank Player::GetReputationRank(uint32 faction) const // Calculate total reputation percent player gain with quest/creature level int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus) { - bool noBonuses = false; - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction)) - if (FriendshipReputationEntry const* friendshipReputation = sFriendshipReputationStore.LookupEntry(factionEntry->FriendshipRepID)) - if (friendshipReputation->GetFlags().HasFlag(FriendshipReputationFlags::NoRepGainModifiers)) - noBonuses = true; - float percent = 100.0f; + float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN)); - if (!noBonuses) - { - float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN)); + // faction specific auras only seem to apply to kills + if (source == REPUTATION_SOURCE_KILL) + repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction); - // faction specific auras only seem to apply to kills - if (source == REPUTATION_SOURCE_KILL) - repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction); - - percent += rep > 0 ? repMod : -repMod; - } + percent += rep > 0 ? repMod : -repMod; float rate; switch (source) @@ -6636,9 +6523,8 @@ void Player::RewardReputation(Unit* victim, float rate) Map const* map = GetMap(); if (map->IsNonRaidDungeon()) if (LFGDungeonsEntry const* dungeon = DB2Manager::GetLfgDungeon(map->GetId(), map->GetDifficultyID())) - if (Optional<ContentTuningLevels> dungeonLevels = sDB2Manager.GetContentTuningData(dungeon->ContentTuningID, m_playerData->CtrOptions->ContentTuningConditionMask)) - if (dungeonLevels->TargetLevelMax == int16(GetMaxLevelForExpansion(EXPANSION_WRATH_OF_THE_LICH_KING))) - ChampioningFaction = GetChampioningFaction(); + if (dungeon->TargetLevel == int16(GetMaxLevelForExpansion(EXPANSION_WRATH_OF_THE_LICH_KING))) + ChampioningFaction = GetChampioningFaction(); } uint32 team = GetTeam(); @@ -7182,12 +7068,7 @@ void Player::ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSour // Azerite if (id == CURRENCY_TYPE_AZERITE) - { - if (amount > 0) - if (Item* heartOfAzeroth = GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - heartOfAzeroth->ToAzeriteItem()->GiveXP(uint64(amount)); return; - } PlayerCurrenciesMap::iterator itr = _currencyStorage.find(id); if (itr == _currencyStorage.end()) @@ -7411,9 +7292,6 @@ uint32 Player::GetCurrencyMaxQuantity(CurrencyTypesEntry const* currency, bool o return 0; uint32 maxQuantity = currency->MaxQty; - if (currency->MaxQtyWorldStateID) - maxQuantity = sWorldStateMgr->GetValue(currency->MaxQtyWorldStateID, GetMap()); - uint32 increasedCap = 0; if (currency->GetFlags().HasFlag(CurrencyTypesFlags::DynamicMaximum)) increasedCap = GetCurrencyIncreasedCapQuantity(currency->ID); @@ -7898,8 +7776,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply, bool updateItemA if (attackType != MAX_ATTACK) UpdateWeaponDependentAuras(attackType); } - ApplyArtifactPowers(item, apply); - ApplyAzeritePowers(item, apply); + ApplyEnchantment(item, apply); TC_LOG_DEBUG("entities.player.items", "Player::_ApplyItemMods: completed"); @@ -8187,22 +8064,6 @@ void Player::_ApplyWeaponDamage(uint8 slot, Item* item, bool apply) if (proto->GetDelay() && !(shapeshift && shapeshift->CombatRoundTime)) SetBaseAttackTime(attType, apply ? proto->GetDelay() : BASE_ATTACK_TIME); - int32 weaponBasedAttackPower = apply ? int32(proto->GetDPS(itemLevel) * 6.0f) : 0; - switch (attType) - { - case BASE_ATTACK: - SetMainHandWeaponAttackPower(weaponBasedAttackPower); - break; - case OFF_ATTACK: - SetOffHandWeaponAttackPower(weaponBasedAttackPower); - break; - case RANGED_ATTACK: - SetRangedWeaponAttackPower(weaponBasedAttackPower); - break; - default: - break; - } - if (CanModifyStats() && (damage || proto->GetDelay())) UpdateDamagePhysical(attType); } @@ -8434,196 +8295,6 @@ void Player::UpdateItemSetAuras(bool formChange /*= false*/) } } -void Player::ApplyArtifactPowers(Item* item, bool apply) -{ - if (item->IsArtifactDisabled()) - return; - - for (UF::ArtifactPower const& artifactPower : item->m_itemData->ArtifactPowers) - { - uint8 rank = artifactPower.CurrentRankWithBonus; - if (!rank) - continue; - - if (sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS) - rank = 1; - - ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, rank - 1); - if (!artifactPowerRank) - continue; - - ApplyArtifactPowerRank(item, artifactPowerRank, apply); - } - - if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(item->GetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID))) - if (artifactAppearance->OverrideShapeshiftDisplayID && GetShapeshiftForm() == ShapeshiftForm(artifactAppearance->OverrideShapeshiftFormID)) - RestoreDisplayId(); -} - -void Player::ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const* artifactPowerRank, bool apply) -{ - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(artifactPowerRank->SpellID, DIFFICULTY_NONE); - if (!spellInfo) - return; - - if (spellInfo->IsPassive()) - { - AuraApplication* powerAura = GetAuraApplication(artifactPowerRank->SpellID, ObjectGuid::Empty, artifact->GetGUID()); - if (powerAura) - { - if (apply) - { - for (AuraEffect* auraEffect : powerAura->GetBase()->GetAuraEffects()) - { - if (!auraEffect) - continue; - - if (powerAura->HasEffect(auraEffect->GetEffIndex())) - auraEffect->ChangeAmount(artifactPowerRank->AuraPointsOverride ? artifactPowerRank->AuraPointsOverride : auraEffect->GetSpellEffectInfo().CalcValue()); - } - } - else - RemoveAura(powerAura); - } - else if (apply) - { - CastSpellExtraArgs args; - args.SetTriggerFlags(TRIGGERED_FULL_MASK); - args.SetCastItem(artifact); - if (artifactPowerRank->AuraPointsOverride) - for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects()) - args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + AsUnderlyingType(spellEffectInfo.EffectIndex)), artifactPowerRank->AuraPointsOverride); - - CastSpell(this, artifactPowerRank->SpellID, args); - } - } - else - { - if (apply && !HasSpell(artifactPowerRank->SpellID)) - { - AddTemporarySpell(artifactPowerRank->SpellID); - WorldPackets::Spells::LearnedSpells learnedSpells; - WorldPackets::Spells::LearnedSpellInfo& learnedSpellInfo = learnedSpells.ClientLearnedSpellData.emplace_back(); - learnedSpellInfo.SpellID = artifactPowerRank->SpellID; - learnedSpells.SuppressMessaging = true; - SendDirectMessage(learnedSpells.Write()); - } - else if (!apply) - { - RemoveTemporarySpell(artifactPowerRank->SpellID); - WorldPackets::Spells::UnlearnedSpells unlearnedSpells; - unlearnedSpells.SuppressMessaging = true; - unlearnedSpells.SpellID.push_back(artifactPowerRank->SpellID); - SendDirectMessage(unlearnedSpells.Write()); - } - } - -} - -void Player::ApplyAzeritePowers(Item* item, bool apply) -{ - if (AzeriteItem* azeriteItem = item->ToAzeriteItem()) - { - // milestone powers - for (uint32 azeriteItemMilestonePowerId : azeriteItem->m_azeriteItemData->UnlockedEssenceMilestones) - ApplyAzeriteItemMilestonePower(azeriteItem, sAzeriteItemMilestonePowerStore.AssertEntry(azeriteItemMilestonePowerId), apply); - - // essences - if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences()) - for (uint8 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot) - if (selectedEssences->AzeriteEssenceID[slot]) - ApplyAzeriteEssence(azeriteItem, selectedEssences->AzeriteEssenceID[slot], azeriteItem->GetEssenceRank(selectedEssences->AzeriteEssenceID[slot]), - AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(slot)->Type) == AzeriteItemMilestoneType::MajorEssence, apply); - } - else if (AzeriteEmpoweredItem* azeriteEmpoweredItem = item->ToAzeriteEmpoweredItem()) - { - if (!apply || GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Equipment)) - for (int32 i = 0; i < MAX_AZERITE_EMPOWERED_TIER; ++i) - if (AzeritePowerEntry const* azeritePower = sAzeritePowerStore.LookupEntry(azeriteEmpoweredItem->GetSelectedAzeritePower(i))) - ApplyAzeritePower(azeriteEmpoweredItem, azeritePower, apply); - } -} - -void Player::ApplyAzeriteItemMilestonePower(AzeriteItem* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply) -{ - AzeriteItemMilestoneType type = AzeriteItemMilestoneType(azeriteItemMilestonePower->Type); - if (type == AzeriteItemMilestoneType::BonusStamina) - { - if (AzeritePowerEntry const* azeritePower = sAzeritePowerStore.LookupEntry(azeriteItemMilestonePower->AzeritePowerID)) - { - if (apply) - CastSpell(this, azeritePower->SpellID, item); - else - RemoveAurasDueToItemSpell(azeritePower->SpellID, item->GetGUID()); - } - } -} - -void Player::ApplyAzeriteEssence(AzeriteItem* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply) -{ - for (uint32 currentRank = 1; currentRank <= rank; ++currentRank) - { - if (AzeriteEssencePowerEntry const* azeriteEssencePower = sDB2Manager.GetAzeriteEssencePower(azeriteEssenceId, currentRank)) - { - ApplyAzeriteEssencePower(item, azeriteEssencePower, major, apply); - if (major && currentRank == 1) - { - if (apply) - { - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellMod(SPELLVALUE_BASE_POINT0, azeriteEssencePower->MajorPowerDescription); - CastSpell(this, SPELL_ID_HEART_ESSENCE_ACTION_BAR_OVERRIDE, args); - } - else - RemoveAurasDueToSpell(SPELL_ID_HEART_ESSENCE_ACTION_BAR_OVERRIDE); - } - } - } -} - -void Player::ApplyAzeriteEssencePower(AzeriteItem* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply) -{ - if (SpellInfo const* powerSpell = sSpellMgr->GetSpellInfo(azeriteEssencePower->MinorPowerDescription, DIFFICULTY_NONE)) - { - if (apply) - CastSpell(this, powerSpell->Id, item); - else - RemoveAurasDueToItemSpell(powerSpell->Id, item->GetGUID()); - } - - if (major) - { - if (SpellInfo const* powerSpell = sSpellMgr->GetSpellInfo(azeriteEssencePower->MajorPowerDescription, DIFFICULTY_NONE)) - { - if (powerSpell->IsPassive()) - { - if (apply) - CastSpell(this, powerSpell->Id, item); - else - RemoveAurasDueToItemSpell(powerSpell->Id, item->GetGUID()); - } - else - { - if (apply) - LearnSpell(powerSpell->Id, true, 0, true); - else - RemoveSpell(powerSpell->Id, false, false, true); - } - } - } -} - -void Player::ApplyAzeritePower(AzeriteEmpoweredItem* item, AzeritePowerEntry const* azeritePower, bool apply) -{ - if (apply) - { - if (!azeritePower->SpecSetID || sDB2Manager.IsSpecSetMember(azeritePower->SpecSetID, AsUnderlyingType(GetPrimarySpecialization()))) - CastSpell(this, azeritePower->SpellID, item); - } - else - RemoveAurasDueToItemSpell(azeritePower->SpellID, item->GetGUID()); -} - void Player::CastItemCombatSpell(DamageInfo const& damageInfo) { Unit* target = damageInfo.GetVictim(); @@ -8911,7 +8582,6 @@ void Player::_RemoveAllItemMods() ApplyItemEquipSpell(m_items[i], false); ApplyEnchantment(m_items[i], false); - ApplyArtifactPowers(m_items[i], false); } } @@ -8966,7 +8636,6 @@ void Player::_ApplyAllItemMods() continue; ApplyItemEquipSpell(m_items[i], true); - ApplyArtifactPowers(m_items[i], true); ApplyEnchantment(m_items[i], true); } } @@ -8997,34 +8666,6 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply) } } -void Player::ApplyAllAzeriteItemMods(bool apply) -{ - for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) - { - if (m_items[i]) - { - if (!m_items[i]->IsAzeriteItem() || m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType()))) - continue; - - ApplyAzeritePowers(m_items[i], apply); - } - } -} - -void Player::ApplyAllAzeriteEmpoweredItemMods(bool apply) -{ - for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) - { - if (m_items[i]) - { - if (!m_items[i]->IsAzeriteEmpoweredItem() || m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType()))) - continue; - - ApplyAzeritePowers(m_items[i], apply); - } - } -} - Loot* Player::GetLootByWorldObjectGUID(ObjectGuid const& lootWorldObjectGuid) const { auto itr = std::find_if(m_AELootView.begin(), m_AELootView.end(), [&lootWorldObjectGuid](std::pair<ObjectGuid const, Loot*> const& lootView) @@ -10945,7 +10586,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool Optional<ContentTuningLevels> requiredLevels; // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items) if (pItem->GetQuality() == ITEM_QUALITY_HEIRLOOM) - requiredLevels = sDB2Manager.GetContentTuningData(pItem->GetScalingContentTuningId(), 0, true); + requiredLevels = sDB2Manager.GetContentTuningData(pItem->GetScalingContentTuningId(), true); if (requiredLevels && requiredLevels->MaxLevel < DEFAULT_MAX_LEVEL && requiredLevels->MaxLevel < GetLevel() && !sDB2Manager.GetHeirloomByItemId(pProto->GetId())) return EQUIP_ERR_NOT_EQUIPPABLE; @@ -11983,14 +11624,12 @@ void Player::SetVisibleItemSlot(uint8 slot, Item* pItem) if (pItem) { SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemID), pItem->GetVisibleEntry(this)); - SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::SecondaryItemModifiedAppearanceID), pItem->GetVisibleSecondaryModifiedAppearanceId(this)); SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemAppearanceModID), pItem->GetVisibleAppearanceModId(this)); SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemVisual), pItem->GetVisibleItemVisual(this)); } else { SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemID), 0); - SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::SecondaryItemModifiedAppearanceID), 0); SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemAppearanceModID), 0); SetUpdateFieldValue(itemField.ModifyValue(&UF::VisibleItem::ItemVisual), 0); } @@ -14416,7 +14055,7 @@ int32 Player::GetQuestMinLevel(Quest const* quest) const int32 Player::GetQuestMinLevel(uint32 contentTuningId) const { - if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(contentTuningId, m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(contentTuningId)) { ChrRacesEntry const* race = sChrRacesStore.AssertEntry(GetRace()); FactionTemplateEntry const* raceFaction = sFactionTemplateStore.AssertEntry(race->FactionID); @@ -14440,7 +14079,7 @@ int32 Player::GetQuestLevel(Quest const* quest) const int32 Player::GetQuestLevel(uint32 contentTuningId) const { - if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(contentTuningId, m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(contentTuningId)) { int32 minLevel = GetQuestMinLevel(contentTuningId); int32 maxLevel = questLevels->MaxLevel; @@ -16374,13 +16013,6 @@ int64 Player::GetQuestSlotEndTime(uint16 slot) const return m_playerData->QuestLog[slot].EndTime; } -bool Player::GetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) const -{ - if (objectiveIndex < MAX_QUEST_COUNTS) - return (*m_playerData->QuestLog[slot].ObjectiveFlags) & (1 << objectiveIndex); - return false; -} - int32 Player::GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objective) const { if (objective.StorageIndex < 0) @@ -16400,7 +16032,7 @@ int32 Player::GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objec if (!objective.IsStoringFlag()) return GetQuestSlotCounter(slot, objective.StorageIndex); - return GetQuestSlotObjectiveFlag(slot, objective.StorageIndex) ? 1 : 0; + return uint8((GetQuestSlotState(slot) > objective.StorageIndex) != 0); } void Player::SetQuestSlot(uint16 slot, uint32 quest_id) @@ -16409,7 +16041,6 @@ void Player::SetQuestSlot(uint16 slot, uint32 quest_id) SetUpdateFieldValue(questLogField.ModifyValue(&UF::QuestLog::QuestID), quest_id); SetUpdateFieldValue(questLogField.ModifyValue(&UF::QuestLog::StateFlags), 0); SetUpdateFieldValue(questLogField.ModifyValue(&UF::QuestLog::EndTime), 0); - SetUpdateFieldValue(questLogField.ModifyValue(&UF::QuestLog::ObjectiveFlags), 0); for (uint32 i = 0; i < MAX_QUEST_COUNTS; ++i) SetUpdateFieldValue(questLogField.ModifyValue(&UF::QuestLog::ObjectiveProgress, i), 0); } @@ -16445,20 +16076,6 @@ void Player::SetQuestSlotEndTime(uint16 slot, time_t endTime) .ModifyValue(&UF::QuestLog::EndTime), uint32(endTime)); } -void Player::SetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) -{ - SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData) - .ModifyValue(&UF::PlayerData::QuestLog, slot) - .ModifyValue(&UF::QuestLog::ObjectiveFlags), 1 << objectiveIndex); -} - -void Player::RemoveQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) -{ - RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_playerData) - .ModifyValue(&UF::PlayerData::QuestLog, slot) - .ModifyValue(&UF::QuestLog::ObjectiveFlags), 1 << objectiveIndex); -} - void Player::SetQuestCompletedBit(uint32 questBit, bool completed) { if (!questBit) @@ -16868,9 +16485,9 @@ void Player::SetQuestObjectiveData(QuestObjective const& objective, int32 data) if (!objective.IsStoringFlag()) SetQuestSlotCounter(status.Slot, objective.StorageIndex, data); else if (data) - SetQuestSlotObjectiveFlag(status.Slot, objective.StorageIndex); + SetQuestSlotState(status.Slot, 256 << objective.StorageIndex); else - RemoveQuestSlotObjectiveFlag(status.Slot, objective.StorageIndex); + RemoveQuestSlotState(status.Slot, 256 << objective.StorageIndex); } bool Player::IsQuestObjectiveCompletable(uint16 slot, Quest const* quest, QuestObjective const& objective) const @@ -17222,9 +16839,9 @@ void Player::_LoadDeclinedNames(PreparedQueryResult result) if (!result) return; - auto declinedNames = m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::DeclinedNames, 0); + m_declinedname = std::make_unique<DeclinedName>(); for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) - SetUpdateFieldValue(declinedNames.ModifyValue(&UF::DeclinedNames::Name, i), (*result)[i].GetString()); + m_declinedname->name[i] = (*result)[i].GetString(); } void Player::_LoadArenaTeamInfo(PreparedQueryResult result) @@ -17623,8 +17240,6 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol return false; } - SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::Name), m_name); - SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::WowAccount), GetSession()->GetAccountGUID()); SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::BnetAccount), GetSession()->GetBattlenetAccountGUID()); @@ -18203,9 +17818,6 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol } } - SetPersonalTabard(fields.personalTabardEmblemStyle, fields.personalTabardEmblemColor, fields.personalTabardBorderStyle, - fields.personalTabardBorderColor, fields.personalTabardBackgroundColor); - TC_LOG_DEBUG("entities.player.loading", "Player::LoadFromDB: The value of player '{}' after load item and aura is: ", m_name); outDebugValues(); @@ -18303,21 +17915,6 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol PushQuests(); - for (TransmogIllusionEntry const* transmogIllusion : sTransmogIllusionStore) - { - if (!transmogIllusion->GetFlags().HasFlag(TransmogIllusionFlags::PlayerConditionGrantsOnLogin)) - continue; - - if (GetSession()->GetCollectionMgr()->HasTransmogIllusion(transmogIllusion->ID)) - continue; - - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(transmogIllusion->UnlockConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - continue; - - GetSession()->GetCollectionMgr()->AddTransmogIllusion(transmogIllusion->ID); - } - return true; } @@ -18637,14 +18234,6 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti if (item->GetTemplate()->GetArtifactID() && addionalDataPtr->Artifact) item->LoadArtifactData(this, addionalDataPtr->Artifact->Xp, addionalDataPtr->Artifact->ArtifactAppearanceId, addionalDataPtr->Artifact->ArtifactTierId, addionalDataPtr->Artifact->ArtifactPowers); - - if (addionalDataPtr->AzeriteItem) - if (AzeriteItem* azeriteItem = item->ToAzeriteItem()) - azeriteItem->LoadAzeriteItemData(this, *addionalDataPtr->AzeriteItem); - - if (addionalDataPtr->AzeriteEmpoweredItem) - if (AzeriteEmpoweredItem* azeriteEmpoweredItem = item->ToAzeriteEmpoweredItem()) - azeriteEmpoweredItem->LoadAzeriteEmpoweredItemData(this, *addionalDataPtr->AzeriteEmpoweredItem); } ObjectGuid bagGuid = fields[51].GetUInt64() ? ObjectGuid::Create<HighGuid::Item>(fields[51].GetUInt64()) : ObjectGuid::Empty; @@ -18772,8 +18361,6 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti } //if (IsAlive()) _ApplyAllItemMods(); - // Apply all azerite item mods, azerite empowered item mods will get applied through its spell script - ApplyAllAzeriteItemMods(true); } void Player::_LoadVoidStorage(PreparedQueryResult result) @@ -18954,8 +18541,6 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 GetGUID().ToString(), GetName(), itemEntry); Item::DeleteFromInventoryDB(trans, itemGuid); Item::DeleteFromDB(trans, itemGuid); - AzeriteItem::DeleteFromDB(trans, itemGuid); - AzeriteEmpoweredItem::DeleteFromDB(trans, itemGuid); } return item; } @@ -18979,8 +18564,6 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint trans->Append(stmt); Item::DeleteFromDB(trans, itemGuid); - AzeriteItem::DeleteFromDB(trans, itemGuid); - AzeriteEmpoweredItem::DeleteFromDB(trans, itemGuid); CharacterDatabase.CommitTransaction(trans); return nullptr; @@ -19009,14 +18592,6 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint if (item->GetTemplate()->GetArtifactID() && addionalData->Artifact) item->LoadArtifactData(player, addionalData->Artifact->Xp, addionalData->Artifact->ArtifactAppearanceId, addionalData->Artifact->ArtifactTierId, addionalData->Artifact->ArtifactPowers); - - if (addionalData->AzeriteItem) - if (AzeriteItem* azeriteItem = item->ToAzeriteItem()) - azeriteItem->LoadAzeriteItemData(player, *addionalData->AzeriteItem); - - if (addionalData->AzeriteEmpoweredItem) - if (AzeriteEmpoweredItem* azeriteEmpoweredItem = item->ToAzeriteEmpoweredItem()) - azeriteEmpoweredItem->LoadAzeriteEmpoweredItemData(player, *addionalData->AzeriteEmpoweredItem); } if (mail) @@ -19194,7 +18769,7 @@ void Player::_LoadQuestStatusObjectives(PreparedQueryResult result) if (!objectiveItr->IsStoringFlag()) SetQuestSlotCounter(questStatusData.Slot, storageIndex, data); else if (data) - SetQuestSlotObjectiveFlag(questStatusData.Slot, storageIndex); + SetQuestSlotState(questStatusData.Slot, 256 << storageIndex); } else TC_LOG_ERROR("entities.player", "Player::_LoadQuestStatusObjectives: Player '{}' ({}) has quest {} out of range objective index {}.", GetName(), GetGUID().ToString(), questID, storageIndex); @@ -20575,8 +20150,6 @@ void Player::_SaveMail(CharacterDatabaseTransaction trans) for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { Item::DeleteFromDB(trans, itr2->item_guid); - AzeriteItem::DeleteFromDB(trans, itr2->item_guid); - AzeriteEmpoweredItem::DeleteFromDB(trans, itr2->item_guid); } } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); @@ -20990,7 +20563,7 @@ void Player::_SaveStats(CharacterDatabaseTransaction trans) const stmt->setFloat(index++, m_activePlayerData->ParryPercentage); stmt->setFloat(index++, m_activePlayerData->CritPercentage); stmt->setFloat(index++, m_activePlayerData->RangedCritPercentage); - stmt->setFloat(index++, m_activePlayerData->SpellCritPercentage); + stmt->setFloat(index++, m_activePlayerData->SpellCritPercentage[0]); // @todo (3.4.3): in wotlk spell crit percentage was split by spell school stmt->setUInt32(index++, m_unitData->AttackPower); stmt->setUInt32(index++, m_unitData->RangedAttackPower); stmt->setUInt32(index++, GetBaseSpellPowerBonus()); @@ -21471,14 +21044,12 @@ void Player::SetBattlePetData(BattlePets::BattlePet const* pet) { SetSummonedBattlePetGUID(pet->PacketInfo.Guid); SetCurrentBattlePetBreedQuality(pet->PacketInfo.Quality); - SetBattlePetCompanionExperience(pet->PacketInfo.Exp); SetWildBattlePetLevel(pet->PacketInfo.Level); } else { SetSummonedBattlePetGUID(ObjectGuid::Empty); SetCurrentBattlePetBreedQuality(AsUnderlyingType(BattlePets::BattlePetBreedQuality::Poor)); - SetBattlePetCompanionExperience(0); SetWildBattlePetLevel(0); } } @@ -22264,16 +21835,6 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid) sPetitionMgr->RemovePetitionsByOwner(guid); } -void Player::SetPersonalTabard(uint32 style, uint32 color, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor) -{ - auto personalTabard = m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::PersonalTabard); - SetUpdateFieldValue(personalTabard.ModifyValue(&UF::CustomTabardInfo::EmblemStyle), style); - SetUpdateFieldValue(personalTabard.ModifyValue(&UF::CustomTabardInfo::EmblemColor), color); - SetUpdateFieldValue(personalTabard.ModifyValue(&UF::CustomTabardInfo::BorderStyle), borderStyle); - SetUpdateFieldValue(personalTabard.ModifyValue(&UF::CustomTabardInfo::BorderColor), borderColor); - SetUpdateFieldValue(personalTabard.ModifyValue(&UF::CustomTabardInfo::BackgroundColor), backgroundColor); -} - void Player::LeaveAllArenaTeams(ObjectGuid guid) { CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(guid); @@ -22302,12 +21863,13 @@ uint32 Player::GetArenaPersonalRating(uint8 slot) const UF::PVPInfo const* Player::GetPvpInfoForBracket(int8 bracket) const { - int32 index = m_activePlayerData->PvpInfo.FindIndexIf([bracket](UF::PVPInfo const& pvpInfo) + auto itr = std::find_if(m_activePlayerData->PvpInfo.begin(), m_activePlayerData->PvpInfo.end(), [bracket](UF::PVPInfo const& pvpInfo) { return pvpInfo.Bracket == bracket && !*pvpInfo.Disqualified; }); - if (index >= 0) - return &m_activePlayerData->PvpInfo[index]; + + if (itr != m_activePlayerData->PvpInfo.end()) + return itr; return nullptr; } @@ -26636,10 +26198,6 @@ TalentLearnResult Player::LearnPvpTalent(uint32 talentID, uint8 slot, int32* spe if (HasPvpTalent(talentID, GetActiveTalentGroup())) return TALENT_FAILED_UNKNOWN; - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(talentInfo->PlayerConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - return TALENT_FAILED_CANT_DO_THAT_RIGHT_NOW; - if (PvpTalentEntry const* talent = sPvpTalentStore.LookupEntry(GetPvpTalentMap(GetActiveTalentGroup())[slot])) { if (!HasPlayerFlag(PLAYER_FLAGS_RESTING) && !HasUnitFlag2(UNIT_FLAG2_ALLOW_CHANGING_TALENTS)) @@ -27748,28 +27306,6 @@ void Player::ActivateTalentGroup(ChrSpecializationEntry const* spec) activeGlyphs.IsFullUpdate = true; SendDirectMessage(activeGlyphs.Write()); - if (Item* item = GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - { - if (AzeriteItem* azeriteItem = item->ToAzeriteItem()) - { - if (azeriteItem->IsEquipped()) - { - ApplyAllAzeriteEmpoweredItemMods(false); - ApplyAzeritePowers(azeriteItem, false); - } - - azeriteItem->SetSelectedAzeriteEssences(spec->ID); - - if (azeriteItem->IsEquipped()) - { - ApplyAzeritePowers(azeriteItem, true); - ApplyAllAzeriteEmpoweredItemMods(true); - } - - azeriteItem->SetState(ITEM_CHANGED, this); - } - } - Unit::AuraEffectList const& shapeshiftAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); for (AuraEffect* aurEff : shapeshiftAuras) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 9f80a9af8c7..fd9a61196b7 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -39,9 +39,6 @@ struct AchievementEntry; struct AreaTableEntry; struct AreaTriggerEntry; struct ArtifactPowerRankEntry; -struct AzeriteEssencePowerEntry; -struct AzeriteItemMilestonePowerEntry; -struct AzeritePowerEntry; struct BarberShopStyleEntry; struct BattlegroundTemplate; struct CharTitlesEntry; @@ -612,7 +609,7 @@ enum PlayerSlots // first slot for item stored (in any way in player m_items data) PLAYER_SLOT_START = 0, // last+1 slot for item stored (in any way in player m_items data) - PLAYER_SLOT_END = 227, + PLAYER_SLOT_END = 141, PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START) }; @@ -1371,8 +1368,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const; uint8 GetInventorySlotCount() const { return m_activePlayerData->NumBackpackSlots; } void SetInventorySlotCount(uint8 slots); - uint8 GetBankBagSlotCount() const { return m_activePlayerData->NumBankSlots; } - void SetBankBagSlotCount(uint8 count) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::NumBankSlots), count); } + uint8 GetBankBagSlotCount() const { return m_playerData->NumBankSlots; } + void SetBankBagSlotCount(uint8 count) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_playerData).ModifyValue(&UF::PlayerData::NumBankSlots), count); } bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const; bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = nullptr) const; bool CanNoReagentCast(SpellInfo const* spellInfo) const; @@ -1608,15 +1605,12 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> uint32 GetQuestSlotState(uint16 slot) const; uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const; int64 GetQuestSlotEndTime(uint16 slot) const; - bool GetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex) const; int32 GetQuestSlotObjectiveData(uint16 slot, QuestObjective const& objective) const; void SetQuestSlot(uint16 slot, uint32 quest_id); void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count); void SetQuestSlotState(uint16 slot, uint32 state); void RemoveQuestSlotState(uint16 slot, uint32 state); void SetQuestSlotEndTime(uint16 slot, time_t endTime); - void SetQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex); - void RemoveQuestSlotObjectiveFlag(uint16 slot, int8 objectiveIndex); void SetQuestCompletedBit(uint32 questBit, bool completed); uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const; @@ -1985,7 +1979,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> Guild const* GetGuild() const; ObjectGuid::LowType GetGuildIdInvited() const { return m_GuildIdInvited; } static void RemovePetitionsAndSigns(ObjectGuid guid); - void SetPersonalTabard(uint32 style, uint32 color, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor); // Arena Team void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot, uint8 type); @@ -2049,7 +2042,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void GetDodgeFromAgility(float &diminishing, float &nondiminishing) const; float GetRatingMultiplier(CombatRating cr) const; float GetRatingBonusValue(CombatRating cr) const; - float ApplyRatingDiminishing(CombatRating cr, float bonusValue) const; /// Returns base spellpower bonus from spellpower stat on items, without spellpower from intellect stat uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; } @@ -2332,8 +2324,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void _RemoveAllItemMods(); void _ApplyAllItemMods(); void _ApplyAllLevelScaleItemMods(bool apply); - void ApplyAllAzeriteItemMods(bool apply); - void ApplyAllAzeriteEmpoweredItemMods(bool apply); void _ApplyItemBonuses(Item* item, uint8 slot, bool apply); void _ApplyWeaponDamage(uint8 slot, Item* item, bool apply); bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) const; @@ -2345,13 +2335,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool formChange = false); void UpdateEquipSpellsAtFormChange(); void UpdateItemSetAuras(bool formChange = false); - void ApplyArtifactPowers(Item* item, bool apply); - void ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const* artifactPowerRank, bool apply); - void ApplyAzeritePowers(Item* item, bool apply); - void ApplyAzeriteItemMilestonePower(AzeriteItem* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply); - void ApplyAzeriteEssence(AzeriteItem* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply); - void ApplyAzeriteEssencePower(AzeriteItem* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply); - void ApplyAzeritePower(AzeriteEmpoweredItem* item, AzeritePowerEntry const* azeritePower, bool apply); void CastItemCombatSpell(DamageInfo const& damageInfo); void CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemTemplate const* proto); @@ -2627,7 +2610,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> bool isAllowedToLoot(Creature const* creature) const; - UF::DeclinedNames const* GetDeclinedNames() const { return m_playerData->DeclinedNames.has_value() ? &*m_playerData->DeclinedNames : nullptr; } + DeclinedName const* GetDeclinedNames() const { return m_declinedname.get(); } uint8 GetRunesState() const; uint32 GetRuneCooldown(uint8 index) const { return m_runes->Cooldown[index]; } uint32 GetRuneBaseCooldown() const; @@ -2776,11 +2759,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void SetHeirloom(uint32 slot, int32 itemId) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Heirlooms, slot), itemId); } void SetHeirloomFlags(uint32 slot, uint32 flags) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::HeirloomFlags, slot), flags); } - void AddToy(int32 itemId, uint32 flags) - { - AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Toys)) = itemId; - AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ToyFlags)) = flags; - } + void AddToy(int32 itemId, uint32 flags) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Toys)) = itemId; } void AddTransmogBlock(uint32 blockValue) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Transmog)) = blockValue; } void AddTransmogFlag(uint32 slot, uint32 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::Transmog, slot), flag); } @@ -2793,9 +2772,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> RemoveDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ConditionalTransmog), uint32(index)); } - void AddIllusionBlock(uint32 blockValue) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TransmogIllusions)) = blockValue; } - void AddIllusionFlag(uint32 slot, uint32 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TransmogIllusions, slot), flag); } - void AddSelfResSpell(int32 spellId) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::SelfResSpells)) = spellId; } void RemoveSelfResSpell(int32 spellId) { @@ -2832,9 +2808,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void SetTransportServerTime(int32 transportServerTime) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::TransportServerTime), transportServerTime); } - void SetRequiredMountCapabilityFlag(uint8 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::RequiredMountCapabilityFlags), flag); } - void ReplaceAllRequiredMountCapabilityFlags(uint8 flags) { SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::RequiredMountCapabilityFlags), flags); } - bool IsInFriendlyArea() const; bool IsFriendlyArea(AreaTableEntry const* inArea) const; @@ -3112,6 +3085,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> WorldLocation m_recall_location; uint32 m_recall_instanceId; + std::unique_ptr< DeclinedName> m_declinedname; std::unique_ptr<Runes> m_runes; EquipmentSetContainer _equipmentSets; diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 3373462cba6..1266dfddacd 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -440,7 +440,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo float attackPowerMod = std::max(GetAPMultiplier(attType, normalized), 0.25f); - float baseValue = GetFlatModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType, false) / 3.5f * attackPowerMod; + float baseValue = GetFlatModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 3.5f * attackPowerMod; float basePct = GetPctModifierValue(unitMod, BASE_PCT); float totalValue = GetFlatModifierValue(unitMod, TOTAL_VALUE); float totalPct = addTotalPct ? GetPctModifierValue(unitMod, TOTAL_PCT) : 1.0f; @@ -589,8 +589,7 @@ void Player::UpdateHealingDonePercentMod() for (AuraEffect const* auraEffect : GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT)) AddPct(value, auraEffect->GetAmount()); - for (uint32 i = 0; i < MAX_SPELL_SCHOOL; ++i) - SetUpdateFieldStatValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModHealingDonePercent, i), value); + SetUpdateFieldStatValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModHealingDonePercent), value); } float const m_diminishing_k[MAX_CLASSES] = @@ -722,34 +721,12 @@ void Player::UpdateSpellCritChance() crit += GetRatingBonusValue(CR_CRIT_SPELL); // Store crit value - SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::SpellCritPercentage), crit); + for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::SpellCritPercentage, i), crit); } void Player::UpdateCorruption() { - float effectiveCorruption = GetRatingBonusValue(CR_CORRUPTION) - GetRatingBonusValue(CR_CORRUPTION_RESISTANCE); - for (CorruptionEffectsEntry const* corruptionEffect : sCorruptionEffectsStore) - { - if ((CorruptionEffectsFlag(corruptionEffect->Flags) & CorruptionEffectsFlag::Disabled) != CorruptionEffectsFlag::None) - continue; - - if (effectiveCorruption < corruptionEffect->MinCorruption) - { - RemoveAura(corruptionEffect->Aura); - continue; - } - - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(corruptionEffect->PlayerConditionID)) - { - if (!ConditionMgr::IsPlayerMeetingCondition(this, playerCondition)) - { - RemoveAura(corruptionEffect->Aura); - continue; - } - } - - CastSpell(this, corruptionEffect->Aura, true); - } } void Player::UpdateArmorPenetration(int32 amount) @@ -859,7 +836,6 @@ void Player::_ApplyAllStatBonuses() _ApplyAllAuraStatMods(); _ApplyAllItemMods(); - ApplyAllAzeriteItemMods(true); SetCanModifyStats(true); @@ -870,7 +846,6 @@ void Player::_RemoveAllStatBonuses() { SetCanModifyStats(false); - ApplyAllAzeriteItemMods(false); _RemoveAllItemMods(); _RemoveAllAuraStatMods(); @@ -1028,7 +1003,7 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, weaponMaxDamage = 0.0f; } - float attackPower = GetTotalAttackPowerValue(attType, false); + float attackPower = GetTotalAttackPowerValue(attType); float attackSpeedMulti = GetAPMultiplier(attType, normalized); float baseValue = GetFlatModifierValue(unitMod, BASE_VALUE) + (attackPower / 3.5f) * variance; float basePct = GetPctModifierValue(unitMod, BASE_PCT) * attackSpeedMulti; @@ -1140,13 +1115,9 @@ void Guardian::UpdateResistances(uint32 school) // hunter and warlock pets gain 40% of owner's resistance if (IsPet()) - { baseValue += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40)); - bonusValue += float(CalculatePct(m_owner->GetBonusResistanceMod(SpellSchools(school)), 40)); - } SetResistance(SpellSchools(school), int32(baseValue)); - SetBonusResistanceMod(SpellSchools(school), int32(bonusValue)); } else UpdateArmor(); @@ -1310,7 +1281,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType) float att_speed = float(GetBaseAttackTime(BASE_ATTACK))/1000.0f; - float base_value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType, false) / 3.5f * att_speed + bonusDamage; + float base_value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType) / 3.5f * att_speed + bonusDamage; float base_pct = GetPctModifierValue(unitMod, BASE_PCT); float total_value = GetFlatModifierValue(unitMod, TOTAL_VALUE); float total_pct = GetPctModifierValue(unitMod, TOTAL_PCT); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 950db3570b1..0b6c13efa24 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6846,7 +6846,7 @@ float Unit::SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSch crit_chance = 0.0f; // For other schools else if (Player const* thisPlayer = ToPlayer()) - crit_chance = thisPlayer->m_activePlayerData->SpellCritPercentage; + crit_chance = thisPlayer->m_activePlayerData->SpellCritPercentage[GetFirstSchoolInMask(schoolMask)]; else crit_chance = (float)m_baseSpellCritChance; break; @@ -7141,14 +7141,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const // Healing done percent if (Player const* thisPlayer = ToPlayer()) - { - float maxModDamagePercentSchool = 0.0f; - for (uint32 i = 0; i < MAX_SPELL_SCHOOL; ++i) - if (spellProto->GetSchoolMask() & (1 << i)) - maxModDamagePercentSchool = std::max(maxModDamagePercentSchool, thisPlayer->m_activePlayerData->ModHealingDonePercent[i]); - - DoneTotalMod *= maxModDamagePercentSchool; - } + DoneTotalMod *= thisPlayer->m_activePlayerData->ModHealingDonePercent; else // SPELL_AURA_MOD_HEALING_DONE_PERCENT is included in m_activePlayerData->ModHealingDonePercent for players DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT); @@ -7913,11 +7906,6 @@ MountCapabilityEntry const* Unit::GetMountCapability(uint32 mountType) const if (mountCapability->ReqSpellKnownID && !HasSpell(mountCapability->ReqSpellKnownID)) continue; - if (Player const* thisPlayer = ToPlayer()) - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mountCapability->PlayerConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(thisPlayer, playerCondition)) - continue; - return mountCapability; } @@ -9114,19 +9102,16 @@ void Unit::UpdateResistances(uint32 school) value *= GetPctModifierValue(unitMod, TOTAL_PCT); SetResistance(SpellSchools(school), int32(value)); - SetBonusResistanceMod(SpellSchools(school), int32(value - baseValue)); } else UpdateArmor(); } -float Unit::GetTotalAttackPowerValue(WeaponAttackType attType, bool includeWeapon /*= true*/) const +float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const { if (attType == RANGED_ATTACK) { float ap = m_unitData->RangedAttackPower + m_unitData->RangedAttackPowerModPos + m_unitData->RangedAttackPowerModNeg; - if (includeWeapon) - ap += std::max<float>(m_unitData->MainHandWeaponAttackPower, m_unitData->RangedWeaponAttackPower); if (ap < 0) return 0.0f; return ap * (1.0f + m_unitData->RangedAttackPowerMultiplier); @@ -9134,16 +9119,6 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType, bool includeWeapo else { float ap = m_unitData->AttackPower + m_unitData->AttackPowerModPos + m_unitData->AttackPowerModNeg; - if (includeWeapon) - { - if (attType == BASE_ATTACK) - ap += std::max<float>(m_unitData->MainHandWeaponAttackPower, m_unitData->RangedWeaponAttackPower); - else - { - ap += m_unitData->OffHandWeaponAttackPower; - ap /= 2; - } - } if (ap < 0) return 0.0f; return ap * (1.0f + m_unitData->AttackPowerMultiplier); @@ -12074,11 +12049,27 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form, uint32 spellId) const } } + uint32 modelId = 0; SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(form); - if (formEntry && formEntry->CreatureDisplayID) - return formEntry->CreatureDisplayID; + if (formEntry && formEntry->CreatureDisplayID[0]) + { + // Take the alliance modelid as default + if (GetTypeId() != TYPEID_PLAYER) + return formEntry->CreatureDisplayID[0]; + else + { + if (Player::TeamForRace(GetRace()) == ALLIANCE) + modelId = formEntry->CreatureDisplayID[0]; + else + modelId = formEntry->CreatureDisplayID[1]; - return 0; + // If the player is horde but there are no values for the horde modelid - take the alliance modelid + if (!modelId && Player::TeamForRace(GetRace()) == HORDE) + modelId = formEntry->CreatureDisplayID[0]; + } + } + + return modelId; } void Unit::JumpTo(float speedXY, float speedZ, float angle, Optional<Position> dest) @@ -13807,9 +13798,3 @@ std::string Unit::GetDebugInfo() const return sstr.str(); } - -DeclinedName::DeclinedName(UF::DeclinedNames const& uf) -{ - for (std::size_t i = 0; i < MAX_DECLINED_NAME_CASES; ++i) - name[i] = uf.Name[i]; -} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 2d550ffa26f..609ec53c2cc 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -880,17 +880,11 @@ class TC_GAME_API Unit : public WorldObject float GetStat(Stats stat) const { return float(m_unitData->Stats[stat]); } void SetStat(Stats stat, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Stats, stat), val); } uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); } - void SetArmor(int32 val, int32 bonusVal) - { - SetResistance(SPELL_SCHOOL_NORMAL, val); - SetBonusResistanceMod(SPELL_SCHOOL_NORMAL, bonusVal); - } + void SetArmor(int32 val, int32 bonusVal) { SetResistance(SPELL_SCHOOL_NORMAL, val); } int32 GetResistance(SpellSchools school) const { return m_unitData->Resistances[school]; } - int32 GetBonusResistanceMod(SpellSchools school) const { return m_unitData->BonusResistanceMods[school]; } int32 GetResistance(SpellSchoolMask mask) const; void SetResistance(SpellSchools school, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Resistances, school), val); } - void SetBonusResistanceMod(SpellSchools school, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BonusResistanceMods, school), val); } static float CalculateAverageResistReduction(WorldObject const* caster, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr); uint64 GetHealth() const { return m_unitData->Health; } @@ -933,9 +927,6 @@ class TC_GAME_API Unit : public WorldObject // returns the change in power int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true); - void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostMultiplier), manaCostMultiplier, apply); } - void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostModifier, school), mod, apply); } - uint32 GetBaseAttackTime(WeaponAttackType att) const; void SetBaseAttackTime(WeaponAttackType att, uint32 val); void UpdateAttackTimeField(WeaponAttackType att); @@ -966,8 +957,6 @@ class TC_GAME_API Unit : public WorldObject void SetCreatedBySpell(int32 spellId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CreatedBySpell), spellId); } - void SetNameplateAttachToGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NameplateAttachToGUID), guid); } - Emote GetEmoteState() const { return Emote(*m_unitData->EmoteState); } void SetEmoteState(Emote emote) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::EmoteState), emote); } @@ -1018,8 +1007,6 @@ class TC_GAME_API Unit : public WorldObject bool IsMounted() const { return HasUnitFlag(UNIT_FLAG_MOUNT); } uint32 GetMountDisplayId() const { return m_unitData->MountDisplayID; } void SetMountDisplayId(uint32 mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::MountDisplayID), mountDisplayId); } - uint32 GetCosmeticMountDisplayId() const { return m_unitData->CosmeticMountDisplayID; } - void SetCosmeticMountDisplayId(uint32 mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CosmeticMountDisplayID), mountDisplayId); } void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0); void Dismount(); MountCapabilityEntry const* GetMountCapability(uint32 mountType) const; @@ -1351,8 +1338,6 @@ class TC_GAME_API Unit : public WorldObject uint32 GetBattlePetCompanionNameTimestamp() const { return m_unitData->BattlePetCompanionNameTimestamp; } void SetBattlePetCompanionNameTimestamp(uint32 timestamp) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BattlePetCompanionNameTimestamp), timestamp); } - uint32 GetBattlePetCompanionExperience() const { return m_unitData->BattlePetCompanionExperience; } - void SetBattlePetCompanionExperience(uint32 experience) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BattlePetCompanionExperience), experience); } uint32 GetWildBattlePetLevel() const { return m_unitData->WildBattlePetLevel; } void SetWildBattlePetLevel(uint32 wildBattlePetLevel) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::WildBattlePetLevel), wildBattlePetLevel); } @@ -1514,15 +1499,6 @@ class TC_GAME_API Unit : public WorldObject .ModifyValue(&UF::UnitData::ChannelData) .ModifyValue(&UF::UnitChannel::SpellID), channelSpellId); } - uint32 GetChannelSpellXSpellVisualId() const { return m_unitData->ChannelData->SpellVisual.SpellXSpellVisualID; } - uint32 GetChannelScriptVisualId() const { return m_unitData->ChannelData->SpellVisual.ScriptVisualID; } - void SetChannelVisual(SpellCastVisual channelVisual) - { - SetUpdateFieldValue(m_values - .ModifyValue(&Unit::m_unitData) - .ModifyValue(&UF::UnitData::ChannelData) - .ModifyValue(&UF::UnitChannel::SpellVisual), channelVisual); - } void AddChannelObject(ObjectGuid guid) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ChannelObjects)) = guid; } void SetChannelObject(uint32 slot, ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ChannelObjects, slot), guid); } void RemoveChannelObject(ObjectGuid guid) @@ -1557,10 +1533,6 @@ class TC_GAME_API Unit : public WorldObject virtual bool IsMovementPreventedByCasting() const; bool CanCastSpellWhileMoving(SpellInfo const* spellInfo) const; - bool IsSilenced(SpellSchoolMask schoolMask) const { return (*m_unitData->SilencedSchoolMask & schoolMask) != 0; } - void SetSilencedSchoolMask(SpellSchoolMask schoolMask) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::SilencedSchoolMask), schoolMask); } - void ReplaceAllSilencedSchoolMask(SpellSchoolMask schoolMask) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::SilencedSchoolMask), schoolMask); } - SpellHistory* GetSpellHistory() { return _spellHistory.get(); } SpellHistory const* GetSpellHistory() const { return _spellHistory.get(); } @@ -1628,11 +1600,8 @@ class TC_GAME_API Unit : public WorldObject void SetRangedAttackPowerModPos(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerModPos), attackPowerMod); } void SetRangedAttackPowerModNeg(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerModNeg), attackPowerMod); } void SetRangedAttackPowerMultiplier(float attackPowerMult) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerMultiplier), attackPowerMult); } - void SetMainHandWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::MainHandWeaponAttackPower), attackPower); } - void SetOffHandWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::OffHandWeaponAttackPower), attackPower); } - void SetRangedWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedWeaponAttackPower), attackPower); } virtual void UpdateDamagePhysical(WeaponAttackType attType); - float GetTotalAttackPowerValue(WeaponAttackType attType, bool includeWeapon = true) const; + float GetTotalAttackPowerValue(WeaponAttackType attType) const; float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const; void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; } virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) const = 0; diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index 92d23e7a8a9..e2509c038f2 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -22,11 +22,6 @@ #include "EnumFlag.h" #include <string> -namespace UF -{ -struct DeclinedNames; -} - #define MIN_MELEE_REACH 2.0f #define NOMINAL_MELEE_RANGE 5.0f #define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players @@ -154,7 +149,7 @@ enum UnitFlags : uint32 UNIT_FLAG_LOOTING = 0x00000400, // loot animation UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // on player pets: whether the pet is chasing a target to attack || on other units: whether any of the unit's minions is in combat UNIT_FLAG_PVP_ENABLING = 0x00001000, // changed in 3.0.3, now UNIT_BYTES_2_OFFSET_PVP_FLAG from UNIT_FIELD_BYTES_2 - UNIT_FLAG_FORCE_NAMEPLATE = 0x00002000, // Force show nameplate, 9.0 + UNIT_FLAG_SILENCED = 0x00002000, // silenced UNIT_FLAG_CANT_SWIM = 0x00004000, // TITLE Can't Swim UNIT_FLAG_CAN_SWIM = 0x00008000, // TITLE Can Swim DESCRIPTION shows swim animation in water UNIT_FLAG_NON_ATTACKABLE_2 = 0x00010000, // removes attackable icon, if on yourself, cannot assist self but can cast TARGET_SELF spells - added by SPELL_AURA_MOD_UNATTACKABLE @@ -478,8 +473,6 @@ enum HitInfo struct TC_GAME_API DeclinedName { DeclinedName() = default; - DeclinedName(UF::DeclinedNames const& uf); - std::string name[MAX_DECLINED_NAME_CASES]; }; diff --git a/src/server/game/Entities/Unit/enuminfo_UnitDefines.cpp b/src/server/game/Entities/Unit/enuminfo_UnitDefines.cpp index 3c870223ffc..2d2028a45c1 100644 --- a/src/server/game/Entities/Unit/enuminfo_UnitDefines.cpp +++ b/src/server/game/Entities/Unit/enuminfo_UnitDefines.cpp @@ -44,7 +44,7 @@ TC_API_EXPORT EnumText EnumUtils<UnitFlags>::ToString(UnitFlags value) case UNIT_FLAG_LOOTING: return { "UNIT_FLAG_LOOTING", "UNIT_FLAG_LOOTING", "loot animation" }; case UNIT_FLAG_PET_IN_COMBAT: return { "UNIT_FLAG_PET_IN_COMBAT", "UNIT_FLAG_PET_IN_COMBAT", "on player pets: whether the pet is chasing a target to attack || on other units: whether any of the unit's minions is in combat" }; case UNIT_FLAG_PVP_ENABLING: return { "UNIT_FLAG_PVP_ENABLING", "UNIT_FLAG_PVP_ENABLING", "changed in 3.0.3, now UNIT_BYTES_2_OFFSET_PVP_FLAG from UNIT_FIELD_BYTES_2" }; - case UNIT_FLAG_FORCE_NAMEPLATE: return { "UNIT_FLAG_FORCE_NAMEPLATE", "UNIT_FLAG_FORCE_NAMEPLATE", "Force show nameplate, 9.0" }; + case UNIT_FLAG_SILENCED: return { "UNIT_FLAG_SILENCED", "UNIT_FLAG_SILENCED", "Silenced" }; case UNIT_FLAG_CANT_SWIM: return { "UNIT_FLAG_CANT_SWIM", "Can't Swim", "" }; case UNIT_FLAG_CAN_SWIM: return { "UNIT_FLAG_CAN_SWIM", "Can Swim", "shows swim animation in water" }; case UNIT_FLAG_NON_ATTACKABLE_2: return { "UNIT_FLAG_NON_ATTACKABLE_2", "UNIT_FLAG_NON_ATTACKABLE_2", "removes attackable icon, if on yourself, cannot assist self but can cast TARGET_SELF spells - added by SPELL_AURA_MOD_UNATTACKABLE" }; @@ -88,7 +88,7 @@ TC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(size_t index) case 10: return UNIT_FLAG_LOOTING; case 11: return UNIT_FLAG_PET_IN_COMBAT; case 12: return UNIT_FLAG_PVP_ENABLING; - case 13: return UNIT_FLAG_FORCE_NAMEPLATE; + case 13: return UNIT_FLAG_SILENCED; case 14: return UNIT_FLAG_CANT_SWIM; case 15: return UNIT_FLAG_CAN_SWIM; case 16: return UNIT_FLAG_NON_ATTACKABLE_2; @@ -129,7 +129,7 @@ TC_API_EXPORT size_t EnumUtils<UnitFlags>::ToIndex(UnitFlags value) case UNIT_FLAG_LOOTING: return 10; case UNIT_FLAG_PET_IN_COMBAT: return 11; case UNIT_FLAG_PVP_ENABLING: return 12; - case UNIT_FLAG_FORCE_NAMEPLATE: return 13; + case UNIT_FLAG_SILENCED: return 13; case UNIT_FLAG_CANT_SWIM: return 14; case UNIT_FLAG_CAN_SWIM: return 15; case UNIT_FLAG_NON_ATTACKABLE_2: return 16; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e882198834a..69ed68c6dd1 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -19,8 +19,6 @@ #include "ArenaTeamMgr.h" #include "AreaTriggerDataStore.h" #include "AreaTriggerTemplate.h" -#include "AzeriteEmpoweredItem.h" -#include "AzeriteItem.h" #include "Chat.h" #include "Containers.h" #include "CreatureAIFactory.h" @@ -3317,12 +3315,6 @@ void ObjectMgr::LoadItemTemplates() specs.set(); } - // Load item effects (spells) - for (ItemXItemEffectEntry const* effectEntry : sItemXItemEffectStore) - if (ItemTemplate* item = Trinity::Containers::MapGetValuePtr(_itemTemplateStore, effectEntry->ItemID)) - if (ItemEffectEntry const* effect = sItemEffectStore.LookupEntry(effectEntry->ItemEffectID)) - item->Effects.push_back(effect); - TC_LOG_INFO("server.loading", ">> Loaded {} item templates in {} ms", _itemTemplateStore.size(), GetMSTimeDiffToNow(oldMSTime)); } @@ -6405,8 +6397,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { Item::DeleteFromDB(nonTransactional, itr2->item_guid); - AzeriteItem::DeleteFromDB(nonTransactional, itr2->item_guid); - AzeriteEmpoweredItem::DeleteFromDB(nonTransactional, itr2->item_guid); } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); @@ -6938,8 +6928,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con // if find graveyard at different map from where entrance placed (or no entrance data), use any first if (!mapEntry || mapEntry->CorpseMapID < 0 - || uint32(mapEntry->CorpseMapID) != entry->Loc.GetMapId() - || (mapEntry->Corpse.X == 0 && mapEntry->Corpse.Y == 0)) // Check X and Y + || uint32(mapEntry->CorpseMapID) != entry->Loc.GetMapId()) // Check X and Y { // not have any corrdinates for check distance anyway entryFar = entry; @@ -6947,20 +6936,15 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con } // at entrance map calculate distance (2D); - float dist2 = (entry->Loc.GetPositionX() - mapEntry->Corpse.X) * (entry->Loc.GetPositionX() - mapEntry->Corpse.X) - + (entry->Loc.GetPositionY() - mapEntry->Corpse.Y) * (entry->Loc.GetPositionY() - mapEntry->Corpse.Y); if (foundEntr) { - if (dist2 < distEntr) - { - distEntr = dist2; - entryEntr = entry; - } + distEntr = 0.f; + entryEntr = entry; } else { foundEntr = true; - distEntr = dist2; + distEntr = 0.f; entryEntr = entry; } } diff --git a/src/server/game/Handlers/ArtifactHandler.cpp b/src/server/game/Handlers/ArtifactHandler.cpp index 66d94b955c3..9504017e3f2 100644 --- a/src/server/game/Handlers/ArtifactHandler.cpp +++ b/src/server/game/Handlers/ArtifactHandler.cpp @@ -106,8 +106,6 @@ void WorldSession::HandleArtifactAddPower(WorldPackets::Artifact::ArtifactAddPow if (artifact->IsEquipped()) { - _player->ApplyArtifactPowerRank(artifact, artifactPowerRank, true); - for (UF::ArtifactPower const& power : artifact->m_itemData->ArtifactPowers) { ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerID); @@ -119,9 +117,6 @@ void WorldSession::HandleArtifactAddPower(WorldPackets::Artifact::ArtifactAddPow continue; artifact->SetArtifactPower(power.ArtifactPowerID, power.PurchasedRank, power.CurrentRankWithBonus + 1); - - _player->ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, false); - _player->ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, true); } } @@ -226,10 +221,6 @@ void WorldSession::HandleConfirmArtifactRespec(WorldPackets::Artifact::ConfirmAr continue; artifact->SetArtifactPower(artifactPower.ArtifactPowerID, artifactPower.PurchasedRank - oldPurchasedRank, artifactPower.CurrentRankWithBonus - oldPurchasedRank); - - if (artifact->IsEquipped()) - if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, 0)) - _player->ApplyArtifactPowerRank(artifact, artifactPowerRank, false); } for (UF::ArtifactPower const& power : artifact->m_itemData->ArtifactPowers) @@ -243,8 +234,6 @@ void WorldSession::HandleConfirmArtifactRespec(WorldPackets::Artifact::ConfirmAr continue; artifact->SetArtifactPower(power.ArtifactPowerID, power.PurchasedRank, 0); - - _player->ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, false); } artifact->SetArtifactXP(newAmount); diff --git a/src/server/game/Handlers/AzeriteHandler.cpp b/src/server/game/Handlers/AzeriteHandler.cpp index 015ec05e570..f6eba68802d 100644 --- a/src/server/game/Handlers/AzeriteHandler.cpp +++ b/src/server/game/Handlers/AzeriteHandler.cpp @@ -16,8 +16,6 @@ */ #include "WorldSession.h" -#include "AzeriteEmpoweredItem.h" -#include "AzeriteItem.h" #include "AzeritePackets.h" #include "DB2Stores.h" #include "NPCPackets.h" @@ -26,213 +24,18 @@ void WorldSession::HandleAzeriteEssenceUnlockMilestone(WorldPackets::Azerite::AzeriteEssenceUnlockMilestone& azeriteEssenceUnlockMilestone) { - if (!AzeriteItem::FindHeartForge(_player)) - return; - - Item* item = _player->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere); - if (!item) - return; - - AzeriteItem* azeriteItem = item->ToAzeriteItem(); - if (!azeriteItem || !azeriteItem->CanUseEssences()) - return; - - AzeriteItemMilestonePowerEntry const* milestonePower = sAzeriteItemMilestonePowerStore.LookupEntry(azeriteEssenceUnlockMilestone.AzeriteItemMilestonePowerID); - if (!milestonePower || milestonePower->RequiredLevel > int32(azeriteItem->GetLevel())) - return; - - // check that all previous milestones are unlocked - for (AzeriteItemMilestonePowerEntry const* previousMilestone : sDB2Manager.GetAzeriteItemMilestonePowers()) - { - if (previousMilestone == milestonePower) - break; - - if (!azeriteItem->HasUnlockedEssenceMilestone(previousMilestone->ID)) - return; - } - - azeriteItem->AddUnlockedEssenceMilestone(milestonePower->ID); - _player->ApplyAzeriteItemMilestonePower(azeriteItem, milestonePower, true); - azeriteItem->SetState(ITEM_CHANGED, _player); } void WorldSession::HandleAzeriteEssenceActivateEssence(WorldPackets::Azerite::AzeriteEssenceActivateEssence& azeriteEssenceActivateEssence) { - WorldPackets::Azerite::ActivateEssenceFailed activateEssenceResult; - activateEssenceResult.AzeriteEssenceID = azeriteEssenceActivateEssence.AzeriteEssenceID; - Item* item = _player->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Equipment); - if (!item) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::NotEquipped; - activateEssenceResult.Slot = azeriteEssenceActivateEssence.Slot; - SendPacket(activateEssenceResult.Write()); - return; - } - - AzeriteItem* azeriteItem = item->ToAzeriteItem(); - if (!azeriteItem || !azeriteItem->CanUseEssences()) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::ConditionFailed; - SendPacket(activateEssenceResult.Write()); - return; - } - - if (azeriteEssenceActivateEssence.Slot >= MAX_AZERITE_ESSENCE_SLOT || !azeriteItem->HasUnlockedEssenceSlot(azeriteEssenceActivateEssence.Slot)) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::SlotLocked; - SendPacket(activateEssenceResult.Write()); - return; - } - - UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences(); - // essence is already in that slot, nothing to do - if (selectedEssences && selectedEssences->AzeriteEssenceID[azeriteEssenceActivateEssence.Slot] == uint32(azeriteEssenceActivateEssence.AzeriteEssenceID)) - return; - - uint32 rank = azeriteItem->GetEssenceRank(azeriteEssenceActivateEssence.AzeriteEssenceID); - if (!rank) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::EssenceNotUnlocked; - activateEssenceResult.Arg = azeriteEssenceActivateEssence.AzeriteEssenceID; - SendPacket(activateEssenceResult.Write()); - return; - } - - if (_player->IsInCombat()) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::AffectingCombat; - activateEssenceResult.Slot = azeriteEssenceActivateEssence.Slot; - SendPacket(activateEssenceResult.Write()); - return; - } - - if (_player->isDead()) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::CantDoThatRightNow; - activateEssenceResult.Slot = azeriteEssenceActivateEssence.Slot; - SendPacket(activateEssenceResult.Write()); - return; - } - - if (!_player->HasPlayerFlag(PLAYER_FLAGS_RESTING) && !_player->HasUnitFlag2(UNIT_FLAG2_ALLOW_CHANGING_TALENTS)) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::NotInRestArea; - activateEssenceResult.Slot = azeriteEssenceActivateEssence.Slot; - SendPacket(activateEssenceResult.Write()); - return; - } - - if (selectedEssences) - { - // need to remove selected essence from another slot if selected - int32 removeEssenceFromSlot = -1; - for (int32 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot) - if (azeriteEssenceActivateEssence.Slot != uint8(slot) && selectedEssences->AzeriteEssenceID[slot] == uint32(azeriteEssenceActivateEssence.AzeriteEssenceID)) - removeEssenceFromSlot = slot; - - // check cooldown of major essence slot - if (selectedEssences->AzeriteEssenceID[0] && (azeriteEssenceActivateEssence.Slot == 0 || removeEssenceFromSlot == 0)) - { - for (uint32 essenceRank = 1; essenceRank <= rank; ++essenceRank) - { - AzeriteEssencePowerEntry const* azeriteEssencePower = ASSERT_NOTNULL(sDB2Manager.GetAzeriteEssencePower(selectedEssences->AzeriteEssenceID[0], essenceRank)); - if (_player->GetSpellHistory()->HasCooldown(azeriteEssencePower->MajorPowerDescription)) - { - activateEssenceResult.Reason = AzeriteEssenceActivateResult::CantRemoveEssence; - activateEssenceResult.Arg = azeriteEssencePower->MajorPowerDescription; - activateEssenceResult.Slot = azeriteEssenceActivateEssence.Slot; - SendPacket(activateEssenceResult.Write()); - return; - } - } - } - - if (removeEssenceFromSlot != -1) - { - _player->ApplyAzeriteEssence(azeriteItem, selectedEssences->AzeriteEssenceID[removeEssenceFromSlot], MAX_AZERITE_ESSENCE_RANK, - AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(removeEssenceFromSlot)->Type) == AzeriteItemMilestoneType::MajorEssence, false); - azeriteItem->SetSelectedAzeriteEssence(removeEssenceFromSlot, 0); - } - - if (selectedEssences->AzeriteEssenceID[azeriteEssenceActivateEssence.Slot]) - { - _player->ApplyAzeriteEssence(azeriteItem, selectedEssences->AzeriteEssenceID[azeriteEssenceActivateEssence.Slot], MAX_AZERITE_ESSENCE_RANK, - AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(azeriteEssenceActivateEssence.Slot)->Type) == AzeriteItemMilestoneType::MajorEssence, false); - } - } - else - azeriteItem->CreateSelectedAzeriteEssences(AsUnderlyingType(_player->GetPrimarySpecialization())); - - azeriteItem->SetSelectedAzeriteEssence(azeriteEssenceActivateEssence.Slot, azeriteEssenceActivateEssence.AzeriteEssenceID); - - _player->ApplyAzeriteEssence(azeriteItem, azeriteEssenceActivateEssence.AzeriteEssenceID, rank, - AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(azeriteEssenceActivateEssence.Slot)->Type) == AzeriteItemMilestoneType::MajorEssence, true); - - azeriteItem->SetState(ITEM_CHANGED, _player); } void WorldSession::HandleAzeriteEmpoweredItemViewed(WorldPackets::Azerite::AzeriteEmpoweredItemViewed& azeriteEmpoweredItemViewed) { - Item* item = _player->GetItemByGuid(azeriteEmpoweredItemViewed.ItemGUID); - if (!item || !item->IsAzeriteEmpoweredItem()) - return; - - item->SetItemFlag(ITEM_FIELD_FLAG_AZERITE_EMPOWERED_ITEM_VIEWED); - item->SetState(ITEM_CHANGED, _player); } void WorldSession::HandleAzeriteEmpoweredItemSelectPower(WorldPackets::Azerite::AzeriteEmpoweredItemSelectPower& azeriteEmpoweredItemSelectPower) { - Item* item = _player->GetItemByPos(azeriteEmpoweredItemSelectPower.ContainerSlot, azeriteEmpoweredItemSelectPower.Slot); - if (!item) - return; - - AzeritePowerEntry const* azeritePower = sAzeritePowerStore.LookupEntry(azeriteEmpoweredItemSelectPower.AzeritePowerID); - if (!azeritePower) - return; - - AzeriteEmpoweredItem* azeriteEmpoweredItem = item->ToAzeriteEmpoweredItem(); - if (!azeriteEmpoweredItem) - return; - - // Validate tier - int32 actualTier = azeriteEmpoweredItem->GetTierForAzeritePower(Classes(_player->GetClass()), azeriteEmpoweredItemSelectPower.AzeritePowerID); - if (azeriteEmpoweredItemSelectPower.Tier > MAX_AZERITE_EMPOWERED_TIER || azeriteEmpoweredItemSelectPower.Tier != actualTier) - return; - - uint32 azeriteLevel = 0; - Item const* heartOfAzeroth = _player->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere); - if (!heartOfAzeroth) - return; - - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - azeriteLevel = azeriteItem->GetEffectiveLevel(); - - // Check required heart of azeroth level - if (azeriteLevel < azeriteEmpoweredItem->GetRequiredAzeriteLevelForTier(uint32(actualTier))) - return; - - // tiers are ordered backwards, you first select the highest one - for (int32 i = actualTier + 1; i < azeriteEmpoweredItem->GetMaxAzeritePowerTier(); ++i) - if (!azeriteEmpoweredItem->GetSelectedAzeritePower(i)) - return; - - bool activateAzeritePower = azeriteEmpoweredItem->IsEquipped() && heartOfAzeroth->IsEquipped(); - if (azeritePower->ItemBonusListID && activateAzeritePower) - _player->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), false); - - azeriteEmpoweredItem->SetSelectedAzeritePower(actualTier, azeriteEmpoweredItemSelectPower.AzeritePowerID); - - if (activateAzeritePower) - { - // apply all item mods when azerite power grants a bonus, item level changes and that affects stats and auras that scale with item level - if (azeritePower->ItemBonusListID) - _player->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), true); - else - _player->ApplyAzeritePower(azeriteEmpoweredItem, azeritePower, true); - } - - azeriteEmpoweredItem->SetState(ITEM_CHANGED, _player); } void WorldSession::SendAzeriteRespecNPC(ObjectGuid npc) diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index d499ba13c11..93d02ae0606 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1988,10 +1988,6 @@ void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipm if (!illusion->ItemVisual || !illusion->GetFlags().HasFlag(SpellItemEnchantmentFlags::AllowTransmog)) return false; - if (PlayerConditionEntry const* condition = sPlayerConditionStore.LookupEntry(illusion->TransmogUseConditionID)) - if (!sConditionMgr->IsPlayerMeetingCondition(_player, condition)) - return false; - if (illusion->ScalingClassRestricted > 0 && uint8(illusion->ScalingClassRestricted) != _player->GetClass()) return false; @@ -2807,10 +2803,6 @@ void WorldSession::HandleSavePersonalEmblem(WorldPackets::Character::SavePersona return; } - _player->SetPersonalTabard(savePersonalEmblem.PersonalTabard.EmblemStyle, savePersonalEmblem.PersonalTabard.EmblemColor, - savePersonalEmblem.PersonalTabard.BorderStyle, savePersonalEmblem.PersonalTabard.BorderColor, - savePersonalEmblem.PersonalTabard.BackgroundColor); - SendPacket(WorldPackets::Character::PlayerSavePersonalEmblem(ERR_GUILDEMBLEM_SUCCESS).Write()); } diff --git a/src/server/game/Handlers/InspectHandler.cpp b/src/server/game/Handlers/InspectHandler.cpp index 5bfd00dc1fa..a6a664fee14 100644 --- a/src/server/game/Handlers/InspectHandler.cpp +++ b/src/server/game/Handlers/InspectHandler.cpp @@ -17,7 +17,6 @@ #include "WorldSession.h" #include "AchievementMgr.h" -#include "AzeriteItem.h" #include "Guild.h" #include "GuildMgr.h" #include "InspectPackets.h" @@ -71,10 +70,6 @@ void WorldSession::HandleInspectOpcode(WorldPackets::Inspect::Inspect& inspect) inspectResult.GuildData->AchievementPoints = guild->GetAchievementMgr().GetAchievementPoints(); } - if (Item const* heartOfAzeroth = player->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere)) - if (AzeriteItem const* azeriteItem = heartOfAzeroth->ToAzeriteItem()) - inspectResult.AzeriteLevel = azeriteItem->GetEffectiveLevel(); - inspectResult.ItemLevel = int32(player->GetAverageItemLevel()); inspectResult.LifetimeMaxRank = player->m_activePlayerData->LifetimeMaxRank; inspectResult.TodayHK = player->m_activePlayerData->TodayHonorableKills; diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index baaeebaf5bc..578db5d938e 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -143,8 +143,7 @@ void WorldSession::SendLfgPlayerLockInfo() // Get Random dungeons that can be done at a certain level and expansion uint8 level = GetPlayer()->GetLevel(); - uint32 contentTuningReplacementConditionMask = GetPlayer()->m_playerData->CtrOptions->ContentTuningConditionMask; - lfg::LfgDungeonSet const& randomDungeons = sLFGMgr->GetRandomAndSeasonalDungeons(level, GetExpansion(), contentTuningReplacementConditionMask); + lfg::LfgDungeonSet const& randomDungeons = sLFGMgr->GetRandomAndSeasonalDungeons(level, GetExpansion(), 0); WorldPackets::LFG::LfgPlayerInfo lfgPlayerInfo; diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index e685aa29982..40a1626edb4 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1167,17 +1167,7 @@ void WorldSession::HandleConversationLineStarted(WorldPackets::Misc::Conversatio void WorldSession::HandleRequestLatestSplashScreen(WorldPackets::Misc::RequestLatestSplashScreen& /*requestLatestSplashScreen*/) { - UISplashScreenEntry const* splashScreen = nullptr; - for (auto itr = sUISplashScreenStore.begin(); itr != sUISplashScreenStore.end(); ++itr) - { - if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(itr->CharLevelConditionID)) - if (!ConditionMgr::IsPlayerMeetingCondition(_player, playerCondition)) - continue; - - splashScreen = *itr; - } - WorldPackets::Misc::SplashScreenShowLatest splashScreenShowLatest; - splashScreenShowLatest.UISplashScreenID = splashScreen ? splashScreen->ID : 0; + splashScreenShowLatest.UISplashScreenID = 0; SendPacket(splashScreenShowLatest.Write()); } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 74548ba34e2..4bcab4d2074 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -154,8 +154,8 @@ void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLoc if (std::shared_ptr<TerrainInfo> entranceTerrain = sTerrainMgr.LoadTerrain(corpseMapEntry->CorpseMapID)) { mapID = corpseMapEntry->CorpseMapID; - x = corpseMapEntry->Corpse.X; - y = corpseMapEntry->Corpse.Y; + //x = corpseMapEntry->Corpse.X; + //y = corpseMapEntry->Corpse.Y; z = entranceTerrain->GetStaticHeight(player->GetPhaseShift(), mapID, x, y, MAX_HEIGHT); } } diff --git a/src/server/game/Handlers/TransmogrificationHandler.cpp b/src/server/game/Handlers/TransmogrificationHandler.cpp index e067b97f57a..02b17190f8f 100644 --- a/src/server/game/Handlers/TransmogrificationHandler.cpp +++ b/src/server/game/Handlers/TransmogrificationHandler.cpp @@ -121,32 +121,7 @@ void WorldSession::HandleTransmogrifyItems(WorldPackets::Transmogrification::Tra resetAppearanceItems.push_back(itemTransmogrified); if (transmogItem.SpellItemEnchantmentID) - { - if (transmogItem.Slot != EQUIPMENT_SLOT_MAINHAND && transmogItem.Slot != EQUIPMENT_SLOT_OFFHAND) - { - TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - {}, Name: {} tried to transmogrify illusion into non-weapon slot ({}).", player->GetGUID().ToString(), player->GetName(), transmogItem.Slot); - return; - } - - TransmogIllusionEntry const* illusion = sDB2Manager.GetTransmogIllusionForEnchantment(transmogItem.SpellItemEnchantmentID); - if (!illusion) - { - TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - {}, Name: {} tried to transmogrify illusion using invalid enchant ({}).", player->GetGUID().ToString(), player->GetName(), transmogItem.SpellItemEnchantmentID); - return; - } - - if (PlayerConditionEntry const* condition = sPlayerConditionStore.LookupEntry(illusion->UnlockConditionID)) - { - if (!ConditionMgr::IsPlayerMeetingCondition(player, condition)) - { - TC_LOG_DEBUG("network", "WORLD: HandleTransmogrifyItems - {}, Name: {} tried to transmogrify illusion using not allowed enchant ({}).", player->GetGUID().ToString(), player->GetName(), transmogItem.SpellItemEnchantmentID); - return; - } - } - - illusionItems[itemTransmogrified] = transmogItem.SpellItemEnchantmentID; - cost += illusion->TransmogCost; - } + return; else resetIllusionItems.push_back(itemTransmogrified); } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index b4e43429384..425612d3111 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -440,8 +440,6 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) DoUpdateCriteria(CriteriaType::DefeatDungeonEncounter, dungeonEncounter->ID); SendBossKillCredit(dungeonEncounter->ID); - if (dungeonEncounter->CompleteWorldStateID) - DoUpdateWorldState(dungeonEncounter->CompleteWorldStateID, 1); UpdateLfgEncounterState(bossInfo); } @@ -508,10 +506,6 @@ void InstanceScript::Load(char const* data) { if (bosses[i].state == DONE && !CheckRequiredBosses(i)) bosses[i].state = NOT_STARTED; - - if (DungeonEncounterEntry const* dungeonEncounter = bosses[i].GetDungeonEncounterForDifficulty(instance->GetDifficultyID())) - if (dungeonEncounter->CompleteWorldStateID) - DoUpdateWorldState(dungeonEncounter->CompleteWorldStateID, bosses[i].state == DONE ? 1 : 0); } UpdateSpawnGroups(); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 95b1f3a204d..c9f1a768d8c 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3305,9 +3305,7 @@ bool Map::IsAlwaysActive() const bool Map::GetEntrancePos(int32 &mapid, float &x, float &y) { - if (!i_mapEntry) - return false; - return i_mapEntry->GetEntrancePos(mapid, x, y); + return false; } uint32 InstanceMap::GetMaxPlayers() const diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 20306a41081..68de71f0c69 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -398,9 +398,6 @@ uint32 Quest::XPValue(Player const* player, uint32 contentTuningId, uint32 xpDif return 0; uint32 xp = questXp->Difficulty[xpDifficulty]; - if (ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(contentTuningId)) - xp = xp * contentTuning->QuestXpMultiplier; - int32 diffFactor = 2 * (questLevel - player->GetLevel()) + 12; if (diffFactor < 1) diffFactor = 1; diff --git a/src/server/game/Server/Packets/InspectPackets.cpp b/src/server/game/Server/Packets/InspectPackets.cpp index cd2d25b80a1..942ffdc8f63 100644 --- a/src/server/game/Server/Packets/InspectPackets.cpp +++ b/src/server/game/Server/Packets/InspectPackets.cpp @@ -16,7 +16,6 @@ */ #include "InspectPackets.h" -#include "AzeriteItem.h" #include "Item.h" #include "Player.h" @@ -181,28 +180,6 @@ InspectItemData::InspectItemData(::Item const* item, uint8 index) } ++i; } - - if (AzeriteItem const* azeriteItem = item->ToAzeriteItem()) - { - if (UF::SelectedAzeriteEssences const* essences = azeriteItem->GetSelectedAzeriteEssences()) - { - for (uint8 slot = 0; slot < essences->AzeriteEssenceID.size(); ++slot) - { - AzeriteEssences.emplace_back(); - - AzeriteEssenceData& essence = AzeriteEssences.back(); - essence.Index = slot; - essence.AzeriteEssenceID = essences->AzeriteEssenceID[slot]; - if (essence.AzeriteEssenceID) - { - essence.Rank = azeriteItem->GetEssenceRank(essence.AzeriteEssenceID); - essence.SlotUnlocked = true; - } - else - essence.SlotUnlocked = azeriteItem->HasUnlockedEssenceSlot(slot); - } - } - } } WorldPacket const* InspectResult::Write() diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp index 513a7bffb45..ef02dfe1c74 100644 --- a/src/server/game/Server/Packets/QueryPackets.cpp +++ b/src/server/game/Server/Packets/QueryPackets.cpp @@ -177,7 +177,7 @@ bool PlayerGuidLookupData::Initialize(ObjectGuid const& guid, Player const* play ClassID = player->GetClass(); Level = player->GetLevel(); - if (UF::DeclinedNames const* names = player->GetDeclinedNames()) + if (DeclinedName const* names = player->GetDeclinedNames()) DeclinedNames = *names; } else diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b5da0699a0e..d7be21e316f 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2377,7 +2377,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, if (apply) { - target->SetSilencedSchoolMask(SpellSchoolMask(GetMiscValue())); + target->SetUnitFlag(UNIT_FLAG_SILENCED); // call functions which may have additional effects after changing state of unit // Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE @@ -2389,14 +2389,11 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, } else { - int32 silencedSchoolMask = 0; - for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_SILENCE)) - silencedSchoolMask |= auraEffect->GetMiscValue(); - - for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_PACIFY_SILENCE)) - silencedSchoolMask |= auraEffect->GetMiscValue(); + // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit + if (target->HasAuraType(SPELL_AURA_MOD_SILENCE) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE)) + return; - target->ReplaceAllSilencedSchoolMask(SpellSchoolMask(silencedSchoolMask)); + target->RemoveUnitFlag(UNIT_FLAG_SILENCED); } } @@ -4007,8 +4004,6 @@ void AuraEffect::HandleModManaCostPct(AuraApplication const* aurApp, uint8 mode, { if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT))) return; - - aurApp->GetTarget()->ApplyModManaCostMultiplier(GetAmount() / 100.0f, apply); } void AuraEffect::HandleAuraModPowerDisplay(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -4564,10 +4559,6 @@ void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, b return; Unit* target = aurApp->GetTarget(); - - for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) - if (GetMiscValue() & (1 << i)) - target->ApplyModManaCostModifier(SpellSchools(i), GetAmount(), apply); } void AuraEffect::HandleArenaPreparation(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -6284,11 +6275,6 @@ void AuraEffect::HandleCosmeticMounted(AuraApplication const* aurApp, uint8 mode if (!(mode & AURA_EFFECT_HANDLE_REAL)) return; - if (apply) - aurApp->GetTarget()->SetCosmeticMountDisplayId(GetMiscValue()); - else - aurApp->GetTarget()->SetCosmeticMountDisplayId(0); // set cosmetic mount to 0, even if multiple auras are active; tested with zandalari racial + divine steed - Player* playerTarget = aurApp->GetTarget()->ToPlayer(); if (!playerTarget) return; @@ -6305,16 +6291,6 @@ void AuraEffect::HandleModRequiredMountCapabilityFlags(AuraApplication const* au if (!playerTarget) return; - if (apply) - playerTarget->SetRequiredMountCapabilityFlag(GetMiscValue()); - else - { - int32 mountCapabilityFlags = 0; - for (AuraEffect* otherAura : playerTarget->GetAuraEffectsByType(GetAuraType())) - mountCapabilityFlags |= otherAura->GetMiscValue(); - - playerTarget->ReplaceAllRequiredMountCapabilityFlags(mountCapabilityFlags); - } } void AuraEffect::HandleSuppressItemPassiveEffectBySpellLabel(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 7f69471f325..0c36396b0a7 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -16,7 +16,6 @@ */ #include "Spell.h" -#include "AzeriteEmpoweredItem.h" #include "Battlefield.h" #include "BattlefieldMgr.h" #include "Battleground.h" @@ -5190,7 +5189,6 @@ void Spell::SendChannelUpdate(uint32 time) { unitCaster->ClearChannelObjects(); unitCaster->SetChannelSpellId(0); - unitCaster->SetChannelVisual({}); } WorldPackets::Spells::SpellChannelUpdate spellChannelUpdate; @@ -5252,7 +5250,6 @@ void Spell::SendChannelStart(uint32 duration) creatureCaster->SetSpellFocus(this, ObjectAccessor::GetWorldObject(*creatureCaster, unitCaster->m_unitData->ChannelObjects[0])); unitCaster->SetChannelSpellId(m_spellInfo->Id); - unitCaster->SetChannelVisual(m_SpellVisual); WorldPackets::Spells::SpellChannelStart spellChannelStart; spellChannelStart.CasterGUID = unitCaster->GetGUID(); @@ -6578,21 +6575,6 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 if (!(battlePetType & (1 << battlePetSpecies->PetTypeEnum))) return SPELL_FAILED_WRONG_BATTLE_PET_TYPE; - if (spellEffectInfo.Effect == SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY) - { - auto qualityItr = std::lower_bound(sBattlePetBreedQualityStore.begin(), sBattlePetBreedQualityStore.end(), spellEffectInfo.CalcBaseValue(m_caster, creature, m_castItemEntry, m_castItemLevel), [](BattlePetBreedQualityEntry const* a1, int32 selector) - { - return a1->MaxQualityRoll < selector; - }); - - BattlePets::BattlePetBreedQuality quality = BattlePets::BattlePetBreedQuality::Poor; - if (qualityItr != sBattlePetBreedQualityStore.end()) - quality = BattlePets::BattlePetBreedQuality(qualityItr->QualityEnum); - - if (battlePet->PacketInfo.Quality >= AsUnderlyingType(quality)) - return SPELL_FAILED_CANT_UPGRADE_BATTLE_PET; - } - if (spellEffectInfo.Effect == SPELL_EFFECT_GRANT_BATTLEPET_LEVEL || spellEffectInfo.Effect == SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE) if (battlePet->PacketInfo.Level >= BattlePets::MAX_BATTLE_PET_LEVEL) return GRANT_PET_LEVEL_FAIL; @@ -6903,7 +6885,7 @@ SpellCastResult Spell::CheckCasterAuras(int32* param1) const else if ((m_spellInfo->Mechanic & MECHANIC_IMMUNE_SHIELD) && m_caster->ToUnit() && m_caster->ToUnit()->HasAuraWithMechanic(1 << MECHANIC_BANISH)) result = SPELL_FAILED_STUNNED; } - else if (unitCaster->IsSilenced(m_spellSchoolMask) && m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_SILENCE && !CheckSpellCancelsSilence(param1)) + else if (unitCaster->HasUnitFlag(UNIT_FLAG_SILENCED) && m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_SILENCE && !CheckSpellCancelsSilence(param1)) result = SPELL_FAILED_SILENCED; else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_PACIFY && !CheckSpellCancelsPacify(param1)) result = SPELL_FAILED_PACIFIED; @@ -7783,36 +7765,7 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*= break; } case SPELL_EFFECT_RESPEC_AZERITE_EMPOWERED_ITEM: - { - Item const* item = m_targets.GetItemTarget(); - if (!item) - return SPELL_FAILED_AZERITE_EMPOWERED_ONLY; - - if (item->GetOwnerGUID() != m_caster->GetGUID()) - return SPELL_FAILED_DONT_REPORT; - - AzeriteEmpoweredItem const* azeriteEmpoweredItem = item->ToAzeriteEmpoweredItem(); - if (!azeriteEmpoweredItem) - return SPELL_FAILED_AZERITE_EMPOWERED_ONLY; - - bool hasSelections = false; - for (int32 tier = 0; tier < MAX_AZERITE_EMPOWERED_TIER; ++tier) - { - if (azeriteEmpoweredItem->GetSelectedAzeritePower(tier)) - { - hasSelections = true; - break; - } - } - - if (!hasSelections) - return SPELL_FAILED_AZERITE_EMPOWERED_NO_CHOICES_TO_UNDO; - - if (!m_caster->ToPlayer()->HasEnoughMoney(azeriteEmpoweredItem->GetRespecCost())) - return SPELL_FAILED_DONT_REPORT; - break; - } default: break; } @@ -9389,14 +9342,6 @@ CastSpellExtraArgs& CastSpellExtraArgs::SetTriggeringAura(AuraEffect const* trig return *this; } -SpellCastVisual::operator UF::SpellCastVisual() const -{ - UF::SpellCastVisual visual; - visual.SpellXSpellVisualID = SpellXSpellVisualID; - visual.ScriptVisualID = ScriptVisualID; - return visual; -} - SpellCastVisual::operator WorldPackets::Spells::SpellCastVisual() const { return { int32(SpellXSpellVisualID), int32(ScriptVisualID) }; diff --git a/src/server/game/Spells/SpellDefines.h b/src/server/game/Spells/SpellDefines.h index ef9a3b0f79b..18fdef801e2 100644 --- a/src/server/game/Spells/SpellDefines.h +++ b/src/server/game/Spells/SpellDefines.h @@ -39,11 +39,6 @@ enum Difficulty : uint8; enum ProcFlags : uint32; enum ProcFlags2 : int32; -namespace UF -{ - struct SpellCastVisual; -} - namespace WorldPackets { namespace Spells @@ -504,7 +499,6 @@ struct SpellCastVisual uint32 SpellXSpellVisualID = 0; uint32 ScriptVisualID = 0; - operator UF::SpellCastVisual() const; operator WorldPackets::Spells::SpellCastVisual() const; }; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 350f20e239d..6080c8ad392 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -18,8 +18,6 @@ #include "Spell.h" #include "AccountMgr.h" #include "AreaTrigger.h" -#include "AzeriteEmpoweredItem.h" -#include "AzeriteItem.h" #include "Battleground.h" #include "BattlegroundMgr.h" #include "BattlePetMgr.h" @@ -2508,7 +2506,7 @@ void Spell::EffectEnchantItemTmp() } // select enchantment duration - uint32 duration = pEnchant->Duration; + uint32 duration = m_damage; // item can be in trade slot and have owner diff. from caster Player* item_owner = itemTarget->GetOwner(); @@ -3823,7 +3821,7 @@ void Spell::EffectSkinning() if (!contentTuning) return; - uint32 skinningSkill = player->GetProfessionSkillForExp(skill, contentTuning->ExpansionID); + uint32 skinningSkill = player->GetProfessionSkillForExp(skill, 0); if (!skinningSkill) return; @@ -5528,17 +5526,6 @@ void Spell::EffectChangeBattlePetQuality() if (!unitTarget || !unitTarget->IsCreature()) return; - - auto qualityItr = std::lower_bound(sBattlePetBreedQualityStore.begin(), sBattlePetBreedQualityStore.end(), damage, [](BattlePetBreedQualityEntry const* a1, int32 selector) - { - return a1->MaxQualityRoll < selector; - }); - - BattlePets::BattlePetBreedQuality quality = BattlePets::BattlePetBreedQuality::Poor; - if (qualityItr != sBattlePetBreedQualityStore.end()) - quality = BattlePets::BattlePetBreedQuality(qualityItr->QualityEnum); - - playerCaster->GetSession()->GetBattlePetMgr()->ChangeBattlePetQuality(unitTarget->GetBattlePetCompanionGUID(), quality); } void Spell::EffectLaunchQuestChoice() @@ -5830,69 +5817,10 @@ void Spell::EffectLearnTransmogSet() void Spell::EffectRespecAzeriteEmpoweredItem() { - if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) - return; - - if (!itemTarget || !itemTarget->IsAzeriteEmpoweredItem()) - return; - - Player* owner = m_caster->ToPlayer(); - if (!owner) - return; - - AzeriteEmpoweredItem* azeriteEmpoweredItem = itemTarget->ToAzeriteEmpoweredItem(); - owner->ModifyMoney(-azeriteEmpoweredItem->GetRespecCost()); - - // reapply all item mods - item level change affects stats and auras - if (azeriteEmpoweredItem->IsEquipped()) - owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), false); - - azeriteEmpoweredItem->ClearSelectedAzeritePowers(); - - if (azeriteEmpoweredItem->IsEquipped()) - owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), true); - - azeriteEmpoweredItem->SetState(ITEM_CHANGED, owner); - owner->SetNumRespecs(owner->GetNumRespecs() + 1); } void Spell::EffectLearnAzeriteEssencePower() { - if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) - return; - - Player* playerTarget = unitTarget ? unitTarget->ToPlayer() : nullptr; - if (!playerTarget) - return; - - Item* heartOfAzeroth = playerTarget->GetItemByEntry(ITEM_ID_HEART_OF_AZEROTH, ItemSearchLocation::Everywhere); - if (!heartOfAzeroth) - return; - - AzeriteItem* azeriteItem = heartOfAzeroth->ToAzeriteItem(); - if (!azeriteItem) - return; - - // remove old rank and apply new one - if (azeriteItem->IsEquipped()) - { - if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences()) - { - for (int32 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot) - { - if (selectedEssences->AzeriteEssenceID[slot] == uint32(effectInfo->MiscValue)) - { - bool major = AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(slot)->Type) == AzeriteItemMilestoneType::MajorEssence; - playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, MAX_AZERITE_ESSENCE_RANK, major, false); - playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, effectInfo->MiscValueB, major, false); - break; - } - } - } - } - - azeriteItem->SetEssenceRank(effectInfo->MiscValue, effectInfo->MiscValueB); - azeriteItem->SetState(ITEM_CHANGED, playerTarget); } void Spell::EffectCreatePrivateConversation() @@ -5940,18 +5868,6 @@ void Spell::EffectGrantBattlePetExperience() void Spell::EffectLearnTransmogIllusion() { - if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) - return; - - Player* player = Object::ToPlayer(unitTarget); - if (!player) - return; - - uint32 illusionId = effectInfo->MiscValue; - if (!sTransmogIllusionStore.LookupEntry(illusionId)) - return; - - player->GetSession()->GetCollectionMgr()->AddTransmogIllusion(illusionId); } void Spell::EffectModifyAuraStacks() diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 656bd37e3a7..f73fa7e6a1a 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -433,7 +433,7 @@ SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo, SpellEffectEntry co TriggerSpell = _effect.EffectTriggerSpell; SpellClassMask = _effect.EffectSpellClassMask; BonusCoefficientFromAP = _effect.BonusCoefficientFromAP; - Scaling.Class = _effect.ScalingClass; + Scaling.Class = 0; Scaling.Coefficient = _effect.Coefficient; Scaling.Variance = _effect.Variance; Scaling.ResourceCoefficient = _effect.ResourceCoefficient; @@ -587,7 +587,7 @@ int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* targ if (!randPropPoints) randPropPoints = sRandPropPointsStore.AssertEntry(sRandPropPointsStore.GetNumRows() - 1); - value = Scaling.Class == -8 ? randPropPoints->DamageReplaceStatF : randPropPoints->DamageSecondaryF; + value = randPropPoints->DamageReplaceStat; } else value = GetRandomPropertyPoints(effectiveItemLevel, ITEM_QUALITY_RARE, INVTYPE_CHEST, 0); @@ -615,27 +615,6 @@ int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* targ else { float value = BasePoints; - ExpectedStatType stat = GetScalingExpectedStat(); - if (stat != ExpectedStatType::None) - { - if (_spellInfo->HasAttribute(SPELL_ATTR0_SCALES_WITH_CREATURE_LEVEL)) - stat = ExpectedStatType::CreatureAutoAttackDps; - - // TODO - add expansion and content tuning id args? - uint32 contentTuningId = _spellInfo->ContentTuningId; // content tuning should be passed as arg, the one stored in SpellInfo is fallback - int32 expansion = -2; - if (ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(contentTuningId)) - expansion = contentTuning->ExpansionID; - - int32 level = 1; - if (target && _spellInfo->HasAttribute(SPELL_ATTR8_USE_TARGETS_LEVEL_FOR_SPELL_SCALING)) - level = target->GetLevel(); - else if (caster && caster->IsUnit()) - level = caster->ToUnit()->GetLevel(); - - value = sDB2Manager.EvaluateExpectedStat(stat, level, expansion, 0, CLASS_NONE, 0) * BasePoints / 100.0f; - } - return int32(round(value)); } } @@ -1238,10 +1217,6 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S TargetAuraSpell = _aura->TargetAuraSpell; ExcludeCasterAuraSpell = _aura->ExcludeCasterAuraSpell; ExcludeTargetAuraSpell = _aura->ExcludeTargetAuraSpell; - CasterAuraType = AuraType(_aura->CasterAuraType); - TargetAuraType = AuraType(_aura->TargetAuraType); - ExcludeCasterAuraType = AuraType(_aura->ExcludeCasterAuraType); - ExcludeTargetAuraType = AuraType(_aura->ExcludeTargetAuraType); } // SpellCastingRequirementsEntry @@ -1277,7 +1252,6 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S RecoveryTime = _cooldowns->RecoveryTime; CategoryRecoveryTime = _cooldowns->CategoryRecoveryTime; StartRecoveryTime = _cooldowns->StartRecoveryTime; - CooldownAuraSpellId = _cooldowns->AuraSpellID; } // SpellEquippedItemsEntry @@ -4082,34 +4056,6 @@ Optional<SpellPowerCost> SpellInfo::CalcPowerCost(SpellPowerEntry const* power, { powerCost = int32(power->OptionalCost); - if (power->OptionalCostPct) - { - switch (power->PowerType) - { - // health as power used - case POWER_HEALTH: - powerCost += int32(CalculatePct(unitCaster->GetMaxHealth(), power->OptionalCostPct)); - break; - case POWER_MANA: - powerCost += int32(CalculatePct(unitCaster->GetCreateMana(), power->OptionalCostPct)); - break; - case POWER_ALTERNATE_POWER: - TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unsupported power type POWER_ALTERNATE_POWER in spell {} for optional cost percent", Id); - return {}; - default: - { - if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(Powers(power->PowerType))) - { - powerCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, power->OptionalCostPct)); - break; - } - - TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '{}' in spell {} for optional cost percent", power->PowerType, Id); - return {}; - } - } - } - powerCost += unitCaster->GetTotalAuraModifier(SPELL_AURA_MOD_ADDITIONAL_POWER_COST, [this, power](AuraEffect const* aurEff) -> bool { return aurEff->GetMiscValue() == power->PowerType @@ -4212,9 +4158,6 @@ Optional<SpellPowerCost> SpellInfo::CalcPowerCost(SpellPowerEntry const* power, } } - if (power->PowerType == POWER_MANA) - powerCost = float(powerCost) * (1.0f + unitCaster->m_unitData->ManaCostMultiplier); - // power cost cannot become negative if initially positive if (initiallyNegative != (powerCost < 0)) powerCost = 0; @@ -4296,7 +4239,7 @@ inline float CalcPPMCritMod(SpellProcsPerMinuteModEntry const* mod, Unit* caster float crit = player->m_activePlayerData->CritPercentage; float rangedCrit = player->m_activePlayerData->RangedCritPercentage; - float spellCrit = player->m_activePlayerData->SpellCritPercentage; + float spellCrit = player->m_activePlayerData->SpellCritPercentage[0]; switch (mod->Param) { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index cfd9b4fd99a..a53049d8a5b 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -684,8 +684,7 @@ public: if (handler->GetSession()) { int32 maxLevel = 0; - if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(questTemplatePair.second.GetContentTuningId(), - handler->GetSession()->GetPlayer()->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(questTemplatePair.second.GetContentTuningId())) maxLevel = questLevels->MaxLevel; int32 scalingFactionGroup = 0; @@ -744,8 +743,7 @@ public: if (handler->GetSession()) { int32 maxLevel = 0; - if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(questTemplatePair.second.GetContentTuningId(), - handler->GetSession()->GetPlayer()->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(questTemplatePair.second.GetContentTuningId())) maxLevel = questLevels->MaxLevel; int32 scalingFactionGroup = 0; @@ -814,8 +812,7 @@ public: if (handler->GetSession()) { int32 maxLevel = 0; - if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(quest->GetContentTuningId(), - handler->GetSession()->GetPlayer()->m_playerData->CtrOptions->ContentTuningConditionMask)) + if (Optional<ContentTuningLevels> questLevels = sDB2Manager.GetContentTuningData(quest->GetContentTuningId())) maxLevel = questLevels->MaxLevel; int32 scalingFactionGroup = 0; diff --git a/src/server/scripts/Spells/spell_azerite.cpp b/src/server/scripts/Spells/spell_azerite.cpp index 760bcaa515a..794e588da9f 100644 --- a/src/server/scripts/Spells/spell_azerite.cpp +++ b/src/server/scripts/Spells/spell_azerite.cpp @@ -581,8 +581,6 @@ class spell_item_heart_of_azeroth : public AuraScript { if (Player* target = GetTarget()->ToPlayer()) { - target->ApplyAllAzeriteEmpoweredItemMods(equipped); - WorldPackets::Azerite::PlayerAzeriteItemEquippedStatusChanged statusChanged; statusChanged.IsHeartEquipped = equipped; target->SendDirectMessage(statusChanged.Write()); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index da6a028a78f..58a5770b025 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5003,7 +5003,7 @@ class spell_gen_skinning : public SpellScript if (!contentTuning) return; - uint32 skinningSkill = player->GetProfessionSkillForExp(SKILL_SKINNING, contentTuning->ExpansionID); + uint32 skinningSkill = player->GetProfessionSkillForExp(SKILL_SKINNING, 0); if (!skinningSkill) return; diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 59df174b3a0..3c57ad48ed9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -159,7 +159,7 @@ class spell_warl_chaos_bolt : public SpellScript void HandleDummy(SpellEffIndex /*effIndex*/) { - SetHitDamage(GetHitDamage() + CalculatePct(GetHitDamage(), GetCaster()->ToPlayer()->m_activePlayerData->SpellCritPercentage)); + SetHitDamage(GetHitDamage() + CalculatePct(GetHitDamage(), GetCaster()->ToPlayer()->m_activePlayerData->SpellCritPercentage[0])); } void CalcCritChance(Unit const* /*victim*/, float& critChance) |
