diff options
| author | SnapperRy <snapperryen@gmail.com> | 2016-07-16 21:10:54 +0200 |
|---|---|---|
| committer | SnapperRy <snapperryen@gmail.com> | 2016-07-16 21:10:54 +0200 |
| commit | b4b3c10c69f73a0fd1e8efe4fd8684676f33948d (patch) | |
| tree | d21e02182f2e3df24158e0d2f7f0f5a474d14d0e | |
| parent | cee1c0789acb7d75e453ed355a5d68781a5dec4c (diff) | |
Core/Conditions: implement CONDITION_DAILY_QUEST_DONE to check whether or not a daily quest has been completed by a player in that day.
Also use it to fix two quest chains broken in commit 7905651. Should be the only ones of their kind.
| -rw-r--r-- | sql/updates/world/3.3.5/2016_07_16_08_world.sql | 8 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 13 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 3 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 18 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 1 |
5 files changed, 41 insertions, 2 deletions
diff --git a/sql/updates/world/3.3.5/2016_07_16_08_world.sql b/sql/updates/world/3.3.5/2016_07_16_08_world.sql new file mode 100644 index 00000000000..af4db3f1567 --- /dev/null +++ b/sql/updates/world/3.3.5/2016_07_16_08_world.sql @@ -0,0 +1,8 @@ +-- +UPDATE `quest_template_addon` SET `PrevQuestID`=0 WHERE `ID` IN (12692, 12695); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (19, 20) AND `SourceEntry` IN (12692, 12695); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(19, 0, 12692, 0, 0, 43, 0, 12582, 0, 0, 0, 0, 0, "", "Quest 'Return of the Lich Hunter' can be accepted if daily quest 'Frenzyheart Champion' hsa been turned in"), +(20, 0, 12692, 0, 0, 43, 0, 12582, 0, 0, 0, 0, 0, "", "Quest mark for 'Return of the Lich Hunter' can be seen if daily quest 'Frenzyheart Champion' hsa been turned in"), +(19, 0, 12695, 0, 0, 43, 0, 12689, 0, 0, 0, 0, 0, "", "Quest 'Return of the Friendly Dryskin' can be accepted if daily quest 'Hand of the Oracles' has been turned in"), +(20, 0, 12695, 0, 0, 43, 0, 12689, 0, 0, 0, 0, 0, "", "Quest mark for 'Return of the Friendly Dryskin' can be accepted if daily quest 'Hand of the Oracles' has been turned in"); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 74e94135b86..6317fae2767 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -103,7 +103,8 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Realm Achievement", true, false, false }, { "In Water", false, false, false }, { "Terrain Swap", false, false, false }, - { "Sit/stand state", true, true, false } + { "Sit/stand state", true, true, false }, + { "Daily Quest Completed",true, false, false } }; // Checks if object meets the condition @@ -448,6 +449,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const } break; } + case CONDITION_DAILY_QUEST_DONE: + { + if (Player* player = object->ToPlayer()) + condMeets = player->IsDailyQuestDone(ConditionValue1); + break; + } default: condMeets = false; break; @@ -621,6 +628,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_STAND_STATE: mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; break; + case CONDITION_DAILY_QUEST_DONE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -1791,6 +1801,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const case CONDITION_QUESTTAKEN: case CONDITION_QUEST_NONE: case CONDITION_QUEST_COMPLETE: + case CONDITION_DAILY_QUEST_DONE: { if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1)) { diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 83e714781c3..4ec2be0753a 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -73,7 +73,8 @@ enum ConditionTypes CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water CONDITION_TERRAIN_SWAP = 41, // only for 6.x CONDITION_STAND_STATE = 42, // stateType state 0 true if unit matches specified sitstate (0,x: has exactly state x; 1,0: any standing state; 1,1: any sitting state;) - CONDITION_MAX = 43 // MAX + CONDITION_DAILY_QUEST_DONE = 43, // quest id 0 0 true if daily quest has been completed for the day + CONDITION_MAX = 44 // MAX }; /*! Documentation on implementing a new ConditionSourceType: diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ad20ba07773..493e21230a2 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22938,6 +22938,24 @@ void Player::SetDailyQuestStatus(uint32 quest_id) } } +bool Player::IsDailyQuestDone(uint32 quest_id) +{ + bool found = false; + if (Quest const* qQuest = sObjectMgr->GetQuestTemplate(quest_id)) + { + for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) + { + if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx) == quest_id) + { + found = true; + break; + } + } + } + + return found; +} + void Player::SetWeeklyQuestStatus(uint32 quest_id) { m_weeklyquests.insert(quest_id); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 10c6f4264b9..38fff9b8d83 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1368,6 +1368,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> QuestGiverStatus GetQuestDialogStatus(Object* questGiver); void SetDailyQuestStatus(uint32 quest_id); + bool IsDailyQuestDone(uint32 quest_id); void SetWeeklyQuestStatus(uint32 quest_id); void SetMonthlyQuestStatus(uint32 quest_id); void SetSeasonalQuestStatus(uint32 quest_id); |
