Questie

Questie

116M Downloads

quest.ObjectiveData[ ].Id is unset for event and killcredit

Laumesis opened this issue · 2 comments

commented

Quest 64845 Alliance War Effort is missing objectives from DB / corrections.

Questie: [DEVELOP] [QuestieQuest:GetAllQuestObjectives] Error finding entry ID for objective 1 event Victory in a battleground match of questId: 64845
Dump: value=GetQuestLogTitle(20)
[1]="Alliance War Effort",
[2]=70,
[3]="PvP",
[4]=false,
[5]=false,
[7]=1,
[8]=64845,
[9]=true,
[10]=false,
[11]=false,
[12]=false,
[13]=false,
[14]=false,
[15]=false,
[16]=false,
[17]=false
Dump: value=C_QuestLog.GetQuestObjectives(64845)
[1]={
  [1]={
    type="event",
    numRequired=1,
    text="Victory in a battleground match",
    finished=false,
    numFulfilled=0
  }
}

v6.9.1

commented

Hmmm the data looks fine for me 🤔

Since it is an "event" objective type only a triggerEnd is needed which is in the corrections.

commented

The "error" is getting outputed for every objective of type event or killcredit (is there even such type?).
Seems other parts of code rely the id to exists, which might results some bugs.. I don't know if those are error-catch run parts.

.Id assigned to quest.Objectives[ ].Id :

quest.Objectives[objectiveIndex] = {
Id = quest.ObjectiveData[objectiveIndex].Id,

The "error" outputed few lines later:

if (not quest.Objectives[objectiveIndex]) or (not quest.Objectives[objectiveIndex].Id) then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieQuest:GetAllQuestObjectives] Error finding entry ID for objective", objectiveIndex, objective.type, objective.text, "of questId:", quest.Id)
end

.Id (not) assigned to quest.ObjectiveData[ ].Id :

QO.ObjectiveData = {}
if rawdata[10] ~= nil then
if rawdata[10][1] ~= nil then
for _, v in pairs(rawdata[10][1]) do
if v ~= nil then
local obj = {
Type = "monster",
Id = v[1],
Text = v[2]
}
tinsert(QO.ObjectiveData, obj);
end
end
end
if rawdata[10][2] ~= nil then
for _, v in pairs(rawdata[10][2]) do
if v ~= nil then
local obj = {
Type = "object",
Id = v[1],
Text = v[2]
}
tinsert(QO.ObjectiveData, obj);
end
end
end
if rawdata[10][3] ~= nil then
for _, v in pairs(rawdata[10][3]) do
if v ~= nil then
local obj = {
Type = "item",
Id = v[1],
Text = v[2]
}
tinsert(QO.ObjectiveData, obj);
end
end
end
if rawdata[10][4] ~= nil then
local obj = {
Type = "reputation",
Id = rawdata[10][4][1],
RequiredRepValue = rawdata[10][4][2]
}
tinsert(QO.ObjectiveData, obj);
end
if rawdata[10][5] then
local obj = {
Type = "killcredit",
IdList = rawdata[10][5][1],
RootId = rawdata[10][5][2],
Text = rawdata[10][5][3]
}
tinsert(QO.ObjectiveData, obj);
end
-- There are quest(s) which have the killCredit at first so we need to switch them
if QuestieCorrections.reversedKillCreditQuestIDs[questId] then
local tmp = QO.ObjectiveData[1]
QO.ObjectiveData[1] = QO.ObjectiveData[2]
QO.ObjectiveData[2] = tmp
end
end
-- Events need to be added at the end of ObjectiveData
local triggerEnd = rawdata[9]
if triggerEnd then
local obj = {
Type = "event",
Text = triggerEnd[1],
Coordinates = triggerEnd[2]
}
tinsert(QO.ObjectiveData, obj);
end

All places that assume quest.Objectives[ ].Id exists (edit: or quest.ObjectiveData[ ].Id) :

quest[offset] = questObject.Objectives[objectiveIndex].Id

quest[offset] = questObject.Objectives[objectiveIndex].Id

quest.objectives[objectiveIndex].id = questObject.Objectives[objectiveIndex].Id;--[_QuestieComms.idLookup["id"]] = questObject.Objectives[objectiveIndex].Id;

objective.spawnList = _QuestieQuest.objectiveSpawnListCallTable[objectiveData.Type](objective.Id, objective, objectiveData);

Questie:Error("Missing event data for Objective:", objective.Description, "id:", id)

objectiveName = QuestieDB.QueryItemSingle(currentObjective.Id, "name")

I didn't look if icon.data.Id may get assigned with this and zillion places where icon.data.Id is used.