diff --git a/behaviors/buffs.lua b/behaviors/buffs.lua index d0d0c61..0d124cb 100644 --- a/behaviors/buffs.lua +++ b/behaviors/buffs.lua @@ -1,3 +1,5 @@ +require 'ffxi.recast'; + local party = require('party'); local config = require('config'); local actions = require('actions'); @@ -246,4 +248,18 @@ function buffs:SneakyTime(levels) end end +function buffs:AbilityOnCD(abilityName) + local r = AshitaCore:GetResourceManager(); + local onCD = false; + for x = 0, 31 do + if (ashita.ffxi.recast.get_ability_recast_by_index(x) > 0) then + local ability = r:GetAbilityByTimerId(ashita.ffxi.recast.get_ability_id_from_index(x)); + if (ability.Name[0] == abilityName) then + onCD = true; + end + end + end + return onCD; +end + return buffs; diff --git a/jobs/sam.lua b/jobs/sam.lua index 06d2297..fd72952 100644 --- a/jobs/sam.lua +++ b/jobs/sam.lua @@ -5,8 +5,17 @@ local packets = require('packets'); local buffs = require('behaviors.buffs') local healing = require('behaviors.healing'); -local spell_levels = {}; +local status = packets.status; +local abilities = packets.abilities; +local stoe = packets.stoe; +local ability_levels = {}; +ability_levels[packets.abilities.THIRD_EYE] = 15; +ability_levels[packets.abilities.HASSO] = 25; +ability_levels[packets.abilities.MEDITATE] = 30; +ability_levels[packets.abilities.SEIGAN] = 35; +ability_levels[packets.abilities.SEKKANOKI] = 40; +ability_levels[packets.abilities.KONZENITTAI] = 65; local jsam = { spell_levels = spell_levels, @@ -18,6 +27,7 @@ function jsam:tick() local cnf = config:get(); local tid = AshitaCore:GetDataManager():GetTarget():GetTargetServerId(); local tp = AshitaCore:GetDataManager():GetParty():GetMemberCurrentTP(0); + local player = AshitaCore:GetDataManager():GetPlayer(); if (cnf.ATTACK_TID and tid ~= cnf.ATTACK_TID) then cnf.ATTACK_TID = nil; @@ -25,7 +35,7 @@ function jsam:tick() -- Attempt to weaponskill when you have TP elseif (cnf.ATTACK_TID and tid == cnf.ATTACK_TID and tp >= 1000) then if (cnf.WeaponSkillID ~= nil ) then - if AshitaCore:GetDataManager():GetPlayer():HasWeaponSkill(tonumber(cnf.WeaponSkillID)) then + if player:HasWeaponSkill(tonumber(cnf.WeaponSkillID)) then for k, v in pairs(packets.weaponskills) do if (tonumber(cnf.WeaponSkillID) == tonumber(v)) then AshitaCore:GetChatManager():QueueCommand('/ws "' .. string.gsub(string.gsub(k,"_"," "),"TACHI","TACHI:") .. '" ', 1); @@ -34,6 +44,31 @@ function jsam:tick() end end end + if (party:GetBuffs(0)[packets.status.EFFECT_INVISIBLE]) then return end + + if (buffs:IsAble(abilities.HASSO, ability_levels) and party:GetBuffs(0)[stoe.HASSO] ~= true and not(buffs:AbilityOnCD("Hasso"))) then + actions.busy = true; + actions:queue(actions:new() + :next(partial(ability, '"Hasso"', '')) + :next(partial(wait, 3)) + :next(function(self) actions.busy = false; end)); + return true; + end + + local queueJobAbility = nil; + if not(buffs:AbilityOnCD("Meditate")) then + queueJobAbility = '"Meditate"'; + --elseif not(buffs:AbilityOnCD("Third Eye")) then + -- queueJobAbility = '"Third Eye"'; + end + if (queueJobAbility ~= nil) then + actions.busy = true; + actions:queue(actions:new() + :next(partial(ability, queueJobAbility, '')) + :next(partial(wait, 3)) + :next(function(self) actions.busy = false; end)); + return true; + end end function jsam:attack(tid) diff --git a/jobs/war.lua b/jobs/war.lua index 7ed4824..92304c0 100644 --- a/jobs/war.lua +++ b/jobs/war.lua @@ -23,6 +23,7 @@ return { AshitaCore:GetChatManager():QueueCommand("/follow " .. cnf.leader, 1); end + if (party:GetBuffs(0)[packets.status.EFFECT_INVISIBLE]) then return end local sub = AshitaCore:GetDataManager():GetPlayer():GetSubJob(); if (sub == Jobs.Dancer and cnf.ATTACK_TID ~= nil) then @@ -38,6 +39,27 @@ return { end if (healing:DNCHeal(spell_levels)) then return end end + + local queueJobAbility = nil; + local queueTarget = nil; + if (not(buffs:AbilityOnCD("Provoke")) and cnf.ATTACK_TID ~= nil) then + queueJobAbility = '"Provoke"'; + queueTarget = ''; + elseif not(buffs:AbilityOnCD("Warcry")) then + queueJobAbility = '"Warcry"'; + queueTarget = ''; + elseif not(buffs:AbilityOnCD("Defender")) then + queueJobAbility = '"Defender"'; + queueTarget = ''; + end + if (queueJobAbility ~= nil) then + actions.busy = true; + actions:queue(actions:new() + :next(partial(ability, queueJobAbility, queueTarget)) + :next(partial(wait, 3)) + :next(function(self) actions.busy = false; end)); + return true; + end end, attack = function(self, tid) diff --git a/packets.lua b/packets.lua index 1985071..d54bea2 100644 --- a/packets.lua +++ b/packets.lua @@ -127,11 +127,16 @@ local packets = { EFFECT_PUPPET_ROLL = 327, EFFECT_DANCERS_ROLL = 328, EFFECT_SCHOLARS_ROLL = 329, + EFFECT_HASSO = 353, EFFECT_DRAIN_SAMBA = 368, EFFECT_POISON_II = 540, }, abilities = { + STEAL = 25, + THIRD_EYE = 46, + MEDITATE = 47, + WARDING_CIRCLE = 48, PHANTOM_ROLL = 81, FIGHTERS_ROLL = 82, MONKS_ROLL = 83, @@ -153,7 +158,11 @@ local packets = { PUPPET_ROLL = 99, DANCERS_ROLL = 100, SCHOLARS_ROLL = 101, + HASSO = 157, + SEIGAN = 158, DRAIN_SAMBA = 168, + SEKKANOKI = 214, + KONZENITTAI = 304 }, spells = { @@ -514,5 +523,6 @@ stoe.VALOR_MINUET_II = status.EFFECT_MINUET; stoe.VALOR_MINUET_III = status.EFFECT_MINUET; stoe.SWORD_MADRIGAL = status.EFFECT_MADRIGAL; stoe.BLADE_MADRIGAL = status.EFFECT_MADRIGAL; +stoe.HASSO = status.EFFECT_HASSO; return packets;