Skip to content

Commit b0f9316

Browse files
committed
Initial updates for Midnight Alpha
1 parent d03f389 commit b0f9316

File tree

5 files changed

+26
-37
lines changed

5 files changed

+26
-37
lines changed

MacroToolkit/MacroToolkit.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ local PanelTemplates_GetSelectedTab, StaticPopup_Show, SpellBook_GetSpellBookSlo
1515
local CreateFrame, GetBindingText, InCombatLockdown, CursorHasMacro, GetCursorInfo, ClearCursor = CreateFrame, GetBindingText, InCombatLockdown, CursorHasMacro, GetCursorInfo, ClearCursor
1616
local exFormat = "%s%s%s [btn:1]%s LeftButton 1;[btn:2]%s RightButton 1;[btn:3]%s MiddleButton 1;[btn:4]%s Button4 1;[btn:5]%s Button5 1"
1717

18+
local ChatEdit_InsertLink = ChatFrameUtil and ChatFrameUtil.InsertLink or ChatEdit_InsertLink
19+
local SendChatMessage = C_ChatInfo and C_ChatInfo.SendChatMessage or SendChatMessage
20+
1821
-- GLOBALS: ChatEdit_InsertLink StaticPopupDialogs SpellBookFrame MacroToolkitText MacroToolkitEnterText MacroToolkitFauxText MacroToolkitSelMacroName MacroToolkitSelBg MacroToolkitDelete
1922
-- GLOBALS: MacroToolkitExtend MacroToolkitShorten MacroToolkitSelMacroButton MacroToolkitLimit MacroToolkitEdit MacroToolkitCopy GameTooltip MacroToolkitBind MacroToolkitConditions
2023
-- GLOBALS: MacroToolkitShare MacroToolkitClear MacroToolkitBackup MacroToolkitBrokerIcon MacroToolkitNew MacroToolkitCSelMacroName MacroToolkitSelMacroButton.Icon MacroToolkitCText

MacroToolkit/MacroToolkit.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Interface: @toc-version-retail@
2-
## Interface-Retail: @toc-version-retail@
1+
## Interface: @toc-version-retail@,@toc-version-midnight@
2+
## Interface-Retail: @toc-version-retail@,@toc-version-midnight@
33
## Interface-Classic: @toc-version-classic@
44
## Interface-BCC: @toc-version-bcc@
55
## Interface-Wrath: @toc-version-wrath@

MacroToolkit/modules/initialise.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MT.click = _G.SLASH_CLICK1
1010
MT.target = _G.SLASH_TARGET1
1111
MT.MAX_EXTRA_MACROS = 1000 -- I'd like to see you try to hit this limit :P
1212
local L = MT.L
13-
local SendChatMessage, format = SendChatMessage, format
13+
local format = format
1414

1515
MT.frame:RegisterEvent("ADDON_LOADED")
1616
MT.frame:RegisterEvent("PLAYER_LOGIN")

MacroToolkit/modules/parser.lua

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,17 @@ local L = MT.L
99
MT.clist = {cast={}, script={}, click={}, console={}, target={}, castsequence={}, stopmacro={}}
1010
local SHOW_META, SHOWTOOLTIP_META = "#show", "#showtooltip"
1111

12-
local GetSpellInfo;
13-
do -- todo: rework after 11.0 release
14-
GetSpellInfo = _G.GetSpellInfo or function(spellID)
15-
if not spellID then
16-
return nil;
17-
end
18-
19-
local spellInfo = C_Spell.GetSpellInfo(spellID);
20-
if spellInfo then
21-
return spellInfo.name, nil, spellInfo.iconID, spellInfo.castTime, spellInfo.minRange, spellInfo.maxRange, spellInfo.spellID, spellInfo.originalIconID;
22-
end
23-
end
24-
end
25-
2612
local function trim(s) return string.match(s, "^%s*(.*%S)") or "" end
2713
local function escape(s) return (s:gsub("[%-%.%+%[%]%(%)%$%^%%%?%*]","%%%1"):gsub("%z","%%z")) end
2814

2915
local LibTalentTree = LibStub("LibTalentTree-1.0");
3016
local LibTalentTreeExists = LibTalentTree:IsCompatible();
31-
local spellCache;
32-
local function getSpellCache()
33-
if spellCache then return spellCache end
34-
spellCache = {}
17+
local spellNameCache;
18+
local function getSpellNameCache()
19+
if spellNameCache then return spellNameCache end
20+
spellNameCache = {}
3521
-- for now, just built based on current class' talents, and only for retail
36-
if not LibTalentTreeExists then return spellCache end
22+
if not LibTalentTreeExists then return spellNameCache end
3723

3824
local treeId = LibTalentTree:GetClassTreeID(UnitClassBase('player'));
3925
local nodes = C_Traits.GetTreeNodes(treeId);
@@ -43,24 +29,25 @@ local function getSpellCache()
4329
local entryInfo = LibTalentTree:GetEntryInfo(entryID);
4430
local definitionInfo = entryInfo and entryInfo.definitionID and C_Traits.GetDefinitionInfo(entryInfo.definitionID);
4531
local spellID = definitionInfo and definitionInfo.spellID;
46-
if spellID and GetSpellInfo(spellID) then
47-
spellCache[string.lower(GetSpellInfo(spellID))] = spellID;
32+
if spellID and C_Spell.GetSpellName(spellID) then
33+
spellNameCache[string.lower(C_Spell.GetSpellName(spellID))] = spellID;
4834
end
4935
end
5036
end
5137

52-
return spellCache;
38+
return spellNameCache;
5339
end
5440

55-
local function GetSpellInfoPlus(spellIDOrName)
56-
if GetSpellInfo(spellIDOrName) or tonumber(spellIDOrName, 10) then
57-
return GetSpellInfo(spellIDOrName)
41+
local function getSpellNameAndID(spellIDOrName)
42+
local spellInfo = C_Spell.GetSpellInfo(spellIDOrName);
43+
if spellInfo or tonumber(spellIDOrName, 10) then
44+
return spellInfo and spellInfo.name or nil, spellInfo and spellInfo.spellID or tonumber(spellIDOrName, 10);
5845
end
5946

60-
local cache = getSpellCache();
47+
local cache = getSpellNameCache();
6148
local spellID = cache[string.lower(spellIDOrName)];
6249
if spellID then
63-
return GetSpellInfo(spellID);
50+
return C_Spell.GetSpellName(spellID), spellID;
6451
end
6552
end
6653

@@ -312,7 +299,7 @@ local function validateParameters(parameters, commandtext)
312299
if string.sub(parameters, 1, 1) == "!" then parameters = string.sub(parameters, 2) end
313300
if isScript(commandtext) or isConsole(commandtext) or isClick(commandtext) then c = format("|c%s", MT.db.profile.scriptcolour)
314301
elseif isTarget(commandtext) then c = format("|c%s", MT.db.profile.targetcolour)
315-
elseif GetSpellInfoPlus(parameters) then c = format("|c%s", MT.db.profile.spellcolour)
302+
elseif getSpellNameAndID(parameters) then c = format("|c%s", MT.db.profile.spellcolour)
316303
elseif GetItemInfo(parameters) then c = format("|c%s", MT.db.profile.itemcolour)
317304
elseif isNumeric({parameters}) then c = format("|c%s", MT.db.profile.stringcolour)
318305
elseif MT.db.profile.unknown then err = format("%s: |c%s%s|r", L["Unknown parameter"], MT.db.profile.stringcolour, parameters) end
@@ -446,12 +433,12 @@ local function validateCondition(condition, optionArguments, parameters)
446433
if not msg then
447434
color = conditionColor
448435
if tr_condition == 'known' and optionArguments and optionArguments[1] then
449-
local name, _ = GetSpellInfoPlus(optionArguments[1])
436+
local name, _ = getSpellNameAndID(optionArguments[1])
450437
if not name then
451438
msg = format("%s: [%s%s|r:%s] - %s", L["Invalid condition"], conditionColor, tr_condition, optionArguments[1], "Unknown spell")
452439
isCondition = false
453440
elseif name:lower() ~= parameters:lower() and optionArguments[1]:lower() ~= parameters:lower() then
454-
local spellID = select(7, GetSpellInfoPlus(parameters))
441+
local _, spellID = getSpellNameAndID(parameters)
455442
msg = format(
456443
"Known spell mismatch: [%s%s%s|r:%s (%s)]\n %s%s",
457444
conditionColor,
@@ -584,8 +571,7 @@ function MT:ShortenMacro(macrotext)
584571
local spellNameOrID = string.gsub(v, "known:", "")
585572
-- if not a number
586573
if not tonumber(spellNameOrID) then
587-
local spellInfo = { GetSpellInfoPlus(spellNameOrID) }
588-
local spellName, spellID = spellInfo[1], spellInfo[7]
574+
local spellName, spellID = getSpellNameAndID(spellNameOrID)
589575
if spellID and string.len(spellID) < string.len(spellName) then v = format("known:%d", spellID) end
590576
end
591577
line = string.gsub(line, k, v)

MacroToolkitIcons/MacroToolkitIcons.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Interface: @toc-version-retail@
2-
## Interface-Retail: @toc-version-retail@
1+
## Interface: @toc-version-retail@,@toc-version-midnight@
2+
## Interface-Retail: @toc-version-retail@,@toc-version-midnight@
33
## Interface-Classic: @toc-version-classic@
44
## Interface-BCC: @toc-version-bcc@
55
## Interface-Wrath: @toc-version-wrath@

0 commit comments

Comments
 (0)