diff --git a/sql/updates/characters/master/2026_11_19_00_characters_major_factions.sql b/sql/updates/characters/master/2026_11_19_00_characters_major_factions.sql new file mode 100644 index 00000000..aa1fa89a --- /dev/null +++ b/sql/updates/characters/master/2026_11_19_00_characters_major_factions.sql @@ -0,0 +1,25 @@ +-- +-- Major Factions - renown reward grant tracking +-- +-- Backs ReputationMgr::IsRenownRewardGranted / MarkRenownRewardGranted and is +-- loaded at login by ReputationMgr::LoadRenownRewardsGrantedFromDB (queries +-- CHAR_SEL_CHAR_RENOWN_REWARDS_GRANTED / CHAR_SEL_WARBAND_RENOWN_REWARDS_GRANTED). +-- +-- character_renown_rewards_granted holds character-bound rewards (RenownRewards +-- rows without the AccountUnlock flag, e.g. per-toon spells / Crafter's +-- Knowledge). warband_renown_rewards_granted holds rows with AccountUnlock, so +-- a mount/toy/transmog unlocked by one character is not handed out again to +-- every alt on the same Battle.net account. +-- + +CREATE TABLE IF NOT EXISTS `character_renown_rewards_granted` ( + `characterId` bigint unsigned NOT NULL, + `renownRewardId` int unsigned NOT NULL, + PRIMARY KEY (`characterId`, `renownRewardId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `warband_renown_rewards_granted` ( + `battlenetAccountId` int unsigned NOT NULL, + `renownRewardId` int unsigned NOT NULL, + PRIMARY KEY (`battlenetAccountId`, `renownRewardId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/sql/updates/world/master/2026_11_19_01_world_major_factions.sql b/sql/updates/world/master/2026_11_19_01_world_major_factions.sql new file mode 100644 index 00000000..5d0536ab --- /dev/null +++ b/sql/updates/world/master/2026_11_19_01_world_major_factions.sql @@ -0,0 +1,85 @@ +-- +-- Major Factions - world configuration table and seed +-- +-- MajorFactionMgr::LoadWorldData() reads this table at startup (wired from +-- World::SetInitialWorldSettings right after sDB2Manager.IndexLoadedStores()). +-- The table is a server-side overlay for the post-12.0 Journey UI; everything +-- else (identity, renown track, rewards, paragon) comes from DB2. +-- +-- Values match the live 12.1.5.70077 data. uiPriority orders the expansion +-- page (newer expansions sort first). displayAsJourney/useJourneyRewardTrack/ +-- useJourneyUnlockToast are set only for 2616 Keg Leg Thrasher (Plunderstorm), +-- which renders through Journey-mode UI and has no renown campaign. +-- +-- 2772 Zul'jarra's Forces is a live major faction (ParagonFactionID and +-- RenownCurrencyID are set) but is intentionally not seeded: its intro quest +-- and campaign ids have not been verified, and LoadWorldData tolerates a +-- missing row (GetConfig returns nullptr). Add it once the data is captured. +-- +-- introQuestId is the canonical/Horde value; introQuestIdAlliance is only set +-- where the Alliance uses a distinct quest (2507 Dragonscale Expedition: +-- Horde 65435, Alliance 65436). 0 means "fall back to introQuestId". +-- + +CREATE TABLE IF NOT EXISTS `major_faction_config` ( + `factionId` int unsigned NOT NULL, + `hiddenFromExpansionPage` tinyint(1) NOT NULL DEFAULT 0, + `displayAsJourney` tinyint(1) NOT NULL DEFAULT 0, + `useJourneyRewardTrack` tinyint(1) NOT NULL DEFAULT 0, + `useJourneyUnlockToast` tinyint(1) NOT NULL DEFAULT 0, + `uiPriority` int NOT NULL DEFAULT 0, + `introQuestId` int unsigned NOT NULL DEFAULT 0, + `introQuestIdAlliance` int unsigned NOT NULL DEFAULT 0, + `playerCompanionId` int unsigned NOT NULL DEFAULT 0, + `renownCampaignId` int unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`factionId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- Older installs created the table before introQuestIdAlliance existed. +-- MySQL 8 has no ADD COLUMN IF NOT EXISTS, so guard it through +-- INFORMATION_SCHEMA and a prepared statement (no DELIMITER required). +SET @hasIntroQuestIdAlliance := ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = 'major_faction_config' + AND COLUMN_NAME = 'introQuestIdAlliance'); +SET @addIntroQuestIdAlliance := IF(@hasIntroQuestIdAlliance = 0, + 'ALTER TABLE `major_faction_config` ADD COLUMN `introQuestIdAlliance` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `introQuestId`', + 'DO 0'); +PREPARE stmt FROM @addIntroQuestIdAlliance; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +DELETE FROM `major_faction_config` WHERE `factionId` IN + (2503, 2507, 2510, 2511, 2564, 2574, 2570, 2590, 2594, 2600, 2616, + 2653, 2658, 2685, 2688, 2696, 2699, 2704, 2710, 2792); + +INSERT INTO `major_faction_config` + (`factionId`, `hiddenFromExpansionPage`, `displayAsJourney`, `useJourneyRewardTrack`, + `useJourneyUnlockToast`, `uiPriority`, `introQuestId`, `introQuestIdAlliance`, + `playerCompanionId`, `renownCampaignId`) VALUES +-- Dragonflight 10.x +(2503, 0, 0, 0, 0, 100, 65795, 0, 0, 166), -- Maruuk Centaur +(2507, 0, 0, 0, 0, 101, 65435, 65436, 0, 197), -- Dragonscale Expedition (Alliance intro 65436) +(2510, 0, 0, 0, 0, 102, 66705, 0, 0, 189), -- Valdrakken Accord +(2511, 0, 0, 0, 0, 103, 65566, 0, 0, 174), -- Iskaara Tuskarr +(2564, 0, 0, 0, 0, 104, 75292, 0, 0, 203), -- Loamm Niffen +(2574, 0, 0, 0, 0, 105, 76558, 0, 0, 231), -- Dream Wardens +-- Plunderstorm 10.2.6 (dedicated Journey track, no campaign) +(2616, 0, 1, 1, 1, 150, 78443, 0, 0, 0), -- Keg Leg Thrasher +-- The War Within 11.0 +(2570, 0, 0, 0, 0, 200, 76246, 0, 0, 238), -- Hallowfall Arathi +(2590, 0, 0, 0, 0, 201, 76061, 0, 0, 236), -- Council of Dornogal +(2594, 0, 0, 0, 0, 202, 76365, 0, 0, 237), -- The Assembly of the Deeps +(2600, 0, 0, 0, 0, 203, 76502, 0, 0, 239), -- The Severed Threads +-- The War Within 11.1 / 11.2 +(2653, 0, 0, 0, 0, 210, 85115, 0, 0, 264), -- The Cartels of Undermine +(2688, 0, 0, 0, 0, 211, 86715, 0, 0, 267), -- Flame's Radiance +(2658, 0, 0, 0, 0, 220, 85116, 0, 0, 268), -- The K'aresh Trust +(2685, 0, 0, 0, 0, 221, 85116, 0, 0, 0), -- Gallagio Loyalty Rewards Club (raid, no campaign) +-- Midnight 12.0 +(2696, 0, 0, 0, 0, 300, 92010, 0, 0, 270), -- Amani Tribe +(2699, 0, 0, 0, 0, 301, 92030, 0, 0, 270), -- The Singularity +(2704, 0, 0, 0, 0, 302, 92020, 0, 0, 270), -- Hara'ti +(2710, 0, 0, 0, 0, 303, 92040, 0, 0, 267), -- Silvermoon Court +(2792, 0, 0, 0, 0, 310, 95390, 0, 0, 0); -- Ritual Sites (auxiliary track, no campaign) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 54a3ef6e..e2569115 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -87,6 +87,7 @@ #include "LootPackets.h" #include "Mail.h" #include "MailPackets.h" +#include "MajorFactionMgr.h" #include "MapManager.h" #include "MapUtils.h" #include "MiscPackets.h" @@ -17423,10 +17424,6 @@ void Player::ReputationChanged(FactionEntry const* factionEntry, int32 change) UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_MIN_REPUTATION, factionEntry->ID, change); UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_MAX_REPUTATION, factionEntry->ID, change); UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_INCREASE_REPUTATION, factionEntry->ID, change); - - // A covenant renown gain may cross one or more renown levels -> grant their RenownRewards. - if (change > 0 && GetReputationMgr().IsRenownReputation(factionEntry)) - UpdateRenownRewards(factionEntry); } void Player::CurrencyChanged(uint32 currencyId, int32 change) @@ -35298,7 +35295,7 @@ CurrencyTypesEntry const* Player::GetCovenantRenownCurrency(uint32 covenantId) // Covenant.db2 also carries the Dragonflight and later major factions, and they publish a CurrencyTypesID // too. Those run on renown REPUTATION (their Faction row publishes RenownCurrencyID) and are served by - // UpdateRenownRewards(FactionEntry const*); claiming them here would double-grant and would apply the + // MajorFactionMgr::GrantRenownLevelRewards; claiming them here would double-grant and would apply the // Shadowlands-only level offset to them. Only covenants whose faction publishes no renown currency - which // in this build is exactly the four Shadowlands covenants - are currency-driven. FactionEntry const* faction = sFactionStore.LookupEntry(uint32(covenant->FactionID)); @@ -35489,32 +35486,6 @@ void Player::GrantRenownReward(RenownRewardsEntry const* reward) // quests at a character would be destructive. Left until the field's meaning is confirmed in-game. } -void Player::UpdateRenownRewards(FactionEntry const* renownFaction) -{ - // Only act on live renown gains for an in-world player (avoids granting items mid-load); a player who already had - // renown before this feature is caught up on the first live renown change (all ungranted levels grant at once). - if (!renownFaction || !IsInWorld()) - return; - - if (!GetReputationMgr().IsRenownReputation(renownFaction)) - return; - - // Which covenant owns this renown faction? - uint32 covenantId = 0; - for (CovenantEntry const* covenant : sCovenantStore) - { - if (covenant->FactionID == int32(renownFaction->ID)) - { - covenantId = covenant->ID; - break; - } - } - if (!covenantId) - return; - - GrantRenownRewardsUpTo(covenantId, GetReputationMgr().GetRenownLevel(renownFaction)); -} - void Player::UpdateCovenantRenownRewards(uint32 covenantId) { // Same in-world guard as the reputation path: never grant items mid-load. A character that already holds @@ -35987,10 +35958,13 @@ void Player::GrantRenownRewardsUpTo(uint32 covenantId, int32 currentLevel) void Player::UpdateAllRenownRewards() { - // Reputation-driven renown (Dragonflight and later major factions). - for (CovenantEntry const* covenant : sCovenantStore) - if (FactionEntry const* faction = sFactionStore.LookupEntry(uint32(covenant->FactionID))) - UpdateRenownRewards(faction); + // Reputation-driven renown (Dragonflight and later major factions). Live level-ups dispatch through + // ReputationMgr::SetReputation; this is the in-world catch-up for renown the character already holds - either + // earned before the grant tables existed or inherited from a warband alt. GrantRenownLevelRewards skips rows + // already present in the character/warband grant tables, so replaying every level from 0 is cheap and idempotent. + if (IsInWorld()) + for (uint32 factionId : sMajorFactionMgr->GetMajorFactionIDs()) + sMajorFactionMgr->GrantRenownLevelRewards(this, factionId, 0, sMajorFactionMgr->GetPlayerRenownLevel(this, factionId)); // Currency-driven renown (the four Shadowlands covenants). Every covenant is walked, not just the active // one: the per-covenant currencies 1829-1832 persist independently, so a character that switched covenants diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index be9f6af2..073cd104 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -3186,19 +3186,19 @@ class TC_GAME_API Player final : public Unit, public GridObject void RemoveSoulbindTraitSpells(); // Covenant renown. - // - // There are two renown engines and Covenant.db2 feeds both: - // - Dragonflight and later major factions (Covenant.db2 rows 12+) run on renown REPUTATION: their - // Faction row publishes RenownCurrencyID, ReputationMgr::IsRenownReputation is true and - // ReputationMgr::GetRenownLevel returns the level. UpdateRenownRewards(FactionEntry const*) serves those. - // - The four Shadowlands covenants (1-4) do NOT. Factions 2407/2410/2413/2465 publish - // RenownCurrencyID = 0 and RenownFactionID = 0, so IsRenownReputation is false for them and the - // reputation path can never fire for a covenant. Their renown is the per-covenant currency named by - // Covenant.db2 CurrencyTypesID (1829 Kyrian / 1830 Venthyr / 1831 Night Fae / 1832 Necrolord). - // That is also why one character can hold four independent renown tracks. - // Both paths converge on GrantRenownRewardsUpTo(), which grants each RenownRewards row exactly once. - void UpdateRenownRewards(FactionEntry const* renownFaction); - void UpdateAllRenownRewards(); // login catch-up: grant any renown rewards earned before this feature existed + // + // There are two renown engines and Covenant.db2 feeds both: + // - Dragonflight and later major factions (Covenant.db2 rows 12+) run on renown REPUTATION: their + // Faction row publishes RenownCurrencyID, ReputationMgr::IsRenownReputation is true and + // ReputationMgr::GetRenownLevel returns the level. MajorFactionMgr::GrantRenownLevelRewards serves + // those and tracks the grants per character / per warband. + // - The four Shadowlands covenants (1-4) do NOT. Factions 2407/2410/2413/2465 publish + // RenownCurrencyID = 0 and RenownFactionID = 0, so IsRenownReputation is false for them and the + // reputation path can never fire for a covenant. Their renown is the per-covenant currency named by + // Covenant.db2 CurrencyTypesID (1829 Kyrian / 1830 Venthyr / 1831 Night Fae / 1832 Necrolord). + // That is also why one character can hold four independent renown tracks; those converge on + // GrantRenownRewardsUpTo(). + void UpdateAllRenownRewards(); // login catch-up: grant any renown rewards the character already holds // The currency a Shadowlands covenant stores its renown in, or nullptr for any covenant whose renown is // reputation-driven (and therefore not handled here). diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index a8447063..4cc62994 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1702,7 +1702,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder) pCurrChar->SendInitialPacketsAfterAddToMap(); //WowCommunity - // Now in world: grant any covenant renown rewards earned before this character was last saved / before the feature existed. + // Now in world: grant any renown rewards the character already holds (major factions and Shadowlands covenants), + // including rewards earned before the grant tables existed or inherited from a warband alt. pCurrChar->UpdateAllRenownRewards(); // Mythic+ weekly keystone maintenance: after a weekly reset the carried keystone is adjusted from last week's diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 34f13202..14bde375 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -58,8 +58,6 @@ #include "World.h" #include #include -#include "MajorFactionMgr.h" -#include "MajorFactionPackets.h" #include "ReferAFriendPackets.h" #include "ReputationMgr.h" diff --git a/src/server/game/MajorFactions/MajorFactionMgr.cpp b/src/server/game/MajorFactions/MajorFactionMgr.cpp index 6bd3efac..482ea7d7 100644 --- a/src/server/game/MajorFactions/MajorFactionMgr.cpp +++ b/src/server/game/MajorFactions/MajorFactionMgr.cpp @@ -90,6 +90,26 @@ void MajorFactionMgr::IndexCovenants() continue; uint32 factionId = uint32(covenant->FactionID); + + // Some covenant rows point at a non-major sibling faction that shares + // the major faction's renown currency (e.g. covenant 23 "Keg Leg's + // Crew" -> faction 2593, while the major faction is 2616 "Keg Leg + // Thrasher"; both use currency 2814). RenownRewards rows are keyed by + // CovenantID, so without this remap the rows would be bucketed under + // 2593 and never dispatched for 2616. + if (!_majorFactionSet.contains(factionId) && covenant->CurrencyTypesID != 0) + { + for (uint32 candidateId : _majorFactionIDs) + { + FactionEntry const* candidate = sFactionStore.LookupEntry(candidateId); + if (candidate && uint32(candidate->RenownCurrencyID) == uint32(covenant->CurrencyTypesID)) + { + factionId = candidateId; + break; + } + } + } + _factionToCovenant[factionId] = covenant->ID; _covenantToFaction[covenant->ID] = factionId; _covenantByFaction[factionId] = covenant; @@ -457,7 +477,11 @@ uint32 MajorFactionMgr::GetPlayerRenownLevel(Player const* player, uint32 factio if (!faction) return 0; - return uint32(player->GetReputationMgr().GetRenownLevel(faction)); + // GetRenownLevel returns raw currency quantity as int32; it can be + // negative if a cheat/destroy path drove the currency below zero, which + // must not wrap into a huge unsigned level. + int32 level = player->GetReputationMgr().GetRenownLevel(faction); + return level > 0 ? uint32(level) : 0; } uint32 MajorFactionMgr::GetPlayerReputationThisLevel(Player const* player, uint32 factionId) const @@ -469,20 +493,26 @@ uint32 MajorFactionMgr::GetPlayerReputationThisLevel(Player const* player, uint3 if (!faction) return 0; - int32 standing = player->GetReputationMgr().GetReputation(faction); - if (standing <= 0) + // FactionState::Standing already holds the progress inside the current + // renown level for renown factions: ReputationMgr::SetReputation + // normalises it as totalReputation % threshold. The threshold comes from + // FactionEntry.ReputationMax for the character's race/class, so it must + // not be replaced by the fixed ReputationPerRenownLevel constant. + ReputationMgr const& repMgr = player->GetReputationMgr(); + int32 threshold = repMgr.GetRenownLevelThreshold(faction); + if (threshold <= 0) return 0; - uint32 perLevel = GetReputationPerRenownLevel(factionId); - if (perLevel == 0) + FactionState const* state = repMgr.GetState(faction); + if (!state || state->Standing <= 0) return 0; - return uint32(standing) % perLevel; + return uint32(state->Standing) % uint32(threshold); } // ----- Reward dispatch ----------------------------------------------------- -void MajorFactionMgr::GrantRenownLevelRewards(Player* player, uint32 factionId, uint32 fromLevel, uint32 toLevel, bool accountSync) const +void MajorFactionMgr::GrantRenownLevelRewards(Player* player, uint32 factionId, uint32 fromLevel, uint32 toLevel) const { if (!player || fromLevel >= toLevel) return; @@ -495,34 +525,31 @@ void MajorFactionMgr::GrantRenownLevelRewards(Player* player, uint32 factionId, { bool isAccountUnlock = (uint32(reward->Flags) & uint32(MajorFactions::RenownRewardFlags::AccountUnlock)) != 0; - // On account-sync (alt inherits renown from a higher toon), skip - // account-wide rewards that have already been granted on the - // original toon. Character-bound rewards still need to be granted - // because they're per-toon (e.g. Crafter's Knowledge). - if (accountSync && isAccountUnlock) - continue; - if (player->GetReputationMgr().IsRenownRewardGranted(reward->ID, isAccountUnlock)) continue; - GrantSingleRenownReward(player, reward); - player->GetReputationMgr().MarkRenownRewardGranted(reward->ID, isAccountUnlock); + // Only remember the reward when it was actually handed out: a row + // gated by a PlayerConditionID that does not hold yet must stay + // unmarked so a later pass can still grant it. + if (GrantSingleRenownReward(player, reward)) + player->GetReputationMgr().MarkRenownRewardGranted(reward->ID, isAccountUnlock); } } -void MajorFactionMgr::GrantSingleRenownReward(Player* player, RenownRewardsEntry const* reward) const +bool MajorFactionMgr::GrantSingleRenownReward(Player* player, RenownRewardsEntry const* reward) const { if (!player || !reward) - return; + return false; - // PlayerConditionID gate: if set and not satisfied, skip silently. The - // client itself filters the reward row in this case so this is the - // server mirror. + // PlayerConditionID gate: if set and not satisfied, skip. The client + // filters the row in this case, so this is the server mirror. Returning + // false keeps the row eligible for a later attempt instead of marking it + // granted for a condition that may become true later. if (reward->PlayerConditionID > 0) { PlayerConditionEntry const* condition = sPlayerConditionStore.LookupEntry(uint32(reward->PlayerConditionID)); - if (condition && !ConditionMgr::IsPlayerMeetingCondition(player, condition)) - return; + if (!condition || !ConditionMgr::IsPlayerMeetingCondition(player, condition)) + return false; } // Item grant. @@ -602,4 +629,6 @@ void MajorFactionMgr::GrantSingleRenownReward(Player* player, RenownRewardsEntry TC_LOG_DEBUG("server.major-factions", "Granted RenownReward {} (Level {}, CovenantID {}) to player {} GUID {}", reward->ID, reward->Level, reward->CovenantID, player->GetName(), player->GetGUID().ToString()); + + return true; } diff --git a/src/server/game/MajorFactions/MajorFactionMgr.h b/src/server/game/MajorFactions/MajorFactionMgr.h index 407662c8..9f2b7d15 100644 --- a/src/server/game/MajorFactions/MajorFactionMgr.h +++ b/src/server/game/MajorFactions/MajorFactionMgr.h @@ -189,9 +189,11 @@ public: // ReputationMgr::GetRenownLevel via FactionEntry lookup). uint32 GetPlayerRenownLevel(Player const* player, uint32 factionId) const; - // Reputation earned toward the next renown level (standing modulo - // ReputationPerRenownLevel). Mirror of - // MajorFactionData.renownReputationEarned. + // Reputation earned toward the next renown level. Mirror of + // MajorFactionData.renownReputationEarned. Uses the normalised + // FactionState::Standing that ReputationMgr keeps for renown factions + // and the faction's real per-level threshold (FactionEntry.ReputationMax) + // rather than a fixed constant. uint32 GetPlayerReputationThisLevel(Player const* player, uint32 factionId) const; // -- Reward dispatch (Phase 10C) ----------------------------------- @@ -200,18 +202,16 @@ public: // for the given faction and dispatch each reward to the player. // Handles multi-level jumps (e.g. catch-up). De-duplicates against // ReputationMgr::IsRenownRewardGranted (character-scoped and - // account-scoped grant tables). - // - // If accountSync is true the call is the result of an alt logging - // in and inheriting renown from a higher-level toon: only - // character-bound rewards are granted (account-wide rewards were - // already granted on the original toon and live in - // warband_renown_rewards_granted). - void GrantRenownLevelRewards(Player* player, uint32 factionId, uint32 fromLevel, uint32 toLevel, bool accountSync = false) const; + // account-scoped grant tables), so the same span may safely be replayed + // both on a live level-up and on the login catch-up pass. + void GrantRenownLevelRewards(Player* player, uint32 factionId, uint32 fromLevel, uint32 toLevel) const; - // Dispatch a single RenownRewards row. Used both by - // GrantRenownLevelRewards and by admin/test command paths. - void GrantSingleRenownReward(Player* player, RenownRewardsEntry const* reward) const; + // Dispatch a single RenownRewards row. Returns whether the reward was + // actually handed out. A row whose PlayerConditionID is set but not + // satisfied returns false so the caller leaves it unmarked and it is + // re-evaluated on a later pass. Used both by GrantRenownLevelRewards and + // by admin/test command paths. + bool GrantSingleRenownReward(Player* player, RenownRewardsEntry const* reward) const; private: void IndexFactions(); diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 184fd20b..5484fd83 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -599,7 +599,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in // Phase 10C: dispatch renown rewards for every level crossed (only on increase). if (newRenownLevel > oldRenownLevel && sMajorFactionMgr->IsMajorFaction(factionEntry)) - sMajorFactionMgr->GrantRenownLevelRewards(_player, factionEntry->ID, uint32(oldRenownLevel), uint32(newRenownLevel), false); + sMajorFactionMgr->GrantRenownLevelRewards(_player, factionEntry->ID, uint32(oldRenownLevel), uint32(newRenownLevel)); } } } @@ -935,17 +935,16 @@ void ReputationMgr::LoadAccountWideFromDB(PreparedQueryResult result) if (shouldSync) { - // Set renown currency to account level + // Set renown currency to account level. The warband renown + // carry-over is intentionally not dispatched here: this runs + // during Player::LoadFromDB, before inventory exists, so item + // rewards would be lost. Player::UpdateAllRenownRewards() + // replays the full span once the character is in world, with + // the grant tables acting as the de-duplicator. if (accountRenownLevel != charRenownLevel) { if (CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(factionEntry->RenownCurrencyID)) _player->ModifyCurrency(currency->ID, accountRenownLevel - charRenownLevel, CurrencyGainSource::RenownRepGain, CurrencyDestroyReason::Cheat); - - // Phase 10C: dispatch character-bound rewards for the inherited renown - // span. accountSync=true skips account-wide rewards which were already - // granted on the original toon and live in warband_renown_rewards_granted. - if (sMajorFactionMgr->IsMajorFaction(factionEntry)) - sMajorFactionMgr->GrantRenownLevelRewards(_player, factionEntry->ID, uint32(charRenownLevel), uint32(accountRenownLevel), true); } state->Standing = accountStanding; diff --git a/src/server/game/Server/Packets/CovenantPackets.h b/src/server/game/Server/Packets/CovenantPackets.h index 707730ab..2950e603 100644 --- a/src/server/game/Server/Packets/CovenantPackets.h +++ b/src/server/game/Server/Packets/CovenantPackets.h @@ -57,7 +57,7 @@ namespace Covenant std::vector BountyIDs; }; - // CMSG_COVENANT_RENOWN_REQUEST_CATCHUP_STATE (0x3B0111). Empty payload; the client asks whether accelerated + // CMSG_COVENANT_RENOWN_REQUEST_CATCHUP_STATE (0x3E0113). Empty payload; the client asks whether accelerated // renown catch-up is currently active for the player. class CovenantRenownRequestCatchupState final : public ClientPacket { @@ -67,7 +67,7 @@ namespace Covenant void Read() override {} }; - // SMSG_COVENANT_RENOWN_SEND_CATCHUP_STATE (0x42030D). Wire (client reader, all_smsg_layouts): a single Bits<1>. + // SMSG_COVENANT_RENOWN_SEND_CATCHUP_STATE (0x45030F). Wire (client reader, all_smsg_layouts): a single Bits<1>. // Core does not implement accelerated renown catch-up, so the answer is false (no catch-up active). class CovenantRenownSendCatchupState final : public ServerPacket { diff --git a/src/server/game/Server/Packets/MajorFactionPackets.h b/src/server/game/Server/Packets/MajorFactionPackets.h index e9445fd6..08e58d9b 100644 --- a/src/server/game/Server/Packets/MajorFactionPackets.h +++ b/src/server/game/Server/Packets/MajorFactionPackets.h @@ -25,7 +25,18 @@ namespace WorldPackets { namespace MajorFactions { - // CMSG_COVENANT_RENOWN_REQUEST_CATCHUP_STATE (0x3B0111). + // DEPRECATED / UNVERIFIED WIRE FORMAT - DO NOT WIRE UP. + // + // This multi-entry catch-up reply is dead code. The live build answers + // CMSG_COVENANT_RENOWN_REQUEST_CATCHUP_STATE through + // WorldPackets::Covenant::CovenantRenownSendCatchupState, which is a + // single Bits<1> and is the only shape confirmed in-game. The layout + // below (length-prefixed array of faction/percent records) could not be + // verified and must not be sent. Kept only until the real multi-entry + // format is captured; remove together with MajorFactionPackets.cpp once + // CMake has been re-run (the source glob has no CONFIGURE_DEPENDS). + + // CMSG_COVENANT_RENOWN_REQUEST_CATCHUP_STATE (0x3E0113). // The client sends this when opening the Renown UI (covenant or major // faction). Empty payload - the server replies with the current // catchup state for every applicable faction. @@ -37,7 +48,7 @@ namespace WorldPackets void Read() override { } }; - // SMSG_COVENANT_RENOWN_SEND_CATCHUP_STATE (0x42030D). + // SMSG_COVENANT_RENOWN_SEND_CATCHUP_STATE (0x45030F). UNVERIFIED wire. // // Wire format derived from IDA decomp of ParseCovenantRenownCatchupState // (sub_7FF75C0EB140) at build 12.0.5.67186: diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 7eb49fc6..2246117b 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -826,11 +826,6 @@ namespace WorldPackets class FetchBleepProxies; } - namespace MajorFactions - { - class RequestCatchupState; - } - namespace PerksProgram { class RequestStoreFrontInfoUpdate; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f0db4e8d..0bb3563d 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1,7 +1,3 @@ -#include "HousingBlueprintMgr.h" -#include "HousingMgr.h" -#include "InitiativeManager.h" -#include "NeighborhoodMgr.h" /* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * @@ -72,6 +68,7 @@ #include "LootItemStorage.h" #include "LootMgr.h" #include "M2Stores.h" +#include "MajorFactionMgr.h" #include "MMapManager.h" #include "Map.h" #include "MapManager.h" @@ -139,6 +136,10 @@ #include "AbyssAnglersMgr.h" #include "TurbulentTimewaysMgr.h" #include "DelvesRewards.h" +#include "HousingBlueprintMgr.h" +#include "HousingMgr.h" +#include "InitiativeManager.h" +#include "NeighborhoodMgr.h" //WowCommunity #include @@ -1391,6 +1392,9 @@ bool World::SetInitialWorldSettings() sDB2Manager.LoadHotfixOptionalData(m_availableDbcLocaleMask); TC_LOG_INFO("server.loading", "Indexing loaded data stores..."); sDB2Manager.IndexLoadedStores(); + TC_LOG_INFO("server.loading", "Loading Major Faction data..."); + sMajorFactionMgr->Load(); + sMajorFactionMgr->LoadWorldData(); ///- Load M2 fly by cameras LoadM2Cameras(m_dataPath); ///- Load GameTables