aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-09-09 17:14:34 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-26 15:31:42 +0100
commit31a3f2297b421d2d15b5db630e419c3baa9ce2a3 (patch)
treef1db62a574f84f7d053c4dd7ad835d182400fb10
parente941d7e04b41e9f7236db6981b7ddb1d071453ea (diff)
Core/Conditions: New CONDITION_QUESTSTATE (47). It's the existing quest conditions collapsed into a bitmask value2 because I'm a lazy person that doesn't like having long SQL queries.
Then use this new condition to fix Sniffing out the Perpetrator for Horde. Tagging issue #17914. (cherry picked from commit 62cffd11d0e9b33dd60cb5238f06d6dfd06415d8)
-rw-r--r--sql/updates/world/master/2017_02_26_04_world_2016_09_09_02_world.sql7
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp28
-rw-r--r--src/server/game/Conditions/ConditionMgr.h3
3 files changed, 36 insertions, 2 deletions
diff --git a/sql/updates/world/master/2017_02_26_04_world_2016_09_09_02_world.sql b/sql/updates/world/master/2017_02_26_04_world_2016_09_09_02_world.sql
new file mode 100644
index 00000000000..2f0395782b4
--- /dev/null
+++ b/sql/updates/world/master/2017_02_26_04_world_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 621d48112f2..917e61bb8d7 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -109,7 +109,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
@@ -484,6 +485,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;
@@ -677,6 +693,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;
@@ -1930,6 +1949,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 cb8fb3e8a08..aecccb82708 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -95,7 +95,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: