Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of updates #3

Merged
merged 2 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions Mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ for ci,c in pairs{GetMapContinents()} do
end
end


local cache = {}
local function MapPoint(zone, x, y, desc)
TourGuide:DebugF(1, "Mapping %q - %s (%.2f, %.2f)", desc, zone, x, y)
Expand All @@ -22,18 +21,36 @@ local function MapPoint(zone, x, y, desc)
zone = zonenames[zc][zi]
end

if TomTom then TomTom:AddZWaypoint(zc, zi, x, y, "[TG] "..desc) --AddZWaypoint(c,z,x,y,desc) select(z, GetMapZones(c))
local opts = { title = "[TG] "..desc }
if TomTom then TomTom:AddMFWaypoint(zc, zi, x/100, y/100, opts) --AddZWaypoint(c,z,x,y,desc) select(z, GetMapZones(c))
elseif Cartographer_Waypoints then
local pt = NotePoint:new(zone, x/100, y/100, "[TG] "..desc)
Cartographer_Waypoints:AddWaypoint(pt)
table.insert(cache, pt.WaypointID)
end
end

function TourGuide:MapLightHeadedNPC(qid, action)
if not self.db.char.mapquestgivers then return end
local npcid, npcname, stype
LightHeaded:LoadQIDData(qid)

local title, level = LightHeaded:QIDToTitleLevel(qid)
if action == "ACCEPT" then _, _, _, _, stype, npcname, npcid = LightHeaded:GetQuestInfo(title, level)
else _, _, _, _, _, _, _, stype, npcname, npcid = LightHeaded:GetQuestInfo(title, level) end
self:DebugF(1, "LightHeaded lookup", action, qid, stype, npcname, npcid)
if stype ~= "npc" then return end

local data = LightHeaded:LoadNPCData(tonumber(npcid))
if not data then return end
local _,_,cid,zid,x,y = string.find(data,"([^,]+),([^,]+),([^,]+),([^:]+):")
MapPoint(zonenames[tonumber(cid)][tonumber(zid)], tonumber(x), tonumber(y), title.." ("..npcname..")")
return true
end

function TourGuide:ParseAndMapCoords(note, desc, zone)
function TourGuide:ParseAndMapCoords(qid, action, note, desc, zone)
if TomTom then
local Astrolabe = DongleStub("Astrolabe-0.4")
local Astrolabe = Astrolabe
local TomTom = TomTom

if TomTom.m_points then
Expand Down Expand Up @@ -72,8 +89,10 @@ function TourGuide:ParseAndMapCoords(note, desc, zone)
end
end

if not note then return end

for x,y in note:gmatch(L.COORD_MATCH) do MapPoint(zone, tonumber(x), tonumber(y), desc) end
if (action == "ACCEPT" or action == "TURNIN") and LightHeaded then
self:MapLightHeadedNPC(qid, action)
else
if not note then return end
for x,y in string.gfind(note, L.COORD_MATCH) do MapPoint(zone, tonumber(x), tonumber(y), desc) end
end
end

33 changes: 33 additions & 0 deletions OHDebug.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
local f = CreateFrame("ScrollingMessageFrame", nil, UIParent)
f:SetMaxLines(250)
f:SetFontObject(ChatFontNormal)
f:SetJustifyH("LEFT")
f:SetFading(false)
f:EnableMouseWheel(true)
f:SetScript("OnMouseWheel", function()
if (arg1 > 0) then
if IsShiftKeyDown() then
self:ScrollToTop()
else
self:ScrollUp()
end
elseif (arg1 < 0) then
if IsShiftKeyDown() then
self:ScrollToBottom()
else
self:ScrollDown()
end
end
end)
f:SetScript("OnHide", f.ScrollToBottom)
--f:Hide()


