Index: src/game/GossipDef.cpp =================================================================== --- src/game/GossipDef.cpp (revision 4415) +++ src/game/GossipDef.cpp (working copy) @@ -379,10 +379,12 @@ data << uint32(pQuest->GetType()); data << uint32(pQuest->GetSuggestedPlayers()); - data << uint32(pQuest->GetRequiredRepFaction()); - data << uint32(pQuest->GetRequiredRepValue()); - data << uint32(0); // reputation related (faction) - data << uint32(0); // reputation related (value) + data << uint32(pQuest->GetRequiredMinRepFaction()); + data << uint32(pQuest->GetRequiredMinRepValue()); + data << uint32(pQuest->GetRequiredMaxRepFaction()); + data << uint32(pQuest->GetRequiredMaxRepValue()); + //data << uint32(0); // reputation related (faction) + //data << uint32(0); // reputation related (value) data << uint32(pQuest->GetNextQuestInChain()); data << uint32(pQuest->GetRewOrReqMoney()); Index: src/game/ObjectMgr.cpp =================================================================== --- src/game/ObjectMgr.cpp (revision 4415) +++ src/game/ObjectMgr.cpp (working copy) @@ -1584,7 +1584,7 @@ // 0 1 2 3 4 QueryResult *result = sDatabase.Query("SELECT `entry`,`ZoneOrSort`, `MinLevel`,`QuestLevel`,`Type`," // 5 6 7 8 9 10 - "`RequiredRaces`,`RequiredSkillValue`,`RequiredRepFaction`,`RequiredRepValue`,`SuggestedPlayers`,`LimitTime`," + "`RequiredRaces`,`RequiredSkillValue`,`RequiredMinRepFaction`,`RequiredMinRepValue`,`RequiredMaxRepFaction`,`RequiredMaxRepValue`,`SuggestedPlayers`,`LimitTime`," // 11 12 13 14 15 16 17 18 "`SpecialFlags`,`PrevQuestId`,`NextQuestId`,`ExclusiveGroup`,`NextQuestInChain`,`SrcItemId`,`SrcItemCount`,`SrcSpell`," // 19 20 21 22 23 24 25 26 27 28 @@ -1650,20 +1650,34 @@ // no changes, quest can't be done for this requirement } - if(qinfo->RequiredRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredRepFaction)) + if(qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { - sLog.outErrorDb("Quest %u has `RequiredRepFaction` = %u but faction template %u doesn't exist, quest can't be done.", - qinfo->GetQuestId(),qinfo->RequiredRepFaction,qinfo->RequiredRepFaction); + sLog.outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u doesn't exist, quest can't be done.", + qinfo->GetQuestId(),qinfo->RequiredMinRepFaction,qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } - if(qinfo->RequiredRepValue && int32(qinfo->RequiredRepValue) > Player::Reputation_Cap) + if(qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { - sLog.outErrorDb("Quest %u has `RequiredRepValue` = %u but max reputation is %u, quest can't be done.", - qinfo->GetQuestId(),qinfo->RequiredRepValue,Player::Reputation_Cap); + sLog.outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u doesn't exist, quest can't be done.", + qinfo->GetQuestId(),qinfo->RequiredMaxRepFaction,qinfo->RequiredMaxRepFaction); // no changes, quest can't be done for this requirement } + if(qinfo->RequiredMinRepValue && int32(qinfo->RequiredMinRepValue) > Player::Reputation_Cap) + { + sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %u but max reputation is %u, quest can't be done.", + qinfo->GetQuestId(),qinfo->RequiredMinRepValue,Player::Reputation_Cap); + // no changes, quest can't be done for this requirement + } + + if(qinfo->RequiredMaxRepValue && int32(qinfo->RequiredMaxRepValue) > Player::Reputation_Cap) + { + sLog.outErrorDb("Quest %u has `RequiredMaxRepValue` = %u but max reputation is %u, quest can't be done.", + qinfo->GetQuestId(),qinfo->RequiredMaxRepValue,Player::Reputation_Cap); + // no changes, quest can't be done for this requirement + } + if(qinfo->SrcItemId && !sItemStorage.LookupEntry(qinfo->SrcItemId)) { sLog.outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u doesn't exist, quest can't be done.", Index: src/game/Player.cpp =================================================================== --- src/game/Player.cpp (revision 4415) +++ src/game/Player.cpp (working copy) @@ -10844,11 +10844,17 @@ Quest * qInfo = objmgr.mQuestTemplates[quest_id]; if( qInfo ) { - uint32 faction_id = qInfo->GetRequiredRepFaction(); - if(!faction_id) + uint32 fIdMin = qInfo->GetRequiredMinRepFaction(); //Min required rep + uint32 fIdMax = qInfo->GetRequiredMaxRepFaction(); //Max required rep + if(!fIdMin && !fIdMax) //There can be problem if second not set you'll get rep always? return true; - - return GetReputation(faction_id) >= int32(qInfo->GetRequiredRepValue()); + bool cond1, cond2; + //Now you have to be on both cnditions true + //Your rep have to be > as MinRepvalue + //and < as MaxRepValue + cond1 = fIdMin ? GetReputation(fIdMin) >= int32(qInfo->GetRequiredMinRepValue()) : true; + cond2 = fIdMax ? GetReputation(fIdMax) <= int32(qInfo->GetRequiredMaxRepValue()) : true; + return cond1 && cond2; } return false; } Index: src/game/QuestDef.cpp =================================================================== --- src/game/QuestDef.cpp (revision 4415) +++ src/game/QuestDef.cpp (working copy) @@ -28,90 +28,92 @@ Type = questRecord[4].GetUInt32(); RequiredRaces = questRecord[5].GetUInt32(); RequiredSkillValue = questRecord[6].GetUInt32(); - RequiredRepFaction = questRecord[7].GetUInt32(); - RequiredRepValue = questRecord[8].GetUInt32(); - SuggestedPlayers = questRecord[9].GetUInt32(); - LimitTime = questRecord[10].GetUInt32(); - SpecialFlags = questRecord[11].GetUInt32(); - PrevQuestId = questRecord[12].GetInt32(); - NextQuestId = questRecord[13].GetInt32(); - ExclusiveGroup = questRecord[14].GetUInt32(); - NextQuestInChain = questRecord[15].GetUInt32(); - SrcItemId = questRecord[16].GetUInt32(); - SrcItemCount = questRecord[17].GetUInt32(); - SrcSpell = questRecord[18].GetUInt32(); - Title = questRecord[19].GetCppString(); - Details = questRecord[20].GetCppString(); - Objectives = questRecord[21].GetCppString(); - OfferRewardText = questRecord[22].GetCppString(); - RequestItemsText = questRecord[23].GetCppString(); - EndText = questRecord[24].GetCppString(); + RequiredMinRepFaction = questRecord[7].GetUInt32(); + RequiredMinRepValue = questRecord[8].GetUInt32(); + RequiredMaxRepFaction = questRecord[9].GetUInt32(); + RequiredMaxRepValue = questRecord[10].GetUInt32(); + SuggestedPlayers = questRecord[11].GetUInt32(); + LimitTime = questRecord[12].GetUInt32(); + SpecialFlags = questRecord[13].GetUInt32(); + PrevQuestId = questRecord[14].GetInt32(); + NextQuestId = questRecord[15].GetInt32(); + ExclusiveGroup = questRecord[16].GetUInt32(); + NextQuestInChain = questRecord[17].GetUInt32(); + SrcItemId = questRecord[18].GetUInt32(); + SrcItemCount = questRecord[19].GetUInt32(); + SrcSpell = questRecord[20].GetUInt32(); + Title = questRecord[21].GetCppString(); + Details = questRecord[22].GetCppString(); + Objectives = questRecord[23].GetCppString(); + OfferRewardText = questRecord[24].GetCppString(); + RequestItemsText = questRecord[25].GetCppString(); + EndText = questRecord[26].GetCppString(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ObjectiveText[i] = questRecord[25+i].GetCppString(); + ObjectiveText[i] = questRecord[27+i].GetCppString(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqItemId[i] = questRecord[29+i].GetUInt32(); + ReqItemId[i] = questRecord[31+i].GetUInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqItemCount[i] = questRecord[33+i].GetUInt32(); + ReqItemCount[i] = questRecord[35+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - ReqSourceId[i] = questRecord[37+i].GetUInt32(); + ReqSourceId[i] = questRecord[39+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - ReqSourceCount[i] = questRecord[41+i].GetUInt32(); + ReqSourceCount[i] = questRecord[43+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - ReqSourceRef[i] = questRecord[45+i].GetUInt32(); + ReqSourceRef[i] = questRecord[47+i].GetUInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqCreatureOrGOId[i] = questRecord[49+i].GetInt32(); + ReqCreatureOrGOId[i] = questRecord[51+i].GetInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqCreatureOrGOCount[i] = questRecord[53+i].GetUInt32(); + ReqCreatureOrGOCount[i] = questRecord[55+i].GetUInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqSpell[i] = questRecord[57+i].GetUInt32(); + ReqSpell[i] = questRecord[59+i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewChoiceItemId[i] = questRecord[61+i].GetUInt32(); + RewChoiceItemId[i] = questRecord[63+i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewChoiceItemCount[i] = questRecord[67+i].GetUInt32(); + RewChoiceItemCount[i] = questRecord[69+i].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewItemId[i] = questRecord[73+i].GetUInt32(); + RewItemId[i] = questRecord[75+i].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewItemCount[i] = questRecord[77+i].GetUInt32(); + RewItemCount[i] = questRecord[79+i].GetUInt32(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewRepFaction[i] = questRecord[81+i].GetUInt32(); + RewRepFaction[i] = questRecord[83+i].GetUInt32(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewRepValue[i] = questRecord[86+i].GetInt32(); + RewRepValue[i] = questRecord[88+i].GetInt32(); - RewOrReqMoney = questRecord[91].GetInt32();; - RewXpOrMoney = questRecord[92].GetUInt32(); - RewSpell = questRecord[93].GetUInt32(); - PointMapId = questRecord[94].GetUInt32(); - PointX = questRecord[95].GetFloat(); - PointY = questRecord[96].GetFloat(); - PointOpt = questRecord[97].GetUInt32(); + RewOrReqMoney = questRecord[93].GetInt32();; + RewXpOrMoney = questRecord[94].GetUInt32(); + RewSpell = questRecord[95].GetUInt32(); + PointMapId = questRecord[96].GetUInt32(); + PointX = questRecord[97].GetFloat(); + PointY = questRecord[98].GetFloat(); + PointOpt = questRecord[99].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmote[i] = questRecord[98+i].GetUInt32(); + DetailsEmote[i] = questRecord[100+i].GetUInt32(); - IncompleteEmote = questRecord[102].GetUInt32(); - CompleteEmote = questRecord[103].GetUInt32(); + IncompleteEmote = questRecord[104].GetUInt32(); + CompleteEmote = questRecord[105].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmote[i] = questRecord[104+i].GetInt32(); + OfferRewardEmote[i] = questRecord[106+i].GetInt32(); - QuestStartScript = questRecord[108].GetUInt32(); - QuestCompleteScript = questRecord[109].GetUInt32(); - Repeatable = questRecord[110].GetUInt32(); + QuestStartScript = questRecord[110].GetUInt32(); + QuestCompleteScript = questRecord[111].GetUInt32(); + Repeatable = questRecord[112].GetUInt32(); m_reqitemscount = 0; m_reqCreatureOrGOcount = 0; Index: src/game/QuestDef.h =================================================================== --- src/game/QuestDef.h (revision 4415) +++ src/game/QuestDef.h (working copy) @@ -146,8 +146,10 @@ uint32 GetType() { return Type; } uint32 GetRequiredRaces() { return RequiredRaces; } uint32 GetRequiredSkillValue() { return RequiredSkillValue; } - uint32 GetRequiredRepFaction() { return RequiredRepFaction; } - uint32 GetRequiredRepValue() { return RequiredRepValue; } + uint32 GetRequiredMinRepFaction() { return RequiredMinRepFaction; } + uint32 GetRequiredMinRepValue() { return RequiredMinRepValue; } + uint32 GetRequiredMaxRepFaction() { return RequiredMaxRepFaction; } + uint32 GetRequiredMaxRepValue() { return RequiredMaxRepValue; } uint32 GetSuggestedPlayers() { return SuggestedPlayers; } uint32 GetLimitTime() { return LimitTime; } int32 GetNextQuestId() { return NextQuestId; } @@ -222,8 +224,10 @@ uint32 Type; uint32 RequiredRaces; uint32 RequiredSkillValue; - uint32 RequiredRepFaction; - uint32 RequiredRepValue; + uint32 RequiredMinRepFaction; + uint32 RequiredMinRepValue; + uint32 RequiredMaxRepFaction; + uint32 RequiredMaxRepValue; uint32 SuggestedPlayers; uint32 LimitTime; uint32 SpecialFlags;