Skip to content

Commit

Permalink
Fixes #64 ADDON_ACTION_BLOCKED due to protected function GetPlaystyle…
Browse files Browse the repository at this point in the history
…String() by overwriting some of Blizzard's functions and breaking automatic group titles (code from github.com/ChrisKader/LFMPlus)
  • Loading branch information
0xbs committed Feb 2, 2022
1 parent bd2909e commit e31067e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions FixGetPlaystyleString.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- Overwrite C_LFGList.GetPlaystyleString with a custom implementation because the original function is
-- hardware protected, causing an error when a group tooltip is shown as we modify the search result list.
-- Original code from https://github.com/ChrisKader/LFMPlus/blob/36bca68720c724bf26cdf739614d99589edb8f77/core.lua#L38
-- but sligthly modified.
C_LFGList.GetPlaystyleString = function(playstyle, activityInfo)
if not ( activityInfo and playstyle and playstyle ~= 0
and C_LFGList.GetLfgCategoryInfo(activityInfo.categoryID).showPlaystyleDropdown ) then
return nil
end
local globalStringPrefix
if activityInfo.isMythicPlusActivity then
globalStringPrefix = "GROUP_FINDER_PVE_PLAYSTYLE"
elseif activityInfo.isRatedPvpActivity then
globalStringPrefix = "GROUP_FINDER_PVP_PLAYSTYLE"
elseif activityInfo.isCurrentRaidActivity then
globalStringPrefix = "GROUP_FINDER_PVE_RAID_PLAYSTYLE"
elseif activityInfo.isMythicActivity then
globalStringPrefix = "GROUP_FINDER_PVE_MYTHICZERO_PLAYSTYLE"
end
return globalStringPrefix and _G[globalStringPrefix .. tostring(playstyle)] or nil
end

-- By overwriting C_LFGList.GetPlaystyleString, we taint the code writing the tooltip (which does not matter),
-- and also code related to the dropdows where you can select the playstyle. The only relevant protected function
-- here is C_LFGList.SetEntryTitle, which is only called from LFGListEntryCreation_SetTitleFromActivityInfo.
LFGListEntryCreation_SetTitleFromActivityInfo = function(_) end
1 change: 1 addition & 0 deletions PremadeGroupsFilter.toc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Localization\zhCN.lua
Localization\zhTW.lua
Localization\ruRU.lua
Localization\esES.lua
FixGetPlaystyleString.lua
Modules\Util.lua
Modules\Difficulty.lua
Modules\Lockout.lua
Expand Down

0 comments on commit e31067e

Please sign in to comment.