Skip to content

Bug in quest_i_main with db mapping of query results. #7

Description

@Ardesco

I think you have a bug in quest_i_main on lines 2959, 2962 and 2965. It is currently:

if (GetQuestAllowPrecollectedItems(sQuestTag) == TRUE)
{
    sqlquery sObjectiveData = GetQuestStepObjectiveData(nQuestID, nNextStep);
    while (SqlStep(sObjectiveData))
    {
        int nValueType = SqlGetInt(sObjectiveData, 0);
        if (nValueType == QUEST_OBJECTIVE_GATHER)
        {
            string sItemTag = SqlGetString(sObjectiveData, 1);
            //int nQuantity = SqlGetInt(sObjectiveData, 2);
            //int nQuantityMax = SqlGetInt(sObjectiveData, 3);
            string sData = SqlGetString(sObjectiveData, 4);
            int bParty = GetQuestStepPartyCompletion(sQuestTag, nNextStep);
            int n, nPCCount = GetPCItemCount(oPC, sItemTag, bParty);

            if (nPCCount == 0)
                QuestDebug(PCToString(oPC) + " does not have any precollected items that " +
                    "satisfy requirements for " + QuestToString(nQuestID) + " " + StepToString(nNextStep));
            else
                QuestDebug("Applying " + IntToString(nPCCount) + " precollected items toward " +
                    "requirements for " + QuestToString(nQuestID) + " " + StepToString(nNextStep));

            for (n = 0; n < nPCCount; n++)
                SignalQuestStepProgress(oPC, sItemTag, QUEST_OBJECTIVE_GATHER, sData);
        }
    }
}

I think it should be:

if (GetQuestAllowPrecollectedItems(sQuestTag) == TRUE)
{
    sqlquery sObjectiveData = GetQuestStepObjectiveData(nQuestID, nNextStep);
    while (SqlStep(sObjectiveData))
    {
        int nValueType = SqlGetInt(sObjectiveData, 1); // 0 is ID, not nValueType 
        if (nValueType == QUEST_OBJECTIVE_GATHER)
        {
            string sItemTag = SqlGetString(sObjectiveData, 2); // 1 is nValueType , not sKey.  Assuming sKey maps to sItemTag  
            string sData = SqlGetString(sObjectiveData, 5); // 4 is sValueMax, not sData 
            int bParty = GetQuestStepPartyCompletion(sQuestTag, nNextStep);
            int n, nPCCount = GetPCItemCount(oPC, sItemTag, bParty);

            if (nPCCount == 0)
                QuestDebug(PCToString(oPC) + " does not have any precollected items that " +
                    "satisfy requirements for " + QuestToString(nQuestID) + " " + StepToString(nNextStep));
            else
                QuestDebug("Applying " + IntToString(nPCCount) + " precollected items toward " +
                    "requirements for " + QuestToString(nQuestID) + " " + StepToString(nNextStep));

            for (n = 0; n < nPCCount; n++)
                SignalQuestStepProgress(oPC, sItemTag, QUEST_OBJECTIVE_GATHER, sData);
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions