Added support for maximum allowed player level for quests. By Gyullo.

--HG--
branch : trunk
This commit is contained in:
Xanadu
2010-03-23 16:10:18 +01:00
parent a348b591a7
commit cfc094040f
6 changed files with 125 additions and 114 deletions
@@ -0,0 +1 @@
ALTER TABLE `quest_template` ADD COLUMN `MaxLevel` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `MinLevel`;
+1
View File
@@ -4369,6 +4369,7 @@ CREATE TABLE `quest_template` (
`ZoneOrSort` smallint(6) NOT NULL DEFAULT '0',
`SkillOrClass` smallint(6) NOT NULL DEFAULT '0',
`MinLevel` tinyint(3) unsigned NOT NULL DEFAULT '0',
`MaxLevel` tinyint(3) unsigned NOT NULL DEFAULT '0',
`QuestLevel` smallint(3) NOT NULL DEFAULT '1',
`Type` smallint(5) unsigned NOT NULL DEFAULT '0',
`RequiredRaces` smallint(5) unsigned NOT NULL DEFAULT '0',
+19 -19
View File
@@ -3581,41 +3581,41 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.clear();
// 0 1 2 3 4 5 6 7 8
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
// 9 10 11 12 13 14 15 16 17 18
// 0 1 2 3 4 5 6 7 8 9
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, MaxLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
// 10 11 12 13 14 15 16 17 18 19
"RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
// 19 20 21 22 23 24 25 26 27 28 29 30 31
// 20 21 22 23 24 25 26 27 28 29 30 31 32
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, RewXPId, SrcItemId, SrcItemCount, SrcSpell,"
// 32 33 34 35 36 37 38 39 40 41 42
// 33 34 35 36 37 38 39 40 41 42 43
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 43 44 45 46 47 48 49 50 51 52 53 54
// 44 45 46 47 48 49 50 51 52 53 54 55
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
// 55 56 57 58 59 60 61 62
// 56 57 58 59 60 61 62 63
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
// 63 64 65 66 67 68 69 70
// 64 65 66 67 68 69 70 71
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
// 71 72 73 74
// 72 73 74 75
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
// 75 76 77 78 79 80
// 76 77 78 79 80 81
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
// 81 82 83 84 85 86
// 82 83 84 85 86 87
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 87 88 89 90 91 92 93 94
// 88 89 90 91 92 93 94 95
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 95 96 97 98 99 100 101 102 103 104
// 96 97 98 99 100 101 102 103 104 105
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5,"
// 105 106 107 108 109
// 106 107 108 109 110
"RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 110 111 112 113 114 115 116 117 118 119 120 121
// 111 112 113 114 115 116 117 118 119 120 121 122
"RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 122 123 124 125 126 127 128 129
// 123 124 125 126 127 128 129 130
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
// 130 131 132 133 134 135
// 131 132 135 134 135 136
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 136 137 138 139
// 137 138 139 140
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 140 141
// 141 142
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
+7 -1
View File
@@ -14226,7 +14226,13 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg)
if (getLevel() < qInfo->GetMinLevel())
{
if(msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL);
return false;
}
else if (qInfo->GetMaxLevel() > 0 && getLevel() > qInfo->GetMaxLevel())
{
if(msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
return false;
}
return true;
+92 -91
View File
@@ -29,116 +29,117 @@ Quest::Quest(Field * questRecord)
ZoneOrSort = questRecord[2].GetInt32();
SkillOrClass = questRecord[3].GetInt32();
MinLevel = questRecord[4].GetUInt32();
QuestLevel = questRecord[5].GetInt32();
Type = questRecord[6].GetUInt32();
RequiredRaces = questRecord[7].GetUInt32();
RequiredSkillValue = questRecord[8].GetUInt32();
RepObjectiveFaction = questRecord[9].GetUInt32();
RepObjectiveValue = questRecord[10].GetInt32();
RepObjectiveFaction2 = questRecord[11].GetUInt32();
RepObjectiveValue2 = questRecord[12].GetInt32();
RequiredMinRepFaction = questRecord[13].GetUInt32();
RequiredMinRepValue = questRecord[14].GetInt32();
RequiredMaxRepFaction = questRecord[15].GetUInt32();
RequiredMaxRepValue = questRecord[16].GetInt32();
SuggestedPlayers = questRecord[17].GetUInt32();
LimitTime = questRecord[18].GetUInt32();
QuestFlags = questRecord[19].GetUInt16();
uint32 SpecialFlags = questRecord[20].GetUInt16();
CharTitleId = questRecord[21].GetUInt32();
PlayersSlain = questRecord[22].GetUInt32();
BonusTalents = questRecord[23].GetUInt32();
PrevQuestId = questRecord[24].GetInt32();
NextQuestId = questRecord[25].GetInt32();
ExclusiveGroup = questRecord[26].GetInt32();
NextQuestInChain = questRecord[27].GetUInt32();
XPId = questRecord[28].GetUInt32();
SrcItemId = questRecord[29].GetUInt32();
SrcItemCount = questRecord[30].GetUInt32();
SrcSpell = questRecord[31].GetUInt32();
Title = questRecord[32].GetCppString();
Details = questRecord[33].GetCppString();
Objectives = questRecord[34].GetCppString();
OfferRewardText = questRecord[35].GetCppString();
RequestItemsText = questRecord[36].GetCppString();
EndText = questRecord[37].GetCppString();
CompletedText = questRecord[38].GetCppString();
MaxLevel = questRecord[5].GetUInt32();
QuestLevel = questRecord[6].GetInt32();
Type = questRecord[7].GetUInt32();
RequiredRaces = questRecord[8].GetUInt32();
RequiredSkillValue = questRecord[9].GetUInt32();
RepObjectiveFaction = questRecord[10].GetUInt32();
RepObjectiveValue = questRecord[11].GetInt32();
RepObjectiveFaction2 = questRecord[12].GetUInt32();
RepObjectiveValue2 = questRecord[13].GetInt32();
RequiredMinRepFaction = questRecord[14].GetUInt32();
RequiredMinRepValue = questRecord[15].GetInt32();
RequiredMaxRepFaction = questRecord[16].GetUInt32();
RequiredMaxRepValue = questRecord[17].GetInt32();
SuggestedPlayers = questRecord[18].GetUInt32();
LimitTime = questRecord[19].GetUInt32();
QuestFlags = questRecord[20].GetUInt16();
uint32 SpecialFlags = questRecord[21].GetUInt16();
CharTitleId = questRecord[22].GetUInt32();
PlayersSlain = questRecord[23].GetUInt32();
BonusTalents = questRecord[24].GetUInt32();
PrevQuestId = questRecord[25].GetInt32();
NextQuestId = questRecord[26].GetInt32();
ExclusiveGroup = questRecord[27].GetInt32();
NextQuestInChain = questRecord[28].GetUInt32();
XPId = questRecord[29].GetUInt32();
SrcItemId = questRecord[30].GetUInt32();
SrcItemCount = questRecord[31].GetUInt32();
SrcSpell = questRecord[32].GetUInt32();
Title = questRecord[33].GetCppString();
Details = questRecord[34].GetCppString();
Objectives = questRecord[35].GetCppString();
OfferRewardText = questRecord[36].GetCppString();
RequestItemsText = questRecord[37].GetCppString();
EndText = questRecord[38].GetCppString();
CompletedText = questRecord[39].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = questRecord[39+i].GetCppString();
ObjectiveText[i] = questRecord[40+i].GetCppString();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemId[i] = questRecord[43+i].GetUInt32();
ReqItemId[i] = questRecord[44+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemCount[i] = questRecord[49+i].GetUInt32();
ReqItemCount[i] = questRecord[50+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceId[i] = questRecord[55+i].GetUInt32();
ReqSourceId[i] = questRecord[56+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceCount[i] = questRecord[59+i].GetUInt32();
ReqSourceCount[i] = questRecord[60+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[63+i].GetInt32();
ReqCreatureOrGOId[i] = questRecord[64+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[67+i].GetUInt32();
ReqCreatureOrGOCount[i] = questRecord[68+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[71+i].GetUInt32();
ReqSpell[i] = questRecord[72+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemId[i] = questRecord[75+i].GetUInt32();
RewChoiceItemId[i] = questRecord[76+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemCount[i] = questRecord[81+i].GetUInt32();
RewChoiceItemCount[i] = questRecord[82+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemId[i] = questRecord[87+i].GetUInt32();
RewItemId[i] = questRecord[88+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[91+i].GetUInt32();
RewItemCount[i] = questRecord[92+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepFaction[i] = questRecord[95+i].GetUInt32();
RewRepFaction[i] = questRecord[96+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValueId[i] = questRecord[100+i].GetInt32();
RewRepValueId[i] = questRecord[101+i].GetInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[105+i].GetInt32();
RewHonorableKills = questRecord[110].GetUInt32();
RewHonorMultiplier = questRecord[111].GetFloat();
RewOrReqMoney = questRecord[112].GetInt32();
RewMoneyMaxLevel = questRecord[113].GetUInt32();
RewSpell = questRecord[114].GetUInt32();
RewSpellCast = questRecord[115].GetInt32();
RewMailTemplateId = questRecord[116].GetUInt32();
RewMailDelaySecs = questRecord[117].GetUInt32();
PointMapId = questRecord[118].GetUInt32();
PointX = questRecord[119].GetFloat();
PointY = questRecord[120].GetFloat();
PointOpt = questRecord[121].GetUInt32();
RewRepValue[i] = questRecord[106+i].GetInt32();
RewHonorableKills = questRecord[111].GetUInt32();
RewHonorMultiplier = questRecord[112].GetFloat();
RewOrReqMoney = questRecord[113].GetInt32();
RewMoneyMaxLevel = questRecord[114].GetUInt32();
RewSpell = questRecord[115].GetUInt32();
RewSpellCast = questRecord[116].GetInt32();
RewMailTemplateId = questRecord[117].GetUInt32();
RewMailDelaySecs = questRecord[118].GetUInt32();
PointMapId = questRecord[119].GetUInt32();
PointX = questRecord[120].GetFloat();
PointY = questRecord[121].GetFloat();
PointOpt = questRecord[122].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[122+i].GetUInt32();
DetailsEmote[i] = questRecord[123+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[126+i].GetUInt32();
IncompleteEmote = questRecord[130].GetUInt32();
CompleteEmote = questRecord[131].GetUInt32();
DetailsEmoteDelay[i] = questRecord[127+i].GetUInt32();
IncompleteEmote = questRecord[131].GetUInt32();
CompleteEmote = questRecord[132].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[132+i].GetInt32();
OfferRewardEmote[i] = questRecord[133+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[136+i].GetInt32();
QuestStartScript = questRecord[140].GetUInt32();
QuestCompleteScript = questRecord[141].GetUInt32();
OfferRewardEmoteDelay[i] = questRecord[137+i].GetInt32();
QuestStartScript = questRecord[141].GetUInt32();
QuestCompleteScript = questRecord[142].GetUInt32();
QuestFlags |= SpecialFlags << 16;
+5 -3
View File
@@ -187,6 +187,7 @@ class Quest
int32 GetZoneOrSort() const { return ZoneOrSort; }
int32 GetSkillOrClass() const { return SkillOrClass; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
uint32 GetQuestLevel() const { return QuestLevel; }
uint32 GetType() const { return Type; }
uint32 GetRequiredRaces() const { return RequiredRaces; }
@@ -253,7 +254,7 @@ class Quest
uint32 RewItemId[QUEST_REWARDS_COUNT];
uint32 RewItemCount[QUEST_REWARDS_COUNT];
uint32 RewRepFaction[QUEST_REPUTATIONS_COUNT];
int32 RewRepValueId[QUEST_REPUTATIONS_COUNT];
int32 RewRepValueId[QUEST_REPUTATIONS_COUNT];
int32 RewRepValue[QUEST_REPUTATIONS_COUNT];
uint32 DetailsEmote[QUEST_EMOTE_COUNT];
uint32 DetailsEmoteDelay[QUEST_EMOTE_COUNT];
@@ -284,7 +285,8 @@ class Quest
int32 ZoneOrSort;
int32 SkillOrClass;
uint32 MinLevel;
int32 QuestLevel;
uint32 MaxLevel;
int32 QuestLevel;
uint32 Type;
uint32 RequiredRaces;
uint32 RequiredSkillValue;
@@ -306,7 +308,7 @@ class Quest
int32 NextQuestId;
int32 ExclusiveGroup;
uint32 NextQuestInChain;
uint32 XPId;
uint32 XPId;
uint32 SrcItemId;
uint32 SrcItemCount;
uint32 SrcSpell;