Skip to content

Commit 2f76027

Browse files
committed
Fix removed escapePatternSymbols being made local
1 parent 536cf04 commit 2f76027

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

.luacheckrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4921,7 +4921,6 @@ globals = {
49214921
"VoiceChatShineFadeIn",
49224922
"VoiceChatShineFadeOut",
49234923
"WrapTextInColorCode",
4924-
"escapePatternSymbols",
49254924
"getglobal",
49264925
"getprinthandler",
49274926
"isRaidFinderDungeonDisplayable",

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"CreateSimpleTextureMarkup",
3535
"tContains",
3636
"FindValueInTableIf",
37-
"escapePatternSymbols",
3837
"ITEM_BNETACCOUNTBOUND",
3938
"PLAYER_LIST_DELIMITER",
4039
"BIND_TRADE_TIME_REMAINING",

RCLootCouncil.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Author: Potdisc
22
## Interface: 110207
3-
## Notes: Interface for running a Loot Council v3.18.1
3+
## Notes: Interface for running a Loot Council v3.18.2
44
## Title: RCLootCouncil
5-
## Version: 3.18.1
5+
## Version: 3.18.2
66
## SavedVariables: RCLootCouncilDB, RCLootCouncilLootDB
77
## AllowLoadGameType: standard
88
## OptionalDeps: LibStub, CallbackHandler-1.0, Ace3, lib-st, LibWindow-1.1, LibDialog-1.0

Utils/Utils.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ function Utils:Int2Bin(n)
371371
return string.format("%04s", result)
372372
end
373373

374+
local symbols = { "%%", "%*", "%+", "%-", "%?", "%(", "%)", "%[", "%]", "%$", "%^", } --% has to be escaped first or everything is ruined
375+
local replacements = { "%%%%", "%%%*", "%%%+", "%%%-", "%%%?", "%%%(", "%%%)", "%%%[", "%%%]", "%%%$", "%%%^", }
376+
--- Reimplementation of Blizzard function (make local in 11.2.7)
377+
function Utils:escapePatternSymbols(text)
378+
for i = 1, #symbols do
379+
text = text:gsub(symbols[i], replacements[i])
380+
end
381+
return text
382+
end
383+
374384
---@deprecated
375385
---@see Utils.Item.GetTransmittableItemString
376386
function Utils:GetTransmittableItemString(link)

__tests/wow_api/wow_api.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,16 +1123,6 @@ function _G.GetInventorySlotInfo(slot) end
11231123
-- Mocked with random item
11241124
function GetInventoryItemLink(unit, slot) return _G.Items_Array[math.random(#_G.Items_Array)] end
11251125

1126-
local symbols = { "%%", "%*", "%+", "%-", "%?", "%(", "%)", "%[", "%]", "%$", "%^", } --% has to be escaped first or everything is ruined
1127-
local replacements = { "%%%%", "%%%*", "%%%+", "%%%-", "%%%?", "%%%(", "%%%)", "%%%[", "%%%]", "%%%$", "%%%^", }
1128-
-- Defined in FrameXML/ChatFrame.lua
1129-
function escapePatternSymbols(text)
1130-
for i = 1, #symbols do
1131-
text = text:gsub(symbols[i], replacements[i])
1132-
end
1133-
return text
1134-
end
1135-
11361126
function FauxScrollFrame_Update()
11371127
end
11381128

core.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ function RCLootCouncil:GetContainerItemTradeTimeRemaining(container, slot)
14231423
tooltipForParsing:SetBagItem(container, slot) -- Set the tooltip content and show it, should hide the tooltip before function ends
14241424
if not tooltipForParsing:NumLines() or tooltipForParsing:NumLines() == 0 then return 0 end
14251425

1426-
local bindTradeTimeRemainingPattern = escapePatternSymbols(BIND_TRADE_TIME_REMAINING) -- Escape special characters in translations
1426+
local bindTradeTimeRemainingPattern = self.Utils:escapePatternSymbols(BIND_TRADE_TIME_REMAINING) -- Escape special characters in translations
14271427
:gsub("1%%%$", "") -- Remove weird insertion in RU '%1$s'
14281428
:gsub("%%%%s", "%(%.%+%)") -- Create capture group for the time string
14291429
local bounded = false

ml_core.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ function RCLootCouncilML:AnnounceItems(table)
10431043
local msg = db.announceItemString
10441044
for text, func in pairs(self.announceItemStrings) do
10451045
-- escapePatternSymbols is defined in FrameXML/ChatFrame.lua that escapes special characters.
1046-
msg = gsub(msg, text, escapePatternSymbols(tostring(func(v.session or k, link, v))))
1046+
msg = gsub(msg, text, addon.Utils:escapePatternSymbols(tostring(func(v.session or k, link, v))))
10471047
end
10481048
if v.isRoll then
10491049
msg = _G.ROLL..": "..msg
@@ -1103,7 +1103,8 @@ function RCLootCouncilML:AnnounceAward(name, link, response, roll, session, chan
11031103
local message = v.text
11041104
for text, func in pairs(self.awardStrings) do
11051105
-- escapePatternSymbols is defined in FrameXML/ChatFrame.lua that escapes special characters.
1106-
message = gsub(message, text, escapePatternSymbols(tostring(func(name, link, response, roll, session, owner))))
1106+
message = gsub(message, text,
1107+
addon.Utils:escapePatternSymbols(tostring(func(name, link, response, roll, session, owner))))
11071108
end
11081109
if changeAward then
11091110
message = "("..L["Change Award"]..") "..message

0 commit comments

Comments
 (0)