forked from phanx-wow/LibFlyable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibFlyable.lua
109 lines (91 loc) · 3.69 KB
/
LibFlyable.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
--[[--------------------------------------------------------------------
LibFlyable
Replacement for the IsFlyableArea API function in World of Warcraft.
Author : Phanx <[email protected]>
License: Public Domain
This is free and unencumbered software released into the public domain.
https://github.com/phanx-wow/LibFlyable
https://wow.curseforge.com/projects/libflyable
----------------------------------------------------------------------]]
-- TODO: Wintergrasp (mapID 501) status detection? Or too old to bother with?
local MAJOR, MINOR = "LibFlyable", 3
assert(LibStub, MAJOR.." requires LibStub")
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end
----------------------------------------
-- Data
----------------------------------------
local spellForContinent = {
-- Continents/instances requiring a spell to fly:
-- Broken Isles Pathfinder
[1220] = 233368, -- Broken Isles
-- Battle for Azeroth Pathfinder
[1642] = 278833, -- Zandalar
[1643] = 278833, -- Kul Tiras
[1718] = 278833, -- Nazjatar
-- Unflyable continents/instances where IsFlyableArea returns true:
[1191] = -1, -- Ashran (PvP)
[1265] = -1, -- Tanaan Jungle Intro
[1463] = -1, -- Helheim Exterior Area
[1500] = -1, -- Broken Shore (scenario for DH Vengeance artifact)
[1669] = -1, -- Argus (mostly OK, few spots are bugged)
-- Unflyable class halls where IsFlyableArea returns true:
-- Note some are flyable at the entrance, but not inside;
-- flying serves no purpose here, so we'll just say no.
[1519] = -1, -- The Fel Hammer (Demon Hunter)
[1514] = -1, -- The Wandering Isle (Monk)
[1469] = -1, -- The Heart of Azeroth (Shaman)
[1107] = -1, -- Dreadscar Rift (Warlock)
[1479] = -1, -- Skyhold (Warrior)
-- Unflyable island expeditions where IsFlyableArea returns true:
[1813] = -1, -- Un'gol Ruins
[1814] = -1, -- Havenswood
[1879] = -1, -- Jorundall
[1882] = -1, -- Verdant Wilds
[1883] = -1, -- Whispering Reef
[1892] = -1, -- Rotting Mire
[1893] = -1, -- The Dread Chain
[1897] = -1, -- Molten Clay
[1898] = -1, -- Skittering Hollow
[1907] = -1, -- Snowblossom Village
[2124] = -1, -- Crestfall
-- Unflyable Dungeons where IsFlyableArea returns true:
[1208] = -1, -- Grimrail Depot
[1763] = -1, -- Atal'dazar
-- Unflyable Warfronts where IsFlyableArea returns true:
[1943] = -1, -- The Battle of Stormgarde
[1876] = -1, -- Warfronts Arathi - Horde
-- Unflyable Raids where IsFlyableArea returns true:
[2169] = -1, -- Uldir: The Oblivion Door
[2296] = -1, -- Castle Nathria
-- Unflyable Scenarios where IsFlyableArea returns true:
[1662] = -1, -- Assault of the Sanctum of Order
[1906] = -1, -- Zandalar Continent Finale
[1917] = -1, -- Mag'har Scenario
-- Unflyable Lesser Visions where IsFlyableArea returns true:
[2275] = -1, -- Vale of Eternal Twilight
-- Unflyable Covenant areas where IsFlyableArea returns true:
[2363] = -1, -- Ardenweald Queens Conservatory
}
local noFlySubzones = {
-- Unflyable subzones where IsFlyableArea() returns true:
["Nespirah"] = true, ["Неспира"] = true, ["네스피라"] = true, ["奈瑟匹拉"] = true, ["奈斯畢拉"] = true,
}
----------------------------------------
-- Logic
----------------------------------------
local GetInstanceInfo = GetInstanceInfo
local GetSubZoneText = GetSubZoneText
local IsFlyableArea = IsFlyableArea
local IsSpellKnown = IsSpellKnown
function lib.IsFlyableArea()
if not IsFlyableArea() or noFlySubzones[GetSubZoneText() or ""] then
return false
end
local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo()
local reqSpell = spellForContinent[instanceMapID]
if reqSpell then
return reqSpell > 0 and IsSpellKnown(reqSpell)
end
return IsSpellKnown(34090) or IsSpellKnown(34091) or IsSpellKnown(90265)
end