Skip to content

Commit

Permalink
Added functionality for trinket support
Browse files Browse the repository at this point in the history
  • Loading branch information
Vae2009 committed Mar 1, 2025
1 parent 5624d15 commit 13e34f0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ConRO.toc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Title:-|cffFFFFFFConRO|r- Conflict Rotation Optimizer
## Notes: Rotation helper framework.
## Version: 11.1.1
## Version: 11.1.2
## Author: Vae
## Interface: 110100
## Category: ConRO
Expand Down
2 changes: 1 addition & 1 deletion buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ function ConRO:AddStandardButton(button, hotkey)
spellId = GetMacroSpell(id)
end
elseif type == 'item' then
spellId = C_Item.GetItemSpell(id)
spellId = id
elseif type == 'spell' then
local spellInfo = C_Spell.GetSpellInfo(id)
spellId = spellInfo and spellInfo.spellID
Expand Down
39 changes: 29 additions & 10 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2395,10 +2395,11 @@ function ConRO:OnEnable()
self:RegisterEvent('ACTIVE_TALENT_GROUP_CHANGED');
self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED');
self:RegisterEvent('UPDATE_MACROS');

self:RegisterEvent('VEHICLE_UPDATE');

self:RegisterEvent('UNIT_ENTERED_VEHICLE');
self:RegisterEvent('UNIT_EXITED_VEHICLE');

self:RegisterEvent('PLAYER_CONTROL_LOST');
self:RegisterEvent('PLAYER_CONTROL_GAINED');

Expand Down Expand Up @@ -2726,6 +2727,11 @@ function ConRO:ACTIONBAR_SLOT_CHANGED()
ConRO:ButtonFetch()
end

function ConRO:UPDATE_MACROS()
self:UpdateButtonGlow();
ConRO:ButtonFetch()
end

function ConRO:ButtonFetch()
if self.rotationEnabled then
if self.fetchTimer then
Expand All @@ -2744,7 +2750,6 @@ ConRO.UPDATE_STEALTH = ConRO.ButtonFetch;
ConRO.LEARNED_SPELL_IN_TAB = ConRO.ButtonFetch;
ConRO.CHARACTER_POINTS_CHANGED = ConRO.ButtonFetch;
ConRO.ACTIVE_TALENT_GROUP_CHANGED = ConRO.ButtonFetch;
ConRO.UPDATE_MACROS = ConRO.ButtonFetch;
ConRO.VEHICLE_UPDATE = ConRO.ButtonFetch;

function ConRO:InvokeNextSpell()
Expand All @@ -2759,26 +2764,40 @@ function ConRO:InvokeNextSpell()
-- ConRO:UpdateButtonGlow();

local spellName, spellTexture;

-- Get info for the first suggested spell
if self.Spell then
local spellInfo1 = C_Spell.GetSpellInfo(self.Spell);
spellName = spellInfo1 and spellInfo1.name;
spellTexture = spellInfo1 and spellInfo1.originalIconID;
if type(self.Spell) == "string" then
self.Spell = tonumber(self.Spell)
spellName, _, _, _, _, _, _, _, _, spellTexture = GetItemInfo(self.Spell);
else
local spellInfo1 = C_Spell.GetSpellInfo(self.Spell);
spellName = spellInfo1 and spellInfo1.name;
spellTexture = spellInfo1 and spellInfo1.originalIconID;
end
end

local spellTexture2;
-- Get info for the second suggested spell, only if it exists
if self.SuggestedSpells[2] then
local spellInfo2 = C_Spell.GetSpellInfo(self.SuggestedSpells[2]);
spellTexture2 = spellInfo2 and spellInfo2.originalIconID;
if type(self.SuggestedSpells[2]) == "string" then
spell_2 = tonumber(self.SuggestedSpells[2])
_, _, _, _, _, _, _, _, _, spellTexture2 = GetItemInfo(self.SuggestedSpells[2]);
else
local spellInfo2 = C_Spell.GetSpellInfo(self.SuggestedSpells[2]);
spellTexture2 = spellInfo2 and spellInfo2.originalIconID;
end
end

local spellTexture3;
-- Get info for the third suggested spell, only if it exists
if self.SuggestedSpells[3] then
local spellInfo3 = C_Spell.GetSpellInfo(self.SuggestedSpells[3]);
spellTexture3 = spellInfo3 and spellInfo3.originalIconID;
if type(self.SuggestedSpells[3]) == "string" then
spell_3 = tonumber(self.SuggestedSpells[3])
_, _, _, _, _, _, _, _, _, spellTexture3 = GetItemInfo(self.SuggestedSpells[3]);
else
local spellInfo3 = C_Spell.GetSpellInfo(self.SuggestedSpells[3]);
spellTexture3 = spellInfo3 and spellInfo3.originalIconID;
end
end

if (oldSkill ~= self.Spell or oldSkill == nil) and self.Spell ~= nil then
Expand Down
54 changes: 46 additions & 8 deletions helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ function ConRO:BurstMode(_Spell_ID, timeShift)
local _Burst = ConRO_BurstButton:IsVisible();
timeShift = timeShift or ConRO:EndCast();
local _Burst_Threshold = ConRO.db.profile._Burst_Threshold;
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);
local _Burst_Mode = false;

if _Burst and baseCooldown >= _Burst_Threshold then
_Burst_Mode = true;
if _Spell_ID == "item" then
if _Burst then
_Burst_Mode = true;
end
else
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);

if _Burst and baseCooldown >= _Burst_Threshold then
_Burst_Mode = true;
end
end

return _Burst_Mode;
Expand All @@ -116,13 +123,20 @@ function ConRO:FullMode(_Spell_ID, timeShift)
local _Burst = ConRO_BurstButton:IsVisible();
timeShift = timeShift or ConRO:EndCast();
local _Burst_Threshold = ConRO.db.profile._Burst_Threshold;
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);
local _Full_Mode = false;

if _Burst and baseCooldown < _Burst_Threshold then
_Full_Mode = true;
elseif _Full then
_Full_Mode = true;
if _Spell_ID == "item" then
if _Full then
_Full_Mode = true;
end
else
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);

if _Burst and baseCooldown < _Burst_Threshold then
_Full_Mode = true;
elseif _Full then
_Full_Mode = true;
end
end

return _Full_Mode;
Expand Down Expand Up @@ -203,6 +217,30 @@ function ConRO:ItemEquipped(_item_string)
return _match_item_NAME;
end

function ConRO:UsableTrinket()
local t13_Usable, t13_RDY, t14_Usable, t14_RDY = false, false, false, false;

local item13ID = GetInventoryItemID("player", 13)
local _, duration13, enable13 = GetItemCooldown(item13ID)
if enable13 == 1 then
t13_Usable = true;
if duration13 == 0 then
t13_RDY = true;
end
end

local item14ID = GetInventoryItemID("player", 14)
local _, duration14, enable14 = GetItemCooldown(item14ID)
if enable14 then
t14_Usable = true;
if duration14 == 0 then
t14_RDY = true;
end
end

return item13ID, t13_Usable, t13_RDY, item14ID, t14_Usable, t14_RDY
end

--[[function ConRO:CountTier()
local _, _, classIndex = UnitClass("player");
local count = 0;
Expand Down

0 comments on commit 13e34f0

Please sign in to comment.