* Added support for RepObjectiveFaction2 / RepObjectiveValue2 (opposite

* faction) IE: need to LOSE reputation with that faction.
* Original patch by Brian / Ported to latest rev. by Kudlaty -- THANKS!

--HG--
branch : trunk
This commit is contained in:
Brian
2009-12-20 16:51:41 -07:00
parent 8a5df265c2
commit c4ac6323b0
9 changed files with 148 additions and 76 deletions
@@ -0,0 +1,3 @@
ALTER TABLE `quest_template` ADD `RepObjectiveFaction2` smallint(5) UNSIGNED NOT NULL DEFAULT 0 AFTER `RepObjectiveValue`;
ALTER TABLE `quest_template` ADD `RepObjectiveValue2` mediumint(9) NOT NULL DEFAULT 0 AFTER `RepObjectiveFaction2`;
+2
View File
@@ -3828,6 +3828,8 @@ CREATE TABLE `quest_template` (
`RequiredSkillValue` smallint(5) unsigned NOT NULL DEFAULT '0',
`RepObjectiveFaction` smallint(5) unsigned NOT NULL DEFAULT '0',
`RepObjectiveValue` mediumint(9) NOT NULL DEFAULT '0',
`RepObjectiveFaction2` smallint(5) unsigned NOT NULL DEFAULT '0',
`RepObjectiveValue2` mediumint(9) NOT NULL DEFAULT '0',
`RequiredMinRepFaction` smallint(5) unsigned NOT NULL DEFAULT '0',
`RequiredMinRepValue` mediumint(9) NOT NULL DEFAULT '0',
`RequiredMaxRepFaction` smallint(5) unsigned NOT NULL DEFAULT '0',
+2 -2
View File
@@ -571,8 +571,8 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
data << uint32(pQuest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective
data << uint32(pQuest->GetRepObjectiveValue()); // shown in quest log as part of quest objective
data << uint32(0); // RequiredOpositeRepFaction
data << uint32(0); // RequiredOpositeRepValue, required faction value with another (oposite) faction (objective)
data << uint32(pQuest->GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPOSITE faction
data << uint32(pQuest->GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction
data << uint32(pQuest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0
+10
View File
@@ -5742,6 +5742,16 @@ bool ChatHandler::HandleQuestComplete(const char *args)
player->GetReputationMgr().SetReputation(factionEntry,repValue);
}
// If the quest requires a SECOND reputation to complete
if(uint32 repFaction = pQuest->GetRepObjectiveFaction2())
{
uint32 repValue2 = pQuest->GetRepObjectiveValue2();
uint32 curRep = player->GetReputationMgr().GetReputation(repFaction);
if(curRep < repValue2)
if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction))
player->GetReputationMgr().SetReputation(factionEntry,repValue2);
}
// If the quest requires money
int32 ReqOrRewMoney = pQuest->GetRewOrReqMoney();
if(ReqOrRewMoney < 0)
+31 -17
View File
@@ -3505,37 +3505,37 @@ void ObjectMgr::LoadQuests()
// 0 1 2 3 4 5 6 7 8
QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
// 9 10 11 12 13 14 15 16
"RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
// 17 18 19 20 21 22 23 24 25 26 27 28
// 9 10 11 12 13 14 15 16 17 18
"RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
// 19 20 21 22 23 24 25 26 27 28 29 30
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, SrcItemId, SrcItemCount, SrcSpell,"
// 29 30 31 32 33 34 35 36 37 38
// 31 32 33 34 35 36 37 38 39 40
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 39 40 41 42 43 44 45 46 47 48 49 50
// 41 42 43 44 45 46 47 48 49 50 51 52
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
// 51 52 53 54 55 56 57 58
// 53 54 55 56 57 58 59 60
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
// 59 60 61 62 63 64 65 66
// 61 62 63 64 65 66 67 68
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
// 67 68 69 70
// 69 70 71 72
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
// 71 72 73 74 75 76
// 73 74 75 76 77 78
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
// 77 78 79 80 81 82
// 79 80 81 82 83 84
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 83 84 85 86 87 88 89 90
// 85 86 87 88 89 90 91 92
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 91 92 93 94 95 96 97 98 99 100
// 93 94 95 96 97 98 99 100 101 102
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 101 102 103 104 105 106 107 108 109 110 111
// 103 104 105 106 107 108 109 110 111 112 113
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 112 113 114 115 116 117 118 119
// 114 115 116 117 118 119 120 121
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
// 120 121 122 123 124 125
// 122 123 124 125 126 127
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 126 127 128 129
// 128 129 130 131
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
// 130 131
// 132 133
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
@@ -3688,6 +3688,13 @@ void ObjectMgr::LoadQuests()
}
// else Skill quests can have 0 skill level, this is ok
if(qinfo->RepObjectiveFaction2 && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction2))
{
sLog.outErrorDb("Quest %u has `RepObjectiveFaction2` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(),qinfo->RepObjectiveFaction2,qinfo->RepObjectiveFaction2);
// no changes, quest can't be done for this requirement
}
if(qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction))
{
sLog.outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.",
@@ -3730,6 +3737,13 @@ void ObjectMgr::LoadQuests()
// warning
}
if(!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0 )
{
sLog.outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect",
qinfo->GetQuestId(),qinfo->RepObjectiveValue2);
// warning
}
if(!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0 )
{
sLog.outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
+36
View File
@@ -13422,6 +13422,10 @@ bool Player::CanCompleteQuest( uint32 quest_id )
if ( repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue() )
return false;
uint32 repFacId2 = qInfo->GetRepObjectiveFaction2();
if ( repFacId2 && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue2() )
return false;
return true;
}
}
@@ -13556,6 +13560,10 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
if(FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction()))
GetReputationMgr().SetVisible(factionEntry);
if( pQuest->GetRepObjectiveFaction2() )
if(FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->GetRepObjectiveFaction2()))
GetReputationMgr().SetVisible(factionEntry);
uint32 qtime = 0;
if( pQuest->HasFlag( QUEST_TRINITY_FLAGS_TIMED ) )
{
@@ -14716,6 +14724,34 @@ void Player::ReputationChanged(FactionEntry const* factionEntry)
}
}
void Player::ReputationChanged2(FactionEntry const* factionEntry)
{
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
if(uint32 questid = GetQuestSlotQuestId(i))
{
if (Quest const* qInfo = objmgr.GetQuestTemplate(questid))
{
if (qInfo->GetRepObjectiveFaction2() == factionEntry->ID)
{
QuestStatusData& q_status = mQuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue2())
if (CanCompleteQuest(questid))
CompleteQuest(questid);
}
else if(q_status.m_status == QUEST_STATUS_COMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2())
IncompleteQuest(questid);
}
}
}
}
}
}
bool Player::HasQuestForItem(uint32 itemid) const
{
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
+1
View File
@@ -1341,6 +1341,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void TalkedToCreature( uint32 entry, uint64 guid );
void MoneyChanged( uint32 value );
void ReputationChanged(FactionEntry const* factionEntry );
void ReputationChanged2(FactionEntry const* factionEntry );
bool HasQuestForItem( uint32 itemid ) const;
bool HasQuestForGO(int32 GOId) const;
void UpdateForQuestWorldObjects();
+59 -57
View File
@@ -35,102 +35,104 @@ Quest::Quest(Field * questRecord)
RequiredSkillValue = questRecord[8].GetUInt32();
RepObjectiveFaction = questRecord[9].GetUInt32();
RepObjectiveValue = questRecord[10].GetInt32();
RequiredMinRepFaction = questRecord[11].GetUInt32();
RequiredMinRepValue = questRecord[12].GetInt32();
RequiredMaxRepFaction = questRecord[13].GetUInt32();
RequiredMaxRepValue = questRecord[14].GetInt32();
SuggestedPlayers = questRecord[15].GetUInt32();
LimitTime = questRecord[16].GetUInt32();
QuestFlags = questRecord[17].GetUInt16();
uint32 SpecialFlags = questRecord[18].GetUInt16();
CharTitleId = questRecord[19].GetUInt32();
PlayersSlain = questRecord[20].GetUInt32();
BonusTalents = questRecord[21].GetUInt32();
PrevQuestId = questRecord[22].GetInt32();
NextQuestId = questRecord[23].GetInt32();
ExclusiveGroup = questRecord[24].GetInt32();
NextQuestInChain = questRecord[25].GetUInt32();
SrcItemId = questRecord[26].GetUInt32();
SrcItemCount = questRecord[27].GetUInt32();
SrcSpell = questRecord[28].GetUInt32();
Title = questRecord[29].GetCppString();
Details = questRecord[30].GetCppString();
Objectives = questRecord[31].GetCppString();
OfferRewardText = questRecord[32].GetCppString();
RequestItemsText = questRecord[33].GetCppString();
EndText = questRecord[34].GetCppString();
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();
SrcItemId = questRecord[28].GetUInt32();
SrcItemCount = questRecord[29].GetUInt32();
SrcSpell = questRecord[30].GetUInt32();
Title = questRecord[31].GetCppString();
Details = questRecord[32].GetCppString();
Objectives = questRecord[33].GetCppString();
OfferRewardText = questRecord[34].GetCppString();
RequestItemsText = questRecord[35].GetCppString();
EndText = questRecord[36].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectiveText[i] = questRecord[35+i].GetCppString();
ObjectiveText[i] = questRecord[37+i].GetCppString();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemId[i] = questRecord[39+i].GetUInt32();
ReqItemId[i] = questRecord[41+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
ReqItemCount[i] = questRecord[45+i].GetUInt32();
ReqItemCount[i] = questRecord[47+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceId[i] = questRecord[51+i].GetUInt32();
ReqSourceId[i] = questRecord[52+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceCount[i] = questRecord[55+i].GetUInt32();
ReqSourceCount[i] = questRecord[57+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[59+i].GetInt32();
ReqCreatureOrGOId[i] = questRecord[61+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[63+i].GetUInt32();
ReqCreatureOrGOCount[i] = questRecord[65+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[67+i].GetUInt32();
ReqSpell[i] = questRecord[69+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemId[i] = questRecord[71+i].GetUInt32();
RewChoiceItemId[i] = questRecord[72+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemCount[i] = questRecord[77+i].GetUInt32();
RewChoiceItemCount[i] = questRecord[79+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemId[i] = questRecord[83+i].GetUInt32();
RewItemId[i] = questRecord[85+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[87+i].GetUInt32();
RewItemCount[i] = questRecord[89+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepFaction[i] = questRecord[91+i].GetUInt32();
RewRepFaction[i] = questRecord[93+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[96+i].GetInt32();
RewRepValue[i] = questRecord[98+i].GetInt32();
RewHonorableKills = questRecord[101].GetUInt32();
RewOrReqMoney = questRecord[102].GetInt32();
RewMoneyMaxLevel = questRecord[103].GetUInt32();
RewSpell = questRecord[104].GetUInt32();
RewSpellCast = questRecord[105].GetUInt32();
RewMailTemplateId = questRecord[106].GetUInt32();
RewMailDelaySecs = questRecord[107].GetUInt32();
PointMapId = questRecord[108].GetUInt32();
PointX = questRecord[109].GetFloat();
PointY = questRecord[110].GetFloat();
PointOpt = questRecord[111].GetUInt32();
RewHonorableKills = questRecord[103].GetUInt32();
RewOrReqMoney = questRecord[104].GetInt32();
RewMoneyMaxLevel = questRecord[105].GetUInt32();
RewSpell = questRecord[106].GetUInt32();
RewSpellCast = questRecord[107].GetUInt32();
RewMailTemplateId = questRecord[108].GetUInt32();
RewMailDelaySecs = questRecord[109].GetUInt32();
PointMapId = questRecord[110].GetUInt32();
PointX = questRecord[111].GetFloat();
PointY = questRecord[112].GetFloat();
PointOpt = questRecord[113].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[112+i].GetUInt32();
DetailsEmote[i] = questRecord[114+i].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmoteDelay[i] = questRecord[116+i].GetUInt32();
DetailsEmoteDelay[i] = questRecord[118+i].GetUInt32();
IncompleteEmote = questRecord[120].GetUInt32();
CompleteEmote = questRecord[121].GetUInt32();
IncompleteEmote = questRecord[122].GetUInt32();
CompleteEmote = questRecord[123].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[122+i].GetInt32();
OfferRewardEmote[i] = questRecord[124+i].GetInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[126+i].GetInt32();
OfferRewardEmoteDelay[i] = questRecord[128+i].GetInt32();
QuestStartScript = questRecord[130].GetUInt32();
QuestCompleteScript = questRecord[131].GetUInt32();
QuestStartScript = questRecord[132].GetUInt32();
QuestCompleteScript = questRecord[133].GetUInt32();
QuestFlags |= SpecialFlags << 16;
+4
View File
@@ -187,6 +187,8 @@ class Quest
uint32 GetRequiredSkillValue() const { return RequiredSkillValue; }
uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; }
int32 GetRepObjectiveValue() const { return RepObjectiveValue; }
uint32 GetRepObjectiveFaction2() const { return RepObjectiveFaction2; }
int32 GetRepObjectiveValue2() const { return RepObjectiveValue2; }
uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; }
int32 GetRequiredMinRepValue() const { return RequiredMinRepValue; }
uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; }
@@ -280,6 +282,8 @@ class Quest
uint32 RequiredSkillValue;
uint32 RepObjectiveFaction;
int32 RepObjectiveValue;
uint32 RepObjectiveFaction2;
int32 RepObjectiveValue2;
uint32 RequiredMinRepFaction;
int32 RequiredMinRepValue;
uint32 RequiredMaxRepFaction;