Quantcast
WoWInterface - View Single Post - Carbonite Unexpectedly Returns Nil
View Single Post
08-11-14, 01:34 AM   #4
DeaTHCorEKiD
A Deviate Faerie Dragon
Join Date: Apr 2010
Posts: 14
hello...

first: sorry for my english, i'm come from german and english is not my best language

i use carbonite beta 5.4.2 Alpha 5 with DugiGuidesPack v6.873 (the actual version) and i have modifyd the addons, so thats work. it's a desaster, that i read here, rythal don't replay any email from dugi, so i must change the dugi addon by all new version from hand

here the changes from me (i have all changes marked with "-- DeaTHCorE..." and the mark ends with "-- ** --") :

in file NxQuest.lua i have changed the follow function:

function Nx.Quest:FindCur (qId, qIndex)

if type (qId) == "string" then -- Quest title?

for n, v in ipairs (self.CurQ) do
if v.Title == qId then
return n, v, qId
end
end

return
end

if qIndex and qId == 0 then
local i, cur = self:FindCurByIndex (qIndex)
return i, cur, cur.Title -- Also return string type id
end

assert (qId > 0)

-- DeaTHCorE - added for compatibility with Carbonite beta...
if not self.CurQ then
return
end
-- ** --

for n, v in ipairs (self.CurQ) do
if v.QId == qId then
return n, v, qId
end
end
end


into the file DugisGuideViwer.lua i have changed the follow function:

function DugisGuideViewer:GetCarboniteQuestLogIndexByQID(qid)
local i
for i=1,40 do
-- DeaTHCorE - added for carbonite beta
if not (Nx.Quest.CurQ) then
return
end
-- ** --
if Nx.Quest.CurQ[i] then
local curq = Nx.Quest.CurQ[i];
local qid2 = curq.QId;
if qid2 == qid then return i end
end
end
end


into the file Guides.lua i have changed the follow functions

function DGV:WatchQuest()
local logindex
DGU.removedQuests = {}
if self:UserSetting(DGV_ENABLEQW) and DGV:isValidGuide(CurrentTitle) == true then
for logindex = 1, GetNumQuestLogEntries() do
local qid = DGV:GetQIDByLogIndex(logindex)
if not DGU.watchedQuests[qid] then
if DGV.carboniteloaded and qid ~= 0 then
Nx.Quest.Watch:RemoveWatch(qid, logindex)
else
RemoveQuestWatch(logindex)
end
end
if DGU.watchedQuests[qid] ~= nil and not IsQuestWatched(logindex) then --clean up watchedQuest
DGU.watchedQuests[qid] = nil
end
end
end

if (self:UserSetting(DGV_ENABLEQW) or self:UserSetting(DGV_OBJECTIVECOUNTER)) and DGV:isValidGuide(CurrentTitle) == true then
local i = DGU.CurrentQuestIndex
if strmatch(self.actions[DGU.CurrentQuestIndex], "[R]") then
logindex = self:GetQuestLogIndexByQID(self.qid[i])
i = i + 1
end
local skiplogindex = nil
local onceonly = false
while i <= #visualRows and strmatch(self.actions[i], "[CTNK]") do
if self:GetQuestState(i) ~= "X" then
if DGV.carboniteloaded then
logindex = self:GetCarboniteQuestLogIndexByQID(self.qid[i])
else
logindex = self:GetQuestLogIndexByQID(self.qid[i])
end

if logindex and DGV.carboniteloaded then
Nx.Quest.Watch:Add(logindex)
elseif logindex then
if self:UserSetting(DGV_OBJECTIVECOUNTER) and self:UserSetting(DGV_MULTISTEPMODE) then
RemoveQuestWatch(logindex)
DGU.removedQuests[self.qid[i]] = true
elseif self:UserSetting(DGV_OBJECTIVECOUNTER) and not self:UserSetting(DGV_MULTISTEPMODE) and (skiplogindex ~= logindex) and not onceonly and not strmatch(self.actions[DGU.CurrentQuestIndex], "[R]") then
RemoveQuestWatch(logindex)
skiplogindex = logindex
onceonly = true
DGU.removedQuests[self.qid[i]] = true
elseif skiplogindex ~= logindex or strmatch(self.actions[DGU.CurrentQuestIndex], "[R]") then
AddQuestWatch(logindex)
end
end
end
i = i + 1
end
end

if self:UserSetting(DGV_ENABLEQW) and DGV:isValidGuide(CurrentTitle) == true then
if DGV.carboniteloaded and strmatch(self.actions[DGU.CurrentQuestIndex], "[CTNK]") and DGV.qid[DGU.CurrentQuestIndex] then
-- DeaTHCorE - added for carbonite beta...
if (Nx.Quest.Tracking) then
-- ** --
local cqid = DGV.qid[DGU.CurrentQuestIndex]
cqid = tonumber(cqid)
local cqidpart = DGV:ReturnTag("QIDP", DGU.CurrentQuestIndex)
cqidpart = tonumber(cqidpart)
if cqid and strmatch(self.actions[DGU.CurrentQuestIndex], "[T]") then
Nx.Quest.Tracking[cqid] = 1
Nx.Quest:TrackOnMap(cqid, 0, true, true, true)
elseif cqid and cqidpart == 1 then
Nx.Quest.Tracking[cqid] = 2
Nx.Quest:TrackOnMap(cqid, 1, true, true, true)
elseif cqid and cqidpart == 2 then
Nx.Quest.Tracking[cqid] = 4
Nx.Quest:TrackOnMap(cqid, 2, true, true, true)
elseif cqid and cqidpart == 3 then
Nx.Quest.Tracking[cqid] = 8
Nx.Quest:TrackOnMap(cqid, 3, true, true, true)
elseif cqid and cqidpart == 4 then
Nx.Quest.Tracking[cqid] = 16
Nx.Quest:TrackOnMap(cqid, 4, true, true, true)
elseif cqid then
Nx.Quest.Tracking[cqid] = 2
Nx.Quest:TrackOnMap(cqid, 1, true, true, true)
end
-- DeaTHCorE - added for carbonite beta...
end
-- ** --
end
end

