Skip to content

Commit

Permalink
feat: expedition status
Browse files Browse the repository at this point in the history
added rudimentary expedition status
  • Loading branch information
grimmier378 committed May 19, 2024
1 parent 76e4fdd commit 691b286
Showing 1 changed file with 114 additions and 27 deletions.
141 changes: 114 additions & 27 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,135 @@ Icons = require('mq.ICONS')
local ImGui = require 'ImGui'
-- Variables
local AdvWIN = mq.TLO.Window('AdventureRequestWnd')
local ExpWIN = mq.TLO.Window('DynamicZoneWnd')
local adv, exp = false, false
local guiOpen = false
local eqWinOpen = false
local eqWinAdvOpen, eqWinExpOpen = false, false
local groupCmd = '/dgae '
local mode = 'DanNet'
local winFlags = bit32.bor(ImGuiWindowFlags.NoCollapse,ImGuiWindowFlags.NoTitleBar,ImGuiWindowFlags.AlwaysAutoResize)
local locked = false
--Helpers
local function checkAdv()
-- check for active adventure timers.Either time to enter dungeon or time to complete.
if AdvWIN.Child('AdvRqst_EnterTimeLeftLabel').Text() ~= '' then
adv = true
return string.format('Time to Enter Left: %s',AdvWIN.Child('AdvRqst_EnterTimeLeftLabel').Text())
elseif AdvWIN.Child('AdvRqst_CompleteTimeLeftLabel').Text() ~= '' then
adv =true
return string.format('Time to Complete Left: %s',AdvWIN.Child('AdvRqst_CompleteTimeLeftLabel').Text())
else
adv = false
-- no active timers, so we are not in an adventure.
return tostring('No Adventure Started')
end
end
local function checkExp()
if ExpWIN.Child('DZ_CurrentDZValue').Text() ~= 'NULL' then
exp = true
return string.format(ExpWIN.Child('DZ_CurrentDZValue').Text())
else
exp = false
return tostring('No Expedition Started')
end

end

