Skip to content

Commit

Permalink
feat: add support for classic era to the main branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Aug 25, 2023
1 parent 73bb359 commit 6249bee
Show file tree
Hide file tree
Showing 44 changed files with 2,391 additions and 613 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
exit 1
fi;
- name: "Validate TOC Classic"
run: |
if [[ "$(grep -hroP '## X?-?\KInterface.*' --exclude-dir=.release --include="*-Classic.toc" . | sort --unique | wc -l)" -gt 1 ]]; then
grep -rnP '## X?-?\KInterface.*' --exclude-dir=.release --include="*-Classic.toc" . | cat
echo "More than 1 distinct ##Interface version found in .toc files." 1>&2
exit 1
fi;
- name: "Validate TOC Wrath"
run: |
if [[ "$(grep -hroP '## X?-?\KInterface.*' --exclude-dir=.release --include="*-Wrath.toc" . | sort --unique | wc -l)" -gt 1 ]]; then
Expand Down
2 changes: 2 additions & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ externals:
Lib/LibBabble-CreatureType-3.0: svn://svn.wowace.com/wow/libbabble-creaturetype-3-0/mainline/trunk
Lib/LibBabble-Race-3.0: svn://svn.wowace.com/wow/libbabble-race-3-0/mainline/trunk

Lib/LibClassicCasterino: https://github.com/rgd87/LibClassicCasterino.git

optional-dependencies:
- masque
- omni-cc
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v10.1.6
* Support for WoW Classic Era 1.14.4. The classic era codebase has been merged into the main codebase, so some features that don't support classic may be present in a non-working state.

## v10.1.5
* Support for WoW 10.1.5

Expand Down
2 changes: 1 addition & 1 deletion Components/Core/Common/PlayerNames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ end
function NAMES:UPDATE_BATTLEFIELD_SCORE()
for i = 1, GetNumBattlefieldScores() do
local name, class, _
if TMW.isWrath then
if not TMW.isRetail then
-- There's an extra "rank" return that's not there in retail.
name, _, _, _, _, _, _, _, _, class = GetBattlefieldScore(i)
else
Expand Down
7 changes: 5 additions & 2 deletions Components/Core/Common/SwingTimerMonitor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ TMW:RegisterCallback("TMW_GLOBAL_UPDATE", function()
end)

