Skip to content

Commit

Permalink
Cata config update
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Apr 30, 2024
1 parent 4450f2b commit ca9e31f
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 8 deletions.
19 changes: 19 additions & 0 deletions NugComboBar-Cata.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Interface: 40400
## Title: NugComboBar
## Notes: Combopoints counter
## Author: d87
## SavedVariablesPerCharacter: NugComboBarDB_Character
## SavedVariables: NugComboBarDB_Global
## Version: @project-version@

## X-WoWI-ID: 6308
## X-Curse-Project-ID: 2538
## X-Wago-ID: 9rN4yy6D

Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
Libs\AceDB-3.0\AceDB-3.0.xml
NugComboBar.lua
skin.lua
config.lua
config.cata.lua
20 changes: 18 additions & 2 deletions NugComboBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ end
--- Compatibility with Classic
local APILevel = math.floor(select(4,GetBuildInfo())/10000)
-- local isClassic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
local IsInPetBattle = APILevel <= 3 and function() end or C_PetBattles.IsInBattle
local GetSpecialization = APILevel <= 3 and function() return 1 end or GetSpecializationWithFallback
local IsInPetBattle = APILevel <= 4 and function() end or C_PetBattles.IsInBattle
local GetSpecialization = APILevel <= 4 and function() return 1 end or GetSpecializationWithFallback

local configs = {}
local currentConfigName
Expand Down Expand Up @@ -204,6 +204,22 @@ if APILevel == 3 then
PRIEST = { "Disabled", "Disabled", "Disabled" },
}
end
if APILevel == 4 then
defaults.global.classConfig = {
ROGUE = { "ComboPointsRogueClassic", "ComboPointsRogueClassic", "ComboPointsRogueClassic" },
DRUID = { "ShapeshiftDruid", "ComboPointsDruid", "ShapeshiftDruid", "ComboPointsDruid" },
PALADIN = { "HolyPower", "HolyPower", "HolyPower" },
MONK = { "Disabled", "Disabled", "Disabled" },
WARLOCK = { "SoulShards", "SoulShards", "SoulShards" },
DEMONHUNTER = { "Disabled", "Disabled" },
DEATHKNIGHT = { "Disabled", "Disabled", "Disabled" },
MAGE = { "ArcaneBlastClassic", "ArcaneBlastClassic", "ArcaneBlastClassic" },
WARRIOR = { "Disabled", "Disabled", "Disabled" },
SHAMAN = { "MaelstromWeapon", "MaelstromWeapon", "MaelstromWeapon" },
HUNTER = { "Disabled", "Disabled", "Disabled" },
PRIEST = { "ShadowOrbs", "ShadowOrbs", "ShadowOrbs" },
}
end

function NugComboBar:LoadClassSettings()
local class = select(2,UnitClass("player"))
Expand Down
2 changes: 1 addition & 1 deletion Options/NugComboBarGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local NugComboBar = _G.NugComboBar
local L = NugComboBar.L

local APILevel = math.floor(select(4,GetBuildInfo())/10000)
local isClassic = APILevel <= 3
local isClassic = APILevel <= 4

local GetNumSpecializations = isClassic and function() return 1 end or _G.GetNumSpecializations
local GetSpecializationInfo = isClassic and function() return nil end or _G.GetSpecializationInfo
Expand Down
67 changes: 67 additions & 0 deletions config.cata.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
local addonName, ns = ...

local APILevel = ns.APILevel

local GetSpecialization = APILevel <= 4 and function() return 1 end or _G.GetSpecialization
local GetSpell = ns.GetSpell
local FindAura = ns.FindAura
local GetAuraStack = ns.GetAuraStack
local GetAuraStackWTimer = ns.GetAuraStackWTimer
local MakeGetChargeFunc = ns.MakeGetChargeFunc
local MakeGetComboPower = ns.MakeGetComboPower
local GENERAL_UPDATE = ns.GENERAL_UPDATE
local GENERIC_FILTERED_UNIT_POWER_UPDATE = ns.GENERIC_FILTERED_UNIT_POWER_UPDATE


local DRUID_BEAR_FORM = ns.DRUID_BEAR_FORM
local DRUID_CAT_FORM = ns.DRUID_CAT_FORM


if APILevel ~= 4 then return end
-- CATACLYSM CONFIG


---------------------
-- PALADIN
---------------------

NugComboBar:RegisterConfig("HolyPower", {
triggers = { GetSpecialization },
setup = function(self, spec)
self.eventProxy:RegisterUnitEvent("UNIT_POWER_UPDATE", "player")
self.eventProxy.UNIT_POWER_UPDATE = GENERIC_FILTERED_UNIT_POWER_UPDATE("HOLY_POWER")
self:SetMaxPoints(3)
self:SetDefaultValue(0)
self.flags.soundFullEnabled = true
self:SetSourceUnit("player")
self:SetTargetUnit("player")
self:SetPointGetter(MakeGetComboPower(Enum.PowerType.HolyPower))
end
}, "PALADIN")

