From a848bb9edc706499a76c526c047ac17135d6f56d Mon Sep 17 00:00:00 2001 From: sogladev Date: Mon, 29 Dec 2025 05:21:13 +0100 Subject: [PATCH] fix(Core/Conditions): Limit Oculus' Cache drop to Random Heroic (#24184) --- .../rev_1766404520085093714.sql | 2 ++ src/server/game/Conditions/ConditionMgr.cpp | 31 +++++++++++++++++++ src/server/game/Conditions/ConditionMgr.h | 3 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1766404520085093714.sql diff --git a/data/sql/updates/pending_db_world/rev_1766404520085093714.sql b/data/sql/updates/pending_db_world/rev_1766404520085093714.sql new file mode 100644 index 000000000..e144eaee2 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1766404520085093714.sql @@ -0,0 +1,2 @@ +-- +UPDATE `conditions` SET `ConditionTypeOrReference` = 105, `ConditionValue1` = 1, `ConditionValue2` = 0, `ConditionValue3` = 0, `Comment` = 'Loot Cache of the Ley-Guardian only when the player is queued via Random Heroic' WHERE `SourceTypeOrReferenceId` = 4 AND `SourceGroup` = 24524 AND `SourceEntry` = 52676 AND `SourceId` = 0 AND `ElseGroup` = 0 AND `ConditionTarget` = 0 AND `ConditionTypeOrReference` = 1; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 1d1bbec23..1e1840de3 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -542,6 +542,23 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = object->GetMap()->GetDifficulty() == ConditionValue1; break; } + case CONDITION_RANDOM_DUNGEON: + { + if (Unit* unit = object->ToUnit()) + { + if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + if (sLFGMgr->selectedRandomLfgDungeon(player->GetGUID())) + { + if (!ConditionValue1) + condMeets = true; + else if (Map* map = player->GetMap()) + condMeets = map->GetDifficulty() == Difficulty(ConditionValue1); + } + } + } + break; + } case CONDITION_PET_TYPE: { if (Unit* unit = object->ToUnit()) @@ -786,6 +803,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_CHARMED: mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_RANDOM_DUNGEON: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; case CONDITION_WORLD_SCRIPT: mask |= GRID_MAP_TYPE_MASK_ALL; break; @@ -2466,6 +2486,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) return false; } break; + case CONDITION_RANDOM_DUNGEON: + if (cond->ConditionValue1 >= MAX_DIFFICULTY) + { + LOG_ERROR("sql.sql", "RandomDungeon condition has invalid difficulty in value1 ({}).", cond->ConditionValue1); + return false; + } + if (cond->ConditionValue2) + LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value2 ({}).", cond->ConditionValue2); + if (cond->ConditionValue3) + LOG_ERROR("sql.sql", "RandomDungeon condition has useless data in value3 ({}).", cond->ConditionValue3); + break; case CONDITION_PET_TYPE: if (cond->ConditionValue1 >= (1 << MAX_PET_TYPE)) { diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index d8a29e4d1..c472451a3 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -88,8 +88,9 @@ enum ConditionTypes CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type CONDITION_WORLD_SCRIPT = 103, // conditionId state 0 true if WorldState::IsConditionFulfilled returns true CONDITION_AI_DATA = 104, // dataId value 0 true if AI::GetData returns value + CONDITION_RANDOM_DUNGEON = 105, // difficulty (0 = any) 0 0 true if player is queued for a random dungeon via RDF (param1 = Difficulty) - CONDITION_AC_END = 105 // placeholder + CONDITION_AC_END = 106 // placeholder }; /*! Documentation on implementing a new ConditionSourceType: