|
03-14-19, 11:43 AM | #1 |
Quest Completist map pins
After banging my head whit this sinze the release of Bfa i hope nice soul here can help out where the troubble is, used bugsack/buggrabber to fix alot of errors but it domt print anything releated to pins.
This should be the part of code that related to puting pins on the map local function qcColouredQuestName(questId) if not (questId) then return nil end if not (qcQuestDatabase[questId]) then return nil end if ((qcQuestDatabase[questId][6] == 3) or (qcQuestDatabase[questId][6] == 2)) then return string.format("|cff178ed5%s|r",qcQuestDatabase[questId][2]) elseif (qcCompletedQuests[questId] == nil) then return string.format("|cffffffff%s|r",qcQuestDatabase[questId][2]) elseif ((qcCompletedQuests[questId]["C"] == 1) or (qcCompletedQuests[questId]["C"] == 2)) then return string.format("|cff00ff00%s|r",qcQuestDatabase[questId][2]) else return string.format("|cffffffff%s [u]|r",qcQuestDatabase[questId][2]) end end local function qcHideAllPins() -- * for i = #qcPinFrames, 1, -1 do qcPinFrames[i]:Hide() TableInsert(qcSparePinFrames, qcPinFrames[i]) TableRemove(qcPinFrames,i) end end local function qcGetPin() local pin = nil if (#qcSparePinFrames > 0) then pin = qcSparePinFrames[1] TableRemove(qcSparePinFrames, 1) end if not (pin) then pin = CreateFrame("Frame", "qcPin", WorldMapDetailFrame) pin:SetWidth(16) pin:SetHeight(16) pin.Texture = pin:CreateTexture() pin.Texture:SetTexture("Interface\\Addons\\QuestCompletist\\Images\\QCIcons") pin.Texture:SetAllPoints() pin:EnableMouse(true) pin:SetFrameStrata(WorldMapDetailFrame:GetFrameStrata()) -- **** pin:SetFrameLevel(WorldMapPOIFrame:GetFrameLevel() + 1) pin:HookScript("OnEnter", function(self, motion) local frames = {} local frame = EnumerateFrames() while (frame) do if (frame:IsVisible() and MouseIsOver(frame) and (frame:GetName() == "qcPin")) then TableInsert(frames, frame) end frame = EnumerateFrames(frame) end qcMapTooltip:SetParent(self) qcMapTooltip:SetOwner(self, "ANCHOR_RIGHT") qcMapTooltip:ClearLines() for i, e in pairs(frames) do -- TODO: Possible ipairs? local initiatorsIndex = e.PinIndex if (qcPins[initiatorsIndex][3] == 0) then qcMapTooltip:AddLine(qcPins[initiatorsIndex][4] or StringFormat("%s %s",UnitName("player"),"|cff69ccf0<Yourself>|r")) else qcMapTooltip:AddDoubleLine(qcPins[initiatorsIndex][4] or StringFormat("%s %s",UnitName("player"),"|cff69ccf0<Yourself>|r"), StringFormat("|cffff7d0a[%d]|r",qcPins[initiatorsIndex][3])) end for qcIndex, qcEntry in ipairs(qcPins[initiatorsIndex][7]) do qcMapTooltip:AddDoubleLine(tostring(qcColouredQuestName(qcEntry)), StringFormat("|cffff7d0a[%d]|r",tostring(qcEntry))) if (#qcPins[initiatorsIndex][7] <= 10) then --[[ Order by most likely first, always leaving completed until the end ]]-- --[[ TODO: Create a texture object and use in-game texture with SetTexCoord ]]-- if (qcQuestDatabase[qcEntry]) then if (qcQuestDatabase[qcEntry][6] == 3) then qcMapTooltip:AddTexture("Interface\\Addons\\QuestCompletist\\Images\\DailyQuestIcon") elseif (qcQuestDatabase[qcEntry][6] == 2) then qcMapTooltip:AddTexture("Interface\\Addons\\QuestCompletist\\Images\\DailyActiveQuestIcon") elseif (qcCompletedQuests[qcEntry] ~= nil) and (qcCompletedQuests[qcEntry]["C"] == 1 or qcCompletedQuests[qcEntry]["C"] == 2) then qcMapTooltip:AddTexture("Interface\\Addons\\QuestCompletist\\Images\\QuestCompleteIcon") else qcMapTooltip:AddTexture("Interface\\Addons\\QuestCompletist\\Images\\AvailableQuestIcon") end end end end if (qcPins[initiatorsIndex][8]) then qcMapTooltip:AddLine(StringFormat("|cffabd473%s|r",qcPins[initiatorsIndex][8]),nil,nil,nil,true) end end qcMapTooltip:Show() end ) pin:HookScript("OnLeave", function(self) qcMapTooltip:Hide() end ) end TableInsert(qcPinFrames, pin) return pin end local function qcShowPin(index, icon) -- * local pin = qcGetPin() pin:SetPoint("CENTER", WorldMapDetailFrame, "TOPLEFT", (qcPins[index][5] / 100) * WorldMapDetailFrame:GetWidth(), (-qcPins[index][6] / 100) * WorldMapDetailFrame:GetHeight()) pin.PinIndex = index if (icon == 1) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_NORMAL)) elseif (icon == 3) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_DAILY)) elseif (icon == 2) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_REPEATABLE)) elseif (icon == 5) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_SEASONAL)) elseif (icon == 4) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_SPECIAL)) elseif (icon == 6) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_PROFESSION)) elseif (icon == 7) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_ITEMDROPSTANDARD)) elseif (icon == 8) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_ITEMDROPREPEATABLE)) elseif (icon == 9) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_CLASS)) elseif (icon == 10) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_KILL)) elseif (icon == 11) then pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_WORLDQUEST)) else pin.Texture:SetTexCoord(unpack(QC_ICON_COORDS_NORMAL)) end pin:Show() end local function qcRefreshPins(mapId, mapLevel) if not (WorldMapFrame:IsVisible()) then return nil end qcHideAllPins() wipe(qcPins) if (qcSettings.QC_M_SHOW_ICONS == 0) or (qcPinDB[mapId] == nil) then wipe(qcPins) return nil end qcPins = qcCopyTable(qcPinDB[mapId]) for i = #qcPins, 1, -1 do if not (qcPins[i][1] == mapLevel) then TableRemove(qcPins,i) end end if (qcSettings.QC_M_HIDE_LOWLEVEL == 1) then for i = #qcPins, 1, -1 do for questIndex = #qcPins[i][7], 1, -1 do local questId = qcPins[i][7][questIndex] if (qcQuestDatabase[questId]) then local questLevel = qcQuestDatabase[questId][3] or 0 local greenCutoff = (UnitLevel("player") - GetQuestGreenRange()) if (questLevel < greenCutoff) then TableRemove(qcPins[i][7],questIndex) end else TableRemove(qcPins[i][7],questIndex) end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end if (qcSettings["QC_M_HIDE_COMPLETED"] == 1) then for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] if (qcCompletedQuests[qcQuestID]) and ((qcCompletedQuests[qcQuestID]["C"] == 1) or (qcCompletedQuests[qcQuestID]["C"] == 2)) then TableRemove(qcPins[i][7], qcQuestIndex) end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[ Faction ]]-- if (qcSettings["QC_ML_HIDE_FACTION"] == 1) then for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] local qcCurrentPlayerFaction, _S = UnitFactionGroup("player") local qcCurrentFaction = qcFactionBits[string.upper(qcCurrentPlayerFaction)] if (qcQuestDatabase[qcQuestID]) and (BitBand(qcQuestDatabase[qcQuestID][7], qcCurrentFaction) == 0) then TableRemove(qcPins[i][7], qcQuestIndex) end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[ Race\Class ]]-- if (qcSettings["QC_ML_HIDE_RACECLASS"] == 1) then for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] local _S, qcCurrentPlayerRace = UnitRace("player") local qcCurrentRace = qcRaceBits[string.upper(qcCurrentPlayerRace)] local _S, qcCurrentPlayerClass = UnitClass("player") local qcCurrentClass = qcClassBits[string.upper(qcCurrentPlayerClass)] if (qcQuestDatabase[qcQuestID]) and (BitBand(qcQuestDatabase[qcQuestID][8], qcCurrentRace) == 0) then TableRemove(qcPins[i][7], qcQuestIndex) elseif (qcQuestDatabase[qcQuestID]) and (BitBand(qcQuestDatabase[qcQuestID][9], qcCurrentClass) == 0) then TableRemove(qcPins[i][7], qcQuestIndex) end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[ Seasonal ]]-- if (qcSettings["QC_M_HIDE_SEASONAL"] == 1) then local qcToday = date("%y%m%d") for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] if (qcQuestDatabase[qcQuestID]) and (qcQuestDatabase[qcQuestID][11] > 0) then if not ((qcToday >= qcHolidayDates[qcQuestDatabase[qcQuestID][11]][1]) and (qcToday <= qcHolidayDates[qcQuestDatabase[qcQuestID][11]][2])) then TableRemove(qcPins[i][7], qcQuestIndex) end end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[ Professions ]]-- if (qcSettings["QC_M_HIDE_PROFESSION"] == 1) then local qcProfessionBitwise = 0 local qcProfessions = {GetProfessions()} for qcIndex, qcEntry in pairs(qcProfessions) do local qcName, qcTexture, _S, _S, _S, _S, qcProfessionID, _S = GetProfessionInfo(qcEntry) qcProfessionBitwise = (qcProfessionBitwise + qcProfessionBits[qcProfessionID]) end for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] if (qcQuestDatabase[qcQuestID]) and (qcQuestDatabase[qcQuestID][10] > 0) then if (BitBand(qcQuestDatabase[qcQuestID][10], qcProfessionBitwise) == 0) then TableRemove(qcPins[i][7], qcQuestIndex) end end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[WORLDQUEST ]]-- -- if (qcSettings["QC_ML_HIDE_WORLDQUEST"] == 1) then -- for i = #qcPins, 1, -1 do -- for qcQuestIndex = #qcPins[i][7], 1, -1 do -- local qcQuestID = qcPins[i][7][qcQuestIndex] -- local _S, qcCurrentPlayerRace = UnitRace("player") -- local qcCurrentRace = qcRaceBits[string.upper(qcCurrentPlayerRace)] -- local _S, qcCurrentPlayerClass = UnitClass("player") -- local qcCurrentClass = qcClassBits[string.upper(qcCurrentPlayerClass)] -- if (qcQuestDatabase[qcQuestID]) and (BitBand(qcQuestDatabase[qcQuestID][8], qcCurrentRace) == 0) then -- TableRemove(qcPins[i][7], qcQuestIndex) -- elseif (qcQuestDatabase[qcQuestID]) and (BitBand(qcQuestDatabase[qcQuestID][9], qcCurrentClass) == 0) then -- TableRemove(qcPins[i][7], qcQuestIndex) -- end -- end -- if (#qcPins[i][7] == 0) then -- TableRemove(qcPins, i) -- end -- end -- end --[[ In progress ]]-- if (qcSettings["QC_M_HIDE_INPROGRESS"] == 1) then for i = #qcPins, 1, -1 do for qcQuestIndex = #qcPins[i][7], 1, -1 do local qcQuestID = qcPins[i][7][qcQuestIndex] if (GetQuestLogIndexByID(qcQuestID) ~= 0) then TableRemove(qcPins[i][7], qcQuestIndex) end end if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end end --[[ Empty quest sub-tables ]]-- for i = #qcPins, 1, -1 do if (#qcPins[i][7] == 0) then TableRemove(qcPins, i) end end --[[ Check if only 1 quest remains for each initiator, and customize icon for that final quest ]]-- for i = #qcPins, 1, -1 do local qcIconType = qcPins[i][2] if (#qcPins[i][7] == 1) then local qcQuestID = qcPins[i][7][1] if ((qcQuestDatabase[qcQuestID]) and (qcIconType == 1)) then if (qcQuestDatabase[qcQuestID][6] == 1) then qcIconType = 1 elseif (qcQuestDatabase[qcQuestID][6] == 3) then qcIconType = 3 elseif (qcQuestDatabase[qcQuestID][6] == 2) then qcIconType = 2 elseif (qcQuestDatabase[qcQuestID][6] == 4) then qcIconType = 4 end end end qcShowPin(i, qcIconType) end end |
|
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Quest Completist map pins |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|