diff options
-rw-r--r-- | sql/updates/world/3.3.5/2016_09_09_02_world.sql | 7 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 28 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 3 |
3 files changed, 36 insertions, 2 deletions
diff --git a/sql/updates/world/3.3.5/2016_09_09_02_world.sql b/sql/updates/world/3.3.5/2016_09_09_02_world.sql new file mode 100644 index 00000000000..2f0395782b4 --- /dev/null +++ b/sql/updates/world/3.3.5/2016_09_09_02_world.sql @@ -0,0 +1,7 @@ +-- fix Sniffing out the Perpetrator (Horde side), issue #17914 +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=29695 AND `SourceEntry`=40971; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`Comment`) VALUES + (1,29695,40971,0,47,12855,(2|8|64),0,0,"Brann's Communicator - Only drop if player has 'Sniffing out the Perpetrator' (12855) completed or rewarded."), + (1,29695,40971,0, 2,40971, 1,1,1,"Brann's Communicator - Only drop if player does not have 1 Brann's Communicator in their inventory or bank."), + (1,29695,40971,1,47,12910,(2|8|64),0,0,"Brann's Communicator - Only drop if player has 'Sniffing out the Perpetrator' (12910) completed or rewarded."), + (1,29695,40971,1, 2,40971, 1,1,1,"Brann's Communicator - Only drop if player does not have 1 Brann's Communicator in their inventory or bank."); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index a31d73b6dfb..c859031b573 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -108,7 +108,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Daily Quest Completed",true, false, false }, { "Charmed", false, false, false }, { "Pet type", true, false, false }, - { "On Taxi", false, false, false } + { "On Taxi", false, false, false }, + { "Quest state mask", true, true, false } }; // Checks if object meets the condition @@ -478,6 +479,21 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = player->IsInFlight(); break; } + case CONDITION_QUESTSTATE: + { + if (Player* player = object->ToPlayer()) + { + if ( + ((ConditionValue2 & (1 << QUEST_STATUS_NONE)) && (player->GetQuestStatus(ConditionValue1) == QUEST_STATUS_NONE)) || + ((ConditionValue2 & (1 << QUEST_STATUS_COMPLETE)) && (player->GetQuestStatus(ConditionValue1) == QUEST_STATUS_COMPLETE)) || + ((ConditionValue2 & (1 << QUEST_STATUS_INCOMPLETE)) && (player->GetQuestStatus(ConditionValue1) == QUEST_STATUS_INCOMPLETE)) || + ((ConditionValue2 & (1 << QUEST_STATUS_FAILED)) && (player->GetQuestStatus(ConditionValue1) == QUEST_STATUS_FAILED)) || + ((ConditionValue2 & (1 << QUEST_STATUS_REWARDED)) && player->GetQuestRewardStatus(ConditionValue1)) + ) + condMeets = true; + } + break; + } default: condMeets = false; break; @@ -663,6 +679,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_TAXI: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_QUESTSTATE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -1829,6 +1848,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } + case CONDITION_QUESTSTATE: + if (cond->ConditionValue2 >= (1 << MAX_QUEST_STATUS)) + { + TC_LOG_ERROR("sql.sql", "%s has invalid state mask (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue2); + return false; + } + // intentional missing break case CONDITION_QUESTREWARDED: case CONDITION_QUESTTAKEN: case CONDITION_QUEST_NONE: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index f4068842765..7bda1376a0d 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -77,7 +77,8 @@ enum ConditionTypes CONDITION_CHARMED = 44, // 0 0 0 true if unit is currently charmed CONDITION_PET_TYPE = 45, // mask 0 0 true if player has a pet of given type(s) CONDITION_TAXI = 46, // 0 0 0 true if player is on taxi - CONDITION_MAX = 47 // MAX + CONDITION_QUESTSTATE = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded) + CONDITION_MAX = 48 // MAX }; /*! Documentation on implementing a new ConditionSourceType: |