Core/Conditions: implement CONDITION_WINTERGRASP_HORDE to check if Wintergrasp is held by Horde.

Use negative condition to check if it is held by Alliance instead.

Use this condition to fix availability of the Wintergrasp item-gathering weekly quests.
This commit is contained in:
SnapperRy
2016-10-04 11:29:02 +02:00
parent 0c24e4ee0e
commit 723c253f8f
3 changed files with 66 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
--
UPDATE `quest_template_addon` SET `ExclusiveGroup`=236 WHERE `ID` IN (13195, 13156, 13194, 13201, 13154, 13196, 13193, 13199, 236, 13197, 13191, 13200, 13153, 13198, 13202, 13192);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (19, 20) AND `SourceEntry` IN (13195, 13156, 13194, 13201, 13154, 13196, 13193, 13199, 236, 13197, 13191, 13200, 13153, 13198, 13202, 13192, 13185, 13186, 13222, 13223);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(19, 0, 13195, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Alliance quest 'A Rare Herb' (attackers) is available if Wintergrasp is held by Horde"),
(20, 0, 13195, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Alliance quest 'A Rare Herb' (attackers) is available if Wintergrasp is held by Horde"),
(19, 0, 13156, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Alliance quest 'A Rare Herb' (defenders) is available if Wintergrasp is held by Alliance"),
(20, 0, 13156, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Alliance quest 'A Rare Herb' (defenders) is available if Wintergrasp is held by Alliance"),
(19, 0, 13194, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Horde quest 'Healing with Roses' (defenders) is available if Wintergrasp is held by Horde"),
(20, 0, 13194, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Horde quest 'Healing with Roses' (defenders) is available if Wintergrasp is held by Horde"),
(19, 0, 13201, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Horde quest 'Healing with Roses' (attackers) is available if Wintergrasp is held by Alliance"),
(20, 0, 13201, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Horde quest 'Healing with Roses' (attackers) is available if Wintergrasp is held by Alliance"),
(19, 0, 13154, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Alliance quest 'Bones and Arrows' (defenders) is available if Wintergrasp is held by Alliance"),
(20, 0, 13154, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Alliance quest 'Bones and Arrows' (defenders) is available if Wintergrasp is held by Alliance"),
(19, 0, 13196, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Alliance quest 'Bones and Arrows' (attackers) is available if Wintergrasp is held by Horde"),
(20, 0, 13196, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Alliance quest 'Bones and Arrows' (attackers) is available if Wintergrasp is held by Horde"),
(19, 0, 13193, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Horde quest 'Bones and Arrows' (defenders) is available if Wintergrasp is held by Horde"),
(20, 0, 13193, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Horde quest 'Bones and Arrows' (defenders) is available if Wintergrasp is held by Horde"),
(19, 0, 13199, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Horde quest 'Bones and Arrows' (attackers) is available if Wintergrasp is held by Alliance"),
(20, 0, 13199, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Horde quest 'Bones and Arrows' (attackers) is available if Wintergrasp is held by Alliance"),
(19, 0, 236, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Alliance quest 'Fueling the Demolishers' (defenders) is available if Wintergrasp is held by Alliance"),
(20, 0, 236, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Alliance quest 'Fueling the Demolishers' (defenders) is available if Wintergrasp is held by Alliance"),
(19, 0, 13197, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Alliance quest 'Fueling the Demolishers' (attackers) is available if Wintergrasp is held by Horde"),
(20, 0, 13197, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Alliance quest 'Fueling the Demolishers' (attackers) is available if Wintergrasp is held by Horde"),
(19, 0, 13191, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Horde quest 'Fueling the Demolishers' (defenders) is available if Wintergrasp is held by Horde"),
(20, 0, 13191, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Horde quest 'Fueling the Demolishers' (defenders) is available if Wintergrasp is held by Horde"),
(19, 0, 13200, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Horde quest 'Fueling the Demolishers' (attackers) is available if Wintergrasp is held by Alliance"),
(20, 0, 13200, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Horde quest 'Fueling the Demolishers' (attackers) is available if Wintergrasp is held by Alliance"),
(19, 0, 13153, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Alliance quest 'Warding the Warriors' (defenders) is available if Wintergrasp is held by Alliance"),
(20, 0, 13153, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Alliance quest 'Warding the Warriors' (defenders) is available if Wintergrasp is held by Alliance"),
(19, 0, 13198, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Alliance quest 'Warding the Warriors' (attackers) is available if Wintergrasp is held by Horde"),
(20, 0, 13198, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Alliance quest 'Warding the Warriors' (attackers) is available if Wintergrasp is held by Horde"),
(19, 0, 13202, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Horde quest 'Jinxing the Walls' (attackers) is available if Wintergrasp is held by Alliance"),
(20, 0, 13202, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Horde quest 'Jinxing the Walls' (attackers) is available if Wintergrasp is held by Alliance"),
(19, 0, 13192, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Horde quest 'Warding the Walls' (defenders) is available if Wintergrasp is held by Horde"),
(20, 0, 13192, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Horde quest 'Warding the Walls' (defenders) is available if Wintergrasp is held by Horde"),
(19, 0, 13185, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Horde quest 'Stop the Siege' (defenders) is available if Wintergrasp is held by Horde"),
(20, 0, 13185, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Horde quest 'Stop the Siege' (defenders) is available if Wintergrasp is held by Horde"),
(19, 0, 13186, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Alliance quest 'Stop the Siege' (defenders) is available if Wintergrasp is held by Alliance"),
(20, 0, 13186, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Alliance quest 'Stop the Siege' (defenders) is available if Wintergrasp is held by Alliance"),
(19, 0, 13222, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Alliance quest 'Defend the Siege' (attackers) is available if Wintergrasp is held by Horde"),
(20, 0, 13222, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, "", "Quest mark for Alliance quest 'Defend the Siege' (attackers) is available if Wintergrasp is held by Horde"),
(19, 0, 13223, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Horde quest 'Defend the Siege' (attackers) is available if Wintergrasp is held by Alliance"),
(20, 0, 13223, 0, 0, 48, 0, 0, 0, 0, 1, 0, 0, "", "Quest mark for Horde quest 'Defend the Siege' (attackers) is available if Wintergrasp is held by Alliance");

View File

@@ -18,6 +18,7 @@
#include "ConditionMgr.h"
#include "AchievementMgr.h"
#include "BattlefieldMgr.h"
#include "GameEventMgr.h"
#include "InstanceScript.h"
#include "ObjectMgr.h"
@@ -109,7 +110,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND
{ "Charmed", false, false, false },
{ "Pet type", true, false, false },
{ "On Taxi", false, false, false },
{ "Quest state mask", true, true, false }
{ "Quest state mask", true, true, false },
{ "Wintergrasp is horde",false, false, false }
};
// Checks if object meets the condition
@@ -494,6 +496,18 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
}
break;
}
case CONDITION_WINTERGRASP_HORDE:
{
condMeets = false;
if (Player* player = object->ToPlayer())
{
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1);
if (wintergrasp->IsEnabled())
if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
condMeets = true;
}
break;
}
default:
condMeets = false;
break;
@@ -682,6 +696,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const
case CONDITION_QUESTSTATE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_WINTERGRASP_HORDE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -2222,6 +2239,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
case CONDITION_IN_WATER:
case CONDITION_CHARMED:
case CONDITION_TAXI:
case CONDITION_WINTERGRASP_HORDE:
default:
break;
}

View File

@@ -78,7 +78,8 @@ enum ConditionTypes
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_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
CONDITION_WINTERGRASP_HORDE = 48, // 0 0 0 true if Wintergrasp is enabled and held by horde
CONDITION_MAX = 49 // MAX
};
/*! Documentation on implementing a new ConditionSourceType: