Skip to content

Commit

Permalink
v9.0.0 (#97)
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

* 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 committed Mar 20, 2024
1 parent 0c4c7ca commit a09411c
Show file tree
Hide file tree
Showing 124 changed files with 2,194 additions and 1,067 deletions.
1 change: 1 addition & 0 deletions Trust-Cylibs-Include.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ElementalMagic = require('cylibs/battle/abilities/elemental_magic')

-- Roles
Role = require('cylibs/trust/roles/role')
Assistant = require('cylibs/trust/roles/assistant')
Aftermather = require('cylibs/trust/roles/aftermather')
Attacker = require('cylibs/trust/roles/attacker')
CombatMode = require('cylibs/trust/roles/combat_mode')
Expand Down
55 changes: 30 additions & 25 deletions Trust.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
_addon.author = 'Cyrite'
_addon.commands = {'Trust','trust'}
_addon.name = 'Trust'
_addon.version = '8.8.6'
_addon.version = '9.0.0'
_addon.release_notes = [[
This update brings Scholar to the forefront with skillchaining
using Immanence, as well as changes to Dancer and Rune Fencer!
• 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
• Dancer
• Automatically use No Foot Rise, Building Flourish and
Climactic Flourish
• Rune Fencer
• Automatically use Vallation and Valiance
• Corsair / Ranger
• Faster ranged attacks when `AutoShootMode` is set to Auto
This update features improvements to pulling and targeting as well as
changes to White Mage when fighting on the front lines!
• Targeting
• Improved speed of targeting with `AutoTargetMode`
• Added `Party` mode which only targets monsters attacking or being
attacked by party members
• Pulling
• Improved speed of pulling with `AutoPullMode`
• Added `Party` mode which only pulls monsters attacking or being
attacked by party members
• Fixed issues where puller would sometimes lose its target and
not engage
• Added ability to customize pull actions in the UI with spells,
job abilities, ranged attack and approach
• UI
Updated menu graphics and user experience
• Added movable Trust, Party and Target widgets
Debuffs on the current target are now shown in the target widget
• Added ability to change `TrustMode` from the trust widget
• Bug Fixes
• Fixed an issue where skillchain would not restart when
the wrong weapon skill was used
• Fixed various issues with UI would not render properly
• Fixed issue where target would persist after zoning
• Press escape or enter to exit.
]]
Expand Down Expand Up @@ -115,7 +114,9 @@ function load_user_files(main_job_id, sub_job_id)
local oldValue = state.MainTrustSettingsMode.value
player.trust.main_job_settings = newSettings
local mode_names = list.subtract(L(T(newSettings):keyset()), L{'Version'})
state.MainTrustSettingsMode:options(T(mode_names):unpack())
if not mode_names:equals(state.MainTrustSettingsMode:options()) then
state.MainTrustSettingsMode:options(T(mode_names):unpack())
end
if mode_names:contains(oldValue) then
state.MainTrustSettingsMode:set(oldValue)
else
Expand All @@ -130,7 +131,9 @@ function load_user_files(main_job_id, sub_job_id)
local oldValue = state.SubTrustSettingsMode.value
player.trust.sub_job_settings = newSettings
local mode_names = list.subtract(L(T(newSettings):keyset()), L{'Version'})
state.SubTrustSettingsMode:options(T(mode_names):unpack())
if not mode_names:equals(state.SubTrustSettingsMode:options()) then
state.SubTrustSettingsMode:options(T(mode_names):unpack())
end
if mode_names:contains(oldValue) then
state.SubTrustSettingsMode:set(oldValue)
else
Expand Down Expand Up @@ -185,6 +188,7 @@ function load_user_files(main_job_id, sub_job_id)
player.trust.main_job:add_role(Targeter.new(action_queue))
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")))
player.trust.main_job:add_role(Assistant.new(action_queue))

target_change_time = os.time()

Expand Down Expand Up @@ -537,6 +541,7 @@ end

function handle_debug()
print(num_created)
print('images', num_images_created)

print(L(windower.ffxi.get_player().buffs):map(function(buff_id)
return res.buffs:with('id', buff_id).en
Expand Down Expand Up @@ -622,7 +627,7 @@ function load_chunk_event()
end

function unload_chunk_event()
for key in L{'up','down','left','right','enter', addon_settings:getSettings().menu_key}:extend(L{'a','w','s','d','f','h'}):it() do
for key in L{'up','down','left','right','enter', addon_settings:getSettings().menu_key}:extend(L{'a','w','s','d','f','e','h','i','k','l'}):it() do
windower.send_command('unbind %s':format(key))
end
IpcRelay.shared():destroy()
Expand Down
53 changes: 49 additions & 4 deletions cylibs/Cylibs-Windower-Events.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local Event = require('cylibs/events/Luvent')
local DisposeBag = require('cylibs/events/dispose_bag')
local GainDebuffMessage = require('cylibs/messages/gain_buff_message')
local IpcRelay = require('cylibs/messages/ipc/ipc_relay')
local logger = require('cylibs/logger/logger')
local LoseDebuffMessage = require('cylibs/messages/lose_buff_message')
local MobUpdateMessage = require('cylibs/messages/mob_update_message')
local packets = require('packets')
local ZoneMessage = require('cylibs/messages/zone_message')
Expand All @@ -18,16 +20,19 @@ local WindowerEvents = {}
WindowerEvents.DisposeBag = DisposeBag.new()

-- Global list of handlers for all Windower events. Listen to events here.
WindowerEvents.Action = Event.newEvent()
WindowerEvents.ActionMessage = Event.newEvent()
WindowerEvents.Action = Event.newEvent("Action")
WindowerEvents.ActionMessage = Event.newEvent("ActionMessage")
WindowerEvents.CharacterUpdate = Event.newEvent()
WindowerEvents.MobUpdate = Event.newEvent()
WindowerEvents.MobKO = Event.newEvent()
WindowerEvents.PositionChanged = Event.newEvent()
WindowerEvents.TargetIndexChanged = Event.newEvent()
WindowerEvents.TargetIndexChanged = Event.newEvent("TargetIndexChanged")
WindowerEvents.ZoneUpdate = Event.newEvent()
WindowerEvents.ZoneRequest = Event.newEvent()
WindowerEvents.BuffsChanged = Event.newEvent()
WindowerEvents.DebuffsChanged = Event.newEvent()
WindowerEvents.GainDebuff = Event.newEvent()
WindowerEvents.LoseDebuff = Event.newEvent()
WindowerEvents.AllianceMemberListUpdate = Event.newEvent()
WindowerEvents.PetUpdate = Event.newEvent()
WindowerEvents.Equipment = {}
Expand All @@ -41,6 +46,7 @@ local incoming_event_ids = S{
0x0DD, -- data.incoming[0x0DD] = {name='Party member update', description='Packet sent on party member join, leave, zone, etc.'}
0x0DF,
0x00D,
0x00E,
0x076,
0x0C8,
0x037,
Expand All @@ -63,7 +69,7 @@ local incoming_event_dispatcher = {
for _, target in pairs(act.targets) do
local action = target.actions[1]
if action then
if action_message_util.is_gain_debuff_message(action.message) then
if action_message_util.is_gain_debuff_message(action.message) and act.param and not L{260, 360}:contains(act.param) then
local debuff = buff_util.debuff_for_spell(act.param)
if debuff then
WindowerEvents.GainDebuff:trigger(target.id, debuff.id)
Expand All @@ -86,6 +92,14 @@ local incoming_event_dispatcher = {
local param_3 = packet['_unknown1']
WindowerEvents.ActionMessage:trigger(actor_id, target_id, actor_index,
target_index, message_id, param_1, param_2, param_3)

if action_message_util.is_lose_debuff_message(message_id) and param_1 then
if buff_util.is_debuff(param_1) then
WindowerEvents.LoseDebuff:trigger(target_id, param_1)
-- NOTE: this causes a memory leak
--IpcRelay.shared():send_message(LoseDebuffMessage.new(target_id, param_1))
end
end
end,

-- Party member update, only sent on join/leave and maybe some other rare circumstances?
Expand Down Expand Up @@ -158,6 +172,31 @@ local incoming_event_dispatcher = {
end
end,

-- 0x00E
-- NPC Update
[0x00E] = function(data)
local packet = packets.parse('incoming', data)

local mob_id = packet['NPC']
local mob = windower.ffxi.get_mob_by_id(mob_id)
if not mob then
return
end

local name = mob.name
local status = packet['Status']
local type = packet['Mask']

if type == 7 then
local hpp = packet['HP %']
WindowerEvents.MobUpdate:trigger(mob_id, name, hpp)
end

if L{ 2, 3 }:contains(status) then
WindowerEvents.MobKO:trigger(mob_id, name)
end
end,

[0x076] = function(data)
for party_member in party_util.get_party_members(true):it() do
local buff_ids = party_util.get_buffs(party_member.id)
Expand Down Expand Up @@ -373,6 +412,12 @@ end)
WindowerEvents.DisposeBag:add(IpcRelay.shared():on_message_received():addAction(function(ipc_message)
if ipc_message.__class == MobUpdateMessage.__class then
local mob = windower.ffxi.get_mob_by_name(ipc_message:get_mob_name())
--[[if mob == nil then
local follower = player.trust.main_job:role_with_type("follower")
if follower and follower:get_follow_target() and follower:get_follow_target():get_name() == ipc_message:get_mob_name() then
mob = follower:get_follow_target()
end
end]]
if mob then
WindowerEvents.PositionChanged:trigger(mob.id, ipc_message:get_position()[1], ipc_message:get_position()[2], ipc_message:get_position()[3])
end
Expand Down
9 changes: 9 additions & 0 deletions cylibs/actions/action.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function Action.new(x, y, z, target_index, conditions)
self.action_complete = Event.newEvent()

actions_created = actions_created + 1

return self
end

Expand Down Expand Up @@ -193,13 +194,21 @@ function Action:on_outgoing_chunk(id, data, modified, injected, blocked)
end

function Action:debug_log_create(action_type)
if self.logged_create then
return
end
self.logged_create = true
if actions_counter[action_type] == nil then
actions_counter[action_type] = 0
end
actions_counter[action_type] = actions_counter[action_type] + 1
end

function Action:debug_log_destroy(action_type)
if self.logged_destroy then
return
end
self.logged_destroy = true
if actions_counter[action_type] then
actions_counter[action_type] = actions_counter[action_type] - 1
end
Expand Down
4 changes: 0 additions & 4 deletions cylibs/actions/flourish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ function Flourish.new(flourish_name, target_index)
self.conditions:append(HasBuffsCondition.new(L{ "Finishing Move 1", "Finishing Move 2", "Finishing Move 3", "Finishing Move 4", "Finishing Move 5", "Finishing Move (6+)" }, 1))
self.conditions:append(ValidTargetCondition.new())

self:debug_log_create(self:gettype())

return self
end

function Flourish:destroy()
JobAbility.destroy(self)

self:debug_log_destroy(self:gettype())
end

function Flourish:perform()
Expand Down
9 changes: 5 additions & 4 deletions cylibs/actions/job_ability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ function JobAbility.new(x, y, z, job_ability_name, target_index)
local self = setmetatable(Action.new(x, y, z, target_index, conditions), JobAbility)

self.job_ability_name = job_ability_name
self.debug_log_type = self:gettype()

self:debug_log_create(self:gettype())
self:debug_log_create(self.debug_log_type)

return self
end

function JobAbility:destroy()
Action.destroy(self)
self:debug_log_destroy(self.debug_log_type)

self:debug_log_destroy(self:gettype())
Action.destroy(self)
end

function JobAbility:perform()
logger.notice("trying to perform", self.job_ability_name)
logger.notice(self.__class, 'perform', self.job_ability_name)

if self.target_index == nil then
windower.chat.input('/%s':format(self.job_ability_name))
Expand Down
66 changes: 0 additions & 66 deletions cylibs/actions/key.lua

This file was deleted.

6 changes: 6 additions & 0 deletions cylibs/actions/sequence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function SequenceAction:destroy()
for action in self.queue:it() do
action:destroy()
end
if self.current_action then
self.current_action:destroy()
end
self.current_action = nil

self:debug_log_destroy(self:gettype())

Expand All @@ -62,11 +66,13 @@ function SequenceAction:perform()
end
if self.queue:length() > 0 then
local next_action = self.queue:pop()
self.current_action = next_action
if next_action:can_perform() then
next_action:on_action_complete():addAction(function(a, success)
if not success then
self.num_failed_actions = self.num_failed_actions + 1
end
self.current_action = nil
a:destroy()
self:perform()
end)
Expand Down
Loading

0 comments on commit a09411c

Please sign in to comment.