Skip to content

Commit

Permalink
Merge branch 'TylerR909-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps committed Feb 14, 2023
2 parents e925d05 + 209bc9a commit a46a3b6
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Versions/Classic/bestride.lua
Expand Up @@ -34,3 +34,7 @@ end
function BeStride:GetMountInfoByIndex()
return nil
end

function BeStride:GetKnownMountFromTarget()
return nil
end
2 changes: 2 additions & 0 deletions Versions/Common/BeStride_Variables.lua
Expand Up @@ -7,6 +7,7 @@ BeStride_Variables = {
{name="mount.nodismountwhileflying",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.NoDismountWhileFlying"]},
{name="mount.useflyingmount",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.UseFlyingMount"], dependants = {"mount.forceflyingmount"}},
{name="mount.forceflyingmount",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.ForceFlyingMount"], depends = {"mount.useflyingmount"}},
{name="mount.copytargetmount",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.CopyTargetMount"]},
{name="mount.prioritizepassenger",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.PrioritizePassenger"]},
{name="mount.noswimming",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.NoSwimming"]},
{name="mount.flyingbroom",element="CheckBox",label=LibStub("AceLocale-3.0"):GetLocale("BeStride")["Settings.FlyingBroom"]},
Expand Down Expand Up @@ -94,6 +95,7 @@ defaults = {
enablenew = false, --ENABLENEW
useflyingmount = false,
forceflyingmount = false, --FFM
copytargetmount = true,
nodismountwhileflying = false, --NDWF
noswimming = false,
flyingbroom = false,
Expand Down
8 changes: 8 additions & 0 deletions Versions/Common/logic.mounts.lua
Expand Up @@ -52,4 +52,12 @@ function BeStride:CheckLoanedMount()
end

return nil
end

function BeStride:CanUseTargetsMount()
if (not self:DBGet("settings.mount.copytargetmount")) then return false end
if (self:MovementCheck() or not UnitExists("target")) then return false end

local spellId, mountId, isUsable = self:GetKnownMountFromTarget()
return isUsable
end
10 changes: 9 additions & 1 deletion Versions/Common/mount.lua
@@ -1,6 +1,9 @@
function BeStride:Regular()
if self:CanUseTargetsMount() then
self:DismountAndExit()
return self:UseTargetsMount()
-- Aspect of the Cheetah is available from level 5
if self:IsHunterAndSpecial() then
elseif self:IsHunterAndSpecial() then
return self:Hunter()
-- Check if we are mounted
elseif IsMounted() and self:NeedsChauffeur() then
Expand Down Expand Up @@ -264,3 +267,8 @@ function BeStride:DismountAndExit()
Dismount()
end
end

function BeStride:UseTargetsMount()
local spellId = self:GetKnownMountFromTarget()
return BeStride_Mount:MountSpell(GetSpellInfo(spellId))
end
12 changes: 10 additions & 2 deletions Versions/Common/options.lua
Expand Up @@ -75,10 +75,18 @@ local optionsTable_Options = {
set=function (info,val) BeStride:DBSetSetting(info[#info],val) end,
disabled=function(info) return not BeStride:DBGetSetting('mount.useflyingmount') end,
},
["mount.copytargetmount"]={
type="toggle",
name=L["Settings.CopyTargetMount"],
order=7,
width="full",
get=function (info) return BeStride:DBGetSetting(info[#info]) end,
set=function (info,val) BeStride:DBSetSetting(info[#info],val) end,
},
special_mounts = {
type="group",
inline=true,
order=7,
order=8,
name=L["GUI.TAB.MountOptions.SpecialMounts"],
args={
["mount.prioritizepassenger"]={
Expand Down Expand Up @@ -126,7 +134,7 @@ local optionsTable_Options = {
repair_mounts = {
type="group",
name=L["GUI.TAB.MountOptions.RepairMounts"],
order=8,
order=9,
width="full",
inline=true,
args={
Expand Down
11 changes: 11 additions & 0 deletions Versions/Mainline/bestride.lua
Expand Up @@ -38,4 +38,15 @@ end

function BeStride:GetMountInfoByIndex(index)
return nil
end

function BeStride:GetKnownMountFromTarget()
for i=1,40,1 do
local spellId = select(10, UnitBuff("target", i))
if not spellId then return end
local mountId = C_MountJournal.GetMountFromSpell(spellId)
if mountId ~= nil then
return self:isMountUsable(mountId)
end
end
end
16 changes: 16 additions & 0 deletions Versions/Wrath/bestride.lua
Expand Up @@ -54,4 +54,20 @@ end

function BeStride:OverrideConstants()
BeStride_Constants.Riding.Flight.Restricted.Continents[113].requires = 54197
end

function BeStride:GetKnownMountFromTarget()
local mountIdBySpellId = {}
for i=1,GetNumCompanions("MOUNT"),1 do
local mountID,name,spellID,icon,isSummoned = GetCompanionInfo("MOUNT", i)
mountIdBySpellId[spellID] = mountID
end
-- look for unit aura that matches known AND usable mount ID
for i=1,40,1 do
local spellId = select(10,UnitBuff("target",i))
if not spellId then return end
if mountIdBySpellId[spellId] ~= nil then
return spellId, mountIdBySpellId[spellId], true
end
end
end
1 change: 1 addition & 0 deletions localization/en-US.lua
Expand Up @@ -64,6 +64,7 @@ L["Settings.RemountAfterDismount"] = "Remount Immediately After Dismounting"
L["Settings.NoDismountWhileFlying"] = "Don't dismount while flying. You'll have to land or (if enabled in Blizzard options) cast a spell"
L["Settings.UseFlyingMount"] = "Use Flying type mounts even in areas where you cannot fly"
L["Settings.ForceFlyingMount"] = "Force Flying type mounts even in areas where you cannot fly"
L["Settings.CopyTargetMount"] = "Attempt to use the same mount as your current target"
L["Settings.PrioritizePassenger"] = "Prioritize Passenger Mounts when in group"
L["Settings.NoSwimming"] = "Never use underwater mounts even when swimming"
L["Settings.FlyingBroom"] = "Always use Flying Broom instead of a normal mount"
Expand Down

0 comments on commit a46a3b6

Please sign in to comment.