Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Feb 26, 2024
2 parents e9c21ba + d1ba639 commit f449adb
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 11 deletions.
21 changes: 17 additions & 4 deletions class_configs/mag_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,19 @@ _ClassConfig = {
end,
custom_func = function(self) return self.ClassConfig.HelperFunctions.summon_pet(self) end,
},
{
name = "Drop Cursor Items",
type = "CustomFunc",
cond = function(self)
return mq.TLO.Cursor() and mq.TLO.Cursor.ID() > 0
end,
custom_func = function(self)
if mq.TLO.Cursor() and mq.TLO.Cursor.ID() > 0 then
RGMercsLogger.log_info("Sending Item(%s) on Cursor to Bag", mq.TLO.Cursor())
RGMercUtils.DoCmd("/autoinventory")
end
end,
},
},
['Burn'] = {
{
Expand All @@ -1194,12 +1207,12 @@ _ClassConfig = {
cond = function(self)
if not self.ResolvedActionMap['EarthPetItemSummon'] then return false end
local baseItem = self.ResolvedActionMap['EarthPetItemSummon'].RankName.Base(1)()
return mq.TLO.FindItemCount(baseItem)() > 1
return mq.TLO.FindItemCount(baseItem)() >= 1
end,
custom_func = function(self)
if not self.ResolvedActionMap['EarthPetItemSummon'] then return false end
local baseItem = self.ResolvedActionMap['EarthPetItemSummon'].RankName.Base(1)()
if mq.TLO.FindItemCount(baseItem)() > 1 then
if mq.TLO.FindItemCount(baseItem)() >= 1 then
local invItem = mq.TLO.FindItem(baseItem)
return RGMercUtils.UseItem(invItem.Name(), mq.TLO.Me.ID())
end
Expand All @@ -1213,12 +1226,12 @@ _ClassConfig = {
cond = function(self)
if not self.ResolvedActionMap['FirePetItemSummon'] then return false end
local baseItem = self.ResolvedActionMap['FirePetItemSummon'].RankName.Base(1)()
return mq.TLO.FindItemCount(baseItem)() > 1
return mq.TLO.FindItemCount(baseItem)() >= 1
end,
custom_func = function(self)
if not self.ResolvedActionMap['FirePetItemSummon'] then return false end
local baseItem = self.ResolvedActionMap['FirePetItemSummon'].RankName.Base(1)()
if mq.TLO.FindItemCount(baseItem)() > 1 then
if mq.TLO.FindItemCount(baseItem)() >= 1 then
local invItem = mq.TLO.FindItem(baseItem)
return RGMercUtils.UseItem(invItem.Name(), mq.TLO.Me.ID())
end
Expand Down
2 changes: 1 addition & 1 deletion extras/version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = 'eafe7dd 2024-02-25' }
return { commitId = '554c532 2024-02-25' }
39 changes: 37 additions & 2 deletions modules/pull.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Module.TempSettings.AbortPull = false
Module.TempSettings.PullID = 0
Module.TempSettings.LastPullAbilityCheck = 0
Module.TempSettings.LastPullerMercChec = 0
Module.TempSettings.HuntX = 0
Module.TempSettings.HuntY = 0
Module.TempSettings.HuntZ = 0


local PullStates = {
Expand Down Expand Up @@ -135,6 +138,7 @@ Module.DefaultConfig = {
['PullRadius'] = { DisplayName = "Pull Radius", Category = "Pull Distance", Tooltip = "Distnace to pull", Default = 350, Min = 1, Max = 10000, },
['PullZRadius'] = { DisplayName = "Pull Z Radius", Category = "Pull Distance", Tooltip = "Distnace to pull on Z axis", Default = 90, Min = 1, Max = 150, },
['PullRadiusFarm'] = { DisplayName = "Pull Radius Farm", Category = "Pull Distance", Tooltip = "Distnace to pull in Farm mode", Default = 90, Min = 1, Max = 10000, },
['PullRadiusHunt'] = { DisplayName = "Pull Radius Hunt", Category = "Pull Distance", Tooltip = "Distnace to pull in Hunt mode from your starting position", Default = 500, Min = 1, Max = 10000, },
['PullMinCon'] = { DisplayName = "Pull Min Con", Category = "Pull Targets", Tooltip = "Min Con Mobs to consider pulling", Default = 2, Min = 1, Max = #RGMercConfig.Constants.ConColors, Type = "Combo", ComboOptions = RGMercConfig.Constants.ConColors, },
['PullMaxCon'] = { DisplayName = "Pull Max Con", Category = "Pull Targets", Tooltip = "Max Con Mobs to consider pulling", Default = 5, Min = 1, Max = #RGMercConfig.Constants.ConColors, Type = "Combo", ComboOptions = RGMercConfig.Constants.ConColors, },
['UsePullLevels'] = { DisplayName = "Use Pull Levels", Category = "Pull Targets", Tooltip = "Use Min and Max Levels Instead of Con.", Default = false, ConfigType = "Advanced", },
Expand Down Expand Up @@ -450,7 +454,9 @@ function Module:Render()
ImGui.TableNextColumn()
ImGui.Text(tostring(#self.TempSettings.PullTargets))
ImGui.TableNextColumn()
ImGui.Text("Current Farm WP ID")
ImGui.Text("Hunt X,Y,Z")
ImGui.TableNextColumn()
ImGui.Text(string.format("%d, %d, %d", self.TempSettings.HuntX, self.TempSettings.HuntY, self.TempSettings.HuntZ))
ImGui.TableNextColumn()
local wpId = self:GetCurrentWpId()
local wpData = self:GetWPById(wpId)
Expand Down Expand Up @@ -827,7 +833,14 @@ function Module:FixPullerMerc()
end

function Module:FindTarget()
local pullRadius = self.Constants.PullModes[self.settings.PullMode] == "Farm" and self.settings.PullRadiusFarm or self.settings.PullRadius
local pullRadius = RGMercUtils.GetSetting('PullRadius')

if self:IsPullMode("Farm") then
pullRadius = RGMercUtils.GetSetting('PullRadiusFarm')
elseif self:IsPullMode("Hunt") then
pullRadius = RGMercUtils.GetSetting('PullRadiusHunt')
end

local pullSearchString = string.format("npc radius %d targetable zradius %d range %d %d playerstate 0",
pullRadius, self.settings.PullZRadius,
(self.settings.UsePullLevels and self.settings.PullMinLevel or 1),
Expand All @@ -838,6 +851,9 @@ function Module:FindTarget()
local wpData = self:GetWPById(wpId)
pullSearchString = pullSearchString .. string.format(" loc %0.2f, %0.2f, %0.2f", wpData.x, wpData.y, wpData.z)
RGMercsLogger.log_debug("FindTarget :: Mode: Farm :: %s", pullSearchString)
elseif self:IsPullMode("Hunt") then
pullSearchString = pullSearchString .. string.format(" loc %0.2f, %0.2f, %0.2f", self.TempSettings.HuntX, self.TempSettings.HuntY, self.TempSettings.HuntZ)
RGMercsLogger.log_debug("FindTarget :: Mode: Farm :: %s", pullSearchString)
else
RGMercsLogger.log_debug("FindTarget :: Mode: %s :: %s", self.Constants.PullModes[self.settings.PullMode], pullSearchString)
end
Expand Down Expand Up @@ -946,6 +962,11 @@ function Module:CheckForAbort(pullID)
return true
end

if spawn.FeetWet() ~= mq.TLO.Me.FeetWet() then
RGMercsLogger.log_debug("\ar ALERT: Aborting feet wet mismatch \ax")
return true
end

-- ignore distance if this is a manually requested pull
if pullID ~= self.TempSettings.TargetSpawnID then
if not self:IsPullMode("Farm") and spawn.Distance() > self.settings.PullRadius then
Expand Down Expand Up @@ -1043,8 +1064,22 @@ function Module:GiveTime(combat_state)
self:SetValidPullAbilities()
self:FixPullerMerc()

if not RGMercUtils.GetSetting('DoPull') and (self.TempSettings.HuntX ~= 0 or self.TempSettings.HuntY ~= 0 or self.TempSettings.HuntZ ~= 0) then
self.TempSettings.HuntX = 0
self.TempSettings.HuntY = 0
self.TempSettings.HuntZ = 0
RGMercUtils.DoCmd("/mapfilter pullradius off")
end

if not RGMercUtils.GetSetting('DoPull') and self.TempSettings.TargetSpawnID == 0 then return end

if RGMercUtils.GetSetting('DoPull') and self:IsPullMode("Hunt") and (self.TempSettings.HuntX == 0 or self.TempSettings.HuntY == 0 or self.TempSettings.HuntZ == 0) then
self.TempSettings.HuntX = mq.TLO.Me.X()
self.TempSettings.HuntY = mq.TLO.Me.Y()
self.TempSettings.HuntZ = mq.TLO.Me.Z()
RGMercUtils.DoCmd("/mapfilter pullradius %d", RGMercUtils.GetSetting('PullRadiusHunt'))
end

if not mq.TLO.Navigation.MeshLoaded() then
RGMercsLogger.log_debug("\ar ERROR: There's no mesh for this zone. Can't pull. \ax")
RGMercsLogger.log_debug("\ar Disabling Pulling. \ax")
Expand Down
9 changes: 5 additions & 4 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ function Utils.SetTarget(targetId)
if Utils.GetTargetID() ~= targetId then
Utils.DoCmd("/target id %d", targetId)
mq.delay(10)
if mq.TLO.Target.PctHPs() > 90 then
printf("*********Engage WARNING TARGET ABOVE 90 : %s", callerTracer)
end
end
end
end
Expand All @@ -155,6 +152,7 @@ function Utils.HandleDeath()
RGMercModules:ExecAll("OnDeath")

while mq.TLO.Me.Hovering() do
RGMercsLogger.log_debug("Trying to release...")
if mq.TLO.Window("RespawnWnd").Open() and Utils.GetSetting('InstantRelease') then
mq.TLO.Window("RespawnWnd").Child("RW_OptionsList").Select(1)
mq.delay("1s")
Expand All @@ -166,7 +164,10 @@ function Utils.HandleDeath()

mq.delay("1m", function() return (not mq.TLO.Me.Zoning()) end)

RGMercsLogger.log_debug("Done zoning post death.")

if Utils.GetSetting('DoFellow') then
RGMercsLogger.log_debug("Doing fellowship post death.")
if mq.TLO.FindItem("Fellowship Registration Insignia").Timer.TotalSeconds() == 0 then
mq.delay("30s", function() return (mq.TLO.Me.CombatState():lower() == "active") end)
Utils.DoCmd("/useitem \"Fellowship Registration Insignia\"")
Expand Down Expand Up @@ -2134,7 +2135,7 @@ function Utils.EngageTarget(autoTargetId, preEngageRoutine)
end

if (Utils.GetTargetPctHPs() <= Utils.GetSetting('AutoAssistAt') or Utils.IAmMA()) and not Utils.GetTargetDead(target) then
if target.Distance() > Utils.GetTargetMaxRangeTo(target) then
if Utils.GetTargetDistance(target) > Utils.GetTargetMaxRangeTo(target) then
RGMercsLogger.log_debug("Target is too far! %d>%d attempting to nav to it.", target.Distance(),
target.MaxRangeTo())
if preEngageRoutine then
Expand Down

0 comments on commit f449adb

Please sign in to comment.