* 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 committed 2009-12-20 16:51:41 -07:00
1 parent 8a5df265c2
commit c4ac6323b0
9 files changed
+148 -76

No files matched your search

+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)