NugComboBar:RegisterConfig("ShadowOrbs", {
triggers = { GetSpecialization, GetSpell(95740) },
setup = function(self, spec)
self.eventProxy:RegisterUnitEvent("UNIT_AURA", "player")
self.eventProxy.UNIT_AURA = GENERAL_UPDATE
self:SetMaxPoints(3)
self:SetDefaultValue(0)
self.flags.soundFullEnabled = true
self:SetPointGetter(GetAuraStack(77487)) -- Shadow Orbs
end
}, "PREIST")


NugComboBar:RegisterConfig("SoulShards", {
triggers = { GetSpecialization },
setup = function(self, spec)
self.eventProxy:RegisterUnitEvent("UNIT_POWER_UPDATE", "player")
self.eventProxy.UNIT_POWER_UPDATE = GENERIC_FILTERED_UNIT_POWER_UPDATE("SOUL_SHARDS")
self:SetMaxPoints(3)
self:SetDefaultValue(3)
self.flags.soundFullEnabled = true
self:SetSourceUnit("player")
self:SetTargetUnit("player")
self:SetPointGetter(MakeGetComboPower(Enum.PowerType.SoulShards))
end
}, "WARLOCK")
46 changes: 41 additions & 5 deletions config.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
local APILevel = math.floor(select(4,GetBuildInfo())/10000)
local addonName, ns = ...

ns.APILevel = math.floor(select(4,GetBuildInfo())/10000)
local APILevel = ns.APILevel
local isClassic = APILevel <= 3
local GetSpecialization = APILevel <= 3 and function() return 1 end or _G.GetSpecialization
local GetSpecialization = APILevel <= 4 and function() return 1 end or _G.GetSpecialization

local DRUID_CAT_FORM = DRUID_CAT_FORM or CAT_FORM or 1
local DRUID_BEAR_FORM = DRUID_BEAR_FORM or BEAR_FORM or 5

ns.DRUID_BEAR_FORM = DRUID_BEAR_FORM
ns.DRUID_CAT_FORM = DRUID_CAT_FORM
local UnitPower = UnitPower

local GetSpell = function(spellId)
Expand Down Expand Up @@ -54,6 +60,27 @@ local MakeGetChargeFunc = function(spellID)
end
end

local function GENERIC_FILTERED_UNIT_POWER_UPDATE(powerType)
return function(self,event,unit,ptype)
if unit ~= "player" or ptype ~= powerType then return end
return self:Update(unit, ptype)
end
end

local function MakeGetComboPower(powerTypeIndex)
return function(unit)
return UnitPower("player", powerTypeIndex)
end
end

ns.GetSpell = GetSpell
ns.FindAura = FindAura
ns.GetAuraStack = GetAuraStack
ns.GetAuraStackWTimer = GetAuraStackWTimer
ns.MakeGetChargeFunc = MakeGetChargeFunc
ns.GENERIC_FILTERED_UNIT_POWER_UPDATE = GENERIC_FILTERED_UNIT_POWER_UPDATE
ns.MakeGetComboPower = MakeGetComboPower

---------------
-- COMMON
---------------
Expand All @@ -62,6 +89,8 @@ local GENERAL_UPDATE = function(self)
self:Update()
end

ns.GENERAL_UPDATE = GENERAL_UPDATE

local COMBO_POINTS_UNIT_POWER_UPDATE = function(self,event,unit,ptype)
if unit ~= "player" then return end
if ptype == "COMBO_POINTS" then
Expand Down Expand Up @@ -932,7 +961,7 @@ end -- end of retail configs

-- Classic

if APILevel <= 3 then
if APILevel <= 4 then

local OriginalGetComboPoints = _G.GetComboPoints
local RogueGetComboPoints = function(unit)
Expand Down Expand Up @@ -1017,6 +1046,8 @@ if APILevel <= 3 then
end
}, "DRUID")


-- BURNING CRUSADE
if APILevel == 2 then
NugComboBar:RegisterConfig("ArcaneBlastClassic", {
triggers = { GetSpecialization },
Expand Down Expand Up @@ -1056,11 +1087,13 @@ if APILevel <= 3 then
self:SetPointGetter(GetAuraStack(408505, "HELPFUL")) -- Maelstrom Weapon
end
}, "SHAMAN")
end


end

if APILevel == 3 then

-- WRATH & CATA ARCANE BLAST
if APILevel >= 3 then
NugComboBar:RegisterConfig("ArcaneBlastClassic", {
triggers = { GetSpecialization },
setup = function(self, spec)
Expand All @@ -1072,7 +1105,10 @@ if APILevel <= 3 then
self:SetPointGetter(GetAuraStack(36032, "HARMFUL")) -- Arcane Blast
end
}, "MAGE")
end

-- WRATH & CATA MAELSTROM
if APILevel >= 3 then
NugComboBar:RegisterConfig("MaelstromWeapon", {
triggers = { GetSpecialization },
setup = function(self, spec)
Expand Down

0 comments on commit ca9e31f

Please sign in to comment.