Skip to content

Commit

Permalink
lots of syntax fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 1, 2024
1 parent 30196d7 commit 18c2882
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 41 deletions.
8 changes: 4 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RGMercModules = require("utils.rgmercs_modules").load()
-- ImGui Variables
local openGUI = true
local shouldDrawGUI = true
local BgOpacity = tonumber(RGMercConfig:GetSettings().BgOpacity)
local BgOpacity = tonumber(RGMercConfig:GetSettings().BgOpacity) or 1.0

local curState = "Downtime"

Expand All @@ -26,8 +26,8 @@ local animItems = mq.FindTextureAnimation("A_DragItem")
local animBox = mq.FindTextureAnimation("A_RecessedBox")

-- Constants
local ICON_WIDTH = 40
local ICON_HEIGHT = 40
local ICON_WIDTH = 45
local ICON_HEIGHT = 45
local COUNT_X_OFFSET = 39
local COUNT_Y_OFFSET = 23
local EQ_ICON_OFFSET = 500
Expand Down Expand Up @@ -166,7 +166,7 @@ local function RGMercsGUI()
ImGui.NewLine()
ImGui.Separator()

BgOpacity, pressed = ImGui.SliderFloat("BG Opacity", BgOpacity, 0, 1.0, "%.1f", 0.1)
BgOpacity, pressed = ImGui.SliderFloat("BG Opacity", BgOpacity, 0, 1.0, "%.1f")
if pressed then
RGMercConfig:GetSettings().BgOpacity = tostring(BgOpacity)
RGMercConfig:SaveSettings(true)
Expand Down
32 changes: 16 additions & 16 deletions modules/movement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ local RGMercUtils = require("utils.rgmercs_utils")
local ICONS = require('mq.Icons')
local Set = require("mq.Set")

local Module = { _version = '0.1a', name = "Movement", author = 'Derple' }
local Module = { _version = '0.1a', name = "Movement", author = 'Derple', }
Module.__index = Module

Module.TempSettings = {}
Module.TempSettings.CampZoneId = 0

Module.DefaultConfig = {
['AutoCampRadius'] = { DisplayName = "Auto Camp Radius", Category = "Camp", Tooltip = "Return to camp after you get this far away", Default = 60, Min = 10, Max = 150 },
['ChaseOn'] = { DisplayName = "Chase On", Category = "Chase", Tooltip = "Chase your Chase Target.", Default = false },
['ChaseDistance'] = { DisplayName = "Chase Distance", Category = "Chase", Tooltip = "How Far your Chase Target can get before you Chase.", Default = 25, Min = 5, Max = 100 },
['ChaseTarget'] = { DisplayName = "Chase Target", Category = "Chase", Tooltip = "Character you are Chasing", Type = "Custom", Default = "" },
['ReturnToCamp'] = { DisplayName = "Return To Camp", Category = "Camp", Tooltip = "Return to Camp After Combat (requires you to /rgl campon)", Default = (not RGMercConfig.Constants.RGTank:contains(mq.TLO.Me.Class.ShortName())) },
['MaintainCampfire'] = { DisplayName = "Maintain Campfire", Category = "Camp", Tooltip = "0: Off; 1: Regular Fellowship; 2: Empowered Fellowship; 36: Scaled Wolf", Default = 1, Min = 0, Max = 36 },
['RequireLoS'] = { DisplayName = "Require LOS", Category = "Chase", Tooltip = "Require LOS when using /nav", Default = RGMercConfig.Constants.RGCasters:contains(mq.TLO.Me.Class.ShortName()) },
['AutoCampRadius'] = { DisplayName = "Auto Camp Radius", Category = "Camp", Tooltip = "Return to camp after you get this far away", Default = 60, Min = 10, Max = 150, },
['ChaseOn'] = { DisplayName = "Chase On", Category = "Chase", Tooltip = "Chase your Chase Target.", Default = false, },
['ChaseDistance'] = { DisplayName = "Chase Distance", Category = "Chase", Tooltip = "How Far your Chase Target can get before you Chase.", Default = 25, Min = 5, Max = 100, },
['ChaseTarget'] = { DisplayName = "Chase Target", Category = "Chase", Tooltip = "Character you are Chasing", Type = "Custom", Default = "", },
['ReturnToCamp'] = { DisplayName = "Return To Camp", Category = "Camp", Tooltip = "Return to Camp After Combat (requires you to /rgl campon)", Default = (not RGMercConfig.Constants.RGTank:contains(mq.TLO.Me.Class.ShortName())), },
['MaintainCampfire'] = { DisplayName = "Maintain Campfire", Category = "Camp", Tooltip = "0: Off; 1: Regular Fellowship; 2: Empowered Fellowship; 36: Scaled Wolf", Default = 1, Min = 0, Max = 36, },
['RequireLoS'] = { DisplayName = "Require LOS", Category = "Chase", Tooltip = "Require LOS when using /nav", Default = RGMercConfig.Constants.RGCasters:contains(mq.TLO.Me.Class.ShortName()), },
}

