Complete a Non-Repeatable quest and remove it from player ?

is there a function that completes a quest that the player has right now and removes it without giving him the rewards and prevents the player from taking the same quest again because its already completed and non-reaptable ?



void Player::CompleteQuest(uint32 quest_id)

{

    if (quest_id)

    {

        SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);


        uint16 log_slot = FindQuestSlot(quest_id);

        if (log_slot < MAX_QUEST_LOG_SIZE)

            SetQuestSlotState(log_slot,QUEST_STATE_COMPLETE);


        if (Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id))

        {

            if (qInfo->HasFlag(QUEST_FLAGS_AUTO_REWARDED))

                RewardQuest(qInfo,0,this,false);

            else

                SendQuestComplete(quest_id);

        }

    }

}

i noticed that if flag is AUTO rewarded which is SET QuestFlags = 1024

then reward gets sent , hopefully this will work

auto rewarded gives the player the rewards directly when he finishes the quest , which sucks so this doesnt work

complete a quest with no rewards ?

can this be used ?


void Player::FinishQuest(uint32 quest_id)

{

    //this THING should be here to protect code from quest, which cast on player far teleport as a reward

    //should work fine, cause far teleport will be executed in Player::Update()

    SetCanDelayTeleport(true);


    for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)

        if (pQuest->ReqItemId[i])

            DestroyItemCount(pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true);


    for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)

    {

        if (pQuest->ReqSourceId[i])

        {

            uint32 count = pQuest->ReqSourceCount[i];

            DestroyItemCount(pQuest->ReqSourceId[i], count ? count : 9999, true);

        }

    }


    RemoveTimedQuest(quest_id);



    uint16 log_slot = FindQuestSlot(quest_id);

    if (log_slot < MAX_QUEST_LOG_SIZE)

        SetQuestSlot(log_slot, 0);


    QuestStatusData& q_status = mQuestStatus[quest_id];


    if (!pQuest->IsRepeatable())

        SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);

    else

        SetQuestStatus(quest_id, QUEST_STATUS_NONE);


    q_status.m_rewarded = true;

    if (q_status.uState != QUEST_NEW)

        q_status.uState = QUEST_CHANGED;


    //lets remove flag for delayed teleports

    SetCanDelayTeleport(false);

}

There is an edit button for a reason, needlessly bumping your own thread (especially when no one else has posted anything in it) is a bit annoying.

OK its Working Perfectly :

Code is :


void Player::FinishNoRewardNonReapeatQuest(uint32 quest_id)

{

    uint16 log_slot = FindQuestSlot(quest_id);

    if (log_slot < MAX_QUEST_LOG_SIZE)

        SetQuestSlot(log_slot, 0);


    QuestStatusData& q_status = mQuestStatus[quest_id];


     SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);



    q_status.m_rewarded = true;

    if (q_status.uState != QUEST_NEW)

        q_status.uState = QUEST_CHANGED;


}

Quest must be non repeatable and you must add this only to quests you don’t want player rewarded for !

just a little script for a custom area

or you just go ingame and do:

.quest remove