WeakAuras

WeakAuras

200M Downloads

Weakauras changed global function "AbbreviateNumbers"

fingershi opened this issue · 1 comments

commented

Is there an existing issue for this?

  • I have searched the existing open and closed issues.

Description

In Types.lua, the codes below changes the global function AbbreviateNumbers
https://github.com/WeakAuras/WeakAuras2/blob/1be6f9ad0f7740cc122896d54743173e6ea9c6e1/WeakAuras/Types.lua#L157C1-L190

if gameLocale == "koKR" or gameLocale == "zhCN" or gameLocale == "zhTW" then
  -- Work around https://github.com/Stanzilla/WoWUIBugs/issues/515
  --
  local NUMBER_ABBREVIATION_DATA_FIXED={
    [1]={
      breakpoint = 10000 * 10000,
      significandDivisor = 10000 * 10000,
      abbreviation = SECOND_NUMBER_CAP_NO_SPACE,
      fractionDivisor = 1
    },
    [2]={
      breakpoint = 1000 * 10000,
      significandDivisor = 1000 * 10000,
      abbreviation = SECOND_NUMBER_CAP_NO_SPACE,
      fractionDivisor = 10
    },
    [3]={
      breakpoint = 10000,
      significandDivisor = 1000,
      abbreviation = FIRST_NUMBER_CAP_NO_SPACE,
      fractionDivisor = 10
    }
  }

  AbbreviateNumbers = function(value)
    for i, data in ipairs(NUMBER_ABBREVIATION_DATA_FIXED) do
      if value >= data.breakpoint then
              local finalValue = math.floor(value / data.significandDivisor) / data.fractionDivisor;
              return finalValue .. data.abbreviation;
      end
    end
    return tostring(value);
  end
end

It causes ADDON_ACTION_FORBIDDEN when changing guild rank of a member.
The code only takes effect if game locale is KR, CN or TW.

WeakAuras Version

WeakAuras 5.9.1

World of Warcraft Flavor

Retail (Default)

World of Warcraft Region

TW/Asia

Tested with only WeakAuras

  • Yes

Lua Error

20x [ADDON_ACTION_FORBIDDEN] 插件 'WeakAuras' 尝试调用保护功能 'SetGuildRankOrder()'。
[string "@!BugGrabber/BugGrabber.lua"]:481: in function <!BugGrabber/BugGrabber.lua:481>
[string "=[C]"]: in function `SetGuildRankOrder'
[string "@Blizzard_Communities/GuildRoster.lua"]:174: in function `func'
[string "@SharedXML/UIDropDownMenu.lua"]:1009: in function `UIDropDownMenuButton_OnClick'
[string "*UIDropDownMenuTemplates.xml:131_OnClick"]:1: in function <[string "*UIDropDownMenuTemplates.xml:131_OnClick"]:1>

Locals:
_ = Frame {
 RegisterEvent = <function> defined @!BugGrabber/BugGrabber.lua:487
 0 = <userdata>
 UnregisterEvent = <function> defined @!BugGrabber/BugGrabber.lua:487
 SetScript = <function> defined @!BugGrabber/BugGrabber.lua:487
}
event = "ADDON_ACTION_FORBIDDEN"
events = <table> {
 ADDON_ACTION_BLOCKED = <function> defined @!BugGrabber/BugGrabber.lua:553
 ADDON_ACTION_FORBIDDEN = <function> defined @!BugGrabber/BugGrabber.lua:553
 PLAYER_LOGIN = <function> defined @!BugGrabber/BugGrabber.lua:547
 LUA_WARNING = <function> defined @!BugGrabber/BugGrabber.lua:562
 ADDON_LOADED = <function> defined @!BugGrabber/BugGrabber.lua:507
}

Reproduction Steps

Change a guild rank of some members

Last Good Version

WeakAuras 5.8.7-44-g78b941f(alpha)

Screenshots

No response

Export String

No response

commented

Ah that was unintentionally, thanks for the report.