Skip to content

Commit

Permalink
Fix to allow Target dummies in Donogol to be detected again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vae2009 committed Dec 13, 2024
1 parent 98eee63 commit 21a0c13
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 56 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.0.7
## Version: 11.0.8
## Author: Vae
## Interface: 110005
## SavedVariables: ConROPreferences
Expand Down
2 changes: 1 addition & 1 deletion buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3131,7 +3131,7 @@ ConROSwapSpells = ConROSwapSpells or swapSpells;

function ConRO:GlowSpell(spellID)
local spellName
local spellInfo = GetSpellInfo(spellID);
local spellInfo = GetSpellInfo(spellID);
spellName = spellInfo and spellInfo.name
local _IsSwapSpell = false;

Expand Down
18 changes: 8 additions & 10 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2299,14 +2299,13 @@ end

function ConRO:PLAYER_CONTROL_LOST()
-- self:Print(self.Colors.Success .. 'Lost Control!');
self:DisableRotation();
self:DisableDefense();
self:DisableRotation();
self:DisableDefense();
end

function ConRO:PLAYER_CONTROL_GAINED()
if not C_PetBattles.IsInBattle() then
-- self:Print(self.Colors.Success .. 'Control Gained!');

self:DisableRotation();
self:DisableDefense();
self:EnableRotation();
Expand All @@ -2316,8 +2315,8 @@ end

function ConRO:PLAYER_LEAVING_WORLD()
-- self:Print(self.Colors.Success .. 'Lost Control!');
self:DisableRotation();
self:DisableDefense();
self:DisableRotation();
self:DisableDefense();
end

function ConRO:PLAYER_ENTERING_WORLD()
Expand Down Expand Up @@ -2529,11 +2528,10 @@ end

function ConRO:LoadModule()
local _, _, classId = UnitClass('player');

if self.Classes[classId] == nil then
self:Print(self.Colors.Error, 'Invalid player class, please contact author of addon.');
return;
end
if self.Classes[classId] == nil then
self:Print(self.Colors.Error, 'Invalid player class, please contact author of addon.');
return;
end

local module = 'ConRO_' .. self.Classes[classId];
local _, _, _, loadable, reason = C_AddOns.GetAddOnInfo(module);
Expand Down
146 changes: 102 additions & 44 deletions helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ ConRO.WarningFlags = {};
-- Global cooldown spell id
local _GlobalCooldown = 61304;

-- Global functions
local GetSpellCharges = C_Spell.GetSpellCharges
local GetSpellInfo = C_Spell and C_Spell.GetSpellInfo or GetSpellInfo
local GetSpellCooldown = C_Spell and C_Spell.GetSpellCooldown
local IsUsableSpell = C_Spell.IsSpellUsable
local UnitAura = C_UnitAuras.GetAuraDataByIndex

local INF = 2147483647;

function ConRO:SpecName()
Expand Down Expand Up @@ -71,16 +64,6 @@ function ConRO:CheckTalents()
end
end

function ConRO:IsPvP()
local _is_PvP = UnitIsPVP('player');
local _is_Arena, _is_Registered = IsActiveBattlefieldArena();
local _Flagged = false;
if _is_PvP or _is_Arena then
_Flagged = true;
end
return _Flagged;
end

function ConRO:CheckPvPTalents()
self.PvPTalents = {};
local talents = C_SpecializationInfo.GetAllSelectedPvpTalentIDs();
Expand Down Expand Up @@ -145,6 +128,16 @@ function ConRO:FullMode(_Spell_ID, timeShift)
return _Full_Mode;
end

function ConRO:IsPvP()
local _is_PvP = UnitIsPVP('player');
local _is_Arena, _is_Registered = IsActiveBattlefieldArena();
local _Flagged = false;
if _is_PvP or _is_Arena then
_Flagged = true;
end
return _Flagged;
end

function ConRO:Warnings(_Message, _Condition)
if self.WarningFlags[_Message] == nil then
self.WarningFlags[_Message] = 0;
Expand Down Expand Up @@ -441,75 +434,137 @@ local HarmItems = {
},
}]]

local targetDummiesIds = {
[31146] = true, --raider's training dummie
[225983] = true, --Dungeoneer's training dummy - Dornogal
[225984] = true, --Normal dummy - Dornogal
[225979] = true, --Healing Dummy - Dornogal
[225982] = true, --Cleave Dummy - Dornogal
[225977] = true, --Dungeoneer's Tanking dummy - Dornogal
[225976] = true, --Normal Tanking dummy - Dornogal
}

function ConRO:GetNpcIdFromGuid(GUID)
local npcId = select(6, strsplit("-", GUID ))
if npcId then
npcId = tonumber(npcId)
return npcId or 0
end
return 0
end

function ConRO:Targets(spellID)
local target_in_range = false;
local number_in_range = 0;
if spellID == "Melee" then
if UnitIsEnemy("player", "target") and UnitExists("target") then
if C_Item.IsItemInRange(37727, "target") then
target_in_range = true;
if UnitReaction("player", "target") ~= nil then
if UnitReaction("player", "target") <= 4 and UnitExists("target") then
if C_Item.IsItemInRange(37727, "target") then
target_in_range = true;
end
end
end