Module.DefaultCategories = Set.new({})
Expand Down Expand Up @@ -72,7 +72,7 @@ end

function Module.New()
RGMercsLogger.log_info("Chase Module Loaded.")
local newModule = setmetatable({ settings = {} }, Module)
local newModule = setmetatable({ settings = {}, }, Module)

newModule:LoadSettings()

Expand Down Expand Up @@ -120,20 +120,20 @@ end

function Module:DestoryCampfire()
mq.TLO.Window("FellowshipWnd").DoOpen()
mq.delay("3s", mq.TLO.Window("FellowshipWnd").Open())
mq.delay("3s", function() return mq.TLO.Window("FellowshipWnd").Open() end)
---@diagnostic disable-next-line: undefined-field
mq.TLO.Window("FellowshipWnd").Child("FP_Subwindows").SetCurrentTab(2)

if mq.TLO.Me.Fellowship.Campfire() then
if mq.TLO.Zone.ID() ~= mq.TLO.Me.Fellowship.CampfireZone.ID() then
mq.TLO.Window("FellowshipWnd").Child("FP_DestroyCampsite").LeftMouseUp()
mq.delay("5s", mq.TLO.Window("ConfirmationDialogBox").Open())
mq.delay("5s", function() return mq.TLO.Window("ConfirmationDialogBox").Open() end)

if mq.TLO.Window("ConfirmationDialogBox").Open() then
mq.TLO.Window("ConfirmationDialogBox").Child("Yes_Button").LeftMouseUp()
end

mq.delay("5s", mq.TLO.Me.Fellowship.Campfire() == nil)
mq.delay("5s", function() return mq.TLO.Me.Fellowship.Campfire() == nil end)
end
end
mq.TLO.Window("FellowshipWnd").DoClose()
Expand Down Expand Up @@ -174,20 +174,20 @@ function Module:Campfire(camptype)

if fellowCount >= 3 then
mq.TLO.Window("FellowshipWnd").DoOpen()
mq.delay("3s", mq.TLO.Window("FellowshipWnd").Open())
mq.delay("3s", function() return mq.TLO.Window("FellowshipWnd").Open() end)
---@diagnostic disable-next-line: undefined-field
mq.TLO.Window("FellowshipWnd").Child("FP_Subwindows").SetCurrentTab(2)

if mq.TLO.Me.Fellowship.Campfire() then
if mq.TLO.Zone.ID() ~= mq.TLO.Me.Fellowship.CampfireZone.ID() then
mq.TLO.Window("FellowshipWnd").Child("FP_DestroyCampsite").LeftMouseUp()
mq.delay("5s", mq.TLO.Window("ConfirmationDialogBox").Open())
mq.delay("5s", function() return mq.TLO.Window("ConfirmationDialogBox").Open() end)

if mq.TLO.Window("ConfirmationDialogBox").Open() then
mq.TLO.Window("ConfirmationDialogBox").Child("Yes_Button").LeftMouseUp()
end

mq.delay("5s", mq.TLO.Me.Fellowship.Campfire() == nil)
mq.delay("5s", function() return mq.TLO.Me.Fellowship.Campfire() == nil end)
end
end

Expand All @@ -197,7 +197,7 @@ function Module:Campfire(camptype)
mq.TLO.Window("FellowshipWnd").Child("FP_CampsiteKitList").Select(self.settings.MaintainCampfire or camptype)
mq.delay("1s")
mq.TLO.Window("FellowshipWnd").Child("FP_CreateCampsite").LeftMouseUp()
mq.delay("5s", mq.TLO.Me.Fellowship.Campfire() ~= nil)
mq.delay("5s", function() return mq.TLO.Me.Fellowship.Campfire() ~= nil end)
mq.TLO.Window("FellowshipWnd").DoClose()

RGMercsLogger.log_info("\agCampfire Dropped")
Expand Down
41 changes: 21 additions & 20 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ function Utils.HandleDeath()
end

---@diagnostic disable-next-line: undefined-field
mq.delay("1m", (not mq.TLO.Me.Zoning()))
mq.delay("1m", function() return (not mq.TLO.Me.Zoning()) end)

if RGMercConfig:GetSettings().DoFellow then
if mq.TLO.FindItem("Fellowship Registration Insignia").Timer() == 0 then
mq.delay("30s", (mq.TLO.Me.CombatState():lower() == "active"))
mq.delay("30s", function() return (mq.TLO.Me.CombatState():lower() == "active") end)
mq.cmdf("/useitem \"Fellowship Registration Insignia\"")
mq.delay("2s", (mq.TLO.FindItem("Fellowship Registration Insignia").Timer() ~= 0))
mq.delay("2s", function() return (mq.TLO.FindItem("Fellowship Registration Insignia").Timer() ~= 0) end)
else
RGMercsLogger.log_error("\aw Bummer, Insignia on cooldown, you must really suck at this game...")
end
Expand Down Expand Up @@ -269,7 +269,7 @@ end
function Utils.ActionPrep()
if not mq.TLO.Me.Standing() then
mq.TLO.Me.Stand()
mq.delay(10, mq.TLO.Me.Standing())
mq.delay(10, function() return mq.TLO.Me.Standing() end)

RGMercConfig.Globals.InMedState = false
end
Expand All @@ -284,7 +284,7 @@ function Utils.UseItem(itemName, targetId)

if mq.TLO.Window("CastingWindow").Open() or me.Casting.ID() then
if me.Class.ShortName():lower() == "brd" then
mq.delay("3s", not mq.TLO.Window("CastingWindow").Open())
mq.delay("3s", function() return not mq.TLO.Window("CastingWindow").Open() end)
mq.delay(10)
mq.cmdf("/stopsong")
else
Expand Down Expand Up @@ -325,7 +325,7 @@ function Utils.UseItem(itemName, targetId)
local oldTargetId = Utils.GetTargetID()
if targetId > 0 then
mq.cmdf("/target id %d", targetId)
mq.delay("2s", Utils.GetTargetID() == targetId)
mq.delay("2s", function() return Utils.GetTargetID() == targetId end)
end

RGMercsLogger.log_debug("\aw Using Item \ag %s", itemName)
Expand All @@ -340,7 +340,7 @@ function Utils.UseItem(itemName, targetId)
-- slight delay for instant casts
mq.delay(4)
else
mq.delay(item.CastTime(), not me.Casting.ID())
mq.delay(item.CastTime(), function() return not me.Casting.ID() end)

-- pick up any additonal server lag.
while me.Casting.ID() do
Expand All @@ -355,7 +355,7 @@ function Utils.UseItem(itemName, targetId)

if oldTargetId > 0 then
mq.cmdf("/target id %d", oldTargetId)
mq.delay("2s", Utils.GetTargetID() == oldTargetId)
mq.delay("2s", function() return Utils.GetTargetID() == oldTargetId end)
else
mq.cmdf("/target clear")
end
Expand Down Expand Up @@ -432,7 +432,7 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)

if mq.TLO.Window("CastingWindow").Open() or me.Casting.ID() then
if me.Class.ShortName():lower() == "brd" then
mq.delay("3s", not mq.TLO.Window("CastingWindow").Open())
mq.delay("3s", function() return (not mq.TLO.Window("CastingWindow").Open()) end)
mq.delay(10)
mq.cmdf("/stopsong")
else
Expand All @@ -459,7 +459,7 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)
if me.Combat() and target.Type():lower() == "pc" then
RGMercsLogger.log_info("\awNOTICE:\ax Turning off autoattack to cast on a PC.")
mq.cmdf("/attack off")
mq.delay("2s", not me.Combat())
mq.delay("2s", function() return not me.Combat() end)
end

Utils.SetTarget(targetId)
Expand All @@ -469,7 +469,7 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)

mq.cmdf(cmd)

mq.delay(5, not Utils.AAReady(e.name))
mq.delay(5, function() return not Utils.AAReady(e.name) end)

if me.AltAbility(e.name).Spell.MyCastTime.TotalSeconds() > 0 then
Utils.WaitCastFinish(target)
Expand All @@ -483,7 +483,7 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)

if e.type:lower() == "ability" then
mq.cmdf("/doability %s", e.name)
mq.delay(8, not me.AbilityReady(e.name))
mq.delay(8, function() return not me.AbilityReady(e.name) end)
RGMercsLogger.log_debug("Using Ability \ao =>> \ag %s \ao <<=", e.name)

return
Expand Down Expand Up @@ -522,17 +522,17 @@ function Utils.ExecEntry(e, targetId, map, bAllowMem)
if me.ActiveDisc.ID() then
RGMercsLogger.log_debug("Cancelling Disc for %s -- Active Disc: [%s]", discSpell.RankName(), me.ActiveDisc.Name())
mq.cmdf("/stopdisc")
mq.delay(20, not me.ActiveDisc.ID())
mq.delay(20, function() return not me.ActiveDisc.ID() end)
end
end

mq.cmdf("/squelch /doability \"%s\"", discSpell.RankName())

mq.delay(discSpell.MyCastTime() / 100 or 100, (not me.CombatAbilityReady(discSpell.RankName()) and not me.Casting.ID()))
mq.delay(discSpell.MyCastTime() / 100 or 100, function() return (not me.CombatAbilityReady(discSpell.RankName()) and not me.Casting.ID()) end)

-- Is this even needed?
if Utils.IsDisc(discSpell.RankName()) then
mq.delay(20, me.ActiveDisc.ID())
mq.delay(20, function() return me.ActiveDisc.ID() end)
end

RGMercsLogger.log_debug("\aw Cast >>> \ag %s", discSpell.RankName())
Expand Down Expand Up @@ -608,7 +608,7 @@ function Utils.SelfBuffAACheck(aaName)
not mq.TLO.Me.FindBuff("id " .. tostring(mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1).ID())).ID() and
not mq.TLO.Me.Aura(tostring(mq.TLO.Spell(aaName).RankName())).ID() and
mq.TLO.Spell(mq.TLO.Me.AltAbility(aaName).Spell.RankName()).Stacks() and
(not mq.TLO.Spell(mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1))() or mq.TLO.Spell(mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1)).Stacks())
(not mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1).ID() or mq.TLO.Me.AltAbility(aaName).Spell.Trigger(1).Stacks())
end

function Utils.DotSpellCheck(config, spell)
Expand Down Expand Up @@ -643,6 +643,7 @@ function Utils.GetTargetID()
end

function Utils.GetTargetAggroPct()
---@diagnostic disable-next-line: undefined-field
return (mq.TLO.Target.PctAggro() or 0)
end

Expand Down Expand Up @@ -1507,7 +1508,7 @@ function Utils.DrawInspectableSpellIcon(iconID, spell)
end

function Utils.RenderLoadoutTable(t)
if ImGui.BeginTable("Spells", 5, ImGuiTableFlags.Resizable + ImGuiTableFlags.Borders) then
if ImGui.BeginTable("Spells", 5, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Borders)) then
ImGui.PushStyleColor(ImGuiCol.Text, 1.0, 0.0, 1.0, 1)
ImGui.TableSetupColumn('Icon', (ImGuiTableColumnFlags.WidthFixed), 20.0)
ImGui.TableSetupColumn('Gem', (ImGuiTableColumnFlags.WidthFixed), 20.0)
Expand Down Expand Up @@ -1564,7 +1565,7 @@ function Utils.RenderRotationTableKey()
end

function Utils.RenderRotationTable(s, n, t, map, rotationState)
if ImGui.BeginTable("Rotation_" .. n, rotationState and 4 or 3, ImGuiTableFlags.Resizable + ImGuiTableFlags.Borders) then
if ImGui.BeginTable("Rotation_" .. n, rotationState and 4 or 3, bit32.bor(ImGuiTableFlags.Resizable, ImGuiTableFlags.Borders)) then
ImGui.PushStyleColor(ImGuiCol.Text, 1.0, 0.0, 1.0, 1)
ImGui.TableSetupColumn('ID', ImGuiTableColumnFlags.WidthFixed, 20.0)
if rotationState then
Expand Down Expand Up @@ -1663,8 +1664,8 @@ end
function Utils.RenderOptionNumber(id, text, cur, min, max)
ImGui.PushID("##num_spin_" .. id)
ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0.5, 0.5, 0.5, 1.0)
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0.5, 0.5, 0.5, 0.5)
ImGui.PushStyleColor(ImGuiCol.Button, 1.0, 1.0, 1.0, 0)
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0.5, 0.5, 0.5, 0.8)
ImGui.PushStyleColor(ImGuiCol.Button, 1.0, 1.0, 1.0, 0.2)
ImGui.PushStyleColor(ImGuiCol.FrameBg, 1.0, 1.0, 1.0, 0)
local input, changed = ImGui.InputInt(text, cur)
ImGui.PopStyleColor(4)
Expand Down
2 changes: 1 addition & 1 deletion version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = '20a658f 2024-01-01' }
return { commitId = '30196d7 2024-01-01' }

0 comments on commit 18c2882

Please sign in to comment.