MountsJournal

MountsJournal

673k Downloads

Dragonriding mounts not prioritized in Dragonflight zones, with solution

Agayek opened this issue ยท 2 comments

commented

Not sure if this is the right place to put this, but it seems correct. I noticed that Dragonriding mounts are treated as just another mount by the addon randomizer when in Dragonflight zones, and that gets pretty obnoxious in practice. So I went and added in a filter to my install of it to exclude non-dragonriding mounts in dragonflight zones. It relies on zone UI ID right now, because I couldn't find any better way to tell if dragonriding is available, but it seems to be fully functional and doesn't interfere with other functionality of the addon. The code is below:

Modification to Mounts.lua, starting at line 642:

do
	local usableIDs = {}
	function mounts:summon(ids)
		local isInDragonridingZone = isInDragonridingZone();
		local weight = 0
		for mountID in next, ids do
			local _,_,_,_, isUsable,_,_,_,_,_,_,_,isDragonriding = C_MountJournal.GetMountInfoByID(mountID)
			if ( isInDragonridingZone ) then 
				if( isDragonriding ) then
					weight = weight + (self.mountsWeight[mountID] or 100)
					usableIDs[weight] = mountID
				end
			else
				if isUsable then
					weight = weight + (self.mountsWeight[mountID] or 100)
					usableIDs[weight] = mountID
				end
			end
		end
		if weight > 0 then
			for i = random(weight), weight do
				if usableIDs[i] then
					C_MountJournal.SummonByID(usableIDs[i])
					break
				end
			end
			wipe(usableIDs)
			return true
		else
			return false
		end
	end
end

function isInDragonridingZone()
	local mapId = C_Map.GetBestMapForUnit("player")
	return (mapId == 2022 or mapId == 2023 or mapId == 2024 or mapId == 2025 or mapId == 2026 or mapId == 2093 or mapId == 2112 or mapId == 2134 or mapId == 2135)
end
commented

Hello, :))

commented

The addon allows you to configure mounts for any zone, closed.