local swingSpells =
TMW.isWrath and {
not TMW.isRetail and {
[strlowerCache[GetSpellInfo(78)]] = 1, -- Heroic Strike
[strlowerCache[GetSpellInfo(845)]] = 1, -- Cleave
[strlowerCache[GetSpellInfo(6807)]] = 1, -- Maul
[strlowerCache[GetSpellInfo(2973)]] = 1, -- Raptor Strike
[strlowerCache[GetSpellInfo(56815)]] = 1, -- Rune Strike
}
or {}

if TMW.isWrath then
swingSpells[strlowerCache[GetSpellInfo(56815)]] = 1 -- Rune Strike
end

-- ---------------------------------
-- Misc state update functions
-- ---------------------------------
Expand Down
8 changes: 4 additions & 4 deletions Components/Core/Conditions/Categories/BuffsDebuffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ ConditionCategory:RegisterCondition(4, "BUFFTOOLTIP", {
end,
icon = "Interface\\Icons\\inv_elemental_primal_mana",
tcoords = CNDT.COMMON.standardtcoords,
hidden = TMW.isWrath,
hidden = not TMW.isRetail,
funcstr = function(c)
if CanUsePackedAuras(c) then
return [[AuraVariableNumberPacked(c.Unit, c.Spells.First, "isHelpful", ]] .. (tostring(c.Checked)) .. [[) c.Operator c.Level]]
Expand All @@ -564,7 +564,7 @@ for i = 1, 3 do -- BUFFTOOLTIPSCAN
check = function(check)
check:SetTexts(L["ONLYCHECKMINE"], L["ONLYCHECKMINE_DESC"])
end,
icon = TMW.isWrath and "Interface\\Icons\\spell_ice_lament" or "Interface\\Icons\\ability_priest_clarityofwill",
icon = not TMW.isRetail and "Interface\\Icons\\spell_ice_lament" or "Interface\\Icons\\ability_priest_clarityofwill",
tcoords = CNDT.COMMON.standardtcoords,
funcstr = function(c)
if CanUsePackedAuras(c) then
Expand Down Expand Up @@ -707,7 +707,7 @@ ConditionCategory:RegisterCondition(12.5,"DEBUFFPERC", {
check:SetTexts(L["ONLYCHECKMINE"], L["ONLYCHECKMINE_DESC"])
end,
formatter = TMW.C.Formatter.PERCENT,
icon = TMW.isWrath and "Interface\\Icons\\ability_rogue_dualweild" or "Interface\\Icons\\spell_priest_voidshift",
icon = not TMW.isRetail and "Interface\\Icons\\ability_rogue_dualweild" or "Interface\\Icons\\spell_priest_voidshift",
tcoords = CNDT.COMMON.standardtcoords,
funcstr = function(c)
if CanUsePackedAuras(c) then
Expand Down Expand Up @@ -805,7 +805,7 @@ ConditionCategory:RegisterCondition(14, "DEBUFFTOOLTIP", {
end,
icon = "Interface\\Icons\\spell_shadow_lifedrain",
tcoords = CNDT.COMMON.standardtcoords,
hidden = TMW.isWrath,
hidden = not TMW.isRetail,
funcstr = function(c)
if CanUsePackedAuras(c) then
return [[AuraVariableNumberPacked(c.Unit, c.Spells.First, "isHarmful", ]] .. (tostring(c.Checked)) .. [[) c.Operator c.Level]]
Expand Down
10 changes: 7 additions & 3 deletions Components/Core/Conditions/Categories/Location.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ConditionCategory:RegisterCondition(1, "INSTANCE2", {

unit = false,
bitFlagTitle = L["CONDITIONPANEL_BITFLAGS_CHOOSEMENU_TYPES"],
bitFlags = TMW.isWrath and {
bitFlags = not TMW.isRetail and {
[01] = {order=01, text=L["CONDITIONPANEL_INSTANCETYPE_NONE"], space=true, }, -- None (Outside)
[02] = {order=02, text=BATTLEGROUND, }, -- Battleground
[03] = {order=03, text=ARENA, space=true, }, -- Arena
Expand Down Expand Up @@ -354,8 +354,12 @@ ConditionCategory:RegisterCondition(13, "LOC_CONTINENT", {
return t
else -- post-wow-80000
local t = {}
-- 946 is the cosmic map ID.
for id, mapInfo in pairs(C_Map.GetMapChildrenInfo(946, Enum.UIMapType.Continent, true)) do
for id, mapInfo in pairs(
-- 946 is the cosmic map ID.
C_Map.GetMapChildrenInfo(946, Enum.UIMapType.Continent, true) or
-- 947 is the Azeroth Map ID (will be used on pre-TBC versions)
C_Map.GetMapChildrenInfo(947, Enum.UIMapType.Continent, true)
) do
t[mapInfo.mapID] = mapInfo.name
end
return t
Expand Down
2 changes: 1 addition & 1 deletion Components/Core/Conditions/Categories/Misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ ConditionCategory:RegisterCondition(12, "TIMEOFDAY", {
--return CNDT.COMMON.formatSeconds(k*60)
end,
unit = false,
icon = TMW.isWrath and "Interface\\Icons\\inv_misc_pocketwatch_02" or "Interface\\Icons\\Ability_Racial_TimeIsMoney",
icon = not TMW.isRetail and "Interface\\Icons\\inv_misc_pocketwatch_02" or "Interface\\Icons\\Ability_Racial_TimeIsMoney",
tcoords = CNDT.COMMON.standardtcoords,
Env = {
GetDaysElapsedMinutes = function()
Expand Down
8 changes: 4 additions & 4 deletions Components/Core/Conditions/Categories/PlayerAttributes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ end)

ConditionCategory:RegisterSpacer(5.5)

local FirstStances = TMW.isWrath and {
local FirstStances = not TMW.isRetail and {
DRUID = 5487, -- Bear Form
PRIEST = 15473, -- Shadowform
ROGUE = 1784, -- Stealth
Expand Down Expand Up @@ -246,7 +246,7 @@ TMW:RegisterUpgrade(73019, {
})
local PetModes = {
PET_MODE_ASSIST = 1, -- Retail
PET_MODE_AGRESSIVE = 1, -- Wrath
PET_MODE_AGRESSIVE = 1, -- Wrath/Classic
PET_MODE_DEFENSIVE = 2,
PET_MODE_DEFENSIVEASSIST = 2, -- Added in 8.3
PET_MODE_PASSIVE = 3,
Expand All @@ -258,13 +258,13 @@ ConditionCategory:RegisterCondition(13.1, "PETMODE2", {
bitFlagTitle = L["CONDITIONPANEL_BITFLAGS_CHOOSEMENU_TYPES"],
bitFlags = {
[0] = L["CONDITIONPANEL_PETMODE_NONE"],
[1] = TMW.isWrath and PET_MODE_AGRESSIVE or PET_MODE_ASSIST,
[1] = not TMW.isRetail and PET_MODE_AGRESSIVE or PET_MODE_ASSIST,
[2] = PET_MODE_DEFENSIVE,
[3] = PET_MODE_PASSIVE
},

unit = false,
icon = TMW.isWrath and PET_PASSIVE_TEXTURE or PET_ASSIST_TEXTURE,
icon = not TMW.isRetail and PET_PASSIVE_TEXTURE or PET_ASSIST_TEXTURE,
tcoords = CNDT.COMMON.standardtcoords,

Env = {
Expand Down
19 changes: 19 additions & 0 deletions Components/Core/Conditions/Categories/PlayerAttributes_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ Module.stances = TMW.isWrath and {
[48263] = GetSpellInfo(48263), -- Frost
[48265] = GetSpellInfo(48265), -- Unholy
},
} or TMW.isClassic and {
WARRIOR = {
[2457] = GetSpellInfo(2457), -- Battle Stance
[71] = GetSpellInfo(71), -- Defensive Stance
[2458] = GetSpellInfo(2458), -- Berserker Stance
},
DRUID = {
[5487] = GetSpellInfo(5487), -- Bear Form
[768] = GetSpellInfo(768), -- Cat Form
[783] = GetSpellInfo(783), -- Travel Form
[24858] = GetSpellInfo(24858), -- Moonkin Form
[33891] = GetSpellInfo(33891), -- Incarnation: Tree of Life
},
PRIEST = {
[15473] = GetSpellInfo(15473), -- Shadowform
},
ROGUE = {
[1784] = GetSpellInfo(1784), -- Stealth
},
} or {
DRUID = {
[5487] = GetSpellInfo(5487), -- Bear Form
Expand Down
2 changes: 1 addition & 1 deletion Components/Core/Conditions/Categories/Resources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ ConditionCategory:RegisterCondition(102.2, "DEFAULT_MAX", {
end,
})

offset = TMW.tContains({"PALADIN", "PRIEST", "SHAMAN", "MAGE", "WARLOCK", "DRUID", "MONK", TMW.isWrath and "HUNTER" or nil}, pclass) and S or 0
offset = TMW.tContains({"PALADIN", "PRIEST", "SHAMAN", "MAGE", "WARLOCK", "DRUID", "MONK", not TMW.isRetail and "HUNTER" or nil}, pclass) and S or 0
ConditionCategory:RegisterCondition(103.0 - offset, "MANA", {
text = MANA .. " - " .. L["CONDITIONPANEL_PERCENT"],
percent = true,
Expand Down
150 changes: 82 additions & 68 deletions Components/Core/Conditions/Categories/Spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ ConditionCategory:RegisterCondition(20.1, "TOTEM_ANY", {
editbox:SetTexts(L["CNDT_TOTEMNAME"], L["CNDT_TOTEMNAME_DESC"])
editbox:SetLabel(L["CNDT_TOTEMNAME"] .. " " .. L["ICONMENU_CHOOSENAME_ORBLANK"])
end,
useSUG = TMW.isWrath and "totem" or true,
useSUG = TMW.isRetail and true or "totem",
allowMultipleSUGEntires = true,
formatter = TMW.C.Formatter.TIME_0ABSENT,
icon = "Interface\\ICONS\\spell_nature_groundingtotem",
Expand All @@ -830,7 +830,7 @@ for i = 1, 5 do
editbox:SetTexts(L["CNDT_TOTEMNAME"], L["CNDT_TOTEMNAME_DESC"])
editbox:SetLabel(L["CNDT_TOTEMNAME"] .. " " .. L["ICONMENU_CHOOSENAME_ORBLANK"])
end,
useSUG = TMW.isWrath and "totem" or true,
useSUG = TMW.isRetail and true or "totem",
allowMultipleSUGEntires = true,
formatter = TMW.C.Formatter.TIME_0ABSENT,
icon = totem and totem.texture or "Interface\\ICONS\\spell_nature_groundingtotem",
Expand All @@ -850,7 +850,7 @@ end

ConditionCategory:RegisterSpacer(30)

local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo
local UnitCastingInfo, UnitChannelInfo = TMW.UnitCastingInfo or UnitCastingInfo, TMW.UnitChannelInfo or UnitChannelInfo
Env.UnitCast = function(unit, level, matchname)
local name, _, _, _, _, _, _, notInterruptible = UnitCastingInfo(unit)
if not name then
Expand Down Expand Up @@ -905,6 +905,15 @@ Env.UnitCastPercent = function(unit, matchname)
return 1 - (remaining / duration), 1 / duration
end
local castEvents = function(ConditionObject, c)
if TMW.isClassic then
return
ConditionObject:GetUnitChangedEventString(CNDT:GetUnit(c.Unit)),

-- We can't check against the unit here because LibClassicCasterino's events don't
-- work like the blizzard events do - they don't fire with every valid unitID.
ConditionObject:GenerateNormalEventString("TMW_UNIT_CAST_UPDATE")
end

return
ConditionObject:GetUnitChangedEventString(CNDT:GetUnit(c.Unit)),
ConditionObject:GenerateNormalEventString("UNIT_SPELLCAST_START", CNDT:GetUnit(c.Unit)),
Expand All @@ -926,7 +935,7 @@ end
ConditionCategory:RegisterCondition(31, "CASTING", {
text = L["ICONMENU_CAST"],
tooltip = L["ICONMENU_CAST_DESC"],
min = 0,
min = TMW.isClassic and 1 or 0,
max = 2,
levelChecks = true,
nooperator = true,
Expand Down Expand Up @@ -1028,76 +1037,81 @@ end



-- No SpellIDs in the classic combat log.
-- Can't imagine how this condition would ever be useful in classic, so just excluding it.
if not TMW.isClassic then

local CastCounts
local function CASTCOUNT_COMBAT_LOG_EVENT_UNFILTERED()
local _, cleuEvent, _, sourceGUID, _, _, _, destGUID, _, destFlags, _, spellID, spellName = CombatLogGetCurrentEventInfo()
if cleuEvent == "SPELL_CAST_SUCCESS" then
spellName = spellName and strlowerCache[spellName]
local castsForGUID = CastCounts[sourceGUID]

if not castsForGUID then
castsForGUID = {}
CastCounts[sourceGUID] = castsForGUID
end
local CastCounts
local function CASTCOUNT_COMBAT_LOG_EVENT_UNFILTERED()
local _, cleuEvent, _, sourceGUID, _, _, _, destGUID, _, destFlags, _, spellID, spellName = CombatLogGetCurrentEventInfo()
if cleuEvent == "SPELL_CAST_SUCCESS" then
spellName = spellName and strlowerCache[spellName]
local castsForGUID = CastCounts[sourceGUID]

if not castsForGUID then
castsForGUID = {}
CastCounts[sourceGUID] = castsForGUID
end

castsForGUID[spellName] = spellID
castsForGUID[spellID] = (castsForGUID[spellID] or 0) + 1
TMW:Fire("TMW_CNDT_CASTCOUNT_UPDATE")

castsForGUID[spellName] = spellID
castsForGUID[spellID] = (castsForGUID[spellID] or 0) + 1
TMW:Fire("TMW_CNDT_CASTCOUNT_UPDATE")

elseif cleuEvent == "UNIT_DIED" then
if destFlags then
if bit_band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) ~= COMBATLOG_OBJECT_TYPE_PLAYER then
CastCounts[destGUID] = nil
TMW:Fire("TMW_CNDT_CASTCOUNT_UPDATE")
elseif cleuEvent == "UNIT_DIED" then
if destFlags then
if bit_band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) ~= COMBATLOG_OBJECT_TYPE_PLAYER then
CastCounts[destGUID] = nil
TMW:Fire("TMW_CNDT_CASTCOUNT_UPDATE")
end
end
end
end
end
function Env.UnitCastCount(...)
CastCounts = {}
CNDT.CastCounts = CastCounts
CNDT:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", CASTCOUNT_COMBAT_LOG_EVENT_UNFILTERED)

Env.UnitCastCount = function(unit, spell)
local GUID = UnitGUID(unit)
if not GUID then
return 0
end

local casts = CastCounts[GUID]
function Env.UnitCastCount(...)
CastCounts = {}
CNDT.CastCounts = CastCounts
CNDT:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED", CASTCOUNT_COMBAT_LOG_EVENT_UNFILTERED)

if not casts then
return 0
Env.UnitCastCount = function(unit, spell)
local GUID = UnitGUID(unit)
if not GUID then
return 0
end

local casts = CastCounts[GUID]

if not casts then
return 0
end

if not isNumber[spell] then
spell = casts[spell] or spell -- spell name keys have values that are spellIDs
end
return casts[spell] or 0
end

if not isNumber[spell] then
spell = casts[spell] or spell -- spell name keys have values that are spellIDs
end
return casts[spell] or 0
return Env.UnitCastCount(...)
end

return Env.UnitCastCount(...)
end
ConditionCategory:RegisterCondition(32, "CASTCOUNT", {
text = L["CONDITIONPANEL_CASTCOUNT"],
tooltip = L["CONDITIONPANEL_CASTCOUNT_DESC"],
range = 10,
icon = "Interface\\Icons\\spell_nature_lightningoverload",
name = function(editbox)
editbox:SetTexts(L["SPELLTOCHECK"], L["CNDT_ONLYFIRST"])
end,
useSUG = true,
tcoords = CNDT.COMMON.standardtcoords,
funcstr = function()
-- attempt initialization if it hasn't been done already
Env.UnitCastCount("none", "none")

return [[UnitCastCount(c.Unit, c.Spells.First) c.Operator c.Level]]
end,
events = function(ConditionObject, c)
return
ConditionObject:GetUnitChangedEventString(CNDT:GetUnit(c.Unit)),
ConditionObject:GenerateNormalEventString("TMW_CNDT_CASTCOUNT_UPDATE")
end,
})
ConditionCategory:RegisterCondition(32, "CASTCOUNT", {
text = L["CONDITIONPANEL_CASTCOUNT"],
tooltip = L["CONDITIONPANEL_CASTCOUNT_DESC"],
range = 10,
icon = "Interface\\Icons\\spell_nature_lightningoverload",
name = function(editbox)
editbox:SetTexts(L["SPELLTOCHECK"], L["CNDT_ONLYFIRST"])
end,
useSUG = true,
tcoords = CNDT.COMMON.standardtcoords,
funcstr = function()
-- attempt initialization if it hasn't been done already
Env.UnitCastCount("none", "none")

return [[UnitCastCount(c.Unit, c.Spells.First) c.Operator c.Level]]
end,
events = function(ConditionObject, c)
return
ConditionObject:GetUnitChangedEventString(CNDT:GetUnit(c.Unit)),
ConditionObject:GenerateNormalEventString("TMW_CNDT_CASTCOUNT_UPDATE")
end,
})

end
Loading

0 comments on commit 6249bee

Please sign in to comment.