for i = 1, 15 do
if UnitIsEnemy("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and UnitAffectingCombat('nameplate' .. i) and C_Item.IsItemInRange(37727, "nameplate"..i) == true then
if UnitReaction("player", 'nameplate' .. i) ~= nil then
if UnitReaction("player", 'nameplate' .. i) <= 4 and UnitExists('nameplate' .. i) and C_Item.IsItemInRange(37727, "nameplate"..i) == true then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "10" then
if UnitIsEnemy("player", "target") and UnitExists("target") then
if C_Item.IsItemInRange(32321, "target") then
target_in_range = true;
if UnitReaction("player", "target") ~= nil then
if UnitReaction("player", "target") <= 4 and UnitExists("target") then
if C_Item.IsItemInRange(32321, "target") then
target_in_range = true;
end
end
end

for i = 1, 15 do
if UnitIsEnemy("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and UnitAffectingCombat('nameplate' .. i) and C_Item.IsItemInRange(32321, "nameplate"..i) == true then
if UnitReaction("player", 'nameplate' .. i) ~= nil then
if UnitReaction("player", 'nameplate' .. i) <= 4 and UnitExists('nameplate' .. i) and C_Item.IsItemInRange(32321, "nameplate"..i) == true then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "15" then
if UnitIsEnemy("player", "target") and UnitExists("target") then
if C_Item.IsItemInRange(33069, "target") then
target_in_range = true;
if UnitReaction("player", "target") ~= nil then
if UnitReaction("player", "target") <= 4 and UnitExists("target") then
if C_Item.IsItemInRange(33069, "target") then
target_in_range = true;
end
end
end

for i = 1, 15 do
if UnitIsEnemy("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and UnitAffectingCombat('nameplate' .. i) and C_Item.IsItemInRange(33069, "nameplate"..i) == true then
local serial = UnitGUID('nameplate' .. i);
local _Is_Dummy = false;
if serial then
local npcId = ConRO:GetNpcIdFromGuid(serial)
if npcId then
if (targetDummiesIds[npcId]) then
_Is_Dummy = true;
end
end
end

if UnitReaction("player", 'nameplate' .. i) ~= nil then
if UnitReaction("player", 'nameplate' .. i) <= 4 and UnitExists('nameplate' .. i) and (UnitAffectingCombat('nameplate' .. i) or _Is_Dummy) and C_Item.IsItemInRange(33069, "nameplate"..i) == true then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "25" then
if UnitIsEnemy("player", "target") and UnitExists("target") then
if C_Item.IsItemInRange(24268, "target") then
target_in_range = true;
if UnitReaction("player", "target") ~= nil then
if UnitReaction("player", "target") <= 4 and UnitExists("target") then
if C_Item.IsItemInRange(24268, "target") then
target_in_range = true;
end
end
end

for i = 1, 15 do
if UnitIsEnemy("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and UnitAffectingCombat('nameplate' .. i) and C_Item.IsItemInRange(24268, "nameplate"..i) == true then
local serial = UnitGUID('nameplate' .. i);
local _Is_Dummy = false;
if serial then
local npcId = ConRO:GetNpcIdFromGuid(serial)
if npcId then
if (targetDummiesIds[npcId]) then
_Is_Dummy = true;
end
end
end

if UnitReaction("player", 'nameplate' .. i) ~= nil then
if UnitReaction("player", 'nameplate' .. i) <= 4 and UnitExists('nameplate' .. i) and (UnitAffectingCombat('nameplate' .. i) or _Is_Dummy) and C_Item.IsItemInRange(24268, "nameplate"..i) == true then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "40" then
if UnitIsEnemy("player", "target") and UnitExists("target") then
if C_Item.IsItemInRange(28767, "target") then
target_in_range = true;
if UnitReaction("player", "target") ~= nil then
if UnitReaction("player", "target") <= 4 and UnitExists("target") then
if C_Item.IsItemInRange(28767, "target") then
target_in_range = true;
end
end
end

for i = 1, 15 do
if UnitIsEnemy("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and UnitAffectingCombat('nameplate' .. i) and C_Item.IsItemInRange(28767, "nameplate"..i) == true then
local serial = UnitGUID('nameplate' .. i);
local _Is_Dummy = false;
if serial then
local npcId = ConRO:GetNpcIdFromGuid(serial)
if npcId then
if (targetDummiesIds[npcId]) then
_Is_Dummy = true;
end
end
end

if UnitReaction("player", 'nameplate' .. i) ~= nil then
if UnitReaction("player", 'nameplate' .. i) <= 4 and UnitExists('nameplate' .. i) and (UnitAffectingCombat('nameplate' .. i) or _Is_Dummy) and C_Item.IsItemInRange(28767, "nameplate"..i) == true then
number_in_range = number_in_range + 1
end
end
Expand Down Expand Up @@ -1055,11 +1110,14 @@ function ConRO:IsOverride(spellID)
end

function ConRO:TarYou()
local tarYou = false;

local targettarget = UnitName('targettarget');
local targetplayer = UnitName('player');
if targettarget == targetplayer then
return 1;
tarYou = true;
end
return tarYou;
end

function ConRO:TarHostile()
Expand Down Expand Up @@ -1351,7 +1409,7 @@ function ConRO:ExtractTooltip(spell, pattern)
end

function ConRO:GlobalCooldown()
local _, duration, enabled = GetSpellCooldown(61304);
local _, duration, enabled = C_Spell.GetSpellCooldown(61304);
return duration;
end

Expand Down

0 comments on commit 21a0c13

Please sign in to comment.