23 Commits
Author SHA1 Message Date
luis 9efeff119f Omnium Folio 2026-11-15 09:59:41 -03:00
luis a39762d6d8 fix profession 2026-11-15 08:43:17 -03:00
luis 7a08902c4c db quest fix 2026-11-14 20:59:02 -03:00
luis 8ee93bc327 mem leaks fix 2026-11-14 20:58:22 -03:00
luis e9e3e04f3c voidform 2026-11-14 20:43:53 -03:00
luis 8b24fce631 Fix mem leaks 2026-11-14 20:10:57 -03:00
luis 35bc846508 Slice and Dice 2026-11-14 17:44:27 -03:00
luis c56fae705d Revert "client misc test"
This reverts commit c56d091862.
2026-11-14 17:44:12 -03:00
luis 0bd8bdb3f8 typo 2026-11-14 17:33:43 -03:00
Shauren fc930b0324 Core/Utils: Extend unique_trackable_ptr functionality with the equivalent of std::enable_shared_from_this (exposing only weak_from_this) and fixed unique_trackable_ptr for array types
Signed-off-by: luis <[email protected]>
2026-11-14 17:27:22 -03:00
Shauren bdec3c42f6 Core/Metric: Fix final metric batch not being sent on shutdown after 585e170ad626bccfba22fbb91b8073d5b7797626
Signed-off-by: luis <[email protected]>
2026-11-14 17:25:25 -03:00
luis f8c791f326 change values 2026-11-14 17:25:06 -03:00
luis c56d091862 client misc test 2026-11-14 17:23:47 -03:00
luis 64d61fe383 misc client Core/Auras: Implement SPELL_AURA_MOD_HEALING_PCT_DONE_PET, SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET and SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON 2026-11-14 17:23:25 -03:00
luis 41a24d808d Core/Reputation: Never put a friendship reputation at war 2026-11-14 12:49:32 -03:00
luis c9a4cabc48 Core/Reputation: Do not use the friendship level as a creature's reaction to a player 2026-11-14 12:45:33 -03:00
luis f5eb6115e4 quests 2026-11-13 07:03:09 -03:00
luis d67e819a3f fix PreloadHousingMaps 2026-11-13 06:42:53 -03:00
luis 7b578b5b26 ++ 2026-11-13 06:26:13 -03:00
luis fe3a8eb6ec remove bad opcode cause mem leak 2026-11-13 05:51:57 -03:00
luis 0fa0fa9723 missing data 2026-11-13 04:58:44 -03:00
luis 3fd39127e9 Core/Criteria: Complete game event criteria once their counter reaches the required amount 2026-11-13 02:19:41 -03:00
luis 91690e0f73 scenario commands 2026-11-13 02:10:01 -03:00
59 changed files with 3906 additions and 226 deletions
@@ -0,0 +1,11 @@
-- Account data caches no longer fit in BLOB.
-- The client uploads its edit mode layout through CMSG_UPDATE_ACCOUNT_DATA as type 13 (GLOBAL_EDIT_MODE_CACHE)
-- and type 14 (PER_CHARACTER_EDIT_MODE_CACHE), which decompress to more than 65535 bytes on a normal UI layout.
-- BLOB silently rejected those saves, so the layout was never persisted across logins.
-- Sized to match MAX_ACCOUNT_DATA_SIZE in WorldSession.h (0x20000 = 128 KB).
ALTER TABLE `account_data`
MODIFY `data` MEDIUMBLOB NOT NULL;
ALTER TABLE `character_account_data`
MODIFY `data` MEDIUMBLOB NOT NULL;
@@ -0,0 +1,4 @@
DELETE FROM `broadcast_text` WHERE `ID`=310214;
INSERT INTO `broadcast_text` (`Text`, `Text1`, `ID`, `LanguageID`, `ConditionID`, `EmotesID`, `Flags`, `ChatBubbleDurationMs`, `VoiceOverPriorityID`, `SoundKitID1`, `SoundKitID2`, `EmoteID1`, `EmoteID2`, `EmoteID3`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `VerifiedBuild`) VALUES
('', 'De fiends steal our people. Save who you can.', 310214, 0, 0, 1, 256, 0, 13, 0, 342058, 0, 0, 0, 0, 0, 0, 70783);
@@ -0,0 +1,49 @@
DELETE FROM `broadcast_text` WHERE `VerifiedBuild`>0 AND `ID` IN (310501, 311547, 311535, 311057, 311060, 311055, 311530, 311052, 311051, 312694, 311049, 311048, 311069, 311450, 314231);
INSERT INTO `broadcast_text` (`Text`, `Text1`, `ID`, `LanguageID`, `ConditionID`, `EmotesID`, `Flags`, `ChatBubbleDurationMs`, `VoiceOverPriorityID`, `SoundKitID1`, `SoundKitID2`, `EmoteID1`, `EmoteID2`, `EmoteID3`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `VerifiedBuild`) VALUES
('My patience is at its end. If the Amani cannot handle this threat, then the sin\'dorei will.', '', 310501, 0, 0, 0, 256, 0, 4, 355158, 0, 0, 0, 0, 0, 0, 0, 70783),
('This is no time for diplomacy. We must strike before the aqir attack again.', '', 311547, 0, 0, 0, 258, 0, 4, 355156, 0, 0, 0, 0, 0, 0, 0, 70783),
('We will do whatever we can to ensure the people of Silvermoon know peace.', '', 311535, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('We will finish what the Amani started!', '', 311057, 0, 0, 0, 256, 0, 4, 355151, 0, 0, 0, 0, 0, 0, 0, 70783),
('More... will come... Prepare... for Kith\'ix...', '', 311060, 0, 0, 0, 256, 0, 4, 355152, 0, 0, 0, 0, 0, 0, 0, 70783),
('You and the foolish Amani stand no chance against Kith\'ix!', '', 311055, 0, 0, 0, 256, 0, 4, 355150, 0, 0, 0, 0, 0, 0, 0, 70783),
('Push through the swarms! We have to reach Lor\'themar!', '', 311530, 0, 0, 0, 256, 0, 4, 355149, 0, 0, 0, 0, 0, 0, 0, 70783),
('Kith\'ix will fall to the might of Silvermoon!', '', 311052, 0, 0, 0, 256, 0, 4, 355148, 0, 0, 0, 0, 0, 0, 0, 70783),
('Kith\'ix awakens! All of the lands will tremble in his wake!', '', 311051, 0, 0, 0, 256, 0, 4, 355146, 0, 0, 0, 0, 0, 0, 0, 70783),
('Rescue any civilians you can and get to the front gates. I\'ll rally the city guard!', '', 312694, 0, 0, 396, 256, 0, 4, 355145, 0, 0, 0, 0, 0, 0, 0, 70783),
('Defenders of Silvermoon! Give these monsters no quarter!', '', 311049, 0, 0, 0, 256, 0, 4, 355144, 0, 0, 0, 0, 0, 0, 0, 70783),
('Kith\'ix rises from the serpent\'s grave! This land will tremble in his wake!', '', 311048, 0, 0, 0, 256, 0, 4, 355143, 0, 0, 0, 0, 0, 0, 0, 70783),
('Do you hear that? The aqir are in the city!', '', 311069, 0, 0, 0, 256, 0, 4, 355142, 0, 0, 0, 0, 0, 0, 0, 70783),
('The aqir travel in swarms. More must be nearby if this was found within the city.\n\nThey may even be right below our feet as we speak.', '', 311450, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('I\'m here to help with the investigation and ensure no one else gets too close to the corpse.', 'I\'m here to help with the investigation and ensure no one else gets too close to the corpse.', 314231, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783);
DELETE FROM `broadcast_text` WHERE `VerifiedBuild`>0 AND `ID` IN (310511, 310510, 310508, 310507, 310598, 311449, 314802, 314801, 310597, 311439, 314800, 310599, 310506, 311447, 310505, 310503, 310530, 310504, 315989, 318440, 315961);
INSERT INTO `broadcast_text` (`Text`, `Text1`, `ID`, `LanguageID`, `ConditionID`, `EmotesID`, `Flags`, `ChatBubbleDurationMs`, `VoiceOverPriorityID`, `SoundKitID1`, `SoundKitID2`, `EmoteID1`, `EmoteID2`, `EmoteID3`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `VerifiedBuild`) VALUES
('', 'The loa\'s eyes are upon you, elves. Do not make me regret this.', 310511, 0, 0, 0, 256, 0, 4, 0, 355180, 0, 0, 0, 0, 0, 0, 70783),
('', 'We\'ll attack by sea. A small force, not an entire army.', 310510, 0, 0, 0, 256, 0, 4, 0, 355179, 0, 0, 0, 0, 0, 0, 70783),
('Kith\'ix must die, and the Amani will not stand in our way.', '', 310508, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('', 'Dat is far enough, elf! Your army will not set foot in Zul\'Aman!', 310507, 0, 0, 0, 256, 0, 4, 0, 355170, 0, 0, 0, 0, 0, 0, 70783),
('', 'Lor\'themar still sees threats in every shadow. The Amani need not be his enemy any longer.', 310598, 0, 0, 0, 256, 0, 4, 0, 355163, 0, 0, 0, 0, 0, 0, 70783),
('', 'A great many dangers lay dormant within our world. I can only hope that we can weather this latest awakening.\n\n<Orweyna looks on, her expression grim.>', 311449, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('', 'Fall back! Secure the pass!', 314802, 0, 0, 0, 256, 0, 4, 0, 355166, 0, 0, 0, 0, 0, 0, 70783),
('', 'Retreat to the pass! The elves are advancing!', 314801, 0, 0, 0, 256, 0, 4, 0, 355167, 0, 0, 0, 0, 0, 0, 70783),
('Kith\'ix has to be dealt with. But if Lor\'themar isn\'t careful, he\'ll just be trading one crisis for another.', '', 310597, 0, 0, 0, 256, 0, 4, 355161, 0, 0, 0, 0, 0, 0, 0, 70783),
('We\'ve fought back the Legion and the Devouring Host. I thought I\'d be ready for anything at this point, but the aqir are something else entirely.', '', 311439, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('', 'More swarms from the south! Reinforce the lower stair!', 314800, 0, 0, 0, 256, 0, 4, 0, 355168, 0, 0, 0, 0, 0, 0, 70783),
('Lor\'themar is right. If we do not act now, then we place all of Quel\'Thalas at risk.', '', 310599, 0, 0, 0, 256, 0, 4, 355162, 0, 0, 0, 0, 0, 0, 0, 70783),
('What would you have me do? Kith\'ix must die, no matter the consequence.', '', 310506, 0, 0, 0, 256, 0, 4, 355165, 0, 0, 0, 0, 0, 0, 0, 70783),
('I\'m in no hurry to start another troll war. But the safety of Quel\'Thalas is paramount. If Lor\'themar says we march, then we march.', '', 311447, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('', 'Lor\'themar, this is an act of war! Zul\'jarra will not stand for this.', 310505, 0, 0, 0, 256, 0, 4, 0, 355164, 0, 0, 0, 0, 0, 0, 70783),
('', 'Aid the Amani before they\'re torn apart!', 310503, 0, 0, 603, 256, 0, 4, 0, 355160, 0, 0, 0, 0, 0, 0, 70783),
('', 'Kith\'ix presents a threat to us all, but the hostility between elves and trolls may undo us before we\'ve even begun to fight.\n\nI do not expect generations of hatred to heal overnight. My hands aren\'t clean in all of this either. But someone has to take the first step forward if we are all to survive.', 310530, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('Advance! Let nothing through!', '', 310504, 0, 0, 5, 256, 0, 4, 355159, 0, 0, 0, 0, 0, 0, 0, 70783),
('', 'I\'ve been studying the aqir for years! I never thought I\'d get a chance to witness an invasion myself.\n\nThis is a great opportunity to make new strides in our research on these strange beasts.', 315989, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('Indeed. The aqir offensive is happening in both Eversong Woods and Zul\'Aman.\n\nI have enlisted the aid of two local aqir researchers. Their enthusiasm is concerning, but they are experts in their studies.\n\nFend off the aqir wherever you see them. They seem to launch their attacks every hour, as if driven by some mindless purpose.\n\nSpeak with our researchers to see what they have available from the coffers to reward you for your efforts.', '', 318440, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783),
('The aqir threaten all of our lands.\n\nWe must push them back wherever we find them.', '', 315961, 0, 0, 0, 256, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 70783);
UPDATE `broadcast_text` SET `VerifiedBuild`=70783 WHERE `VerifiedBuild`>0 AND `ID` IN (314923, 315121, 314998, 318202, 314900, 314744, 310357, 310356, 314685, 314678, 294685, 294686, 294677, 294676, 294643, 302098, 303329, 302096, 303334, 303333, 294642, 294641, 294511, 297473, 289253, 289251, 289250, 284358, 289248, 289213, 289212, 300672, 289234, 289211, 300671, 291645, 291616, 291597, 291596, 291595, 291584, 290950, 300985, 300973, 300979, 301005, 291310, 301006, 291309, 290915, 291307, 290906, 291311, 290916, 289162, 289160, 289159, 289158, 289157, 289153, 289152, 315305, 313761);
UPDATE `broadcast_text` SET `Text1`='Enough with the suspense. How fares Magister Aradis?', `VerifiedBuild`=70783 WHERE `VerifiedBuild`>0 AND `ID`=288754;
UPDATE `broadcast_text` SET `Text`='Help Nema\'s crew open the sarcophagus.', `Text1`='Help Nema\'s crew open the sarcophagus.', `VerifiedBuild`=70783 WHERE `VerifiedBuild`>0 AND `ID`=317831;
UPDATE `broadcast_text` SET `Text1`='Nashabor. Settlement of Blades. It is a world of natural beauty. Crimson salt plains give way to cool, purple lakes. Our rivers are choked with huge, sturdy lily pads. The sight of a draenei napping upon one, drifting downstream is common in times of peace. Our young learn to fight early, far earlier than they did on Argus. Martial and arcane skill is essential to survive attacks from its great, intelligent beasts.\n\nWe have been through cycles of strife and renewal. We have made unlikely allies of Legion defectors who live among us in small number. And we have largely rejected the forces that began our great flight in the first place--be they fel, Void, or Light.\n\nOur sayaad are naturals at jed\'hin. They are a pleasure to spectate.', `VerifiedBuild`=70783 WHERE `VerifiedBuild`>0 AND `ID`=291782;
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -246,8 +246,7 @@ void Metric::ScheduleSend()
void Metric::Unload()
{
// Send what's queued only if IoContext is stopped (so only on shutdown)
if (_enabled && Trinity::Asio::get_io_context(*_batchTimer).stopped())
if (_enabled)
{
_enabled = false;
SendBatch();
+50 -3
View File
@@ -31,6 +31,9 @@ class unique_weak_ptr;
template <typename T>
class unique_strong_ref_ptr;
template <typename T>
class enable_unique_weak_from_this;
/**
* \brief Specialized variant of std::shared_ptr that enforces unique ownership and/or std::unique_ptr with std::weak_ptr capabilities
* Implementation has the same overhead as a std::shared_ptr, that is, a separate allocation for control block that holds use counters
@@ -40,8 +43,8 @@ template <typename T>
class unique_trackable_ptr
{
public:
using element_type = T;
using pointer = T*;
using element_type = std::remove_extent_t<T>;
using pointer = element_type*;
unique_trackable_ptr() : _ptr() { }
@@ -105,6 +108,11 @@ public:
return _ptr.get();
}
element_type& operator[](std::ptrdiff_t i) const requires (std::is_array_v<T>)
{
return get()[i];
}
explicit operator bool() const
{
return static_cast<bool>(_ptr);
@@ -148,7 +156,7 @@ private:
template <typename T0>
friend std::enable_if_t<std::is_bounded_array_v<T0>, unique_trackable_ptr<T0>> make_unique_trackable(std::remove_extent_t<T0> const& val);
std::shared_ptr<element_type> _ptr;
std::shared_ptr<T> _ptr;
};
/**
@@ -330,6 +338,43 @@ private:
std::shared_ptr<element_type> _ptr;
};
/**
* \brief Trinity::unique_trackable_ptr companion class, replicating what std::enable_shared_from_this is to std::shared_ptr
* \tparam T Type of held object
*/
template <typename T>
class enable_unique_weak_from_this
{
protected:
enable_unique_weak_from_this() noexcept = default;
enable_unique_weak_from_this(enable_unique_weak_from_this const&) noexcept : _ptr() { }
enable_unique_weak_from_this(enable_unique_weak_from_this&&) noexcept : _ptr() { }
enable_unique_weak_from_this& operator=(enable_unique_weak_from_this const&) noexcept { return *this; }
enable_unique_weak_from_this& operator=(enable_unique_weak_from_this&&) noexcept { return *this; }
~enable_unique_weak_from_this() = default;
public:
using enable_weak_type = enable_unique_weak_from_this;
unique_weak_ptr<T> weak_from_this() noexcept { return _ptr; }
unique_weak_ptr<T const> weak_from_this() const noexcept { return _ptr; }
private:
template <typename T0, typename... Args>
friend std::enable_if_t<!std::is_array_v<T0>, unique_trackable_ptr<T0>> make_unique_trackable(Args&&... args);
unique_weak_ptr<T> _ptr;
};
template <typename T>
concept has_unique_weak_from_this = requires { typename T::enable_weak_type; }
&& std::convertible_to<std::remove_cv_t<T>*, typename T::enable_weak_type*>;
// unique_trackable_ptr funcions
template <typename T1, typename T2>
@@ -361,6 +406,8 @@ std::enable_if_t<!std::is_array_v<T>, unique_trackable_ptr<T>> make_unique_track
{
unique_trackable_ptr<T> ptr;
ptr._ptr = std::make_shared<T>(std::forward<Args>(args)...);
if constexpr (has_unique_weak_from_this<T>)
ptr._ptr->T::enable_weak_type::_ptr = unique_weak_ptr<T>(ptr, ptr.get());
return ptr;
}
@@ -33,6 +33,7 @@
#include "Mail.h"
#include "MapUtils.h"
#include "ObjectMgr.h"
#include "OmniumFolioMgr.h"
#include "RBAC.h"
#include "ScriptMgr.h"
#include "StringConvert.h"
@@ -616,6 +617,12 @@ void PlayerAchievementMgr::CompletedAchievement(AchievementEntry const* achievem
sScriptMgr->OnAchievementCompleted(referencePlayer, achievement);
// Omnium Folio: mint the folio trait config as soon as the unlock
// achievement ("The Sunstrider Omnium") is earned so the rune UI opens
// without requiring a relog. EnsureFolioForPlayer is idempotent.
if (achievement->ID == OmniumFolioMgr::UNLOCK_ACHIEVEMENT_ID)
sOmniumFolioMgr->EnsureFolioForPlayer(_owner);
// reward items and titles if any
AchievementReward const* reward = sAchievementMgr->GetAchievementReward(achievement);
@@ -1340,6 +1340,8 @@ bool CriteriaHandler::IsCompletedCriteria(Criteria const* criteria, uint64 requi
case CriteriaType::ReachRenownLevel:
case CriteriaType::BankTabPurchased:
case CriteriaType::LearnTaxiNode:
case CriteriaType::PlayerTriggerGameEvent:
case CriteriaType::AnyoneTriggerGameEventScenario:
case CriteriaType::CompleteResearchProject:
case CriteriaType::CompleteAnyResearchProject:
case CriteriaType::FindResearchObject:
+61
View File
@@ -656,6 +656,44 @@ SpellCastResult Crafting::DoCraft(uint32 craftingDataId)
else if (progress > 1.0f)
progress = 1.0f;
// First craft bonus. Every recipe carries a hidden flag that the client uses to tell whether the
// item was already crafted: an older QuestV2 flag (no objectives, no reward, only the completed
// bit) or a PlayerDataFlagCharacter bit for the newer recipes. Nothing on the server ever set
// those flags, so a first craft stayed "not yet crafted" forever and the knowledge currency was
// never awarded. The flag is resolved before crafting so an unknown flag never awards twice.
bool isFirstCraft = false;
if (!_recraft)
{
if (_craftingData->FirstCraftFlagQuestID > 0)
{
uint32 firstCraftQuestId = uint32(_craftingData->FirstCraftFlagQuestID);
isFirstCraft = sDB2Manager.GetQuestUniqueBitFlag(firstCraftQuestId) != 0
&& !_player->IsQuestCompletedBitSet(firstCraftQuestId);
}
else if (_craftingData->FirstCraftPlayerDataFlagCharacterID > 0)
{
uint32 firstCraftFlagId = uint32(_craftingData->FirstCraftPlayerDataFlagCharacterID);
isFirstCraft = sPlayerDataFlagCharacterStore.LookupEntry(firstCraftFlagId) != nullptr
&& !_player->HasDataFlagCharacter(firstCraftFlagId);
}
}
uint32 firstCraftKnowledgeCurrency = 0;
if (isFirstCraft && skillAbility)
{
auto findKnowledgeCurrency = [&](uint32 skillLineId)
{
return visitSkillLineChain(skillLineId, [&](uint32 line)
{
firstCraftKnowledgeCurrency = sDB2Manager.GetProfessionKnowledgeCurrencyForSkillLine(line);
return firstCraftKnowledgeCurrency != 0;
});
};
if (!findKnowledgeCurrency(skillAbility->SkillLine))
findKnowledgeCurrency(skillAbility->SkillupSkillLineID);
}
WorldPackets::Crafting::CraftingData craftingData;
craftingData.CraftingQualityID = quality.CraftingQualityID;
craftingData.QualityProgress = progress;
@@ -678,8 +716,31 @@ SpellCastResult Crafting::DoCraft(uint32 craftingDataId)
craftingData.ConcentrationSpent = concentrationSpent;
craftingData.ApplyConcentration = concentrationApplied;
craftingData.ResourcesReturned = std::move(resourcesReturned);
craftingData.IsFirstCraft = isFirstCraft;
if (isFirstCraft)
craftingData.OperationID = _craftingData->ID;
_player->SendNewItem(createdItem, totalCount, true, true, false, 0, &craftingData);
// The knowledge gain is sent as a plain currency update, with the craft operation id attached so
// the client can link the "first craft" toast to the craft that produced it.
if (isFirstCraft)
{
_player->SetCurrentCraftOperationID(_craftingData->ID);
if (firstCraftKnowledgeCurrency)
_player->ModifyCurrency(firstCraftKnowledgeCurrency, 1, CurrencyGainSource::ProfessionInitialAward);
_player->SetCurrentCraftOperationID(Optional<uint32>());
// SetRewardedQuest persists the completed bit through character_queststatus_rewarded;
// a bare SetQuestCompletedBit would be lost on relog for QuestV2-only flag quests.
if (_craftingData->FirstCraftFlagQuestID > 0)
_player->SetRewardedQuest(uint32(_craftingData->FirstCraftFlagQuestID));
else if (_craftingData->FirstCraftPlayerDataFlagCharacterID > 0)
_player->SetDataFlagCharacter(uint32(_craftingData->FirstCraftPlayerDataFlagCharacterID), true);
}
_player->UpdateCraftSkill(_spell->GetSpellInfo());
return SpellCastResult::SPELL_CAST_OK;
}
@@ -418,6 +418,11 @@ bool CraftingOrderMgr::IsIgnoring(ObjectGuid owner, ObjectGuid other) const
return std::find(it->second.begin(), it->second.end(), other) != it->second.end();
}
void CraftingOrderMgr::ClearIgnoreList(ObjectGuid owner)
{
_ignoreLists.erase(owner);
}
bool CraftingOrderMgr::ReportPlayer(uint64 orderId, ObjectGuid reporter, ObjectGuid reported, int32 reportType,
int32 majorCategory, int32 minorCategoryFlags, std::string const& comment) const
{
@@ -118,6 +118,8 @@ public:
// needed (it is re-synced every session). Used to reject personal orders aimed at an ignored crafter.
void SetIgnoreList(ObjectGuid owner, std::vector<ObjectGuid> ignored);
bool IsIgnoring(ObjectGuid owner, ObjectGuid other) const;
// Drops the session-only ignore list of a player that is leaving the world.
void ClearIgnoreList(ObjectGuid owner);
// Records a player report filed against a participant of a crafting order (CMSG_CRAFTING_ORDER_REPORT_PLAYER).
// The report is persisted to `crafting_order_reports` (character DB) for GM review; there is no client response.
+1 -1
View File
@@ -9057,7 +9057,7 @@ struct CraftingDataLoadInfo
{.IsSigned = false, .Type = FT_FLOAT, .Name = "Field_10_0_0_45141_011" },
{.IsSigned = true, .Type = FT_INT, .Name = "FirstCraftFlagQuestID" },
{.IsSigned = true, .Type = FT_INT, .Name = "FirstCraftTreasureID" },
{.IsSigned = true, .Type = FT_INT, .Name = "Field_10_2_5_52432_014" },
{.IsSigned = true, .Type = FT_INT, .Name = "FirstCraftPlayerDataFlagCharacterID" },
{.IsSigned = true, .Type = FT_INT, .Name = "CraftedTreasureID" },
};
+32
View File
@@ -747,6 +747,7 @@ namespace
std::unordered_map<uint32, std::vector<ProfessionEffectValue>> _professionEffectsByTraitDefinition;
std::unordered_map<int32, ProfessionEffectValue> _professionEffectById;
std::unordered_map<uint32, uint32> _concentrationCurrencyBySkillLine;
std::unordered_map<uint32, uint32> _professionKnowledgeCurrencyBySkillLine;
std::unordered_map<uint32, std::pair<float, float>> _multicraftExtraPercentBySkillLine;
std::unordered_map<uint32, std::pair<float, float>> _resourcefulEffectBySkillLine;
@@ -2254,6 +2255,31 @@ void DB2Manager::IndexLoadedStores()
itemIds.push_back(row.ItemId);
}
//WowCommunity
// Profession knowledge is a currency, and the specialization trees are the only place where the
// client links a profession skill line to the currency that is spent in it. TraitCurrency rows of
// type CurrencyTypesBased point at the knowledge currency of that profession and expansion.
{
std::unordered_map<uint32 /*traitTreeId*/, uint32 /*currencyId*/> knowledgeCurrencyByTraitTree;
for (TraitTreeXTraitCurrencyEntry const* link : sTraitTreeXTraitCurrencyStore)
{
TraitCurrencyEntry const* traitCurrency = sTraitCurrencyStore.LookupEntry(uint32(link->TraitCurrencyID));
if (!traitCurrency || traitCurrency->GetType() != TraitCurrencyType::CurrencyTypesBased || traitCurrency->CurrencyTypesID <= 0)
continue;
knowledgeCurrencyByTraitTree[link->TraitTreeID] = uint32(traitCurrency->CurrencyTypesID);
}
for (SkillLineXTraitTreeEntry const* link : sSkillLineXTraitTreeStore)
{
auto itr = knowledgeCurrencyByTraitTree.find(link->TraitTreeID);
if (itr == knowledgeCurrencyByTraitTree.end())
continue;
_professionKnowledgeCurrencyBySkillLine[link->SkillLineID] = itr->second;
}
}
for (SoulbindConduitRankEntry const* soulbindConduitRank : sSoulbindConduitRankStore)
_soulbindConduitRanks[{ soulbindConduitRank->SoulbindConduitID, soulbindConduitRank->RankIndex }] = soulbindConduitRank;
@@ -4377,6 +4403,12 @@ uint32 DB2Manager::GetConcentrationCurrencyForSkillLine(uint32 skillLineId) cons
return itr != _concentrationCurrencyBySkillLine.end() ? itr->second : 0;
}
uint32 DB2Manager::GetProfessionKnowledgeCurrencyForSkillLine(uint32 skillLineId) const
{
auto itr = _professionKnowledgeCurrencyBySkillLine.find(skillLineId);
return itr != _professionKnowledgeCurrencyBySkillLine.end() ? itr->second : 0;
}
bool DB2Manager::GetMulticraftExtraQuantityRange(uint32 skillLineId, float& minPercent, float& maxPercent) const
{
auto itr = _multicraftExtraPercentBySkillLine.find(skillLineId);
+1
View File
@@ -760,6 +760,7 @@ public:
void AccumulateProfessionTraitEffects(int32 traitDefinitionId, int32 rank, ProfessionEffectTotals& totals) const;
void AccumulateProfessionEffect(int32 effectId, int32 stacks, ProfessionEffectTotals& totals) const;
uint32 GetConcentrationCurrencyForSkillLine(uint32 skillLineId) const;
uint32 GetProfessionKnowledgeCurrencyForSkillLine(uint32 skillLineId) const;
bool GetMulticraftExtraQuantityRange(uint32 skillLineId, float& minPercent, float& maxPercent) const;
bool GetResourcefulEffectRange(uint32 skillLineId, float& minPercent, float& maxPercent) const;
std::vector<RenownRewardsEntry const*> const* GetRenownRewards(int32 covenantId, int32 level) const;
+1 -1
View File
@@ -6456,7 +6456,7 @@ struct CraftingDataEntry
float Field_10_0_0_45141_011;
int32 FirstCraftFlagQuestID;
int32 FirstCraftTreasureID;
int32 Field_10_2_5_52432_014;
int32 FirstCraftPlayerDataFlagCharacterID;
int32 CraftedTreasureID;
};
+8 -1
View File
@@ -2181,7 +2181,14 @@ ReputationRank WorldObject::GetReactionTo(WorldObject const* target) const
{
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->Faction))
{
if (factionEntry->CanHaveReputation())
if (factionEntry->CanHaveReputation() && factionEntry->FriendshipRepID)
{
// friendship reputation: GetRank is the friendship level index, not a reaction (the first level would be
// REP_HATED), so only the at-war state is taken from it and the faction template decides the rest
if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
return REP_HOSTILE;
}
else if (factionEntry->CanHaveReputation())
{
// CvP case - check reputation, don't allow state higher than neutral when at war
ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
@@ -3844,6 +3844,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
// The house dies with the character on every removal path (final purge after the undelete
// window, account unlink); the delete request already handled it, this is idempotent.
sHousingMgr.DeleteHouseForOwner(playerguid);
sHousingMgr.RemoveIgnoredNeighborhoods(playerguid);
//WowCommunity
uint32 charDeleteMethod = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(playerguid);
@@ -15684,6 +15685,12 @@ void Player::RewardQuest(Quest const* quest, LootItemType rewardType, uint32 rew
SetQuestCompletedBit(quest_id, true);
// Omnium Folio: turning in "Seeking Knowledge" (96410) is the retail unlock
// moment for the rune UI -- the generic trait config (TraitSystem 48) is
// minted here so the client receives it in the same update burst.
if (quest_id == OmniumFolioMgr::UNLOCK_QUEST_ID)
sOmniumFolioMgr->EnsureFolioForPlayer(this);
//WowCommunity
// Phase 10F - if this quest is a Campaign.Completed marker, auto-grant the
@@ -20934,6 +20941,13 @@ void Player::_LoadQuestStatusRewarded(PreparedQueryResult result)
if (quest->CanIncreaseRewardedQuestCounters())
m_RewardedQuests.insert(quest_id);
}
else
{
// Quests without a quest_template row can still carry a QuestV2 UniqueBitFlag
// (e.g. profession first-craft flags). The bit only needs the flag, not a Quest
// object, and SetQuestCompletedBit no-ops when the id has no bit assigned.
SetQuestCompletedBit(quest_id, true);
}
} while (result->NextRow());
}
}
+13 -23
View File
@@ -7100,24 +7100,12 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
// Done total percent damage auras
float DoneTotalMod = 1.0f;
// Pet damage?
if (IsPet() || IsSummon() || IsGuardian())
{
if (IsSummon())
if (Unit* owner = GetOwner())
{
Unit::AuraEffectList const& modSummonDamageAuras = owner->GetAuraEffectsByType(SPELL_AURA_MOD_SUMMON_DAMAGE_PCT_DONE);
for (AuraEffect const* aurEff : modSummonDamageAuras)
AddPct(DoneTotalMod, aurEff->GetAmount());
}
}
else if (GetTypeId() == TYPEID_UNIT)
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->Classification);
DoneTotalMod *= owner->GetTotalAuraMultiplier(IsPet() ? SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET : SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON);
// Pet damage multiplier
DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_PET_DAMAGE_MULTI);
if (IsPet())
if (Unit* owner = GetOwner())
DoneTotalMod *= owner->GetTotalAuraMultiplier(SPELL_AURA_PET_DAMAGE_MULTI);
if (GetTypeId() == TYPEID_UNIT && !IsPet())
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->Classification);
// Versatility
if (Player* modOwner = GetSpellModOwner())
@@ -7702,6 +7690,10 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
else // SPELL_AURA_MOD_HEALING_DONE_PERCENT is included in m_activePlayerData->ModHealingDonePercent for players
DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
if (IsPet())
if (Unit* owner = GetOwner())
DoneTotalMod *= owner->GetTotalAuraMultiplier(SPELL_AURA_MOD_HEALING_PCT_DONE_PET);
// bonus against aurastate
DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, [victim](AuraEffect const* aurEff) -> bool
{
@@ -8297,12 +8289,6 @@ int32 Unit::MeleeDamageBonusDone(Unit* pVictim, int32 damage, WeaponAttackType a
// Done total percent damage auras
float DoneTotalMod = 1.0f;
// Pet damage multiplier
DoneTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_PET_DAMAGE_MULTI);
if (IsPet())
if (Unit* owner = GetOwner())
DoneTotalMod *= owner->GetTotalAuraMultiplier(SPELL_AURA_PET_DAMAGE_MULTI);
SpellSchoolMask schoolMask = spellProto ? spellProto->GetSchoolMask() : damageSchoolMask;
if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL))
@@ -8336,12 +8322,16 @@ int32 Unit::MeleeDamageBonusDone(Unit* pVictim, int32 damage, WeaponAttackType a
{
if (Unit* owner = GetOwner())
{
Unit::AuraEffectList const& modSummonDamageAuras = owner->GetAuraEffectsByType(SPELL_AURA_MOD_SUMMON_DAMAGE_PCT_DONE);
Unit::AuraEffectList const& modSummonDamageAuras = owner->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON);
for (AuraEffect const* aurEff : modSummonDamageAuras)
AddPct(DoneTotalMod, aurEff->GetAmount());
}
}
if (IsSummon())
if (Unit* owner = GetOwner())
DoneTotalMod *= owner->GetTotalAuraMultiplier(IsPet() ? SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET : SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON);
DoneTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, creatureTypeMask);
// bonus against aurastate
@@ -1463,8 +1463,14 @@ namespace
uint32 BattlemasterListID = 0;
uint16 Bracket = 0;
bool TournamentRules = false;
time_t CreatedTime = 0;
};
// The client's war-game prompt times out on its own, so a challenge that was
// ignored (or whose opponent logged off) will never be answered. Expire it
// instead of keeping one entry per opponent leader for the whole uptime.
constexpr uint32 WAR_GAME_REQUEST_TIMEOUT = 2 * MINUTE;
std::unordered_map<ObjectGuid /*opponentLeader*/, WargamePendingRequest> g_wargameRequests;
}
@@ -1472,6 +1478,16 @@ void WorldSession::HandleStartWarGame(WorldPackets::Battleground::StartWarGame&
{
Player* initiator = _player;
// Drop challenges nobody answered; the prompt is long gone by now.
time_t const now = GameTime::GetGameTime();
for (auto itr = g_wargameRequests.begin(); itr != g_wargameRequests.end();)
{
if (now >= time_t(itr->second.CreatedTime) + WAR_GAME_REQUEST_TIMEOUT)
itr = g_wargameRequests.erase(itr);
else
++itr;
}
// Only a party leader may issue a war-game challenge on behalf of their group.
Group* group = initiator->GetGroup();
if (!group || group->GetLeaderGUID() != initiator->GetGUID())
@@ -1501,6 +1517,7 @@ void WorldSession::HandleStartWarGame(WorldPackets::Battleground::StartWarGame&
req.BattlemasterListID = packet.BattlemasterListID;
req.Bracket = packet.Bracket;
req.TournamentRules = packet.TournamentRules;
req.CreatedTime = now;
// Prompt the opposing leader to accept or decline.
WorldPackets::Battleground::CheckWargameEntry check;
-106
View File
@@ -940,112 +940,6 @@ void WorldSession::HandleSpawnTrackingUpdate(WorldPackets::Quest::SpawnTrackingU
SendPacket(response.Write());
}
void WorldSession::HandleQueryQuestItemUsability(WorldPackets::Quest::QueryQuestItemUsability& packet)
{
if (!_player)
return;
Creature* creature = ObjectAccessor::GetCreature(*_player, packet.CreatureGUID);
if (!creature)
return;
uint32 creatureEntry = creature->GetEntry();
WorldPackets::Quest::QuestItemUsabilityResponse response;
response.CreatureGUID = packet.CreatureGUID;
for (ObjectGuid const& itemGuid : packet.ItemGUIDs)
{
Item const* item = _player->GetItemByGuid(itemGuid);
if (!item)
{
response.ItemsData.emplace_back(itemGuid, false);
continue;
}
ItemTemplate const* itemTemplate = item->GetTemplate();
if (!itemTemplate)
{
response.ItemsData.emplace_back(itemGuid, false);
continue;
}
bool isUsable = false;
auto bounds = sObjectMgr->GetSpellClickInfoMapBounds(creatureEntry);
for (auto const& [npcEntry, spellClickInfo] : bounds)
{
uint32 spellClickSpellId = spellClickInfo.spellId;
for (auto const* effect : itemTemplate->Effects)
{
if (!effect || effect->SpellID == 0)
continue;
if (uint32(effect->SpellID) == spellClickSpellId)
{
isUsable = true;
break;
}
}
if (isUsable)
break;
}
if (!isUsable)
{
uint32 itemId = item->GetEntry();
for (auto const& [questId, statusData] : _player->m_QuestStatus)
{
if (statusData.Status != QUEST_STATUS_INCOMPLETE)
continue;
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest)
continue;
if (quest->GetSrcItemId() != itemId)
continue;
for (QuestObjective const& obj : quest->GetObjectives())
{
if (obj.Type == QUEST_OBJECTIVE_MONSTER)
{
uint32 objectiveCreature = uint32(std::abs(obj.ObjectID));
if (objectiveCreature == creatureEntry)
{
isUsable = true;
break;
}
// Else quest have trigger or script, check linking killcredit
CreatureTemplate const* cTemplate = creature->GetCreatureTemplate();
if (cTemplate)
{
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
{
if (cTemplate->KillCredit[i] == objectiveCreature && cTemplate->KillCredit[i] != 0)
{
isUsable = true;
break;
}
}
}
if (isUsable)
break;
}
}
if (isUsable)
break;
}
}
response.ItemsData.emplace_back(itemGuid, isUsable);
}
SendPacket(response.Write());
}
void WorldSession::HandleCloseQuestChoice(WorldPackets::Quest::CloseQuestChoice& /*closeQuestChoice*/)
{
// Client notification that player closed quest choice UI - no server action needed
+11
View File
@@ -18,6 +18,7 @@
#include "WorldSession.h"
#include "Battleground.h"
#include "DB2Stores.h"
#include "OmniumFolioMgr.h"
#include "Player.h"
#include "SpellHistory.h"
#include "TraitMgr.h"
@@ -141,7 +142,17 @@ void WorldSession::HandleTraitsCommitConfig(WorldPackets::Traits::TraitsCommitCo
else if (UF::TraitConfig const* savedConfig = _player->GetTraitConfig(traitsCommitConfig.SavedLocalIdentifier))
newConfigState.LocalIdentifier = savedConfig->LocalIdentifier;
bool const isFolioRuneCommit = newConfigState.Type == TraitConfigType::Generic
&& sOmniumFolioMgr->IsFolioTraitSystem(newConfigState.TraitSystemID)
&& std::ranges::any_of(newConfigState.Entries, [](WorldPackets::Traits::TraitEntry const& entry) { return entry.Rank > 0; });
_player->UpdateTraitConfig(std::move(newConfigState), traitsCommitConfig.SavedConfigID, needsCastTime);
// Omnium Folio quest (96410 "Seeking Knowledge"): the "empower your first
// rune" objective is a kill-credit NPC granted when the player ranks a
// node in the folio's generic trait config.
if (isFolioRuneCommit)
_player->KilledMonsterCredit(265203 /* [DNT] Kill Credit: Empower your First Rune */);
}
void WorldSession::HandleClassTalentsRequestNewConfig(WorldPackets::Traits::ClassTalentsRequestNewConfig& classTalentsRequestNewConfig)
+11
View File
@@ -677,6 +677,12 @@ Optional<HousingMgr::PendingPlotTeleport> HousingMgr::TakePendingPlotTeleport(Ob
return pending;
}
void HousingMgr::RemovePendingPlotTeleport(ObjectGuid playerGuid)
{
std::lock_guard<std::mutex> lock(_pendingPlotTeleportsLock);
_pendingPlotTeleports.erase(playerGuid);
}
Position HousingMgr::GetDefaultHousePosition(NeighborhoodPlotData const& plot) const
{
// A never-moved house root sits at local (0,0,0) under the plot room (the GO row turned half a revolution).
@@ -1716,6 +1722,11 @@ void HousingMgr::AddIgnoredNeighborhood(ObjectGuid playerGuid, ObjectGuid neighb
CharacterDatabase.Execute(stmt);
}
void HousingMgr::RemoveIgnoredNeighborhoods(ObjectGuid playerGuid)
{
_ignoredNeighborhoods.erase(playerGuid);
}
void HousingMgr::RemoveIgnoredNeighborhood(ObjectGuid playerGuid, ObjectGuid neighborhoodGuid)
{
std::unordered_set<ObjectGuid>& set = EnsureIgnoredNeighborhoodsLoaded(playerGuid);
+4
View File
@@ -275,6 +275,8 @@ public:
};
void SetPendingPlotTeleport(ObjectGuid playerGuid, WorldLocation const& dest, uint32 neighborhoodId);
Optional<PendingPlotTeleport> TakePendingPlotTeleport(ObjectGuid playerGuid);
// Drops a teleport that was never consumed (the caster left the world first).
void RemovePendingPlotTeleport(ObjectGuid playerGuid);
// Find a plot by its cornerstone GO entry within a specific neighborhood map
NeighborhoodPlotData const* GetPlotByCornerstoneEntry(uint32 neighborhoodMapId, uint32 cornerstoneGoEntry) const;
@@ -380,6 +382,8 @@ public:
bool IsNeighborhoodIgnored(ObjectGuid playerGuid, ObjectGuid neighborhoodGuid);
void AddIgnoredNeighborhood(ObjectGuid playerGuid, ObjectGuid neighborhoodGuid);
void RemoveIgnoredNeighborhood(ObjectGuid playerGuid, ObjectGuid neighborhoodGuid);
// Drops the cached list of a player that is leaving the world (reloaded from DB on next use).
void RemoveIgnoredNeighborhoods(ObjectGuid playerGuid);
private:
std::mutex _pendingPlotTeleportsLock;
+9 -4
View File
@@ -674,12 +674,17 @@ void MapManager::PreloadHousingMaps()
sScriptMgr->OnCreateMap(map);
// Load every grid so all entities are fully spawned before any player connects.
map->LoadAllGrids();
// Loading every grid pre-spawns the whole neighborhood, but it sweeps all 64x64 cells
// of the map at boot and asks for mmap tiles that neighborhood maps never generate.
// Neighborhood grids load on demand like any other map; enable Housing.LoadAllGrids
// to restore the old eager behaviour.
if (sWorld->getBoolConfig(CONFIG_HOUSING_LOAD_ALL_GRIDS))
map->LoadAllGrids();
++count;
TC_LOG_INFO("housing", "MapManager::PreloadHousingMaps: Pre-loaded neighborhood '{}' (map={} instanceId={}) with all cells",
neighborhood->GetName(), mapId, instanceId);
TC_LOG_INFO("housing", "MapManager::PreloadHousingMaps: Pre-loaded neighborhood '{}' (map={} instanceId={}){}",
neighborhood->GetName(), mapId, instanceId,
sWorld->getBoolConfig(CONFIG_HOUSING_LOAD_ALL_GRIDS) ? " with all cells" : "");
}
TC_LOG_INFO("server.loading", ">> Pre-loaded {} housing neighborhood maps in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -187,10 +187,13 @@ void OmniumFolioMgr::EnsureFolioForPlayer(Player* player)
if (!player || !_enabled)
return;
// Eligibility gate. The unlock questline ("The Magisters' Call" -> "The Omnium
// Reawakens") that AWARDS achievement 62606 is CAPTURE-BLOCKED world content
// seeded later; keying on the confirmed achievement id keeps this code stable.
if (!player->HasAchieved(UNLOCK_ACHIEVEMENT_ID))
// Eligibility gate. Retail unlocks the folio UI on turn-in of quest 96410
// ("Seeking Knowledge"), which is itself gated behind achievement 62606
// ("The Sunstrider Omnium", earned from quest 96233 "The Omnium Reawakens").
// Accept either key: the achievement covers the login path for characters who
// finished the chain before this hook existed, the quest covers turn-in even
// if the achievement criteria never fired.
if (!player->HasAchieved(UNLOCK_ACHIEVEMENT_ID) && !player->IsQuestRewarded(UNLOCK_QUEST_ID))
return;
bool const hasConfig = HasFolioConfig(player);
@@ -76,6 +76,12 @@ public:
// it is CAPTURE-BLOCKED content seeded later; the achievement id is the stable key.
// No schedule column exists for it, so it stays a constant.
static constexpr uint32 UNLOCK_ACHIEVEMENT_ID = 62606;
// Quest 96410 "Seeking Knowledge Week 1 of 5: The Omnium Folio" is the turn-in
// that delivers the folio (retail: SMSG_UPDATE_OBJECT with the generic trait
// config arrives right after this quest's QUEST_UPDATE_COMPLETE). Accepted as an
// alternative eligibility key so characters whose achievement criteria did not
// fire still unlock, and as the live trigger hooked from Player::RewardQuest.
static constexpr uint32 UNLOCK_QUEST_ID = 96410;
// Loads the (optional) seasonal schedule for this fork. Realm-safe: absent
// table/row => system stays idle and definitions still ride TraitMgr.
@@ -102,6 +108,10 @@ public:
uint32 GetCurrentSeasonId() const { return _seasonId; }
bool IsEnabled() const { return _enabled; }
// True when the folio system is enabled and traitSystemId is the folio's
// (schedule-driven) system. Used to spot folio trait config commits.
bool IsFolioTraitSystem(int32 traitSystemId) const { return _enabled && traitSystemId == _traitSystemId; }
private:
OmniumFolioMgr() = default;
~OmniumFolioMgr() = default;
@@ -700,6 +700,11 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
if (atWar && faction->Flags.HasFlag(ReputationFlags::Peaceful) && GetRank(sFactionStore.AssertEntry(faction->ID)) > REP_HATED)
return;
// A friendship reputation's rank is its friendship level index (the first level is REP_HATED), not a reaction,
// so it never puts the player at war: otherwise every friendship faction starts at war and its NPCs turn hostile
if (atWar && sFactionStore.AssertEntry(faction->ID)->FriendshipRepID)
return;
// already set
if (faction->Flags.HasFlag(ReputationFlags::AtWar) == atWar)
return;
+5
View File
@@ -101,6 +101,11 @@ class TC_GAME_API Scenario : public CriteriaHandler
// CriteriaType::AnyoneTriggerGameEventScenario for an event not sent by a player (a participant is the reference)
void TriggerGameEvent(uint32 gameEventId, WorldObject const* source);
//WowCommunity
// Read-only view of one criteria's progress on this scenario (nullptr when it has none), for .scenario info
CriteriaProgress const* GetProgress(Criteria const* criteria) { return GetCriteriaProgress(criteria); }
//WowCommunity
protected:
Map const* _map;
GuidUnorderedSet _players;
@@ -88,6 +88,12 @@ namespace ScriptHelpers
{
return player && s_forceClearedPlayers.erase(player->GetGUID().GetCounter()) > 0;
}
void EraseFakePartyCleared(Player* player)
{
if (player)
s_forceClearedPlayers.erase(player->GetGUID().GetCounter());
}
//WowCommunity
void SendClearFakeParty(Player* player)
@@ -68,6 +68,10 @@ namespace ScriptHelpers
// when the bot composition hash is unchanged.
TC_GAME_API bool ConsumeFakePartyCleared(Player* player);
// Same bookkeeping, without reporting a hit: used when a player leaves the
// world, so a clear nobody consumed does not survive the session.
TC_GAME_API void EraseFakePartyCleared(Player* player);
// Wrapper function to send a party member full state packet for a bot to a player
// This constructs the packet internally in the core to avoid linking issues with dynamic loading
// Takes raw bot data instead of PartyMemberStats to avoid needing PartyPackets.h in scripts
@@ -951,33 +951,6 @@ namespace WorldPackets::Quest
return &_worldPacket;
}
void QueryQuestItemUsability::Read()
{
_worldPacket >> CreatureGUID;
uint32 count;
_worldPacket >> count;
ItemGUIDs.resize(count);
for (uint32 i = 0; i < count; ++i)
_worldPacket >> ItemGUIDs[i];
}
WorldPacket const* QuestItemUsabilityResponse::Write()
{
_worldPacket << CreatureGUID;
_worldPacket << Size<uint32>(ItemsData);
_worldPacket << Size<uint32>(ItemsData);
for (auto const& pair : ItemsData)
_worldPacket << pair.first;
for (auto const& pair : ItemsData)
_worldPacket.WriteBit(pair.second);
_worldPacket.FlushBits();
return &_worldPacket;
}
WorldPacket const* DisplayQuestPopup::Write()
{
_worldPacket << int32(QuestID);
@@ -894,28 +894,6 @@ namespace WorldPackets
// Quest Enhancement Packets
// ============================================================
class QueryQuestItemUsability final : public ClientPacket
{
public:
explicit QueryQuestItemUsability(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_QUEST_ITEM_USABILITY, std::move(packet)) {}
void Read() override;
ObjectGuid CreatureGUID;
std::vector<ObjectGuid> ItemGUIDs;
};
class QuestItemUsabilityResponse final : public ServerPacket
{
public:
explicit QuestItemUsabilityResponse() : ServerPacket(SMSG_QUEST_ITEM_USABILITY_RESPONSE, 24) {}
WorldPacket const* Write() override;
ObjectGuid CreatureGUID;
std::vector<std::pair<ObjectGuid, bool>> ItemsData;
};
class CloseQuestChoice final : public ClientPacket
{
public:
+2 -2
View File
@@ -903,7 +903,7 @@ void OpcodeTable::InitializeClientOpcodes()
DEFINE_HANDLER(CMSG_QUERY_PLAYER_NAME_BY_COMMUNITY_ID, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_QUERY_QUEST_COMPLETION_NPCS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQueryQuestCompletionNPCs);
DEFINE_HANDLER(CMSG_QUERY_QUEST_INFO, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQuestQueryOpcode);
DEFINE_HANDLER(CMSG_QUERY_QUEST_ITEM_USABILITY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleQueryQuestItemUsability);
DEFINE_HANDLER(CMSG_QUERY_QUEST_ITEM_USABILITY, STATUS_IGNORED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_QUERY_REALM_NAME, STATUS_AUTHED, PROCESS_INPLACE, &WorldSession::HandleQueryRealmName);
DEFINE_HANDLER(CMSG_QUERY_SCENARIO_POI, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleQueryScenarioPOI);
DEFINE_HANDLER(CMSG_QUERY_SELECTED_WOW_LABS_AREA, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
@@ -2274,7 +2274,7 @@ void OpcodeTable::InitializeServerOpcodes()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_REQUEST_ITEMS, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_STATUS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_STATUS_MULTIPLE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_ITEM_USABILITY_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_ITEM_USABILITY_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_LOG_FULL, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_NON_LOG_UPDATE_COMPLETE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_POI_QUERY_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
+14
View File
@@ -31,12 +31,14 @@
#include "ChatPackets.h"
#include "ClientConfigPackets.h"
#include "Containers.h"
#include "CraftingOrderMgr.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "GameTime.h"
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "HousingMgr.h"
#include "Hyperlinks.h"
#include "IpAddress.h"
#include "Log.h"
@@ -52,8 +54,10 @@
#include "Random.h"
#include "RBAC.h"
#include "RealmList.h"
#include "ScriptHelpers.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
#include "WeeklyRewardsMgr.h"
#include "World.h"
#include "WorldSocket.h"
#include <boost/circular_buffer.hpp>
@@ -579,6 +583,16 @@ void WorldSession::LogoutPlayer(bool save)
sLFGListMgr.RemoveListingsBy(_player->GetGUID());
sLFGListMgr.RemoveApplicationsBy(_player->GetGUID());
sLFGListMgr.UnregisterSearch(_player->GetGUID());
// The house finder ignore list is DB backed, drop the cached copy with the session.
sHousingMgr.RemoveIgnoredNeighborhoods(_player->GetGUID());
// A pending housing teleport that was never taken dies with the session.
sHousingMgr.RemovePendingPlotTeleport(_player->GetGUID());
// Crafting-order ignore lists are session-only; drop them with the session.
sCraftingOrderMgr.ClearIgnoreList(_player->GetGUID());
// Bot-roster clears nobody consumed must not outlive the session.
ScriptHelpers::EraseFakePartyCleared(_player);
// The Great Vault cache is written through on every change, so drop it here.
sWeeklyRewardsMgr.UnloadCharacter(_player->GetGUID());
//WowCommunity
if (!_player->GetLootGUID().IsEmpty())
DoLootReleaseAll();
-2
View File
@@ -1060,7 +1060,6 @@ namespace WorldPackets
namespace Quest
{
class QuestConfirmAccept;
class QueryQuestItemUsability;
class CloseQuestChoice;
class QuestGiverStatusQuery;
class QuestGiverStatusMultipleQuery;
@@ -2298,7 +2297,6 @@ public:
void HandleRafClaimNextReward(WorldPackets::RaF::RafClaimNextReward& packet);
void HandleQueryTreasurePicker(WorldPackets::Query::QueryTreasurePicker const& queryTreasurePicker);
void HandleSpawnTrackingUpdate(WorldPackets::Quest::SpawnTrackingUpdate& spawnTrackingUpdate);
void HandleQueryQuestItemUsability(WorldPackets::Quest::QueryQuestItemUsability& queryQuestItemUsability);
void HandleCloseQuestChoice(WorldPackets::Quest::CloseQuestChoice& packet);
void HandleRequestScheduledAreaPoiUpdate(WorldPackets::Quest::RequestScheduledAreaPoiUpdate& packet);
void HandleHideQuestChoice(WorldPackets::Quest::HideQuestChoice& hideQuestChoice);
@@ -241,7 +241,7 @@ enum AuraType : uint32
SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
SPELL_AURA_MOD_HEALING_PCT_DONE_PET = 157, // Mod Healing Pct Done (Pet)
SPELL_AURA_ALLOW_TALENT_SWAPPING = 158,
SPELL_AURA_NO_PVP_CREDIT = 159,
SPELL_AURA_160 = 160, // old SPELL_AURA_MOD_AOE_AVOIDANCE. Unused 4.3.4
@@ -513,7 +513,7 @@ enum AuraType : uint32
SPELL_AURA_426 = 426,
SPELL_AURA_SCALE_PLAYER_LEVEL = 427, // NYI
SPELL_AURA_LINKED_SUMMON = 428,
SPELL_AURA_MOD_SUMMON_DAMAGE_PCT_DONE = 429,
SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET = 429, // Only affects pets
SPELL_AURA_PLAY_SCENE = 430,
SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE = 431,
SPELL_AURA_432 = 432,
@@ -615,7 +615,7 @@ enum AuraType : uint32
SPELL_AURA_ALLOW_BLOCKING_SPELLS = 528, // NYI
SPELL_AURA_MOD_SPELL_BLOCK_CHANCE = 529, // NYI
SPELL_AURA_530 = 530,
SPELL_AURA_531 = 531,
SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON = 531, // Affects all summons except pets
SPELL_AURA_532 = 532,
SPELL_AURA_DISABLE_NAVIGATION = 533, // disables map pins
SPELL_AURA_534 = 534,
@@ -498,7 +498,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //426
&AuraEffect::HandleNULL, //427 SPELL_AURA_SCALE_PLAYER_LEVEL
&AuraEffect::HandleLinkedSummon, //428 SPELL_AURA_LINKED_SUMMON
&AuraEffect::HandleNoImmediateEffect, //429 SPELL_AURA_MOD_SUMMON_DAMAGE_PCT_DONE Implemented in Unit::MeleeDamageBonusDone and Unit::SpellDamagePctDone
&AuraEffect::HandleNoImmediateEffect, //429 SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET implemented in Unit::MeleeDamageBonusDone and Unit::SpellDamagePctDone
&AuraEffect::HandlePlayScene, //430 SPELL_AURA_PLAY_SCENE
&AuraEffect::HandleModOverrideZonePVPType, //431 SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE
&AuraEffect::HandleNULL, //432
@@ -600,7 +600,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //528 SPELL_AURA_ALLOW_BLOCKING_SPELLS
&AuraEffect::HandleNULL, //529 SPELL_AURA_MOD_SPELL_BLOCK_CHANCE
&AuraEffect::HandleNULL, //530
&AuraEffect::HandleNULL, //531
&AuraEffect::HandleNoImmediateEffect, //531 SPELL_AURA_MOD_DAMAGE_PCT_DONE_SUMMON implemented in Unit::MeleeDamageBonusDone and Unit::SpellDamagePctDone
&AuraEffect::HandleNULL, //532
&AuraEffect::HandleNULL, //533 SPELL_AURA_DISABLE_NAVIGATION
&AuraEffect::HandleNULL, //534
@@ -246,6 +246,11 @@ void WeeklyRewardsMgr::SaveVault(ObjectGuid guid)
CharacterDatabase.CommitTransaction(trans);
}
void WeeklyRewardsMgr::UnloadCharacter(ObjectGuid guid)
{
_vaults.erase(guid);
}
void WeeklyRewardsMgr::RecordActivity(Player* player, WeeklyRewards::ActivityType type, uint32 level)
{
if (!player || type >= WeeklyRewards::ActivityType::Max)
@@ -128,6 +128,8 @@ public:
void LoadCharacter(ObjectGuid guid); // lazy load on demand
void SaveVault(ObjectGuid guid);
// Drop the cached vault of a character that is leaving the world (it is saved on every mutation).
void UnloadCharacter(ObjectGuid guid);
// --- Great Vault slots ---
+1
View File
@@ -745,6 +745,7 @@ void World::LoadConfigSettings(bool reload)
{ .Name = "Housing.EnableCreateCharterNeighborhood"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_ENABLE_CREATE_CHARTER_NEIGHBORHOOD },
{ .Name = "Housing.EnableCreateGuildNeighborhood"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_ENABLE_CREATE_GUILD_NEIGHBORHOOD },
{ .Name = "Housing.TutorialsEnabled"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_TUTORIALS_ENABLED },
{ .Name = "Housing.LoadAllGrids"sv, .DefaultValue = false, .Index = CONFIG_HOUSING_LOAD_ALL_GRIDS },
} };
static constexpr ConfigOptionLoadDefinitionArray<uint32, INT_CONFIG_VALUE_COUNT> ints =
+1
View File
@@ -213,6 +213,7 @@ enum WorldBoolConfigs : uint32
CONFIG_HOUSING_ENABLE_CREATE_CHARTER_NEIGHBORHOOD,
CONFIG_HOUSING_ENABLE_CREATE_GUILD_NEIGHBORHOOD,
CONFIG_HOUSING_TUTORIALS_ENABLED,
CONFIG_HOUSING_LOAD_ALL_GRIDS,
BOOL_CONFIG_VALUE_COUNT
};
@@ -174,7 +174,9 @@ public:
void OnLogout(Player* player) override
{
_messengers.erase(player->GetGUID()); // the personal summon despawns with the player / on its own timer
// the personal summon despawns with the player / on its own timer
std::lock_guard<std::mutex> guard(_messengersLock);
_messengers.erase(player->GetGUID());
}
private:
+127
View File
@@ -0,0 +1,127 @@
/*
* 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/>.
*/
/* ScriptData
Name: scenario_commandscript
%Complete: 100
Comment: scenario debugging commands (patterns/SCENARIO_FOUNDATION.md)
Category: commandscripts
EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "ChatCommand.h"
#include "CriteriaHandler.h"
#include "DB2Stores.h"
#include "GameEventSender.h"
#include "Map.h"
#include "Player.h"
#include "RBAC.h"
#include "Scenario.h"
#include "StringFormat.h"
#include "WorldSession.h"
using namespace Trinity::ChatCommands;
class scenario_commandscript : public CommandScript
{
public:
scenario_commandscript() : CommandScript("scenario_commandscript") { }
std::span<ChatCommandBuilder const> GetCommands() const override
{
static ChatCommandTable scenarioCommandTable =
{
{ "info", HandleScenarioInfoCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "event", HandleScenarioEventCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
{ "internal", HandleScenarioInternalCommand, rbac::RBAC_PERM_COMMAND_DEBUG, Console::No },
};
static ChatCommandTable commandTable =
{
{ "scenario", scenarioCommandTable },
};
return commandTable;
}
// .scenario info - scenario of the map you are on, its current step and the progress of that step's criteria
// (SendSysMessage + StringFormat: PSendSysMessage is printf-style and printed these {} literally)
static bool HandleScenarioInfoCommand(ChatHandler* handler)
{
Player* player = handler->GetSession()->GetPlayer();
Scenario* scenario = player->GetScenario();
if (!scenario)
{
handler->SendSysMessage(Trinity::StringFormat("No scenario on this map (map {}, difficulty {}).", player->GetMapId(), uint32(player->GetMap()->GetDifficultyID())));
return true;
}
handler->SendSysMessage(Trinity::StringFormat("Scenario {} '{}' complete: {}", scenario->GetEntry()->ID, scenario->GetEntry()->Name[handler->GetSessionDbcLocale()], scenario->IsComplete() ? "yes" : "no"));
ScenarioStepEntry const* step = scenario->GetStep();
if (!step)
{
handler->SendSysMessage("No current step.");
return true;
}
handler->SendSysMessage(Trinity::StringFormat("Current step {} (order {}) '{}', criteria tree {}, step state {}, tree complete: {}", step->ID, uint32(step->OrderIndex),
step->Title[handler->GetSessionDbcLocale()], step->Criteriatreeid, uint32(scenario->GetStepState(step)), scenario->IsCompletedStep(step) ? "yes" : "no"));
CriteriaTree const* tree = sCriteriaMgr->GetCriteriaTree(step->Criteriatreeid);
if (!tree)
{
handler->SendSysMessage(Trinity::StringFormat("Criteria tree {} is not loaded.", step->Criteriatreeid));
return true;
}
CriteriaMgr::WalkCriteriaTree(tree, [&](CriteriaTree const* node)
{
if (!node->Criteria)
return;
CriteriaProgress const* progress = scenario->GetProgress(node->Criteria);
handler->SendSysMessage(Trinity::StringFormat(" tree {} criteria {} {} ({}) asset {}: {} / {}", node->ID, node->Criteria->ID,
CriteriaMgr::GetCriteriaTypeString(node->Criteria->Entry->Type), uint32(node->Criteria->Entry->Type), node->Criteria->Entry->Asset.ID,
progress ? progress->Counter : 0, node->Entry->Amount));
});
return true;
}
// .scenario event <gameEventId> - fire a game event with you as source (same path as the scenario_event_trigger emitters)
static bool HandleScenarioEventCommand(ChatHandler* handler, uint32 gameEventId)
{
Player* player = handler->GetSession()->GetPlayer();
GameEvents::Trigger(gameEventId, player, nullptr);
handler->SendSysMessage(Trinity::StringFormat("Triggered game event {}.", gameEventId));
return true;
}
// .scenario internal <criteriaId> [count] - feed CompleteInternalCriteria (asset = criteria id) count times
static bool HandleScenarioInternalCommand(ChatHandler* handler, uint32 criteriaId, Optional<uint32> count)
{
Player* player = handler->GetSession()->GetPlayer();
uint32 n = count.value_or(1);
for (uint32 i = 0; i < n; ++i)
player->UpdateCriteria(CriteriaType::CompleteInternalCriteria, criteriaId);
handler->SendSysMessage(Trinity::StringFormat("Fed internal criteria {} x{}.", criteriaId, n));
return true;
}
};
void AddSC_scenario_commandscript()
{
new scenario_commandscript();
}
@@ -67,6 +67,7 @@ void AddSC_mythic_plus_commandscript();
void AddSC_shop_commandscript();
void AddSC_smallactivities_commandscript();
void AddSC_prey_commandscript();
void AddSC_scenario_commandscript();
// The name of this function should match:
// void Add${NameOfDirectory}Scripts()
@@ -123,5 +124,6 @@ void AddCommandsScripts()
AddSC_shop_commandscript();
AddSC_smallactivities_commandscript();
AddSC_prey_commandscript();
AddSC_scenario_commandscript();
}
@@ -26,6 +26,7 @@ FSB_BaseAI::~FSB_BaseAI()
{
FSBChatMgr::Get()->LeaveBotChannels(me);
FSBChatMgr::Get()->UnregisterActiveBot(me);
GenAINpcMemoryMgr::Get()->Erase(me->GetGUID());
delete botDungeonData;
delete botBattlegroundData;
}
@@ -72,6 +72,13 @@ void GenAINpcMemoryMgr::ClearMemory(ObjectGuid npcGuid)
it->second.clear();
}
void GenAINpcMemoryMgr::Erase(ObjectGuid npcGuid)
{
std::unique_lock<std::shared_mutex> lock(_mutex);
_memories.erase(npcGuid);
_questStates.erase(npcGuid);
}
void GenAINpcMemoryMgr::RemoveIfUnused(ObjectGuid npcGuid)
{
std::unique_lock<std::shared_mutex> lock(_mutex);
@@ -39,6 +39,7 @@ public:
void AddEntry(ObjectGuid npcGuid, uint32 channelId, std::string const& sender, std::string const& msg, bool isPlayer);
std::deque<BotChatMemoryEntry> GetMemory(ObjectGuid npcGuid) const;
void ClearMemory(ObjectGuid npcGuid);
void Erase(ObjectGuid npcGuid);
void RemoveIfUnused(ObjectGuid npcGuid);
uint8 GetQuestState(ObjectGuid npcGuid) const;
@@ -37,6 +37,7 @@
#include "Creature.h"
#include "Log.h"
#include "Map.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -534,11 +535,34 @@ namespace FSBBattleground
}
}
std::unordered_map<BattlegroundMap*, std::vector<ObjectGuid>> SpawnedBotGuids;
// Spawned bot guids are only needed while their battleground map lives, but
// nothing tells this module when the map goes away. Store the map identity
// with the list and drop entries whose map no longer exists whenever a bot
// is spawned, so the store cannot grow across battlegrounds (a recycled
// BattlegroundMap* must not inherit the previous instance's guids either).
struct SpawnedBotGuidsEntry
{
uint32 MapId = 0;
uint32 InstanceId = 0;
std::vector<ObjectGuid> Guids;
};
std::unordered_map<BattlegroundMap*, SpawnedBotGuidsEntry> SpawnedBotGuids;
void AddBotSpawnGuid(BattlegroundMap* battlegroundMap, ObjectGuid guid)
{
SpawnedBotGuids[battlegroundMap].push_back(guid);
for (auto itr = SpawnedBotGuids.begin(); itr != SpawnedBotGuids.end();)
{
if (sMapMgr->FindMap(itr->second.MapId, itr->second.InstanceId) != itr->first)
itr = SpawnedBotGuids.erase(itr);
else
++itr;
}
SpawnedBotGuidsEntry& entry = SpawnedBotGuids[battlegroundMap];
entry.MapId = battlegroundMap->GetId();
entry.InstanceId = battlegroundMap->GetInstanceId();
entry.Guids.push_back(guid);
}
void ClearSpawnedBotGuids(BattlegroundMap* battlegroundMap)
@@ -658,7 +682,7 @@ namespace FSBBattleground
{
static std::vector<ObjectGuid> const empty;
auto it = SpawnedBotGuids.find(battlegroundMap);
return it != SpawnedBotGuids.end() ? it->second : empty;
return it != SpawnedBotGuids.end() ? it->second.Guids : empty;
}
Unit* FindFriendlyAssistTarget(Creature* bot, float range)
@@ -94,8 +94,15 @@ void FSBChatMgr::UnregisterActiveBot(Creature* bot)
{
if (!bot)
return;
std::lock_guard<std::mutex> lock(_activeBotsMutex);
_activeBots.erase(bot->GetGUID());
{
std::lock_guard<std::mutex> lock(_activeBotsMutex);
_activeBots.erase(bot->GetGUID());
}
// The bot is gone, its reply cooldown has no owner left to throttle.
std::lock_guard<std::mutex> cooldownLock(_botReplyCooldownsMutex);
_botReplyCooldowns.erase(bot->GetGUID());
}
std::vector<Creature*> FSBChatMgr::GetActiveBots()
@@ -319,8 +326,14 @@ void FSBChatMgr::HandlePlayerGeneralChat(Player* player, Channel* channel, std::
if (FSBMgr::Get()->IsBotOwned(bot))
continue;
auto cdIt = _botReplyCooldowns.find(bot->GetGUID());
if (cdIt != _botReplyCooldowns.end() && now < cdIt->second + cooldownMs)
bool onCooldown = false;
{
std::lock_guard<std::mutex> lock(_botReplyCooldownsMutex);
auto cdIt = _botReplyCooldowns.find(bot->GetGUID());
onCooldown = cdIt != _botReplyCooldowns.end() && now < cdIt->second + cooldownMs;
}
if (onCooldown)
continue;
if (urand(0, 99) >= chance)
@@ -405,7 +418,10 @@ void FSBChatMgr::HandlePlayerGeneralChat(Player* player, Channel* channel, std::
_pendingReplies.push_back(state);
}
_botReplyCooldowns[bot->GetGUID()] = now;
{
std::lock_guard<std::mutex> lock(_botReplyCooldownsMutex);
_botReplyCooldowns[bot->GetGUID()] = now;
}
}
}
@@ -125,6 +125,7 @@ private:
std::unordered_map<ObjectGuid, Creature*> _activeBots;
mutable std::mutex _activeBotsMutex;
std::unordered_map<ObjectGuid, uint32> _botReplyCooldowns;
std::mutex _botReplyCooldownsMutex;
std::vector<std::shared_ptr<PendingBotReply>> _pendingReplies;
std::mutex _pendingRepliesMutex;
@@ -3072,7 +3072,7 @@ class spell_anduin_wrynn_force_of_will : public AuraScript
{
OnEffectApply += AuraEffectApplyFn(spell_anduin_wrynn_force_of_will::OnApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_anduin_wrynn_force_of_will::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_anduin_wrynn_force_of_will::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_SUMMON_DAMAGE_PCT_DONE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_anduin_wrynn_force_of_will::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PCT_DONE_PET);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_anduin_wrynn_force_of_will::RecalculateHookDamageTaken, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
}
};
+28
View File
@@ -2621,6 +2621,11 @@ struct FesteringStrikeBlight
return true;
}
static void Clear(ObjectGuid casterGuid)
{
Charges().erase(casterGuid);
}
private:
static std::unordered_map<ObjectGuid, uint32>& Charges()
{
@@ -2629,6 +2634,28 @@ private:
}
};
// The blight is only consumed by Scourge Strike, so a caster that logs out with
// charges left would otherwise keep its GUID in the map for the whole uptime.
class player_dk_festering_strike_cleanup : public PlayerScript
{
public:
player_dk_festering_strike_cleanup() : PlayerScript("player_dk_festering_strike_cleanup") { }
void OnLogout(Player* player) override
{
// Only a Death Knight can apply Festering Strike's blight.
if (player->GetClass() != CLASS_DEATH_KNIGHT)
return;
FesteringStrikeBlight::Clear(player->GetGUID());
}
void OnDelete(ObjectGuid guid, uint32 /*accountId*/) override
{
FesteringStrikeBlight::Clear(guid);
}
};
class spell_dk_festering_strike : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
@@ -3414,6 +3441,7 @@ void AddSC_deathknight_spell_scripts()
new player_dk_frostreaper_cleanup();
new player_dk_on_a_paler_horse();
new player_dk_festering_strike_cleanup();
RegisterAreaTriggerAI(at_dk_death_and_decay);
}
+58 -12
View File
@@ -36,7 +36,10 @@
#include "TaskScheduler.h"
#include "TemporarySummon.h"
#include <algorithm>
#include <chrono>
#include <mutex>
#include <unordered_map>
#include <vector>
enum MageSpells
{
@@ -1224,12 +1227,50 @@ private:
};
// Track Brain Freeze boosted Flurry casts by OriginalCastId (workaround for aura interrupt issues)
// Key = Flurry(44614) CastId, Value = pending missiles for that Flurry cast
static std::unordered_map<ObjectGuid, int32> g_BrainFreezePendingMissiles;
// Key = Flurry(44614) CastId, Value = pending missiles and the time the cast stops being relevant
struct BrainFreezeCastState
{
int32 pendingMissiles;
std::chrono::steady_clock::time_point expires;
};
static std::mutex g_BrainFreezeStateMutex;
static std::unordered_map<ObjectGuid, BrainFreezeCastState> g_BrainFreezePendingMissiles;
// Translation map: 228596's CastId -> Flurry's CastId (so 228354 can find its counter)
static std::unordered_map<ObjectGuid, ObjectGuid> g_BrainFreezeCastIdChain;
// All missiles of a Flurry land within ~1.5s. Anything older belongs to a cast that never
// finished (interrupted, target lost, caster died) and must not stay cached forever.
static constexpr std::chrono::seconds BrainFreezeStateLifetime(30);
// Must be called with g_BrainFreezeStateMutex held.
static void EraseBrainFreezeCast(ObjectGuid flurryCastId)
{
g_BrainFreezePendingMissiles.erase(flurryCastId);
// Every missile of the cast registers its own chain entry, all of them point at the same Flurry.
for (auto chainItr = g_BrainFreezeCastIdChain.begin(); chainItr != g_BrainFreezeCastIdChain.end();)
{
if (chainItr->second == flurryCastId)
chainItr = g_BrainFreezeCastIdChain.erase(chainItr);
else
++chainItr;
}
}
// Must be called with g_BrainFreezeStateMutex held.
static void PruneBrainFreezeState(std::chrono::steady_clock::time_point now)
{
std::vector<ObjectGuid> expired;
for (auto const& [castId, state] : g_BrainFreezePendingMissiles)
if (now >= state.expires)
expired.push_back(castId);
for (ObjectGuid castId : expired)
EraseBrainFreezeCast(castId);
}
// 44614 - Flurry (cast) - Manual missile control
class spell_mage_flurry : public SpellScript
{
@@ -1252,12 +1293,18 @@ class spell_mage_flurry : public SpellScript
ObjectGuid castId = GetSpell()->m_castId;
if (Aura* brainFreeze = caster->GetAura(SPELL_MAGE_BRAIN_FREEZE_BUFF))
{
g_BrainFreezePendingMissiles[castId] = numMissiles;
{
std::lock_guard lock(g_BrainFreezeStateMutex);
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
PruneBrainFreezeState(now);
g_BrainFreezePendingMissiles[castId] = { numMissiles, now + BrainFreezeStateLifetime };
}
caster->RemoveAura(brainFreeze); // Remove immediately so it doesn't get interrupted
}
else
{
g_BrainFreezePendingMissiles.erase(castId);
std::lock_guard lock(g_BrainFreezeStateMutex);
EraseBrainFreezeCast(castId);
}
// Cast first missile immediately
@@ -1301,7 +1348,8 @@ class spell_mage_flurry_damage_spell : public SpellScript
// Check if our originalCastId (Flurry's CastId) has a Brain Freeze entry
ObjectGuid flurryCastId = GetSpell()->m_originalCastId;
ObjectGuid myCastId = GetSpell()->m_castId;
std::lock_guard lock(g_BrainFreezeStateMutex);
auto it = g_BrainFreezePendingMissiles.find(flurryCastId);
if (it != g_BrainFreezePendingMissiles.end())
g_BrainFreezeCastIdChain[myCastId] = flurryCastId;
@@ -1352,6 +1400,7 @@ class spell_mage_flurry_missile_damage : public SpellScript
// Brain Freeze: +50% damage per missile if this cast had the buff
ObjectGuid damageSpellCastId = GetSpell()->m_originalCastId;
std::lock_guard lock(g_BrainFreezeStateMutex);
auto chainIt = g_BrainFreezeCastIdChain.find(damageSpellCastId);
if (chainIt == g_BrainFreezeCastIdChain.end())
return;
@@ -1359,18 +1408,15 @@ class spell_mage_flurry_missile_damage : public SpellScript
ObjectGuid flurryCastId = chainIt->second;
auto it = g_BrainFreezePendingMissiles.find(flurryCastId);
if (it == g_BrainFreezePendingMissiles.end() || it->second <= 0)
if (it == g_BrainFreezePendingMissiles.end() || it->second.pendingMissiles <= 0)
return;
int32 currentDamage = GetHitDamage();
SetHitDamage(currentDamage + currentDamage / 2); // +50%
it->second--; // Consume one missile
if (it->second <= 0)
{
g_BrainFreezePendingMissiles.erase(it);
g_BrainFreezeCastIdChain.erase(chainIt);
}
it->second.pendingMissiles--; // Consume one missile
if (it->second.pendingMissiles <= 0)
EraseBrainFreezeCast(flurryCastId);
}
void Register() override
+102 -1
View File
@@ -283,6 +283,11 @@ enum PriestSpells
SPELL_PRIEST_MIND_FLAY = 15407,
SPELL_PRIEST_MIND_SEAR = 394976,
SPELL_PRIEST_MIND_SEAR_DAMAGE = 394979,
SPELL_PRIEST_SHADOWFORM = 232698,
SPELL_PRIEST_VOIDFORM = 194249,
SPELL_PRIEST_VOIDFORM_1 = 210199,
SPELL_PRIEST_VOID_VOLLEY = 1242173,
SPELL_PRIEST_VOID_VOLLEY_OVERRIDE = 1242171,
};
enum PriestSpellLabels
@@ -5194,7 +5199,7 @@ class spell_pri_void_volley : public SpellScript
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_PRIEST_VOID_VOLLEY_DAMAGE })
return ValidateSpellInfo({ SPELL_PRIEST_VOID_VOLLEY_DAMAGE, SPELL_PRIEST_VOID_VOLLEY_OVERRIDE })
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } });
}
@@ -5213,9 +5218,103 @@ class spell_pri_void_volley : public SpellScript
caster->m_Events.AddEventAtOffset(new BoltEvent(caster, target->GetGUID(), GetSpell()->m_originalCastId, bolts - 1), BoltEvent::Period);
}
// each Void Volley the priest casts during Voidform spends one of the extra volleys; the one Voidform fires itself is triggered
void SpendVolley() const
{
if (GetSpell()->IsTriggered())
return;
Unit* caster = GetCaster();
if (Aura* overrideAura = caster->GetAura(SPELL_PRIEST_VOID_VOLLEY_OVERRIDE, caster->GetGUID()))
overrideAura->ModStackAmount(-1);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pri_void_volley::HandleEffectHit, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_pri_void_volley::SpendVolley);
}
};
// 228260 - Voidform
class spell_pri_voidform : public SpellScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ SPELL_PRIEST_VOID_VOLLEY, SPELL_PRIEST_VOIDFORM, SPELL_PRIEST_VOID_VOLLEY_OVERRIDE })
&& ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } });
}
void HandleVoidVolley(SpellEffIndex /*effIndex*/) const
{
GetCaster()->CastSpell(GetHitUnit(), SPELL_PRIEST_VOID_VOLLEY, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringSpell = GetSpell()
});
}
void HandleVoidform() const
{
Unit* caster = GetCaster();
caster->CastSpell(caster, SPELL_PRIEST_VOIDFORM, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringSpell = GetSpell()
});
// effect 2 is the number of extra Void Volleys (Improved Voidform adds to it)
caster->CastSpell(caster, SPELL_PRIEST_VOID_VOLLEY_OVERRIDE, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringSpell = GetSpell(),
.SpellValueOverrides = { { SPELLVALUE_AURA_STACK, GetEffectInfo(EFFECT_2).CalcValueAsInt(caster) } }
});
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pri_voidform::HandleVoidVolley, EFFECT_0, SPELL_EFFECT_DUMMY);
AfterCast += SpellCastFn(spell_pri_voidform::HandleVoidform);
}
};
// 194249 - Voidform
class spell_pri_voidform_aura : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_PRIEST_VOIDFORM_1, SPELL_PRIEST_VOID_VOLLEY_OVERRIDE, SPELL_PRIEST_SHADOWFORM });
}
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_PRIEST_VOIDFORM_1, target->GetGUID()))
target->CastSpell(target, SPELL_PRIEST_VOIDFORM_1, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringAura = aurEff
});
}
// runs after the shapeshift handler has reset the form
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
{
Unit* target = GetTarget();
target->RemoveAurasDueToSpell(SPELL_PRIEST_VOID_VOLLEY_OVERRIDE, target->GetGUID());
target->RemoveAurasDueToSpell(SPELL_PRIEST_VOIDFORM_1, target->GetGUID());
// Voidform's shapeshift removed Shadowform; it comes back when Voidform runs out
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !target->IsAlive())
return;
target->CastSpell(target, SPELL_PRIEST_SHADOWFORM, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringAura = aurEff
});
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_pri_voidform_aura::AfterApply, EFFECT_6, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_pri_voidform_aura::AfterRemove, EFFECT_9, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -5750,6 +5849,8 @@ void AddSC_priest_spell_scripts()
RegisterSpellScript(spell_pri_vampiric_touch);
RegisterSpellScript(spell_pri_voice_of_harmony);
RegisterSpellScript(spell_pri_void_volley);
RegisterSpellScript(spell_pri_voidform);
RegisterSpellScript(spell_pri_voidform_aura);
//WowCommunity
RegisterSpellScript(spell_pri_master_the_darkness);
RegisterSpellScript(spell_pri_tentacle_slam);
+37
View File
@@ -121,6 +121,8 @@ enum RogueSpells
SPELL_ROGUE_DOOMBLADE_BLEED = 394021,
SPELL_ROGUE_MUTILATE_MAIN_HAND = 5374,
SPELL_ROGUE_MUTILATE_OFF_HAND = 27576,
SPELL_ROGUE_RECUPERATOR = 378996,
SPELL_ROGUE_SLICE_AND_DICE_RECUPERATOR = 426605,
};
static constexpr std::array<std::pair<uint32 /*poisonAura*/, uint32 /*triggeredPoisonSpell*/>, 7> PoisonAuraToDebuff
@@ -1764,6 +1766,40 @@ class spell_rog_zero_in_proc : public AuraScript
}
};
// 315496 - Slice and Dice
class spell_rog_slice_and_dice : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_ROGUE_RECUPERATOR, SPELL_ROGUE_SLICE_AND_DICE_RECUPERATOR });
}
// effect 1 names the Recuperator heal; its only points come from Recuperator, and retail applies it only with Recuperator
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) const
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_ROGUE_RECUPERATOR))
return;
target->CastSpell(target, SPELL_ROGUE_SLICE_AND_DICE_RECUPERATOR, CastSpellExtraArgsInit{
.TriggerFlags = TRIGGERED_FULL_MASK,
.TriggeringAura = aurEff
});
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{
GetTarget()->RemoveAurasDueToSpell(SPELL_ROGUE_SLICE_AND_DICE_RECUPERATOR, GetTarget()->GetGUID());
}
void Register() override
{
// AURA_EFFECT_HANDLE_REAL: a refresh of Slice and Dice keeps the heal up instead of applying it again
AfterEffectApply += AuraEffectApplyFn(spell_rog_slice_and_dice::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_rog_slice_and_dice::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_rogue_spell_scripts()
{
RegisterSpellScript(spell_rog_airborne_irritant);
@@ -1817,4 +1853,5 @@ void AddSC_rogue_spell_scripts()
RegisterSpellScript(spell_rog_venomous_wounds);
RegisterSpellScript(spell_rog_zero_in_proc);
RegisterSpellScript(spell_rog_swift_slasher);
RegisterSpellScript(spell_rog_slice_and_dice);
}
@@ -5695,6 +5695,16 @@ Housing.EnableCreateGuildNeighborhood = 1
Housing.TutorialsEnabled = 1
# Housing.LoadAllGrids
# Description: Load every grid of each preloaded neighborhood map at startup, so every
# plot and decor object exists before the first player connects. Costs a
# full 64x64 cell sweep per neighborhood map (and a lot of mmap lookups
# for tiles that neighborhood maps do not ship) and visibly slows startup.
# When disabled, neighborhood grids load on demand like any other map.
# Default: false
Housing.LoadAllGrids = 0
# Housing.MaxHousesPerAccount
# Description: Maximum number of houses one battle.net account may own.
# Default: 2
+46
View File
@@ -48,6 +48,14 @@ struct TestObj4 : public TestObj
{
};
struct TestObj5 : public Trinity::enable_unique_weak_from_this<TestObj5>
{
};
struct TestObj6 : public TestObj5
{
};
TEST_CASE("Trinity::unique_trackable_ptr frees memory", "[UniqueTrackablePtr]")
{
bool deleted = false;
@@ -163,3 +171,41 @@ TEST_CASE("Trinity::unique_strong_ref_ptr type casts", "[UniqueTrackablePtr]")
#if TRINITY_COMPILER_IS_CLANG
#pragma clang diagnostic pop
#endif
TEST_CASE("Trinity::enable_unique_weak_from_this exposes weak_from_this", "[UniqueTrackablePtr]")
{
SECTION("single object make_unique_trackable sets weak_from_this")
{
Trinity::unique_trackable_ptr<TestObj6> testObj5 = Trinity::make_unique_trackable<TestObj6>();
REQUIRE(testObj5->weak_from_this().expired() == false);
}
SECTION("unbounded array make_unique_trackable does not set weak_from_this")
{
Trinity::unique_trackable_ptr<TestObj6[]> testObj5 = Trinity::make_unique_trackable<TestObj6[]>(1);
REQUIRE(testObj5[0].weak_from_this().expired() == true);
}
SECTION("unbounded array make_unique_trackable with initial value does not set weak_from_this")
{
Trinity::unique_trackable_ptr<TestObj6[]> testObj5 = Trinity::make_unique_trackable<TestObj6[]>(1, TestObj6());
REQUIRE(testObj5[0].weak_from_this().expired() == true);
}
SECTION("bounded array make_unique_trackable does not set weak_from_this")
{
Trinity::unique_trackable_ptr<TestObj6[1]> testObj5 = Trinity::make_unique_trackable<TestObj6[1]>();
REQUIRE(testObj5[0].weak_from_this().expired() == true);
}
SECTION("bounded array make_unique_trackable with initial value does not set weak_from_this")
{
Trinity::unique_trackable_ptr<TestObj6[1]> testObj5 = Trinity::make_unique_trackable<TestObj6[1]>(TestObj6());
REQUIRE(testObj5[0].weak_from_this().expired() == true);
}
}