local orig = f.AddMessage
f.AddMessage = function(self, txt, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
local newtext = string.gsub(txt,"TourGuide|r:", date("%X").."|r", 1)
return orig(self, newtext, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
end


TourGuideOHDebugFrame = f
64 changes: 32 additions & 32 deletions OptionHouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ end

local function createScrollFrame(frame, displayNum, onScroll)
frame:EnableMouseWheel(true)
frame:SetScript("OnMouseWheel", onParentMouseWheel)
frame:SetScript("OnMouseWheel", function() onMouseWheel(frame, arg1) end)

frame.scroll = CreateFrame("ScrollFrame", nil, frame)
frame.scroll:EnableMouseWheel(true)
frame.scroll:SetWidth(16)
frame.scroll:SetHeight(270)
frame.scroll:SetScript("OnVerticalScroll", onVerticalScroll)
frame.scroll:SetScript("OnMouseWheel", onMouseWheel)
frame.scroll:SetScript("OnVerticalScroll", function() onVerticalScroll(frame.scroll, arg1) end)
frame.scroll:SetScript("OnMouseWheel", function() onMouseWheel(frame.scroll, arg1) end)

frame.scroll.offset = 0
frame.scroll.displayNum = displayNum
Expand Down Expand Up @@ -614,7 +614,7 @@ local function openConfigFrame(data)
data.frame:SetHeight(305)
end

data.frame:SetParent(frame)
--data.frame:SetParent(frame)
data.frame:SetFrameStrata("DIALOG")

if( not data.noCache ) then
Expand Down Expand Up @@ -661,7 +661,7 @@ local function displayCategoryRow(type, text, data, tooltip, highlighted)
if( frame.totalRows <= frame.scroll.offset or frame.rowID >= 15 ) then
return
end

frame.rowID = frame.rowID + 1

local button = frame.buttons[frame.rowID]
Expand Down Expand Up @@ -692,7 +692,7 @@ local function displayCategoryRow(type, text, data, tooltip, highlighted)
line:SetTexCoord(0, 0.4375, 0, 0.625)
line:Show()
end

button.fs = button:GetFontString()
button.tooltip = tooltip
button.data = data
Expand Down Expand Up @@ -749,7 +749,7 @@ local function updateConfigList(openAlso)
-- Total sub categories of the selected addons selected category
displayCategoryRow(subCat.type, subCat.name, subCat.data, subCat.tooltip, subCat.name == frame.selectedSubCat)
lastID = frame.rowID

if( openAlso ) then
opened = subCat.data
end
Expand All @@ -760,7 +760,7 @@ local function updateConfigList(openAlso)
if( lastID ) then
frame.lines[lastID]:SetTexCoord(0.4375, 0.875, 0, 0.625)
end

-- Okay open the category then
if( not opened and openAlso ) then
opened = cat.data
Expand All @@ -770,7 +770,7 @@ local function updateConfigList(openAlso)
end
end
end

if( not opened and openAlso ) then
opened = addon.data
end
Expand All @@ -779,7 +779,7 @@ local function updateConfigList(openAlso)
end
end
end

if( opened ) then
openConfigFrame(opened)
end
Expand All @@ -798,7 +798,7 @@ local function updateConfigList(openAlso)
else
button:SetWidth(156)
end

if( button.fs ) then
local wrapAt = wrapSize
if( button.type == "category" ) then
Expand All @@ -813,7 +813,7 @@ local function updateConfigList(openAlso)
button.fs:SetWidth(button.fs:GetStringWidth())
end
end

-- We have less then 15 rows used
-- and our index is equal or past our current
if( frame.rowID < 15 and i > frame.rowID ) then
Expand Down Expand Up @@ -931,7 +931,7 @@ local function createAddonFrame(hide)
if( frame.shownFrame ) then
frame.shownFrame:Hide()
end

updateConfigList()
ShowUIPanel(frame)
end
Expand Down Expand Up @@ -1100,7 +1100,7 @@ function OptionHouse.RegisterFrame(self, type, frame)
if( type ~= "addon" and type ~= "manage" and type ~= "perf" and type ~= "main" ) then
error(string.format(L["UNKNOWN_FRAMETYPE"], type), 3)
end

regFrames[type] = frame
OptionHouseFrames[type] = frame
end
Expand All @@ -1126,11 +1126,11 @@ function OptionHouse:Open(addonName, parentCat, childCat)
ShowUIPanel(frame)
return
end

regFrames.addon.selectedAddon = addonName or ""
regFrames.addon.selectedCategory = parentCat or ""
regFrames.addon.selectedSubCat = childCat or ""

updateConfigList(true)
ShowUIPanel(frame)
end
Expand Down Expand Up @@ -1258,7 +1258,7 @@ local function instanceLoaded()
if( oldRevision ) then
addons = OHInstance.addons or addons
evtFrame = OHInstance.evtFrame or evtFrame
tabfunctions = OHInstance.tabfunctions or tabfunctions
tabfunctions = OHInstance.tabfunctions or tabfunctions
else
-- Secure headers are supported so don't want the window stuck open in combat
evtFrame = CreateFrame("Frame")
Expand All @@ -1275,20 +1275,20 @@ local function instanceLoaded()
-- don't have to upgrade the referance because it just uses the slash command
-- which will upgrade below to use the current version anyway
if( not GameMenuButtonOptionHouse ) then
local menubutton = CreateFrame("Button", "GameMenuButtonOptionHouse", GameMenuFrame, "GameMenuButtonTemplate")
menubutton:SetText(L["OPTION_HOUSE"])
menubutton:SetScript("OnClick", function()
PlaySound("igMainMenuOption")
HideUIPanel(GameMenuFrame)
SlashCmdList["OPTHOUSE"]()
end)

-- Position below "Interface Options"
local a1, fr, a2, x, y = GameMenuButtonKeybindings:GetPoint()
menubutton:SetPoint(a1, fr, a2, x, y)

GameMenuButtonKeybindings:SetPoint(a1, menubutton, a2, x, y)
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 25)
-- local menubutton = CreateFrame("Button", "GameMenuButtonOptionHouse", GameMenuFrame, "GameMenuButtonTemplate")
-- menubutton:SetText(L["OPTION_HOUSE"])
-- menubutton:SetScript("OnClick", function()
-- PlaySound("igMainMenuOption")
-- HideUIPanel(GameMenuFrame)
-- SlashCmdList["OPTHOUSE"]()
-- end)
--
-- -- Position below "Interface Options"
-- local a1, fr, a2, x, y = GameMenuButtonKeybindings:GetPoint()
-- menubutton:SetPoint(a1, fr, a2, x, y)
--
-- GameMenuButtonKeybindings:SetPoint(a1, menubutton, a2, x, y)
-- GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 25)
end
end

