Skip to content

Commit

Permalink
v8.8.5 (#93)
Browse files Browse the repository at this point in the history
* Adding workflows files

* Automated commit to update trust

* Re-adding README.md

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Update weapon_skill.lua

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Update README.md

* Automated commit to update trust

* Automated commit to update trust

* Update README.md

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

* Automated commit to update trust

---------

Co-authored-by: cyritegamestudios <>
  • Loading branch information
cyrite authored Mar 3, 2024
1 parent 20ae9ea commit 1e94f28
Show file tree
Hide file tree
Showing 192 changed files with 6,717 additions and 1,192 deletions.
2 changes: 2 additions & 0 deletions Trust-Cylibs-Include.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ SkillchainAbility = require('cylibs/battle/skillchains/abilities/skillchain_abil
WeaponSkill = require('cylibs/battle/abilities/weapon_skill')
BloodPactRage = require('cylibs/battle/abilities/blood_pact_rage')
BloodPactMagic = require('cylibs/battle/abilities/blood_pact_magic')
ElementalMagic = require('cylibs/battle/abilities/elemental_magic')

-- Roles
Role = require('cylibs/trust/roles/role')
Expand Down Expand Up @@ -94,6 +95,7 @@ pup_util = require('cylibs/util/pup_util')
job_util = require('cylibs/util/job_util')
lists_ext = require('cylibs/util/extensions/lists')
localization_util = require('cylibs/util/localization_util')
timer = require('cylibs/util/timers/timer')

-- Entities
Alliance = require('cylibs/entity/alliance/alliance')
Expand Down
107 changes: 49 additions & 58 deletions Trust.lua
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
_addon.author = 'Cyrite'
_addon.commands = {'Trust','trust'}
_addon.name = 'Trust'
_addon.version = '8.7.0'
_addon.version = '8.8.6'
_addon.release_notes = [[
This update introduces new settings editors for the Geomancer,
Summoner and Corsair Trusts!
This update brings Scholar to the forefront with skillchaining
using Immanence, as well as changes to Dancer and Rune Fencer!
• Summoner
• Customize Blood Pact: Wards in the Trust menu under
Settings > Blood Pacts > Buffs
• Automatically use Avatar's Favor
• Migrated buff settings to standard buff format
• Scholar
• Added ability to use Immanence spells to skillchain
• Added ability to use Immanence spells to spam
• Added ability to set a default Immanence spell
• Geomancer
• Customize geocolures, indicolures and entrust indicolures in
the Trust menu under Settings > Geomancy > Skillchains
• Automatically choose default targets for geocolures
• Added `AutoIndiMode` and `AutoEntrustMode`
• Dancer
• Automatically use No Foot Rise, Building Flourish and
Climactic Flourish
• Corsair
• Choose Phantom Rolls to use in the Trust menu under
Settings > Rolls
• Rune Fencer
• Automatically use Vallation and Valiance
• Corsair / Ranger
• Faster ranged attacks when `AutoShootMode` is set to Auto
• UI
• Updated menu graphics and user experience
• Added movable Trust, Party and Target widgets
• Bug Fixes
• Fixed an issue where Summoner would not magic burst
• Fixed an issue where White Magic nukes did not appear
• Fixed an issue where skillchain would not restart when
the wrong weapon skill was used
• Press escape or enter to exit.
]]
_addon.release_url = "https://github.com/cyritegamestudios/trust/releases"

require('Trust-Include')

local addon_settings = TrustAddonSettings.new()
settings = addon_settings:loadSettings()
addon_settings = TrustAddonSettings.new()
addon_settings:loadSettings()

addon_enabled = ValueRelay.new(false)
addon_enabled:onValueChanged():addAction(function(_, isEnabled)
Expand Down Expand Up @@ -96,7 +99,7 @@ function load_user_files(main_job_id, sub_job_id)

player.player = Player.new(windower.ffxi.get_player().id)

local party_chat = PartyChat.new(settings.chat.ipc_enabled)
local party_chat = PartyChat.new(addon_settings:getSettings().chat.ipc_enabled)
player.alliance = Alliance.new(party_chat)
player.alliance:monitor()
player.party = player.alliance:get_parties()[1]
Expand Down Expand Up @@ -163,7 +166,7 @@ function load_user_files(main_job_id, sub_job_id)
player.trust.sub_job:set_trust_settings(player.trust.sub_job_settings[new_value])
end)

main_job_trust, sub_job_trust = TrustFactory.trusts(trust_for_job_short(player.main_job_name_short, settings, player.trust.main_job_settings.Default, action_queue, player.player, player.alliance, player.party), trust_for_job_short(player.sub_job_name_short, settings, player.trust.sub_job_settings.Default, action_queue, player.player, player.alliance, player.party))
main_job_trust, sub_job_trust = TrustFactory.trusts(trust_for_job_short(player.main_job_name_short, addon_settings:getSettings(), player.trust.main_job_settings.Default, action_queue, player.player, player.alliance, player.party), trust_for_job_short(player.sub_job_name_short, addon_settings:getSettings(), player.trust.sub_job_settings.Default, action_queue, player.player, player.alliance, player.party))

main_job_trust:init()
sub_job_trust:init()
Expand All @@ -172,15 +175,15 @@ function load_user_files(main_job_id, sub_job_id)
player.trust.sub_job = sub_job_trust

player.trust.main_job:add_role(Attacker.new(action_queue))
player.trust.main_job:add_role(CombatMode.new(action_queue, settings.battle.melee_distance, settings.battle.range_distance))
player.trust.main_job:add_role(CombatMode.new(action_queue, addon_settings:getSettings().battle.melee_distance, addon_settings:getSettings().battle.range_distance))
player.trust.main_job:add_role(Eater.new(action_queue, main_job_trust:get_trust_settings().AutoFood))
player.trust.main_job:add_role(Follower.new(action_queue, settings.follow.distance))
player.trust.main_job:add_role(Follower.new(action_queue, addon_settings:getSettings().follow.distance))
player.trust.main_job:add_role(Pather.new(action_queue, 'data/paths/'))
player.trust.main_job:add_role(Skillchainer.new(action_queue, weapon_skill_settings))
player.trust.main_job:add_role(Spammer.new(action_queue, weapon_skill_settings))
player.trust.main_job:add_role(Cleaver.new(action_queue, weapon_skill_settings))
player.trust.main_job:add_role(Targeter.new(action_queue))
player.trust.main_job:add_role(Truster.new(action_queue, settings.battle.trusts))
player.trust.main_job:add_role(Truster.new(action_queue, addon_settings:getSettings().battle.trusts))
player.trust.main_job:add_role(Aftermather.new(action_queue, player.trust.main_job:role_with_type("skillchainer")))

target_change_time = os.time()
Expand All @@ -189,8 +192,8 @@ function load_user_files(main_job_id, sub_job_id)

load_trust_modes(player.main_job_name_short)
load_trust_reactions(player.main_job_name_short)
load_trust_commands(player.main_job_name_short, player.trust.main_job, action_queue, player.party)
load_ui()
load_trust_commands(player.main_job_name_short, player.trust.main_job, action_queue, player.party)

main_trust_settings:copySettings()
sub_trust_settings:copySettings()
Expand Down Expand Up @@ -229,17 +232,17 @@ function load_trust_modes(job_name_short)

state.AutoUnloadOnDeathMode:on_state_change():addAction(function(_, new_value)
if new_value == 'Off' then
if settings.flags.show_death_warning then
if addon_settings:getSettings().flags.show_death_warning then
windower.add_to_chat(122, "---== WARNING ==---- Disabling unload on death may result in unexpected Trust behavior. It is not recommended that you use this setting while AFK.")
settings.flags.show_death_warning = false
addon_settings:getSettings().flags.show_death_warning = false
addon_settings:saveSettings(true)
end
end
end)

trust_mode_settings:loadSettings()

set_help_text_enabled(settings.help.mode_text_enabled)
set_help_text_enabled(addon_settings:getSettings().help.mode_text_enabled)

addon_message(207, 'Trust modes set to '..state.TrustMode.value)

Expand All @@ -263,6 +266,7 @@ function load_trust_commands(job_name_short, trust, action_queue, party)
SendAllCommands.new(trust, action_queue),
SendCommands.new(trust, action_queue),
SkillchainCommands.new(trust, weapon_skill_settings, action_queue),
WidgetCommands.new(trust, action_queue, addon_settings, hud.widgetManager),
}:extend(get_job_commands(job_name_short, trust, action_queue))

local add_command = function(command)
Expand Down Expand Up @@ -290,33 +294,16 @@ function get_job_commands(job_name_short, trust, action_queue)
end

function load_ui()
local Mouse = require('cylibs/ui/input/mouse')
Mouse.input():setMouseEventCooldown(settings.click_cooldown or 0.0)

hud = TrustHud.new(player, action_queue, addon_enabled, 500, 500)

local info = windower.get_windower_settings()

local xPos = info.ui_x_res - info.ui_x_res / 2
local yPos = 20

if settings.hud.position.x > 0 then
xPos = settings.hud.position.x
end
if settings.hud.position.y > 0 then
yPos = settings.hud.position.y
end

hud:setPosition(xPos, yPos)
hud = TrustHud.new(player, action_queue, addon_settings, trust_mode_settings, addon_enabled, 500, 500)
hud:setNeedsLayout()
hud:layoutIfNeeded()
end

function load_logger_settings()
_libs.logger.settings.logtofile = settings.logging.logtofile
_libs.logger.settings.logtofile = addon_settings:getSettings().logging.logtofile
_libs.logger.settings.defaultfile = 'logs/'..windower.ffxi.get_player().name..'_'..string.format("%s.log", os.date("%m-%d-%y"))

logger.isEnabled = settings.logging.enabled
logger.isEnabled = addon_settings:getSettings().logging.enabled
end

function trust_for_job_short(job_name_short, settings, trust_settings, action_queue, player, alliance, party)
Expand Down Expand Up @@ -398,14 +385,14 @@ function trust_for_job_short(job_name_short, settings, trust_settings, action_qu
end

function check_version()
local version = settings.version
local version = addon_settings:getSettings().version
if version ~= _addon.version then
settings.version = _addon.version
config.save(settings)
addon_settings:getSettings().version = _addon.version
addon_settings:saveSettings()

local Frame = require('cylibs/ui/views/frame')

local updateView = TrustMessageView.new("Version ".._addon.version, "What's new", _addon.release_notes, "Click here for full release notes.", Frame.new(0, 0, 500, 550))
local updateView = TrustMessageView.new("Version ".._addon.version, "What's new", _addon.release_notes, "Click here for full release notes.", Frame.new(0, 0, 500, 525))

updateView:getDelegate():didSelectItemAtIndexPath():addAction(function(indexPath)
updateView:getDelegate():deselectItemAtIndexPath(indexPath)
Expand All @@ -420,7 +407,7 @@ function check_version()
end

function check_files()
if settings.flags.check_files then
if addon_settings:getSettings().flags.check_files then
if windower.file_exists(windower.windower_path..'/addons/libs/cylibs/Cylibs-Include.lua') then
error('Please remove the', windower.windower_path..'addons/libs/cylibs/', 'folder and reload Trust.')
end
Expand Down Expand Up @@ -549,7 +536,11 @@ function handle_toggle_menu()
end

function handle_debug()
print(L(windower.ffxi.get_player().buffs))
print(num_created)

print(L(windower.ffxi.get_player().buffs):map(function(buff_id)
return res.buffs:with('id', buff_id).en
end))

local alliance = player.alliance
for i = 1, 3 do
Expand Down Expand Up @@ -618,7 +609,7 @@ end
function load_chunk_event()
load_user_files(windower.ffxi.get_player().main_job_id, windower.ffxi.get_player().sub_job_id)

trust_remote_commands = TrustRemoteCommands.new(settings.remote_commands.whitelist, commands:keyset())
trust_remote_commands = TrustRemoteCommands.new(addon_settings:getSettings().remote_commands.whitelist, commands:keyset())

IpcRelay.shared():on_message_received():addAction(function(ipc_message)
if ipc_message.__class == CommandMessage.__class then
Expand All @@ -631,7 +622,7 @@ function load_chunk_event()
end

function unload_chunk_event()
for key in L{'up','down','left','right','enter', settings.menu_key}:it() do
for key in L{'up','down','left','right','enter', addon_settings:getSettings().menu_key}:extend(L{'a','w','s','d','f','h'}):it() do
windower.send_command('unbind %s':format(key))
end
IpcRelay.shared():destroy()
Expand Down Expand Up @@ -666,7 +657,7 @@ function loaded()
user_events.zone_change = windower.register_event('zone change', handle_zone_change)
end

windower.send_command('bind %s trust menu':format(settings.menu_key))
windower.send_command('bind %s trust menu':format(addon_settings:getSettings().menu_key))
end

windower.register_event('addon command', addon_command)
Expand Down
51 changes: 51 additions & 0 deletions Trust/commands/AssistCommands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
local TrustCommands = require('cylibs/trust/commands/trust_commands')
local AssistTrustCommands = setmetatable({}, {__index = TrustCommands })
AssistTrustCommands.__index = AssistTrustCommands
AssistTrustCommands.__class = "AssistTrustCommands"

function AssistTrustCommands.new(trust, action_queue)
local self = setmetatable(TrustCommands.new(), AssistTrustCommands)

self.trust = trust
self.action_queue = action_queue

self:add_command('default', self.handle_assist_player, 'Assist a party or alliance member, // trust assist player_name')
self:add_command('clear', self.handle_clear_assist, 'Clear assist target')

return self
end

function AssistTrustCommands:get_command_name()
return 'assist'
end

-- // trust assist player_name
function AssistTrustCommands:handle_assist_player(party_member_name)
local success
local message

local alliance_member = self.trust:get_alliance():get_alliance_member_named(party_member_name)
if alliance_member then
success = true
message = "Now assisting "..party_member_name

self.trust:get_party():set_assist_target(alliance_member)

if state.AutoPullMode and state.AutoPullMode.value ~= 'Off' then
state.AutoPullMode:set('Off')
self.trust:get_party():add_to_chat(self.trust:get_party():get_player(), "I can't pull when I'm assisting someone else, so I'm going to stop pulling.")
end
else
success = false
message = (party_member_name or 'nil')..' is not a valid party member'
end

return success, message
end

-- // trust assist clear
function AssistTrustCommands:handle_clear_assist()
return self:handle_assist_player(windower.ffxi.get_player().name)
end

return AssistTrustCommands
39 changes: 39 additions & 0 deletions Trust/commands/AttackCommands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local TrustCommands = require('cylibs/trust/commands/trust_commands')
local AttackTrustCommands = setmetatable({}, {__index = TrustCommands })
AttackTrustCommands.__index = AttackTrustCommands
AttackTrustCommands.__class = "AttackTrustCommands"

function AttackTrustCommands.new(trust, action_queue)
local self = setmetatable(TrustCommands.new(), AttackTrustCommands)

self.trust = trust
self.action_queue = action_queue

-- AutoEngageMode
self:add_command('engage', function(_) return self:handle_toggle_mode('AutoEngageMode', 'Always', 'Off') end, 'Automatically engage mobs party is fighting')
self:add_command('mirror', function(_) return self:handle_toggle_mode('AutoEngageMode', 'Mirror', 'Off') end, 'Automatically engage only if assist target is fighting')
self:add_command('assist', function(_) return self:handle_toggle_mode('AutoEngageMode', 'Assist', 'Off') end, 'Automatically lock onto the battle target but don\'t engage')

return self
end

function AttackTrustCommands:get_command_name()
return 'attack'
end

-- // trust attack [engage, mirror, assist]
function AttackTrustCommands:handle_toggle_mode(mode_var_name, on_value, off_value)
local success = true
local message

local mode_var = get_state(mode_var_name)
if mode_var.value == on_value then
handle_set(mode_var_name, off_value)
else
handle_set(mode_var_name, on_value)
end

return success, message
end

return AttackTrustCommands
Loading

0 comments on commit 1e94f28

Please sign in to comment.