aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorStalker_Riddick <nenad_kuza@hotmail.com>2011-11-25 13:11:53 +0000
committerNay <dnpd.dd@gmail.com>2011-11-25 13:11:53 +0000
commitd8ffeed4767a42071ca075b23e3989069f91e4ab (patch)
treeec3f0c4b39ba5957ebb2014dfd7b42cc5ec225c0 /src/server/game/Entities
parentd2b4f331128e10748ad31d3dbc83b36eba5904ca (diff)
Core/Quests: Add new field RequiredClasses for quest_template Credits to
NoFantasy. * SkillOrClass is converted to RequiredSkill (and then field can contain skill id only) * Field ZoneOrSort has no longer a function in quest requirement, and RequiredClasses must be used instead where class limits are expected. To restrict a quest to one class or more, use bitmask of class in RequiredClasses. RequiredSkill works like before. Signed-off-by: NoFantasy <nofantasy@nf.no> Signed-off-by: Stalker_Riddick <nenad_kuza@hotmail.com>
Diffstat (limited to 'src/server/game/Entities')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp66
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h5
2 files changed, 32 insertions, 39 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 24e83da78d5..fce50bc37d2 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -14515,7 +14515,7 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(Quest const* quest)
{
- if (SatisfyQuestRace(quest, false) && SatisfyQuestSkillOrClass(quest, false) &&
+ if (SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) && SatisfyQuestSkill(quest, false) &&
SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
@@ -14530,8 +14530,8 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg)
{
return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
- && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
- && SatisfyQuestSkillOrClass(quest, msg) && SatisfyQuestReputation(quest, msg)
+ && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
+ && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
@@ -15062,47 +15062,21 @@ void Player::FailQuest(uint32 questId)
}
}
-bool Player::SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg)
+bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const
{
- int32 zoneOrSort = qInfo->GetZoneOrSort();
- int32 skillOrClassMask = qInfo->GetSkillOrClassMask();
+ uint32 skill = qInfo->GetRequiredSkill();
- // skip zone zoneOrSort and 0 case skillOrClass
- if (zoneOrSort >= 0 && skillOrClassMask == 0)
+ // skip 0 case RequiredSkill
+ if (skill == 0)
return true;
- int32 questSort = -zoneOrSort;
- uint8 reqSortClass = ClassByQuestSort(questSort);
-
- // check class sort cases in zoneOrSort
- if (reqSortClass != 0 && getClass() != reqSortClass)
+ // check skill value
+ if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue())
{
if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- // check class
- if (skillOrClassMask < 0)
- {
- uint32 reqClassMask = -int32(skillOrClassMask);
- if (!(reqClassMask & getClassMask()))
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
- }
- // check skill
- else if (skillOrClassMask > 0)
- {
- uint32 reqSkill = skillOrClassMask;
- if (GetSkillValue(reqSkill) < qInfo->GetRequiredSkillValue())
- {
- if (msg)
- SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
- return false;
- }
+ return false;
}
return true;
@@ -15230,6 +15204,24 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
return false;
}
+bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
+{
+ uint32 reqClass = qInfo->GetRequiredClasses();
+
+ if (reqClass == 0)
+ return true;
+
+ if ((reqClass & getClassMask()) == 0)
+ {
+ if (msg)
+ SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+
+ return false;
+ }
+
+ return true;
+}
+
bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg)
{
uint32 reqraces = qInfo->GetRequiredRaces();
@@ -16201,7 +16193,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id)
}
}
-void Player::SendCanTakeQuestResponse(uint32 msg)
+void Player::SendCanTakeQuestResponse(uint32 msg) const
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4);
data << uint32(msg);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 9aad63ccb1b..da58a7dadbf 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1410,10 +1410,11 @@ class Player : public Unit, public GridObject<Player>
void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
void FailQuest(uint32 quest_id);
- bool SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg);
+ bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
bool SatisfyQuestLevel(Quest const* qInfo, bool msg);
bool SatisfyQuestLog(bool msg);
bool SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg);
+ bool SatisfyQuestClass(Quest const* qInfo, bool msg) const;
bool SatisfyQuestRace(Quest const* qInfo, bool msg);
bool SatisfyQuestReputation(Quest const* qInfo, bool msg);
bool SatisfyQuestStatus(Quest const* qInfo, bool msg);
@@ -1493,7 +1494,7 @@ class Player : public Unit, public GridObject<Player>
void SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver);
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
void SendQuestTimerFailed(uint32 quest_id);
- void SendCanTakeQuestResponse(uint32 msg);
+ void SendCanTakeQuestResponse(uint32 msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint32 msg);
void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);