Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon: [1.7.60] - Improved CastingHandler spell detection, channeling support and wands #617

Merged
merged 3 commits into from
Aug 17, 2024
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
1 change: 1 addition & 0 deletions Addons/DataToColor/DataToColor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ DataToColor.targetChanged = true

DataToColor.autoFollow = false
DataToColor.moving = false
DataToColor.channeling = false

DataToColor.playerGUID = UnitGUID(DataToColor.C.unitPlayer)
DataToColor.petGUID = UnitGUID(DataToColor.C.unitPet)
Expand Down
2 changes: 1 addition & 1 deletion Addons/DataToColor/DataToColor.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Title: DataToColor
## Author: FreeHongKongMMO
## Notes: Displays data as colors
## Version: 1.7.59
## Version: 1.7.60
## RequiredDeps:
## OptionalDeps: Ace3, LibRangeCheck, LibClassicCasterino
## SavedVariables:
Expand Down
12 changes: 12 additions & 0 deletions Addons/DataToColor/EventHandlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function DataToColor:RegisterEvents()
DataToColor:RegisterEvent("UNIT_SPELLCAST_SENT", 'OnUnitSpellCastSent')
DataToColor:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", 'OnUnitSpellCastSucceeded')
DataToColor:RegisterEvent("UNIT_SPELLCAST_FAILED", 'OnUnitSpellCastFailed')
DataToColor:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", 'OnUnitSpellCastChannelStart')
DataToColor:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", 'OnUnitSpellCastChannelStop')
--DataToColor:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET", 'OnUnitSpellCastFailed')
DataToColor:RegisterEvent('LOOT_READY', 'OnLootReady')
DataToColor:RegisterEvent('LOOT_CLOSED', 'OnLootClosed')
Expand Down Expand Up @@ -481,6 +483,16 @@ function DataToColor:OnUnitSpellCastFailed(event, unit, castGUID, spellId)
DataToColor.lastCastSpellId = spellId
end

function DataToColor:OnUnitSpellCastChannelStart(event, unit, castGUID, spellID)
if unit ~= DataToColor.C.unitPlayer then return end
DataToColor.channeling = true
end

function DataToColor:OnUnitSpellCastChannelStop(event, unit, castGUID, spellID)
if unit ~= DataToColor.C.unitPlayer then return end
DataToColor.channeling = false
end

function DataToColor:SoM_OnCastSuccess(event, unitTarget, castGuid, spellId)
if unitTarget ~= DataToColor.C.unitPlayer then return end
som_spellId = spellId or 0
Expand Down
3 changes: 2 additions & 1 deletion Addons/DataToColor/Query.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ function DataToColor:Bits3()
(UnitIsPlayer(DataToColor.C.unitSoftInteract) and 2 or 0) ^ 3 +
(UnitIsTapDenied(DataToColor.C.unitSoftInteract) and 2 or 0) ^ 4 +
(UnitAffectingCombat(DataToColor.C.unitSoftInteract) and 2 or 0) ^ 5 +
(DataToColor:IsUnitHostile(DataToColor.C.unitPlayer, DataToColor.C.unitSoftInteract) and 2 or 0) ^ 6
(DataToColor:IsUnitHostile(DataToColor.C.unitPlayer, DataToColor.C.unitSoftInteract) and 2 or 0) ^ 6 +
((DataToColor.channeling and 2 or 0)) ^ 7
)
end

Expand Down
2 changes: 2 additions & 0 deletions Core/AddonComponent/AddonBits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ public void Update(IAddonDataProvider reader)
public bool SoftInteract_Combat() => v3[Mask._5];

public bool SoftInteract_Hostile() => v3[Mask._6];

public bool Channeling() => v3[Mask._7];
}
25 changes: 25 additions & 0 deletions Core/GoalsComponent/CastResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;

namespace Core.Goals;

public enum CastResult
{
Success,
CurrentActionNotDetected,
UIFeedbackNotDetected,
TokenInterrupted,
UIError
}

public static class CastResult_Extension
{
public static string ToStringF(this CastResult value) => value switch
{
CastResult.Success => nameof(CastResult.Success),
CastResult.CurrentActionNotDetected => nameof(CastResult.CurrentActionNotDetected),
CastResult.UIFeedbackNotDetected => nameof(CastResult.UIFeedbackNotDetected),
CastResult.TokenInterrupted => nameof(CastResult.TokenInterrupted),
CastResult.UIError => nameof(CastResult.UIError),
_ => throw new ArgumentNullException(nameof(value)),
};
}
Loading
Loading