Expand All @@ -1314,7 +1314,7 @@ local function instanceLoaded()
OptionHouse:Open(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
end
end

-- Now make it active
for k, v in pairs(OptionHouse) do
OHInstance[k] = v
Expand Down
13 changes: 7 additions & 6 deletions OptionsFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ trackquestcheck.text:SetText("Automatically Track Quests")

ww.SetFadeTime(frame, 0.7)

trackquestcheck:SetScript("OnClick", function()
trackquestcheck:SetScript("OnClick", function()
TourGuide.db.char.trackquests = not TourGuide.db.char.trackquests
end)

Expand All @@ -56,8 +56,9 @@ end)

table.insert(UISpecialFrames, "TourGuideOptions")

--if tekDebug then
-- local b = CreateButton(frame, "TOP", trackquestcheck, "BOTTOM")
-- b:SetText("Debug All")
-- b:SetScript("OnClick", function() frame:Hide(); self:DebugGuideSequence(true) LibStub("OptionHouse-1.1"):Open("tekDebug", "TourGuide") end)
--end
-- if tekDebug then
-- local b = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
-- b:SetPoint("TOP", trackquestcheck, "BOTTOM", 0, -10)
-- b:SetText("Debug All")
-- b:SetScript("OnClick", function() frame:Hide(); self:DebugGuideSequence(true) LibStub("OptionHouse-1.1"):Open("tekDebug", "TourGuide") end)
-- end
9 changes: 4 additions & 5 deletions Parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ function TourGuide:GetObjectiveTag(tag, i)
local tags = self.tags[i]
if not tags then return end

if tag == "O" then return string.find(tags,"|O|")
elseif tag == "T" then return string.find(tags,"|T|")
if tag == "O" then return select(3, string.find(tags,"|O|"))
elseif tag == "T" then return select(3, string.find(tags,"|T|"))
elseif tag == "QID" then return select(3, string.find(tags, "|QID|(%d+)|"))
elseif tag == "L" then
local _, _, lootitem, lootqty = string.find(tags,"|L|(%d+)%s?(%d*)|")
lootqty = tonumber(lootqty) or 1
Expand Down Expand Up @@ -68,7 +69,7 @@ local function DebugQuestObjective(text, action, quest, accepts, turnins, comple
end
end

if string.find(text,"[���]") then
if string.find(text,"[���]") then
TourGuide:DebugF(1, "%s %s -- Contains bad char", action, quest)
haserrors = true
end
Expand Down Expand Up @@ -174,5 +175,3 @@ function TourGuide:DebugGuideSequence(dumpquests)
self:Debug(1, "Last zone loaded:", lastzone)
self:Debug(1, "------ End Full Debug ------")
end


2 changes: 1 addition & 1 deletion QuestTracking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ end

local orig = GetQuestReward
GetQuestReward = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
local quest = GetTitleText()
local quest = string.gsub(GetTitleText(), "%[%d+%]%s", "")
TourGuide:Debug(10, "GetQuestReward", quest)
TourGuide:CompleteQuest(quest, true)

Expand Down
9 changes: 4 additions & 5 deletions StatusFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function TourGuide:UpdateStatusFrame()
repeat
action = self:GetObjectiveInfo(j)
turnedin, logi, complete = self:GetObjectiveStatus(j)
if action == "COMPLETE" and logi and not complete then AddQuestWatch(logi) -- Watch if we're in a 'COMPLETE' block
if action == "COMPLETE" and logi and not complete then if not IsQuestWatched(logi) then AddQuestWatch(logi) end-- Watch if we're in a 'COMPLETE' block
elseif action == "COMPLETE" and logi then RemoveQuestWatch(logi) end -- or unwatch if done
j = j + 1
until action ~= "COMPLETE"
Expand All @@ -206,14 +206,14 @@ function TourGuide:UpdateStatusFrame()
self.current = nextstep
local action, quest, fullquest = self:GetObjectiveInfo(nextstep)
local turnedin, logi, complete = self:GetObjectiveStatus(nextstep)
local note, useitem, optional = self:GetObjectiveTag("N", nextstep), self:GetObjectiveTag("U", nextstep), self:GetObjectiveTag("O", nextstep)
local note, useitem, optional, qid = self:GetObjectiveTag("N", nextstep), self:GetObjectiveTag("U", nextstep), self:GetObjectiveTag("O", nextstep), self:GetObjectiveTag("QID", nextstep)
local zonename = self:GetObjectiveTag("Z", nextstep) or self.zonename
self:DebugF(1, "Progressing to objective \"%s %s\"", action, quest)

-- Mapping
if (TomTom or Cartographer_Waypoints) and (lastmapped ~= quest or lastmappedaction ~= action) then
lastmappedaction, lastmapped = action, quest
self:ParseAndMapCoords(note, quest, zonename) --, zone)
self:ParseAndMapCoords(qid, action, note, quest, zonename) --, zone)
end


Expand Down Expand Up @@ -265,7 +265,7 @@ end

f:SetScript("OnClick", function()
local self, btn = this, arg1
if TourGuide.db.char.currentguide == "No Guide" then
if TourGuide.db.char.currentguide == "No Guide" then
OptionHouse:Open("Tour Guide", "Guides")
else
if btn == "RightButton" then
Expand Down Expand Up @@ -357,4 +357,3 @@ item:SetScript("OnDragStop", function()
TourGuide.db.profile.itemframepoint, _, _, TourGuide.db.profile.itemframex, TourGuide.db.profile.itemframey = frame:GetPoint()
--TourGuide.db.profile.itemframepoint, TourGuide.db.profile.itemframex, TourGuide.db.profile.itemframey = GetUIParentAnchor(frame)
end)

Loading