Skip to content

Commit

Permalink
- SaveSettings no long causes a reload until that means something
Browse files Browse the repository at this point in the history
- Necro Pet will now recast
- Necro Pet Type Support
- Custom Combo Box Support
- pre_activate and post_activate support added to rotation items
- Small bug fixes.
  • Loading branch information
DerpleMQ2 committed Jan 8, 2024
1 parent 2da6cab commit 38d70b7
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 80 deletions.
39 changes: 37 additions & 2 deletions class_configs/nec_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -952,16 +952,50 @@ local _ClassConfig = {
-- active_cond = function(self, spell) return RGMercUtils.SongActive(spell.RankName()) end,
-- cond = function(self, spell) return not RGMercUtils.SongActive(spell.RankName()) end,
--},
{
name = "PetSpellWar",
type = "Spell",
active_cond = function(self, _) return mq.TLO.Me.Pet.ID() ~= 0 and mq.TLO.Me.Pet.Class.ShortName():lower() == "war" end,
pre_activate = function(self, spell)
if mq.TLO.Me.Pet.ID() > 0 then
mq.cmdf("/pet leave")
end
end,
cond = function(self, spell) return self.settings.PetType == 1 and (mq.TLO.Me.Pet.ID() == 0 or mq.TLO.Me.Pet.Class.ShortName():lower() ~= "war") end,
post_activate = function(self, spell)
local pet = mq.TLO.Me.Pet
if pet.ID() > 0 then
RGMercUtils.PrintGroupMessage("Summoned a new %d %s pet named %s using '%s'!", pet.Level(), pet.Class.Name(), pet.CleanName(), spell.RankName())
end
end,
},
{
name = "PetSpellRog",
type = "Spell",
active_cond = function(self, _) return mq.TLO.Me.Pet.ID() ~= 0 and mq.TLO.Me.Pet.Class.ShortName():lower() == "rog" end,
pre_activate = function(self, spell)
if mq.TLO.Me.Pet.ID() > 0 then
mq.cmdf("/pet leave")
end
end,
cond = function(self, _) return self.settings.PetType == 2 and (mq.TLO.Me.Pet.ID() == 0 or mq.TLO.Me.Pet.Class.ShortName():lower() ~= "rog") end,
post_activate = function(self, spell)
local pet = mq.TLO.Me.Pet
if pet.ID() > 0 then
RGMercUtils.PrintGroupMessage("Summoned a new %d %s pet named %s using '%s'!", pet.Level(), pet.Class.Name(), pet.CleanName(), spell.RankName())
end
end,
},
{
name = "PetHaste",
type = "Spell",
active_cond = function(self, spell) return mq.TLO.Me.PetBuff(spell.RankName) ~= nil end,
active_cond = function(self, spell) return mq.TLO.Me.PetBuff(spell.RankName())() ~= nil end,
cond = function(self, spell) return RGMercUtils.SelfBuffPetCheck(spell) end,
},
{
name = "PetBuff",
type = "Spell",
active_cond = function(self, spell) return mq.TLO.Me.PetBuff(spell.RankName) ~= nil end,
active_cond = function(self, spell) return mq.TLO.Me.PetBuff(spell.RankName())() ~= nil end,
cond = function(self, spell) return RGMercUtils.SelfBuffPetCheck(spell) end,
},
},
Expand Down Expand Up @@ -1074,6 +1108,7 @@ local _ClassConfig = {
},
['DefaultConfig'] = {
['Mode'] = { DisplayName = "Mode", Category = "Combat", Tooltip = "Select the Combat Mode for this Toon", Type = "Custom", RequiresLoadoutChange = true, Default = 1, Min = 1, Max = 1, },
['PetType'] = { DisplayName = "Mode", Category = "Combat", Tooltip = "1 = War, 2 = Rog", Type = "Combo", ComboOptions = { 'War', 'Rog', }, Default = 1, Min = 1, Max = 2, },
['DoLich'] = { DisplayName = "Cast Lich", Category = "Spells and Abilities", Tooltip = "Enable casting Lich spells.", RequiresLoadoutChange = true, Default = true, },
['DeathBloomPercent'] = { DisplayName = "Death Bloom %", Category = "Spells and Abilities", Tooltip = "Mana % at which to cast Death Bloom", Default = 40, Min = 1, Max = 100, },
['DoSnare'] = { DisplayName = "Cast Snares", Category = "Spells and Abilities", Tooltip = "Enable casting Snare spells.", Default = true, },
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 = '527cec6 2024-01-07' }
return { commitId = '2da6cab 2024-01-07' }
13 changes: 7 additions & 6 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ local function RGMercsGUI()
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, GetMainOpacity()) -- Main window opacity.

openGUI, shouldDrawGUI = ImGui.Begin('RGMercs', openGUI)

ImGui.PushID("##RGMercsUI_" .. RGMercConfig.Globals.CurLoadedChar)
--ImGui.Image(derpImg:GetTextureID(), ImVec2(ImGui.GetWindowWidth(), ImGui.GetWindowHeight()))

--ImGui.SetCursorPos(0, 0)
Expand Down Expand Up @@ -191,7 +191,7 @@ local function RGMercsGUI()
if RGMercsConsole.opacity then
RGMercsConsole.opacity = GetMainOpacity()
end
RGMercConfig:SaveSettings(true)
RGMercConfig:SaveSettings(false)
end

if ImGui.BeginTabBar("RGMercsTabs", ImGuiTabBarFlags.None) then
Expand All @@ -207,7 +207,7 @@ local function RGMercsGUI()
local settingsRef = RGMercConfig:GetSettings()
settingsRef, pressed, _ = RGMercUtils.RenderSettings(settingsRef, RGMercConfig.DefaultConfig, RGMercConfig.DefaultCategories)
if pressed then
RGMercConfig:SaveSettings(true)
RGMercConfig:SaveSettings(false)
end
end

Expand All @@ -233,14 +233,14 @@ local function RGMercsGUI()
if dropped then
RGMercsLogger.log_debug("New item dropped: %s", newItem)
RGMercConfig:GetSettings().MountItem = newItem
RGMercConfig:SaveSettings(true)
RGMercConfig:SaveSettings(false)
end

dropped, newItem = renderDragDropForItem("Drop Shrink Item")
if dropped then
RGMercsLogger.log_debug("New item dropped: %s", newItem)
RGMercConfig:GetSettings().ShrinkItem = newItem
RGMercConfig:SaveSettings(true)
RGMercConfig:SaveSettings(false)
end
end

Expand All @@ -263,7 +263,7 @@ local function RGMercsGUI()
#RGMercConfig.Constants.LogLevels)

if changed then
RGMercConfig:SaveSettings(true)
RGMercConfig:SaveSettings(false)
end

if ImGui.CollapsingHeader("Debug Output", ImGuiTreeNodeFlags.DefaultOpen) then
Expand All @@ -284,6 +284,7 @@ local function RGMercsGUI()
display_item_on_cursor()
end

ImGui.PopID()
ImGui.End()
if themeStylePop > 0 then
ImGui.PopStyleColor(themeStylePop)
Expand Down
6 changes: 3 additions & 3 deletions modules/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Module:LoadSettings()
if err or not config then
RGMercsLogger.log_error("\ay[%s]: Unable to load module settings file(%s), creating a new one!", RGMercConfig.Globals.CurLoadedClass, settings_pickle_path)
self.settings = {}
self:SaveSettings(true)
self:SaveSettings(false)
else
self.settings = config()
end
Expand Down Expand Up @@ -139,14 +139,14 @@ function Module:Render()
RGMercUtils.Tooltip(self.ClassConfig.DefaultConfig.Mode.Tooltip)
self.settings.Mode, pressed = ImGui.Combo("##_select_ai_mode", self.settings.Mode, self.ClassConfig.Modes, #self.ClassConfig.Modes)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
newCombatMode = true
end

if ImGui.CollapsingHeader("Config Options") then
self.settings, pressed, loadoutChange = RGMercUtils.RenderSettings(self.settings, self.ClassConfig.DefaultConfig, self.DefaultCategories)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
newCombatMode = newCombatMode or loadoutChange
end
end
Expand Down
10 changes: 5 additions & 5 deletions modules/movement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Module:ChaseOn(target)
if chaseTarget() and chaseTarget.ID() > 0 and chaseTarget.Type() == "PC" then
self.settings.ChaseOn = true
self.settings.ChaseTarget = chaseTarget.CleanName()
self:SaveSettings(true)
self:SaveSettings(false)

RGMercsLogger.log_info("\ao Now Chasing \ag %s", chaseTarget.CleanName())
else
Expand All @@ -109,7 +109,7 @@ end
function Module:ChaseOff()
self.settings.ChaseOn = false
self.settings.ChaseTarget = nil
self:SaveSettings(true)
self:SaveSettings(false)
RGMercsLogger.log_warning("\ayNo longer chasing \at%s\ay.", self.settings.ChaseTarget or "None")
end

Expand All @@ -129,7 +129,7 @@ end

function Module:CampOff()
self.settings.ReturnToCamp = false
self:SaveSettings(true)
self:SaveSettings(false)
end

function Module:DestoryCampfire()
Expand Down Expand Up @@ -168,7 +168,7 @@ function Module:Campfire(camptype)
if self.settings.MaintainCampfire then
if mq.TLO.FindItemCount("Fellowship Campfire Materials") == 0 then
self.settings.MaintainCampfire = 1
self:SaveSettings(true)
self:SaveSettings(false)
RGMercsLogger.log_info("Fellowship Campfire Materials Not Found. Setting to Regular Fellowship.")
end
end
Expand Down Expand Up @@ -230,7 +230,7 @@ function Module:Render()
if ImGui.CollapsingHeader("Config Options") then
self.settings, pressed, _ = RGMercUtils.RenderSettings(self.settings, self.DefaultConfig, self.DefaultCategories)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
end
end

Expand Down
2 changes: 1 addition & 1 deletion modules/performance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function Module:LoadSettings()
RGMercsLogger.log_error("\ay[Performance Monitor]: Unable to load global settings file(%s), creating a new one!",
settings_pickle_path)
self.settings.MyCheckbox = false
self:SaveSettings(true)
self:SaveSettings(false)
else
self.settings = config()
end
Expand Down
22 changes: 11 additions & 11 deletions modules/pull.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function Module:LoadSettings()
if err or not config then
RGMercsLogger.log_error("\ay[Pull]: Unable to load global settings file(%s), creating a new one!",
settings_pickle_path)
self:SaveSettings(true)
self:SaveSettings(false)
else
self.settings = config()
end
Expand Down Expand Up @@ -215,7 +215,7 @@ function Module:Render()

if ImGui.Button(self.settings.DoPull and "Stop Pulls" or "Start Pulls", ImGui.GetWindowWidth() * .3, 25) then
self.settings.DoPull = not self.settings.DoPull
self:SaveSettings(true)
self:SaveSettings(false)
end
ImGui.PopStyleColor()

Expand All @@ -228,12 +228,12 @@ function Module:Render()

self.settings.PullMode, pressed = ImGui.Combo("Pull Mode", self.settings.PullMode, self.Constants.PullModes, #self.Constants.PullModes)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
end
if #self.TempSettings.ValidPullAbilities > 0 then
self.settings.PullAbility, pressed = ImGui.Combo("Pull Ability", self.settings.PullAbility, self.TempSettings.ValidPullAbilities, #self.TempSettings.ValidPullAbilities)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
end
end

Expand Down Expand Up @@ -337,7 +337,7 @@ function Module:Render()
if ImGui.CollapsingHeader("Config Options") then
self.settings, pressed, _ = RGMercUtils.RenderSettings(self.settings, self.DefaultConfig, self.DefaultCategories)
if pressed then
self:SaveSettings(true)
self:SaveSettings(false)
end
end
end
Expand Down Expand Up @@ -383,15 +383,15 @@ end
function Module:AddMobToList(list, mobName)
self.settings[list][mq.TLO.Zone.ShortName()] = self.settings[list][mq.TLO.Zone.ShortName()] or {}
table.insert(self.settings[list][mq.TLO.Zone.ShortName()], mobName)
self:SaveSettings(true)
self:SaveSettings(false)
end

---@param list string
---@param idx number
function Module:DeleteMobFromList(list, idx)
self.settings[list][mq.TLO.Zone.ShortName()] = self.settings[list][mq.TLO.Zone.ShortName()] or {}
self.settings[list][mq.TLO.Zone.ShortName()][idx] = nil
self:SaveSettings(true)
self:SaveSettings(false)
end

function Module:IncrementWpId()
Expand All @@ -414,7 +414,7 @@ function Module:MoveWayPointUp(id)
local oldEntry = self:GetWPById(newId)
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][newId] = self:GetWPById(id)
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][id] = oldEntry
self:SaveSettings(true)
self:SaveSettings(false)
end

---@param id number
Expand All @@ -427,13 +427,13 @@ function Module:MoveWayPointDown(id)
local oldEntry = self:GetWPById(newId)
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][newId] = self:GetWPById(id)
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][id] = oldEntry
self:SaveSettings(true)
self:SaveSettings(false)
end

function Module:CreateWayPointHere()
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()] = self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()] or {}
table.insert(self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()], { x = mq.TLO.Me.X(), y = mq.TLO.Me.Y(), z = mq.TLO.Me.Z(), })
self:SaveSettings(true)
self:SaveSettings(false)
RGMercsLogger.log_info("\axNew waypoint \at%d\ax created at location \ag%02.f, %02.f, %02.f", #self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()],
mq.TLO.Me.X(), mq.TLO.Me.Y(), mq.TLO.Me.Z())
end
Expand All @@ -442,7 +442,7 @@ function Module:DeleteWayPoint(idx)
if idx >= #self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()] then
RGMercsLogger.log_info("\axWaypoint \at%d\ax at location \ag%s\ax - \arDeleted!\ax", idx, self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][idx])
self.settings.FarmWayPoints[mq.TLO.Zone.ShortName()][idx] = nil
self:SaveSettings(true)
self:SaveSettings(false)
else
RGMercsLogger.log_error("\ar%d is not a valid waypoint ID!", idx)
end
Expand Down
2 changes: 1 addition & 1 deletion modules/travel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function Module:LoadSettings()
RGMercsLogger.log_error("\ay[Travel]: Unable to load global settings file(%s), creating a new one!",
settings_pickle_path)
self.settings = {}
self:SaveSettings(true)
self:SaveSettings(false)
else
self.settings = config()
end
Expand Down
2 changes: 1 addition & 1 deletion utils/rgmercs_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function Config:LoadSettings()
self.settings = RGMercUtils.ResolveDefaults(Config.DefaultConfig, self.settings)

if needSave then
self:SaveSettings(true)
self:SaveSettings(false)
end

return true
Expand Down

0 comments on commit 38d70b7

Please sign in to comment.