From 57987578f6cf7634e1445190a0aa7e4423d59200 Mon Sep 17 00:00:00 2001 From: cyrite <123847593+cyrite@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:03:46 -0400 Subject: [PATCH] v10.5.2 (#177) * Adding empty GambitSettings * Fixing issue with stale player index in Conditions * Fixing Min and MaxTacticalPointsCondition target index * Nil fix * Fixing target index issue with HP, MP and TP conditions * More fixes * Various fixes * Fixing SkillchainPropertyCondition serialize * Fixing more conditions * Fixing nil issue with HasBuffsCondition * Displaying friendly descriptions in conditions picker view * Fixing Puppetmaster trust * Updating default Gambits for White Mage and Dark Knight trusts * Changing Gambit ability condtions check to always be player * Adding support for capitalizing letters in text input view * Adding Condition target filtering * Adding Reset button to GambitSettingsMenuItem to reset to Default Gambits * Adding replacement for AutoControl * Adding default attachment sets for Puppetmaster Trust * Bumping Trust version to 10.0.0 * PR feedback * Fixing nil exception * Fixing sleeper and adding more monster abilities to ready and finish ability condition * Bumping Trust version to 10.0.1 * Fixing issue with equipping automaton attachments * Adding additional delay after removing attachments * Adding manifest.json * Bumping Trust version to 10.0.3 * Adding the Trust MSI * Updating MSI * Bumping Trust version to 10.0.5 * Bumping manifest version * Update README.md * Adding new C# installer * Update README.md * Update README.md * Create README.md * Adding README and TrustInstaller zip file * Adding README * Update README.md * Updating the TrustInstaller.zip * Updating TrustInstaller.zip * Updating the TrustInstaller * Bumping Trust Version to 10.0.9 * Adding support for Entrust + Indicolure in Gambit picker * Adding check for extra song instrument while singing dummy songs * Fixing singer view selection * Update README.md * Adding Bard song diagnostics * Adding tags field to Gambit * Adding support for no sub job * Disabling sub job menu item when no sub job is present * Bumping Trust version to 10.1.0 * PR feedback * Adding Reactions menu item * Updating default Red Mage trust settings * Updating default widget positions * Fixing false positive in Bard trust diagnostics * PR feedback * WIP of speed singing * Getting rid of extra multiplier on Marcato duration * Adding StepTracker and HasDazeCondition * Adding Command Gambit ability * Adding // trust sc mintp command * Adding elemental resistances * Collapsing debuffs section of target widget when there are no debuffs * Target widget cleanup * Clean up * Moving turn to face mob out of action queue * Adding new actions * Adding GridLayout * Showing and disabling spells and job abilities which are unavailable on sub job * Adding more resistance data to monster families * Adding shortcuts for menus and widgets * Adding shortcut for gambits * Adding shortcut for skillchains menu * Fixing nil issue * Fixing nil exception in SongTracker * Fixing regression with Gambits * Adding missing __eq function to RunTo and RunAway * Disabling singing while moving * Updating default Bard trust settings and fixing song editor to respect current mode * Fixing nil issue with ConfigEditor * Fixing more focus issues * Bumping Trust version to 10.2.0 * PR feedback * Updating deafult alter egos and pull targets * Adding more pull targets * Updating default widget positions * Updating release notes * Updating manifest * Update create_release.yml * Updating TrustInstaller * Updating manifest.json * Update README.md * Update README.md * Updating manifest.json * Fixing singer regressions * Disabling keyboard shortcuts while chat is open * Adding rolls viwe * Adding Geomancy view * Fixing edge case with Shooter * Adding separate queue for equipping automaton attachments * Disabling AutoPetMode while equipping attachments * Fixing issue where ManeuverMode would be overriden by settings * Overhauled AutomatonSettingsMenuItem and added abilty to customize maneuvers * Updating help text for maneuver menu. * Updating ManeuverMode help text * Removing res.items dependency on PUP job file * PR feedback * Adding TODO * Fixing regression in SongSettingsMenuItem * Bumping Trust version to 10.2.1 * Fixing merge issue in manifest.json * Adding PetStatusWidget * Adding AutomatonStatusWidget * Updating PetMode on AutomatonStatusWidget when changing attachments * Removing debug error * Bumping Trust version to 10.2.2 * Updating AutomatonStatusWidget text formatting * Fixing scrolling content offset with section header views * Adding pet ability in AutomatonStatusWidget * Updating default position for pet status widget * Updating default attachment set for LightTank * Re-enabling AutoFaceMobMode while singing because turn to face mob is no longer in action queue * Fixing copy on GambitSettingsMenuItem reset button * Adding Default and Gambits for Rune Fencer * Adding PathWidget * Adding TargetNameCondition * Fixing nil exception in PathRecorder * Fixing nil exception in PathRecorder * Adding new IPC messages * Fixing self targeting weapon skills and nil exception with job abilities * Updating release notes for 10.3.0 * PR feedback * Bumping Trust version to 10.3.1 * Adding autocomplete for Trust commands * Resetting content offset of autocomplete when menu disappears * Removing ActionBatchingMode * Adding MigrationManager and migration to move Bard job settings under SongSettings key * Updating default Bard job settings file * Adding menu to pick pianissimo songs * Refactoring commands into GeneralCommands and MenuCommands and adding settings.xml flag to disable autocomplete * Showing command description in info bar * PR feedback * Fixing missing handle_stop issue * Fixing issue where no pianissimo song is initially selected * Adding pianissimo songs to SongSettingsEditor * Updating description for AutoClarionCallMode * Fixing issue reordering Pianissimo songs * Adding Soul Voice as a conflicting buff for Marcato * Updating release notes * PR feedback * Adding menu for editing the remote commands whitelist * Update migration_v1.lua * Fixing issue where Bard settings migration ran on all jobs * PR feedback * Fixing merge issue * PR feedback * Fixing issue where EarthSpirit would not be dismissed * Fixing issue where BloodPactSettings default ability would not appear selected * Adding Puller role if neither main nor sub job Trust can pull * Clean up * Fixing spell, job ability and weapon skill actions for JP players * Fixing strategem actions for JP players * PR feedback * PR feedback * Updating release notes * Adding CombatSkillsCondition and updating Hasso to only be used with 2-handed weapons * Fixing issue where pull distance can't be edited in the UI * Bumping Trust version to 10.4.5 * Updating default Samurai job settings file * Adding MagicBurstTrustCommands and NukeTrustCommands * Adding NukeCommands * Fixing issue where Scholar menu does not refresh when changing arts * Bumping Trust version to 10.4.6 * Adding nil check in party mob update packet * Updating release notes * Adding MultiPickerConfigItem * PR feedback * Edge cases for Truster * Fixing nil error * Remove sleep debuff when attacking a monster * Fixing issue with casting spell on dead enemy * Adding JobCondition to match multiple jobs * Fixing PLD Gambits * Updating default Gambits for Dancer * Adding Apururu to cylibs/res/trusts.lua * Bumping Trust version to 10.4.8 * Filtering out Gambit ability targets if job has no abilities for that target type * Fixing typo in EnemiesNearbyCondition * Updating manifest.json * Bumping Trust version to 10.4.9 * Fixing TargetNameCondition * Bumping Trust version to 10.5.0 * PR feedback * Adding Phalanx and Phalanx II to blacklist for Buff.new * Adding more spells to Buff blacklist * Updating default job settings for Red Mage * Adding Reset button to Self and Party buff settings * Updating default Red Mage job settings file * Adding // trust set and // trust cycle commands to auto complete * Converting TrustInfoBar to a MarqueeCollectionViewCell * Cleanup * Hiding status removal Blacklist for Red Mage * Truncating skillchains * Adding AutoCampMode * Bumping Trust version to 10.5.2 * PR feedback * Updating HealerSettingsMenuItem to use new ModeConfigEditor * Adding friendly descriptions for AutoHealMode, AutoStatusRemovalMode and AutoDetectAuraMode * Migrating modes menus to ModeConfigEditor * Updating description for AutoGambitMode * Fixing issue where GambitSettingsEditor reset when getting focus * Showing full gambit description in info bar * Bumping Trust version to 10.5.3 * PR feedback --- Trust.lua | 32 +++++-- TrustSettings.lua | 1 + commands/PullCommands.lua | 22 +++-- cylibs/battle/spell.lua | 6 +- cylibs/battle/spells/debuff.lua | 2 +- cylibs/conditions/condition.lua | 1 + cylibs/conditions/job.lua | 5 + cylibs/messages/ipc/ipc_relay.lua | 2 +- cylibs/trust/data/BRD.lua | 8 +- cylibs/trust/data/PUP.lua | 17 +++- cylibs/trust/roles/buffer.lua | 7 +- cylibs/trust/roles/debuffer.lua | 4 +- cylibs/trust/roles/follower.lua | 2 +- cylibs/trust/roles/gambiter.lua | 2 +- cylibs/trust/roles/healer.lua | 2 +- cylibs/trust/roles/magic_burster.lua | 4 +- cylibs/trust/roles/nuker.lua | 2 +- cylibs/trust/roles/puller.lua | 35 ++++++- cylibs/trust/roles/skillchainer.lua | 8 +- cylibs/trust/roles/status_remover.lua | 4 +- cylibs/trust/roles/truster.lua | 2 +- .../cells/marquee_collection_view_cell.lua | 7 +- cylibs/ui/collection_view/collection_view.lua | 22 ++++- .../autocomplete/chat_auto_completer.lua | 4 +- cylibs/ui/navigation/navigation_bar.lua | 8 +- cylibs/ui/picker/picker_view.lua | 6 +- cylibs/ui/views/border/border_view.lua | 2 +- cylibs/ui/views/border/title_border_view.lua | 2 +- cylibs/util/States.lua | 4 +- data/RDM.lua | 93 +++++++++---------- manifest.json | 4 +- ui/TrustHud.lua | 7 +- ui/TrustInfoBar.lua | 12 ++- ui/settings/editors/GambitSettingsEditor.lua | 2 - ui/settings/editors/config/ConfigEditor.lua | 5 +- .../editors/config/ModeConfigEditor.lua | 82 ++++++++++++++++ .../menus/AlterEgoSettingsMenuItem.lua | 6 +- ui/settings/menus/FollowSettingsMenuItem.lua | 6 +- .../menus/WeaponSkillSettingsMenuItem.lua | 8 +- .../AttachmentSettingsMenuItem.lua | 2 +- .../attachments/AutomatonSettingsMenuItem.lua | 8 +- .../attachments/ManeuverSettingsMenuItem.lua | 10 -- .../menus/buffs/BloodPactSettingsMenuItem.lua | 6 +- .../menus/buffs/BuffSettingsMenuItem.lua | 19 ++++ .../menus/buffs/BufferSettingsMenuItem.lua | 6 +- .../menus/buffs/EntrustSettingsMenuItem.lua | 3 - .../menus/buffs/FoodSettingsMenuItem.lua | 6 +- .../menus/buffs/GeomancySettingsMenuItem.lua | 4 +- .../menus/gambits/GambitSettingsMenuItem.lua | 14 ++- .../gambits/JobGambitSettingsMenuItem.lua | 13 ++- .../gambits/react/ReactSettingsMenuItem.lua | 6 +- .../menus/healing/HealerSettingsMenuItem.lua | 12 ++- .../menus/loading/JobSettingsMenuItem.lua | 28 +++++- .../menus/loading/LoadSettingsMenuItem.lua | 2 +- .../menus/nukes/NukeSettingsMenuItem.lua | 6 +- .../menus/pulling/PullSettingsMenuItem.lua | 10 +- .../BuildSkillchainSettingsMenuItem.lua | 8 +- .../menus/songs/SongSettingsMenuItem.lua | 6 +- ui/settings/pickers/SpellPickerView.lua | 5 +- ui/themes/ffxi/FFXIBackgroundView.lua | 5 +- ui/themes/ffxi/FFXIClassicStyle.lua | 12 +++ ui/themes/ffxi/FFXIPickerView.lua | 14 ++- 62 files changed, 468 insertions(+), 185 deletions(-) create mode 100644 ui/settings/editors/config/ModeConfigEditor.lua diff --git a/Trust.lua b/Trust.lua index 5cee0306..1ecc885a 100644 --- a/Trust.lua +++ b/Trust.lua @@ -1,7 +1,7 @@ _addon.author = 'Cyrite' _addon.commands = {'Trust','trust'} _addon.name = 'Trust' -_addon.version = '10.5.0' +_addon.version = '10.5.3' _addon.release_notes = [[ This update introduces new menus for Bard, autocomplete for Trust commands, new commands and important bug fixes for users running the @@ -73,7 +73,7 @@ state.AutoUnloadOnDeathMode = M{['description'] = 'Auto Unload On Death Mode', ' state.AutoUnloadOnDeathMode:set_description('Off', "Okay, I'll pause Trust after getting knocked out but won't unload it. DO NOT USE WHILE AFK!") state.AutoUnloadOnDeathMode:set_description('Auto', "Okay, I'll automatically unload Trust after getting knocked out.") -state.AutoBuffMode = M{['description'] = 'Auto Buff Mode', 'Off', 'Auto'} +state.AutoBuffMode = M{['description'] = 'Buff Self and Party', 'Off', 'Auto'} state.AutoBuffMode:set_description('Auto', "Okay, I'll automatically buff myself and the party.") state.AutoEnmityReductionMode = M{['description'] = 'Auto Enmity Reduction Mode', 'Off', 'Auto'} @@ -312,15 +312,35 @@ function load_trust_commands(job_name_short, trust, action_queue, party, main_tr local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') - command_widget = FFXIPickerView.withItems(L{}, L{}) + command_widget = FFXIPickerView.withItems(L{}, L{}, false, nil, nil, nil, true) command_widget:setPosition(16, windower.get_windower_settings().ui_y_res - 233) command_widget:setShouldRequestFocus(false) command_widget:setUserInteractionEnabled(false) command_widget:setVisible(false) + local all_commands = L{} + + for command in common_commands:it() do + for text in command:get_all_commands():it() do + all_commands:append(text) + end + end + + for state_name, _ in pairs(state) do + local state_var = get_state(state_name) + if state_var then + all_commands:append('// trust cycle '..state_name) + for option in state_var:options():it() do + all_commands:append('// trust set '..state_name..' '..option) + end + end + end + + all_commands:sort() + local ChatAutoCompleter = require('cylibs/ui/input/autocomplete/chat_auto_completer') - chat_auto_completer = ChatAutoCompleter.new(common_commands) + chat_auto_completer = ChatAutoCompleter.new(all_commands) chat_auto_completer:onAutoCompleteListChange():addAction(function(_, terms) command_widget:getDataSource():removeAllItems() if not addon_settings:getSettings().autocomplete.visible then @@ -328,12 +348,12 @@ function load_trust_commands(job_name_short, trust, action_queue, party, main_tr end if terms:length() > 0 then command_widget:setVisible(true) - command_widget:setItems(terms, L{}) + command_widget:setItems(terms:map(function(term) return term:gsub("^// trust ", "") end), L{}) local description if terms:length() == 1 then hud.infoBar:setTitle("Commands") local args = string.split(terms[1], " ") - if args[3] and args[4] and shortcuts[args[3]] then + if args[3] and args[4] and shortcuts[args[3]] and type(shortcuts[args[3]]) ~= 'function' then description = shortcuts[args[3]]:get_description(args[4]) end end diff --git a/TrustSettings.lua b/TrustSettings.lua index 33dc11f1..bd39badc 100644 --- a/TrustSettings.lua +++ b/TrustSettings.lua @@ -144,6 +144,7 @@ function TrustSettings:deleteSettings(setName) end function TrustSettings:backupSettings(filePath) + filePath = filePath or self.settingsFolder..self.jobNameShort..'_'..windower.ffxi.get_player().name..'.lua' local playerSettings = FileIO.new(filePath) if playerSettings:exists() then local backupFilePath = self.settingsFolder..self.backupsFolder..self.jobNameShort..'_'..windower.ffxi.get_player().name..'.lua' diff --git a/commands/PullCommands.lua b/commands/PullCommands.lua index 8ee9f5b1..37377a40 100644 --- a/commands/PullCommands.lua +++ b/commands/PullCommands.lua @@ -13,6 +13,7 @@ function PullTrustCommands.new(trust, action_queue) self:add_command('auto', function(_) return self:handle_toggle_mode('AutoPullMode', 'Auto', 'Off') end, 'Automatically pull mobs for the party') self:add_command('party', function(_) return self:handle_toggle_mode('AutoPullMode', 'Party', 'Off') end, 'Automatically pull whatever monster the party is fighting') self:add_command('all', function(_) return self:handle_toggle_mode('AutoPullMode', 'All', 'Off') end, 'Automatically pull whatever monsters are nearby') + self:add_command('camp', self.handle_camp, 'Automatically return to camp after battle') return self end @@ -21,16 +22,23 @@ function PullTrustCommands:get_command_name() return 'pull' end --- // trust pull [auto, party, all] -function PullTrustCommands:handle_toggle_mode(mode_var_name, on_value, off_value) - local success = true +function PullTrustCommands:get_puller() + return self.trust:role_with_type("puller") +end + +-- // trust pull camp +function PullTrustCommands:handle_camp(_) + local success local message - local mode_var = get_state(mode_var_name) - if mode_var.value == on_value then - handle_set(mode_var_name, off_value) + if state.AutoCampMode.value == 'Off' then + success = false + message = "AutoCampMode must be set to Auto" else - handle_set(mode_var_name, on_value) + self:get_puller():set_camp_position(ffxi_util.get_mob_position(windower.ffxi.get_player().name)) + + success = true + message = "Return to the current position after battle" end return success, message diff --git a/cylibs/battle/spell.lua b/cylibs/battle/spell.lua index d1a71ead..b3e52a26 100644 --- a/cylibs/battle/spell.lua +++ b/cylibs/battle/spell.lua @@ -30,12 +30,16 @@ function Spell.new(spell_name, job_abilities, job_names, target, conditions, con local self = setmetatable({ spell_name = spell_name; job_abilities = job_abilities or L{}; - job_names = job_names or job_util.all_jobs(); + job_names = job_names; target = target; consumable = consumable; conditions = conditions or L{}; }, Spell) + if S(res.spells:with('en', spell_name)):contains('Party') then + job_names = job_names or job_util.all_jobs() + end + self:add_condition(SpellRecastReadyCondition.new(res.spells:with('en', spell_name).id)) local strategem_count = self.job_abilities:filter(function(job_ability_name) diff --git a/cylibs/battle/spells/debuff.lua b/cylibs/battle/spells/debuff.lua index d95f32db..f9217a18 100644 --- a/cylibs/battle/spells/debuff.lua +++ b/cylibs/battle/spells/debuff.lua @@ -34,7 +34,7 @@ function Debuff.new(spell_name, job_abilities, job_names, spell_prefix) end function Debuff:serialize() - return "Debuff.new(" .. serializer_util.serialize_args(self.original_spell_name, self.job_abilities, self.job_names, self.spell_prefix) .. ")" + return "Debuff.new(" .. serializer_util.serialize_args(self.original_spell_name, self.job_abilities, L{}, self.spell_prefix) .. ")" end return Debuff \ No newline at end of file diff --git a/cylibs/conditions/condition.lua b/cylibs/conditions/condition.lua index 1635ff86..a7c95876 100644 --- a/cylibs/conditions/condition.lua +++ b/cylibs/conditions/condition.lua @@ -104,6 +104,7 @@ function Condition.defaultSerializableConditionClasses() SkillchainPropertyCondition.__class, HasDazeCondition.__class, CombatSkillsCondition.__class, + NotCondition.__class, } end diff --git a/cylibs/conditions/job.lua b/cylibs/conditions/job.lua index d17de52b..13d764be 100644 --- a/cylibs/conditions/job.lua +++ b/cylibs/conditions/job.lua @@ -3,6 +3,7 @@ -- @class module -- @name JobCondition local MultiPickerConfigItem = require('ui/settings/editors/config/MultiPickerConfigItem') +local list_ext = require('cylibs/util/extensions/lists') local serializer_util = require('cylibs/util/serializer_util') local Condition = require('cylibs/conditions/condition') @@ -42,6 +43,10 @@ function JobCondition:tostring() if self.job_name_shorts:equals(job_util.all_jobs()) then return "Target job is any job" else + if self.job_name_shorts:length() > 15 then + local excluded_job_name_shorts = list.diff(self.job_name_shorts, job_util.all_jobs()) + return "Target is any job except "..localization_util.commas(excluded_job_name_shorts, 'or') + end return "Target job is "..localization_util.commas(self.job_name_shorts, 'or') end end diff --git a/cylibs/messages/ipc/ipc_relay.lua b/cylibs/messages/ipc/ipc_relay.lua index 001c7f61..514a44d1 100644 --- a/cylibs/messages/ipc/ipc_relay.lua +++ b/cylibs/messages/ipc/ipc_relay.lua @@ -14,7 +14,7 @@ local IpcRelay = {} IpcRelay.__index = IpcRelay IpcRelay.__class = "IpcRelay" -state.IpcMode = M{['description'] = 'Ipc Mode', 'All', 'Off', 'Send', 'Receive'} +state.IpcMode = M{['description'] = 'Send IPC Messages', 'All', 'Off', 'Send', 'Receive'} state.IpcMode:set_description('All', "Okay, I'll send and receive IPC messages.") state.IpcMode:set_description('Send', "Okay, I'll only send IPC messages.") state.IpcMode:set_description('Receive', "Okay, I'll only receive IPC messages.") diff --git a/cylibs/trust/data/BRD.lua b/cylibs/trust/data/BRD.lua index 2daeb000..ad0dbce2 100644 --- a/cylibs/trust/data/BRD.lua +++ b/cylibs/trust/data/BRD.lua @@ -17,18 +17,18 @@ local Puller = require('cylibs/trust/roles/puller') local Singer = require('cylibs/trust/roles/singer') local Sleeper = require('cylibs/trust/roles/sleeper') -state.AutoSongMode = M{['description'] = 'Auto Song Mode', 'Off', 'Auto', 'Dummy'} +state.AutoSongMode = M{['description'] = 'Sing Songs', 'Off', 'Auto', 'Dummy'} state.AutoSongMode:set_description('Auto', "Okay, I'll keep songs on the party.") state.AutoSongMode:set_description('Dummy', "Okay, I'll only sing dummy songs.") -state.AutoPianissimoMode = M{['description'] = 'Auto Pianissimo Mode', 'Merged', 'Override'} +state.AutoPianissimoMode = M{['description'] = 'Pianissimo Type', 'Merged', 'Override'} state.AutoPianissimoMode:set_description('Merged', "Okay, I'll make sure to keep all songs on everyone.") state.AutoPianissimoMode:set_description('Override', "Okay, I'll only focus on Pianissimo songs.") -state.AutoNitroMode = M{['description'] = 'Auto Nitro Mode', 'Auto', 'Off'} +state.AutoNitroMode = M{['description'] = 'Use Nitro', 'Auto', 'Off'} state.AutoNitroMode:set_description('Auto', "Okay, I'll use Nightingale and Troubadour before singing songs.") -state.AutoClarionCallMode = M{['description'] = 'Auto Clarion Call Mode', 'Off', 'Auto'} +state.AutoClarionCallMode = M{['description'] = 'Use Clarion Call', 'Off', 'Auto'} state.AutoClarionCallMode:set_description('Auto', "Okay, I'll use Clarion Call before Nightingale and Troubadour.") function BardTrust.new(settings, action_queue, battle_settings, trust_settings) diff --git a/cylibs/trust/data/PUP.lua b/cylibs/trust/data/PUP.lua index 34aeec58..571176ab 100644 --- a/cylibs/trust/data/PUP.lua +++ b/cylibs/trust/data/PUP.lua @@ -18,10 +18,17 @@ Automaton = require('cylibs/entity/automaton') local Dispeler = require('cylibs/trust/roles/dispeler') local Buffer = require('cylibs/trust/roles/buffer') -state.AutoAssaultMode = M{['description'] = 'Auto Assault Mode', 'Off', 'Auto'} -state.AutoManeuverMode = M{['description'] = 'Auto Maneuver Mode', 'Off', 'Auto'} -state.AutoPetMode = M{['description'] = 'Auto Pet Mode', 'Off', 'Auto'} -state.AutoRepairMode = M{['description'] = 'Auto Repair Mode', 'Auto', 'Off'} +state.AutoAssaultMode = M{['description'] = 'Deploy Pet in Battle', 'Off', 'Auto'} +state.AutoAssaultMode:set_description('Auto', "Okay, my pet will fight with me!") + +state.AutoManeuverMode = M{['description'] = 'Use Maneuvers', 'Off', 'Auto'} +state.AutoManeuverMode:set_description('Auto', "Okay, I'll automatically use maneuvers.") + +state.AutoPetMode = M{['description'] = 'Call Pet', 'Off', 'Auto'} +state.AutoPetMode:set_description('Auto', "Okay, I'll automatically call a pet.") + +state.AutoRepairMode = M{['description'] = 'Use Repair', 'Auto', 'Off'} +state.AutoRepairMode:set_description('Auto', "Okay, I'll use repair when my automaton's HP is low.") function PuppetmasterTrust.new(settings, action_queue, battle_settings, trust_settings) local roles = S{ @@ -40,7 +47,7 @@ function PuppetmasterTrust.new(settings, action_queue, battle_settings, trust_se local mode_names = T(T(trust_settings.AutomatonSettings.ManeuverSettings.Default):keyset()):map(function(m) return m end) - state.ManeuverMode = M{['description'] = 'Maneuver Mode', mode_names} + state.ManeuverMode = M{['description'] = 'Maneuver Set', mode_names} for mode_name in mode_names:it() do state.ManeuverMode:set_description(mode_name, 'Maneuver set for '..mode_name..' pet type.') end diff --git a/cylibs/trust/roles/buffer.lua b/cylibs/trust/roles/buffer.lua index cfe7e228..a6561ce3 100644 --- a/cylibs/trust/roles/buffer.lua +++ b/cylibs/trust/roles/buffer.lua @@ -92,6 +92,11 @@ function Buffer:conditions_check(spell, target) return true end +function Buffer:job_names_check(spell, party_member) + local job_names = spell:get_job_names() or L{} + return job_names:length() == 0 or spell:get_job_names():contains(party_member:get_main_job_short()) +end + function Buffer:check_buffs() local player_buff_ids = L(windower.ffxi.get_player().buffs) @@ -144,7 +149,7 @@ function Buffer:check_buffs() local buff = buff_util.buff_for_spell(spell:get_spell().id) if buff and not (party_member:has_buff(buff.id) or (party_member:is_trust() and self.buff_tracker:has_buff(party_member:get_mob().id, buff.id))) and not (buff_util.conflicts_with_buffs(buff.id, party_member:get_buff_ids())) - and spell:get_job_names():contains(party_member:get_main_job_short()) and spell_util.can_cast_spell(spell:get_spell().id) then + and self:job_names_check(spell, party_member) and spell_util.can_cast_spell(spell:get_spell().id) then local target = party_member:get_mob() if target and self:conditions_check(spell, target) then if self:cast_spell(spell, target.index) then diff --git a/cylibs/trust/roles/debuffer.lua b/cylibs/trust/roles/debuffer.lua index 5fbff51f..54f403a4 100644 --- a/cylibs/trust/roles/debuffer.lua +++ b/cylibs/trust/roles/debuffer.lua @@ -6,10 +6,10 @@ local Debuffer = setmetatable({}, {__index = Role }) Debuffer.__index = Debuffer Debuffer.__class = "Debuffer" -state.AutoDebuffMode = M{['description'] = 'Auto Debuff Mode', 'Off', 'Auto'} +state.AutoDebuffMode = M{['description'] = 'Debuff Enemies', 'Off', 'Auto'} state.AutoDebuffMode:set_description('Auto', "Okay, I'll debuff the monster.") -state.AutoSilenceMode = M{['description'] = 'Auto Silence Mode', 'Off', 'Auto'} +state.AutoSilenceMode = M{['description'] = 'Silence Casters', 'Off', 'Auto'} state.AutoSilenceMode:set_description('Auto', "Okay, I'll try to silence monsters that cast spells.") function Debuffer.new(action_queue, debuff_spells) diff --git a/cylibs/trust/roles/follower.lua b/cylibs/trust/roles/follower.lua index 6747b169..e672b76f 100644 --- a/cylibs/trust/roles/follower.lua +++ b/cylibs/trust/roles/follower.lua @@ -12,7 +12,7 @@ local SequenceAction = require('cylibs/actions/sequence') local WaitAction = require('cylibs/actions/wait') local zone_util = require('cylibs/util/zone_util') -state.AutoFollowMode = M{['description'] = 'Auto Follow Mode', 'Off', 'Always'} +state.AutoFollowMode = M{['description'] = 'Follow', 'Off', 'Always'} state.AutoFollowMode:set_description('Off', "Okay, I'll no longer follow anyone.") state.AutoFollowMode:set_description('Always', "Okay, I'll follow when not in battle.") diff --git a/cylibs/trust/roles/gambiter.lua b/cylibs/trust/roles/gambiter.lua index 908cc00a..7dba8d50 100644 --- a/cylibs/trust/roles/gambiter.lua +++ b/cylibs/trust/roles/gambiter.lua @@ -5,7 +5,7 @@ local Gambiter = setmetatable({}, {__index = Role }) Gambiter.__index = Gambiter Gambiter.__class = "Gambiter" -state.AutoGambitMode = M{['description'] = 'Auto Gambit Mode', 'Auto', 'Off'} +state.AutoGambitMode = M{['description'] = 'Use Gambits', 'Auto', 'Off'} state.AutoGambitMode:set_description('Off', "Okay, I'll ignore any gambits you've set.") state.AutoGambitMode:set_description('Auto', "Okay, I'll customize my battle plan with gambits.") diff --git a/cylibs/trust/roles/healer.lua b/cylibs/trust/roles/healer.lua index 5251c063..d17a9e81 100644 --- a/cylibs/trust/roles/healer.lua +++ b/cylibs/trust/roles/healer.lua @@ -10,7 +10,7 @@ local Healer = setmetatable({}, {__index = Role }) Healer.__index = Healer Healer.__class = "Healer" -state.AutoHealMode = M{['description'] = 'Auto Heal Mode', 'Auto', 'Emergency', 'Off'} +state.AutoHealMode = M{['description'] = 'Heal Player and Party', 'Auto', 'Emergency', 'Off'} state.AutoHealMode:set_description('Auto', "You can count on me to heal the party.") state.AutoHealMode:set_description('Emergency', "Okay, I'll only heal when you're in a pinch.") diff --git a/cylibs/trust/roles/magic_burster.lua b/cylibs/trust/roles/magic_burster.lua index 0e78a3f8..db16634a 100644 --- a/cylibs/trust/roles/magic_burster.lua +++ b/cylibs/trust/roles/magic_burster.lua @@ -10,7 +10,7 @@ local Renderer = require('cylibs/ui/views/render') local skillchain_util = require('cylibs/util/skillchain_util') local spell_util = require('cylibs/util/spell_util') -state.AutoMagicBurstMode = M{['description'] = 'Auto Magic Burst Mode', 'Off', 'Auto', 'Earth', 'Lightning', 'Water', 'Fire', 'Ice', 'Wind', 'Light', 'Dark'} +state.AutoMagicBurstMode = M{['description'] = 'Magic Burst', 'Off', 'Auto', 'Earth', 'Lightning', 'Water', 'Fire', 'Ice', 'Wind', 'Light', 'Dark'} state.AutoMagicBurstMode:set_description('Auto', "Okay, if you make skillchains I'll try to magic burst.") state.AutoMagicBurstMode:set_description('Earth', "Okay, I'll only magic burst with earth spells.") state.AutoMagicBurstMode:set_description('Lightning', "Okay, I'll only magic burst with lightning spells.") @@ -21,7 +21,7 @@ state.AutoMagicBurstMode:set_description('Wind', "Okay, I'll only magic burst wi state.AutoMagicBurstMode:set_description('Light', "Okay, I'll only magic burst with light spells.") state.AutoMagicBurstMode:set_description('Dark', "Okay, I'll only magic burst with dark spells.") -state.MagicBurstTargetMode = M{['description'] = 'Magic Burst Target Mode', 'Single', 'All'} +state.MagicBurstTargetMode = M{['description'] = 'Magic Burst Target Type', 'Single', 'All'} state.MagicBurstTargetMode:set_description('Single', "Okay, I'll only magic burst with single target spells.") state.MagicBurstTargetMode:set_description('All', "Okay, I'll magic burst with both single target and AOE spells.") diff --git a/cylibs/trust/roles/nuker.lua b/cylibs/trust/roles/nuker.lua index c3b0d182..7a30f749 100644 --- a/cylibs/trust/roles/nuker.lua +++ b/cylibs/trust/roles/nuker.lua @@ -5,7 +5,7 @@ local DisposeBag = require('cylibs/events/dispose_bag') local skillchain_util = require('cylibs/util/skillchain_util') local spell_util = require('cylibs/util/spell_util') -state.AutoNukeMode = M{['description'] = 'Auto Nuke Mode', 'Off', 'Earth', 'Lightning', 'Water', 'Fire', 'Ice', 'Wind', 'Light', 'Dark', 'Cleave'} +state.AutoNukeMode = M{['description'] = 'Free Nuke', 'Off', 'Earth', 'Lightning', 'Water', 'Fire', 'Ice', 'Wind', 'Light', 'Dark', 'Cleave'} state.AutoNukeMode:set_description('Earth', "Okay, I'll free nuke with earth spells.") state.AutoNukeMode:set_description('Lightning', "Okay, I'll free nuke with lightning spells.") state.AutoNukeMode:set_description('Water', "Okay, I'll free nuke with water spells.") diff --git a/cylibs/trust/roles/puller.lua b/cylibs/trust/roles/puller.lua index 438a5a77..abb8b038 100644 --- a/cylibs/trust/roles/puller.lua +++ b/cylibs/trust/roles/puller.lua @@ -2,19 +2,24 @@ local Approach = require('cylibs/battle/approach') local ClaimedCondition = require('cylibs/conditions/claimed') local DisposeBag = require('cylibs/events/dispose_bag') local ffxi_util = require('cylibs/util/ffxi_util') +local RunToLocationAction = require('cylibs/actions/runtolocation') local SwitchTargetAction = require('cylibs/actions/switch_target') local Puller = setmetatable({}, {__index = Role }) Puller.__index = Puller Puller.__class = "Puller" -state.AutoPullMode = M{['description'] = 'Auto Pull Mode', 'Off', 'Auto','Party','All'} +state.AutoPullMode = M{['description'] = 'Pull Monsters to Fight', 'Off', 'Auto','Party','All'} state.AutoPullMode:set_description('Off', "Okay, I won't pull monsters for the party.") state.AutoPullMode:set_description('Auto', "Okay, I'll automatically pull monsters for the party.") state.AutoPullMode:set_description('Party', "Okay, I'll pull monsters the party is fighting.") state.AutoPullMode:set_description('All', "Okay, I'll pull any monster that's nearby.") -state.ApproachPullMode = M{['description'] = 'Approach Pull Mode', 'Off', 'Auto'} +state.AutoCampMode = M{['description'] = 'Return to Camp after Battle', 'Off', 'Auto'} +state.AutoCampMode:set_description('Off', "Okay, I won't return to camp after battle.") +state.AutoCampMode:set_description('Auto', "Okay, I'll return to camp after battle (set camp with // trust pull camp).") + +state.ApproachPullMode = M{['description'] = 'Force Pull with Approach', 'Off', 'Auto'} state.ApproachPullMode:set_description('Auto', "Okay, I'll pull by engaging and approaching instead.") @@ -65,10 +70,28 @@ function Puller:on_add() self.dispose_bag:add(WindowerEvents.MobKO:addAction(function(mob_id, mob_name) if self:get_pull_target() and self:get_pull_target():get_id() == mob_id then self:set_pull_target(nil) + self:return_to_camp() end end), WindowerEvents.MobKO) end +function Puller:return_to_camp() + if state.AutoCampMode.value == 'Off' or self:get_camp_position() == nil then + return + end + + if ffxi_util.distance(ffxi_util.get_mob_position(windower.ffxi.get_player().name), self:get_camp_position()) > 40 then + self:set_camp_position(nil) + self:get_party():add_to_chat(self:get_party():get_player(), "I'm too far from camp to go back now.") + return + end + + local return_to_camp_action = RunToLocationAction.new(self:get_camp_position()[1], self:get_camp_position()[2], self:get_camp_position()[3], 2.0) + return_to_camp_action.identifier = "Return to camp" + + self.action_queue:push_action(return_to_camp_action, true) +end + function Puller:target_change(target_index) Role.target_change(self, target_index) @@ -253,6 +276,14 @@ function Puller:get_target_names() return self.target_names end +function Puller:set_camp_position(position) + self.camp_position = position +end + +function Puller:get_camp_position() + return self.camp_position +end + function Puller:allows_duplicates() return false end diff --git a/cylibs/trust/roles/skillchainer.lua b/cylibs/trust/roles/skillchainer.lua index 090f723d..45db0096 100644 --- a/cylibs/trust/roles/skillchainer.lua +++ b/cylibs/trust/roles/skillchainer.lua @@ -11,20 +11,20 @@ local SkillchainPropertyCondition = require('cylibs/conditions/skillchain_proper local SkillchainTracker = require('cylibs/battle/skillchains/skillchain_tracker') local skillchain_util = require('cylibs/util/skillchain_util') -state.AutoSkillchainMode = M{['description'] = 'Auto Skillchain Mode', 'Off', 'Auto', 'Cleave', 'Spam'} +state.AutoSkillchainMode = M{['description'] = 'Create Skillchains', 'Off', 'Auto', 'Cleave', 'Spam'} state.AutoSkillchainMode:set_description('Off', "Okay, I won't use weapon skills or make skillchains.") state.AutoSkillchainMode:set_description('Auto', "Okay, I'll try to make skillchains.") -state.SkillchainPropertyMode = M{['description'] = 'Skillchain Property Mode', 'Off', 'Light', 'Darkness'} +state.SkillchainPropertyMode = M{['description'] = 'Skillchain Properties', 'Off', 'Light', 'Darkness'} state.SkillchainPropertyMode:set_description('Off', "Okay, I'll try to make skillchains of all properties.") state.SkillchainPropertyMode:set_description('Light', "Okay, I'll only make Light skillchains unless I have instructions to use certain weapon skills.") state.SkillchainPropertyMode:set_description('Darkness', "Okay, I'll only make Darkness skillchains unless I have instructions to use certain weapon skills.") -state.SkillchainDelayMode = M{['description'] = 'Skillchain Delay Mode', 'Off', 'Maximum'} +state.SkillchainDelayMode = M{['description'] = 'Delay Between Weapon Skills', 'Off', 'Maximum'} state.SkillchainDelayMode:set_description('Off', "Okay, I'll use the next weapon skill as soon as the skillchain window opens.") state.SkillchainDelayMode:set_description('Maximum', "Okay, I'll wait until the end of the skillchain window to use my next weapon skill.") -state.SkillchainAssistantMode = M{['description'] = 'Skillchain Assistant Mode', 'Auto', 'Off'} +state.SkillchainAssistantMode = M{['description'] = 'Show Skillchain Assistant', 'Auto', 'Off'} state.SkillchainAssistantMode:set_description('Auto', "Okay, I'll suggest weapon skills you can use to continue the skillchain.") state.SkillchainAssistantMode:set_description('Off', "Okay, I'll keep my suggestions to myself!") diff --git a/cylibs/trust/roles/status_remover.lua b/cylibs/trust/roles/status_remover.lua index 18b0ef64..28861f7f 100644 --- a/cylibs/trust/roles/status_remover.lua +++ b/cylibs/trust/roles/status_remover.lua @@ -9,10 +9,10 @@ local StatusRemover = setmetatable({}, {__index = Role }) StatusRemover.__index = StatusRemover StatusRemover.__class = "StatusRemover" -state.AutoStatusRemovalMode = M{['description'] = 'Auto Status Removal Mode', 'Auto', 'Off'} +state.AutoStatusRemovalMode = M{['description'] = 'Remove Status Ailments', 'Auto', 'Off'} state.AutoStatusRemovalMode:set_description('Auto', "Okay, I'll remove status effects.") -state.AutoDetectAuraMode = M{['description'] = 'Auto Detect Aura Mode', 'Off', 'Auto'} +state.AutoDetectAuraMode = M{['description'] = 'Detect Auras', 'Off', 'Auto'} state.AutoDetectAuraMode:set_description('Auto', "Okay, I'll try not to remove status effects caused by auras.") ------- diff --git a/cylibs/trust/roles/truster.lua b/cylibs/trust/roles/truster.lua index 24bf56a4..796746be 100644 --- a/cylibs/trust/roles/truster.lua +++ b/cylibs/trust/roles/truster.lua @@ -5,7 +5,7 @@ local Truster = setmetatable({}, {__index = Role }) Truster.__index = Truster Truster.__class = "Truster" -state.AutoTrustsMode = M{['description'] = 'Auto Trusts Mode', 'Off', 'Auto'} +state.AutoTrustsMode = M{['description'] = 'Call Alter Egos', 'Off', 'Auto'} state.AutoTrustsMode:set_description('Auto', "Okay, I'll automatically summon trusts before battle.") function Truster.new(action_queue, trusts) diff --git a/cylibs/ui/collection_view/cells/marquee_collection_view_cell.lua b/cylibs/ui/collection_view/cells/marquee_collection_view_cell.lua index 59d1daac..911df098 100644 --- a/cylibs/ui/collection_view/cells/marquee_collection_view_cell.lua +++ b/cylibs/ui/collection_view/cells/marquee_collection_view_cell.lua @@ -15,9 +15,10 @@ MarqueeCollectionViewCell.__type = "MarqueeCollectionViewCell" -- @tparam TextItem item The item associated with the cell. -- @treturn CollectionViewCell The newly created cell. -- -function MarqueeCollectionViewCell.new(item) +function MarqueeCollectionViewCell.new(item, multiplier) local self = setmetatable(TextCollectionViewCell.new(item), MarqueeCollectionViewCell) + self.multiplier = multiplier or 1 self.currentIndex = -1 self.numCharacters = 10 self.currentText = self:getItem():getText() @@ -59,9 +60,9 @@ function MarqueeCollectionViewCell:setVisible(visible) end function MarqueeCollectionViewCell:updateNumCharacters() - local multiplier = 1 + local multiplier = self.multiplier if self:getItem():getStyle():isBold() then - multiplier = 1.2 + multiplier = multiplier * 1.2 end self.numCharacters = math.floor(self:getSize().width / (self:getItem():getStyle():getFontSize() * multiplier) + 6) end diff --git a/cylibs/ui/collection_view/collection_view.lua b/cylibs/ui/collection_view/collection_view.lua index 7b3bc4b0..5a09ba5c 100644 --- a/cylibs/ui/collection_view/collection_view.lua +++ b/cylibs/ui/collection_view/collection_view.lua @@ -18,6 +18,16 @@ function CollectionView.setDefaultStyle(style) defaultStyle = style end +local defaultBackgroundStyle + +function CollectionView.defaultBackgroundStyle() + return defaultBackgroundStyle +end + +function CollectionView.setDefaultBackgroundStyle(style) + defaultBackgroundStyle = style +end + --- -- Creates a new CollectionView instance with the specified data source and layout. -- @@ -81,11 +91,13 @@ function CollectionView.new(dataSource, layout, delegate, style) self.delegate:didMoveCursorToItemAtIndexPath():addAction(function(cursorIndexPath) local cell = self:getDataSource():cellForItemAtIndexPath(cursorIndexPath) if cell then - self.selectionBackground:setPosition(cell:getPosition().x - self.cursorImageItem:getSize().width - 7, cell:getPosition().y + (cell:getSize().height - self.cursorImageItem:getSize().height) / 2) - self.selectionBackground:setSize(self.cursorImageItem:getSize().width, self.cursorImageItem:getSize().height) - self.selectionBackground:setVisible(self:hasFocus()) - self.selectionBackground:setNeedsLayout() - self.selectionBackground:layoutIfNeeded() + if self.selectionBackground then + self.selectionBackground:setPosition(cell:getPosition().x - self.cursorImageItem:getSize().width - 7, cell:getPosition().y + (cell:getSize().height - self.cursorImageItem:getSize().height) / 2) + self.selectionBackground:setSize(self.cursorImageItem:getSize().width, self.cursorImageItem:getSize().height) + self.selectionBackground:setVisible(self:hasFocus()) + self.selectionBackground:setNeedsLayout() + self.selectionBackground:layoutIfNeeded() + end end end) diff --git a/cylibs/ui/input/autocomplete/chat_auto_completer.lua b/cylibs/ui/input/autocomplete/chat_auto_completer.lua index fe8b63d7..3220274c 100644 --- a/cylibs/ui/input/autocomplete/chat_auto_completer.lua +++ b/cylibs/ui/input/autocomplete/chat_auto_completer.lua @@ -15,9 +15,7 @@ function ChatAutoCompleter.new(commands) self.commandTrie = CommandTrie.new() for command in commands:it() do - for text in command:get_all_commands():it() do - self.commandTrie:addCommand(text) - end + self.commandTrie:addCommand(command) end self.disposeBag = DisposeBag.new() diff --git a/cylibs/ui/navigation/navigation_bar.lua b/cylibs/ui/navigation/navigation_bar.lua index 90d30035..38207e5a 100644 --- a/cylibs/ui/navigation/navigation_bar.lua +++ b/cylibs/ui/navigation/navigation_bar.lua @@ -1,18 +1,19 @@ local BackgroundView = require('cylibs/ui/views/background/background_view') local FFXIBackgroundView = require('ui/themes/ffxi/FFXIBackgroundView') local Frame = require('cylibs/ui/views/frame') +local MarqueeCollectionViewCell = require('cylibs/ui/collection_view/cells/marquee_collection_view_cell') local TextCollectionViewCell = require('cylibs/ui/collection_view/cells/text_collection_view_cell') local TextItem = require('cylibs/ui/collection_view/items/text_item') local TextStyle = require('cylibs/ui/style/text_style') -local NavigationBar = setmetatable({}, { __index = TextCollectionViewCell }) +local NavigationBar = setmetatable({}, { __index = MarqueeCollectionViewCell }) NavigationBar.__index = NavigationBar function NavigationBar.new(frame, hideBackground, textStyle) textStyle = textStyle or TextStyle.Default.NavigationTitle - local self = setmetatable(TextCollectionViewCell.new(TextItem.new('', textStyle)), NavigationBar) + local self = setmetatable(MarqueeCollectionViewCell.new(TextItem.new('', textStyle), 0.65), NavigationBar) self:setItemSize(frame.height) self:setEstimatedSize(textStyle:getFontSize() * 1.75) @@ -23,6 +24,7 @@ function NavigationBar.new(frame, hideBackground, textStyle) if not hideBackground then local backgroundView = FFXIBackgroundView.new(frame, true) + backgroundView:setShouldRequestFocus(false) self:setBackgroundImageView(backgroundView) @@ -37,7 +39,7 @@ function NavigationBar.new(frame, hideBackground, textStyle) end function NavigationBar:destroy() - TextCollectionViewCell.destroy(self) + MarqueeCollectionViewCell.destroy(self) end function NavigationBar:setTitle(title) diff --git a/cylibs/ui/picker/picker_view.lua b/cylibs/ui/picker/picker_view.lua index 3c1ddd26..c20eec1a 100644 --- a/cylibs/ui/picker/picker_view.lua +++ b/cylibs/ui/picker/picker_view.lua @@ -126,10 +126,12 @@ function PickerView:reload() end end -function PickerView:setItems(texts, selectedTexts) +function PickerView:setItems(texts, selectedTexts, shouldTruncateText) selectedTexts = selectedTexts or L{} self.pickerItems = L{ texts:map(function(text) - return PickerItem.new(TextItem.new(text, TextStyle.PickerView.Text), selectedTexts:contains(text)) + local textItem = TextItem.new(text, TextStyle.PickerView.Text) + textItem:setShouldTruncateText(shouldTruncateText) + return PickerItem.new(textItem, selectedTexts:contains(text)) end) } self:reload() end diff --git a/cylibs/ui/views/border/border_view.lua b/cylibs/ui/views/border/border_view.lua index f983b844..d346f13b 100644 --- a/cylibs/ui/views/border/border_view.lua +++ b/cylibs/ui/views/border/border_view.lua @@ -21,7 +21,7 @@ BorderView.__index = BorderView -- @treturn BackgroundView The created background view. -- function BorderView.new(frame, resizableImageItem) - local self = setmetatable(CollectionView.new(CollectionViewDataSource.new(), HorizontalFlowLayout.new(0)), BorderView) + local self = setmetatable(CollectionView.new(CollectionViewDataSource.new(), HorizontalFlowLayout.new(0), nil, CollectionView.defaultBackgroundStyle()), BorderView) self.borderImageItem = resizableImageItem diff --git a/cylibs/ui/views/border/title_border_view.lua b/cylibs/ui/views/border/title_border_view.lua index 7684d201..ebddee70 100644 --- a/cylibs/ui/views/border/title_border_view.lua +++ b/cylibs/ui/views/border/title_border_view.lua @@ -41,7 +41,7 @@ TitleBorderView.HeaderSmall = TextStyle.new( -- @treturn BackgroundView The created background view. -- function TitleBorderView.new(frame, resizableImageItem) - local self = setmetatable(CollectionView.new(CollectionViewDataSource.new(), HorizontalFlowLayout.new(0)), TitleBorderView) + local self = setmetatable(CollectionView.new(CollectionViewDataSource.new(), HorizontalFlowLayout.new(0), nil, CollectionView.defaultBackgroundStyle()), TitleBorderView) self.borderImageItem = resizableImageItem self.title = "" diff --git a/cylibs/util/States.lua b/cylibs/util/States.lua index 51871bc1..30385c24 100644 --- a/cylibs/util/States.lua +++ b/cylibs/util/States.lua @@ -27,7 +27,7 @@ function handle_cycle(field) local descrip = state_var.description or field - addon_message(122,descrip..' is now '..state_var.current..'.') + addon_message(122,field..' is now '..state_var.current..'.') --handle_update({'auto'}) else addon_message(123,'Cycle: Unknown field ['..field..']') @@ -71,7 +71,7 @@ function handle_set(field, value) state_change(descrip, newVal, oldVal) end - local msg = descrip..' is now '..state_var.current + local msg = field..' is now '..state_var.current if state_var == state.DefenseMode and newVal ~= 'None' then msg = msg .. ' (' .. state[newVal .. 'DefenseMode'].current .. ')' end diff --git a/data/RDM.lua b/data/RDM.lua index fbb38a99..67bca40b 100644 --- a/data/RDM.lua +++ b/data/RDM.lua @@ -2,18 +2,29 @@ return { Version = 2, Default = { - AutoFood = "Grape Daifuku", SelfBuffs = L{ - Buff.new("Refresh", L{}, L{}, nil, L{}), Buff.new("Haste", L{}, L{}, nil, L{}), + Buff.new("Refresh", L{}, L{}, nil, L{}), + Spell.new("Phalanx", L{}, L{}, nil, L{}), Buff.new("Temper", L{}, L{}, nil, L{InBattleCondition.new()}), - Spell.new("Enblizzard", L{}, L{}, nil, L{InBattleCondition.new(), MainJobCondition.new('RDM')}), - Spell.new("Gain-INT", L{}, L{}, nil, L{IdleCondition.new()}), - Spell.new("Gain-STR", L{}, L{}, nil, L{InBattleCondition.new()}), - Spell.new("Phalanx", L{}, nil, nil, L{}), + Spell.new("Enblizzard", L{}, L{}, nil, L{InBattleCondition.new(), MainJobCondition.new("RDM")}), + Spell.new("Gain-INT", L{}, L{}, nil, L{NotCondition.new(L{ModeCondition.new("AutoMagicBurstMode", "Off")})}), + Spell.new("Gain-STR", L{}, L{}, nil, L{ModeCondition.new("AutoMagicBurstMode", "Off")}), Buff.new("Protect", L{}, L{}, nil, L{}), Buff.new("Shell", L{}, L{}, nil, L{}) }, + GambitSettings = { + Default = L{ + Gambit.new("Self", L{MaxManaPointsPercentCondition.new(20), ModeCondition.new("AutoConvertMode", "Auto")}, JobAbility.new("Convert", L{}, L{}), "Self", L{}) + }, + Gambits = L{ + Gambit.new("Enemy", L{MeleeAccuracyCondition.new(75, "<="), MainJobCondition.new("RDM"), NumResistsCondition.new("Distract", "<", 3), NumResistsCondition.new("Distract II", "<", 3), NumResistsCondition.new("Distract III", "<", 3)}, Debuff.new("Distract", L{}, L{}), "Self", L{}) + } + }, + JobAbilities = L{ + JobAbility.new("Composure", L{}, L{}) + }, + AutoFood = "Grape Daifuku", CureSettings = { Thresholds = { ["Cure IV"] = 1500, @@ -22,64 +33,50 @@ return { ["Cure II"] = 0, ["Cure III"] = 600 }, - Delay = 2, - MinNumAOETargets = 3 - }, - JobAbilities = L{ - JobAbility.new('Composure', L{}, L{}, nil), + MinNumAOETargets = 3, + Delay = 2 }, PartyBuffs = L{ - Buff.new("Refresh", L{}, L{"DRK", "PUP", "PLD", "BLU", "BLM", "BRD", "GEO", "SMN", "WHM", "RUN"}, nil, L{}), - Buff.new("Haste", L{}, L{"WAR", "PLD", "BRD", "SAM", "DRG", "BLU", "PUP", "RUN", "MNK", "THF", "BST", "NIN", "DNC", "DRK", "GEO", "SCH", "BLM"}, nil, L{}), - Buff.new("Haste", L{}, L{"COR"}, nil, L{InBattleCondition.new()}), - Buff.new("Flurry", L{}, L{"RNG", "COR"}, nil, L{IdleCondition.new()}), - Spell.new("Phalanx II", L{}, L{"WAR", "PLD", "BRD", "SAM", "DRG", "BLU", "PUP", "RUN", "MNK", "THF", "BST", "NIN", "DNC", "DRK", "GEO"}, nil, L{InBattleCondition.new()}) + Buff.new("Haste", L{}, L{}, nil, L{JobCondition.new(L{"WAR", "NIN", "BST", "GEO", "SCH", "DRK", "DRG", "PUP", "BLU", "BLM", "THF", "PLD", "BRD", "SAM", "MNK", "RUN", "COR", "DNC", "RNG"})}), + Buff.new("Refresh", L{}, L{}, nil, L{JobCondition.new(L{"DRK", "PLD", "BLU", "BLM", "BRD", "GEO", "SMN", "WHM", "RUN"})}), + Spell.new("Phalanx II", L{}, L{}, nil, L{InBattleCondition.new(), JobCondition.new(L{"NIN", "DNC", "GEO", "DRK", "SAM", "COR", "RNG", "PLD", "BRD", "WAR", "PUP", "DRG", "MNK", "RUN", "THF", "BST", "BLU"})}), }, NukeSettings = { - Delay = 4, - MinManaPointsPercent = 40, MinNumMobsToCleave = 2, + MinManaPointsPercent = 40, Spells = L{ - Spell.new('Thunder V'), - Spell.new('Thunder IV'), - Spell.new('Thunder III'), - Spell.new('Blizzard V'), - Spell.new('Blizzard IV'), - Spell.new('Blizzard III'), - Spell.new('Fire V'), - Spell.new('Fire IV'), - Spell.new('Fire III'), - Spell.new('Aero V'), - Spell.new('Aero IV'), - Spell.new('Aero III'), - Spell.new('Water V'), - Spell.new('Water IV'), - Spell.new('Water III'), - Spell.new('Stone V'), - Spell.new('Stone IV'), - Spell.new('Stone III'), + Spell.new("Thunder V", L{}, nil, nil, L{}), + Spell.new("Thunder IV", L{}, nil, nil, L{}), + Spell.new("Thunder III", L{}, nil, nil, L{}), + Spell.new("Blizzard V", L{}, nil, nil, L{}), + Spell.new("Blizzard IV", L{}, nil, nil, L{}), + Spell.new("Blizzard III", L{}, nil, nil, L{}), + Spell.new("Fire V", L{}, nil, nil, L{}), + Spell.new("Fire IV", L{}, nil, nil, L{}), + Spell.new("Fire III", L{}, nil, nil, L{}), + Spell.new("Aero V", L{}, nil, nil, L{}), + Spell.new("Aero IV", L{}, nil, nil, L{}), + Spell.new("Aero III", L{}, nil, nil, L{}), + Spell.new("Water V", L{}, nil, nil, L{}), + Spell.new("Water IV", L{}, nil, nil, L{}), + Spell.new("Water III", L{}, nil, nil, L{}), + Spell.new("Stone V", L{}, nil, nil, L{}), + Spell.new("Stone IV", L{}, nil, nil, L{}), + Spell.new("Stone III", L{}, nil, nil, L{}) }, + Delay = 4, Blacklist = L{ - }, + } }, Debuffs = L{ - Debuff.new("Distract", L{}) + Debuff.new("Distract", L{}, L{}) }, PullSettings = { Abilities = L{ Debuff.new("Dia", L{}, L{}) }, Distance = 20 - }, - GambitSettings = { - Default = L{ - Gambit.new("Self", L{MaxManaPointsPercentCondition.new(20), ModeCondition.new("AutoConvertMode", "Auto")}, JobAbility.new("Convert", L{}, L{}), "Self"), - Gambit.new("Enemy", L{MeleeAccuracyCondition.new(75, "<="), MainJobCondition.new("RDM"), NumResistsCondition.new("Distract", "<", 3), NumResistsCondition.new("Distract II", "<", 3), NumResistsCondition.new("Distract III", "<", 3)}, Debuff.new("Distract", L{}, L{}), "Self"), - }, - Gambits = L{ - - } - }, + } } } \ No newline at end of file diff --git a/manifest.json b/manifest.json index bcd55ed7..4a1ab274 100644 --- a/manifest.json +++ b/manifest.json @@ -1,4 +1,4 @@ { - "version": "10.5.0", - "download_url": "https://github.com/cyritegamestudios/trust/releases/download/v10.5.0/trust.zip" + "version": "10.5.3", + "download_url": "https://github.com/cyritegamestudios/trust/archive/refs/heads/alpha.zip" } diff --git a/ui/TrustHud.lua b/ui/TrustHud.lua index b1e41077..b8e35933 100644 --- a/ui/TrustHud.lua +++ b/ui/TrustHud.lua @@ -25,7 +25,7 @@ local Keybind = require('cylibs/ui/input/keybind') local Keyboard = require('cylibs/ui/input/keyboard') local MenuItem = require('cylibs/ui/menu/menu_item') local ModesMenuItem = require('ui/settings/menus/ModesMenuItem') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local NavigationBar = require('cylibs/ui/navigation/navigation_bar') local PullSettingsMenuItem = require('ui/settings/menus/pulling/PullSettingsMenuItem') local LoadSettingsMenuItem = require('ui/settings/menus/loading/LoadSettingsMenuItem') @@ -79,6 +79,7 @@ function TrustHud.new(player, action_queue, addon_settings, trustModeSettings, a local self = setmetatable(View.new(), TrustHud) CollectionView.setDefaultStyle(FFXIClassicStyle.default()) + CollectionView.setDefaultBackgroundStyle(FFXIClassicStyle.background()) self.lastMenuToggle = os.time() self.menuSize = Frame.new(0, 0, menu_width, menu_height) @@ -342,7 +343,9 @@ function TrustHud:getSettingsMenuItem(trust, trustSettings, trustSettingsMode, w return chooseSpellsView end, "Debuffs", "Add a new debuff.") - local debuffModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local debuffModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoDebuffMode', 'AutoDispelMode', 'AutoSilenceMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/TrustInfoBar.lua b/ui/TrustInfoBar.lua index 1ed2f2ac..b8d679ef 100644 --- a/ui/TrustInfoBar.lua +++ b/ui/TrustInfoBar.lua @@ -22,17 +22,21 @@ function TrustInfoBar.new(frame) else itemSize = frame.width - 111 - 15 - 4 end - local cell = InfoBarCollectionViewCell.new(Frame.new(0, 0, itemSize, frame.height)) + local cell = InfoBarCollectionViewCell.new(Frame.new(0, 0, itemSize, frame.height), false, TextStyle.Default.NavigationTitle) cell:setTitle(item:getText()) cell:setItemSize(itemSize) return cell end) - local self = setmetatable(CollectionView.new(dataSource, HorizontalFlowLayout.new(4, Padding.new(0, 0, 0, 0))), TrustInfoBar) + local style = CollectionView.defaultBackgroundStyle() + + local self = setmetatable(CollectionView.new(dataSource, HorizontalFlowLayout.new(4, Padding.new(0, 0, 0, 0)), nil, style), TrustInfoBar) self:setSize(0, frame.height) self:setUserInteractionEnabled(false) self:setScrollEnabled(false) + self:setAllowsCursorSelection(false) + self:setShouldRequestFocus(false) self:getDataSource():addItems(L{ IndexedItem.new(TextItem.new("", TextStyle.Default.ButtonSmall), IndexPath.new(1, 1)), @@ -43,12 +47,12 @@ function TrustInfoBar.new(frame) end function TrustInfoBar:setTitle(title) - local titleItem = TextItem.new(title or "", TextStyle.Default.ButtonSmall) + local titleItem = TextItem.new(title or "", TextStyle.Default.NavigationTitle) self:getDataSource():updateItem(titleItem, IndexPath.new(1, 1)) end function TrustInfoBar:setDescription(description) - local descriptionItem = TextItem.new(description or "", TextStyle.Default.ButtonSmall) + local descriptionItem = TextItem.new(description or "", TextStyle.Default.NavigationTitle) self:getDataSource():updateItem(descriptionItem, IndexPath.new(1, 2)) end diff --git a/ui/settings/editors/GambitSettingsEditor.lua b/ui/settings/editors/GambitSettingsEditor.lua index 34aebc22..11ee1888 100644 --- a/ui/settings/editors/GambitSettingsEditor.lua +++ b/ui/settings/editors/GambitSettingsEditor.lua @@ -38,8 +38,6 @@ function GambitSettingsEditor.new(gambit, trustSettings, trustSettingsMode, abil ) self:getDataSource():setItemForSectionHeader(4, conditionsSectionHeaderItem) - --self:reloadSettings() - self:getDisposeBag():add(self:getDelegate():didSelectItemAtIndexPath():addAction(function(indexPath) if indexPath.section == 4 then self:getDelegate():deselectItemAtIndexPath(indexPath) diff --git a/ui/settings/editors/config/ConfigEditor.lua b/ui/settings/editors/config/ConfigEditor.lua index 92eebe9b..60d2b2fa 100644 --- a/ui/settings/editors/config/ConfigEditor.lua +++ b/ui/settings/editors/config/ConfigEditor.lua @@ -294,8 +294,9 @@ function ConfigEditor:onConfirmClick(skipSave) return end - - self:onConfigChanged():trigger(self.configSettings, originalSettings) + if self.configSettings ~= originalSettings then + self:onConfigChanged():trigger(self.configSettings, originalSettings) + end if self.trustSettings and not skipSave then self.trustSettings:saveSettings(true) diff --git a/ui/settings/editors/config/ModeConfigEditor.lua b/ui/settings/editors/config/ModeConfigEditor.lua new file mode 100644 index 00000000..602a4b4e --- /dev/null +++ b/ui/settings/editors/config/ModeConfigEditor.lua @@ -0,0 +1,82 @@ +local ConfigEditor = require('ui/settings/editors/config/ConfigEditor') +local ConfigItem = require('ui/settings/editors/config/ConfigItem') +local ImageItem = require('cylibs/ui/collection_view/items/image_item') +local IndexedItem = require('cylibs/ui/collection_view/indexed_item') +local IndexPath = require('cylibs/ui/collection_view/index_path') +local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') +local SectionHeaderItem = require('cylibs/ui/collection_view/items/section_header_item') +local skillchain_util = require('cylibs/util/skillchain_util') + +local TextItem = require('cylibs/ui/collection_view/items/text_item') +local TextStyle = require('cylibs/ui/style/text_style') + +local ModeConfigEditor = setmetatable({}, {__index = ConfigEditor }) +ModeConfigEditor.__index = ModeConfigEditor + + +function ModeConfigEditor.new(modeNames, infoView) + modeNames = modeNames:filter(function(modeName) + return state[modeName] ~= nil + end) + + local modeSettings = {} + + local configItems = modeNames:map(function(modeName) + if state[modeName] then + modeSettings[modeName:lower()] = state[modeName].value + return PickerConfigItem.new(modeName:lower(), state[modeName].value, L(state[modeName]:options()), nil, state[modeName].description or modeName) + end + return nil + end):compact_map() + + local self = setmetatable(ConfigEditor.new(nil, modeSettings, configItems), ModeConfigEditor) + + self.infoView = infoView + self.modeNames = modeNames + + self:setScrollDelta(16) + self:setShouldRequestFocus(true) + + self:getDelegate():didMoveCursorToItemAtIndexPath():addAction(function(indexPath) + self:updateInfoBar(indexPath) + end) + + self:onConfigChanged():addAction(function(newSettings, oldSettings) + for modeName, value in pairs(newSettings) do + if oldSettings[modeName] ~= value then + for m in modeNames:it() do + if m:lower() == modeName then + handle_set(m, value) + end + end + end + end + end) + + return self +end + +function ModeConfigEditor:setHasFocus(focus) + ConfigEditor.setHasFocus(self, focus) + + if focus then + self:updateInfoBar() + end +end + +function ModeConfigEditor:updateInfoBar(indexPath) + indexPath = indexPath or self:getDelegate():getCursorIndexPath() + if indexPath then + local item = self:getDataSource():itemAtIndexPath(indexPath) + if item then + local description = state[self.modeNames[indexPath.section]]:get_description(item:getText()) or "View and change Trust modes." + + description = string.gsub(description, "^Okay, ", "") + description = self.modeNames[indexPath.section]..': '..description:gsub("^%l", string.upper) + + self.infoView:setDescription(description) + end + end +end + +return ModeConfigEditor \ No newline at end of file diff --git a/ui/settings/menus/AlterEgoSettingsMenuItem.lua b/ui/settings/menus/AlterEgoSettingsMenuItem.lua index 3d273441..68035f9c 100644 --- a/ui/settings/menus/AlterEgoSettingsMenuItem.lua +++ b/ui/settings/menus/AlterEgoSettingsMenuItem.lua @@ -1,7 +1,7 @@ local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local AlterEgoSettingsMenuItem = setmetatable({}, {__index = MenuItem }) AlterEgoSettingsMenuItem.__index = AlterEgoSettingsMenuItem @@ -49,7 +49,9 @@ function AlterEgoSettingsMenuItem:getEditMenuItem() end function AlterEgoSettingsMenuItem:getModesMenuItem() - local curesModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local curesModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoTrustsMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for summoning alter egos.") diff --git a/ui/settings/menus/FollowSettingsMenuItem.lua b/ui/settings/menus/FollowSettingsMenuItem.lua index 20179fbc..e67647a9 100644 --- a/ui/settings/menus/FollowSettingsMenuItem.lua +++ b/ui/settings/menus/FollowSettingsMenuItem.lua @@ -2,7 +2,7 @@ local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local ConfigEditor = require('ui/settings/editors/config/ConfigEditor') local ConfigItem = require('ui/settings/editors/config/ConfigItem') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local FollowSettingsMenuItem = setmetatable({}, {__index = MenuItem }) FollowSettingsMenuItem.__index = FollowSettingsMenuItem @@ -40,7 +40,9 @@ function FollowSettingsMenuItem:getConfigMenuItem() end function FollowSettingsMenuItem:getModesMenuItem() - local curesModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local curesModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoFollowMode', 'IpcMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for following.") diff --git a/ui/settings/menus/WeaponSkillSettingsMenuItem.lua b/ui/settings/menus/WeaponSkillSettingsMenuItem.lua index a63d4120..176c4a19 100644 --- a/ui/settings/menus/WeaponSkillSettingsMenuItem.lua +++ b/ui/settings/menus/WeaponSkillSettingsMenuItem.lua @@ -1,7 +1,7 @@ local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local DisposeBag = require('cylibs/events/dispose_bag') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModeConfigEditor = require('ui/settings/editors/config/ModeConfigEditor') local SkillchainAbilityPickerView = require('ui/settings/pickers/SkillchainAbilityPickerView') local SkillchainSettingsEditor = require('ui/settings/SkillchainSettingsEditor') local SkillchainSettingsMenuItem = require('ui/settings/menus/SkillchainSettingsMenuItem') @@ -79,8 +79,10 @@ function WeaponSkillSettingsMenuItem:getAbilitiesMenuItem(activeSkills) end function WeaponSkillSettingsMenuItem:getModesMenuItem() - local skillchainModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) - local modesView = ModesView.new(L{'AutoSkillchainMode', 'SkillchainAssistantMode', 'SkillchainDelayMode', 'SkillchainPropertyMode', 'WeaponSkillSettingsMode'}, infoView) + local skillchainModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) + local modesView = ModeConfigEditor.new(L{'AutoSkillchainMode', 'SkillchainAssistantMode', 'SkillchainDelayMode', 'SkillchainPropertyMode', 'WeaponSkillSettingsMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for weapon skills and skillchains.") return modesView diff --git a/ui/settings/menus/attachments/AttachmentSettingsMenuItem.lua b/ui/settings/menus/attachments/AttachmentSettingsMenuItem.lua index aef9a2fd..570cd9f2 100644 --- a/ui/settings/menus/attachments/AttachmentSettingsMenuItem.lua +++ b/ui/settings/menus/attachments/AttachmentSettingsMenuItem.lua @@ -13,7 +13,7 @@ local IndexedItem = require('cylibs/ui/collection_view/indexed_item') local IndexPath = require('cylibs/ui/collection_view/index_path') local job_util = require('cylibs/util/job_util') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') local Puppetmaster = require('cylibs/entity/jobs/PUP') diff --git a/ui/settings/menus/attachments/AutomatonSettingsMenuItem.lua b/ui/settings/menus/attachments/AutomatonSettingsMenuItem.lua index bc17e567..59cb746f 100644 --- a/ui/settings/menus/attachments/AutomatonSettingsMenuItem.lua +++ b/ui/settings/menus/attachments/AutomatonSettingsMenuItem.lua @@ -2,7 +2,7 @@ local AttachmentSettingsMenuItem = require('ui/settings/menus/attachments/Attach local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local ManeuverSettingsMenuItem = require('ui/settings/menus/attachments/ManeuverSettingsMenuItem') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local AutomatonSettingsMenuItem = setmetatable({}, {__index = MenuItem }) AutomatonSettingsMenuItem.__index = AutomatonSettingsMenuItem @@ -59,8 +59,10 @@ function AutomatonSettingsMenuItem:getManeuverSettingsMenuItem() end function AutomatonSettingsMenuItem:getModesMenuItem() - local automatonModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) - local modesView = ModesView.new(L{'AutoAssaultMode', 'AutoManeuverMode', 'AutoPetMode', 'AutoRepairMode', 'ManeuverMode'}, infoView) + local automatonModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) + local modesView = ModesView.new(L{'AutoPetMode', 'AutoAssaultMode', 'AutoRepairMode', 'AutoManeuverMode', 'ManeuverMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView end, "Modes", "Change automaton behavior.") diff --git a/ui/settings/menus/attachments/ManeuverSettingsMenuItem.lua b/ui/settings/menus/attachments/ManeuverSettingsMenuItem.lua index 75be357d..8b03e751 100644 --- a/ui/settings/menus/attachments/ManeuverSettingsMenuItem.lua +++ b/ui/settings/menus/attachments/ManeuverSettingsMenuItem.lua @@ -1,19 +1,9 @@ -local AssetManager = require('ui/themes/ffxi/FFXIAssetManager') local ButtonItem = require('cylibs/ui/collection_view/items/button_item') -local ConditionSettingsMenuItem = require('ui/settings/menus/conditions/ConditionSettingsMenuItem') local ConfigEditor = require('ui/settings/editors/config/ConfigEditor') local DisposeBag = require('cylibs/events/dispose_bag') -local FFXIClassicStyle = require('ui/themes/FFXI/FFXIClassicStyle') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') -local FFXITextInputView = require('ui/themes/ffxi/FFXITextInputView') -local Gambit = require('cylibs/gambits/gambit') -local GambitSettingsEditor = require('ui/settings/editors/GambitSettingsEditor') -local GambitTarget = require('cylibs/gambits/gambit_target') -local IndexedItem = require('cylibs/ui/collection_view/indexed_item') local IndexPath = require('cylibs/ui/collection_view/index_path') -local job_util = require('cylibs/util/job_util') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') local Puppetmaster = require('cylibs/entity/jobs/PUP') diff --git a/ui/settings/menus/buffs/BloodPactSettingsMenuItem.lua b/ui/settings/menus/buffs/BloodPactSettingsMenuItem.lua index 24ee1c84..3c1d3bc5 100644 --- a/ui/settings/menus/buffs/BloodPactSettingsMenuItem.lua +++ b/ui/settings/menus/buffs/BloodPactSettingsMenuItem.lua @@ -3,7 +3,7 @@ local BloodPactSettingsEditor = require('ui/settings/editors/BloodPactSettingsEd local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local DisposeBag = require('cylibs/events/dispose_bag') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') local BloodPactSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -74,7 +74,9 @@ function BloodPactSettingsMenuItem:getBuffsMenuItem() end function BloodPactSettingsMenuItem:getModesMenuItem() - local geomancyModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local geomancyModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoAssaultMode', 'AutoAvatarMode', 'AutoBuffMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for Summoner.") diff --git a/ui/settings/menus/buffs/BuffSettingsMenuItem.lua b/ui/settings/menus/buffs/BuffSettingsMenuItem.lua index 4a486169..8075bd61 100644 --- a/ui/settings/menus/buffs/BuffSettingsMenuItem.lua +++ b/ui/settings/menus/buffs/BuffSettingsMenuItem.lua @@ -15,6 +15,7 @@ function BuffSettingsMenuItem.new(trustSettings, trustSettingsMode, settingsPref ButtonItem.default('Remove', 18), ButtonItem.default('Edit', 18), ButtonItem.default('Conditions', 18), + ButtonItem.default('Reset', 18), }, {}, nil, "Buffs", descriptionText), BuffSettingsMenuItem) self.trustSettings = trustSettings @@ -69,6 +70,7 @@ function BuffSettingsMenuItem:reloadSettings() self:setChildMenuItem("Add", self:getAddBuffMenuItem()) self:setChildMenuItem("Edit", self:getEditBuffMenuItem()) self:setChildMenuItem("Conditions", self:getConditionsMenuItem()) + self:setChildMenuItem("Reset", self:getResetMenuItem()) end function BuffSettingsMenuItem:getAddBuffMenuItem() @@ -124,4 +126,21 @@ function BuffSettingsMenuItem:getConditionsMenuItem() end) end +function BuffSettingsMenuItem:getResetMenuItem() + return MenuItem.action(function(menu) + local defaultSettings = T(self.trustSettings:getDefaultSettings()):clone().Default + + local currentSettings = self.trustSettings:getSettings()[self.trustSettingsMode.value] + if self.settingsPrefix then + currentSettings[self.settingsPrefix][self.settingsKey] = defaultSettings[self.settingsPrefix][self.settingsKey] + else + currentSettings[self.settingsKey] = defaultSettings[self.settingsKey] + end + self.trustSettings:saveSettings(true) + addon_message(260, '('..windower.ffxi.get_player().name..') '.."Alright, I've forgotten any custom settings!") + + menu:showMenu(self) + end, "Reset", "Reset to default settings. WARNING: your settings will be overriden.") +end + return BuffSettingsMenuItem \ No newline at end of file diff --git a/ui/settings/menus/buffs/BufferSettingsMenuItem.lua b/ui/settings/menus/buffs/BufferSettingsMenuItem.lua index ceb58144..c21f8ff3 100644 --- a/ui/settings/menus/buffs/BufferSettingsMenuItem.lua +++ b/ui/settings/menus/buffs/BufferSettingsMenuItem.lua @@ -6,7 +6,7 @@ local FoodSettingsMenuItem = require('ui/settings/menus/buffs/FoodSettingsMenuIt local JobAbilityPickerView = require('ui/settings/pickers/JobAbilityPickerView') local JobAbilitiesSettingsEditor = require('ui/settings/JobAbilitiesSettingsEditor') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local SpellSettingsEditor = require('ui/settings/SpellSettingsEditor') local BufferSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -116,7 +116,9 @@ function BufferSettingsMenuItem:getFoodMenuItem() end function BufferSettingsMenuItem:getModesMenuItem() - local buffModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local buffModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoBarSpellMode', 'AutoBuffMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/settings/menus/buffs/EntrustSettingsMenuItem.lua b/ui/settings/menus/buffs/EntrustSettingsMenuItem.lua index c310815b..fb45e5fa 100644 --- a/ui/settings/menus/buffs/EntrustSettingsMenuItem.lua +++ b/ui/settings/menus/buffs/EntrustSettingsMenuItem.lua @@ -1,12 +1,9 @@ local AssetManager = require('ui/themes/ffxi/FFXIAssetManager') local ButtonItem = require('cylibs/ui/collection_view/items/button_item') -local CursorItem = require('ui/themes/FFXI/CursorItem') local DisposeBag = require('cylibs/events/dispose_bag') local GeomancySettingsEditor = require('ui/settings/editors/GeomancySettingsEditor') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') -local SpellPickerView = require('ui/settings/pickers/SpellPickerView') local EntrustSettingsMenuItem = setmetatable({}, {__index = MenuItem }) EntrustSettingsMenuItem.__index = EntrustSettingsMenuItem diff --git a/ui/settings/menus/buffs/FoodSettingsMenuItem.lua b/ui/settings/menus/buffs/FoodSettingsMenuItem.lua index 220983e8..8762b657 100644 --- a/ui/settings/menus/buffs/FoodSettingsMenuItem.lua +++ b/ui/settings/menus/buffs/FoodSettingsMenuItem.lua @@ -1,7 +1,7 @@ local ButtonItem = require('cylibs/ui/collection_view/items/button_item') local DisposeBag = require('cylibs/events/dispose_bag') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') local FoodSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -87,7 +87,9 @@ function FoodSettingsMenuItem:getFoodMenuItem() end function FoodSettingsMenuItem:getModesMenuItem() - local foodModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local foodModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{ 'AutoFoodMode' }, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for eating.") diff --git a/ui/settings/menus/buffs/GeomancySettingsMenuItem.lua b/ui/settings/menus/buffs/GeomancySettingsMenuItem.lua index ea9348a1..dbcda5d8 100644 --- a/ui/settings/menus/buffs/GeomancySettingsMenuItem.lua +++ b/ui/settings/menus/buffs/GeomancySettingsMenuItem.lua @@ -5,7 +5,7 @@ local EntrustSettingsMenuItem = require('ui/settings/menus/buffs/EntrustSettings local FFXIClassicStyle = require('ui/themes/FFXI/FFXIClassicStyle') local GeomancySettingsEditor = require('ui/settings/editors/GeomancySettingsEditor') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') local GeomancySettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -142,7 +142,7 @@ end function GeomancySettingsMenuItem:getModesMenuItem() local geomancyModesMenuItem = MenuItem.new(L{ - --ButtonItem.default('Save', 18), + ButtonItem.default('Confirm', 18), }, {}, function(_, infoView) local modesView = ModesView.new(L{'AutoGeoMode', 'AutoIndiMode', 'AutoEntrustMode'}, infoView) modesView:setShouldRequestFocus(true) diff --git a/ui/settings/menus/gambits/GambitSettingsMenuItem.lua b/ui/settings/menus/gambits/GambitSettingsMenuItem.lua index c70d1f49..11d5f2b2 100644 --- a/ui/settings/menus/gambits/GambitSettingsMenuItem.lua +++ b/ui/settings/menus/gambits/GambitSettingsMenuItem.lua @@ -12,7 +12,7 @@ local IndexedItem = require('cylibs/ui/collection_view/indexed_item') local IndexPath = require('cylibs/ui/collection_view/index_path') local job_util = require('cylibs/util/job_util') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') local GambitSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -62,10 +62,18 @@ function GambitSettingsMenuItem.new(trustSettings, trustSettingsMode) self.disposeBag:add(gambitSettingsEditor:getDelegate():didSelectItemAtIndexPath():addAction(function(indexPath) local selectedGambit = currentGambits[indexPath.row] self.selectedGambit = selectedGambit + gambitSettingsEditor.menuArgs['conditions'] = selectedGambit.conditions gambitSettingsEditor.menuArgs['targetTypes'] = S{ selectedGambit:getConditionsTarget() } end, gambitSettingsEditor:getDelegate():didSelectItemAtIndexPath())) + self.disposeBag:add(gambitSettingsEditor:getDelegate():didMoveCursorToItemAtIndexPath():addAction(function(indexPath) + local selectedGambit = currentGambits[indexPath.row] + if selectedGambit then + infoView:setDescription(selectedGambit:tostring()) + end + end), gambitSettingsEditor:getDelegate():didMoveCursorToItemAtIndexPath()) + if currentGambits:length() > 0 then gambitSettingsEditor:getDelegate():setCursorIndexPath(IndexPath.new(1, 1)) end @@ -320,7 +328,9 @@ function GambitSettingsMenuItem:getResetGambitsMenuItem() end function GambitSettingsMenuItem:getModesMenuItem() - local gambitModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local gambitModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoGambitMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/settings/menus/gambits/JobGambitSettingsMenuItem.lua b/ui/settings/menus/gambits/JobGambitSettingsMenuItem.lua index b2a5e71d..83c13fdd 100644 --- a/ui/settings/menus/gambits/JobGambitSettingsMenuItem.lua +++ b/ui/settings/menus/gambits/JobGambitSettingsMenuItem.lua @@ -12,7 +12,7 @@ local IndexedItem = require('cylibs/ui/collection_view/indexed_item') local IndexPath = require('cylibs/ui/collection_view/index_path') local job_util = require('cylibs/util/job_util') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') local JobGambitSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -65,6 +65,13 @@ function JobGambitSettingsMenuItem.new(trustSettings, trustSettingsMode) end end), self.gambitSettingsEditor:getDelegate():didSelectItemAtIndexPath()) + self.gambitSettingsEditor:getDisposeBag():add(gambitSettingsEditor:getDelegate():didMoveCursorToItemAtIndexPath():addAction(function(indexPath) + local selectedGambit = currentGambits[indexPath.row] + if selectedGambit then + infoView:setDescription(selectedGambit:tostring()) + end + end), gambitSettingsEditor:getDelegate():didMoveCursorToItemAtIndexPath()) + return gambitSettingsEditor end @@ -102,7 +109,9 @@ end function JobGambitSettingsMenuItem:getModesMenuItem() - local gambitModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local gambitModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoGambitMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/settings/menus/gambits/react/ReactSettingsMenuItem.lua b/ui/settings/menus/gambits/react/ReactSettingsMenuItem.lua index 216f4a24..1d1390f1 100644 --- a/ui/settings/menus/gambits/react/ReactSettingsMenuItem.lua +++ b/ui/settings/menus/gambits/react/ReactSettingsMenuItem.lua @@ -12,7 +12,7 @@ local IndexedItem = require('cylibs/ui/collection_view/indexed_item') local IndexPath = require('cylibs/ui/collection_view/index_path') local job_util = require('cylibs/util/job_util') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local PickerConfigItem = require('ui/settings/editors/config/PickerConfigItem') local ReactSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -196,7 +196,9 @@ function ReactSettingsMenuItem:getEditConditionsMenuItem() end function ReactSettingsMenuItem:getModesMenuItem() - local gambitModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local gambitModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoGambitMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/settings/menus/healing/HealerSettingsMenuItem.lua b/ui/settings/menus/healing/HealerSettingsMenuItem.lua index 12027328..7dc5fdb6 100644 --- a/ui/settings/menus/healing/HealerSettingsMenuItem.lua +++ b/ui/settings/menus/healing/HealerSettingsMenuItem.lua @@ -3,7 +3,7 @@ local ConfigEditor = require('ui/settings/editors/config/ConfigEditor') local ConfigItem = require('ui/settings/editors/config/ConfigItem') local DisposeBag = require('cylibs/events/dispose_bag') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModeConfigEditor = require('ui/settings/editors/config/ModeConfigEditor') local StatusRemovalPickerView = require('ui/settings/pickers/StatusRemovalPickerView') local HealerSettingsMenuItem = setmetatable({}, {__index = MenuItem }) @@ -40,7 +40,9 @@ end function HealerSettingsMenuItem:reloadSettings() self:setChildMenuItem("Config", self:getConfigMenuItem()) - self:setChildMenuItem("Blacklist", self:getBlacklistMenuItem()) + if self.trustSettings:getSettings().Default.CureSettings.StatusRemovals ~= nil then + self:setChildMenuItem("Blacklist", self:getBlacklistMenuItem()) + end self:setChildMenuItem("Modes", self:getModesMenuItem()) end @@ -84,8 +86,10 @@ function HealerSettingsMenuItem:getBlacklistMenuItem() end function HealerSettingsMenuItem:getModesMenuItem() - local curesModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) - local modesView = ModesView.new(L{'AutoHealMode', 'AutoStatusRemovalMode', 'AutoDetectAuraMode'}, infoView) + local curesModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm'), + }, L{}, function(_, infoView) + local modesView = ModeConfigEditor.new(L{'AutoHealMode', 'AutoStatusRemovalMode', 'AutoDetectAuraMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for healing and status removals.") return modesView diff --git a/ui/settings/menus/loading/JobSettingsMenuItem.lua b/ui/settings/menus/loading/JobSettingsMenuItem.lua index 74585bc1..9d9bcf3e 100644 --- a/ui/settings/menus/loading/JobSettingsMenuItem.lua +++ b/ui/settings/menus/loading/JobSettingsMenuItem.lua @@ -11,11 +11,13 @@ function JobSettingsMenuItem.new(jobSettingsMode, jobSettings, viewFactory) local self = setmetatable(MenuItem.new(L{ ButtonItem.default('Save As', 18), ButtonItem.default('Edit', 18), + ButtonItem.default('Backup', 18), + ButtonItem.default('Reset', 18), }, {}, function(args) local loadSettingsView = JobSettingsView.new(jobSettingsMode, jobSettings) loadSettingsView:setShouldRequestFocus(true) return loadSettingsView - end, "Settings", "Load saved modes and job settings"), JobSettingsMenuItem) + end, "Settings", "Load saved modes and job settings."), JobSettingsMenuItem) self.jobSettingsMode = jobSettingsMode self.jobSettings = jobSettings @@ -38,6 +40,8 @@ end function JobSettingsMenuItem:reloadSettings() self:setChildMenuItem("Save As", self:getCreateSetMenuItem()) self:setChildMenuItem("Edit", self:getEditMenuItem()) + self:setChildMenuItem("Backup", self:getBackupMenuItem()) + self:setChildMenuItem("Reset", self:getResetMenuItem()) end function JobSettingsMenuItem:getEditMenuItem() @@ -70,4 +74,26 @@ function JobSettingsMenuItem:getCreateSetMenuItem() return createSetMenuItem end +function JobSettingsMenuItem:getBackupMenuItem() + return MenuItem.action(function() + self.jobSettings:backupSettings() + end, "Settings", "Backup job settings file.") +end + +function JobSettingsMenuItem:getResetMenuItem() + local resetMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm'), + }, { + Confirm = MenuItem.action(function() + local defaultSettings = T(self.jobSettings:getDefaultSettings()):clone().Default + + self.jobSettings:getSettings()[self.jobSettingsMode.value] = defaultSettings + self.jobSettings:saveSettings(true) + + addon_message(260, '('..windower.ffxi.get_player().name..") Alright, I've reset "..self.jobSettingsMode.value.." to the default job settings!") + end, "Settings", "Reset to default job settings. WARNING: your settings will be overriden.") + }, nil, "Settings", "Reset to default job settings. WARNING: your settings will be overriden.", true) + return resetMenuItem +end + return JobSettingsMenuItem \ No newline at end of file diff --git a/ui/settings/menus/loading/LoadSettingsMenuItem.lua b/ui/settings/menus/loading/LoadSettingsMenuItem.lua index c53d1c87..d2bb7f26 100644 --- a/ui/settings/menus/loading/LoadSettingsMenuItem.lua +++ b/ui/settings/menus/loading/LoadSettingsMenuItem.lua @@ -19,7 +19,7 @@ function LoadSettingsMenuItem.new(addonSettings, trustModeSettings, jobSettings, local loadSettingsView = LoadSettingsView.new(state.TrustMode, addonSettings, trustModeSettings) loadSettingsView:setShouldRequestFocus(true) return loadSettingsView - end, "Settings", "Load saved modes and job settings"), LoadSettingsMenuItem) + end, "Settings", "Load saved modes and job settings."), LoadSettingsMenuItem) self.addonSettings = addonSettings self.trustModeSettings = trustModeSettings diff --git a/ui/settings/menus/nukes/NukeSettingsMenuItem.lua b/ui/settings/menus/nukes/NukeSettingsMenuItem.lua index f9f6ce8e..2add3929 100644 --- a/ui/settings/menus/nukes/NukeSettingsMenuItem.lua +++ b/ui/settings/menus/nukes/NukeSettingsMenuItem.lua @@ -4,7 +4,7 @@ local ConfigItem = require('ui/settings/editors/config/ConfigItem') local DisposeBag = require('cylibs/events/dispose_bag') local ElementPickerView = require('ui/settings/pickers/ElementPickerView') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local NukeSettingsEditor = require('ui/settings/NukeSettingsEditor') local SpellPickerView = require('ui/settings/pickers/SpellPickerView') @@ -110,7 +110,9 @@ function NukeSettingsMenuItem:getConfigMenuItem() end function NukeSettingsMenuItem:getModesMenuItem() - local nukeModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local nukeModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoMagicBurstMode', 'AutoNukeMode', 'MagicBurstTargetMode'}, infoView) modesView:setShouldRequestFocus(true) return modesView diff --git a/ui/settings/menus/pulling/PullSettingsMenuItem.lua b/ui/settings/menus/pulling/PullSettingsMenuItem.lua index 9ce2ad3f..2acb21b3 100644 --- a/ui/settings/menus/pulling/PullSettingsMenuItem.lua +++ b/ui/settings/menus/pulling/PullSettingsMenuItem.lua @@ -3,7 +3,7 @@ local ConfigEditor = require('ui/settings/editors/config/ConfigEditor') local ConfigItem = require('ui/settings/editors/config/ConfigItem') local DisposeBag = require('cylibs/events/dispose_bag') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local PullActionMenuItem = require('ui/settings/menus/pulling/PullActionMenuItem') local PullSettingsEditor = require('ui/settings/PullSettingsEditor') local TargetsPickerView = require('ui/settings/pickers/TargetsPickerView') @@ -61,7 +61,7 @@ function PullSettingsMenuItem:getTargetsMenuItem() local chooseTargetsView = TargetsPickerView.new(self.addon_settings, self.puller) chooseTargetsView:setShouldRequestFocus(true) return chooseTargetsView - end, "Targets", "Add targets to pull.") + end, "Targets", "Choose which enemies to pull.") local targetsMenuItem = MenuItem.new(L{ ButtonItem.default('Add', 18), @@ -80,8 +80,10 @@ function PullSettingsMenuItem:getTargetsMenuItem() end function PullSettingsMenuItem:getModesMenuItem() - local pullModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) - local modesView = ModesView.new(L{ 'AutoPullMode', 'AutoApproachMode' }, infoView) + local pullModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) + local modesView = ModesView.new(L{ 'AutoPullMode', 'ApproachPullMode', 'AutoCampMode' }, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for pulling.") return modesView diff --git a/ui/settings/menus/skillchains/BuildSkillchainSettingsMenuItem.lua b/ui/settings/menus/skillchains/BuildSkillchainSettingsMenuItem.lua index 2805bb97..8660ac01 100644 --- a/ui/settings/menus/skillchains/BuildSkillchainSettingsMenuItem.lua +++ b/ui/settings/menus/skillchains/BuildSkillchainSettingsMenuItem.lua @@ -73,7 +73,7 @@ function BuildSkillchainSettingsMenuItem:getConfirmMenuItem() local abilities = L(abilities:map(function(ability) return ability:get_name() end)) return localization_util.join(abilities, '→') end)) - self.chooseSkillchainView:setItems(pickerItems) + self.chooseSkillchainView:setItems(pickerItems, L{}, true) end end @@ -90,7 +90,7 @@ function BuildSkillchainSettingsMenuItem:getConfirmMenuItem() Next = MenuItem.action(function() setPage(self.currentPage + 1) end, "Skillchains", "See next page."), - }, function(menuArgs) + }, function(menuArgs, infoView) self.currentPage = 1 local skillchain_builder = SkillchainBuilder.with_skills(L(self.builderSettings.CombatSkills)) @@ -104,12 +104,14 @@ function BuildSkillchainSettingsMenuItem:getConfirmMenuItem() return localization_util.join(abilities, '→') end)) - local chooseSkillchainView = FFXIPickerView.withItems(pickerItems, L{}, false, nil, nil, FFXIClassicStyle.WindowSize.Editor.ConfigEditorLarge) + local chooseSkillchainView = FFXIPickerView.withItems(pickerItems, L{}, false, nil, nil, FFXIClassicStyle.WindowSize.Editor.ConfigEditorLarge, true) chooseSkillchainView.menuArgs.Skillchain = self.currentSkillchains[1] chooseSkillchainView:setTitle("Choose a skillchain.") chooseSkillchainView:setAllowsCursorSelection(true) chooseSkillchainView:getDelegate():didMoveCursorToItemAtIndexPath():addAction(function(indexPath) chooseSkillchainView.menuArgs.Skillchain = self.currentSkillchains[indexPath.row] + local abilities = L(self.currentSkillchains[indexPath.row]:map(function(ability) return ability:get_name() end)) + infoView:setDescription(localization_util.join(abilities, '→')) end) self.chooseSkillchainView = chooseSkillchainView return chooseSkillchainView diff --git a/ui/settings/menus/songs/SongSettingsMenuItem.lua b/ui/settings/menus/songs/SongSettingsMenuItem.lua index c4acf137..83905210 100644 --- a/ui/settings/menus/songs/SongSettingsMenuItem.lua +++ b/ui/settings/menus/songs/SongSettingsMenuItem.lua @@ -6,7 +6,7 @@ local DisposeBag = require('cylibs/events/dispose_bag') local FFXIPickerView = require('ui/themes/ffxi/FFXIPickerView') local IndexPath = require('cylibs/ui/collection_view/index_path') local MenuItem = require('cylibs/ui/menu/menu_item') -local ModesView = require('ui/settings/editors/ModeSettingsEditor') +local ModesView = require('ui/settings/editors/config/ModeConfigEditor') local SongPickerView = require('ui/settings/pickers/SongPickerView') local SongSettingsEditor = require('ui/settings/SongSettingsEditor') local SongValidator = require('cylibs/entity/jobs/bard/song_validator') @@ -271,7 +271,9 @@ function SongSettingsMenuItem:getDiagnosticsMenuItem() end function SongSettingsMenuItem:getModesMenuItem() - local songModesMenuItem = MenuItem.new(L{}, L{}, function(_, infoView) + local songModesMenuItem = MenuItem.new(L{ + ButtonItem.default('Confirm') + }, L{}, function(_, infoView) local modesView = ModesView.new(L{'AutoSongMode', 'AutoClarionCallMode', 'AutoNitroMode', 'AutoPianissimoMode'}, infoView) modesView:setShouldRequestFocus(true) modesView:setTitle("Set modes for singing.") diff --git a/ui/settings/pickers/SpellPickerView.lua b/ui/settings/pickers/SpellPickerView.lua index c8d98349..2f5202d8 100644 --- a/ui/settings/pickers/SpellPickerView.lua +++ b/ui/settings/pickers/SpellPickerView.lua @@ -34,6 +34,9 @@ function SpellPickerView.new(trustSettings, spells, allSpells, defaultJobNames, 'Absorb-MND', 'Absorb-VIT', 'Drain II', 'Drain III' } + self.doNotConvertSpellIds = L{ + 100, 101, 102, 103, 104, 105, 106, 107, 312, 313, 314, 315, 316, 317, 338, 339, 340 + } self:setScrollEnabled(true) @@ -57,7 +60,7 @@ function SpellPickerView:onSelectMenuItemAtIndexPath(textItem, _) local spell = res.spells:with('en', item:getText()) if spell then local status = buff_util.buff_for_spell(spell.id) - if status and not L{ 40, 41, 42 }:contains(spell.skill) and not L{ 338, 339, 340 }:contains(spell.id) then + if status and not L{ 40, 41, 42 }:contains(spell.skill) and not self.doNotConvertSpellIds:contains(spell.id) then if S(spell.targets):contains('Enemy') then if not self.selfBuffsWhitelist:contains(spell.en) then self.spells:append(Debuff.new(spell_util.base_spell_name(item:getText()), L{}, L{})) diff --git a/ui/themes/ffxi/FFXIBackgroundView.lua b/ui/themes/ffxi/FFXIBackgroundView.lua index 1e23d7b5..854f3eb8 100644 --- a/ui/themes/ffxi/FFXIBackgroundView.lua +++ b/ui/themes/ffxi/FFXIBackgroundView.lua @@ -2,6 +2,7 @@ local BorderView = require('cylibs/ui/views/border/border_view') local CollectionView = require('cylibs/ui/collection_view/collection_view') local CollectionViewDataSource = require('cylibs/ui/collection_view/collection_view_data_source') local Event = require('cylibs/events/Luvent') +local FFXIClassicStyle = require('ui/themes/FFXI/FFXIClassicStyle') local Frame = require('cylibs/ui/views/frame') local ImageCollectionViewCell = require('cylibs/ui/collection_view/cells/image_collection_view_cell') local ImageItem = require('cylibs/ui/collection_view/items/image_item') @@ -49,8 +50,8 @@ end -- @param bottomImagePath The file path of the bottom image. -- @treturn BackgroundView The created background view. -- -function FFXIBackgroundView.new(frame, hideTitle, style) - style = style or CollectionView.defaultStyle() +function FFXIBackgroundView.new(frame, hideTitle) + local style = FFXIClassicStyle.background() local self = setmetatable(CollectionView.new(CollectionViewDataSource.new(), VerticalFlowLayout.new(0), nil, style), FFXIBackgroundView) diff --git a/ui/themes/ffxi/FFXIClassicStyle.lua b/ui/themes/ffxi/FFXIClassicStyle.lua index a19adf03..a04d6a5c 100644 --- a/ui/themes/ffxi/FFXIClassicStyle.lua +++ b/ui/themes/ffxi/FFXIClassicStyle.lua @@ -55,6 +55,18 @@ function FFXIClassicStyle.default() return self end +function FFXIClassicStyle.background() + local self = setmetatable(CollectionViewStyle.new( + nil, + ScrollItem.new(), + FFXIClassicStyle.CenterImageItem, + FFXIClassicStyle.Border.LeftImageItem, + FFXIClassicStyle.Border.CenterImageItem, + FFXIClassicStyle.Border.RightImageItem + ), FFXIClassicStyle) + return self +end + function FFXIClassicStyle.static() local self = setmetatable(CollectionViewStyle.new( nil, diff --git a/ui/themes/ffxi/FFXIPickerView.lua b/ui/themes/ffxi/FFXIPickerView.lua index cb89c573..52fd51b2 100644 --- a/ui/themes/ffxi/FFXIPickerView.lua +++ b/ui/themes/ffxi/FFXIPickerView.lua @@ -11,21 +11,27 @@ local PickerView = require('cylibs/ui/picker/picker_view') local FFXIPickerView = setmetatable({}, {__index = PickerView }) FFXIPickerView.__index = FFXIPickerView -function FFXIPickerView.new(pickerItems, allowsMultipleSelection, cursorImageItem, viewSize) +function FFXIPickerView.new(pickerItems, allowsMultipleSelection, cursorImageItem, viewSize, title) local style = CollectionView.defaultStyle() local viewSize = viewSize or style:getDefaultPickerSize() - local backgroundView = FFXIBackgroundView.new(Frame.new(0, 0, viewSize.width, viewSize.height), true, style) + local backgroundView = FFXIBackgroundView.new(Frame.new(0, 0, viewSize.width, viewSize.height), title == nil, style) + if title then + backgroundView:setTitle(title, { width = 20, height = 14 }) + end local self = setmetatable(PickerView.new(pickerItems, allowsMultipleSelection, cursorImageItem), FFXIPickerView) self:setBackgroundImageView(backgroundView) self:setSize(viewSize.width, viewSize.height) self:setPadding(Padding.new(8, 0, 8, 0)) + backgroundView:setNeedsLayout() + backgroundView:layoutIfNeeded() + return self end -function FFXIPickerView.withItems(texts, selectedTexts, allowsMultipleSelection, cursorImageItem, imageForText, viewSize, shouldTruncateText) +function FFXIPickerView.withItems(texts, selectedTexts, allowsMultipleSelection, cursorImageItem, imageForText, viewSize, shouldTruncateText, title) imageForText = imageForText or function(_) return nil end @@ -38,7 +44,7 @@ function FFXIPickerView.withItems(texts, selectedTexts, allowsMultipleSelection, textItem:setShouldTruncateText(shouldTruncateText) return PickerItem.new(textItem, selectedTexts:contains(text)) end) - return FFXIPickerView.new(L{ pickerItems }, allowsMultipleSelection, cursorImageItem, viewSize) + return FFXIPickerView.new(L{ pickerItems }, allowsMultipleSelection, cursorImageItem, viewSize, title) end function FFXIPickerView.withSections(sections, selectedTexts, allowsMultipleSelection, cursorImageItem, imageForText)