Skip to content

Commit

Permalink
Add some compat code (closes #149)
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Aug 15, 2024
1 parent 6759a25 commit 54d7e54
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ globals = {
"C_Item",
"C_Minimap",
"C_PvP",
"C_Spell",
"C_Texture",
"C_Timer",
"C_UIWidgetManager",
Expand All @@ -45,6 +46,7 @@ globals = {
"GetQuestReward",
"GetRealmName",
"GetSpellInfo",
"GetSpellTexture",
"GetTime",
"IsAltKeyDown",
"IsControlKeyDown",
Expand Down
9 changes: 5 additions & 4 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ do
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetAtlasInfo = C_Texture.GetAtlasInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo

local function UpdatePOI()
local pois = GetAreaPOIForMap(curMapID)
Expand All @@ -596,12 +597,12 @@ do
local bar = curMod:StartBar(name, capTime, GetIconData(icon), iconDataConflict[icon])
bar:Set("capping:poiid", areaPoiID)
if icon == 137 or icon == 139 then -- Workshop in IoC
curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
end
else
curMod:StopBar(name)
if icon == 136 or icon == 138 then -- Workshop in IoC
curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
local _, _, _, id = UnitPosition("player")
Expand Down Expand Up @@ -634,12 +635,12 @@ do
)
bar:Set("capping:poiid", areaPoiID)
--if atlasName == WORKSHOPHORDE or atlasName == WORKSHOPALLIANCE then -- Workshop in IoC
-- curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
-- curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
--end
else
curMod:StopBar(name)
--if icon == 136 or icon == 138 then -- Workshop in IoC
-- curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
-- curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
--elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- -- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
-- local _, _, _, id = UnitPosition("player")
Expand Down
9 changes: 5 additions & 4 deletions Core_BCC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ do
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetAtlasInfo = C_Texture.GetAtlasInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo

local function UpdatePOI()
local pois = GetAreaPOIForMap(curMapID)
Expand All @@ -671,12 +672,12 @@ do
local bar = curMod:StartBar(name, capTime, GetIconData(icon), iconDataConflict[icon])
bar:Set("capping:poiid", areaPoiID)
if icon == 137 or icon == 139 then -- Workshop in IoC
curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
end
else
curMod:StopBar(name)
if icon == 136 or icon == 138 then -- Workshop in IoC
curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
elseif icon == 1 or icon == 2 then
-- Horde mine, Alliance mine
local _, _, _, id = UnitPosition("player")
Expand Down Expand Up @@ -709,12 +710,12 @@ do
)
bar:Set("capping:poiid", areaPoiID)
--if atlasName == WORKSHOPHORDE or atlasName == WORKSHOPALLIANCE then -- Workshop in IoC
-- curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
-- curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
--end
else
curMod:StopBar(name)
--if icon == 136 or icon == 138 then -- Workshop in IoC
-- curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
-- curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
--elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- -- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
-- local _, _, _, id = UnitPosition("player")
Expand Down
5 changes: 3 additions & 2 deletions Core_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ do
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetAtlasInfo = C_Texture.GetAtlasInfo
--local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo

local function UpdatePOI()
local pois = GetAreaPOIForMap(curMapID)
Expand Down Expand Up @@ -703,12 +704,12 @@ do
)
bar:Set("capping:poiid", areaPoiID)
--if atlasName == WORKSHOPHORDE or atlasName == WORKSHOPALLIANCE then -- Workshop in IoC
-- curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
-- curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
--end
else
curMod:StopBar(name)
--if icon == 136 or icon == 138 then -- Workshop in IoC
-- curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
-- curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
--elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- -- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
-- local _, _, _, id = UnitPosition("player")
Expand Down
9 changes: 5 additions & 4 deletions Core_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ do
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetAtlasInfo = C_Texture.GetAtlasInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo

local function UpdatePOI()
local pois = GetAreaPOIForMap(curMapID)
Expand All @@ -671,12 +672,12 @@ do
local bar = curMod:StartBar(name, capTime, GetIconData(icon), iconDataConflict[icon])
bar:Set("capping:poiid", areaPoiID)
if icon == 137 or icon == 139 then -- Workshop in IoC
curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
end
else
curMod:StopBar(name)
if icon == 136 or icon == 138 then -- Workshop in IoC
curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
local _, _, _, id = UnitPosition("player")
Expand Down Expand Up @@ -709,12 +710,12 @@ do
)
bar:Set("capping:poiid", areaPoiID)
--if atlasName == WORKSHOPHORDE or atlasName == WORKSHOPALLIANCE then -- Workshop in IoC
-- curMod:StopBar((GetSpellInfo(56661))) -- Build Siege Engine
-- curMod:StopBar((GetSpellName(56661))) -- Build Siege Engine
--end
else
curMod:StopBar(name)
--if icon == 136 or icon == 138 then -- Workshop in IoC
-- curMod:StartBar(GetSpellInfo(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
-- curMod:StartBar(GetSpellName(56661), 181, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- Build Siege Engine, 252187 = ability_vehicle_siegeengineram
--elseif icon == 2 or icon == 3 or icon == 151 or icon == 153 or icon == 18 or icon == 20 then
-- -- Horde mine, Alliance mine, Alliance Refinery, Horde Refinery, Alliance Quarry, Horde Quarry
-- local _, _, _, id = UnitPosition("player")
Expand Down
7 changes: 5 additions & 2 deletions Modules/Arena.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ end

do
local GetIconAndTextWidgetVisualizationInfo = C_UIWidgetManager.GetIconAndTextWidgetVisualizationInfo
local tonumber, gsub, match, GetSpellInfo = tonumber, string.gsub, string.match, GetSpellInfo
local tonumber, gsub, match = tonumber, string.gsub, string.match
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
function mod:UPDATE_UI_WIDGET(tbl)
if tbl.widgetSetID == 1 and tbl.widgetType == 0 then
local id = tbl.widgetID
Expand All @@ -20,7 +22,8 @@ do
local remaining = seconds + (minutes*60) + 1
if remaining > 4 then
self:UnregisterEvent("UPDATE_UI_WIDGET")
local spell, _, icon = GetSpellInfo(34709)
local spell = GetSpellName(34709)
local icon = GetSpellTexture(34709)
self:StartBar(spell, 93, icon, "colorOther")
local text = gsub(TIME_REMAINING, ":", "")
self:StartBar(text, remaining, nil, "colorOther")
Expand Down
6 changes: 4 additions & 2 deletions Modules/Arena_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ do
end

do
local GetSpellInfo = GetSpellInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
function mod:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
if msg == L.arenaStartTrigger then
self:UnregisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
local spell, _, icon = GetSpellInfo(34709)
local spell = GetSpellName(34709)
local icon = GetSpellTexture(34709)
self:StartBar(spell, 95, icon, "colorOther")
end
end
Expand Down
8 changes: 6 additions & 2 deletions Modules/EyeOfTheStorm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ do
local extraMsg = nil
local color = {r=0,g=1,b=0}
local NewTicker = C_Timer.NewTicker
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
local function PrintExtraMessage()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if extraMsg and id == 566 then -- Check the game isn't over
Expand All @@ -31,7 +33,8 @@ do
local function StartNextGravTimer()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if id == 566 then -- Check the game isn't over
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
mod:StartBar(name, 55, icon, "colorOther")
ticker1 = NewTicker(55, StartNextGravTimer, 1) -- Compensate for being dead (you don't get the message)
ticker2 = NewTicker(50, PrintExtraMessage, 1)
Expand All @@ -42,7 +45,8 @@ do
if not extraMsg then
extraMsg = msg:gsub("1", "")
end
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
self:StartBar(name, 15, icon, "colorOther")
self:Timer(15, StartNextGravTimer)
self:Timer(10, PrintExtraMessage)
Expand Down
8 changes: 6 additions & 2 deletions Modules/EyeOfTheStorm_TBC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ do
local extraMsg = nil
local color = {r=0,g=1,b=0}
local NewTicker = C_Timer.NewTicker
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
local function PrintExtraMessage()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if extraMsg and id == 566 then -- Check the game isn't over
Expand All @@ -31,7 +33,8 @@ do
local function StartNextGravTimer()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if id == 566 then -- Check the game isn't over
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
mod:StartBar(name, 55, icon, "colorOther")
ticker1 = NewTicker(55, StartNextGravTimer, 1) -- Compensate for being dead (you don't get the message)
ticker2 = NewTicker(50, PrintExtraMessage, 1)
Expand All @@ -42,7 +45,8 @@ do
if not extraMsg then
extraMsg = msg:gsub("1", "")
end
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
self:StartBar(name, 15, icon, "colorOther")
self:Timer(15, StartNextGravTimer)
self:Timer(10, PrintExtraMessage)
Expand Down
8 changes: 6 additions & 2 deletions Modules/EyeOfTheStorm_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ do
local extraMsg = nil
local color = {r=0,g=1,b=0}
local NewTicker = C_Timer.NewTicker
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
local function PrintExtraMessage()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if extraMsg and id == 566 then -- Check the game isn't over
Expand All @@ -31,7 +33,8 @@ do
local function StartNextGravTimer()
local _, _, _, _, _, _, _, id = GetInstanceInfo()
if id == 566 then -- Check the game isn't over
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
mod:StartBar(name, 55, icon, "colorOther")
ticker1 = NewTicker(55, StartNextGravTimer, 1) -- Compensate for being dead (you don't get the message)
ticker2 = NewTicker(50, PrintExtraMessage, 1)
Expand All @@ -42,7 +45,8 @@ do
if not extraMsg then
extraMsg = msg:gsub("1", "")
end
local name, _, icon = GetSpellInfo(44224) -- Gravity Lapse
local name = GetSpellName(44224) -- Gravity Lapse
local icon = GetSpellTexture(44224) -- Gravity Lapse
self:StartBar(name, 15, icon, "colorOther")
self:Timer(15, StartNextGravTimer)
self:Timer(10, PrintExtraMessage)
Expand Down
3 changes: 2 additions & 1 deletion Modules/IsleOfConquest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ do
local me = UnitName("player").. "-" ..GetRealmName()
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
function mod:CHAT_MSG_ADDON(prefix, msg, channel, sender)
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
if msg == "gr" and sender ~= me then -- gate request
Expand All @@ -160,7 +161,7 @@ do
local tbl = GetAreaPOIInfo(169, pois[i])
local icon = tbl.textureIndex
if icon == 136 or icon == 138 then -- Workshop in IoC
local text = GetSpellInfo(56661) -- Build Siege Engine
local text = GetSpellName(56661) -- Build Siege Engine
local bar = self:GetBar(text)
if not bar then
self:StartBar(text, msg == "rb" and 181 or 90.5, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- 252187 = ability_vehicle_siegeengineram
Expand Down
3 changes: 2 additions & 1 deletion Modules/IsleOfConquest_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ do
local me = UnitName("player").. "-" ..GetRealmName()
local GetAreaPOIForMap = C_AreaPoiInfo.GetAreaPOIForMap
local GetAreaPOIInfo = C_AreaPoiInfo.GetAreaPOIInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
function mod:CHAT_MSG_ADDON(prefix, msg, channel, sender)
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
if msg == "gr" and sender ~= me then -- gate request
Expand All @@ -160,7 +161,7 @@ do
local tbl = GetAreaPOIInfo(169, pois[i])
local icon = tbl.textureIndex
if icon == 136 or icon == 138 then -- Workshop in IoC
local text = GetSpellInfo(56661) -- Build Siege Engine
local text = GetSpellName(56661) -- Build Siege Engine
local bar = self:GetBar(text)
if not bar then
self:StartBar(text, msg == "rb" and 181 or 90.5, 252187, icon == 136 and "colorAlliance" or "colorHorde") -- 252187 = ability_vehicle_siegeengineram
Expand Down

0 comments on commit 54d7e54

Please sign in to comment.