User Tag List

Results 1 to 4 of 4

Thread: Quest Status and Verify Items/Kills

  1. #1
    Member
    Join Date
    Jul 2016
    Posts
    33
    XP
    370
    Level
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quest Status and Verify Items/Kills

    Well, I'm making a npc to verify if a player has a quest completed.

    As you maybe know, some custom quest gets bug and the players can't recive the awards and they have the npc kills or items requireds.

    So, my NPC will check the items and requiredNPCorGo, and if those fields are completed, delete quest, add it again to the player and complete it.

    Maybe this code will help me to do the thing that I want:

    Code:
    Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
    QuestStatusMap::iterator itr = m_QuestStatus.find(quest_id);
    QuestStatusData &q_status = itr->second;
    
    if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO))
                {
                    for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
                    {
                        if (qInfo->RequiredNpcOrGo[i] == 0)
                            continue;
    
                        if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] < qInfo->RequiredNpcOrGoCount[i])
                            return false;
                    }
                }
    
    if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
                {
                    for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
                    {
                        if (qInfo->RequiredItemCount[i]!= 0 && q_status.ItemCount[i] < qInfo->RequiredItemCount[i])
                            return false;
                    }
                }
    Thanks for your help

  2. #2
    Original Poster
    Member
    Join Date
    Jul 2016
    Posts
    33
    XP
    370
    Level
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can I create a function to verify if a player has completed the item in their bag/bank?

    So, then I can do something like:

    Code:
    if(verifyQuest(quest_id) == true){
    //bla bla
    }
    and inside my function something like:

    Code:
    bool verifyQuest (uint8 quest_id){
    //how to implement that code here?
    }

  3. #3
    Original Poster
    Member
    Join Date
    Jul 2016
    Posts
    33
    XP
    370
    Level
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well I've made this code:

    Code:
    bool VerifyQuest(uint32 quest_id, Player* player){
    	if (quest_id)
        {
            Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id);
            if (!qInfo)
                return false;
    
            QuestStatusData& q_status = m_QuestStatus[quest_id];
    
            if (q_status.Status == QUEST_STATUS_INCOMPLETE)
            {
                if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
                {
                    for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
                    {
                        if (qInfo->RequiredItemCount[i]!= 0 && q_status.ItemCount[i] == qInfo->RequiredItemCount[i]){
    						 if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL))
    						{
    							for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
    							{
    								if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] == qInfo->RequiredNpcOrGoCount[i]){
    									if (qInfo->GetRewOrReqMoney() >= 0){
    										return true;
    									}
    									else{
    										if (qInfo->GetRewOrReqMoney() < 0)
    										{
    											if (!player->HasEnoughMoney(-qInfo->GetRewOrReqMoney()))
    												return false;
    										}
    									}
    								}
    							}
    						}
    					}
                    }
                }
            }
        }
        return false;
    }
    But when I'm compiling, I got two errors:

    Code:
    'm_QuestStatus': undeclared identifier
    'q_status': references must be initialized
    I hope you can help me!

  4. #4
    Original Poster
    Member
    Join Date
    Jul 2016
    Posts
    33
    XP
    370
    Level
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solved.

    I've changed "QuestStatusData& q_status = m_QuestStatus[quest_id];" to QueryResult to the table characters.character_queststatus. It has all the info that I need to make my ideas come true.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •