Skip to content

Commit

Permalink
- Added priority class follow
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Feb 25, 2024
1 parent cd144fd commit eafe7dd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion extras/version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = '6e3960c 2024-02-25' }
return { commitId = 'cd144fd 2024-02-25' }
5 changes: 5 additions & 0 deletions modules/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,11 @@ function Module:GiveTime(combat_state)
-- dead... whoops
if mq.TLO.Me.Hovering() then return end

if RGMercUtils.ShouldPriorityFollow() then
RGMercsLogger.log_verbose("\arSkipping Class GiveTime because we are moving and follow is the priority.")
return
end

-- Main Module logic goes here.
if self.TempSettings.NewCombatMode then
RGMercsLogger.log_debug("New Combat Mode Requested: %s", self.ClassConfig.Modes[self.settings.Mode])
Expand Down
2 changes: 1 addition & 1 deletion modules/movement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Module.Constants.GGHZones = Set.new({ "poknowledge", "potranquility", "
Module.Constants.CampfireNameToKit = {
['Regular Fellowship'] = 1,
['Empowered Fellowship'] = 2,
['EScaled Wolf'] = 36,
['Scaled Wolf'] = 36,
}

Module.DefaultConfig = {
Expand Down
3 changes: 3 additions & 0 deletions utils/rgmercs_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ Config.DefaultConfig = {
-- [ ASSIST ] --
['OutsideAssistList'] = { DisplayName = "List of Outsiders to Assist", Category = "Assist", Tooltip = "List of Outsiders to Assist", Type = "Custom", Default = {}, ConfigType = "Advanced", },

-- [ MOVEMENT ] --
['PriorityFollow'] = { DisplayName = "Prioritize Follow", Category = "Movement", Tooltip = "If enabled you will follow more aggresively at the cost of rotations.", Default = false, ConfigType = "Advanced", },

-- [ BURNS ] --
['BurnSize'] = { DisplayName = "Do Burn Size", Category = "Burns", Tooltip = "0=Off, 1=Small, 2=Medium, 3=Large", Default = 1, Min = 0, Max = 3, ConfigType = "Advanced", },
['BurnAuto'] = { DisplayName = "Auto Burn", Category = "Burns", Tooltip = "Automatically burn", Default = false, ConfigType = "Normal", },
Expand Down
22 changes: 20 additions & 2 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,10 @@ function Utils.RunRotation(caller, rotationTable, targetId, resolvedActionMap, s
-- Used for bards to dynamically weave properly
if rotationTable.doFullRotation then start_step = 1 end
for idx, entry in ipairs(rotationTable) do
if Utils.ShouldPriorityFollow() then
break
end

if idx >= start_step then
RGMercsLogger.log_verbose("\aoDoing RunRotation(start(%d), step(%d), cur(%d))", start_step, steps, idx)
lastStepIdx = idx
Expand Down Expand Up @@ -1321,8 +1325,9 @@ end

---Returns a setting from either the global or a module setting table.
---@param setting string #name of setting to get
---@param failOk boolean? # if we cant find it that is okay.
---@return any|string|nil
function Utils.GetSetting(setting)
function Utils.GetSetting(setting, failOk)
local ret = { module = "Base", value = RGMercConfig:GetSettings()[setting], }

-- if we found it in the Global table we should alert if it is duplicated anywhere
Expand All @@ -1341,10 +1346,13 @@ function Utils.GetSetting(setting)
end
end


if ret.value ~= nil then
RGMercsLogger.log_super_verbose("\ag[Setting] \at'%s' \agfound in module \am%s", setting, ret.module)
else
RGMercsLogger.log_error("\ag[Setting] \at'%s' \aywas requested but not found in any module!", setting)
if not failOk then
RGMercsLogger.log_error("\ag[Setting] \at'%s' \aywas requested but not found in any module!", setting)
end
end

return ret.value
Expand Down Expand Up @@ -2003,6 +2011,16 @@ function Utils.DoBuffCheck()
return true
end

---@return boolean
function Utils.ShouldPriorityFollow()
local chaseSpawn = mq.TLO.Spawn("pc =" .. (Utils.GetSetting('ChaseTarget', true) or "NoOne"))
if chaseSpawn() and Utils.GetSetting('PriorityFollow') and Utils.GetSetting('ChaseOn') and (mq.TLO.Me.Moving() or (chaseSpawn.Distance() or 0) > Utils.GetSetting('ChaseDistance')) then
return true
end

return false
end

---@return boolean
function Utils.UseOrigin()
if mq.TLO.FindItem("=Drunkard's Stein").ID() or 0 > 0 and mq.TLO.Me.ItemReady("=Drunkard's Stein") then
Expand Down

0 comments on commit eafe7dd

Please sign in to comment.