if (self:UserSetting(DGV_ENABLEQW) or self:UserSetting(DGV_OBJECTIVECOUNTER)) and DGV:isValidGuide(CurrentTitle) == true then
WatchFrame_Update()
end
end


function DGV:Tooltip_OnEnter(self, event, ...)

local name = self:GetName()
local title = _G[self:GetName().."Name"]:GetText()
local text = _G[self:GetName().."Desc"]:GetText()

CreateFrame( "GameTooltip", "LargeFrameTooltip", nil, "GameTooltipTemplate" );
LargeFrameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
LargeFrameTooltip:SetParent(UIParent)
LargeFrameTooltipTextLeft1:SetFont("Fonts\\FRIZQT__.TTF", 12)

--LargeFrameTooltip:SetPadding(5)
-- DeaTHCorE - eliminate a nil title...
--LargeFrameTooltip:AddLine("|cfff0c502"..title.."|r", 1, 1, 1, true)
LargeFrameTooltip:AddLine("|cfff0c502"..(title or "No Titel...").."|r", 1, 1, 1, true)
-- ** --
LargeFrameTooltip:AddLine(" ", 1, 1, 1, true)
LargeFrameTooltip:AddLine(text, 1, 1, 1, true)
LargeFrameTooltip:Show()
--[[
local ttwidth, ttheight, fwidth, fheight, pad = DGV:GetToolTipSize(LargeFrameTooltip)

--DebugPrint("fwidth:"..fwidth.." fheight:"..fheight.." ttwidth"..ttwidth.." ttheight"..ttheight.." pad"..pad)

local scaleFactor = fwidth / ttwidth
local maxScale = 1.3
if (scaleFactor > 1) then
local newwidth
if scaleFactor > maxScale then
scaleFactor = maxScale

end

if(scaleFactor < 1.10) then
newwidth = fwidth * 1.10
else
newwidth = ttwidth * scaleFactor
end
LargeFrameTooltip:SetWidth(newwidth)
LargeFrameTooltipTextLeft1:SetWidth(newwidth - 15)
LargeFrameTooltip:SetHeight(LargeFrameTooltipTextLeft1:GetHeight() + 20)

ttwidth, ttheight, fwidth, fheight, pad = DGV:GetToolTipSize()
--DebugPrint("2fwidth:"..fwidth.." fheight:"..fheight.." ttwidth"..ttwidth.." ttheight"..ttheight.." pad"..pad)
end
--]]
LargeFrameTooltip:SetFrameStrata("TOOLTIP")
end


and last into the file StickyFrame.lua the follow function:

local function OnEnter(button, event)
if not SF.Tooltip then
SF.Tooltip = CreateFrame( "GameTooltip", "StickyFrameTooltip", nil, "GameTooltipTemplate" )
end
local stickyIndex = tonumber(button:GetName():match("DGV_SFRow(%d*)"))
local guideIndex = SF.StickyQuests[stickyIndex]
--if guideIndex then DebugPrint("guideIndex="..guideIndex) end
--if stickyIndex then DebugPrint("stickyIndex="..stickyIndex) end

if guideIndex then
local mainFrameRow = _G["DGVRow"..guideIndex]

SF.Tooltip:SetFrameStrata("TOOLTIP")
SF.Tooltip:SetOwner(SF.Frame, "ANCHOR_TOPLEFT")
SF.Tooltip:SetParent(SF.Frame)
StickyFrameTooltipTextLeft1:SetFont("Fonts\\FRIZQT__.TTF", 12)
StickyFrameTooltipTextLeft2:SetFont("Fonts\\FRIZQT__.TTF", 12)
-- DeaTHCorE - changed for a nil result in mainFrameRow.Name:GetText()...
--SF.Tooltip:AddLine("|cfff0c502"..mainFrameRow.Name:GetText().."|r", 1, 1, 1, true)
SF.Tooltip:AddLine("|cfff0c502"..(mainFrameRow.Name:GetText() or "Name not found").."|r", 1, 1, 1, true)
-- ** --
SF.Tooltip:AddLine(" ", 1, 1, 1, true)
SF.Tooltip:AddLine(mainFrameRow.Desc:GetText(), 1, 1, 1, true)
SF.Tooltip:Show()
end
end


that'a all. i think, the changes in the file StickyFrame.lua are not needed, this eliminates a other bug and the changes in the file Guides.lua, in the function DGV:Tooltip_OnEnter(self, event, ...) are not needed, this eliminates a other bug .

i hope, it's help many users and rythal and dugi can make a compatible version for us. i think, all changes are not completly right a i can say, it's work and i can use carbonite beta and dugi.

cu DeaTHCorE