mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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 62cffd11d0)
This commit is contained in:
@@ -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.");
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user