Jump to content

[8770] [patch] Fix quest dynamic level


daveh
 Share

Recommended Posts

What bug does the patch fix? What features does the patch add?

Just find quest dynamic level also uses value -1, client also uses -1 to display quest color.

This should fix dynamic level quest shows in gray in client quest log window.

For which repository revision was the patch created?

8734

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

No.

Who has been writing this patch? Please include either forum user names or email addresses.

me

PS: Pls clean client cache first, then update DB.

code:

http://paste2.org/p/483939

diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp
index 422ad6f..6ecfe2c 100644
--- a/src/game/GossipDef.cpp
+++ b/src/game/GossipDef.cpp
@@ -151,7 +172,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID )

        data << uint32(questID);
        data << uint32(qItem.m_qIcon);
-        data << uint32(pSession->GetPlayer()->GetQuestLevel(pQuest));
+        data << int32(pQuest->GetQuestLevel());
        std::string Title = pQuest->GetTitle();

        int loc_idx = pSession->GetSessionDbLocaleIndex();
@@ -400,7 +421,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl

        data << uint32(questID);
        data << uint32(qmi.m_qIcon);
-        data << uint32(pSession->GetPlayer()->GetQuestLevel(pQuest));
+        data << int32(pQuest->GetQuestLevel());
        data << title;
    }
    pSession->SendPacket( &data );
@@ -547,7 +568,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )

    data << uint32(pQuest->GetQuestId());                   // quest id
    data << uint32(pQuest->GetQuestMethod());               // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details)
-    data << uint32(pQuest->GetQuestLevel());                // may be 0, static data, in other cases must be used dynamic level: Player::GetQuestLevel
+    data << int32(pQuest->GetQuestLevel());                 // may be 0, -1, static data, in other cases must be used dynamic level: Player::GetQuestOrPlayerLevel
    data << uint32(pQuest->GetZoneOrSort());                // zone or sort to display in quest log

    data << uint32(pQuest->GetType());                      // quest type
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index c8e9ca2..2445d0f 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5952,7 +5945,7 @@ void Player::RewardReputation(Quest const *pQuest)
    {
        if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] )
        {
-            int32 rep = CalculateReputationGain(GetQuestLevel(pQuest), pQuest->RewRepValue[i], pQuest->RewRepFaction[i], true);
+            int32 rep = CalculateReputationGain(GetQuestOrPlayerLevel(pQuest), pQuest->RewRepValue[i], pQuest->RewRepFaction[i], true);
            FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]);
            if(factionEntry)
                GetReputationMgr().ModifyReputation(factionEntry, rep);
diff --git a/src/game/Player.h b/src/game/Player.h
index 4c9325d..d571ea9 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1280,7 +1280,7 @@ class MANGOS_DLL_SPEC Player : public Unit
        /***                    QUEST SYSTEM                   ***/
        /*********************************************************/

-        uint32 GetQuestLevel( Quest const* pQuest ) const { return pQuest && pQuest->GetQuestLevel() ? pQuest->GetQuestLevel() : getLevel(); }
+        uint32 GetQuestOrPlayerLevel( Quest const* pQuest ) const { return pQuest && (pQuest->GetQuestLevel()>0) ? pQuest->GetQuestLevel() : getLevel(); }

        void PrepareQuestMenu( uint64 guid );
        void SendPreparedQuest( uint64 guid );
diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp
index 5a53e52..c469537 100644
--- a/src/game/QuestDef.cpp
+++ b/src/game/QuestDef.cpp
@@ -27,7 +27,7 @@ Quest::Quest(Field * questRecord)
    ZoneOrSort = questRecord[2].GetInt32();
    SkillOrClass = questRecord[3].GetInt32();
    MinLevel = questRecord[4].GetUInt32();
-    QuestLevel = questRecord[5].GetUInt32();
+    QuestLevel = questRecord[5].GetInt32();
    Type = questRecord[6].GetUInt32();
    RequiredRaces = questRecord[7].GetUInt32();
    RequiredSkillValue = questRecord[8].GetUInt32();
@@ -169,7 +169,7 @@ uint32 Quest::XPValue( Player *pPlayer ) const
        if( RewMoneyMaxLevel > 0 )
        {
            uint32 pLevel = pPlayer->getLevel();
-            uint32 qLevel = QuestLevel;
+            uint32 qLevel = QuestLevel > 0 ? QuestLevel : 0;
            float fullxp = 0;
            if (qLevel >= 15)
                fullxp = RewMoneyMaxLevel / 6.0f;
diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h
index 546a5dc..54e95a4 100644
--- a/src/game/QuestDef.h
+++ b/src/game/QuestDef.h
@@ -181,7 +181,7 @@ class Quest
        int32  GetZoneOrSort() const { return ZoneOrSort; }
        int32  GetSkillOrClass() const { return SkillOrClass; }
        uint32 GetMinLevel() const { return MinLevel; }
-        uint32 GetQuestLevel() const { return QuestLevel; }
+        int32  GetQuestLevel() const { return QuestLevel; }
        uint32 GetType() const { return Type; }
        uint32 GetRequiredRaces() const { return RequiredRaces; }
        uint32 GetRequiredSkillValue() const { return RequiredSkillValue; }
@@ -274,7 +274,7 @@ class Quest
        int32  ZoneOrSort;
        int32  SkillOrClass;
        uint32 MinLevel;
-        uint32 QuestLevel;
+        int32  QuestLevel;
        uint32 Type;
        uint32 RequiredRaces;
        uint32 RequiredSkillValue;
diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
index a93b658..1ecda8a 100644
--- a/src/game/QuestHandler.cpp
+++ b/src/game/QuestHandler.cpp
@@ -606,7 +606,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
                {
                    if ( pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->getQuestStatusMap()[quest_id].m_rewarded))
                        result2 = DIALOG_STATUS_REWARD_REP;
-                    else if (pPlayer->getLevel() <= pPlayer->GetQuestLevel(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF) )
+                    else if (pPlayer->getLevel() <= pPlayer->GetQuestOrPlayerLevel(pQuest) + sWorld.getConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF) )
                    {
                        if (pQuest->HasFlag(QUEST_FLAGS_DAILY))
                            result2 = DIALOG_STATUS_AVAILABLE_REP;

SQL:

ALTER TABLE quest_template
 CHANGE COLUMN QuestLevel QuestLevel smallint(6) NOT NULL DEFAULT 0;

Link to comment
Share on other sites

Same has been discussed from DB devs for a while, and it looks like there is indeed a int32 value. However, you will still find value==0 in cache. That means you must also handle 0 as a valid value and not change all currently having 0 to -1.

You sure the cache data is from offi server? And it's clean?

I don't see level 0 in my clean WDB cache, they all are -1.

And a quick search in wowhead.com show no level 0 quests:

http://www.wowhead.com/?quests&filter=minle=0;maxle=0

Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use