Skip to content

Commit

Permalink
DoRez Support
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 11, 2024
1 parent 1ec9569 commit d7ce42d
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 50 deletions.
81 changes: 40 additions & 41 deletions class_configs/clr_class_config.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local mq = require('mq')
local RGMercUtils = require("utils.rgmercs_utils")
local mq = require('mq')
local RGMercUtils = require("utils.rgmercs_utils")

local _ClassConfig = {
local _ClassConfig = {
['ModeChecks'] = {
IsHealing = function() return true end,
IsCuring = function() return true end,
Expand All @@ -10,13 +10,13 @@ local _ClassConfig = {
'Heal',
'Hybrid',
},
['ItemSets'] = {
['ItemSets'] = {
['Epic'] = {
"Harmony of the Soul",
"Aegis of Superior Divinity",
"Aegis of Superior Divinity",
},
},
['AbilitySets'] = {
['AbilitySets'] = {
['wardspell'] = {
-----Ward Spell Slot 1 or Heal over time for low level
"Celestial Remedy",
Expand Down Expand Up @@ -682,7 +682,7 @@ local _ClassConfig = {
type = "spell",
cond = function(self, spell)
return RGMercUtils.GetMainAssistPctHPs() <= RGMercConfig:GetSettings().GroupHealPoint and self.settings.DoHOT and spell.StacksTarget() and
not RGMercUtils.TargetHasBuff(spell) and mq.TLO.Group.Injured(RGMercConfig:GetSettings().GroupHealPoint)() > RGMercConfig:GetSettings().GroupInjureCnt
not RGMercUtils.TargetHasBuff(spell) and mq.TLO.Group.Injured(RGMercConfig:GetSettings().GroupHealPoint)() > RGMercConfig:GetSettings().GroupInjureCnt
end,
},
{
Expand Down Expand Up @@ -710,7 +710,7 @@ local _ClassConfig = {
type = "spell",
cond = function(self, spell)
return RGMercUtils.GetMainAssistPctHPs() <= RGMercConfig:GetSettings().GroupHealPoint and self.settings.DoHOT and spell.StacksTarget() and
not RGMercUtils.TargetHasBuff(spell) and mq.TLO.Group.Injured(RGMercConfig:GetSettings().GroupHealPoint)() > RGMercConfig:GetSettings().GroupInjureCnt
not RGMercUtils.TargetHasBuff(spell) and mq.TLO.Group.Injured(RGMercConfig:GetSettings().GroupHealPoint)() > RGMercConfig:GetSettings().GroupInjureCnt
end,
},
},
Expand Down Expand Up @@ -858,16 +858,16 @@ local _ClassConfig = {
gem = 2,
spells = {
-- [ HEAL MODE ] --
-- Macro chooses 2 remedy heals for gem 1 and 2, need method to choose second best from list
{ name = "remedyheal", cond = function(self) return true end, },
-- Macro chooses 2 remedy heals for gem 1 and 2, need method to choose second best from list
{ name = "remedyheal", cond = function(self) return true end, },
},
},
{
gem = 3,
spells = {
-- [ HEAL MODE ] --
-- Note: Something wrong with RGMercUtils.IsModeActive, its returning false
{ name = "patchheal", cond = function(self) return RGMercUtils.IsModeActive("Heal") end, },
{ name = "patchheal", cond = function(self) return RGMercUtils.IsModeActive("Heal") end, },
{ name = "SingleHot", cond = function(self) return true end, },
},
},
Expand All @@ -889,15 +889,15 @@ local _ClassConfig = {
gem = 6,
spells = {
-- [ HEAL MODE ] --
{ name = "Icespellcure", cond = function(self) return true end, },
{ name = "Icespellcure", cond = function(self) return true end, },
},
},
{
gem = 7,
cond = function(self, gem) return mq.TLO.Me.NumGems() >= gem end,
spells = {
-- [ HEAL MODE ] --
{ name = "GroupHot", cond = function(self) return true end, },
{ name = "GroupHot", cond = function(self) return true end, },
},
},
{
Expand All @@ -921,7 +921,7 @@ local _ClassConfig = {
cond = function(self, gem) return mq.TLO.Me.NumGems() >= gem end,
spells = {
-- [ HEAL MODE ] --
{ name = "nukeheal", cond = function(self) return true end, },
{ name = "nukeheal", cond = function(self) return true end, },
},
},
{
Expand All @@ -948,36 +948,35 @@ local _ClassConfig = {
{ name = "GroupHealProcBuff", cond = function(self) return true end, },
},
},
},-- spells config
}, -- spells config
['DefaultConfig'] = {
['Mode'] = { DisplayName = "Mode", Category = "Combat", Tooltip = "Select the Combat Mode for this Toon", Type = "Custom", RequiresLoadoutChange = true, Default = 1, Min = 1, Max = 2, },
['DoHOT'] = { DisplayName = "Cast HOTs", Category = "Spells and Abilities", Tooltip = "Use Heal Over Time Spells", Default = true, },
['DoCure'] = { DisplayName = "Cast Cure SPells", Category = "Spells and Abilities", Tooltip = "Use Cure Spells", Default = true, },
['DoProm'] = { DisplayName = "Cast Promised Heal Spells", Category = "Spells and Abilities", Tooltip = "Use Prom Spells", Default = true, },
['DoClutchHeal'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['DoBattleRez'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['DoAutoWard'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['MainHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 95, Min=1, Max=99, },
['BigHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 80, Min=1, Max=99, },
['GroupHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 85, Min=1, Max=99, },
['ClutchHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 34, Min=1, Max=99, },
['GroupInjureCnt'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 2, Min=1, Max=6 },
['DoNuke'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['Manatonuke'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 60, Min=1, Max=100, },
['NukePct'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 90, Min=1, Max=100, },
['DoReverseDS'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['DoQp'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['QPManaPCT'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 40, Min=1, Max=99, },
['VetManaPCT'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 70, Min=1, Max=99, },
['DivineBuffOn'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['DoDruid'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['DoCh'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['TLPStartHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 90, Min=1, Max=99, },
['CompHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 65, Min=1, Max=99, },
['LightHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 65, Min=1, Max=99, },
['RemedyHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 80, Min=1, Max=99, },
['DoSymbol'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['DoCure'] = { DisplayName = "Cast Cure SPells", Category = "Spells and Abilities", Tooltip = "Use Cure Spells", Default = true, },
['DoProm'] = { DisplayName = "Cast Promised Heal Spells", Category = "Spells and Abilities", Tooltip = "Use Prom Spells", Default = true, },
['DoClutchHeal'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['DoAutoWard'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['MainHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 95, Min = 1, Max = 99, },
['BigHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 80, Min = 1, Max = 99, },
['GroupHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 85, Min = 1, Max = 99, },
['ClutchHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 34, Min = 1, Max = 99, },
['GroupInjureCnt'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 2, Min = 1, Max = 6, },
['DoNuke'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['Manatonuke'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 60, Min = 1, Max = 100, },
['NukePct'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 90, Min = 1, Max = 100, },
['DoReverseDS'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['DoQp'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = true, },
['QPManaPCT'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 40, Min = 1, Max = 99, },
['VetManaPCT'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 70, Min = 1, Max = 99, },
['DivineBuffOn'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['DoDruid'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['DoCh'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
['TLPStartHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 90, Min = 1, Max = 99, },
['CompHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 65, Min = 1, Max = 99, },
['LightHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 65, Min = 1, Max = 99, },
['RemedyHealPoint'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = 80, Min = 1, Max = 99, },
['DoSymbol'] = { DisplayName = "Cast Spells", Category = "Spells and Abilities", Tooltip = "Use Spells", Default = false, },
}, -- end DefaultConfig
}

return _ClassConfig
return _ClassConfig
43 changes: 43 additions & 0 deletions class_configs/shm_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,49 @@ local _ClassConfig = {
"Eradicate Poison",
},
},
['HelperFunctions'] = {
-- helper function for advanced logic to see if we want to use Dark Lord's Unity
DoRez = function(self, corpseId)
if not RGMercUtils.PCSpellReady("Incarnate Anew") and
not mq.TLO.FindItem("Staff of Forbidden Rites")() and
not RGMercUtils.CanUseAA("Rejuvenation of Spirit") and
not RGMercUtils.CanUseAA("Call of the Wild") then
return false
end

RGMercUtils.SetTarget(corpseId)

local target = mq.TLO.Target

if not target or not target() then return false end

if mq.TLO.Target.Distance() > 25 then
RGMercUtils.DoCmd("/corpse")
end

local targetClass = target.Class.ShortName()

if mq.TLO.Me.CombatState():lower() == "combat" and (targetClass == "dru" or targetClass == "clr" or RGMercConfig:GetSettings().DoBattleRez) then
if mq.TLO.FindItem("Staff of Forbidden Rites")() and mq.TLO.Me.ItemReady("=Staff of Forbidden Rites")() then
return RGMercUtils.UseItem("Staff of Forbidden Rites", corpseId)
end

if RGMercUtils.AAReady("Call of the Wild") then
return RGMercUtils.UseAA("Call of the Wild", corpseId)
end
else
if RGMercUtils.CanUseAA("Rejuvenation of Spirit") then
return RGMercUtils.UseAA("Rejuvenation of Spirit", corpseId)
end

if RGMercUtils.PCSpellReady("Incarnate Anew") then
return RGMercUtils.UseSpell("Incarnate Anew", corpseId, true)
end
end

return false
end,
},
-- These are handled differently from normal rotations in that we try to make some intelligent desicions about which spells to use instead
-- of just slamming through the base ordered list.
-- These will run in order and exit after the first valid spell to cast
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 = 'a6c52a6 2024-01-11' }
return { commitId = '1ec9569 2024-01-11' }
60 changes: 52 additions & 8 deletions modules/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require('utils.rgmercs_datatypes')
local Module = { _version = '0.1a', _name = "Class", _author = 'Derple', }
Module.__index = Module
Module.LastPetCmd = 0
Module.RezTimers = {}
Module.ModuleLoaded = false
Module.ShowFailedSpells = false
Module.ReloadingLoadouts = true
Expand All @@ -17,6 +18,10 @@ Module.CombatState = "None"
Module.ClassConfig = nil
Module.DefaultCategories = nil

Module.Constants = {}
Module.Constants.RezSearchGroup = "pccorpse group radius 100 zradius 50"
Module.Constants.RezSearchOutOfGroup = "pccorpse radius 100 zradius 50"

-- Track the state of rotations between frames
Module.TempSettings.RotationStates = {}
Module.TempSettings.HealingRotationStates = {}
Expand Down Expand Up @@ -298,19 +303,54 @@ function Module:GetTheme()
end
end

--#define REZSEARCHGROUP "pccorpse group radius 100 zradius 50"
--#define REZSEARCHME "pccorpse ${Me} radius 100 zradius 50"
--#define OUTOFGROUPREZ "pccorpse radius 100 zradius 50"
function Module:SelfCheckAndRez()
local rezSearch = string.format("pccorpse %d radius 100 zradius 50", mq.TLO.Me.ID())
local rezCount = mq.TLO.SpawnCount(rezSearch)()

for i = 1, rezCount do
local rezSpawn = mq.TLO.NearestSpawn(i, rezSearch)

if rezSpawn() then
if self.ClassConfig.HelperFunctions.DoRez then
if (os.clock() - (self.TempSettings.RezTimers[rezSpawn.ID()] or 0)) >= RGMercConfig:GetSettings().RetryRezDelay then
self.ClassConfig.HelperFunctions.DoRez(self, rezSpawn.ID())
self.TempSettings.RezTimers[rezSpawn.ID()] = os.clock()
end
end
end
end
end

function Module:IGCheckAndRez()
local rezCount = mq.TLO.SpawnCount(self.Constants.RezSearchGroup)()

for i = 1, rezCount do
local rezSpawn = mq.TLO.NearestSpawn(i, self.Constants.RezSearchGroup)

if rezSpawn() then
if self.ClassConfig.HelperFunctions.DoRez then
if (os.clock() - (self.TempSettings.RezTimers[rezSpawn.ID()] or 0)) >= RGMercConfig:GetSettings().RetryRezDelay then
self.ClassConfig.HelperFunctions.DoRez(self, rezSpawn.ID())
self.TempSettings.RezTimers[rezSpawn.ID()] = os.clock()
end
end
end
end
end

function Module:OOGCheckAndRez()
local rezFilter = "pccorpse radius 100 zradius 50"
local rezCount = mq.TLO.SpawnCount(rezFilter)()
local rezCount = mq.TLO.SpawnCount(self.Constants.RezSearchOutOfGroup)()

for i = 1, rezCount do
local rezSpawn = mq.TLO.NearestSpawn(i, rezFilter)
local rezSpawn = mq.TLO.NearestSpawn(i, self.Constants.RezSearchOutOfGroup)

--/if ( ${tmp_corpse_name.Equal[${assistname}]} || ${OaList[SETTINGVAL].Find[${tmp_corpse_name}]} || ${Raid.Member[${tmp_corpse_name}].ID} || ${DanNet.Peers.Find[${tmp_corpse_name}]}) {
if rezSpawn() and (RGMercUtils.IsSafeName("pc", rezSpawn.DisplayName())) then
-- TODO: DoRez
if self.ClassConfig.HelperFunctions.DoRez then
if (os.clock() - (self.TempSettings.RezTimers[rezSpawn.ID()] or 0)) >= RGMercConfig:GetSettings().RetryRezDelay then
self.ClassConfig.HelperFunctions.DoRez(self, rezSpawn.ID())
self.TempSettings.RezTimers[rezSpawn.ID()] = os.clock()
end
end
end
end
end
Expand Down Expand Up @@ -473,6 +513,10 @@ function Module:GiveTime(combat_state)
if self:IsHealing() then
-- TODO Check Rezes
if self.CombatState ~= "Downtime" or (not mq.TLO.Me.Invis() or RGMercConfig:GetSettings().BreakInvis) then
self:IGCheckAndRez()

self:SelfCheckAndRez()

if RGMercConfig:GetSettings().AssistOutside then
self:OOGCheckAndRez()
end
Expand Down
4 changes: 4 additions & 0 deletions utils/rgmercs_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ Config.DefaultConfig = {
['DoPetHeals'] = { DisplayName = "Do Pet Heals", Category = "Heals", Tooltip = "Heal Pets?", Default = false, },
['MaxHealPoint'] = { DisplayName = "Max Heal Point", Category = "Heals", Tooltip = "The point at which you stop healing.", Default = 90, Min = 1, Max = 99, },

-- [ REZ ] --
['RetryRezDelay'] = { DisplayName = "Retry Rez Delay", Category = "Rez", Tooltip = "Time in seconds of how often to try to rez a corpse.", Default = 6, Min = 1, Max = 60, },
['DoBattleRez'] = { DisplayName = "Cast Spells", Category = "Rez", Tooltip = "Use Spells", Default = true, },

-- [ FELLOWSHIP ] --
['DoFellow'] = { DisplayName = "Enable Fellowship Insignia", Category = "Fellowship", Tooltip = "Use fellowship insignia automatically.", Default = true, },

Expand Down

0 comments on commit d7ce42d

Please sign in to comment.