66---- ----------------------------------------------------------------------------------------------
77local _G = _G
88local addonName = ...
9- local vmVersion = " 2.7 "
9+ local vmVersion = " 2.8 "
1010if not _G .ValorAddons then _G .ValorAddons = {} end
1111_G .ValorAddons [addonName ] = true
1212
@@ -39,12 +39,18 @@ local spellMap = {
3939 ZenFlight = { id = 125883 },
4040 FlightForm = { id = 276029 },
4141 TravelForm = { id = 783 },
42+ MountForm = { id = 210053 },
4243 AquaticForm = { id = 276012 },
4344 MoonkinForm = { id = 24858 },
4445 RunningWild = { id = 87840 },
4546 TwoForms = { id = 68996 },
4647}
4748for k in pairs (spellMap ) do spellMap [k ].name = GetSpellInfo (spellMap [k ].id ) end
49+ local mawMounts = {
50+ 312762 , -- Mawsworn Soulhunter
51+ 344577 , -- Bound Shadehound
52+ 344578 , -- Corridor Creeper
53+ }
4854
4955---- ---------------------------------------------
5056-- Option Defaults
6369 DetectUnderwater = true ,
6470 MonkZenFlight = true ,
6571 ShamanGhostWolf = true ,
66- WorgenMount = false , WorgenHuman = true ,
67- DruidMoonkin = true , DruidFormRandom = false , DruidFormAlways = false ,
72+
73+ WorgenMount = false ,
74+ WorgenHuman = true ,
75+
76+ DruidMoonkin = true ,
77+ DruidFormRandom = false ,
78+ DruidFormAlways = false ,
79+ DruidFormMount = false ,
6880 }
6981 }
7082
@@ -344,6 +356,11 @@ local function vmVashjir()
344356 return vmMain .zoneInfo .mapId == 204 or vmMain .zoneInfo .mapId == 201 or vmMain .zoneInfo .mapId == 205 or vmMain .zoneInfo .mapId == 203
345357end
346358
359+ -- vmTheMaw() - Return true if in the Maw in Shadowlands.
360+ local function vmTheMaw ()
361+ return vmMain .zoneInfo .mapId == 1543
362+ end
363+
347364-- vmFloating() - Blizzard should either add IsFloating() or fix IsSubmerged()
348365-- false if Breath Timer exists and is lowering, else true
349366---- ---------------------------------------------
449466 if playerClass == " DRUID" and IsPlayerSpell (spellMap .TravelForm .id ) then
450467 -- No Riding Skill: Priority: (Travel > Heirloom) in Water, (Travel < Heirloom) on Land
451468 if not canRide then
452- addToPool ((isSubmerged and IsPlayerSpell (spellMap .AquaticForm .id )) and 15 or 5 , spellMap .TravelForm .id )
469+ -- Always Travel Form in water
470+ if isSubmerged and IsPlayerSpell (spellMap .AquaticForm .id ) then addToPool (15 , spellMap .TravelForm .id )
471+ -- Mount Form
472+ elseif ValorMountLocal .DruidFormMount then addToPool (5 , spellMap .MountForm .id )
473+ -- Travel Form
474+ else addToPool (5 , spellMap .TravelForm .id )
475+ end
453476 -- DruidFormRandom: Treat Flight Form as a Favorite
454- elseif canFly and IsPlayerSpell ( spellMap . FlightForm . id ) and ValorMountLocal .DruidFormRandom then
477+ elseif canFly and ValorMountLocal .DruidFormRandom then
455478 addToPool (FLYING , spellMap .TravelForm .id )
456479 end
457480 end
471494 end
472495
473496 -- Favorites
474- for i = 1 , # mountDb do
475- local mountId , _ , mountType , spellId = unpack (mountDb [i ])
476- local _ , _ , _ , _ , isUsable = GetMountInfoByID (mountId )
477- if isUsable then
478- local myPriority = mountPriority [mountType ] or 0
479- -- Aquatic Mount Priorities,
480- if myPriority == AQUATIC then
481- myPriority =
482- (ValorMountLocal .DetectUnderwater and isSubmerged and not isFloating and myPriority + AQUATIC ) -- Detection ON, In Water, Not Floating, Double Priority (>ALL)
483- or (not ValorMountLocal .DetectUnderwater and isSubmerged and AQUATIC ) -- Detection OFF, In Water, Maintain Priority (>GROUND and <FLY)
484- or 0 -- On land, 0
485- -- Not Flying - Lower Priority for Flying Mounts
486- elseif not canFly and myPriority == FLYING then
487- myPriority = ValorMountGlobal .groundFly [mountId ] and ValorMountGlobal .groundFly [mountId ] > 1 and GROUND or (HEIRLOOM + 5 )
488- -- Flying Mount set to Ground Only
489- elseif canFly and myPriority == FLYING and ValorMountGlobal .groundFly [mountId ] and ValorMountGlobal .groundFly [mountId ] > 2 then
490- myPriority = GROUND
491- end
492- addToPool (myPriority , spellId )
493- end
494- end
497+ if not vmTheMaw () then
498+ for i = 1 , # mountDb do
499+ local mountId , _ , mountType , spellId = unpack (mountDb [i ])
500+ local _ , _ , _ , _ , isUsable = GetMountInfoByID (mountId )
501+ if isUsable then
502+ local myPriority = mountPriority [mountType ] or 0
503+ -- Aquatic Mount Priorities,
504+ if myPriority == AQUATIC then
505+ myPriority =
506+ (ValorMountLocal .DetectUnderwater and isSubmerged and not isFloating and myPriority + AQUATIC ) -- Detection ON, In Water, Not Floating, Double Priority (>ALL)
507+ or (not ValorMountLocal .DetectUnderwater and isSubmerged and AQUATIC ) -- Detection OFF, In Water, Maintain Priority (>GROUND and <FLY)
508+ or 0 -- On land, 0
509+ -- Not Flying - Lower Priority for Flying Mounts
510+ elseif not canFly and myPriority == FLYING then
511+ myPriority = ValorMountGlobal .groundFly [mountId ] and ValorMountGlobal .groundFly [mountId ] > 1 and GROUND or (HEIRLOOM + 5 )
512+ -- Flying Mount set to Ground Only
513+ elseif canFly and myPriority == FLYING and ValorMountGlobal .groundFly [mountId ] and ValorMountGlobal .groundFly [mountId ] > 2 then
514+ myPriority = GROUND
515+ end
516+ addToPool (myPriority , spellId )
517+ end
518+ end
519+ -- Shadowlands: The Maw
520+ else
521+ for k in pairs (mawMounts ) do
522+ if IsPlayerSpell (mawMounts [k ]) then
523+ addToPool (GROUND , mawMounts [k ])
524+ end
525+ end
526+ end
495527
496528 -- *drum roll*
497529 if # tempOne > 0 then
534566 -- Druid & Travel Form
535567 -- 5487 = Bear, 768 = Cat, 783 = Travel, 24858 = Moonkin, 114282 = Tree, 210053 = Stag
536568 if playerClass == " DRUID" and IsPlayerSpell (spellMap .TravelForm .id ) and not inVashjir then
569+ local inMoonkinForm = false
570+
537571 for i = 1 , GetNumShapeshiftForms () do
538572 local _ , fActive , _ , fSpellId = GetShapeshiftFormInfo (i )
539- -- Special Conditions for Travel Form
540- if fSpellId == spellMap .TravelForm .id and fActive then
541- canMount = false
542- inTravelForm = true
543- macroExit = " /cancelform [form]\n "
544- -- DruidMoonkinForm: Shift back into Moonkin from Travel Form
545- if ValorMountLocal .DruidMoonkin and wasMoonkin then
546- macroPost = format (" /cast [noform] %s\n " , spellMap .MoonkinForm .name )
547- end
548- -- In Moonkin
549- elseif fSpellId == spellMap .MoonkinForm .id then
550- wasMoonkin = fActive
551- end
552- end
553- -- Druid Travel Form: If in Combat, Moving, Falling or DruidFormAlways is enabled
554- if not inTravelForm and not isMounted
555- and ((ValorMountLocal .DruidFormAlways and canFly and IsPlayerSpell (spellMap .FlightForm .id ))
556- or (isOutdoors and (inCombat or isMoving or (canFly and isFalling )))) then
557- macroCond = " [outdoors,nomounted,novehicleui]"
558- spellId = spellMap .TravelForm .id
573+
574+ if fActive then
575+ if fSpellId == spellMap .TravelForm .id or fSpellId == spellMap .MountForm .id then
576+ inTravelForm = true
577+ elseif fSpellId == spellMap .MoonkinForm .id then
578+ inMoonkinForm = true
579+ end
580+ end
559581 end
560- end
582+
583+ -- Special Conditions for Travel Form
584+ if inTravelForm then
585+ canMount = false
586+ macroExit = " /cancelform [form]\n "
587+ -- DruidMoonkinForm: Shift back into Moonkin from Travel Form
588+ if wasMoonkin and ValorMountLocal .DruidMoonkin then
589+ macroPost = format (" /cast [noform] %s\n " , spellMap .MoonkinForm .name )
590+ end
591+ else
592+ wasMoonkin = inMoonkinForm
593+ end
594+
595+ -- Druid Travel Form
596+ if not inTravelForm and not isMounted and isOutdoors then
597+ -- If Moving, Cannot Fly, DruidFormMount is enabled, Mount Form is learned, and not Submerged
598+ if isMoving and not canFly and ValorMountLocal .DruidFormMount and IsPlayerSpell (spellMap .MountForm .id ) and not IsSubmerged () then
599+ macroCond = " [outdoors,nomounted,novehicleui]"
600+ spellId = spellMap .MountForm .id
601+ -- If In Combat, Moving, Can Fly and Falling or Always Use Flight Form enabled
602+ elseif (inCombat or isMoving ) or (canFly and (isFalling or ValorMountLocal .DruidFormAlways )) then
603+ macroCond = " [outdoors,nomounted,novehicleui]"
604+ spellId = spellMap .TravelForm .id
605+ end
606+ end
607+ end
561608
562609 -- ShamanGhostWolf
563610 if playerClass == " SHAMAN" and ValorMountLocal .ShamanGhostWolf and IsPlayerSpell (spellMap .GhostWolf .id ) then
664711 desc = " Adds |cFF69CCF0[Travel Form]|r as a favorite flying mount." ,
665712 class = " DRUID" ,
666713 },
714+ DruidFormMount = {
715+ name = " |cFFFF7D0ADruid:|r Prefer Mount Form to Travel Form" ,
716+ desc = " Whenever |cFF69CCF0[Travel Form]|r would be cast as a ground mount, use |cFF69CCF0[Mount Form]|r instead." ,
717+ class = " DRUID" ,
718+ spell = spellMap .MountForm .id ,
719+ },
667720 DruidFormAlways = {
668721 name = " |cFFFF7D0ADruid:|r Always Use Flight Form" ,
669722 desc = " Ignore favorites whenever |cFF69CCF0[Flight Form]|r is available." ,
755808 -- Sort & Validate Dynamic Preferences
756809 wipe (tempOne )
757810 for k in pairs (vmInfo ) do
758- if k ~= " Enabled" and (not vmInfo [k ].race or vmInfo [k ].race == playerRace ) and (not vmInfo [k ].class or vmInfo [k ].class == playerClass ) then
811+ if k ~= " Enabled"
812+ and (not vmInfo [k ].race or vmInfo [k ].race == playerRace )
813+ and (not vmInfo [k ].class or vmInfo [k ].class == playerClass )
814+ and (not vmInfo [k ].spell or IsPlayerSpell (vmInfo [k ].spell ))
815+ then
759816 tinsert (tempOne , k )
760817 end
761818 end
@@ -1064,4 +1121,4 @@ _G.SlashCmdList.VALORMOUNT = function()
10641121 _G .InterfaceOptionsFrame_OpenToCategory (vmPrefs )
10651122 end
10661123 _G .InterfaceOptionsFrame_OpenToCategory (vmPrefs )
1067- end
1124+ end
0 commit comments