Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions addons/autocontrol/autoabils.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
autoabils = {
[1688] = {name = 'Shield Bash', recast = 180, icon = "00210"},
[1689] = {name = 'Strobe', recast = 30, icon = "00210"},
[1690] = {name = 'Shock Absorber', recast = 180, icon = "00210"},
[1691] = {name = 'Flashbulb', recast = 45, icon = "00210"},
[1692] = {name = 'Mana Converter', recast = 180, icon = "00210"},
[1755] = {name = 'Reactive Shield', recast = 65, icon = "00210"},
[1765] = {name = 'Eraser', recast = 30, icon = "00210"},
[1812] = {name = 'Economizer', recast = 180, icon = "00210"},
[1876] = {name = 'Replicator', recast = 60, icon = "00210"},
[2489] = {name = 'Heat Capacitator', recast = 90, icon = "00210"},
[2490] = {name = 'Barrage Turbine', recast = 180, icon = "00210"},
[2491] = {name = 'Disruptor', recast = 60, icon = "00210"},
[3485] = {name = 'Regulator', recast = 60, icon = "00210" }
}
attachments_to_abilities = {
[8225] = 1688,
[8449] = 1689,
[8454] = 1755,
[8456] = 2489,
[8457] = 1689,
[8461] = 2489,
[8519] = 1876,
[8520] = 2490,
[8545] = 1690,
[8553] = 1690,
[8557] = 1690,
[8642] = 1691,
[8645] = 1765,
[8674] = 1692,
[8678] = 1812,
[8680] = 2491,
[8682] = 3485,
}

local player_id = windower.ffxi.get_player().id

windower.register_event("login", function()
player_id = windower.ffxi.get_player().id
end)

windower.register_event("action", function(act)
local abil_ID = act['param']
local actor_id = act['actor_id']
local pet_index = windower.ffxi.get_mob_by_id(player_id)['pet_index']

if act['category'] == 6 and actor_id == player_id and (abil_ID == 136 or abil_ID == 310 or abil_ID == 139) then
local avalible_abilities = {}
local automaton = windower.ffxi.get_mjob_data()

if attachments_to_abilities[automaton.frame] then
table.insert(avalible_abilities, autoabils[attachments_to_abilities[automaton.frame]])
end

for _, id in pairs(automaton.attachments) do
if attachments_to_abilities[id] then
table.insert(avalible_abilities, autoabils[attachments_to_abilities[id]])
end
end

for _, ability in pairs(avalible_abilities) do -- if abil_ID is deactivate delete ability timers, otherwise create them.
windower.send_command('timers '.. (abil_ID == 139 and "d" or "c") .. ' "'..ability.name..'" ' .. (abil_ID == 139 and "" or ability.recast..' up abilities/' .. ability.icon))
end
elseif autoabils[abil_ID-256] and windower.ffxi.get_mob_by_id(actor_id)['index'] == pet_index and pet_index ~= nil then
local abil = abil_ID - 256
windower.send_command('@timers c "'..autoabils[abil].name..'" '..autoabils[abil].recast..' up')
end
end)
37 changes: 14 additions & 23 deletions addons/autocontrol/autocontrol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]

_addon.name = 'autocontrol'
_addon.version = '1.02'
_addon.version = '2.0'
_addon.author = 'Nitrous (Shiva)'
_addon.commands = {'autocontrol','acon'}

Expand Down Expand Up @@ -63,8 +63,8 @@ defaults.burdentracker = true

settings = config.load(defaults)

require('maneuver') -- has to be loaded after settings are parsed.

burden_hud = require('burdometer') -- has to be loaded after settings are parsed.
require("autoabils")
recast_ids = {}
recast_ids.deactivate = res.job_abilities:with('english', 'Deactivate').recast_id
recast_ids.activate = res.job_abilities:with('english', 'Activate').recast_id
Expand All @@ -83,27 +83,18 @@ function initialize()

mjob_id = player.main_job_id
atts = res.items:category('Automaton')
decay = 1
for key,_ in pairs(heat) do
heat[key] = 0
Burden_tb[key] = 0
Burden_tb['time' .. key] = 0
end
local playermob = windower.ffxi.get_mob_by_index(windower.ffxi.get_player().index)
if mjob_id == 18 then
if player.pet_index then
running = 1
text_update_loop('start')
if playermob.pet_index then
if settings.burdentracker then
Burden_tb:show()
burden_hud:show()
end
end
end
end

windower.register_event('load', 'login', initialize)

windower.register_event('logout', 'unload', text_update_loop:prepare('stop'))

function attach_set(autoset)
if windower.ffxi.get_player().main_job_id ~= 18 or not settings.autosets[autoset] then
return
Expand All @@ -113,8 +104,8 @@ function attach_set(autoset)
return
end

local playermob = windower.ffxi.get_mob_by_id(windower.ffxi.get_player().id)
if playermob.pet_index and playermob.pet_index ~= 0 then
local playermob = windower.ffxi.get_mob_by_index(windower.ffxi.get_player().index)
local recast = windower.ffxi.get_ability_recasts()[recast_ids.deactivate]
if recast == 0 then
windower.send_command('input /pet "Deactivate" <me>')
Expand Down Expand Up @@ -268,15 +259,15 @@ windower.register_event('addon command', function(comm, ...)
elseif comm == "maneuvertimers" or comm == "mt" then
maneuvertimers = not maneuvertimers
elseif S{'fonttype','fontsize','pos','bgcolor','txtcolor'}:contains(comm) then
if comm == 'fonttype' then Burden_tb:font(args[1])
elseif comm == 'fontsize' then Burden_tb:size(args[1])
elseif comm == 'pos' then Burden_tb:pos(args[1], args[2])
elseif comm == 'bgcolor' then Burden_tb:bgcolor(args[1], args[2], args[3])
elseif comm == 'txtcolor' then Burden_tb:color(args[1], args[2], args[3])
if comm == 'fonttype' then burden_hud:font(args[1])
elseif comm == 'fontsize' then burden_hud:size(args[1])
elseif comm == 'pos' then burden_hud:pos(args[1], args[2])
elseif comm == 'bgcolor' then burden_hud:bgcolor(args[1], args[2], args[3])
elseif comm == 'txtcolor' then burden_hud:color(args[1], args[2], args[3])
end
config.save(settings, 'all')
elseif comm == 'show' then Burden_tb:show()
elseif comm == 'hide' then Burden_tb:hide()
elseif comm == 'show' then burden_hud:show()
elseif comm == 'hide' then burden_hud:hide()
elseif comm == 'settings' then
log('BG: R: '..settings.bg.red..' G: '..settings.bg.green..' B: '..settings.bg.blue)
log('Font: '..settings.text.font..' Size: '..settings.text.size)
Expand Down
180 changes: 180 additions & 0 deletions addons/autocontrol/burden.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
local set = require("sets")

local o = {
fire = 0,
earth = 0,
water = 0,
wind = 0,
ice = 0,
thunder = 0,
light = 0,
dark = 0,
}
local burden = {}
local mt = {
__index = burden
}
setmetatable(o, mt)
local updaters = {}
local heatsink
for _, id in pairs(windower.ffxi.get_mjob_data().attachments) do
heatsink = (id == 8610)
if heatsink then
break
end
end

local thresholdModifiers =
{
[11101] = 40, -- Cirque Farsetto +2
[11201] = 20, -- Cirque Farsetto +1
[14930] = 5, -- Pup. Dastanas
[15030] = 5, -- Pup. Dastanas +1
[16281] = 5, -- Buffoon's Collar
[16282] = 5, -- Buffoon's Collar +1
[20520] = 40, -- Midnights
[26263] = 10, -- Visucius's Mantle
[26932] = 40, -- Kara. Farsetto
[26933] = 40, -- Kara. Farsetto +1
[27960] = 5, -- Foire Dastanas
[27981] = 5, -- Foire Dastanas +1
[28634] = 5, -- Dispersal Mantle
}
burden.threshold = 30

local pet_actions =
{
[136] = "activate",
[139] = "deactivate",
[141] = "fire",
[142] = "ice",
[143] = "wind",
[144] = "earth",
[145] = "thunder",
[146] = "water",
[147] = "light",
[148] = "dark",
[309] = "cooldown",
[310] = "deus_ex_automata",
}
function burden:update(action)
updaters[action](self)
end

function burden:zone()
for k in pairs(self) do
self[k] = 15
end
end

function burden.set_decay_event(func)
burden.decay_event = func
end
function updaters.deactivate(self)
for k in pairs(self) do
self[k] = 0
end
end

function updaters.activate(self)
for _, id in pairs(windower.ffxi.get_mjob_data().attachments) do
heatsink = (id == 8610)
if heatsink then
break
end
end
burden.update_decay_rate()
for k in pairs(self) do
self[k] = 15
end
end
updaters.deus_ex_automata = updaters.activate

function updaters.cooldown(self)
for k in pairs(self) do
self[k] = self[k] / 2
end
end

function updaters.maneuver(self, type)
self[type] = self[type] + 15
local inventory = windower.ffxi.get_items()
local equipment = {
sub = {},
ammo = {},
main = {},
head = {},
body = {},
back = {},
legs = {},
feet = {},
neck = {},
hands = {},
range = {},
waist = {},
left_ear = {},
left_ring = {},
right_ear = {},
right_ring = {},
}
for k, v in pairs(inventory.equipment) do
equipment[string.gsub(k ,"_bag","")][k] = v
end
burden.threshold = 30
for k, v in pairs(equipment) do
item = windower.ffxi.get_items(v[k .. "_bag"], v[k])
if thresholdModifiers[item.id] then
burden.threshold = burden.threshold + thresholdModifiers[item.id]
end
end
windower.add_to_chat(4, self[type])
end

function updaters.ice(self) updaters.maneuver(self, "ice") end
function updaters.fire(self) updaters.maneuver(self, "fire") end
function updaters.wind(self) updaters.maneuver(self, "wind") end
function updaters.dark(self) updaters.maneuver(self, "dark") end
function updaters.earth(self) updaters.maneuver(self, "earth") end
function updaters.water(self) updaters.maneuver(self, "water") end
function updaters.light(self) updaters.maneuver(self, "light") end
function updaters.thunder(self) updaters.maneuver(self, "thunder") end

burden.decay_rate = 1
function burden.decay()
for k in pairs(o) do
if o[k] > burden.decay_rate then
o[k] = o[k] - burden.decay_rate
elseif o[k] > 0 then
o[k] = 0
end
end
if burden.decay_event then
burden.decay_event()
end
coroutine.schedule(burden.decay, 3)
end
coroutine.schedule(burden.decay, os.date("*t").sec % 3)

local count_to_decay_rate = {
[0] = 2,
[1] = 4,
[2] = 5,
[3] = 6,
}
function burden.update_decay_rate()
print(heatsink)
if heatsink then
local count = 0
for _, v in pairs(windower.ffxi.get_player().buffs) do
print(v)
if v == 305 then
count = count + 1
end
end
burden.decay_rate = count_to_rate[count];
else
burden.decay_rate = 1
end
end

return o
Loading