--GUI
function GUI_AdvStatus(open)
if mq.TLO.Me.Zoning() then return end
if guiOpen then
if locked then
winFlags = bit32.bor(ImGuiWindowFlags.NoCollapse,ImGuiWindowFlags.NoTitleBar,ImGuiWindowFlags.AlwaysAutoResize,ImGuiWindowFlags.NoMove)
else
winFlags = bit32.bor(ImGuiWindowFlags.NoCollapse,ImGuiWindowFlags.NoTitleBar,ImGuiWindowFlags.AlwaysAutoResize)
end
local show = false
open, show = ImGui.Begin("SAST##"..mq.TLO.Me.DisplayName(), open, bit32.bor(ImGuiWindowFlags.NoCollapse,ImGuiWindowFlags.NoTitleBar,ImGuiWindowFlags.AlwaysAutoResize))
open, show = ImGui.Begin("SAST##"..mq.TLO.Me.DisplayName(), open, winFlags)
if not show then
ImGui.End()
return open
end
ImGui.Text("Adventure Status: \t")
ImGui.SameLine()
ImGui.Text( AdvWIN.Child('AdvRqst_ProgressTextLabel').Text() or 'None')
ImGui.SameLine(220)
ImGui.Text(Icons.MD_HELP_OUTLINE)
if ImGui.IsItemHovered() then
if ImGui.IsMouseReleased(0) then
eqWinOpen = AdvWIN.Open()
if not eqWinOpen then
AdvWIN.DoOpen()
eqWinOpen = true
else
AdvWIN.DoClose()
eqWinOpen = false
local iconLocked = locked and Icons.FA_LOCK or Icons.FA_UNLOCK
if adv then
ImGui.PushStyleColor(ImGuiCol.Text, ImVec4( 1.00, 0.454, 0.000, 1.000))
ImGui.PushStyleColor(ImGuiCol.Separator,ImVec4(1.00, 0.454, 0.000, 1.000))
ImGui.Text("Adventure Status: \t")
ImGui.SameLine()
ImGui.Text( AdvWIN.Child('AdvRqst_ProgressTextLabel').Text() or 'None')
ImGui.SameLine(220)
ImGui.Text(Icons.MD_HELP_OUTLINE)
if ImGui.IsItemHovered() then
if ImGui.IsMouseReleased(0) then
eqWinAdvOpen = AdvWIN.Open()
if not eqWinAdvOpen then
AdvWIN.DoOpen()
eqWinAdvOpen = true
else
AdvWIN.DoClose()
eqWinAdvOpen = false
end
end
ImGui.BeginTooltip()
ImGui.PushTextWrapPos(250)
ImGui.Text("Click to Open InGame\nQuest Information:" )
ImGui.Separator()
ImGui.Text(AdvWIN.Child('AdvRqst_NPCText').Text() or 'No Adventure')
ImGui.PopTextWrapPos()
ImGui.EndTooltip()
end
ImGui.SameLine()
ImGui.Text(iconLocked)
if ImGui.IsItemHovered() then
if ImGui.IsMouseReleased(0) then
locked = not locked
end
end
ImGui.BeginTooltip()
ImGui.PushTextWrapPos(250)
ImGui.Text("Click to Open InGame\nQuest Information:" )
ImGui.Separator()
ImGui.Text(AdvWIN.Child('AdvRqst_NPCText').Text() or 'No Adventure')
ImGui.PopTextWrapPos()
ImGui.EndTooltip()
ImGui.Text(checkAdv())
ImGui.PopStyleColor(2)
end
if exp and adv then ImGui.Separator() end
if exp then
ImGui.PushStyleColor(ImGuiCol.Text, ImVec4(0.000, 0.833, 0.751, 1.000))
ImGui.PushStyleColor(ImGuiCol.Separator,ImVec4(0.00, 0.833, 0.751, 1.000))
ImGui.Text("Expedition Status:")
ImGui.SameLine(220)
ImGui.Text(Icons.MD_HELP_OUTLINE)
if ImGui.IsItemHovered() then
if ImGui.IsMouseReleased(0) then
eqWinExpOpen = ExpWIN.Open()
if not eqWinExpOpen then
ExpWIN.DoOpen()
eqWinExpOpen = true
else
ExpWIN.DoClose()
eqWinExpOpen = false
end
end
ImGui.BeginTooltip()
ImGui.PushTextWrapPos(250)
ImGui.Text("Click to Open InGame\nQuest Information:" )
ImGui.Separator()
ImGui.Text(ExpWIN.Child('DZ_CurrentDZValue').Text() or 'No Expedition')
ImGui.PopTextWrapPos()
ImGui.EndTooltip()
end
if not adv then
ImGui.SameLine()
ImGui.Text(iconLocked)
if ImGui.IsItemHovered() then
if ImGui.IsMouseReleased(0) then
locked = not locked
end
end
end
ImGui.Separator()
ImGui.Text(checkExp())
ImGui.PopStyleColor(2)
end
ImGui.Separator()
ImGui.Text(checkAdv())
ImGui.End()

return open
end
end
Expand Down Expand Up @@ -97,19 +173,30 @@ end

local function loop()
while true do

if mq.TLO.Window('CharacterListWnd').Open() then return false end
if mq.TLO.Me.Zoning() then mq.delay('5s') end
if checkAdv() ~= 'No Adventure Started' then
local advActive = checkAdv() ~= 'No Adventure Started'
local expActive = checkExp() ~= 'No Expedition Started'
if advActive or expActive then
guiOpen = true
if not AdvWIN.Open() and eqWinOpen then eqWinOpen = false end -- if we opened through GUI and closed in game reset flag.
if not AdvWIN.Open() and eqWinAdvOpen and advActive then eqWinAdvOpen = false end -- if we opened through GUI and closed in game reset flag.
if not ExpWIN.Open() and eqWinExpOpen and expActive then eqWinExpOpen = false end
-- if ingame window is open and we didn't set the flag close it on all characters. we most likely zoned or just accepted the quest.
if not eqWinOpen and AdvWIN.Open() then
if not eqWinAdvOpen and AdvWIN.Open() then
if mode == 'Solo' then
AdvWIN.DoClose()
else
mq.cmdf('/noparse %s/lua parse mq.TLO.Window("AdventureRequestWnd").DoClose()',groupCmd)
end
end
if not eqWinExpOpen and ExpWIN.Open() then
if mode == 'Solo' then
ExpWIN.DoClose()
else
mq.cmdf('/noparse %s/lua parse mq.TLO.Window("DynamicZoneWnd").DoClose()',groupCmd)
end
end
else
guiOpen = false
end
Expand Down

0 comments on commit 691b286

Please sign in to comment.