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>
This commit is contained in:
1 parent
d2b4f33112
commit
d8ffeed476
6 files changed
+189
-164
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user