diff --git a/.gitignore b/.gitignore index 1ac0165..bbfca1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -libs/LibBabble-SubZone-3.0/ \ No newline at end of file +libs/LibBabble-SubZone-3.0/ +.vscode/settings.json diff --git a/Versions/Common/bestride.lua b/Versions/Common/bestride.lua index ce35946..5f68e1c 100644 --- a/Versions/Common/bestride.lua +++ b/Versions/Common/bestride.lua @@ -57,6 +57,9 @@ function BeStride:OnEnable() BeStride:RegisterEvent("PLAYER_REGEN_DISABLED", "EventCombatEnter") BeStride:RegisterEvent("PLAYER_REGEN_ENABLED", "EventCombatExit") + + BeStride:RegisterEvent("ENCOUNTER_START", function(encounterId) BeStride.encounterId = encounterId end) + BeStride:RegisterEvent("ENCOUNTER_END", function() BeStride.encounterId = nil end) BeStride:Upgrade() end diff --git a/Versions/Common/logic.zone.lua b/Versions/Common/logic.zone.lua index 3c245f4..017c470 100644 --- a/Versions/Common/logic.zone.lua +++ b/Versions/Common/logic.zone.lua @@ -126,6 +126,37 @@ function BeStride:IsSpecialZone() return false end +-- { DungeonEncounterID, maybeEnablingSpellId, BeStride_Mount:FnName } +BeStride.knownEncounters = { + { + 2786, -- Tindral Sageswift, Seer of the Flame; Amirdrassil, the Dream's Hope + 415095, -- Empowered Feather is the buff that enables Dragonriding + "Dragonriding" -- BeStride_Mount Function to call - This is a dragonriding encounter, so call dragonriding + } +} + +-- Some encounters, such as Tindral Sageswift in 10.2's Amirdrassil, require mounting +-- as a part of the encounter. Check for known cases and enable BeStride Mounting during +-- these encounters. +function BeStride:IsKnownSpecialCombatEncounter() + if not BeStride:IsCombat() or BeStride.encounterId == nil then + return nil + end + + for _, encounter in pairs(BeStride.knownEncounters) do + local encounterId, maybeEnablingSpellId = unpack(encounter) + if BeStride.encounterId == encounterId then + if maybeEnablingSpellId ~= nil then + local isProperAuraCurrentlyApplied = C_UnitAuras.GetPlayerAuraBySpellID(maybeEnablingSpellId) ~= nil + return isProperAuraCurrentlyApplied and encounter or nil + else + -- If we're in a known encounter but there's no Spell ID required, assume we can mount I guess? + return encounter + end + end + end +end + function BeStride:WGActive() return true end \ No newline at end of file diff --git a/Versions/Common/mount.lua b/Versions/Common/mount.lua index 88937c8..c48a8e4 100644 --- a/Versions/Common/mount.lua +++ b/Versions/Common/mount.lua @@ -1,5 +1,8 @@ function BeStride:Regular() - if self:CanUseTargetsMount() then + if self:IsKnownSpecialCombatEncounter() then + self:DismountAndExit() + return self:KnownSpecialCombatEncounter() + elseif self:CanUseTargetsMount() then self:DismountAndExit() return self:UseTargetsMount() -- Aspect of the Cheetah is available from level 5 diff --git a/Versions/Common/mounting.zone.lua b/Versions/Common/mounting.zone.lua index 5a114a3..c946451 100644 --- a/Versions/Common/mounting.zone.lua +++ b/Versions/Common/mounting.zone.lua @@ -10,4 +10,12 @@ function BeStride:SpecialZone() end return nil +end + +function BeStride:KnownSpecialCombatEncounter() + local encounter = self:IsKnownSpecialCombatEncounter() + local _, _, br_mount_fn_name = unpack(encounter or {}); + if br_mount_fn_name == nil then return nil end + + return BeStride_Mount[br_mount_fn_name]() end \ No newline at end of file